use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class PoolHelperTest method init.
@Before
public void init() {
pm = mock(PoolManager.class);
psa = mock(ProductServiceAdapter.class);
ent = mock(Entitlement.class);
productCurator = Mockito.mock(ProductCurator.class);
Configuration config = mock(Configuration.class);
when(config.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
owner = TestUtil.createOwner();
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class CandlepinModule method configureJPA.
protected void configureJPA() {
Configuration jpaConfig = config.strippedSubset(ConfigurationPrefixes.JPA_CONFIG_PREFIX);
install(new JpaPersistModule("default").properties(jpaConfig.toProperties()));
bind(JPAInitializer.class).asEagerSingleton();
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class QpidQmfTest method liveTest.
@Ignore("This test requires running qpid broker and is useful only for development")
@Test
public void liveTest() throws URISyntaxException, JMSException, InterruptedException {
Configuration config = new CandlepinCommonTestConfig();
config.setProperty("trust_store", "/etc/candlepin/certs/amqp/candlepin.truststore");
config.setProperty("trust_store_password", "password");
config.setProperty("key_store", "/etc/candlepin/certs/amqp/candlepin.jks");
config.setProperty("key_store_password", "password");
config.setProperty("retries", "0");
config.setProperty("connectdelay", "1");
// QpidConnection connection = new QpidConnection(new QpidConfigBuilder(config));
// QpidQmf qmf = new QpidQmf(connection, config);
// System.out.println(qmf.getStatus());
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class ProductResourceTest method testRefreshPoolsByProduct.
@Test
public void testRefreshPoolsByProduct() {
Configuration config = new MapConfiguration(this.config);
config.setProperty(ConfigProperties.STANDALONE, "false");
ProductResource productResource = new ProductResource(this.productCurator, this.ownerCurator, this.productCertificateCurator, config, this.i18n, this.modelTranslator);
List<Owner> owners = this.setupDBForOwnerProdTests();
Owner owner1 = owners.get(0);
Owner owner2 = owners.get(1);
Owner owner3 = owners.get(2);
JobDetail[] jobs;
jobs = productResource.refreshPoolsForProduct(Arrays.asList("p1"), true);
assertNotNull(jobs);
assertEquals(2, jobs.length);
this.verifyRefreshPoolsJobs(jobs, Arrays.asList(owner1, owner2), true);
jobs = productResource.refreshPoolsForProduct(Arrays.asList("p1", "p2"), false);
assertNotNull(jobs);
assertEquals(3, jobs.length);
this.verifyRefreshPoolsJobs(jobs, Arrays.asList(owner1, owner2, owner3), false);
jobs = productResource.refreshPoolsForProduct(Arrays.asList("p3"), false);
assertNotNull(jobs);
assertEquals(1, jobs.length);
this.verifyRefreshPoolsJobs(jobs, Arrays.asList(owner3), false);
jobs = productResource.refreshPoolsForProduct(Arrays.asList("nope"), false);
assertNotNull(jobs);
assertEquals(0, jobs.length);
}
use of org.candlepin.common.config.Configuration in project candlepin by candlepin.
the class PinsetterKernelTest method updateMultipleSchedules.
@Test
public void updateMultipleSchedules() throws Exception {
Map<String, String> props = new HashMap<>();
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 key = jobKey("org.candlepin.pinsetter.tasks.JobCleaner");
jobs.add(key);
JobKey key2 = jobKey("org.candlepin.pinsetter.tasks.JobCleaner2");
jobs.add(key2);
CronTrigger cronTrigger = mock(CronTrigger.class);
when(cronTrigger.getJobKey()).thenReturn(key);
when(cronTrigger.getCronExpression()).thenReturn("*/7 * * * * ?");
when(sched.getJobKeys(eq(jobGroupEquals(crongrp)))).thenReturn(jobs);
when(sched.getTrigger(any(TriggerKey.class))).thenReturn(cronTrigger);
when(sched.getJobDetail(any(JobKey.class))).thenReturn(jobDetail);
doReturn(JobCleaner.class).when(jobDetail).getJobClass();
pk = new PinsetterKernel(config, jfactory, jlistener, jcurator, sfactory, triggerListener, modeManager);
pk.startup();
verify(sched, times(2)).deleteJob(any(JobKey.class));
verify(jcurator).create(any(JobStatus.class));
}
Aggregations