"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();
for (int i = 0; i < 10; i++) {
model.systemId.set(i);
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();
for (int i = 0; i < 10; i += 2) {
model.systemId.set(i);
model.value.set("NEXT");
model.deleted.set(i % 4 == 0);
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(7));
assertThat(results.get(0).systemId.get(), is(1L));
assertThat(results.get(0).value.toString(), is("HEAD"));
assertThat(results.get(1).systemId.get(), is(2L));
assertThat(results.get(1).value.toString(), is("NEXT"));
assertThat(results.get(2).systemId.get(), is(3L));
assertThat(results.get(2).value.toString(), is("HEAD"));
assertThat(results.get(3).systemId.get(), is(5L));
assertThat(results.get(3).value.toString(), is("HEAD"));
assertThat(results.get(4).systemId.get(), is(6L));
assertThat(results.get(4).value.toString(), is("NEXT"));
assertThat(results.get(5).systemId.get(), is(7L));
assertThat(results.get(5).value.toString(), is("HEAD"));
assertThat(results.get(6).systemId.get(), is(9L));
assertThat(results.get(6).value.toString(), is("HEAD"));
} finally {
storage.close();
}
}