use of org.candlepin.config.CandlepinCommonTestConfig in project candlepin by candlepin.
the class HypervisorResourceTest method setupTest.
@Before
public void setupTest() {
Configuration config = new CandlepinCommonTestConfig();
testMigration = new GuestMigration(consumerCurator);
migrationProvider = Providers.of(testMigration);
this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
this.hypervisorType = new ConsumerType(ConsumerTypeEnum.HYPERVISOR);
this.hypervisorType.setId("test-hypervisor-ctype");
this.mockConsumerType(this.hypervisorType);
this.modelTranslator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.ownerCurator);
this.consumerResource = 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, null, null, this.ownerCurator, this.activationKeyCurator, null, this.complianceRules, this.deletedConsumerCurator, null, null, config, null, null, null, this.consumerBindUtil, null, null, new FactValidator(config, this.i18n), null, consumerEnricher, migrationProvider, modelTranslator);
this.guestIdResource = new GuestIdResource(this.guestIdCurator, this.consumerCurator, this.consumerTypeCurator, this.consumerResource, this.i18n, this.eventFactory, this.sink, migrationProvider, modelTranslator);
this.hypervisorResource = new HypervisorResource(consumerResource, consumerCurator, consumerTypeCurator, i18n, ownerCurator, migrationProvider, modelTranslator, guestIdResource);
// Ensure that we get the consumer that was passed in back from the create call.
when(consumerCurator.create(any(Consumer.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return invocation.getArguments()[0];
}
});
when(consumerCurator.create(any(Consumer.class), any(Boolean.class))).thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return invocation.getArguments()[0];
}
});
when(complianceRules.getStatus(any(Consumer.class), any(Date.class), any(Boolean.class))).thenReturn(new ComplianceStatus(new Date()));
when(ownerCurator.lookupByKey(any(String.class))).thenReturn(new Owner());
when(eventFactory.getEventBuilder(any(Target.class), any(Type.class))).thenReturn(consumerEventBuilder);
when(consumerEventBuilder.setEventData(any(Consumer.class))).thenReturn(consumerEventBuilder);
}
use of org.candlepin.config.CandlepinCommonTestConfig in project candlepin by candlepin.
the class EventSinkImplTest method init.
@Before
public void init() throws Exception {
this.factory = new EventFactory(mockPrincipalProvider);
this.principal = TestUtil.createOwnerPrincipal();
eventFilter = new EventFilter(new CandlepinCommonTestConfig());
when(mockPrincipalProvider.get()).thenReturn(this.principal);
when(mockSessionFactory.createTransactedSession()).thenReturn(mockClientSession);
when(mockClientSession.createProducer(anyString())).thenReturn(mockClientProducer);
when(mockClientSession.createMessage(anyBoolean())).thenReturn(mockClientMessage);
when(mockClientMessage.getBodyBuffer()).thenReturn(ActiveMQBuffers.fixedBuffer(2000));
when(mockSessionFactory.getServerLocator()).thenReturn(mockLocator);
this.mapper = spy(new ObjectMapper());
this.eventSinkImpl = createEventSink(mockSessionFactory);
o = new Owner("test owner");
}
use of org.candlepin.config.CandlepinCommonTestConfig in project candlepin by candlepin.
the class ModeManagerTest method setUp.
@Before
public void setUp() {
I18n mockedi18 = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
modeManager = new ModeManagerImpl(new CandlepinCommonTestConfig(), mockedi18);
testReason = Reason.STARTUP;
modeChanged = false;
}
use of org.candlepin.config.CandlepinCommonTestConfig 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());
}
Aggregations