use of org.finra.herd.model.api.xml.S3PropertiesLocation in project herd by FINRAOS.
the class JobDefinitionServiceTest method testCreateJobDefinitionWithS3PropertiesLocationValidateObjectKeyRequired.
/**
* Asserts that if {@link S3PropertiesLocation} is given, key is required.
*
* @throws Exception
*/
@Test
public void testCreateJobDefinitionWithS3PropertiesLocationValidateObjectKeyRequired() throws Exception {
S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation();
s3PropertiesLocation.setKey(null);
testCreateJobDefinitionWithS3PropertiesLocationValidate(s3PropertiesLocation, IllegalArgumentException.class, "S3 properties location object key must be specified.");
}
use of org.finra.herd.model.api.xml.S3PropertiesLocation in project herd by FINRAOS.
the class JobDefinitionServiceTest method testCreateJobDefinitionWithS3PropertiesLocationPersistsEntity.
/**
* Asserts that when a job definition is created using {@link S3PropertiesLocation}, the S3 location information is persisted.
*
* @throws Exception
*/
@Test
public void testCreateJobDefinitionWithS3PropertiesLocationPersistsEntity() throws Exception {
S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation();
namespaceDaoTestHelper.createNamespaceEntity(TEST_ACTIVITI_NAMESPACE_CD);
JobDefinitionCreateRequest request = jobDefinitionServiceTestHelper.createJobDefinitionCreateRequest();
request.setS3PropertiesLocation(s3PropertiesLocation);
JobDefinition jobDefinition = jobDefinitionService.createJobDefinition(request, false);
Assert.assertEquals("jobDefinition s3PropertiesLocation", request.getS3PropertiesLocation(), jobDefinition.getS3PropertiesLocation());
JobDefinitionEntity jobDefinitionEntity = herdDao.findById(JobDefinitionEntity.class, jobDefinition.getId());
Assert.assertNotNull("jobDefinitionEntity is null", jobDefinitionEntity);
Assert.assertEquals("jobDefinitionEntity s3BucketName", s3PropertiesLocation.getBucketName(), jobDefinitionEntity.getS3BucketName());
Assert.assertEquals("jobDefinitionEntity s3ObjectKey", s3PropertiesLocation.getKey(), jobDefinitionEntity.getS3ObjectKey());
}
use of org.finra.herd.model.api.xml.S3PropertiesLocation in project herd by FINRAOS.
the class JobDefinitionServiceTest method testCreateJobDefinitionWithS3PropertiesLocationValidateBucketNameRequired.
/**
* Asserts that if {@link S3PropertiesLocation} is given, bucket name is required.
*
* @throws Exception
*/
@Test
public void testCreateJobDefinitionWithS3PropertiesLocationValidateBucketNameRequired() throws Exception {
S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation();
s3PropertiesLocation.setBucketName(null);
testCreateJobDefinitionWithS3PropertiesLocationValidate(s3PropertiesLocation, IllegalArgumentException.class, "S3 properties location bucket name must be specified.");
}
use of org.finra.herd.model.api.xml.S3PropertiesLocation in project herd by FINRAOS.
the class JobDefinitionServiceTest method testUpdateJobDefinitionWithS3PropertiesClear.
@Test
public void testUpdateJobDefinitionWithS3PropertiesClear() throws Exception {
S3PropertiesLocation s3PropertiesLocation = getS3PropertiesLocation();
// Create the namespace entity.
namespaceDaoTestHelper.createNamespaceEntity(TEST_ACTIVITI_NAMESPACE_CD);
// Create job definition create request using hard coded test values.
JobDefinitionCreateRequest createRequest = jobDefinitionServiceTestHelper.createJobDefinitionCreateRequest();
createRequest.setS3PropertiesLocation(s3PropertiesLocation);
// Create the job definition in the database.
JobDefinition jobDefinition = jobDefinitionService.createJobDefinition(createRequest, false);
// Create an update request with a varied set of data that is based on the same data used in the create request.
JobDefinitionUpdateRequest updateRequest = createUpdateRequest(createRequest);
// Update the job definition in the database.
JobDefinition updatedJobDefinition = jobDefinitionService.updateJobDefinition(createRequest.getNamespace(), createRequest.getJobName(), updateRequest, false);
JobDefinitionEntity updatedJobDefinitionEntity = herdDao.findById(JobDefinitionEntity.class, updatedJobDefinition.getId());
// Validate the updated job definition.
assertEquals(new JobDefinition(jobDefinition.getId(), jobDefinition.getNamespace(), jobDefinition.getJobName(), updateRequest.getDescription(), updateRequest.getActivitiJobXml(), updateRequest.getParameters(), null, HerdDaoSecurityHelper.SYSTEM_USER), updatedJobDefinition);
// Validate the updated job definition entity.
Assert.assertNull("updatedJobDefinitionEntity s3BucketName", updatedJobDefinitionEntity.getS3BucketName());
Assert.assertNull("updatedJobDefinitionEntity s3ObjectKey", updatedJobDefinitionEntity.getS3ObjectKey());
}
use of org.finra.herd.model.api.xml.S3PropertiesLocation in project herd by FINRAOS.
the class JobServiceTest method testCreateJobWithS3PropertiesPrecedenceDefinitionParamsOverridesDefinitionS3.
/**
* Creates a job where the definition has S3 properties and parameters and request has no parameters. The job definition parameters should take precedence
* if there are name clashes.
*
* @throws Exception
*/
@Test
public void testCreateJobWithS3PropertiesPrecedenceDefinitionParamsOverridesDefinitionS3() throws Exception {
Parameter jobDefinitionS3Parameter = new Parameter("testName", "testValue1");
Parameter jobDefinitionRequestParameter = new Parameter("testName", "expectedValue");
String s3BucketName = "s3BucketName";
S3PropertiesLocation jobDefinitionS3PropertiesLocation = getS3PropertiesLocation(s3BucketName, "jobDefinitionObjectKey", jobDefinitionS3Parameter);
Job resultJob = createJobWithParameters(jobDefinitionS3PropertiesLocation, Arrays.asList(jobDefinitionRequestParameter), null, null);
List<Parameter> actualParameters = resultJob.getParameters();
assertParameterEquals(jobDefinitionRequestParameter, actualParameters);
}
Aggregations