Package org.jacoco.core.instr

Examples of org.jacoco.core.instr.Instrumenter


  }

  private void instrument(final Class<? extends Target> clazz)
      throws Exception {
    reader = new ClassReader(TargetLoader.getClassData(clazz));
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(clazz, bytes);
    target = (Target) loader.getTargetClass().newInstance();
  }
View Full Code Here


    }
  }

  private void testFrames(Class<?> target) throws IOException {
    IRuntime runtime = new SystemPropertiesRuntime();
    Instrumenter instrumenter = new Instrumenter(runtime);
    byte[] source = TargetLoader.getClassDataAsBytes(target);
    source = calculateFrames(source);
    byte[] actual = instrumenter.instrument(source);
    byte[] expected = calculateFrames(actual);

    assertEquals(dump(expected), dump(actual));
  }
View Full Code Here

      public void run() {
        for (int i = 0; i < count; i++) {
          ClassReader reader = new ClassReader(buffer);

          final Instrumenter instr = new Instrumenter(runtime);
          instr.instrument(reader);
        }
      }

    };
  }
View Full Code Here

  }

  public void run(IPerfOutput output) throws Exception {
    final IRuntime runtime = new LoggerRuntime();
    ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
    final Instrumenter instr = new Instrumenter(runtime);
    instr.instrument(reader);
    output.writeByteResult("instrumented class",
        instr.instrument(reader).length, reader.b.length);
  }
View Full Code Here

    final ClassDataRecorder rec = new ClassDataRecorder();
    final Analyzer analyzer = new Analyzer(rec);
    analyzer.analyze(reader);

    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumentedBuffer = instr.instrument(reader);
    final TargetLoader loader = new TargetLoader(clazz, instrumentedBuffer);

    final Object obj = loader.newTargetInstance();
    if (obj instanceof Runnable) {
      ((Runnable) obj).run();
View Full Code Here

  }

  private void instrument(final Class<? extends Target> clazz)
      throws Exception {
    reader = new ClassReader(TargetLoader.getClassData(clazz));
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    final TargetLoader loader = new TargetLoader(clazz, bytes);
    target = (Target) loader.getTargetClass().newInstance();
  }
View Full Code Here

      public void run() {
        for (int i = 0; i < count; i++) {
          ClassReader reader = new ClassReader(buffer);

          final Instrumenter instr = new Instrumenter(runtime);
          instr.instrument(reader);
        }
      }

    };
  }
View Full Code Here

  }

  public void run(IPerfOutput output) throws Exception {
    final IRuntime runtime = new LoggerRuntime();
    ClassReader reader = new ClassReader(TargetLoader.getClassData(target));
    final Instrumenter instr = new Instrumenter(runtime);
    instr.instrument(reader);
    output.writeByteResult("instrumented class",
        instr.instrument(reader).length, reader.b.length);
  }
View Full Code Here

   public InputStream openStream()
   {
      try
      {
         IRuntime runtime = ArquillianRuntime.getInstance();
         Instrumenter instrumenter = new Instrumenter(runtime);
         byte[] instrumented = instrumenter.instrument(asset.openStream(), EX_STRING);
        
         return new ByteArrayInputStream(instrumented);
      }
      catch (Exception e)
      {
View Full Code Here

   public InputStream openStream()
   {
      try
      {
         IRuntime runtime = ArquillianRuntime.getInstance();
         Instrumenter instrumenter = new Instrumenter(runtime);
         byte[] instrumented = instrumenter.instrument(asset.openStream());
        
         return new ByteArrayInputStream(instrumented);
      }
      catch (Exception e)
      {
View Full Code Here

TOP

Related Classes of org.jacoco.core.instr.Instrumenter

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.