Ejemplo n.º 1
0
  /** Configure JETM */
  @BeforeClass
  public static void setUpBeforeClass() {
    BasicEtmConfigurator.configure();

    etmMonitor = EtmManager.getEtmMonitor();
    etmMonitor.start();
  }
  @SuppressWarnings("unchecked")
  @Test
  public final void agregarRendimientoTest() {

    List<Cancion> testElementos = new ArrayList<Cancion>();
    List<Contenido> contenido = new ArrayList<Contenido>();
    Token token = new Token("admin");
    Servidor serv = new ServidorNormal("serv", contenido, token);

    for (int i = 0; i < itNumber; i++) {

      String nombreCancion = "can";
      Integer duracionCancion = 5;
      Cancion cancion = new Cancion(nombreCancion, duracionCancion);

      testElementos.add(cancion);
    }

    EtmPoint point = etmMonitor.createPoint("ServidorNormal:agregar");

    for (Cancion c : testElementos) {
      serv.agregar(c, "admin");
    }

    point.collect();
  }
Ejemplo n.º 3
0
  /**
   * Write out the results of all of the test runs. This writes out the collected point data to an
   * XML file located in target/jetm beneath the working directory.
   *
   * @throws Exception If any errors occur during the write-out.
   */
  @AfterClass
  public static void tearDownAfterClass() throws Exception {
    if (etmMonitor != null) {
      etmMonitor.stop();

      final File timingDirectory = new File("target/jetm");
      FileUtils.forceMkdir(timingDirectory);

      final File timingFile = new File(timingDirectory, "Timing" + ".xml");
      final FileWriter writer = new FileWriter(timingFile);
      try {
        etmMonitor.render(new BindingMeasurementRenderer(new XmlAggregateBinder(), writer));
      } finally {
        writer.close();
      }
    }
  }
 public void setUp() throws Exception {
   EtmManager.reset();
   BasicConfigurator.configure();
   filter = new HttpRequestPerformanceFilter();
   filter.init(null);
   etmMonitor = EtmManager.getEtmMonitor();
   etmMonitor.start();
 }
  @Test
  public final void altaRendimientoTest() {
    Token token = new Token("admin");
    List<Contenido> lista = new ArrayList<Contenido>();
    Servidor s = new ServidorNormal("1", lista, token);

    EtmPoint point = etmMonitor.createPoint("ServidorNormal:alta");
    for (int i = 0; i < itNumber; i++) {
      s.alta();
    }
    point.collect();
  }
Ejemplo n.º 6
0
  /** Obtener duracion test. */
  @Test
  public final void obtenerDuracionPerformanceTest() {
    List<Anuncio> testElements = new ArrayList<Anuncio>();
    for (int i = 0; i < itNumber; i++) {
      testElements.add(new Anuncio());
    }

    EtmPoint point = etmMonitor.createPoint("AnuncioPerfTest:obtenerDuracion");

    for (Anuncio a : testElements) {
      a.obtenerDuracion();
    }

    point.collect();
  }
  public void testHttpRequestMonitoring() throws Exception {

    filter.doFilter(getHttpServletRequest(), null, getFilterChain());
    etmMonitor.render(
        new MeasurementRenderer() {

          public void render(Map points) {
            String key = "POST request /test/testrequest";
            assertTrue(points.containsKey(key));
            Aggregate aggregate = (Aggregate) points.get(key);
            assertEquals(1, aggregate.getMeasurements());
            assertEquals(15d, aggregate.getMin(), 0);
          }
        });
  }
Ejemplo n.º 8
0
  /** Buscar test. */
  @Test
  public final void buscarPerformanceTest() {
    List<Anuncio> testElements = new ArrayList<Anuncio>();
    for (int i = 0; i < itNumber; i++) {
      Anuncio anuncio = new Anuncio();
      testElements.add(anuncio);
    }

    EtmPoint point = etmMonitor.createPoint("AnuncioPerfTest:buscar");

    for (Anuncio a : testElements) {
      a.buscar("PUBLICIDAD");
    }

    point.collect();
  }
  /** Obtener nombre test. */
  @Test
  public final void obtenerNombreRendimientoTest() {
    List<Contenido> testContenido = new ArrayList<Contenido>();
    List<Servidor> testElemento = new ArrayList<Servidor>();
    for (int i = 0; i < itNumber; i++) {
      String nombre = "serv";
      Token token = new Token("admin");
      Servidor s = new ServidorNormal(nombre, testContenido, token);
      testElemento.add(s);
    }

    EtmPoint point = etmMonitor.createPoint("ServidorNormal:obtenerTitulo");

    for (Servidor s : testElemento) {
      s.obtenerNombre();
    }

    point.collect();
  }
  @Test
  public void bajaRendimientoTest() {

    List<String> testElementos = new ArrayList<String>();
    String nombre = "serv";
    Token token = new Token("admin");
    List<Contenido> lista = new ArrayList<Contenido>();
    Servidor servidor = new ServidorNormal(nombre, lista, token);
    for (int i = 0; i < itNumber; i++) {

      testElementos.add(servidor.alta());
    }

    EtmPoint point = etmMonitor.createPoint("ServidorNormal:baja");

    for (String tokens : testElementos) {
      servidor.baja(tokens);
    }

    point.collect();
  }
  @Test
  public final void eliminarRendimientoTest() {
    List<Servidor> testElementos = new ArrayList<Servidor>();
    List<Contenido> contenido = new ArrayList<Contenido>();
    final Token token = new Token("admin");

    String titulo = "can";
    Integer duracion = 2;
    Cancion cancion = new Cancion(titulo, duracion);
    for (int i = 0; i < itNumber; i++) {
      String nombre = "serv";
      Servidor s = new ServidorNormal(nombre, contenido, token);
      s.agregar((Contenido) cancion, "admin");
      testElementos.add(s);
    }

    EtmPoint point = etmMonitor.createPoint("ServidorNormal:eliminar");

    for (Servidor s : testElementos) {
      s.eliminar(cancion, "admin");
    }

    point.collect();
  }
 public void tearDown() {
   etmMonitor.stop();
 }