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);
});
}
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);
}
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;
}
Aggregations