Ejemplo n.º 1
0
  @Test
  public void testSwiftService() throws Exception {
    SwiftScribe scribeService = new SwiftScribe();
    NiftyProcessor processor =
        new ThriftServiceProcessor(
            new ThriftCodecManager(), ImmutableList.<ThriftEventHandler>of(), scribeService);

    List<LogEntry> messages = testProcessor(processor);
    assertEquals(
        scribeService.getMessages(),
        newArrayList(concat(toSwiftLogEntry(messages), toSwiftLogEntry(messages))));
  }
Ejemplo n.º 2
0
  public void swiftEventHandlerTester(boolean niftyProcessor) throws Exception {
    SwiftScribe scribeService = new SwiftScribe();
    EventHandler eventHandler = new EventHandler(niftyProcessor);
    EventHandler secondHandler = new EventHandler(niftyProcessor);
    List<EventHandler> handlers = ImmutableList.of(eventHandler, secondHandler);
    final ThriftServiceProcessor processor =
        new ThriftServiceProcessor(new ThriftCodecManager(), handlers, scribeService);

    List<LogEntry> messages =
        niftyProcessor
            ? testProcessor(processor)
            : testProcessor(NiftyProcessorAdapters.processorToTProcessor(processor));
    assertEquals(
        scribeService.getMessages(),
        newArrayList(concat(toSwiftLogEntry(messages), toSwiftLogEntry(messages))));
    assertTrue(eventHandler.validate(2));
    assertTrue(secondHandler.validate(2));
  }