Search in sources :

Example 16 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class JobResourceImporterTest method listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAGlob.

@Test
public void listArtifactFilesReturnsEmptyListWhenJobArtifactPathIsAGlob() {
    JobResourceImporter rdfImporter = new JobResourceImporter("src/test-shared/resources/cruise", new InMemoryTempGraphFactory(), transformerRegistry, xmlApiService, systemEnvironment);
    File[] files = rdfImporter.getArtifactFilesOfType("artifacts", "job2/**/*.xml", "xml");
    assertThat(files.length, equalTo(0));
}
Also used : InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) File(java.io.File) Test(org.junit.Test)

Example 17 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class LazyStageGraphLoaderTest method initStageStorage.

@Before
public void initStageStorage() {
    stageStorage = new StageStorage(new File(System.getProperty("java.io.tmpdir"), "shine").getAbsolutePath());
    stageStorage.clear();
    graphFactory = new InMemoryTempGraphFactory();
}
Also used : File(java.io.File) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Before(org.junit.Before)

Example 18 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class StageResourceImporterTest method setup.

@Before
public void setup() throws Exception {
    dbHelper.onSetUp();
    configHelper.usingCruiseConfigDao(goConfigDao);
    configHelper.onSetUp();
    graphFactory = new InMemoryTempGraphFactory();
    importer = new StageResourceImporter("test/data/cruise/artifacts", xmlApiService, stageService, pipelineHistoryService, systemEnvironment);
    failureSetup = new TestFailureSetup(materialRepository, dbHelper, pipelineTimeline, configHelper, transactionTemplate);
}
Also used : TestFailureSetup(com.thoughtworks.go.server.dao.sparql.TestFailureSetup) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) Before(org.junit.Before)

Example 19 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class BackgroundStageLoaderStageStatusListener method handle.

public void handle(StageFeedEntry feedEntry, final PipelineInstanceLoader pipelineInstanceLoader) {
    StageIdentifier stageIdentifier = feedEntry.getStageIdentifier();
    LOGGER.debug("handling stage:<{}>...", stageIdentifier);
    try {
        stageStorage.save(stageResourceImporter.load(stageIdentifier, new InMemoryTempGraphFactory(), transformerRegistry));
        LOGGER.debug("importing stage:<{}> finished.", stageIdentifier);
    } catch (GoIntegrationException e) {
        LOGGER.error("Can not import stage <{}>, will skip to next...", stageIdentifier, e);
    }
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)

Example 20 with InMemoryTempGraphFactory

use of com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory in project gocd by gocd.

the class StageStorage method load.

public Graph load(StageIdentifier stageIdentifier) {
    String fileName = stagePath(stageIdentifier);
    try {
        InputStream inputStream = new BufferedInputStream(new FileInputStream(fileName));
        Graph tempGraph = new InMemoryTempGraphFactory().createTempGraph();
        tempGraph.addTriplesFromTurtle(inputStream);
        inputStream.close();
        return tempGraph;
    } catch (IOException e) {
        throw new ShineRuntimeException(String.format("Unable to read stage n3 file for " + stageIdentifier + "(file: %s). This should never happen.", fileName), e);
    }
}
Also used : Graph(com.thoughtworks.studios.shine.semweb.Graph) ShineRuntimeException(com.thoughtworks.studios.shine.ShineRuntimeException) BufferedInputStream(java.io.BufferedInputStream) BufferedInputStream(java.io.BufferedInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) IOException(java.io.IOException) InMemoryTempGraphFactory(com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory) FileInputStream(java.io.FileInputStream)

Aggregations

InMemoryTempGraphFactory (com.thoughtworks.studios.shine.semweb.sesame.InMemoryTempGraphFactory)37 Test (org.junit.Test)28 Graph (com.thoughtworks.studios.shine.semweb.Graph)18 File (java.io.File)14 ByteArrayInputStream (java.io.ByteArrayInputStream)9 InputStream (java.io.InputStream)7 Before (org.junit.Before)6 JobXmlViewModel (com.thoughtworks.go.server.domain.xml.JobXmlViewModel)2 XSLTTransformerRegistry (com.thoughtworks.studios.shine.semweb.grddl.XSLTTransformerRegistry)2 JobInstance (com.thoughtworks.go.domain.JobInstance)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 TestFailureSetup (com.thoughtworks.go.server.dao.sparql.TestFailureSetup)1 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)1 StageStorage (com.thoughtworks.studios.shine.cruise.stage.details.StageStorage)1 BoundVariables (com.thoughtworks.studios.shine.semweb.BoundVariables)1 GRDDLTransformer (com.thoughtworks.studios.shine.semweb.grddl.GRDDLTransformer)1 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1