Package org.candlepin.common.config

Examples of org.candlepin.common.config.Configuration


public class CustomizableModulesTest {

    @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);
View Full Code Here


    // TODO: We should probably be more specific...
    @Test(expected = RuntimeException.class)
    public void shouldFailWhenConfigurationContainsMissingClass()
        throws Exception {

        Configuration config = new PropertiesFileConfiguration(
            getAbsolutePath("customizable_modules_with_missing_class.conf"));

        new CustomizableModules().load(config);
    }
View Full Code Here

        Map<String, String> props = new HashMap<String, String>();
        props.put(ConfigProperties.DEFAULT_TASKS, JobCleaner.class.getName());
        props.put("org.quartz.jobStore.isClustered", "true");
        props.put("pinsetter.org.candlepin.pinsetter.tasks." +
            "JobCleaner.schedule", "*/1 * * * * ?");
        Configuration config = new MapConfiguration(props);
        JobDetail jobDetail = mock(JobDetail.class);

        String crongrp = "cron group";
        Set<JobKey> jobs = new HashSet<JobKey>();
        JobKey key = jobKey("org.candlepin.pinsetter.tasks.JobCleaner");
View Full Code Here

        Map<String, String> props = new HashMap<String, String>();
        props.put(ConfigProperties.DEFAULT_TASKS, JobCleaner.class.getName());
        props.put("org.quartz.jobStore.isClustered", "true");
        props.put("pinsetter.org.candlepin.pinsetter.tasks." +
            "JobCleaner.schedule", "*/1 * * * * ?");
        Configuration config = new MapConfiguration(props);
        JobDetail jobDetail = mock(JobDetail.class);

        // Hack multiple job schedules for same job:
        String crongrp = "cron group";
        Set<JobKey> jobs = new HashSet<JobKey>();
View Full Code Here

    }

    @Test
    public void ensureCacheMaxIsConfigurable() {
        int maxProducts = 200;
        Configuration testConfigMock = mock(Configuration.class);
        when(testConfigMock.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX)))
            .thenReturn(maxProducts);
        ProductCache testCache = new ProductCache(testConfigMock, mockProductAdapter);
        for (int i = 0; i < 220; i++) {
            addProductToCache(testCache, "Prod" + i);
        }
View Full Code Here

        sub = mock(Subscription.class);
        pm = mock(PoolManager.class);
        psa = mock(ProductServiceAdapter.class);
        ent = mock(Entitlement.class);

        Configuration config = mock(Configuration.class);
        when(config.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
        productCache = new ProductCache(config, psa);

        // default to an empty list, override in the test
        when(pool.getProvidedProducts()).thenReturn(Collections.EMPTY_SET);
        when(sub.getProvidedProducts()).thenReturn(Collections.EMPTY_SET);
View Full Code Here

    @SuppressWarnings("unchecked")
    public void unrevoke() throws Exception {
        CrlGenerator crlgen = mock(CrlGenerator.class);
        CrlFileUtil fileutil = mock(CrlFileUtil.class);
        CertificateSerialCurator sercur = mock(CertificateSerialCurator.class);
        Configuration config = new ConfigForTesting();
        X509CRL crl = mock(X509CRL.class);
        when(fileutil.readCRLFile(any(File.class))).thenReturn(crl);
        when(crlgen.removeEntries(eq(crl), any(List.class))).thenReturn(crl);

        CrlResource res = new CrlResource(crlgen, fileutil, config, sercur);
View Full Code Here

    private ImportRecordCurator importRecordCurator;
    private ImportRecordJob job;

    @Before
    public void init() {
        Configuration config = mock(Configuration.class);
        CandlepinCommonTestingModule testingModule = new CandlepinCommonTestingModule(config);
        Injector injector = Guice.createInjector(
                testingModule,
                new CandlepinNonServletEnvironmentTestingModule()
        );
View Full Code Here

        pc = mock(ProductCurator.class);
        idgen = mock(UniqueIdGenerator.class);
        pcc = mock(ProductCertificateCurator.class);
        pki = mock(PKIUtility.class);
        cc = mock(ContentCurator.class);
        Configuration config = mock(Configuration.class);
        when(config.getBoolean(ConfigProperties.ENV_CONTENT_FILTERING)).thenReturn(false);
        extUtil = new X509ExtensionUtil(config);
        dpsa = new DefaultProductServiceAdapter(pc, pcc, pki, extUtil, cc, idgen);
    }
View Full Code Here

@RunWith(MockitoJUnitRunner.class)
public class DefaultSubscriptionServiceAdapterTest {

    @Test
    public void activationPrefix() {
        Configuration config = Mockito.mock(Configuration.class);
        Mockito.when(config.getString(ConfigProperties.ACTIVATION_DEBUG_PREFIX))
                .thenReturn("mega");

        Consumer consumer = Mockito.mock(Consumer.class);
        Mockito.when(consumer.getName()).thenReturn("megaman");
View Full Code Here

TOP

Related Classes of org.candlepin.common.config.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.