コード例 #1
0
 @Override
 public void run() {
   try {
     if (fDebug) System.out.println("Creating server socket " + fServerPort); // $NON-NLS-1$
     fServerSocket = new ServerSocket(fServerPort);
     fSocket = fServerSocket.accept();
     try {
       fPushbackReader =
           new PushbackReader(
               new BufferedReader(
                   new InputStreamReader(fSocket.getInputStream(), "UTF-8"))); // $NON-NLS-1$
     } catch (UnsupportedEncodingException e) {
       fPushbackReader =
           new PushbackReader(
               new BufferedReader(new InputStreamReader(fSocket.getInputStream())));
     }
     try {
       fWriter =
           new PrintWriter(
               new OutputStreamWriter(fSocket.getOutputStream(), "UTF-8"), true); // $NON-NLS-1$
     } catch (UnsupportedEncodingException e1) {
       fWriter = new PrintWriter(new OutputStreamWriter(fSocket.getOutputStream()), true);
     }
     String message;
     while (fPushbackReader != null && (message = readMessage(fPushbackReader)) != null)
       receiveMessage(message);
   } catch (SocketException e) {
     notifyTestRunTerminated();
   } catch (IOException e) {
     JUnitCorePlugin.log(e);
     // fall through
   }
   shutDown();
 }
コード例 #2
0
 private void notifyTestRunStarted(final int count) {
   if (JUnitCorePlugin.isStopped()) return;
   for (int i = 0; i < fListeners.length; i++) {
     final ITestRunListener2 listener = fListeners[i];
     SafeRunner.run(
         new ListenerSafeRunnable() {
           @Override
           public void run() {
             listener.testRunStarted(count);
           }
         });
   }
 }
コード例 #3
0
 private void testRunEnded(final long elapsedTime) {
   if (JUnitCorePlugin.isStopped()) return;
   for (int i = 0; i < fListeners.length; i++) {
     final ITestRunListener2 listener = fListeners[i];
     SafeRunner.run(
         new ListenerSafeRunnable() {
           @Override
           public void run() {
             listener.testRunEnded(elapsedTime);
           }
         });
   }
 }
コード例 #4
0
 private void notifyTestRunTerminated() {
   // fix for 77771 RemoteTestRunnerClient doing work after junit shutdown [JUnit]
   if (JUnitCorePlugin.isStopped()) return;
   for (int i = 0; i < fListeners.length; i++) {
     final ITestRunListener2 listener = fListeners[i];
     SafeRunner.run(
         new ListenerSafeRunnable() {
           @Override
           public void run() {
             listener.testRunTerminated();
           }
         });
   }
 }
コード例 #5
0
 private void notifyTestStarted(final String test) {
   if (JUnitCorePlugin.isStopped()) return;
   for (int i = 0; i < fListeners.length; i++) {
     final ITestRunListener2 listener = fListeners[i];
     SafeRunner.run(
         new ListenerSafeRunnable() {
           @Override
           public void run() {
             String s[] = extractTestId(test);
             listener.testStarted(s[0], s[1]);
           }
         });
   }
 }
コード例 #6
0
 private void notifyTestFailed() {
   if (JUnitCorePlugin.isStopped()) return;
   for (int i = 0; i < fListeners.length; i++) {
     final ITestRunListener2 listener = fListeners[i];
     SafeRunner.run(
         new ListenerSafeRunnable() {
           @Override
           public void run() {
             listener.testFailed(
                 fFailureKind,
                 fFailedTestId,
                 fFailedTest,
                 fFailedTrace.toString(),
                 nullifyEmpty(fExpectedResult),
                 nullifyEmpty(fActualResult));
           }
         });
   }
 }
コード例 #7
0
 @Override
 public void handleException(Throwable exception) {
   JUnitCorePlugin.log(exception);
 }
コード例 #8
0
 private Object[] getListeners() {
   return JUnitCorePlugin.getDefault().getNewTestRunListeners().getListeners();
 }