use of io.cdap.cdap.AppWithWorker in project cdap by caskdata.
the class DefaultStoreTest method testWorkerInstances.
@Test
public void testWorkerInstances() {
ApplicationSpecification spec = Specifications.from(new AppWithWorker());
ApplicationId appId = NamespaceId.DEFAULT.app(spec.getName());
store.addApplication(appId, spec);
ProgramId programId = appId.worker(AppWithWorker.WORKER);
int instancesFromSpec = spec.getWorkers().get(AppWithWorker.WORKER).getInstances();
Assert.assertEquals(1, instancesFromSpec);
int instances = store.getWorkerInstances(programId);
Assert.assertEquals(instancesFromSpec, instances);
store.setWorkerInstances(programId, 9);
instances = store.getWorkerInstances(programId);
Assert.assertEquals(9, instances);
}
Aggregations