Esempio n. 1
0
 private static void initAndRun(String[] args, CommandLineArgs cla, RemoteArgs ra) {
   RemoteTestNG remoteTestNg = new RemoteTestNG();
   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);
   m_serPort = ra.serPort;
   remoteTestNg.m_port = 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);
   }
   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();
   //    }
 }
Esempio n. 2
0
    @Override
    public Version convert(String value) {
      if (value == null) {
        return null;
      }

      return RemoteTestNG.toVersion(value);
    }
  @Override
  public void sendMessage(IMessage message) {
    if (m_outStream == null) {
      throw new IllegalStateException("Trying to send a message on a shutdown sender");
    }
    if (writer == null) {
      try {
        writer =
            new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(m_outStream, "UTF-8")), // $NON-NLS-1$
                false /* autoflush */);
      } catch (UnsupportedEncodingException e1) {
        writer =
            new PrintWriter(
                new BufferedWriter(new OutputStreamWriter(m_outStream)), false /* autoflush */);
      }
    }

    String msg = ((IStringMessage) message).getMessageAsString();
    if (RemoteTestNG.isVerbose()) {
      p("Sending message:" + message);
      p("  String version:" + msg);

      StringBuffer buf = new StringBuffer();
      for (int i = 0; i < msg.length(); i++) {
        if ('\u0001' == msg.charAt(i)) {
          p("  word:[" + buf.toString() + "]");
          buf.delete(0, buf.length());
        } else {
          buf.append(msg.charAt(i));
        }
      }
      p("  word:[" + buf.toString() + "]");
    }

    synchronized (m_ackLock) {
      writer.println(msg);
      writer.flush();
      waitForAck();
    }
  }
 private static void p(String msg) {
   if (RemoteTestNG.isVerbose()) {
     System.out.println("[StringMessageSender] " + msg); // $NON-NLS-1$
   }
 }
 protected void handleThrowable(Throwable cause) {
   if (RemoteTestNG.isVerbose()) {
     cause.printStackTrace();
   }
 }