Search in sources :

Example 56 with StageIdentifier

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));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) Semaphore(java.util.concurrent.Semaphore) XSLTTransformerRegistry(com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry) Test(org.junit.Test)

Example 57 with StageIdentifier

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 . " + "}");
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) Graph(com.thoughtworks.studios.shine.semweb.Graph) Test(org.junit.Test)

Example 58 with StageIdentifier

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));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) File(java.io.File) Test(org.junit.Test)

Example 59 with StageIdentifier

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")));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) File(java.io.File) Test(org.junit.Test)

Aggregations

StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)59 Test (org.junit.Test)31 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 Stage (com.thoughtworks.go.domain.Stage)12 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)6 StageTestRuns (com.thoughtworks.go.domain.testinfo.StageTestRuns)6 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)6 ArrayList (java.util.ArrayList)6 Modification (com.thoughtworks.go.domain.materials.Modification)5 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)5 Username (com.thoughtworks.go.server.domain.Username)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 JobInstance (com.thoughtworks.go.domain.JobInstance)3 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)3 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)3 FailingTestsInPipeline (com.thoughtworks.go.domain.testinfo.FailingTestsInPipeline)3 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)3 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)3 Graph (com.thoughtworks.studios.shine.semweb.Graph)3