final RepositoryConnection mainCon = repositoryRDF.getConnection();
try {
mainCon.begin();
Assert.assertFalse(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
final Facading facading = FacadingFactory.createFacading(mainCon);
Assert.assertFalse(facading.isFacadeable(subject, TypeFacade.class));
Assert.assertFalse(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
final TypeFacade ff = facading.createFacade(subject, TypeFacade.class);
Assert.assertTrue(facading.isFacadeable(subject, TypeFacade.class));
Assert.assertTrue(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
Assert.assertNull(ff.getTitle());
final String v = UUID.randomUUID().toString();
ff.setTitle(v);
Assert.assertEquals(v, ff.getTitle());
Assert.assertTrue(ResourceUtils.hasType(mainCon, subject, TypeFacade.TYPE));
Assert.assertTrue(facading.isFacadeable(subject, TypeFacade.class));
{ // before-commit
final RepositoryConnection subCon_1 = repositoryRDF.getConnection();
try {
subCon_1.begin();
Assert.assertFalse(ResourceUtils.hasType(subCon_1, subject, TypeFacade.TYPE));
final Facading f_1 = FacadingFactory.createFacading(subCon_1);
Assert.assertFalse(f_1.isFacadeable(subject, TypeFacade.class));
final TypeFacade tf_1 = f_1.createFacade(subject, TypeFacade.class);
Assert.assertNull(tf_1.getTitle());
Assert.assertTrue(f_1.isFacadeable(subject, TypeFacade.class));
Assert.assertTrue(ResourceUtils.hasType(subCon_1, subject, TypeFacade.TYPE));
subCon_1.rollback();
} finally {
if (subCon_1.isActive()) subCon_1.rollback();
subCon_1.close();
}
}
mainCon.commit();
{ // after-commit
final RepositoryConnection subCon_2 = repositoryRDF.getConnection();
try {
subCon_2.begin();
Assert.assertTrue(ResourceUtils.hasType(subCon_2, subject, TypeFacade.TYPE));
final Facading f_2 = FacadingFactory.createFacading(subCon_2);
Assert.assertTrue(f_2.isFacadeable(subject, TypeFacade.class));
Assert.assertEquals(v, f_2.createFacade(subject, TypeFacade.class).getTitle());
Assert.assertTrue(ResourceUtils.hasType(subCon_2, subject, TypeFacade.TYPE));
Assert.assertTrue(f_2.isFacadeable(subject, TypeFacade.class));
subCon_2.commit();
} finally {
if (subCon_2.isActive()) subCon_2.rollback();
subCon_2.close();