use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class LazyStageGraphLoaderTest method shouldReuseTransformerAcrossSerialInvocations.
@Test
public void shouldReuseTransformerAcrossSerialInvocations() {
StageIdentifier stageId = new StageIdentifier("pipeline-foo", 23, "stage-1", "1");
DummyStageResourceImporter realLoader = new DummyStageResourceImporter(realGraph(), stageId, new Semaphore(2));
LazyStageGraphLoader loader = new LazyStageGraphLoader(realLoader, stageStorage);
loader.load(stageId);
XSLTTransformerRegistry transformerRegistryFromFirstLoad = realLoader.transformerRegistry;
stageStorage.clear();
loader.load(stageId);
XSLTTransformerRegistry transformerRegistryFromSecondLoad = realLoader.transformerRegistry;
assertThat(transformerRegistryFromFirstLoad, sameInstance(transformerRegistryFromSecondLoad));
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class StageStorageTest method saveStageGraphAndLoadOutSameGraph.
@Test
public void saveStageGraphAndLoadOutSameGraph() throws Exception {
Graph graph = graphWithRDF("" + "@prefix cruise: <" + GoOntology.URI + "> . " + "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . " + "@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . " + "" + "<http://pipeline/1> a cruise:Pipeline ." + "<http://pipeline/1> cruise:pipelineName \"p\"^^xsd:string ." + "<http://pipeline/1> cruise:pipelineCounter 1 ." + "<http://pipeline/1> cruise:hasStage <http://stage/1> ." + "<http://stage/1> rdf:type cruise:Stage . " + "<http://stage/1> cruise:stageName \"s\"^^xsd:string . " + "<http://stage/1> cruise:stageCounter 2 . " + "<http://stage/1> cruise:hasJob <http://job/1> . " + "<http://job/1> a cruise:Job . " + "");
stageStorage.save(graph);
Graph loadedGraph = stageStorage.load(new StageIdentifier("p", 1, "s", "2"));
assertAskIsTrue(loadedGraph, "" + "PREFIX cruise: <" + GoOntology.URI + "> " + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> " + "ASK WHERE {" + " <http://pipeline/1> a cruise:Pipeline ." + " <http://pipeline/1> cruise:pipelineName \"p\"^^xsd:string ." + " <http://pipeline/1> cruise:pipelineCounter 1 ." + " <http://pipeline/1> cruise:hasStage <http://stage/1> ." + " <http://stage/1> rdf:type cruise:Stage . " + " <http://stage/1> cruise:stageName \"s\"^^xsd:string . " + " <http://stage/1> cruise:stageCounter 2 . " + " <http://stage/1> cruise:hasJob <http://job/1> . " + " <http://job/1> a cruise:Job . " + "}");
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class ArtifactDirectoryChooserTest method shouldLocateCachedArtifactIfItExists.
@Test
public void shouldLocateCachedArtifactIfItExists() throws IllegalArtifactLocationException {
StageIdentifier stageIdentifier = new StageIdentifier("P1", 1, "S1", "1");
File cachedStageFolder = new File(root2, "cache/artifacts/pipelines/P1/1/S1/1");
cachedStageFolder.mkdirs();
assertThat(chooser.findCachedArtifact(stageIdentifier), is(cachedStageFolder));
}
use of com.thoughtworks.go.domain.StageIdentifier in project gocd by gocd.
the class PathBasedArtifactsLocatorTest method shouldFindCachedArtifact.
@Test
public void shouldFindCachedArtifact() throws Exception {
PathBasedArtifactsLocator locator = new PathBasedArtifactsLocator(new File("root"));
File directory = locator.findCachedArtifact(new StageIdentifier("P1", 1, "S1", "1"));
assertThat(directory, is(new File("root/cache/artifacts/pipelines/P1/1/S1/1")));
}
Aggregations