TableFieldMappingResource { @GET @Timed @Path("/fields") @ApiOperation("Get all Fields") public Response getAllFields(@QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality, @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality) { return Response.ok() .entity(tableManager.getAll() .stream() .collect(Collectors.toMap(Table::getName, table -> tableMetadataManager.getFieldMappings(table.getName(), withCardinality, calculateCardinality ) ))) .build(); } @Inject  TableFieldMappingResource(TableManager tableManager, TableMetadataManager tableMetadataManager); @GET @Timed @Path("/{name}/fields") @ApiOperation("Get fields") Response get(@PathParam("name") final String table,
                        @QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                        @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @GET @Timed @Path("/fields") @ApiOperation("Get all Fields") Response getAllFields(@QueryParam("withCardinality") @DefaultValue("false") boolean withCardinality,
                                 @QueryParam("calculateCardinality") @DefaultValue("false") boolean calculateCardinality); @POST @Timed @Path("/{name}/fields/update") @ApiOperation("Update Fields") Response updateEstimation(@PathParam("name") final String table, @QueryParam("time") @DefaultValue("0") long epoch);  }
@Test public void getAllFields() throws Exception { doNothing().when(getQueryStore()) .initializeTable(any(String.class)); getQueryStore().save(TestUtils.TEST_TABLE_NAME, TestUtils.getMappingDocuments(getMapper())); await().pollDelay(500, TimeUnit.MILLISECONDS).until(() -> true); Map<String, TableFieldMapping> response = resources.client() .target("/v1/tables/fields") .request() .get(new GenericType<Map<String, TableFieldMapping>>() { }); Assert.assertFalse(response.isEmpty()); Assert.assertEquals(1, response.size()); Assert.assertTrue(response.containsKey(TestUtils.TEST_TABLE_NAME)); }