@Override protected JavaParameters createJavaParameters() throws ExecutionException { final JavaParameters javaParameters = super.createJavaParameters(); javaParameters.setupEnvs(getConfiguration().getPersistantData().getEnvs(), getConfiguration().getPersistantData().PASS_PARENT_ENVS); javaParameters.setMainClass("org.testng.RemoteTestNGStarter"); try { port = NetUtils.findAvailableSocketPort(); } catch (IOException e) { throw new ExecutionException("Unable to bind to port " + port, e); } final TestData data = getConfiguration().getPersistantData(); javaParameters.getProgramParametersList().add(supportSerializationProtocol(getConfiguration()) ? RemoteArgs.PORT : CommandLineArgs.PORT, String.valueOf(port)); if (data.getOutputDirectory() != null && !data.getOutputDirectory().isEmpty()) { javaParameters.getProgramParametersList().add(CommandLineArgs.OUTPUT_DIRECTORY, data.getOutputDirectory()); } javaParameters.getProgramParametersList().add(CommandLineArgs.USE_DEFAULT_LISTENERS, String.valueOf(data.USE_DEFAULT_REPORTERS)); @NonNls final StringBuilder buf = new StringBuilder(); if (data.TEST_LISTENERS != null && !data.TEST_LISTENERS.isEmpty()) { buf.append(StringUtil.join(data.TEST_LISTENERS, ";")); } collectListeners(javaParameters, buf, IDEATestNGListener.EP_NAME, ";"); if (buf.length() > 0) javaParameters.getProgramParametersList().add(CommandLineArgs.LISTENER, buf.toString()); createServerSocket(javaParameters); createTempFiles(javaParameters); return javaParameters; }
private static void initAndRun(IRemoteTestNG remoteTestNg, String[] args, CommandLineArgs cla, RemoteArgs ra) { if (m_debug) { // In debug mode, override the port and the XML file to a fixed location cla.port = Integer.parseInt(DEBUG_PORT); ra.serPort = cla.port; cla.suiteFiles = Arrays.asList(new String[] { DEBUG_SUITE_DIRECTORY + DEBUG_SUITE_FILE }); } remoteTestNg.configure(cla); remoteTestNg.setHost(cla.host); remoteTestNg.setSerPort(ra.serPort); remoteTestNg.setProtocol(ra.protocol); remoteTestNg.setPort(cla.port); if (isVerbose()) { StringBuilder sb = new StringBuilder("Invoked with "); for (String s : args) { sb.append(s).append(" "); } p(sb.toString()); // remoteTestNg.setVerbose(1); // } else { // remoteTestNg.setVerbose(0); } AbstractRemoteTestNG.validateCommandLineParameters(cla); remoteTestNg.run(); // if (m_debug) { // // Run in a loop if in debug mode so it is possible to run several launches // // without having to relauch RemoteTestNG. // while (true) { // remoteTestNg.run(); // remoteTestNg.configure(cla); // } // } else { // remoteTestNg.run(); // } }
@Override public void configure(CommandLineArgs cla) { super.configure(cla); }
public static void validateCommandLineParameters(CommandLineArgs args) { TestNG.validateCommandLineParameters(args); }
void configure(CommandLineArgs cla);