public void onSetUp() throws IOException { initializeConfigFile(); goConfigDao.forceReload(); writeConfigFile(load()); originalConfigDir = sysEnv.getConfigDir(); File configDir = configFile.getParentFile(); sysEnv.setProperty(SystemEnvironment.CONFIG_DIR_PROPERTY, configDir.getAbsolutePath()); }
private GoConfigFileHelper(String xml, GoConfigDao goConfigDao) { new SystemEnvironment().setProperty(SystemEnvironment.ENFORCE_SERVERID_MUTABILITY, "N"); this.originalXml = xml; assignFileDao(goConfigDao); try { File dir = TestFileUtil.createTempFolder("server-config-dir"); this.configFile = new File(dir, "cruise-config.xml"); configFile.deleteOnExit(); sysEnv = new SystemEnvironment(); sysEnv.setProperty(SystemEnvironment.CONFIG_FILE_PROPERTY, configFile.getAbsolutePath()); initializeConfigFile(); } catch (IOException e) { throw bomb("Error creating config file", e); } }
@Test public void shouldRemoveBuildCauseIfPipelineNotExist() throws Exception { configHelper.addPipeline("cruise", "dev", repository); goConfigService.forceNotifyListeners(); scheduleHelper.autoSchedulePipelinesWithRealMaterials("mingle", "evolve", "cruise"); Assertions.assertWillHappen( 2, PipelineScheduleQueueMatcher.numberOfScheduledPipelinesIsAtLeast(pipelineScheduleQueue), Timeout.FIVE_SECONDS); int originalSize = pipelineScheduleQueue.toBeScheduled().size(); assertThat(originalSize, greaterThan(1)); configHelper.initializeConfigFile(); goConfigService.forceNotifyListeners(); scheduleService.autoSchedulePipelinesFromRequestBuffer(); assertThat(pipelineScheduleQueue.toBeScheduled().size(), is(0)); }
private void useConfig(String configContents) throws Exception { GoConfigFileHelper goConfigFileHelper = new GoConfigFileHelper(configContents); goConfigFileHelper.initializeConfigFile(); }