"EXAMPLE",
Collections.singleton("COL"),
"com.example.Model",
123L);
framework.deployLibrary(TestDataModel.class, "batchapps/tbatch/lib/jobflow-tflow.jar");
CacheStorage storage = new CacheStorage(getConfiguration(), getTargetUri());
try {
storage.putPatchCacheInfo(info);
ModelOutput<TestDataModel> head = create(storage, storage.getHeadContents("0"));
try {
TestDataModel model = new TestDataModel();
model.systemId.set(1);
model.value.set("HEAD");
model.deleted.set(false);
head.write(model);
model.systemId.set(2);
model.value.set("HEAD");
model.deleted.set(false);
head.write(model);
} finally {
head.close();
}
ModelOutput<TestDataModel> patch = create(storage, storage.getPatchContents("0"));
try {
TestDataModel model = new TestDataModel();
model.systemId.set(1);
model.value.set("NEXT");
model.deleted.set(false);
patch.write(model);
model.systemId.set(3);
model.value.set("NEXT");
model.deleted.set(false);
patch.write(model);
} finally {
patch.close();
}
execute(CacheBuildClient.SUBCOMMAND_UPDATE);
assertThat(storage.getHeadCacheInfo(), is(info));
List<TestDataModel> results = collect(storage, storage.getHeadContents("*"));
assertThat(results.size(), is(3));
assertThat(results.get(0).systemId.get(), is(1L));
assertThat(results.get(0).value.toString(), is("NEXT"));
assertThat(results.get(1).systemId.get(), is(2L));
assertThat(results.get(1).value.toString(), is("HEAD"));
assertThat(results.get(2).systemId.get(), is(3L));
assertThat(results.get(2).value.toString(), is("NEXT"));
} finally {
storage.close();
}
}