• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng.remote;
2 
3 import org.testng.SuiteRunner;
4 import org.testng.internal.Utils;
5 import org.testng.internal.remote.SlavePool;
6 import org.testng.remote.adapter.RemoteResultListener;
7 import org.testng.xml.XmlSuite;
8 
9 import java.io.IOException;
10 
11 public class RemoteWorker {
12   protected RemoteResultListener m_listener;
13   private SlavePool m_slavePool;
14 
RemoteWorker(RemoteResultListener listener, SlavePool slavePool)15   public RemoteWorker(RemoteResultListener listener, SlavePool slavePool) {
16     m_listener = listener;
17     m_slavePool = slavePool;
18   }
19 
getSlavePool()20   protected SlavePool getSlavePool() {
21     return m_slavePool;
22   }
23 
sendSuite(ConnectionInfo ci, XmlSuite suite)24   protected SuiteRunner sendSuite(ConnectionInfo ci, XmlSuite suite)
25     throws IOException, ClassNotFoundException
26   {
27     log("Sending " + suite.getName() + " to "
28         + ci.getSocket().getInetAddress().getCanonicalHostName() + ":"
29         + ci.getSocket().getRemoteSocketAddress());
30     ci.getOos().writeObject(suite);
31     ci.getOos().flush();
32     SuiteRunner result = (SuiteRunner) ci.getOis().readObject();
33     log("Received results for " + result.getName());
34     return result;
35   }
36 
log(String string)37   private void log(String string) {
38     Utils.log("", 2, string);
39   }
40 
41 
42 }
43