use of org.candlepin.guice.PrincipalProvider in project candlepin by candlepin.
the class EventFactoryTest method init.
@Before
public void init() throws Exception {
principalProvider = mock(PrincipalProvider.class);
Principal principal = mock(Principal.class);
when(principalProvider.get()).thenReturn(principal);
eventFactory = new EventFactory(principalProvider);
}
use of org.candlepin.guice.PrincipalProvider in project candlepin by candlepin.
the class EventBuilderTest method init.
@Before
public void init() throws Exception {
principalProvider = mock(PrincipalProvider.class);
Principal principal = mock(Principal.class);
factory = new EventFactory(principalProvider);
when(principalProvider.get()).thenReturn(principal);
}
use of org.candlepin.guice.PrincipalProvider in project candlepin by candlepin.
the class AMQPBusPublisherTest method onEvent.
@Test
public void onEvent() throws JMSException {
PrincipalProvider pp = mock(PrincipalProvider.class);
when(pp.get()).thenReturn(TestUtil.createPrincipal("admin", null, null));
EventFactory factory = new EventFactory(pp);
Consumer c = TestUtil.createConsumer();
Event e = factory.consumerCreated(c);
publisher.onEvent(e);
verify(qpid).sendTextMessage(Mockito.eq(Target.CONSUMER), Mockito.eq(Type.CREATED), Mockito.contains("TestConsumer"));
}
use of org.candlepin.guice.PrincipalProvider in project candlepin by candlepin.
the class AMQPBusPublisherTest method testApply.
@Test
public void testApply() throws IOException {
PrincipalProvider pp = mock(PrincipalProvider.class);
when(pp.get()).thenReturn(TestUtil.createPrincipal("admin", null, null));
EventFactory factory = new EventFactory(pp);
Consumer c = TestUtil.createConsumer();
Event e = factory.consumerCreated(c);
String value = publisher.apply(e);
Event e1 = mapper.readValue(value, Event.class);
assertEquals(e.getType(), e1.getType());
assertEquals(e.getTarget(), e1.getTarget());
}
Aggregations