Package qat.common

Examples of qat.common.TestObject


 
    /**
     * This method is responsible for executing a daemon on the agent.
     */
    private void processDAEMONSTART_REQUEST(DataInputStream in, DataOutputStream out) {
  TestObject test=new TestObject();
  String eol = System.getProperty("line.separator");
  try {
      ConsoleServer.debugMsg("Processing DAEMONSTART_REQUEST",1);
      // read the serialized TestObject which we will execute
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // create details about our agent to use in the trace file created by the ExecProcess object
      String details = "Local Address : "+socket.getLocalAddress().toString()+eol+
    "Port Number : "+portNo+eol+
View Full Code Here


 
    /**
     * This method is responsible for executing a command on the agent.
     */
    private void processCMDSTART_REQUEST(DataInputStream in, DataOutputStream out) {
  TestObject test=new TestObject();
  String eol = System.getProperty("line.separator");
  try {
      ConsoleServer.debugMsg("Processing CMDSTART_REQUEST",1);
      // read the serialized TestObject which we will execute
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // create details about our agent to use in the trace file created by the ExecProcess object
      String details = "Local Address : "+socket.getLocalAddress().toString()+eol+
    "Port Number : "+portNo+eol+
View Full Code Here

     * This method is resonsible for stopping a previously started command on the agent.
     * If the process has finished, it will return the exit code, else it will return
     * a negative value if the process had to be killed.
     */
    private int processCMDSTOP_REQUEST(DataInputStream in, DataOutputStream out) {
  TestObject test=new TestObject();
  int status=0;
  try {
      ConsoleServer.debugMsg("Processing CMDSTOP_REQUEST",1);
      // read the serialized TestObject which we will stop
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // find the exit code, blocking if neccesary
      ExecProcess proc;
      boolean wasRunning = false;
      for (int i = 0; i < processPool.size(); i++) {
    try {
        proc = (ExecProcess)processPool.get(i);
    }
    catch (java.lang.NoSuchMethodError ex) {
        // does not exist in jdk1.1.x
        proc = (ExecProcess)processPool.elementAt(i);
    }
    // check for any instance of test running with the same id
    if (proc.getTestObject().getTestID().equals(test.getTestID())) {
        ConsoleServer.debugMsg("Stopping process ",5);
        wasRunning = true;
         
        // flush and close it's output streams
        proc.interrupt();
         
        // get it's status if it has finished
        status = proc.checkExitValue();
         
        sendSignal(out,status);
        break;
    }
      }
      if (!wasRunning) {
    // the process was never started, so assume it failed
    ConsoleServer.debugMsg("Process was not running :"+test.getTestID(),1);     
      }
      // now send a signal indicating we have finished
      sendSignal(out,ProtocolConstants.RESPONSE_FINISHED_OK);
  }
  catch (Exception e) {
View Full Code Here

     * This method is resonsible for retrieving the status of a previously executed processes on the agent.
     * It will block until the process exits, or the timeout value specified in the CMDSTART method has been
     * reached.
     */
    private void processCMDSTATUS_REQUEST(DataInputStream in, DataOutputStream out) {
  TestObject test=new TestObject();
  try {
      ConsoleServer.debugMsg("Processing CMDSTATUS_REQUEST",1);
      // read the serialized TestObject that we want the exit code of
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // find the exit code, blocking if neccesary
      ExecProcess proc;
      boolean wasRunning = false;
      for (int i = 0; i < processPool.size(); i++) {
    try {
        proc = (ExecProcess)processPool.get(i);
    }
    catch (java.lang.NoSuchMethodError ex) {
        // does not exist in jdk1.1.x
        proc = (ExecProcess)processPool.elementAt(i);
    }
    // check for any instance of test running with the same name
    if (proc.getTestObject().getTestID().equals(test.getTestID())) {
        ConsoleServer.debugMsg("Returning CMDSTATUS value :"+proc.getExitValue(),5);
        out.writeInt(proc.getExitValue());
        wasRunning = true;
        // flush and close it's output streams
        proc.interrupt();
        // don't remove until it's cleaned :processPool.removeElementAt(i);
        break;
    }
      }
      if (!wasRunning) {
    // the process was never started, so assume it failed
    ConsoleServer.debugMsg("Process was never started :"+test.getTestID(),1);     
    out.writeInt(ProtocolConstants.FAILED);
      }
      // now send a signal indicating we have finished
      sendSignal(out,ProtocolConstants.RESPONSE_FINISHED_OK);
  }
View Full Code Here

 
    /**
     * This method is resonsible for cleaning all files created by running a process.
     */
    private void processCMDCLEAN_REQUEST(DataInputStream in, DataOutputStream out) {
  TestObject test=new TestObject();
  try {
      ConsoleServer.debugMsg("Processing CMDCLEAN_REQUEST",1);
      // read the serialized TestObject which we want the exit code of
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // find the exit code, blocking if neccesary
      ExecProcess proc;
      boolean exists = false;
      for (int i = 0; i < processPool.size(); i++) {
    try {
        proc = (ExecProcess)processPool.get(i);
    }
    catch (java.lang.NoSuchMethodError ex) {
        // does not exist in jdk1.1.x
        proc = (ExecProcess)processPool.elementAt(i);
    }
    // check for any instance of test running with the same name
    if (proc.getTestObject().getTestID().equals(test.getTestID())) {
        try {
      ConsoleServer.debugMsg("Deleting :"+proc.getTestObject().getEnvFileName(),5)
      Utils.delete(proc.getTestObject().getEnvFileName());
        }
        catch (IOException e) {
      ConsoleServer.debugMsg("No environment file was found :"+e,1);     
        }
        try {
      ConsoleServer.debugMsg("Deleting :"+proc.getTestObject().getStdOutFileName(),5)
      Utils.delete(proc.getTestObject().getStdOutFileName());
        }
        catch (IOException e) {
      ConsoleServer.debugMsg("No stdout file was found :"+e,1);     
        }
        try {
      ConsoleServer.debugMsg("Deleting :"+proc.getTestObject().getStdErrFileName(),5)
      Utils.delete(proc.getTestObject().getStdErrFileName());
        }
        catch (IOException e) {
      ConsoleServer.debugMsg("No stderr file was found :"+e,1);     
        }           
        exists = true;
        // flush and close it's output streams by doing a STOP command
        proc.interrupt();
        try {
      processPool.remove(i);
        }
        catch (java.lang.NoSuchMethodError ex) {
      // does not exist in jdk1.1.x
      processPool.removeElementAt(i);
        }
        break;
    }
      }
      if (!exists) {
    // the process was never started, so assume it failed
    ConsoleServer.debugMsg("Process was not running :"+test.getTestID(),1);     
    out.writeInt(ProtocolConstants.FAILED);
      }
      else {
    // now send a signal indicating we have finished
    sendSignal(out,ProtocolConstants.RESPONSE_FINISHED_OK);
View Full Code Here

     */
    private void processCMDGETTRACE_REQUEST(DataInputStream in, DataOutputStream out) {
  try {
      ConsoleServer.debugMsg("Processing CMDGETTRACE_REQUEST",1);
      // read the serialized TestObject which we want the exit code of
      TestObject test = new TestObject();
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
      // find the exit code, blocking if neccesary
      ExecProcess proc;
      boolean wasRun = false;
      for (int i = 0; i < processPool.size(); i++) {
    try {
        proc = (ExecProcess)processPool.get(i);
    }
    catch (java.lang.NoSuchMethodError ex) {
        // does not exist in jdk1.1.x
        proc = (ExecProcess)processPool.elementAt(i);
    }
    // check for any instance of test running with the same name
    if (proc.getTestObject().getTestID().equals(test.getTestID())) {
        wasRun = true;
        // ---- send the env, stdout and stderr files --------------------
        sendFile(proc.getTestObject().getEnvFileName(), out);
        sendFile(proc.getTestObject().getStdOutFileName(), out);
        sendFile(proc.getTestObject().getStdErrFileName(), out);
        // ----------------------------------
        break;
    }
      }
      if (!wasRun) {
    // the process was never started, so assume it failed
    ConsoleServer.debugMsg("Process was never started :"+test.getTestID(),1);     
    out.writeInt(ProtocolConstants.FAILED);
      }
      // now send a signal indicating we have finished
      sendSignal(out,ProtocolConstants.RESPONSE_FINISHED_OK);
  }
View Full Code Here

     */
    private void processGETTRACEPATHS_REQUEST(DataInputStream in, DataOutputStream out) {
  try {
      ConsoleServer.debugMsg("Processing GETTRACEPATHS_REQUEST",1);
      // read the serialized TestObject which we want the exit code of
      TestObject test = new TestObject();
      test.readObject(in);
      // now send a signal indicating we are processing the request
      sendSignal(out,ProtocolConstants.RESPONSE_PROCESSING);
   
      // find the exit code, blocking if neccesary
      ExecProcess proc = null;
      boolean wasRun = false;
      for (int i = 0; i < processPool.size(); i++) {
    try {
        proc = (ExecProcess)processPool.get(i);
    }
    catch (java.lang.NoSuchMethodError ex) {
        // does not exist in jdk1.1.x
        proc = (ExecProcess)processPool.elementAt(i);
    }
    // check for any instance of test running with the same name
    if (proc.getTestObject().getTestID().equals(test.getTestID())) {
        wasRun = true;     
        ConsoleServer.debugMsg("Process Id was found :"+test.getTestID(),9);
        break;
    }
      }
      if (!wasRun) {
    // the process was never started, so assume it failed
    ConsoleServer.debugMsg("Process was not found :"+test.getTestID(),4);     
    sendSignal(out,ProtocolConstants.RESPONSE_FINISHED_ERROR);
      }
      else {
    ConsoleServer.debugMsg("Sending trace file paths",9);
    ConsoleServer.debugMsg("Env file :"+proc.getTestObject().getEnvFileName().toString(),9);
View Full Code Here

    if (!inEvaluationMode()) {
      try {
        /* Open a socket with the Agent */
        openAgentSocket();

        TestObject test = new TestObject(Integer.toString(uniqueID),
            command,
            environment,
            agentWorkDir,
            new Integer(timeout).intValue());
        /* send the CMDSTART_REQUEST command, and the TestObject,
       and wait for acknowledgment */
        outStr.writeInt(ProtocolConstants.CMDSTART_REQUEST);
        test.writeObject(outStr);
        outStr.flush();

        expectCode(ProtocolConstants.RESPONSE_PROCESSING,RESPONSE_PROCESSING_ERROR);       
        expectCode(ProtocolConstants.RESPONSE_FINISHED_OK,RESPONSE_OK_ERROR);

        // no exceptions thrown yet, so
        // record what file was sent and where it was sent to
        executeRequests.put(new Integer(uniqueID),test);
      }
      finally {
        /* close socket and return the result */
        closeAgentSocket();
      }
    }
    else {
      // simulate a process ID for evaluation mode
      executeRequests.put(new Integer(uniqueID),
          new TestObject(Integer.toString(uniqueID),
              command,
              environment,
              agentWorkDir,
              new Integer(timeout).intValue()));
    }
View Full Code Here

    if (!inEvaluationMode()) {
      try {
        /* Open a socket with the Agent */
        openAgentSocket();

        TestObject test = (TestObject)executeRequests.get(new Integer(processID));

        /* send the CMDSTOP_REQUEST command, and the TestObject,
       and wait for acknowledgment */
        outStr.writeInt(ProtocolConstants.CMDSTOP_REQUEST);
        test.writeObject(outStr);
        outStr.flush();
        expectCode(ProtocolConstants.RESPONSE_PROCESSING,  RESPONSE_PROCESSING_ERROR)

        /* get the remote process exit status, and acknowledgment */
        status = inStr.readInt();
View Full Code Here

    if (!inEvaluationMode()) {
      try {
        /* Open a socket with the Agent */
        openAgentSocket();

        TestObject test = (TestObject)executeRequests.get(new Integer(processID));

        /* send the CMDSTATUS command, and the TestObject,
       and wait for acknowledgment */
        outStr.writeInt(ProtocolConstants.CMDSTATUS_REQUEST);
        test.writeObject(outStr);

        expectCode(ProtocolConstants.RESPONSE_PROCESSING,  RESPONSE_PROCESSING_ERROR)

        /* get the remote process exit status, and acknowledgment */
        status = inStr.readInt();
View Full Code Here

TOP

Related Classes of qat.common.TestObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.