Search in sources :

Example 1 with MessageHub

use of org.testng.remote.strprotocol.MessageHub in project druid by druid-io.

the class RemoteTestNG method run.

@Override
public void run() {
    IMessageSender sender = m_serPort != null ? new SerializedMessageSender(m_host, m_serPort, m_ack) : new StringMessageSender(m_host, m_port);
    final MessageHub msh = new MessageHub(sender);
    msh.setDebug(isDebug());
    try {
        msh.connect();
        // We couldn't do this until now in debug mode since the .xml file didn't exist yet.
        // Now that we have connected with the Eclipse client, we know that it created the .xml
        // file so we can proceed with the initialization
        initializeSuitesAndJarFile();
        List<XmlSuite> suites = Lists.newArrayList();
        calculateAllSuites(m_suites, suites);
        //          + " and:" + suites.get(0).getChildSuites().size());
        if (suites.size() > 0) {
            int testCount = 0;
            for (int i = 0; i < suites.size(); i++) {
                testCount += (suites.get(i)).getTests().size();
            }
            GenericMessage gm = new GenericMessage(MessageHelper.GENERIC_SUITE_COUNT);
            gm.setSuiteCount(suites.size());
            gm.setTestCount(testCount);
            msh.sendMessage(gm);
            addListener(new RemoteSuiteListener(msh));
            setTestRunnerFactory(new DelegatingTestRunnerFactory(buildTestRunnerFactory(), msh));
            //        System.out.println("RemoteTestNG starting");
            super.run();
        } else {
            System.err.println("No test suite found. Nothing to run");
        }
    } catch (Throwable cause) {
        cause.printStackTrace(System.err);
    } finally {
        //      System.out.println("RemoteTestNG finishing: " + (getEnd() - getStart()) + " ms");
        msh.shutDown();
        if (!m_debug && !m_dontExit) {
            System.exit(0);
        }
    }
}
Also used : GenericMessage(org.testng.remote.strprotocol.GenericMessage) XmlSuite(org.testng.xml.XmlSuite) StringMessageSender(org.testng.remote.strprotocol.StringMessageSender) MessageHub(org.testng.remote.strprotocol.MessageHub) SerializedMessageSender(org.testng.remote.strprotocol.SerializedMessageSender) IMessageSender(org.testng.remote.strprotocol.IMessageSender)

Aggregations

GenericMessage (org.testng.remote.strprotocol.GenericMessage)1 IMessageSender (org.testng.remote.strprotocol.IMessageSender)1 MessageHub (org.testng.remote.strprotocol.MessageHub)1 SerializedMessageSender (org.testng.remote.strprotocol.SerializedMessageSender)1 StringMessageSender (org.testng.remote.strprotocol.StringMessageSender)1 XmlSuite (org.testng.xml.XmlSuite)1