コード例 #1
0
  /** Tests if a log message is sent as expected. */
  @Test
  public void testSendLogMessageAsConsoleRow() {
    Capture<ConsoleRow> consoleRowCapture = new Capture<>();
    ComponentExecutionRelatedInstances compExeRelatedInstances =
        createComponentExecutionRelatedInstances(consoleRowCapture);
    ConsoleRowsSender consoleRowsSender = new ConsoleRowsSender(compExeRelatedInstances);

    String payload = "some message";
    consoleRowsSender.sendLogMessageAsConsoleRow(ConsoleRow.Type.TOOL_ERROR, payload);

    ConsoleRow capturedConsoleRow =
        verifyAfterConsoleRowSent(consoleRowCapture, ConsoleRow.Type.TOOL_ERROR);
    assertEquals(payload, capturedConsoleRow.getPayload());
  }
コード例 #2
0
 private ConsoleRowsSender createConsoleRowsSenderMock(
     Capture<ConsoleRow.Type> consoleRowTypeCapture, Capture<String> logMessageCapture) {
   ConsoleRowsSender consoleRowsSenderMock = EasyMock.createStrictMock(ConsoleRowsSender.class);
   if (consoleRowTypeCapture != null) {
     consoleRowsSenderMock.sendLogMessageAsConsoleRow(
         EasyMock.capture(consoleRowTypeCapture),
         EasyMock.capture(logMessageCapture),
         EasyMock.anyInt());
     EasyMock.expectLastCall();
   }
   consoleRowsSenderMock.sendLogFileWriteTriggerAsConsoleRow();
   EasyMock.expectLastCall();
   EasyMock.replay(consoleRowsSenderMock);
   return consoleRowsSenderMock;
 }
コード例 #3
0
  /** Tests if a log message is sent as expected. */
  @Test
  public void testSendTimelineEventAsConsoleRow() {
    Capture<ConsoleRow> consoleRowCapture = new Capture<>();
    ComponentExecutionRelatedInstances compExeRelatedInstances =
        createComponentExecutionRelatedInstances(consoleRowCapture);
    ConsoleRowsSender consoleRowsSender = new ConsoleRowsSender(compExeRelatedInstances);

    consoleRowsSender.sendTimelineEventAsConsoleRow(
        ConsoleRow.Type.LIFE_CYCLE_EVENT, WorkflowLifecyleEventType.TOOL_STARTING.name());

    ConsoleRow capturedConsoleRow =
        verifyAfterConsoleRowSent(consoleRowCapture, ConsoleRow.Type.LIFE_CYCLE_EVENT);
    String[] payload = StringUtils.splitAndUnescape(capturedConsoleRow.getPayload());
    assertEquals(payload[0], WorkflowLifecyleEventType.TOOL_STARTING.name());
    assertEquals(payload[1], String.valueOf(DM_ID));
  }
コード例 #4
0
  /** Tests if a {@link ComponentState} is sent as expected. */
  @Test
  public void testSendStateAsConsoleRow() {
    Capture<ConsoleRow> consoleRowCapture = new Capture<>();
    ComponentExecutionRelatedInstances compExeRelatedInstances =
        createComponentExecutionRelatedInstances(consoleRowCapture);
    ConsoleRowsSender consoleRowsSender = new ConsoleRowsSender(compExeRelatedInstances);

    consoleRowsSender.sendStateAsConsoleRow(
        ConsoleRow.WorkflowLifecyleEventType.COMPONENT_TERMINATED);

    ConsoleRow capturedConsoleRow =
        verifyAfterConsoleRowSent(consoleRowCapture, ConsoleRow.Type.LIFE_CYCLE_EVENT);
    assertEquals(
        ConsoleRow.WorkflowLifecyleEventType.COMPONENT_TERMINATED.name(),
        capturedConsoleRow.getPayload());
  }
コード例 #5
0
  /**
   * Tests if the trigger for writing log files to the data management is done properly. That
   * includes that certain flags are set properly afterwards.
   */
  @Test
  public void testSendLogFileWriteTriggerAsConsoleRow() {

    Capture<ConsoleRow> consoleRowCapture = new Capture<>();
    ComponentExecutionRelatedInstances compExeRelatedInstances =
        createComponentExecutionRelatedInstances(consoleRowCapture);
    ConsoleRowsSender consoleRowsSender = new ConsoleRowsSender(compExeRelatedInstances);

    consoleRowsSender.sendLogFileWriteTriggerAsConsoleRow();

    ConsoleRow capturedConsoleRow =
        verifyAfterConsoleRowSent(consoleRowCapture, ConsoleRow.Type.LIFE_CYCLE_EVENT);

    String[] payload = StringUtils.splitAndUnescape(capturedConsoleRow.getPayload());
    assertEquals(ConsoleRow.WorkflowLifecyleEventType.COMPONENT_LOG_FINISHED.name(), payload[0]);
    assertEquals(String.valueOf(DM_ID), payload[1]);
    assertEquals(String.valueOf(EXE_COUNT), payload[2]);

    assertEquals(0, compExeRelatedInstances.compExeRelatedStates.consoleRowSequenceNumber.get());
    assertFalse(
        compExeRelatedInstances.compExeRelatedStates.compHasSentConsoleRowLogMessages.get());
  }