DatabasesResource { @GET @Path("/{databaseName}") @Produces(MediaType.APPLICATION_JSON) public Response getDatabase(@PathParam("databaseName") String databaseName) { if (LOG.isDebugEnabled()) { LOG.debug("Client sent a getDatabase request."); } Response response = null; try { initializeContext(); JerseyResourceDelegateContextKey<String> databaseNameKey = JerseyResourceDelegateContextKey.valueOf(databaseNameKeyName, String.class); context.put(databaseNameKey, databaseName); response = JerseyResourceDelegateUtil.runJerseyResourceDelegate( new GetDatabaseDelegate(), application, context, LOG); } catch (Throwable e) { LOG.error(e.getMessage(), e); response = ResourcesUtil.createExceptionResponse(null, e.getMessage()); } return response; }  @GET @Produces(MediaType.APPLICATION_JSON) Response getAllDatabases(); @POST @Consumes(MediaType.APPLICATION_JSON) Response createNewDatabase(NewDatabaseRequest request); @GET @Path("/{databaseName}") @Produces(MediaType.APPLICATION_JSON) Response getDatabase(@PathParam("databaseName") String databaseName); @DELETE @Path("/{databaseName}") Response deleteDatabase(@PathParam("databaseName") String databaseName);  }
@Test public void testGetDatabase() throws Exception { DatabaseInfoResponse response = restClient.target(databasesURI).path("/{databaseName}") .resolveTemplate("databaseName", TajoConstants.DEFAULT_DATABASE_NAME) .request().get(new GenericType<DatabaseInfoResponse>(DatabaseInfoResponse.class)); assertNotNull(response); assertEquals(TajoConstants.DEFAULT_DATABASE_NAME, response.getName()); assertTrue(response.getTablespace() != null && !response.getTablespace().isEmpty()); }