1 package org.testng.remote.adapter;
2 
3 import java.io.IOException;
4 import java.util.Properties;
5 
6 import org.testng.ISuite;
7 import org.testng.xml.XmlSuite;
8 
9 /**
10  * This interface should be implemented by the Master-Slave transport adapter.
11  * This interface is used by the Slave to pull suites and return results.
12  *
13  * @author	Guy Korland
14  * @since April 9, 2007
15  * @see IMasterAdapter
16  */
17 public interface IWorkerAdapter
18 {
19 	/**
20 	 * Initializes the worker adapter.
21 	 * @param properties holds the properties loaded from the remote.properties file.
22 	 * @throws Exception adapter might throw any exception on initialization, which will abort this adapter.
23 	 */
init( Properties properties)24 	void init( Properties properties) throws Exception;
25 
26 	/**
27 	 * A blocking call to get the next Suite to test.
28 	 * @param timeout the maximum time to wait for the next suite.
29 	 * @return the next suite avaliable or <code>null</code> if the timeout has reached.
30 	 * @throws IOException might be thrown on IO error.
31 	 * @throws InterruptedException if interrupted while waiting.
32 	 */
getSuite( long timeout)33 	XmlSuite getSuite( long timeout) throws InterruptedException, IOException;
34 
35 	/**
36 	 * Return a suite result.
37 	 * @param result the result to return
38 	 * @throws IOException might be thrown on IO error.
39 	 */
returnResult( ISuite result)40 	void returnResult( ISuite result) throws IOException;
41 }
42