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);
}
Aggregations