@Test public void testRunSync() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); Map<String, Object> expectedResponse = new LinkedHashMap<String, Object>(); final Map<String, Object> nexusResponse = new LinkedHashMap<String, Object>() {{ put("1", 2); put("2", 2); put("3", 1); }}; final Map<String, Object> galaxyResponse = new LinkedHashMap<String, Object>() {{ put("2", 1); put("3", 1); }}; expectedResponse.put("android", new LinkedHashMap<String, Object>() {{ put("nexus", nexusResponse); put("galaxy", galaxyResponse); }}); final Map<String, Object> nexusResponse2 = new LinkedHashMap<String, Object>() {{ put("2", 1); }}; final Map<String, Object> iPadResponse = new LinkedHashMap<String, Object>() {{ put("2", 2); }}; final Map<String, Object> iPhoneResponse = new LinkedHashMap<String, Object>() {{ put("1", 1); }}; expectedResponse.put("ios", new LinkedHashMap<String, Object>() {{ put("nexus", nexusResponse2); put("ipad", iPadResponse); put("iphone", iPhoneResponse); }}); Entity<GroupRequest> serviceUserEntity = Entity.json(groupRequest); GroupResponse response = resources.client() .target("/v1/analytics") .request() .post(serviceUserEntity, GroupResponse.class); assertEquals(expectedResponse, response.getResult()); }
@POST @Timed @ApiOperation("runSync") public ActionResponse runSync(@Valid final ActionRequest request) { return queryExecutor.execute(request); }
AnalyticsResource { @POST @Timed @ApiOperation("runSync") public ActionResponse runSync(@Valid final ActionRequest request) { return queryExecutor.execute(request); } }
AnalyticsResource { @POST @Timed @ApiOperation("runSync") public ActionResponse runSync(@Valid final ActionRequest request) { return queryExecutor.execute(request); } @Inject  AnalyticsResource(final QueryExecutor queryExecutor, final ObjectMapper objectMapper); }
AnalyticsResource { @POST @Timed @ApiOperation("runSync") public ActionResponse runSync(@Valid final ActionRequest request) { return queryExecutor.execute(request); } @Inject  AnalyticsResource(final QueryExecutor queryExecutor, final ObjectMapper objectMapper); @POST @Timed @ApiOperation("runSync") ActionResponse runSync(@Valid final ActionRequest request); @POST @Path("/async") @Timed @ApiOperation("runSyncAsync") AsyncDataToken runSyncAsync(@Valid final ActionRequest request); @POST @Path("/validate") @Timed @ApiOperation("validateQuery") ActionValidationResponse validateQuery(@Valid final ActionRequest request); @POST @Produces(FoxtrotExtraMediaType.TEXT_CSV) @Path("/download") @Timed @ApiOperation("downloadAnalytics") StreamingOutput download(@Valid final ActionRequest actionRequest); }
AnalyticsResource { @POST @Timed @ApiOperation("runSync") public ActionResponse runSync(@Valid final ActionRequest request) { return queryExecutor.execute(request); } @Inject  AnalyticsResource(final QueryExecutor queryExecutor, final ObjectMapper objectMapper); @POST @Timed @ApiOperation("runSync") ActionResponse runSync(@Valid final ActionRequest request); @POST @Path("/async") @Timed @ApiOperation("runSyncAsync") AsyncDataToken runSyncAsync(@Valid final ActionRequest request); @POST @Path("/validate") @Timed @ApiOperation("validateQuery") ActionValidationResponse validateQuery(@Valid final ActionRequest request); @POST @Produces(FoxtrotExtraMediaType.TEXT_CSV) @Path("/download") @Timed @ApiOperation("downloadAnalytics") StreamingOutput download(@Valid final ActionRequest actionRequest);  }