Search in sources :

Example 11 with EmrClusterDefinitionInformation

use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.

the class EmrClusterDefinitionServiceTest method testGetEmrClusterDefinitionUpperCaseParameters.

@Test
public void testGetEmrClusterDefinitionUpperCaseParameters() throws Exception {
    // Create and persist the namespace entity with a lowercase name.
    NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE.toLowerCase());
    // Create and persist the EMR cluster definition entity with a lowercase name.
    EmrClusterDefinitionEntity emrClusterDefinitionEntity = emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME.toLowerCase(), getTestEmrClusterDefinitionConfigurationXml(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
    // Get an EMR cluster definition by passing the EMR cluster definition name key parameters in upper case.
    EmrClusterDefinitionInformation resultEmrClusterDefinition = emrClusterDefinitionService.getEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE.toUpperCase(), EMR_CLUSTER_DEFINITION_NAME.toUpperCase()));
    // Validate the returned object.
    validateEmrClusterDefinition(emrClusterDefinitionEntity.getId(), NAMESPACE.toLowerCase(), EMR_CLUSTER_DEFINITION_NAME.toLowerCase(), getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), resultEmrClusterDefinition);
}
Also used : NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) EmrClusterDefinitionKey(org.finra.herd.model.api.xml.EmrClusterDefinitionKey) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) EmrClusterDefinitionEntity(org.finra.herd.model.jpa.EmrClusterDefinitionEntity) Test(org.junit.Test)

Example 12 with EmrClusterDefinitionInformation

use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.

the class EmrClusterDefinitionServiceTest method testCreateEmrClusterDefinition.

@Test
public void testCreateEmrClusterDefinition() throws Exception {
    // Create and persist the namespace entity.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    // Create an EMR cluster definition create request.
    EmrClusterDefinitionCreateRequest request = createEmrClusterDefinitionCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
    // Create an EMR cluster definition.
    EmrClusterDefinitionInformation resultEmrClusterDefinition = emrClusterDefinitionService.createEmrClusterDefinition(request);
    // Validate the returned object.
    validateEmrClusterDefinition(null, NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), resultEmrClusterDefinition);
}
Also used : EmrClusterDefinitionCreateRequest(org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) Test(org.junit.Test)

Example 13 with EmrClusterDefinitionInformation

use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.

the class EmrClusterDefinitionServiceTest method testCreateEmrClusterDefinitionUpperCaseParameters.

@Test
public void testCreateEmrClusterDefinitionUpperCaseParameters() throws Exception {
    // Create and persist the namespace entity with a lowercase name.
    namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE.toLowerCase());
    // Create an EMR cluster definition create request by passing the EMR cluster definition name key parameters in upper case.
    EmrClusterDefinitionCreateRequest request = createEmrClusterDefinitionCreateRequest(NAMESPACE.toUpperCase(), EMR_CLUSTER_DEFINITION_NAME.toUpperCase(), getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
    // Create an EMR cluster definition.
    EmrClusterDefinitionInformation resultEmrClusterDefinition = emrClusterDefinitionService.createEmrClusterDefinition(request);
    // Validate the returned object.
    validateEmrClusterDefinition(null, NAMESPACE.toLowerCase(), EMR_CLUSTER_DEFINITION_NAME.toUpperCase(), getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), resultEmrClusterDefinition);
}
Also used : EmrClusterDefinitionCreateRequest(org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) Test(org.junit.Test)

Example 14 with EmrClusterDefinitionInformation

use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.

the class EmrClusterDefinitionRestControllerTest method testUpdateEmrClusterDefinition.

@Test
public void testUpdateEmrClusterDefinition() throws Exception {
    // Create an EMR cluster definition key.
    EmrClusterDefinitionKey emrClusterDefinitionKey = new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
    // Create an EMR cluster definition.
    EmrClusterDefinition emrClusterDefinition = new EmrClusterDefinition();
    // Create an EMR cluster definition update request.
    EmrClusterDefinitionUpdateRequest emrClusterDefinitionUpdateRequest = new EmrClusterDefinitionUpdateRequest(emrClusterDefinition);
    // Create an object that holds EMR cluster definition information.
    EmrClusterDefinitionInformation emrClusterDefinitionInformation = new EmrClusterDefinitionInformation(ID, emrClusterDefinitionKey, emrClusterDefinition);
    // Mock the external calls.
    when(emrClusterDefinitionService.updateEmrClusterDefinition(emrClusterDefinitionKey, emrClusterDefinitionUpdateRequest)).thenReturn(emrClusterDefinitionInformation);
    // Call the method under test.
    EmrClusterDefinitionInformation result = emrClusterDefinitionRestController.updateEmrClusterDefinition(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, emrClusterDefinitionUpdateRequest);
    // Verify the external calls.
    verify(emrClusterDefinitionService).updateEmrClusterDefinition(emrClusterDefinitionKey, emrClusterDefinitionUpdateRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(emrClusterDefinitionInformation, result);
}
Also used : EmrClusterDefinition(org.finra.herd.model.api.xml.EmrClusterDefinition) EmrClusterDefinitionKey(org.finra.herd.model.api.xml.EmrClusterDefinitionKey) EmrClusterDefinitionUpdateRequest(org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) Test(org.junit.Test)

Example 15 with EmrClusterDefinitionInformation

use of org.finra.herd.model.api.xml.EmrClusterDefinitionInformation in project herd by FINRAOS.

the class EmrClusterDefinitionRestControllerTest method testGetEmrClusterDefinition.

@Test
public void testGetEmrClusterDefinition() throws Exception {
    // Create an EMR cluster definition key.
    EmrClusterDefinitionKey emrClusterDefinitionKey = new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
    // Create an EMR cluster definition.
    EmrClusterDefinition emrClusterDefinition = new EmrClusterDefinition();
    // Create an object that holds EMR cluster definition information.
    EmrClusterDefinitionInformation emrClusterDefinitionInformation = new EmrClusterDefinitionInformation(ID, emrClusterDefinitionKey, emrClusterDefinition);
    // Mock the external calls.
    when(emrClusterDefinitionService.getEmrClusterDefinition(emrClusterDefinitionKey)).thenReturn(emrClusterDefinitionInformation);
    // Call the method under test.
    EmrClusterDefinitionInformation result = emrClusterDefinitionRestController.getEmrClusterDefinition(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME);
    // Verify the external calls.
    verify(emrClusterDefinitionService).getEmrClusterDefinition(emrClusterDefinitionKey);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(emrClusterDefinitionInformation, result);
}
Also used : EmrClusterDefinition(org.finra.herd.model.api.xml.EmrClusterDefinition) EmrClusterDefinitionKey(org.finra.herd.model.api.xml.EmrClusterDefinitionKey) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) Test(org.junit.Test)

Aggregations

EmrClusterDefinitionInformation (org.finra.herd.model.api.xml.EmrClusterDefinitionInformation)23 Test (org.junit.Test)22 EmrClusterDefinitionKey (org.finra.herd.model.api.xml.EmrClusterDefinitionKey)17 EmrClusterDefinitionEntity (org.finra.herd.model.jpa.EmrClusterDefinitionEntity)12 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)12 EmrClusterDefinitionCreateRequest (org.finra.herd.model.api.xml.EmrClusterDefinitionCreateRequest)7 EmrClusterDefinition (org.finra.herd.model.api.xml.EmrClusterDefinition)5 EmrClusterDefinitionUpdateRequest (org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest)2 HashMap (java.util.HashMap)1 InstanceDefinition (org.finra.herd.model.api.xml.InstanceDefinition)1