Class EclipseJUnitViewSocketReporter

java.lang.Object
org.apache.maven.surefire.report.AbstractReporter
com.tibco.ep.buildmavenplugin.surefire.EclipseJUnitViewSocketReporter
All Implemented Interfaces:
org.apache.maven.surefire.report.Reporter

public class EclipseJUnitViewSocketReporter extends org.apache.maven.surefire.report.AbstractReporter

A Reporter that reports results via a socket connection to Eclipse (or StreamBase Studio) and its JUnit view, using a syntax and protocol specific to that view.

For the sake of development-level testing, the constructor accepts two debug-output booleans. When true, "traceCalls" prints to stdout whenever a Reporter interface call is made. When true, "traceSocketMessages" prints to stdout a copy of the messages sent to the JUnit client via the Socket connection.

  • Field Details

    • fPort

      protected final int fPort
      Port to connect to.
    • fTraceCalls

      protected final boolean fTraceCalls
      Is tracing of calls enabled?
    • fTraceSocketMessages

      protected final boolean fTraceSocketMessages
      Is tracing of socket messages enabled?
    • fClientSocket

      protected Socket fClientSocket
      The client socket.
    • fTestClasses

      protected final String[] fTestClasses
      The test classes (fully qualified)
    • fWriter

      protected PrintWriter fWriter
      Print writer for sending messages
    • fTestStartTime

      protected long fTestStartTime
      The start time for all tests; used to calculate the overall duration of all tests at the end
    • fTestNameToIdMap

      protected HashMap<String,Integer> fTestNameToIdMap
      JUnit wants unique integers assigned to tests; this map provides that mapping
    • fNextAvailableId

      protected int fNextAvailableId
      Tracks the next available unique ID number used for "fTestNameToIdMap"
  • Constructor Details

    • EclipseJUnitViewSocketReporter

      public EclipseJUnitViewSocketReporter(Integer testResultsPort, Boolean traceCalls, Boolean traceSocketMessages, String[] testClasses)
      Constructor
      Parameters:
      testResultsPort - test results port number
      traceCalls - true to trace calls
      traceSocketMessages - true to trace socket messages
      testClasses - test case classes
  • Method Details

    • connectToClient

      protected void connectToClient()
      Forms the Socket connection to the JUnit client in Eclipse/Studio
    • runFailed

      public void runFailed(String message, Exception exception)
      Run failed
      Parameters:
      message - failure message
      exception - exception
    • runStarting

      public void runStarting(int testCount)
      Specified by:
      runStarting in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      runStarting in class org.apache.maven.surefire.report.AbstractReporter
    • countNumberOfTestMethods

      protected int countNumberOfTestMethods()
    • countNumberOfTestMethodsIn

      protected int countNumberOfTestMethodsIn(String testClass)
    • runAborted

      public void runAborted(org.apache.maven.surefire.report.ReportEntry entry)
      Specified by:
      runAborted in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      runAborted in class org.apache.maven.surefire.report.AbstractReporter
    • runCompleted

      public void runCompleted()
      Specified by:
      runCompleted in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      runCompleted in class org.apache.maven.surefire.report.AbstractReporter
    • runStopped

      public void runStopped()
      Specified by:
      runStopped in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      runStopped in class org.apache.maven.surefire.report.AbstractReporter
    • getTestIdAndName

      protected String getTestIdAndName(org.apache.maven.surefire.report.ReportEntry entry)
    • testSetStarting

      public void testSetStarting(org.apache.maven.surefire.report.ReportEntry entry) throws org.apache.maven.surefire.report.ReporterException
      Specified by:
      testSetStarting in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testSetStarting in class org.apache.maven.surefire.report.AbstractReporter
      Throws:
      org.apache.maven.surefire.report.ReporterException
    • testMethodsIn

      protected List<Method> testMethodsIn(String testName) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • isTestMethod

      protected boolean isTestMethod(Method m)
    • testSetAborted

      public void testSetAborted(org.apache.maven.surefire.report.ReportEntry entry)
      Specified by:
      testSetAborted in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testSetAborted in class org.apache.maven.surefire.report.AbstractReporter
    • testSetCompleted

      public void testSetCompleted(org.apache.maven.surefire.report.ReportEntry entry) throws org.apache.maven.surefire.report.ReporterException
      Specified by:
      testSetCompleted in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testSetCompleted in class org.apache.maven.surefire.report.AbstractReporter
      Throws:
      org.apache.maven.surefire.report.ReporterException
    • testSkipped

      public void testSkipped(org.apache.maven.surefire.report.ReportEntry entry)
      Specified by:
      testSkipped in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testSkipped in class org.apache.maven.surefire.report.AbstractReporter
    • testStarting

      public void testStarting(org.apache.maven.surefire.report.ReportEntry entry)
      Specified by:
      testStarting in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testStarting in class org.apache.maven.surefire.report.AbstractReporter
    • testSucceeded

      public void testSucceeded(org.apache.maven.surefire.report.ReportEntry entry)
      Specified by:
      testSucceeded in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testSucceeded in class org.apache.maven.surefire.report.AbstractReporter
    • testError

      public void testError(org.apache.maven.surefire.report.ReportEntry entry, String stdOut, String stdErr)
      Specified by:
      testError in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testError in class org.apache.maven.surefire.report.AbstractReporter
    • testFailed

      public void testFailed(org.apache.maven.surefire.report.ReportEntry entry, String stdOut, String stdErr)
      Specified by:
      testFailed in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      testFailed in class org.apache.maven.surefire.report.AbstractReporter
    • printReportEntry

      protected void printReportEntry(org.apache.maven.surefire.report.ReportEntry entry)
    • printReportEntry

      protected void printReportEntry(org.apache.maven.surefire.report.ReportEntry entry, PrintStream out)
    • writeFooter

      public void writeFooter(String arg0)
      Specified by:
      writeFooter in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      writeFooter in class org.apache.maven.surefire.report.AbstractReporter
    • writeMessage

      public void writeMessage(String arg0)
    • reset

      public void reset()
      Specified by:
      reset in interface org.apache.maven.surefire.report.Reporter
      Overrides:
      reset in class org.apache.maven.surefire.report.AbstractReporter
    • sendMessage

      protected void sendMessage(String msg)
    • getTestId

      protected int getTestId(String testName)