use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class ObjectNotFoundExceptionTest method testExceptionMessageConstructor.
@Test
public void testExceptionMessageConstructor() throws Exception {
ObjectNotFoundException exception = new ObjectNotFoundException(TEST_MESSAGE_1);
assertTrue(exception.getMessage().equals(TEST_MESSAGE_1));
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class ObjectNotFoundExceptionTest method testExceptionThrowableConstructor.
@Test
public void testExceptionThrowableConstructor() throws Exception {
Exception exception = new Exception(TEST_MESSAGE_2);
ObjectNotFoundException ObjectNotFoundException = new ObjectNotFoundException(exception);
assertTrue(ObjectNotFoundException.getCause().getMessage().equals(TEST_MESSAGE_2));
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class NamespaceServiceTest method testDeleteNamespaceNoExists.
@Test
public void testDeleteNamespaceNoExists() throws Exception {
// Try to get a non-existing namespace.
try {
namespaceService.deleteNamespace(new NamespaceKey(NAMESPACE));
fail("Should throw an ObjectNotFoundException when namespace doesn't exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Namespace \"%s\" doesn't exist.", NAMESPACE), e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class JobServiceTest method testCreateJobWithS3PropertiesDefinitionObjectKeyNotFoundThrows.
/**
* Creates a job where the definition's S3 object key does not exist. It should throw a not found exception.
*
* @throws Exception
*/
@Test
public void testCreateJobWithS3PropertiesDefinitionObjectKeyNotFoundThrows() throws Exception {
Parameter jobDefinitionS3Parameter = new Parameter("name1", "value1");
Parameter jobCreateRequestS3Parameter = new Parameter("name2", "value2");
String s3BucketName = "s3BucketName";
S3PropertiesLocation jobDefinitionS3PropertiesLocation = getS3PropertiesLocation(s3BucketName, "jobDefinitionObjectKey", jobDefinitionS3Parameter);
S3PropertiesLocation jobCreateRequestS3PropertiesLocation = getS3PropertiesLocation(s3BucketName, "jobCreationObjectKey", jobCreateRequestS3Parameter);
jobDefinitionS3PropertiesLocation.setKey("NOT_FOUND");
try {
createJobWithParameters(jobDefinitionS3PropertiesLocation, null, jobCreateRequestS3PropertiesLocation, null);
Assert.fail("expected ObjectNotFoundException, but no exception was thrown");
} catch (Exception e) {
Assert.assertEquals("thrown exception type", ObjectNotFoundException.class, e.getClass());
Assert.assertEquals("thrown exception message", "Specified S3 object key '" + jobDefinitionS3PropertiesLocation.getKey() + "' does not exist.", e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class JobServiceTest method testSignalJobNoExists.
@Test
public void testSignalJobNoExists() throws Exception {
// Signal job with job id that does not exist.
try {
jobService.signalJob(new JobSignalRequest("job_does_not_exist", "receivetask1", null, null));
fail("Should throw an ObjectNotFoundException.");
} catch (ObjectNotFoundException ex) {
assertEquals(String.format("No job found for matching job id: \"%s\" and receive task id: \"%s\".", "job_does_not_exist", "receivetask1"), ex.getMessage());
}
// Signal job with receive task that does not exist.
jobDefinitionServiceTestHelper.createJobDefinition(ACTIVITI_XML_TEST_RECEIVE_TASK_WITH_CLASSPATH);
// Start the job.
Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME));
try {
// Job should be waiting at Receive task.
Job jobGet = jobService.getJob(job.getId(), false);
assertEquals(JobStatusEnum.RUNNING, jobGet.getStatus());
assertEquals("receivetask1", jobGet.getCurrentWorkflowStep().getId());
jobService.signalJob(new JobSignalRequest(job.getId(), "receivetask_does_not_exist", null, null));
fail("Should throw an ObjectNotFoundException.");
} catch (ObjectNotFoundException ex) {
assertEquals(String.format("No job found for matching job id: \"%s\" and receive task id: \"%s\".", job.getId(), "receivetask_does_not_exist"), ex.getMessage());
}
}
Aggregations