Search in sources :

Example 1 with ConfigElementImplementationRegistrar

use of com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar in project gocd by gocd.

the class ConfigElementImplementationRegistryMother method withNoPlugins.

public static ConfigElementImplementationRegistry withNoPlugins() {
    ConfigElementImplementationRegistry registry = new ConfigElementImplementationRegistry(new NoPluginsInstalled());
    new ConfigElementImplementationRegistrar(registry).initialize();
    return registry;
}
Also used : ConfigElementImplementationRegistry(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry) ConfigElementImplementationRegistrar(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar) NoPluginsInstalled(com.thoughtworks.go.config.registry.NoPluginsInstalled)

Example 2 with ConfigElementImplementationRegistrar

use of com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar in project gocd by gocd.

the class ConfigCipherUpdaterTest method setUp.

@Before
public void setUp() throws Exception {
    systemEnvironment.setProperty(SystemEnvironment.CONFIG_DIR_PROPERTY, temporaryFolder.newFolder().getAbsolutePath());
    final Date currentTime = new DateTime().toDate();
    timestamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(currentTime);
    updater = new ConfigCipherUpdater(systemEnvironment, new TimeProvider() {

        @Override
        public Date currentTime() {
            return currentTime;
        }
    });
    configCache = new ConfigCache();
    registry = new ConfigElementImplementationRegistry(new NoPluginsInstalled());
    ConfigElementImplementationRegistrar registrar = new ConfigElementImplementationRegistrar(registry);
    registrar.initialize();
    magicalGoConfigXmlLoader = new MagicalGoConfigXmlLoader(configCache, registry);
    File configFileEncryptedWithFlawedCipher = new ClassPathResource("cruise-config-with-encrypted-with-flawed-cipher.xml").getFile();
    FileUtil.writeContentToFile(ConfigCipherUpdater.FLAWED_VALUE, systemEnvironment.getCipherFile());
    ReflectionUtil.setStaticField(CipherProvider.class, "cachedKey", null);
    String xml = ConfigMigrator.migrate(FileUtil.readContentFromFile(configFileEncryptedWithFlawedCipher));
    originalConfigFile = new File(systemEnvironment.getCruiseConfigFile());
    FileUtils.writeStringToFile(originalConfigFile, xml);
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) Date(java.util.Date) DateTime(org.joda.time.DateTime) ClassPathResource(org.springframework.core.io.ClassPathResource) ConfigElementImplementationRegistry(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry) ConfigElementImplementationRegistrar(com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar) NoPluginsInstalled(com.thoughtworks.go.config.registry.NoPluginsInstalled) SimpleDateFormat(java.text.SimpleDateFormat) File(java.io.File) Before(org.junit.Before)

Aggregations

ConfigElementImplementationRegistrar (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar)2 ConfigElementImplementationRegistry (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry)2 NoPluginsInstalled (com.thoughtworks.go.config.registry.NoPluginsInstalled)2 TimeProvider (com.thoughtworks.go.util.TimeProvider)1 File (java.io.File)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 DateTime (org.joda.time.DateTime)1 Before (org.junit.Before)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1