use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class StageStorageTest method setUp.
@Before
public void setUp() throws Exception {
File tempFolder = temporaryFolder.newFolder("shine");
stageStorage = new StageStorage(tempFolder.getAbsolutePath());
stageStorage.clear();
graphFactory = new InMemoryTempGraphFactory();
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class XMLArtifactImporterTest method testSubsequentHandlerIsUsedWhenFirstHandlerBlowsUp.
@Test
public void testSubsequentHandlerIsUsedWhenFirstHandlerBlowsUp() throws Exception {
artifactImporter.registerHandler(new ExplodingHandler());
artifactImporter.registerHandler(new StubHandler(true, "http://A-OK/"));
Graph graph = new InMemoryTempGraphFactory().createTempGraph();
URIReference parent = graph.createURIReference(BAR_CLASS, "http://parent/");
artifactImporter.importFile(graph, parent, new ByteArrayInputStream("<foo />".getBytes()));
String askForSecondHandler = "PREFIX ex: <http://example.com/example.owl#> " + "ASK WHERE { " + "<http://parent/> ex:foo <http://A-OK/> " + "}";
assertAskIsTrue(graph, askForSecondHandler);
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class XMLArtifactImporterTest method testSubsequentHandlerIsUsedWhenFirstCannotHandleArtifact.
@Test
public void testSubsequentHandlerIsUsedWhenFirstCannotHandleArtifact() throws Exception {
artifactImporter.registerHandler(new StubHandler(false, "http://foobar/"));
artifactImporter.registerHandler(new StubHandler(true, "http://A-OK/"));
Graph graph = new InMemoryTempGraphFactory().createTempGraph();
URIReference parent = graph.createURIReference(BAR_CLASS, "http://parent/");
artifactImporter.importFile(graph, parent, new ByteArrayInputStream("<foo />".getBytes()));
String askForFirstHandler = "PREFIX ex: <http://example.com/example.owl#> " + "ASK WHERE { " + "<http://parent/> ex:foo <http://foobar/> " + "}";
assertAskIsFalse(graph, askForFirstHandler);
String askForSecondHandler = "PREFIX ex: <http://example.com/example.owl#> " + "ASK WHERE { " + "<http://parent/> ex:foo <http://A-OK/> " + "}";
assertAskIsTrue(graph, askForSecondHandler);
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class XMLArtifactImporterTest method testImportedDataWasAdded.
@Test
public void testImportedDataWasAdded() throws IOException {
artifactImporter.registerHandler(new StubHandler(true));
Graph graph = new InMemoryTempGraphFactory().createTempGraph();
URIReference parent = graph.createURIReference(BAR_CLASS, "http://parent/");
artifactImporter.importFile(graph, parent, new ByteArrayInputStream("<foo />".getBytes()));
String ask = "PREFIX ex: <http://example.com/example.owl#> " + "ASK WHERE { " + "<http://parent/> ex:foo <http://yadda/> " + "}";
assertAskIsTrue(graph, (ask));
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class GraphActionsTest method canRemoveStatements.
@Test
public void canRemoveStatements() {
Graph graph = new InMemoryTempGraphFactory().createTempGraph();
String rdf = "" + "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ." + "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> ." + "" + "<http://pipeline/1> rdf:type cruise:Pipeline ." + "<http://pipeline/1> cruise:hasStage <http://stage/1> ." + "<http://pipeline/1> cruise:hasStage <http://stage/2> ." + "<http://stage/1> rdf:type cruise:Stage . " + "<http://stage/2> rdf:type cruise:Stage . ";
GraphActions actions = new GraphActions(graph);
actions.queueRemoveResourceStatement(graph.createURIReference(GoOntology.PIPELINE_RESOURCE, "http://pipeline/1"), GoOntology.HAS_STAGE, graph.createURIReference(GoOntology.STAGE_RESOURCE, "http://stage/1"));
actions.queueRemoveResourceStatement(graph.createURIReference(GoOntology.PIPELINE_RESOURCE, "http://pipeline/1"), RDFOntology.TYPE, graph.createURIReference(GoOntology.STAGE_RESOURCE, "http://stage/2"));
actions.execute();
assertEquals(3L, graph.size());
}
Aggregations