@Test public void backup() throws Exception { new Expectations() { { snapshotBackup.execute(); } }; Response response = resource.backup(); assertEquals(200, response.getStatus()); assertEquals("[\"ok\"]", response.getEntity()); assertEquals( MediaType.APPLICATION_JSON_TYPE, response.getMetadata().get("Content-Type").get(0)); }
@GET @Path("/do_snapshot") public Response backup() throws Exception { snapshotBackup.execute(); return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build(); }
BackupServlet { @GET @Path("/do_snapshot") public Response backup() throws Exception { snapshotBackup.execute(); return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build(); } }
BackupServlet { @GET @Path("/do_snapshot") public Response backup() throws Exception { snapshotBackup.execute(); return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build(); } @Inject  BackupServlet(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            @Named("backup") IBackupFileSystem backupFs,
            SnapshotBackup snapshotBackup,
            IBackupStatusMgr completedBkups,
            BackupVerification backupVerification,
            BackupService backupService); }
BackupServlet { @GET @Path("/do_snapshot") public Response backup() throws Exception { snapshotBackup.execute(); return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build(); } @Inject  BackupServlet(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            @Named("backup") IBackupFileSystem backupFs,
            SnapshotBackup snapshotBackup,
            IBackupStatusMgr completedBkups,
            BackupVerification backupVerification,
            BackupService backupService); @GET @Path("/do_snapshot") Response backup(); @GET @Path("/incremental_backup") Response backupIncrementals(); @GET @Path("/updateService") Response updateService(); @GET @Path("/list") /* * Fetch the list of files for the requested date range. * * @param date range * @param filter. The type of data files fetched. E.g. META will only fetch the daily snapshot meta data file (meta.json). * @return the list of files in json format as part of the Http response body. */ Response list(
            @QueryParam(REST_HEADER_RANGE) String daterange,
            @QueryParam(REST_HEADER_FILTER) @DefaultValue("") String filter); @GET @Path("/status") @Produces(MediaType.APPLICATION_JSON) Response status(); @GET @Path("/status/{date}") @Produces(MediaType.APPLICATION_JSON) Response statusByDate(@PathParam("date") String date); @GET @Path("/status/{date}/snapshots") @Produces(MediaType.APPLICATION_JSON) Response snapshotsByDate(@PathParam("date") String date); @GET @Path("/validate/snapshot/{daterange}") @Produces(MediaType.APPLICATION_JSON) Response validateSnapshotByDate(
            @PathParam("daterange") String daterange,
            @DefaultValue("false") @QueryParam("force") boolean force); }
BackupServlet { @GET @Path("/do_snapshot") public Response backup() throws Exception { snapshotBackup.execute(); return Response.ok(REST_SUCCESS, MediaType.APPLICATION_JSON).build(); } @Inject  BackupServlet(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            @Named("backup") IBackupFileSystem backupFs,
            SnapshotBackup snapshotBackup,
            IBackupStatusMgr completedBkups,
            BackupVerification backupVerification,
            BackupService backupService); @GET @Path("/do_snapshot") Response backup(); @GET @Path("/incremental_backup") Response backupIncrementals(); @GET @Path("/updateService") Response updateService(); @GET @Path("/list") /* * Fetch the list of files for the requested date range. * * @param date range * @param filter. The type of data files fetched. E.g. META will only fetch the daily snapshot meta data file (meta.json). * @return the list of files in json format as part of the Http response body. */ Response list(
            @QueryParam(REST_HEADER_RANGE) String daterange,
            @QueryParam(REST_HEADER_FILTER) @DefaultValue("") String filter); @GET @Path("/status") @Produces(MediaType.APPLICATION_JSON) Response status(); @GET @Path("/status/{date}") @Produces(MediaType.APPLICATION_JSON) Response statusByDate(@PathParam("date") String date); @GET @Path("/status/{date}/snapshots") @Produces(MediaType.APPLICATION_JSON) Response snapshotsByDate(@PathParam("date") String date); @GET @Path("/validate/snapshot/{daterange}") @Produces(MediaType.APPLICATION_JSON) Response validateSnapshotByDate(
            @PathParam("daterange") String daterange,
            @DefaultValue("false") @QueryParam("force") boolean force);  }