示例#1
0
 @Test
 public void rulesDeletedShouldEmitSuccessfully() throws Exception {
   Rules oldRules = new Rules(TestUtil.createRulesBlob(1));
   eventSinkImpl.emitRulesDeleted(oldRules);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#2
0
 @Test
 public void emptyKeyShouldEmitSuccessfully() throws Exception {
   ActivationKey key = TestUtil.createActivationKey(new Owner("deadbeef"), null);
   eventSinkImpl.emitActivationKeyCreated(key);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#3
0
 @Test
 public void importCreatedShouldEmitSuccessfully() throws Exception {
   Owner owner = new Owner("Import guy");
   eventSinkImpl.emitImportCreated(owner);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#4
0
 @Test
 public void exportCreatedShouldEmitSuccessfully() throws Exception {
   Consumer consumer = TestUtil.createConsumer();
   eventSinkImpl.emitExportCreated(consumer);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#5
0
 @Test
 public void poolCreatedShouldEmitSuccessfully() throws Exception {
   Pool pool = TestUtil.createPool(o, TestUtil.createProduct(o));
   eventSinkImpl.emitPoolCreated(pool);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#6
0
 @Test
 public void keyWithPoolsShouldEmitSuccessfully() throws Exception {
   ArrayList<Pool> pools = new ArrayList<Pool>();
   pools.add(TestUtil.createPool(o, TestUtil.createProduct(o)));
   pools.add(TestUtil.createPool(o, TestUtil.createProduct(o)));
   ActivationKey key = TestUtil.createActivationKey(new Owner("deadbeef"), pools);
   eventSinkImpl.emitActivationKeyCreated(key);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }
示例#7
0
 @Test
 public void sendEventShouldSendMessageOnProperEventInput() throws Exception {
   final String content = "Simple String";
   doReturn(content).when(mapper).writeValueAsString(anyObject());
   ArgumentCaptor<ClientMessage> argumentCaptor = ArgumentCaptor.forClass(ClientMessage.class);
   eventSinkImpl.queueEvent(mock(Event.class));
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(argumentCaptor.capture());
   assertEquals(content, argumentCaptor.getValue().getBodyBuffer().readString());
 }
示例#8
0
 @Test
 public void ownerCreatedShouldEmitSuccessfully() throws Exception {
   eventSinkImpl.emitOwnerCreated(o);
   eventSinkImpl.sendEvents();
   verify(mockClientProducer).send(any(ClientMessage.class));
 }