Search in sources :

Example 31 with Graph

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

the class GRDDLTransformerTest method checkPipelineTransformation.

@Test
public void checkPipelineTransformation() throws Exception {
    InputStream xsl = getClass().getResourceAsStream("/cruise/pipeline-graph-grddl.xsl");
    String rawPipelineXML = "<pipeline name='RPNCalculator' counter='1' label='foo-1'>" + "    <link rel='self' href='http://localhost:8153/go/api/pipelines/RPNCalculator/1.xml'/>" + "    <scheduleTime>2010-01-04T16:02:27-08:00</scheduleTime>" + "    <materials>" + "        <material>" + "            <modifications>" + "                    <changeset changesetUri='http://cruise03:8153/go/api/materials/13/changeset/5c186460acca8e07972e7cf54935814005c38833.xml'>" + "                        <user><![CDATA[sjin <sjin@thoughtworks.com>]]></user>" + "                        <checkinTime>2010-01-04T16:01:21-08:00</checkinTime>" + "                        <revision>938ab08dc5bd43884a106fe253dbf072b4968b5b</revision>" + "                        <message><![CDATA[added a failing test]]></message>" + "                        <file name='test/calculator/RPNIntegerCalculatorTest.java' action='modified' />" + "                    </changeset>" + "            </modifications>" + "        </material>" + "    </materials>" + "    <stages>" + "        <stage href='http://localhost:8153/go/api/stages/6.xml'/>" + "    </stages>" + "    <approvedBy><![CDATA[bigbird]]></approvedBy>" + "</pipeline>";
    InputStream pipelineXML = new ByteArrayInputStream(rawPipelineXML.getBytes());
    GRDDLTransformer transformer = new GRDDLTransformer(transformerForXSLStream(xsl, "foo.xsl"), "foo.xsl");
    Graph transformedGraph = transformer.transform(pipelineXML, new InMemoryTempGraphFactory());
    String askIfPipelineWasTransformedWell = "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE { " + "?pipeline a cruise:Pipeline ; " + "cruise:pipelineCounter \"1\"^^xsd:integer ; " + "cruise:pipelineName \"RPNCalculator\"^^xsd:string ; " + "}";
    assertAskIsTrue(transformedGraph, askIfPipelineWasTransformedWell);
}
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 32 with Graph

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

the class AntJUnitReportRDFizerForRailsTestsReportTest method canReadRailsTestWithPassingOutput.

@Test
public void canReadRailsTestWithPassingOutput() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("src/test-shared/resources/ruby_xunit/passing/TEST-PurchasesControllerTest.xml"), UTF_8)));
    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 'PurchasesControllerTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'test_should_get_index'^^xsd:string . " + "}";
    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 33 with Graph

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

the class AntJUnitReportRDFizerForRailsTestsReportTest method canReadRailsTestWithErrorOutput.

@Test
public void canReadRailsTestWithErrorOutput() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("src/test-shared/resources/ruby_xunit/errors/TEST-PostsControllerTest.xml"), UTF_8)));
    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 'PostsControllerTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'test_should_get_index'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'true'^^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 34 with Graph

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

the class AntJUnitReportRDFizerForTwistReportTest method canReadACombinedTestReport.

@Test
public void canReadACombinedTestReport() throws Exception {
    AntJUnitReportRDFizer junitRDFizer = new AntJUnitReportRDFizer(new InMemoryTempGraphFactory(), XSLTTransformerRegistry);
    Graph graph = junitRDFizer.importFile("http://job", document(FileUtils.readFileToString(new File("src/test-shared/resources/twist_xunit/TESTS-TestSuites.xml"), UTF_8)));
    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 'scn'^^xsd:string . " + "_:testCase xunit:testCaseName 'Parameter type matching in data table.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 35 with Graph

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

the class NUnitRDFizerTest method testLoadingFailingJUnit.

@Test
public void testLoadingFailingJUnit() throws Exception {
    String failingTestXML = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" + "<!--This file represents the results of running a test suite-->" + "<test-results name=\"/home/erik/coding/test/nunittests/Tests.dll\" total=\"4\" failures=\"1\" not-run=\"0\" date=\"2007-07-27\" time=\"11:18:43\">" + "  <environment nunit-version=\"2.2.8.0\" clr-version=\"2.0.50727.42\" os-version=\"Unix 2.6.18.4\" platform=\"Unix\" cwd=\"/home/erik/coding/test/nunittests\" machine-name=\"akira.ramfelt.se\" user=\"erik\" user-domain=\"akira.ramfelt.se\" />" + "  <culture-info current-culture=\"sv-SE\" current-uiculture=\"sv-SE\" />" + "  <test-suite name=\"/home/erik/coding/test/nunittests/Tests.dll\" success=\"False\" time=\"0.404\" asserts=\"0\">" + "    <results>" + "      <test-suite name=\"UnitTests\" success=\"False\" time=\"0.393\" asserts=\"0\">" + "        <results>" + "          <test-suite name=\"UnitTests.MainClassTest\" success=\"False\" time=\"0.289\" asserts=\"0\">" + "            <results>" + "              <test-case name=\"UnitTests.MainClassTest.TestPropertyValue\" executed=\"True\" success=\"True\" time=\"0.146\" asserts=\"1\" />" + "              <test-case name=\"UnitTests.MainClassTest.TestMethodUpdateValue\" executed=\"True\" success=\"True\" time=\"0.001\" asserts=\"1\" />" + "              <test-case name=\"UnitTests.MainClassTest.TestFailure\" executed=\"True\" success=\"False\" time=\"0.092\" asserts=\"1\" result=\"Failure\">" + "                <failure>" + "                  <message><![CDATA[  Expected failure" + "  Expected: 30" + "  But was:  20" + "]]></message>" + "                  <stack-trace><![CDATA[  at UnitTests.MainClassTest.TestFailure () [0x00000] " + "  at <0x00000> <unknown method>" + "  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])" + "  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] " + "]]></stack-trace>" + "                </failure>" + "              </test-case>" + "            </results>" + "          </test-suite>" + "        </results>" + "      </test-suite>" + "    </results>" + "  </test-suite>" + "</test-results>";
    Graph graph = nUnitRDFizer.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 'UnitTests.MainClassTest'^^xsd:string . " + "_:testCase xunit:testCaseName 'TestFailure'^^xsd:string . " + "_:testCase xunit:hasFailure _:failure . " + "_:failure xunit:isError 'false'^^xsd:boolean " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) Test(org.junit.Test)

Aggregations

Graph (com.thoughtworks.studios.shine.semweb.Graph)41 Test (org.junit.Test)26 InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)18 File (java.io.File)7 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)5 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)5 InputStream (java.io.InputStream)5 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Date (java.util.Date)4 Pipeline (com.thoughtworks.go.domain.Pipeline)3 Stage (com.thoughtworks.go.domain.Stage)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3 StageXmlViewModel (com.thoughtworks.go.server.domain.xml.StageXmlViewModel)3 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)3 Modification (com.thoughtworks.go.domain.materials.Modification)2 GoGRDDLResourceRDFizer (com.thoughtworks.studios.shine.cruise.GoGRDDLResourceRDFizer)2 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)2 IOException (java.io.IOException)2 Transformer (javax.xml.transform.Transformer)2