Example #1
0
 /**
  * Creates config dao that has custom remote configuration parts provided by partialConfig
  * argument
  */
 public static GoConfigDao createTestingDao(GoPartialConfig partialConfig) {
   SystemEnvironment systemEnvironment = new SystemEnvironment();
   try {
     ServerHealthService serverHealthService = new ServerHealthService();
     ConfigRepository configRepository = new ConfigRepository(systemEnvironment);
     configRepository.initialize();
     FullConfigSaveNormalFlow normalFlow =
         new FullConfigSaveNormalFlow(
             new ConfigCache(),
             com.thoughtworks.go.util.ConfigElementImplementationRegistryMother.withNoPlugins(),
             systemEnvironment,
             new ServerVersion(),
             new TimeProvider(),
             configRepository,
             new CachedGoPartials(serverHealthService));
     GoFileConfigDataSource dataSource =
         new GoFileConfigDataSource(
             new DoNotUpgrade(),
             configRepository,
             systemEnvironment,
             new TimeProvider(),
             new ConfigCache(),
             new ServerVersion(),
             com.thoughtworks.go.util.ConfigElementImplementationRegistryMother.withNoPlugins(),
             serverHealthService,
             new CachedGoPartials(serverHealthService),
             null,
             normalFlow);
     dataSource.upgradeIfNecessary();
     CachedGoPartials cachedGoPartials = new CachedGoPartials(serverHealthService);
     CachedGoConfig cachedConfigService =
         new CachedGoConfig(serverHealthService, dataSource, cachedGoPartials, null, null);
     cachedConfigService.loadConfigIfNull();
     return new GoConfigDao(cachedConfigService);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
Example #2
0
 public void getXml(CruiseConfig cruiseConfig, ByteArrayOutputStream buffer) throws Exception {
   new MagicalGoConfigXmlWriter(
           new ConfigCache(),
           com.thoughtworks.go.util.ConfigElementImplementationRegistryMother.withNoPlugins())
       .write(cruiseConfig, buffer, false);
 }