Ejemplo n.º 1
0
  @Test
  public void fullRequestSimulationIteration() {

    Services.getInstance().reset();
    Services.getInstance().initializeDefaultFinder();
    try {
      Services.getInstance().beginApplication();

      Object value = null;

      long baseline = System.nanoTime();

      for (int i = 0; i < ITERATIONS; i++) {
        Services.getInstance().beginRequest();
        value = $(RequestService.class);
        value = $(ApplicationService.class);
        Services.getInstance().endRequest();
      }
      long lap = System.nanoTime();

      outputTime("Full request simulation", baseline, lap);
    } finally {
      Services.getInstance().reset();
    }
  }
Ejemplo n.º 2
0
  @Test
  public void injectServiceIteration() {

    Services.getInstance().reset();
    Services.getInstance().initializeDefaultFinder();
    try {
      Services.getInstance().beginApplication();
      Services.getInstance().beginRequest();

      Object value;

      long baseline = System.nanoTime();

      for (int i = 0; i < ITERATIONS; i++) {
        value = $(InjectRoot.class);
      }
      long lap = System.nanoTime();

      outputTime("Inject service (iterate)", baseline, lap);
    } finally {
      ApplicationServiceImpl.resetInstanceCount();
      Services.getInstance().endRequest();
      Services.getInstance().reset();
    }
  }
Ejemplo n.º 3
0
  @Test
  public void beginEndRequestIteration() {

    Services.getInstance().reset();
    Services.getInstance().initializeDefaultFinder();
    try {
      Services.getInstance().beginApplication();

      long baseline = System.nanoTime();

      for (int i = 0; i < ITERATIONS; i++) {
        Services.getInstance().beginRequest();
        Services.getInstance().endRequest();
      }
      long lap = System.nanoTime();

      outputTime("Begin/end request", baseline, lap);
    } finally {
      Services.getInstance().reset();
    }
  }
Ejemplo n.º 4
0
 @AfterClass
 public static void tearDownClass() throws Exception {
   Services.reset();
 }
Ejemplo n.º 5
0
 @BeforeClass
 public static void setUpClass() throws Exception {
   Services.reset();
 }