Java 类org.testng.remote.RemoteArgs 实例源码

项目:testng-remote    文件:RemoteTest.java   
private void launchRemoteTestNG(final String portArg, final int portValue, final String protocol) {
  new Thread(new Runnable() {
    @Override
    public void run() {
      List<String> args = new ArrayList<>();
      args.add(portArg);
      args.add(Integer.toString(portValue));
      args.add(RemoteArgs.VERSION);
      args.add(getTestNGVersion());
      if (protocol != null) {
        args.add(RemoteArgs.PROTOCOL);
        args.add(protocol);
      }
      args.add("-dontexit");
      args.add(getPathToResource("testng-remote.xml"));
      RemoteTestNG.main(args.toArray(new String[0]));
      }
    }).start();
}
项目:intellij-ce-playground    文件:TestNGRunnableState.java   
@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;
}
项目:intellij-ce-playground    文件:TestNGForkedStarter.java   
@Override
protected void configureFrameworkAndRun(String[] args, PrintStream out, PrintStream err) throws Exception {
  final IDEARemoteTestNG testNG = new IDEARemoteTestNG(null);
  CommandLineArgs cla = new CommandLineArgs();
  RemoteArgs ra = new RemoteArgs();
  String[] resultArgs = new String[args.length - 1];
  System.arraycopy(args, 1, resultArgs, 0, resultArgs.length);
  new JCommander(Arrays.asList(cla, ra), resultArgs);
  testNG.configure(cla);
  testNG.run();
  System.exit(0);
}