Search in sources :

Example 6 with NoPluginsInstalled

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

the class ConfigCipherUpdaterTest method setUp.

@BeforeEach
public void setUp(@TempDir File configDir) throws Exception {
    systemEnvironment.setProperty(SystemEnvironment.CONFIG_DIR_PROPERTY, configDir.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();
    writeStringToFile(systemEnvironment.getDESCipherFile(), FLAWED_VALUE, UTF_8);
    ReflectionUtil.setStaticField(DESCipherProvider.class, "cachedKey", null);
    ReflectionUtil.setStaticField(AESCipherProvider.class, "cachedKey", null);
    originalConfigFile = new File(systemEnvironment.getCruiseConfigFile());
    writeStringToFile(originalConfigFile, readFileToString(configFileEncryptedWithFlawedCipher, UTF_8), UTF_8);
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) 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) Date(java.util.Date) DateTime(org.joda.time.DateTime) ClassPathResource(org.springframework.core.io.ClassPathResource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConfigElementImplementationRegistry (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistry)6 NoPluginsInstalled (com.thoughtworks.go.config.registry.NoPluginsInstalled)6 ConfigElementImplementationRegistrar (com.thoughtworks.go.config.registry.ConfigElementImplementationRegistrar)4 TimeProvider (com.thoughtworks.go.util.TimeProvider)2 File (java.io.File)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 DateTime (org.joda.time.DateTime)2 Before (org.junit.Before)2 ClassPathResource (org.springframework.core.io.ClassPathResource)2 ConfigFileHasChangedException (com.thoughtworks.go.config.exceptions.ConfigFileHasChangedException)1 ConfigMergeException (com.thoughtworks.go.config.exceptions.ConfigMergeException)1 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)1 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)1 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)1 FullConfigUpdateCommand (com.thoughtworks.go.config.update.FullConfigUpdateCommand)1 ConfigRepoExtension (com.thoughtworks.go.plugin.access.configrepo.ConfigRepoExtension)1 GoConfigService (com.thoughtworks.go.server.service.GoConfigService)1 ServerVersion (com.thoughtworks.go.server.util.ServerVersion)1 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)1