use of org.apache.samza.application.LegacyTaskApplication in project samza by apache.
the class TestLocalApplicationRunner method testRunIdForBatch.
/**
* For app.mode=BATCH ensure that the run.id generation utils --
* DistributedLock, ClusterMembership and MetadataStore are created.
* Also ensure that metadataStore.put is invoked (to write the run.id)
*/
@Test
public void testRunIdForBatch() throws Exception {
final Map<String, String> cfgs = new HashMap<>();
cfgs.put(ApplicationConfig.APP_MODE, "BATCH");
cfgs.put(ApplicationConfig.APP_PROCESSOR_ID_GENERATOR_CLASS, UUIDGenerator.class.getName());
cfgs.put(JobConfig.JOB_NAME, "test-task-job");
cfgs.put(JobConfig.JOB_ID, "jobId");
config = new MapConfig(cfgs);
mockApp = new LegacyTaskApplication(IdentityStreamTask.class.getName());
prepareTestForRunId();
runner.run();
verify(coordinationUtils, Mockito.times(1)).getLock(CoordinationConstants.RUNID_LOCK_ID);
verify(clusterMembership, Mockito.times(1)).getNumberOfProcessors();
verify(metadataStore, Mockito.times(1)).put(eq(CoordinationConstants.RUNID_STORE_KEY), any(byte[].class));
verify(metadataStore, Mockito.times(1)).flush();
}
Aggregations