use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class BusinessObjectDefinitionTagServiceTest method testDeleteBusinessObjectDefinitionTagTagNoExists.
@Test
public void testDeleteBusinessObjectDefinitionTagTagNoExists() {
// Try to create a non-existing business object definition tag.
try {
businessObjectDefinitionTagService.deleteBusinessObjectDefinitionTag(new BusinessObjectDefinitionTagKey(new BusinessObjectDefinitionKey(BDEF_NAMESPACE, BDEF_NAME), new TagKey(TAG_TYPE, TAG_CODE)));
fail();
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Tag with tag type \"%s\" and code \"%s\" does not exist for business object definition {%s}.", TAG_TYPE, TAG_CODE, businessObjectDefinitionServiceTestHelper.getExpectedBusinessObjectDefinitionKeyAsString(BDEF_NAMESPACE, BDEF_NAME)), e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class EmrServiceTest method testEmrServiceMethodsNewTx.
/**
* This method is to get the coverage for the emr service method that starts the new transaction.
*/
@Test
public void testEmrServiceMethodsNewTx() throws Exception {
EmrClusterCreateRequest request = getNewEmrClusterCreateRequest();
try {
emrServiceImpl.createCluster(request);
fail("Should throw a ObjectNotFoundException.");
} catch (ObjectNotFoundException e) {
assertEquals("Namespace \"" + NAMESPACE + "\" doesn't exist.", e.getMessage());
}
try {
EmrShellStepAddRequest stepRequest = getNewEmrShellStepAddRequest(request.getEmrClusterName());
emrServiceImpl.addStepToCluster(stepRequest);
fail("Should throw a ObjectNotFoundException.");
} catch (ObjectNotFoundException e) {
assertEquals("Namespace \"" + NAMESPACE + "\" doesn't exist.", e.getMessage());
}
try {
EmrMasterSecurityGroupAddRequest emrMasterSecurityGroupAddRequest = getNewEmrAddSecurityGroupMasterRequest(request.getEmrClusterName());
emrServiceImpl.addSecurityGroupsToClusterMaster(emrMasterSecurityGroupAddRequest);
fail("Should throw a ObjectNotFoundException.");
} catch (ObjectNotFoundException e) {
assertEquals("Namespace \"" + NAMESPACE + "\" doesn't exist.", e.getMessage());
}
try {
EmrClusterAlternateKeyDto emrClusterAlternateKeyDto = EmrClusterAlternateKeyDto.builder().withNamespace(NAMESPACE).withEmrClusterDefinitionName(EMR_CLUSTER_DEFINITION_NAME).withEmrClusterName("test_cluster").build();
emrServiceImpl.getCluster(emrClusterAlternateKeyDto, null, null, false, null, false);
fail("Should throw a ObjectNotFoundException.");
} catch (ObjectNotFoundException e) {
assertEquals("Namespace \"" + NAMESPACE + "\" doesn't exist.", e.getMessage());
}
try {
EmrClusterAlternateKeyDto emrClusterAlternateKeyDto = EmrClusterAlternateKeyDto.builder().withNamespace(NAMESPACE).withEmrClusterDefinitionName(EMR_CLUSTER_DEFINITION_NAME).withEmrClusterName("test_cluster").build();
emrServiceImpl.terminateCluster(emrClusterAlternateKeyDto, false, null, null);
fail("Should throw a ObjectNotFoundException.");
} catch (ObjectNotFoundException e) {
assertEquals("Namespace \"" + NAMESPACE + "\" doesn't exist.", e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class EmrServiceWithAccountIdTest method testCreateEmrClusterWithAccountIdAccountNoExists.
@Test
public void testCreateEmrClusterWithAccountIdAccountNoExists() throws Exception {
// Create the namespace entity.
NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
String definitionXml = IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream());
EmrClusterDefinition expectedEmrClusterDefinition = xmlHelper.unmarshallXmlToObject(EmrClusterDefinition.class, definitionXml);
emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, definitionXml);
// Create a new EMR cluster create request and add an account id to the EMR cluster definition override.
EmrClusterCreateRequest emrClusterCreateRequest = getNewEmrClusterCreateRequestWithAccountId();
EmrClusterDefinition emrClusterDefinitionOverride = new EmrClusterDefinition();
emrClusterCreateRequest.setEmrClusterDefinitionOverride(emrClusterDefinitionOverride);
emrClusterDefinitionOverride.setAccountId(AWS_ACCOUNT_ID);
// Try to create an EMR cluster using a non-existing AWS account.
try {
emrService.createCluster(emrClusterCreateRequest);
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Trusting AWS account with id \"%s\" doesn't exist.", AWS_ACCOUNT_ID), e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class ExpectedPartitionValueServiceTest method testCreateExpectedPartitionValuesPartitionKeyGroupNoExists.
@Test
public void testCreateExpectedPartitionValuesPartitionKeyGroupNoExists() {
// Try to perform a create using a non-existing partition key group name.
ExpectedPartitionValuesCreateRequest request = expectedPartitionValueServiceTestHelper.createExpectedPartitionValuesCreateRequest("I_DO_NOT_EXIST", expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
try {
expectedPartitionValueService.createExpectedPartitionValues(request);
fail("Should throw an IllegalArgumentException when partition key group does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Partition key group \"%s\" doesn't exist.", request.getPartitionKeyGroupKey().getPartitionKeyGroupName()), e.getMessage());
}
}
use of org.finra.herd.model.ObjectNotFoundException in project herd by FINRAOS.
the class ExpectedPartitionValueServiceTest method testDeleteExpectedPartitionValuesPartitionKeyGroupNoExists.
@Test
public void testDeleteExpectedPartitionValuesPartitionKeyGroupNoExists() {
// Try to perform a delete using a non-existing partition key group name.
ExpectedPartitionValuesDeleteRequest request = expectedPartitionValueServiceTestHelper.createExpectedPartitionValuesDeleteRequest("I_DO_NOT_EXIST", expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
try {
expectedPartitionValueService.deleteExpectedPartitionValues(request);
fail("Should throw an IllegalArgumentException when partition key group does not exist.");
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Partition key group \"%s\" doesn't exist.", request.getPartitionKeyGroupKey().getPartitionKeyGroupName()), e.getMessage());
}
}
Aggregations