use of com.thoughtworks.studios.shine.cruise.stage.details.StageResourceImporter in project gocd by gocd.
the class ShineDaoIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
dbHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
result = new SubsectionLocalizedOperationResult();
File tempFolder = temporaryFolder.newFolder("artifacts");
String artifactsRoot = tempFolder.getAbsolutePath();
stageStorage.clear();
StageResourceImporter importer = new StageResourceImporter(artifactsRoot, xmlApiService, stageService, pipelineHistoryService, systemEnvironment);
LazyStageGraphLoader graphLoader = new LazyStageGraphLoader(importer, stageStorage);
StagesQuery stagesQuery = new StagesQuery(graphLoader, stagesQueryCache);
shineDao = new ShineDao(stagesQuery, stageService, pipelineHistoryService);
goURLRepository = new StubGoURLRepository("http://localhost:8153", artifactsRoot);
failureSetup = new TestFailureSetup(materialRepository, dbHelper, pipelineTimeline, configHelper, transactionTemplate);
TestFailureSetup.SavedStage savedStage = failureSetup.setupPipelineInstance(true, null, goURLRepository);
pipeline = savedStage.pipeline;
stageId = savedStage.stageId;
}
use of com.thoughtworks.studios.shine.cruise.stage.details.StageResourceImporter in project gocd by gocd.
the class BackgroundStageLoaderIntegrationTest method stageWithInvalidJobPropertiesShouldNotSaveStageToStageStorage.
@Test
public void stageWithInvalidJobPropertiesShouldNotSaveStageToStageStorage() {
PropertiesService propertiesService = mock(PropertiesService.class);
when(propertiesService.getPropertiesForJob(anyLong())).thenThrow(new RuntimeException("something bad happened"));
xmlApiService = new XmlApiService(propertiesService, artifactsService, jobInstanceService, stageService);
StageResourceImporter importer = new StageResourceImporter("/artifacts", xmlApiService, stageFinder, pipelineInstanceLoader, systemEnvironment);
loader = new BackgroundStageLoader(null, importer, stageStorage, pipelineHistoryService, stageService, systemEnvironment);
TestFailureSetup.SavedStage stage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
try {
loader.handle(feedEntry(stage), pipelineInstanceLoader);
fail("should have failed as properties api bombed");
} catch (Exception e) {
// expected
}
assertFalse(stageStorage.isStageStored(stage.stageId));
}
use of com.thoughtworks.studios.shine.cruise.stage.details.StageResourceImporter in project gocd by gocd.
the class BackgroundStageLoaderIntegrationTest method stageWithInvalidPipelineFeedShouldNotSaveStageToStageStorage.
@Test
public void stageWithInvalidPipelineFeedShouldNotSaveStageToStageStorage() {
TestFailureSetup.SavedStage stage = failureSetup.setupPipelineInstanceWithoutTestXmlStubbing(true, null, new Date());
pipelineInstanceLoader = mock(PipelineInstanceLoader.class);
when(pipelineInstanceLoader.loadPipelineForShine(anyLong())).thenThrow(new RuntimeException("ouch, that hurt!"));
StageResourceImporter importer = new StageResourceImporter("/artifacts", xmlApiService, stageFinder, pipelineInstanceLoader, systemEnvironment);
loader = new BackgroundStageLoader(null, importer, stageStorage, pipelineHistoryService, stageService, systemEnvironment);
try {
loader.handle(feedEntry(stage), pipelineInstanceLoader);
fail("should have failed as pipeline load bombed");
} catch (Exception e) {
// expected
}
assertFalse(stageStorage.isStageStored(stage.stageId));
}
use of com.thoughtworks.studios.shine.cruise.stage.details.StageResourceImporter in project gocd by gocd.
the class BackgroundStageLoaderIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
dbHelper.onSetUp();
File tempFolder = temporaryFolder.newFolder("shine");
stageStorage = new StageStorage(tempFolder.getAbsolutePath());
stageStorage.clear();
stageFinder = stageService;
pipelineInstanceLoader = pipelineHistoryService;
StageResourceImporter importer = new StageResourceImporter("/artifacts", xmlApiService, stageFinder, pipelineInstanceLoader, systemEnvironment);
loader = new BackgroundStageLoader(null, importer, stageStorage, pipelineHistoryService, stageService, systemEnvironment);
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
failureSetup = new TestFailureSetup(materialRepository, dbHelper, pipelineTimeline, configHelper, transactionTemplate);
}
Aggregations