Package com.simoncat.time

Source Code of com.simoncat.time.TestTask

package com.simoncat.time;

import java.util.Timer;
import java.util.TimerTask;

import com.simoncat.time.TaskProgrammer;


import com.simoncat.vo.Server;
import com.simoncat.vo.Event;

import java.util.Vector;


import com.simoncat.net.HttpTest;

public class TestTask extends TimerTask {
  private Timer timer = null;
  private Server server;
  private Event event;
  private TaskProgrammer taskProgrammer;
  public TestTask(Timer timer,Server server,Event event,TaskProgrammer taskProgrammer) {
    this.timer = timer;
    this.server = server;
    this.event = event;
    this.taskProgrammer= taskProgrammer;
  }

  @Override
  public void run() {
    String result="";
    // TODO procedimiento para test servidor
    // URL de prueba: listar la aplicaciones del tomcat
   
   
    System.out.println("DatosServer:"+server);
    String ip = server.getAddress();
    String tomcatUsr = server.getUserTomcat();
    String tomcatPwd = server.getPasswordTomcat();
    int port= new Integer(server.getPort()).intValue();
       
    String list = "http://"+ip+":"+port+"/manager/list";
    System.out.println("CORRIENDO EL TEST EN SERVER:"+server.getName());
      HttpTest ht = new HttpTest(ip,port,tomcatUsr,tomcatPwd,list,3,2000);
    boolean r = ht.executeTest();
    System.out.println("RESULT TESTS:"+r);
    //TODO
    //recuperar los resultado de los tests
    //colocarlos en el evento como cadena o cambiar la estructura de event?
    //si todo OK
    //sino repetir el test
    //y si falla de nuevo reiniciar
   
    //guardar en resultado en el campo results del evento
   
    event.setResults(result);
    taskProgrammer.addFinishedTask(server,event);
  }
}
TOP

Related Classes of com.simoncat.time.TestTask

TOP
Copyright © 2018 www.massapi.com. 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.