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 Summary
FieldsModifier and TypeFieldDescriptionprotected Socket
The client socket.protected int
Tracks the next available unique ID number used for "fTestNameToIdMap"protected final int
Port to connect to.protected final String[]
The test classes (fully qualified)JUnit wants unique integers assigned to tests; this map provides that mappingprotected long
The start time for all tests; used to calculate the overall duration of all tests at the endprotected final boolean
Is tracing of calls enabled?protected final boolean
Is tracing of socket messages enabled?protected PrintWriter
Print writer for sending messagesFields inherited from class org.apache.maven.surefire.report.AbstractReporter
completedCount, endTime, errors, failures, NL, skipped, startTime, testSetStartTime
-
Constructor Summary
ConstructorsConstructorDescriptionEclipseJUnitViewSocketReporter
(Integer testResultsPort, Boolean traceCalls, Boolean traceSocketMessages, String[] testClasses) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Forms the Socket connection to the JUnit client in Eclipse/Studioprotected int
protected int
countNumberOfTestMethodsIn
(String testClass) protected int
protected String
getTestIdAndName
(org.apache.maven.surefire.report.ReportEntry entry) protected boolean
protected void
printReportEntry
(org.apache.maven.surefire.report.ReportEntry entry) protected void
printReportEntry
(org.apache.maven.surefire.report.ReportEntry entry, PrintStream out) void
reset()
void
runAborted
(org.apache.maven.surefire.report.ReportEntry entry) void
void
Run failedvoid
runStarting
(int testCount) void
protected void
sendMessage
(String msg) void
void
testFailed
(org.apache.maven.surefire.report.ReportEntry entry, String stdOut, String stdErr) testMethodsIn
(String testName) void
testSetAborted
(org.apache.maven.surefire.report.ReportEntry entry) void
testSetCompleted
(org.apache.maven.surefire.report.ReportEntry entry) void
testSetStarting
(org.apache.maven.surefire.report.ReportEntry entry) void
testSkipped
(org.apache.maven.surefire.report.ReportEntry entry) void
testStarting
(org.apache.maven.surefire.report.ReportEntry entry) void
testSucceeded
(org.apache.maven.surefire.report.ReportEntry entry) void
writeFooter
(String arg0) void
writeMessage
(String arg0) Methods inherited from class org.apache.maven.surefire.report.AbstractReporter
elapsedTimeAsString, getErrorSources, getFailureSources, getNumErrors, getNumFailures, getNumSkipped, getNumTests, getStackTrace
-
Field Details
-
fPort
protected final int fPortPort to connect to. -
fTraceCalls
protected final boolean fTraceCallsIs tracing of calls enabled? -
fTraceSocketMessages
protected final boolean fTraceSocketMessagesIs tracing of socket messages enabled? -
fClientSocket
The client socket. -
fTestClasses
The test classes (fully qualified) -
fWriter
Print writer for sending messages -
fTestStartTime
protected long fTestStartTimeThe start time for all tests; used to calculate the overall duration of all tests at the end -
fTestNameToIdMap
JUnit wants unique integers assigned to tests; this map provides that mapping -
fNextAvailableId
protected int fNextAvailableIdTracks 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 numbertraceCalls
- true to trace callstraceSocketMessages
- true to trace socket messagestestClasses
- test case classes
-
-
Method Details
-
connectToClient
protected void connectToClient()Forms the Socket connection to the JUnit client in Eclipse/Studio -
runFailed
Run failed- Parameters:
message
- failure messageexception
- exception
-
runStarting
public void runStarting(int testCount) - Specified by:
runStarting
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
runStarting
in classorg.apache.maven.surefire.report.AbstractReporter
-
countNumberOfTestMethods
protected int countNumberOfTestMethods() -
countNumberOfTestMethodsIn
-
runAborted
public void runAborted(org.apache.maven.surefire.report.ReportEntry entry) - Specified by:
runAborted
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
runAborted
in classorg.apache.maven.surefire.report.AbstractReporter
-
runCompleted
public void runCompleted()- Specified by:
runCompleted
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
runCompleted
in classorg.apache.maven.surefire.report.AbstractReporter
-
runStopped
public void runStopped()- Specified by:
runStopped
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
runStopped
in classorg.apache.maven.surefire.report.AbstractReporter
-
getTestIdAndName
-
testSetStarting
public void testSetStarting(org.apache.maven.surefire.report.ReportEntry entry) throws org.apache.maven.surefire.report.ReporterException - Specified by:
testSetStarting
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testSetStarting
in classorg.apache.maven.surefire.report.AbstractReporter
- Throws:
org.apache.maven.surefire.report.ReporterException
-
testMethodsIn
- Throws:
ClassNotFoundException
-
isTestMethod
-
testSetAborted
public void testSetAborted(org.apache.maven.surefire.report.ReportEntry entry) - Specified by:
testSetAborted
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testSetAborted
in classorg.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 interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testSetCompleted
in classorg.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 interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testSkipped
in classorg.apache.maven.surefire.report.AbstractReporter
-
testStarting
public void testStarting(org.apache.maven.surefire.report.ReportEntry entry) - Specified by:
testStarting
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testStarting
in classorg.apache.maven.surefire.report.AbstractReporter
-
testSucceeded
public void testSucceeded(org.apache.maven.surefire.report.ReportEntry entry) - Specified by:
testSucceeded
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testSucceeded
in classorg.apache.maven.surefire.report.AbstractReporter
-
testError
public void testError(org.apache.maven.surefire.report.ReportEntry entry, String stdOut, String stdErr) - Specified by:
testError
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testError
in classorg.apache.maven.surefire.report.AbstractReporter
-
testFailed
public void testFailed(org.apache.maven.surefire.report.ReportEntry entry, String stdOut, String stdErr) - Specified by:
testFailed
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
testFailed
in classorg.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) -
writeMessage
-
reset
public void reset()- Specified by:
reset
in interfaceorg.apache.maven.surefire.report.Reporter
- Overrides:
reset
in classorg.apache.maven.surefire.report.AbstractReporter
-
sendMessage
-
getTestId
-