Search in sources :

Example 1 with XSLTTransformerRegistry

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

the class StageResourceImporterTest method shouldNotImportStageNotCompleted.

@Test(expected = CanNotImportABuildingStageException.class)
public void shouldNotImportStageNotCompleted() throws Exception {
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(false, null, new Date());
    importer.load(savedStage.stageId, graphFactory, new XSLTTransformerRegistry());
}
Also used : TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) Date(java.util.Date) Test(org.junit.Test)

Example 2 with XSLTTransformerRegistry

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

the class StageResourceImporterTest method shouldImportPipelineBuildTriggers.

@Test
public void shouldImportPipelineBuildTriggers() throws Exception {
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    Graph graph = importer.load(savedStage.stageId, graphFactory, new XSLTTransformerRegistry());
    for (Modification modification : savedStage.pipeline.getMaterialRevisions().getRevisions().get(0).getModifications()) {
        String changeSetUri = ScmMaterial.changesetUrl(modification, baseUrl, modification.getMaterialInstance().getId());
        assertTrue(graph.containsResourceWithURI(changeSetUri));
        String ask = "" + "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE {" + "  <" + PipelineXmlViewModel.httpUrlForPipeline(baseUrl, savedStage.pipeline.getId(), savedStage.pipeline.getName()) + "> cruise:pipelineTrigger <" + changeSetUri + "> . " + "}";
        assertAskIsTrue(graph, ask);
    }
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) Graph(com.thoughtworks.studios.shine.semweb.Graph) TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) Date(java.util.Date) Test(org.junit.Test)

Example 3 with XSLTTransformerRegistry

use of com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry 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)

Example 4 with XSLTTransformerRegistry

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

the class StageResourceImporterTest method canLoadAllStageInfoAfterImportIt.

@Test
public void canLoadAllStageInfoAfterImportIt() throws Exception {
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    Pipeline pipeline = savedStage.pipeline;
    Graph graph = importer.load(savedStage.stageId, graphFactory, new XSLTTransformerRegistry());
    String pipelineUrl = PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipeline.getId(), pipeline.getName());
    Stage stage = savedStage.stage;
    String stageUrl = new StageXmlViewModel(stage).httpUrl(baseUrl);
    String jobUrl = new JobXmlViewModel(stage.getJobInstances().get(0)).httpUrl(baseUrl);
    String ask = "" + "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE {" + "  <" + pipelineUrl + "> a cruise:Pipeline ." + "  <" + pipelineUrl + "> cruise:hasStage <" + stageUrl + "> ." + "  <" + stageUrl + "> a cruise:Stage ." + "  <" + stageUrl + "> cruise:hasJob <" + jobUrl + "> ." + "  <" + jobUrl + "> a cruise:Job . " + "}";
    assertAskIsTrue(graph, ask);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) StageXmlViewModel(com.thoughtworks.go.server.domain.xml.StageXmlViewModel) JobXmlViewModel(com.thoughtworks.go.server.domain.xml.JobXmlViewModel) TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) Stage(com.thoughtworks.go.domain.Stage) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) Date(java.util.Date) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 5 with XSLTTransformerRegistry

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

the class StageResourceImporterTest method shouldNotImportPreviousNextPipelinePointer.

@Test
public void shouldNotImportPreviousNextPipelinePointer() throws Exception {
    TestFailureSetup.SavedStage savedStageFirst = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    TestFailureSetup.SavedStage savedStageSecond = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    TestFailureSetup.SavedStage savedStageThird = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    Graph graph = importer.load(savedStageSecond.stageId, graphFactory, new XSLTTransformerRegistry());
    Pipeline pipelineSecond = savedStageSecond.pipeline;
    assertTrue(graph.containsResourceWithURI(PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipelineSecond.getId(), pipelineSecond.getName())));
    Pipeline pipelineFirst = savedStageFirst.pipeline;
    assertFalse(graph.containsResourceWithURI(PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipelineFirst.getId(), pipelineFirst.getName())));
    Pipeline pipelineThird = savedStageThird.pipeline;
    assertFalse(graph.containsResourceWithURI(PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipelineThird.getId(), pipelineThird.getName())));
    String askForPreviousPointer = "" + "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE {" + "  [] cruise:previousPipeline [] . " + "}";
    assertAskIsFalse(graph, askForPreviousPointer);
    String askForNextPointer = "" + "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE {" + "  [] cruise:nextPipeline [] . " + "}";
    assertAskIsFalse(graph, askForNextPointer);
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) Date(java.util.Date) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)8 Test (org.junit.Test)5 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)4 Date (java.util.Date)4 Graph (com.thoughtworks.studios.shine.semweb.Graph)3 Before (org.junit.Before)3 Pipeline (com.thoughtworks.go.domain.Pipeline)2 InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)2 Stage (com.thoughtworks.go.domain.Stage)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)1 StageXmlViewModel (com.thoughtworks.go.server.domain.xml.StageXmlViewModel)1 XmlApiService (com.thoughtworks.go.server.service.XmlApiService)1 GRDDLTransformer (com.thoughtworks.studios.shine.semweb.grddl.GRDDLTransformer)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Semaphore (java.util.concurrent.Semaphore)1