TraceContext { protected static void reset() { allTraceInfoMap = new ConcurrentHashMap<Long, ConcurrentLinkedDeque<Trace>>(); if (TEST_ENABLED) { tidToTestInfoMap = new ConcurrentHashMap<Long, ConcurrentLinkedDeque<Info>>(); } }  static void register(InstanceRequest request); static void unregister(InstanceRequest request); static void logLatency(String operator, long latencyMs); static void logException(String key, String value); static String getTraceInfoOfRequestId(Long requestId); static boolean TEST_ENABLED; }
@Test public void testSingleRequest() throws Exception { TraceContext.reset(); ExecutorService jobService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NamedThreadFactory("jobService")); InstanceRequest request = new InstanceRequest(0L, null); request.setEnableTrace(true); singleRequestCall(jobService, request, JOBS_PER_REQUEST); runVerification(1, JOBS_PER_REQUEST); }
@Test public void testMultipleRequests() throws Exception { TraceContext.reset(); ExecutorService sharedService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NamedThreadFactory("sharedService")); runVariousConditionTests(sharedService, sharedService); ExecutorService requestService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NamedThreadFactory("requestService")); ExecutorService jobService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NamedThreadFactory("jobService")); runVariousConditionTests(requestService, jobService); }