use of org.finra.herd.model.api.xml.EmrClusterDefinitionKeys in project herd by FINRAOS.
the class EmrClusterDefinitionServiceImpl method getEmrClusterDefinitions.
@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.READ)
@Override
public EmrClusterDefinitionKeys getEmrClusterDefinitions(String namespace) {
// Validate the namespace.
Assert.hasText(namespace, "A namespace must be specified.");
// Retrieve and return the list of EMR cluster definition keys.
EmrClusterDefinitionKeys emrClusterDefinitionKeys = new EmrClusterDefinitionKeys();
emrClusterDefinitionKeys.getEmrClusterDefinitionKeys().addAll(emrClusterDefinitionDao.getEmrClusterDefinitionsByNamespace(namespace.trim()));
return emrClusterDefinitionKeys;
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionKeys in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testGetEmrClusterDefinitionsLowerCaseParameters.
@Test
public void testGetEmrClusterDefinitionsLowerCaseParameters() throws Exception {
// Create and persist an EMR cluster definition entity.
emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE), EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()));
// Create an EMR cluster definition key.
EmrClusterDefinitionKey emrClusterDefinitionKey = new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
// Retrieve EMR cluster definition keys by passing namespace parameter value in lowercase.
assertEquals(new EmrClusterDefinitionKeys(Arrays.asList(emrClusterDefinitionKey)), emrClusterDefinitionService.getEmrClusterDefinitions(NAMESPACE.toLowerCase()));
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionKeys in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testGetEmrClusterDefinitionsUpperCaseParameters.
@Test
public void testGetEmrClusterDefinitionsUpperCaseParameters() throws Exception {
// Create and persist an EMR cluster definition entity.
emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE), EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()));
// Create an EMR cluster definition key.
EmrClusterDefinitionKey emrClusterDefinitionKey = new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
// Retrieve EMR cluster definition keys by passing namespace parameter value in uppercase.
assertEquals(new EmrClusterDefinitionKeys(Arrays.asList(emrClusterDefinitionKey)), emrClusterDefinitionService.getEmrClusterDefinitions(NAMESPACE.toUpperCase()));
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionKeys in project herd by FINRAOS.
the class EmrClusterDefinitionRestControllerTest method testGetEmrClusterDefinitions.
@Test
public void testGetEmrClusterDefinitions() throws Exception {
// Create an EMR cluster definition keys.
EmrClusterDefinitionKeys emrClusterDefinitionKeys = new EmrClusterDefinitionKeys(Arrays.asList(new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME)));
// Mock the external calls.
when(emrClusterDefinitionService.getEmrClusterDefinitions(NAMESPACE)).thenReturn(emrClusterDefinitionKeys);
// Call the method under test.
EmrClusterDefinitionKeys result = emrClusterDefinitionRestController.getEmrClusterDefinitions(NAMESPACE);
// Verify the external calls.
verify(emrClusterDefinitionService).getEmrClusterDefinitions(NAMESPACE);
verifyNoMoreInteractionsHelper();
// Validate the results.
assertEquals(emrClusterDefinitionKeys, result);
}
use of org.finra.herd.model.api.xml.EmrClusterDefinitionKeys in project herd by FINRAOS.
the class EmrClusterDefinitionServiceTest method testGetEmrClusterDefinitionsTrimParameters.
@Test
public void testGetEmrClusterDefinitionsTrimParameters() throws Exception {
// Create and persist an EMR cluster definition entity.
emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE), EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()));
// Create an EMR cluster definition key.
EmrClusterDefinitionKey emrClusterDefinitionKey = new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
// Retrieve EMR cluster definition keys by passing namespace with leading and trailing whitespace characters.
assertEquals(new EmrClusterDefinitionKeys(Arrays.asList(emrClusterDefinitionKey)), emrClusterDefinitionService.getEmrClusterDefinitions(addWhitespace(NAMESPACE)));
}
Aggregations