@Test public void overlappingPlansApp1() { this.request.addHeader(CLIENT_ID, clientId1); Api api1 = new Api(); api1.setId(1L); Api api2 = new Api(); api2.setId(2L); Plan plan1 = new Plan(); plan1.setId(100L); plan1.setApi(api1); Plan plan2 = new Plan(); plan2.setId(200L); plan2.setApi(api2); App app1 = new App(); app1.setId(10L); app1.setClientId(clientId1); app1.setPlans(Collections.singletonList(plan1)); App app2 = new App(); app2.setId(20L); app2.setClientId(clientId2); app2.setPlans(Collections.singletonList(plan2)); Operation operation1 = new Operation(1111L, null, null,null, null); Operation operation2 = new Operation(2222L, null, null,null, null); Operation operation3 = new Operation(3333L, null, null,null, null); List<Operation> operations1 = new ArrayList<>(); List<Operation> operations2 = new ArrayList<>(); operations1.add(operation1); operations1.add(operation3); operations2.add(operation2); operations2.add(operation3); Scope scope1 = new Scope(123L, null, null, null, new HashSet<>(operations1)); Scope scope2 = new Scope(321L, null, null, null, new HashSet<>(operations2)); plan1.setScopes(new HashSet<>(Collections.singletonList(scope1))); plan2.setScopes(new HashSet<>(Collections.singletonList(scope2))); context.set(OPERATION_ID, operation3.getId()); context.set(API_ID, api1.getId()); Mockito.when(appRepository.findByClientId(Mockito.anyString())).thenReturn(app1); this.filter.run(); final FilterDetail filterDetail = TraceContextHolder.getInstance().getActualTrace().getFilters().get(SCOPES_FILTER); assertEquals(HttpStatus.OK.value(), context.getResponseStatusCode()); assertEquals(Constants.SUCCESS, filterDetail.getStatus()); }
@Override public Object run() { long startTime = System.currentTimeMillis(); try { process(); detail.setStatus(Constants.SUCCESS); } catch (Throwable e) { detail.setStatus(Constants.FAILED); throw e; } finally { long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); detail.setTimeInMillisRun(duration); TraceContextHolder.getInstance().getActualTrace().addFilter(this.getClass().getSimpleName(), detail); } return null; }
ScopesFilter extends ZuulFilter { @Override public Object run() { long startTime = System.currentTimeMillis(); try { process(); detail.setStatus(Constants.SUCCESS); } catch (Throwable e) { detail.setStatus(Constants.FAILED); throw e; } finally { long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); detail.setTimeInMillisRun(duration); TraceContextHolder.getInstance().getActualTrace().addFilter(this.getClass().getSimpleName(), detail); } return null; } }
ScopesFilter extends ZuulFilter { @Override public Object run() { long startTime = System.currentTimeMillis(); try { process(); detail.setStatus(Constants.SUCCESS); } catch (Throwable e) { detail.setStatus(Constants.FAILED); throw e; } finally { long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); detail.setTimeInMillisRun(duration); TraceContextHolder.getInstance().getActualTrace().addFilter(this.getClass().getSimpleName(), detail); } return null; }  }
ScopesFilter extends ZuulFilter { @Override public Object run() { long startTime = System.currentTimeMillis(); try { process(); detail.setStatus(Constants.SUCCESS); } catch (Throwable e) { detail.setStatus(Constants.FAILED); throw e; } finally { long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); detail.setTimeInMillisRun(duration); TraceContextHolder.getInstance().getActualTrace().addFilter(this.getClass().getSimpleName(), detail); } return null; }  @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); }
ScopesFilter extends ZuulFilter { @Override public Object run() { long startTime = System.currentTimeMillis(); try { process(); detail.setStatus(Constants.SUCCESS); } catch (Throwable e) { detail.setStatus(Constants.FAILED); throw e; } finally { long endTime = System.currentTimeMillis(); long duration = (endTime - startTime); detail.setTimeInMillisRun(duration); TraceContextHolder.getInstance().getActualTrace().addFilter(this.getClass().getSimpleName(), detail); } return null; }  @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run();  }