use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class SesameDateTimeOrderingTest method sesameBetterOrderDateTimesCorrectly.
@Test
public void sesameBetterOrderDateTimesCorrectly() throws Exception {
Graph tempGraph = new InMemoryTempGraphFactory().createTempGraph();
tempGraph.addTriplesFromTurtle("" + "@prefix xsd:<http://www.w3.org/2001/XMLSchema#> . " + "<http://foo1> <http://bar> \"2005-02-28T00:00:00Z\"^^xsd:dateTime . " + "<http://foo2> <http://bar> \"2005-02-28T00:00:01Z\"^^xsd:dateTime . " + "<http://foo3> <http://bar> \"2005-02-28T00:00:00-05:00\"^^xsd:dateTime . " + "");
List<BoundVariables> bvs = tempGraph.select("PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" + "SELECT ?subject WHERE { " + " ?subject ?p ?o . " + "} ORDER BY (?o)");
assertEquals("http://foo1", bvs.get(0).getAsString("subject"));
assertEquals("http://foo2", bvs.get(1).getAsString("subject"));
assertEquals("http://foo3", bvs.get(2).getAsString("subject"));
bvs = tempGraph.select("PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" + "SELECT ?subject WHERE { " + " ?subject ?p ?o . " + "} ORDER BY DESC (?o)");
assertEquals("http://foo3", bvs.get(0).getAsString("subject"));
assertEquals("http://foo2", bvs.get(1).getAsString("subject"));
assertEquals("http://foo1", bvs.get(2).getAsString("subject"));
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class StagesQueryTest method setUp.
@Before
public void setUp() throws Exception {
File tempFolder = temporaryFolder.newFolder("shine");
graphLoader = new StageStorage(tempFolder.getAbsolutePath());
graphLoader.clear();
graphFactory = new InMemoryTempGraphFactory();
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class JobResourceImporterTest method listFilesOfTypeWhenThereAreNoMatches.
@Test
public void listFilesOfTypeWhenThereAreNoMatches() {
JobResourceImporter rdfImporter = new JobResourceImporter("src/test-shared/resources/cruise", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
File[] files = rdfImporter.getArtifactFilesOfType("artifacts/job2", "junit-reports", "boo");
assertThat(files.length, equalTo(0));
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class JobResourceImporterTest method listArtifactFilesOfTypeWhenThereAreMatchesWithCaseInSensitiveExtensions.
@Test
public void listArtifactFilesOfTypeWhenThereAreMatchesWithCaseInSensitiveExtensions() {
JobResourceImporter rdfImporter = new JobResourceImporter("src/test-shared/resources/cruise", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
File[] files = rdfImporter.getArtifactFilesOfType("artifacts", "job2", "xml");
assertThat(files.length, equalTo(4));
List<String> actualFileNames = new ArrayList<>();
for (File f : files) {
actualFileNames.add(f.getName());
}
assertThat(actualFileNames, hasItem("junit-report-failed.xml"));
assertThat(actualFileNames, hasItem("junit-report-passed.xml"));
assertThat(actualFileNames, hasItem("junit-report-passed-with-capitalcase-extension.XML"));
assertThat(actualFileNames, hasItem("junit-report-passed-with-mixedcase-extension.Xml"));
}
use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.
the class JobResourceImporterTest method listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAFile.
@Test
public void listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAFile() {
JobResourceImporter rdfImporter = new JobResourceImporter("src/test-shared/resources/cruise", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
File[] files = rdfImporter.getArtifactFilesOfType("artifacts/job2/junit-reports", "junit-report-failed.xml", "xml");
assertThat(files.length, equalTo(0));
}
Aggregations