Search in sources :

Example 1 with StageXmlViewModel

use of com.thoughtworks.go.server.domain.xml.StageXmlViewModel in project gocd by gocd.

the class BackgroundStageLoaderIntegrationTest method handleAStageURLNotYetSeenShouldStoreStageResourceIntoStageStorage.

@Test
public void handleAStageURLNotYetSeenShouldStoreStageResourceIntoStageStorage() {
    TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
    loader.handle(feedEntry(savedStage), pipelineInstanceLoader);
    assertTrue(stageStorage.isStageStored(savedStage.stageId));
    Graph storedGraph = stageStorage.load(savedStage.stageId);
    Stage stage = savedStage.stage;
    String baseUrl = "https://localhost:8154/go";
    String jobUrl = new JobXmlViewModel(stage.getJobInstances().first()).httpUrl(baseUrl);
    assertTrue(storedGraph.containsResourceWithURI(jobUrl));
    assertTrue(storedGraph.containsResourceWithURI(new StageXmlViewModel(stage).httpUrl(baseUrl)));
    Pipeline pipeline = savedStage.pipeline;
    assertTrue(storedGraph.containsResourceWithURI(PipelineXmlViewModel.httpUrlForPipeline(baseUrl, pipeline.getId(), pipeline.getName())));
    Modification latestModification = pipeline.getMaterialRevisions().getRevisions().get(0).getLatestModification();
    assertTrue(storedGraph.containsResourceWithURI(ScmMaterial.changesetUrl(latestModification, baseUrl, latestModification.getMaterialInstance().getId())));
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) 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) Date(java.util.Date) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 2 with StageXmlViewModel

use of com.thoughtworks.go.server.domain.xml.StageXmlViewModel in project gocd by gocd.

the class StageResourceImporter method loadIsolatedStageGraph.

private Graph loadIsolatedStageGraph(StageIdentifier stageIdentifier, TempGraphFactory tempGraphFactory, XSLTTransformerRegistry transformerRegistry, final Stage stageWithIdentifier, final String baseUri) throws GoIntegrationException {
    GoGRDDLResourceRDFizer stageRdfizer = new GoGRDDLResourceRDFizer("stage", XSLTTransformerRegistry.CRUISE_STAGE_GRAPH_GRDDL_XSL, tempGraphFactory, transformerRegistry, xmlApiService);
    Graph graph = stageRdfizer.importURIUsingGRDDL(new StageXmlViewModel(stageWithIdentifier), baseUri);
    if (!stageCompleted(graph)) {
        throw new CanNotImportABuildingStageException(stageIdentifier + " is not completed yet, can not load test details");
    }
    return graph;
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) StageXmlViewModel(com.thoughtworks.go.server.domain.xml.StageXmlViewModel) GoGRDDLResourceRDFizer(com.thoughtworks.studios.shine.cruise.GoGRDDLResourceRDFizer)

Example 3 with StageXmlViewModel

use of com.thoughtworks.go.server.domain.xml.StageXmlViewModel 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)

Aggregations

StageXmlViewModel (com.thoughtworks.go.server.domain.xml.StageXmlViewModel)3 Graph (com.thoughtworks.studios.shine.semweb.Graph)3 Pipeline (com.thoughtworks.go.domain.Pipeline)2 Stage (com.thoughtworks.go.domain.Stage)2 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)2 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)2 Date (java.util.Date)2 Test (org.junit.Test)2 Modification (com.thoughtworks.go.domain.materials.Modification)1 GoGRDDLResourceRDFizer (com.thoughtworks.studios.shine.cruise.GoGRDDLResourceRDFizer)1 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)1