Esempio n. 1
0
  @Test(expected = RuntimeException.class)
  public void exceptionDuringPublishingIsNotIgnored() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    doThrow(IOException.class).when(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
    rmqSink.invoke("msg");
  }
Esempio n. 2
0
  @Test
  public void exceptionDuringPublishingIsIgnoredIfLogFailuresOnly() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();
    rmqSink.setLogFailuresOnly(true);

    doThrow(IOException.class).when(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
    rmqSink.invoke("msg");
  }
Esempio n. 3
0
  @Test
  public void invokePublishBytesToQueue() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    rmqSink.invoke(MESSAGE_STR);
    verify(serializationSchema).serialize(MESSAGE_STR);
    verify(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
  }
Esempio n. 4
0
  @Test
  public void closeAllResources() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    rmqSink.close();

    verify(channel).close();
    verify(connection).close();
  }
Esempio n. 5
0
 private RMQSink<String> createRMQSink() throws Exception {
   RMQSink rmqSink = new RMQSink<String>(rmqConnectionConfig, QUEUE_NAME, serializationSchema);
   rmqSink.open(new Configuration());
   return rmqSink;
 }