use of org.apache.samza.job.JobMetadataChange in project samza by apache.
the class TestJobCoordinatorMetadataManager method testCheckForMetadataChangesConfigChange.
@Test
public void testCheckForMetadataChangesConfigChange() {
JobCoordinatorMetadata previousMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
JobCoordinatorMetadata newMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, NEW_CONFIG_ID, OLD_JOB_MODEL_ID);
Set<JobMetadataChange> metadataChanges = this.jobCoordinatorMetadataManager.checkForMetadataChanges(newMetadata, previousMetadata);
assertEquals("Metadata check should indicate new config", ImmutableSet.of(JobMetadataChange.CONFIG), metadataChanges);
assertEquals("Config changed across application attempts should be 1", 1, this.jobCoordinatorMetadataManager.getMetrics().getConfigChangedAcrossApplicationAttempt().getValue().intValue());
assertEquals("Application attempt count should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getApplicationAttemptCount().getValue().intValue());
}
use of org.apache.samza.job.JobMetadataChange in project samza by apache.
the class TestJobCoordinatorMetadataManager method testCheckForMetadataChangesNoChanges.
@Test
public void testCheckForMetadataChangesNoChanges() {
JobCoordinatorMetadata previousMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
JobCoordinatorMetadata newMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
Set<JobMetadataChange> metadataChanges = this.jobCoordinatorMetadataManager.checkForMetadataChanges(newMetadata, previousMetadata);
assertEquals("Metadata check should indicate no changes", ImmutableSet.of(), metadataChanges);
assertEquals("New deployment should be 0 since Epoch ID did not change", 0, this.jobCoordinatorMetadataManager.getMetrics().getNewDeployment().getValue().intValue());
assertEquals("Job model changed across application attempts should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getJobModelChangedAcrossApplicationAttempt().getValue().intValue());
assertEquals("Config changed across application attempts should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getConfigChangedAcrossApplicationAttempt().getValue().intValue());
assertEquals("Application attempt count should be 1", 1, this.jobCoordinatorMetadataManager.getMetrics().getApplicationAttemptCount().getValue().intValue());
}
Aggregations