Search in sources :

Example 11 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class AntJUnitGRDDLTest method happyPathConversionWithAllData.

@Test
public void happyPathConversionWithAllData() throws Exception {
    String kitchenSinkXUnitXML = "<?xml version='1.0' encoding='UTF-8' ?>" + "<testsuite errors='0' failures='0' hostname='phydeaux3.corporate.thoughtworks.com' name='com.thoughtworks.studios.shine.cruise.GoOntologyTest' tests='2' time='0.601' timestamp='2009-12-18T20:26:42'>" + "<properties>" + "<property name='java.runtime.name' value='Java SE Runtime Environment' />" + "<property name='sun.boot.library.path' value='/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries' />" + "</properties>" + "<testcase classname='com.thoughtworks.studios.shine.cruise.GoOntologyTest' name='canCreateGraph' time='0.57' />" + "<system-out><![CDATA[]]></system-out>" + "<system-err><![CDATA[]]></system-err>" + "</testsuite>";
    InputStream xunitXMLStream = new ByteArrayInputStream(kitchenSinkXUnitXML.getBytes());
    Graph graph = transformer.transform(xunitXMLStream, new InMemoryTempGraphFactory());
    String sparql = "PREFIX xunit: <" + XUnitOntology.URI + "> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "?testCase a xunit:TestCase ; " + "xunit:testCaseName \"canCreateGraph\"^^xsd:string ; " + "xunit:testCaseClassName \"com.thoughtworks.studios.shine.cruise.GoOntologyTest\"^^xsd:string ; " + "xunit:testSuiteName \"com.thoughtworks.studios.shine.cruise.GoOntologyTest\"^^xsd:string . " + "}";
    assertAskIsTrue(graph, sparql);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 12 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class JobResourceImporterTest method listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAGlob.

@Test
public void listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAGlob() {
    JobResourceImporter rdfImporter = new JobResourceImporter("test/data/cruise", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
    File[] files = rdfImporter.getArtifactFilesOfType("artifacts", "job2/**/*.xml", "xml");
    assertThat(files.length, equalTo(0));
}
Also used : InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) File(java.io.File) Test(org.junit.Test)

Example 13 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class LazyStageGraphLoaderTest method initStageStorage.

@Before
public void initStageStorage() {
    stageStorage = new StageStorage(new File(System.getProperty("java.io.tmpdir"), "shine").getAbsolutePath());
    stageStorage.clear();
    graphFactory = new InMemoryTempGraphFactory();
}
Also used : File(java.io.File) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Before(org.junit.Before)

Example 14 with InMemoryTempGraphFactory

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 {
    tempFiles = new TempFiles();
    File tempFolder = tempFiles.createUniqueFolder("shine");
    stageStorage = new StageStorage(tempFolder.getAbsolutePath());
    stageStorage.clear();
    graphFactory = new InMemoryTempGraphFactory();
    pipelineInstanceLoader = mock(PipelineInstanceLoader.class);
}
Also used : PipelineInstanceLoader(com.thoughtworks.go.server.service.PipelineInstanceLoader) File(java.io.File) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) TempFiles(com.thoughtworks.go.util.TempFiles) Before(org.junit.Before)

Example 15 with InMemoryTempGraphFactory

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);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Aggregations

InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)36 Test (org.junit.Test)28 Graph (com.thoughtworks.studios.shine.semweb.Graph)18 File (java.io.File)14 ByteArrayInputStream (java.io.ByteArrayInputStream)9 InputStream (java.io.InputStream)7 Before (org.junit.Before)6 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)2 TempFiles (com.thoughtworks.go.util.TempFiles)2 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)2 JobInstance (com.thoughtworks.go.domain.JobInstance)1 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)1 PipelineInstanceLoader (com.thoughtworks.go.server.service.PipelineInstanceLoader)1 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)1 StageStorage (com.thoughtworks.studios.shine.cruise.stage.details.StageStorage)1 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)1 GRDDLTransformer (com.thoughtworks.studios.shine.semweb.grddl.GRDDLTransformer)1 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1