Search in sources :

Example 6 with Configuration

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());
}
Also used : MapConfiguration(org.candlepin.common.config.MapConfiguration) Configuration(org.candlepin.common.config.Configuration) MapConfiguration(org.candlepin.common.config.MapConfiguration) PrivateKeyReader(org.candlepin.pki.PrivateKeyReader) CertificateReader(org.candlepin.pki.CertificateReader) Test(org.junit.Test)

Example 7 with Configuration

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);
}
Also used : PropertiesFileConfiguration(org.candlepin.common.config.PropertiesFileConfiguration) Configuration(org.candlepin.common.config.Configuration) PropertiesFileConfiguration(org.candlepin.common.config.PropertiesFileConfiguration) Module(com.google.inject.Module) Test(org.junit.Test)

Example 8 with Configuration

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)));
    }
}
Also used : Configuration(org.candlepin.common.config.Configuration) LoggerContext(ch.qos.logback.classic.LoggerContext)

Example 9 with Configuration

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);
}
Also used : MapConfiguration(org.candlepin.common.config.MapConfiguration) Configuration(org.candlepin.common.config.Configuration) EventAdapterImpl(org.candlepin.audit.EventAdapterImpl) EventCurator(org.candlepin.model.EventCurator) I18n(org.xnap.commons.i18n.I18n) Before(org.junit.Before)

Example 10 with Configuration

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);
}
Also used : FactValidator(org.candlepin.util.FactValidator) Configuration(org.candlepin.common.config.Configuration) ComplianceStatus(org.candlepin.policy.js.compliance.ComplianceStatus) StandardTranslator(org.candlepin.dto.StandardTranslator) Date(java.util.Date) GuestMigration(org.candlepin.resource.util.GuestMigration) Target(org.candlepin.audit.Event.Target) Type(org.candlepin.audit.Event.Type) ConsumerType(org.candlepin.model.ConsumerType) Consumer(org.candlepin.model.Consumer) CandlepinCommonTestConfig(org.candlepin.config.CandlepinCommonTestConfig) Mockito.anyBoolean(org.mockito.Mockito.anyBoolean) IdentityCertificate(org.candlepin.model.IdentityCertificate) Before(org.junit.Before)

Aggregations

Configuration (org.candlepin.common.config.Configuration)20 MapConfiguration (org.candlepin.common.config.MapConfiguration)9 Test (org.junit.Test)9 Before (org.junit.Before)7 JobDetail (org.quartz.JobDetail)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 CandlepinCommonTestConfig (org.candlepin.config.CandlepinCommonTestConfig)3 JobCleaner (org.candlepin.pinsetter.tasks.JobCleaner)3 CronTrigger (org.quartz.CronTrigger)3 Date (java.util.Date)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 ServletContext (javax.servlet.ServletContext)2 Target (org.candlepin.audit.Event.Target)2 Type (org.candlepin.audit.Event.Type)2 ConfigurationException (org.candlepin.common.config.ConfigurationException)2 PropertiesFileConfiguration (org.candlepin.common.config.PropertiesFileConfiguration)2 StandardTranslator (org.candlepin.dto.StandardTranslator)2 Consumer (org.candlepin.model.Consumer)2