use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.
the class NodeManagerTest method testException.
@Test
public void testException() throws HyracksException {
IResourceManager resourceManager = new ResourceManager();
INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
NodeControllerState ncState1 = mockNodeControllerState(NODE1, true);
boolean invalidNetworkAddress = false;
// Verifies states after a failure during adding nodes.
try {
nodeManager.addNode(NODE1, ncState1);
} catch (HyracksException e) {
invalidNetworkAddress = e.getErrorCode() == ErrorCode.INVALID_NETWORK_ADDRESS;
}
Assert.assertTrue(invalidNetworkAddress);
// Verifies that the cluster is empty.
verifyEmptyCluster(resourceManager, nodeManager);
}
use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.
the class NodeManagerTest method testNullNode.
@Test
public void testNullNode() throws HyracksException {
IResourceManager resourceManager = new ResourceManager();
INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
boolean invalidParameter = false;
// Verifies states after a failure during adding nodes.
try {
nodeManager.addNode(null, null);
} catch (HyracksException e) {
invalidParameter = e.getErrorCode() == ErrorCode.INVALID_INPUT_PARAMETER;
}
Assert.assertTrue(invalidParameter);
// Verifies that the cluster is empty.
verifyEmptyCluster(resourceManager, nodeManager);
}
use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.
the class NodeManagerTest method testNormal.
@Test
public void testNormal() throws HyracksException {
IResourceManager resourceManager = new ResourceManager();
INodeManager nodeManager = new NodeManager(makeCCConfig(), resourceManager);
NodeControllerState ncState1 = mockNodeControllerState(NODE1, false);
NodeControllerState ncState2 = mockNodeControllerState(NODE2, false);
// Verifies states after adding nodes.
nodeManager.addNode(NODE1, ncState1);
nodeManager.addNode(NODE2, ncState2);
Assert.assertTrue(nodeManager.getIpAddressNodeNameMap().size() == 1);
Assert.assertTrue(nodeManager.getAllNodeIds().size() == 2);
Assert.assertTrue(nodeManager.getAllNodeControllerStates().size() == 2);
Assert.assertTrue(nodeManager.getNodeControllerState(NODE1) == ncState1);
Assert.assertTrue(nodeManager.getNodeControllerState(NODE2) == ncState2);
Assert.assertTrue(resourceManager.getCurrentCapacity().getAggregatedMemoryByteSize() == NODE_MEMORY_SIZE * 2);
Assert.assertTrue(resourceManager.getCurrentCapacity().getAggregatedCores() == NODE_CORES * 2);
Assert.assertTrue(resourceManager.getMaximumCapacity().getAggregatedMemoryByteSize() == NODE_MEMORY_SIZE * 2);
Assert.assertTrue(resourceManager.getMaximumCapacity().getAggregatedCores() == NODE_CORES * 2);
// Verifies states after removing dead nodes.
nodeManager.removeDeadNodes();
verifyEmptyCluster(resourceManager, nodeManager);
}
use of org.apache.hyracks.control.cc.scheduler.ResourceManager in project asterixdb by apache.
the class JobCapacityControllerTest method makeResourceManagerWithCapacity.
private IResourceManager makeResourceManagerWithCapacity(long memorySize, int cores) throws HyracksException {
IResourceManager resourceManager = new ResourceManager();
resourceManager.update("node1", new NodeCapacity(memorySize, cores));
return resourceManager;
}
Aggregations