Skip to content

Commit

Permalink
[SMALLFIX]Change the AllocatorFactory.java using "static"
Browse files Browse the repository at this point in the history
pr-link: #9075
change-id: cid-2c795e884707bd169ce53ebd9bf9e35e5a5d499d
  • Loading branch information
naive4E4A55 authored and alluxio-bot committed May 14, 2019
1 parent d767602 commit 7e7c2c1
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -11,13 +11,14 @@


package alluxio.worker.block.allocator; package alluxio.worker.block.allocator;


import static org.junit.Assert.assertTrue;

import alluxio.conf.ServerConfiguration; import alluxio.conf.ServerConfiguration;
import alluxio.conf.PropertyKey; import alluxio.conf.PropertyKey;
import alluxio.worker.block.BlockMetadataManagerView; import alluxio.worker.block.BlockMetadataManagerView;
import alluxio.worker.block.TieredBlockStoreTestUtils; import alluxio.worker.block.TieredBlockStoreTestUtils;


import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
Expand Down Expand Up @@ -56,7 +57,7 @@ public void after() {
public void createGreedyAllocator() { public void createGreedyAllocator() {
ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS, GreedyAllocator.class.getName()); ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS, GreedyAllocator.class.getName());
Allocator allocator = Allocator.Factory.create(mManagerView); Allocator allocator = Allocator.Factory.create(mManagerView);
Assert.assertTrue(allocator instanceof GreedyAllocator); assertTrue(allocator instanceof GreedyAllocator);
} }


/** /**
Expand All @@ -67,7 +68,7 @@ public void createGreedyAllocator() {
public void createMaxFreeAllocator() { public void createMaxFreeAllocator() {
ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS, MaxFreeAllocator.class.getName()); ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS, MaxFreeAllocator.class.getName());
Allocator allocator = Allocator.Factory.create(mManagerView); Allocator allocator = Allocator.Factory.create(mManagerView);
Assert.assertTrue(allocator instanceof MaxFreeAllocator); assertTrue(allocator instanceof MaxFreeAllocator);
} }


/** /**
Expand All @@ -79,7 +80,7 @@ public void createRoundRobinAllocator() {
ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS, ServerConfiguration.set(PropertyKey.WORKER_ALLOCATOR_CLASS,
RoundRobinAllocator.class.getName()); RoundRobinAllocator.class.getName());
Allocator allocator = Allocator.Factory.create(mManagerView); Allocator allocator = Allocator.Factory.create(mManagerView);
Assert.assertTrue(allocator instanceof RoundRobinAllocator); assertTrue(allocator instanceof RoundRobinAllocator);
} }


/** /**
Expand All @@ -91,6 +92,6 @@ public void createDefaultAllocator() {
// Create a new instance of Alluxio configuration with original properties to test the default // Create a new instance of Alluxio configuration with original properties to test the default
// behavior of create. // behavior of create.
Allocator allocator = Allocator.Factory.create(mManagerView); Allocator allocator = Allocator.Factory.create(mManagerView);
Assert.assertTrue(allocator instanceof MaxFreeAllocator); assertTrue(allocator instanceof MaxFreeAllocator);
} }
} }

0 comments on commit 7e7c2c1

Please sign in to comment.