f0fb4a7ab3676fcade6c299801e603ad3049f542
[phpeclipse.git] /
1 /*************************************************************************
2  * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
3  *
4  * Plugin for PHP unit Testing.
5  * www.phpeclipse.de
6  * 
7  *************************************************************************/
8
9 package net.sourceforge.phpeclipse.phpunit.reporthandling;
10
11 import java.io.BufferedReader;
12 import java.io.IOException;
13 import java.io.InputStreamReader;
14 import java.net.Socket;
15
16 import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
17
18 public class ReportListener extends Thread {
19
20         Socket serviceSocket;
21
22         PHPUnitView view;
23
24         public ReportListener(Socket serviceSocket, PHPUnitView view) {
25                 this.view = view;
26                 this.serviceSocket = serviceSocket;
27
28         }
29
30         public void run() {
31
32                 InputStreamReader reader;
33
34                 try {
35                         reader = new InputStreamReader(serviceSocket.getInputStream());
36
37                         BufferedReader in = new BufferedReader(reader);
38                         String report = null;
39                         int i = 0;
40                         // keep listening until the
41                         while ((report = in.readLine()) != null
42                                         && (report != "end_all_tests")) {
43
44                                 // System.out.println("received something...");
45                                 view.handleReport(report);
46                                 // System.out.println(report);
47                         }
48
49                         // reportArea.append("Finished!");
50                         System.out.println("Finished");
51                         serviceSocket.close();
52
53                 } catch (IOException e) {
54                         // TODO Auto-generated catch block
55                         e.printStackTrace();
56                 }
57
58         }
59
60 }