Search in sources :

Example 6 with InMemoryTempGraphFactory

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

the class AntJUnitReportRDFizerForTwistReportTest method canReadTwistTestWithFailingOutput.

@Test
public void canReadTwistTestWithFailingOutput() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("test/data/twist_xunit/failing/TWIST_TEST--scenarios.AFailingTest.xml"))));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "PREFIX xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:testCaseName 'ShineReadsCruiseStagesCompletedFeed.scn'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'false'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) File(java.io.File) Test(org.junit.Test)

Example 7 with InMemoryTempGraphFactory

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

the class AntJUnitReportRDFizerTest method testLoadingFailingJUnit.

@Test
public void testLoadingFailingJUnit() throws Exception {
    String failingTestXML = "<?xml version='1.0' encoding='UTF-8' ?>" + "<testsuite errors='1' failures='1' hostname='fake-host-name' name='com.example.TheTest' tests='1' time='1.058' timestamp='2009-12-25T00:34:36'>" + "<testcase classname='com.example.TheTest' name='testSomething' time='0.011'>" + "<failure message='foo' type='junit.framework.AssertionFailedError'>junit.framework.AssertionFailedError: foo" + "\tat com.example.TheTest.testSomething(TheTest.java:96)" + "</failure>" + "</testcase>" + "</testsuite>";
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(failingTestXML));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "PREFIX xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'com.example.TheTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'testSomething'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'false'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 8 with InMemoryTempGraphFactory

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

the class AntJUnitReportRDFizerTest method testLoadingPassingJUnit.

@Test
public void testLoadingPassingJUnit() throws Exception {
    String passingTestXML = "<?xml version='1.0' encoding='UTF-8' ?>" + "<testsuite name='com.example.TheTest'>" + "<testcase classname='com.example.TheTest' name='testSomething' />" + "</testsuite>";
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(passingTestXML));
    String ask = "prefix cruise: <" + GoOntology.URI + "> " + "prefix xunit: <" + XUnitOntology.URI + "> " + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "<http://job> xunit:hasTestCase _:testCase . " + "_:testCase a xunit:TestCase . " + "_:testCase xunit:testSuiteName 'com.example.TheTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'testSomething'^^xsd:string . " + "OPTIONAL { ?testCase xunit:hasFailure ?failure } . " + "FILTER (!bound(?failure)) " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 9 with InMemoryTempGraphFactory

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

the class AntJUnitReportRDFizerTest method testDoesNotHandleNonJUnitXMLFile.

@Test
public void testDoesNotHandleNonJUnitXMLFile() throws DocumentException {
    String invalidXML = "<?xml version='1.0' encoding='UTF-8' ?><foo/>";
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    assertFalse(junitRDFizer.canHandle(document(invalidXML)));
}
Also used : InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Test(org.junit.Test)

Example 10 with InMemoryTempGraphFactory

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

the class AntJUnitGRDDLTest method setUp.

@Before
public void setUp() throws Exception {
    InputStream xunitXMLStream = new ByteArrayInputStream(minimalXUnitXML.getBytes());
    XSLTTransformerRegistry xsltTransformerRegistry = new XSLTTransformerRegistry();
    transformer = new GRDDLTransformer(xsltTransformerRegistry, XSLTTransformerRegistry.XUNIT_ANT_JUNIT_GRDDL_XSL);
    minimalDataGraph = transformer.transform(xunitXMLStream, new InMemoryTempGraphFactory());
}
Also used : GRDDLTransformer(com.thoughtworks.studios.shine.semweb.grddl.GRDDLTransformer) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Before(org.junit.Before)

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