@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(); } }
@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(); } }
@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(); } }
@AfterClass public static void tearDownClass() throws Exception { Services.reset(); }
@BeforeClass public static void setUpClass() throws Exception { Services.reset(); }