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())));
}
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;
}
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);
}
Aggregations