Search in sources :

Example 1 with EmrClusterDefinitionUpdateRequest

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

the class EmrClusterDefinitionServiceTest method testUpdateEmrClusterDefinition.

@Test
public void testUpdateEmrClusterDefinition() throws Exception {
    // Create and persist the namespace entity.
    NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
    // Create and persist the EMR cluster definition entity using minimal test XML configuration.
    EmrClusterDefinitionEntity emrClusterDefinitionEntity = emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfigurationXml(EMR_CLUSTER_DEFINITION_XML_FILE_MINIMAL_CLASSPATH));
    // Create an EMR cluster definition update request using normal test XML configuration.
    EmrClusterDefinitionUpdateRequest request = createEmrClusterDefinitionUpdateRequest(getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH));
    executeWithoutLogging(EmrClusterDefinitionServiceImpl.class, () -> {
        // Update the EMR cluster definition.
        EmrClusterDefinitionInformation updatedEmrClusterDefinition = emrClusterDefinitionService.updateEmrClusterDefinition(new EmrClusterDefinitionKey(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME), request);
        // Validate the returned object.
        validateEmrClusterDefinition(emrClusterDefinitionEntity.getId(), NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, getTestEmrClusterDefinitionConfiguration(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH), updatedEmrClusterDefinition);
    });
}
Also used : NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) EmrClusterDefinitionKey(org.finra.herd.model.api.xml.EmrClusterDefinitionKey) EmrClusterDefinitionUpdateRequest(org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest) EmrClusterDefinitionInformation(org.finra.herd.model.api.xml.EmrClusterDefinitionInformation) EmrClusterDefinitionEntity(org.finra.herd.model.jpa.EmrClusterDefinitionEntity) Test(org.junit.Test)

Example 2 with EmrClusterDefinitionUpdateRequest

use of org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest 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 3 with EmrClusterDefinitionUpdateRequest

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

the class EmrClusterDefinitionServiceTest method createEmrClusterDefinitionUpdateRequest.

/**
 * Creates a new EMR cluster definition update request.
 *
 * @param emrClusterDefinitionConfiguration the EMR cluster definition configuration
 *
 * @return the newly created EMR cluster definition update request
 */
private EmrClusterDefinitionUpdateRequest createEmrClusterDefinitionUpdateRequest(EmrClusterDefinition emrClusterDefinitionConfiguration) {
    // Create a new ENR cluster definition create request.
    EmrClusterDefinitionUpdateRequest request = new EmrClusterDefinitionUpdateRequest();
    // Fill in the parameters.
    request.setEmrClusterDefinition(emrClusterDefinitionConfiguration);
    return request;
}
Also used : EmrClusterDefinitionUpdateRequest(org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest)

Aggregations

EmrClusterDefinitionUpdateRequest (org.finra.herd.model.api.xml.EmrClusterDefinitionUpdateRequest)3 EmrClusterDefinitionInformation (org.finra.herd.model.api.xml.EmrClusterDefinitionInformation)2 EmrClusterDefinitionKey (org.finra.herd.model.api.xml.EmrClusterDefinitionKey)2 Test (org.junit.Test)2 EmrClusterDefinition (org.finra.herd.model.api.xml.EmrClusterDefinition)1 EmrClusterDefinitionEntity (org.finra.herd.model.jpa.EmrClusterDefinitionEntity)1 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)1