use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class CertificateReaderTest method readkey.
@Test
public void readkey() throws Exception {
Configuration config = new MapConfiguration(new HashMap<String, String>() {
{
put(ConfigProperties.CA_CERT, "target/test/resources/certs/test.crt");
put(ConfigProperties.CA_CERT_UPSTREAM, "target/test/resources/certs/upstream");
put(ConfigProperties.CA_KEY, "target/test/resources/keys/pkcs1-des-encrypted.pem");
put(ConfigProperties.CA_KEY_PASSWORD, "password");
}
});
new CertificateReader(config, new PrivateKeyReader());
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class CustomizableModulesTest method shouldLoadAndParseConfigurationFile.
@Test
public void shouldLoadAndParseConfigurationFile() throws Exception {
Configuration config = new PropertiesFileConfiguration(getAbsolutePath("customizable_modules_test.conf"));
Set<Module> loaded = new CustomizableModules().load(config);
assertEquals(1, loaded.size());
assertTrue(loaded.iterator().next() instanceof DummyModuleForTesting);
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class LoggingConfigurator method init.
public static void init(Configuration config) {
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
Configuration logLevels = config.strippedSubset(ConfigurationPrefixes.LOGGING_CONFIG_PREFIX);
for (String key : logLevels.getKeys()) {
lc.getLogger(key).setLevel(Level.toLevel(logLevels.getString(key)));
}
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class AtomFeedResourceTest method setUp.
@Before
public void setUp() {
Configuration config = mock(Configuration.class);
injector = Guice.createInjector(new TestingModules.MockJpaModule(), new TestingModules.StandardTest(config), new TestingModules.ServletEnvironmentModule());
i18n = injector.getInstance(I18n.class);
ec = mock(EventCurator.class);
ea = new EventAdapterImpl(new ConfigForTesting(), i18n);
afr = new AtomFeedResource(ec, ea);
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class ConsumerResourceUpdateTest method init.
@Before
public void init() throws Exception {
Configuration config = new CandlepinCommonTestConfig();
this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
testMigration = new GuestMigration(consumerCurator);
migrationProvider = Providers.of(testMigration);
this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.ownerCurator);
this.resource = new ConsumerResource(this.consumerCurator, this.consumerTypeCurator, null, this.subscriptionService, this.ownerService, null, this.idCertService, null, this.i18n, this.sink, this.eventFactory, null, null, this.userService, poolManager, null, null, this.activationKeyCurator, this.entitler, this.complianceRules, this.deletedConsumerCurator, this.environmentCurator, null, config, null, null, null, this.consumerBindUtil, null, null, new FactValidator(config, this.i18n), null, consumerEnricher, migrationProvider, this.translator);
when(complianceRules.getStatus(any(Consumer.class), any(Date.class), any(Boolean.class), any(Boolean.class))).thenReturn(new ComplianceStatus(new Date()));
when(idCertService.regenerateIdentityCert(any(Consumer.class))).thenReturn(new IdentityCertificate());
when(consumerEventBuilder.setEventData(any(Consumer.class))).thenReturn(consumerEventBuilder);
when(eventFactory.getEventBuilder(any(Target.class), any(Type.class))).thenReturn(consumerEventBuilder);
}
Aggregations