use of nl.knaw.huygens.timbuctoo.core.TransactionEnforcerStubs.forGraphWrapper in project timbuctoo by HuygensING.
the class LoadSaveVresTest method onlyReloadReloadsTheConfigurationsFromTheGraph.
@Test
public void onlyReloadReloadsTheConfigurationsFromTheGraph() throws JsonProcessingException {
TinkerPopGraphManager graphManager = newGraph().withVertex(v -> {
v.withLabel(Vre.DATABASE_LABEL).withProperty(Vre.VRE_NAME_PROPERTY_NAME, "VreA");
}).wrap();
TransactionEnforcer transactionEnforcer = TransactionEnforcerStubs.forGraphWrapper(graphManager);
DatabaseConfiguredVres instance = new DatabaseConfiguredVres(transactionEnforcer);
assertThat(instance.getVre("VreA"), instanceOf(Vre.class));
assertThat(instance.getVre("VreB"), CoreMatchers.equalTo(null));
// TODO find a clearer way to write this test.
// This call overrides the GraphManager pointer, so the DatabaseConfiguredVres has an empty database again.
graphManager = newGraph().withVertex(v -> {
v.withLabel(Vre.DATABASE_LABEL).withProperty(Vre.VRE_NAME_PROPERTY_NAME, "VreB");
}).wrap();
assertThat(instance.getVre("VreA"), instanceOf(Vre.class));
assertThat(instance.getVre("VreB"), CoreMatchers.equalTo(null));
instance.reload();
assertThat(instance.getVre("VreB"), instanceOf(Vre.class));
assertThat(instance.getVre("VreA"), CoreMatchers.equalTo(null));
}
Aggregations