TablesResource { @GET @Path("/{tableName}") @Produces(MediaType.APPLICATION_JSON) public Response getTable(@PathParam("tableName") String tableName) { if (LOG.isDebugEnabled()) { LOG.debug("Client sent a get table request."); } Response response = null; try { initializeContext(); JerseyResourceDelegateContextKey<String> databaseNameKey = JerseyResourceDelegateContextKey.valueOf(databaseNameKeyName, String.class); context.put(databaseNameKey, databaseName); JerseyResourceDelegateContextKey<String> tableNameKey = JerseyResourceDelegateContextKey.valueOf(tableNameKeyName, String.class); context.put(tableNameKey, tableName); response = JerseyResourceDelegateUtil.runJerseyResourceDelegate( new GetTableDelegate(), application, context, LOG); } catch (Throwable e) { LOG.error(e.getMessage(), e); response = ResourcesUtil.createExceptionResponse(null, e.getMessage()); } return response; }  void setDatabaseName(String databaseName); void setUriInfo(UriInfo uriInfo); void setApplication(Application application); @POST @Consumes(MediaType.APPLICATION_JSON) Response createNewTable(TableDesc tableDesc); @GET @Produces(MediaType.APPLICATION_JSON) Response getAllTables(); @GET @Path("/{tableName}") @Produces(MediaType.APPLICATION_JSON) Response getTable(@PathParam("tableName") String tableName); @DELETE @Path("/{tableName}") Response deleteTable(@PathParam("tableName") String tableName);  }
@Test public void testGetTable() throws Exception { String tableName = "TestGetTable"; TableDesc tableDesc = createNewTableForTestCreateTable(tableName); Response response = restClient.target(tablesURI) .request().post(Entity.entity(tableDesc, MediaType.APPLICATION_JSON)); assertNotNull(response); assertEquals(Status.CREATED.getStatusCode(), response.getStatus()); TableDesc selectedTable = restClient.target(tablesURI) .path("/{tableName}").resolveTemplate("tableName", tableName) .request().get(new GenericType<TableDesc>(TableDesc.class)); assertNotNull(selectedTable); assertEquals(tableName, CatalogUtil.extractSimpleName(selectedTable.getName())); }