use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.
the class TestStorageManagerComponentHolder method getLocalResourceRepository.
public static synchronized ILocalResourceRepository getLocalResourceRepository() {
if (localResourceRepository == null) {
try {
ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
localResourceRepository = localResourceRepositoryFactory.createRepository();
} catch (HyracksException e) {
//In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
throw new IllegalArgumentException();
}
}
return localResourceRepository;
}
use of org.apache.hyracks.api.exceptions.HyracksException in project asterixdb by apache.
the class TestStorageManagerComponentHolder method getResourceIdFactory.
public static synchronized ResourceIdFactory getResourceIdFactory() {
if (resourceIdFactory == null) {
try {
ResourceIdFactoryProvider resourceIdFactoryFactory = new ResourceIdFactoryProvider(getLocalResourceRepository());
resourceIdFactory = resourceIdFactoryFactory.createResourceIdFactory();
} catch (HyracksException e) {
//In order not to change the IStorageManagerInterface due to the test code, throw runtime exception.
throw new IllegalArgumentException();
}
}
return resourceIdFactory;
}
use of org.apache.hyracks.api.exceptions.HyracksException 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.api.exceptions.HyracksException 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.api.exceptions.HyracksException in project asterixdb by apache.
the class JobCleanupWork method run.
@Override
public void run() {
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Cleanup for JobRun with id: " + jobId);
}
try {
JobRun jobRun = jobManager.get(jobId);
jobManager.prepareComplete(jobRun, status, exceptions);
} catch (HyracksException e) {
// Fail the job with the caught exception during final completion.
JobRun run = jobManager.get(jobId);
run.getExceptions().add(e);
run.setStatus(JobStatus.FAILURE, run.getExceptions());
}
}
Aggregations