@Test public void createInstance() { CassandraRing ring = createMock(CassandraRing.class); service.save(ring); expect(ring.getName()).andReturn(RING_NAME); replayAll(); Response response = resource.createRing(ring); assertEquals(Status.CREATED.getStatusCode(), response.getStatus()); assertEquals(RING_NAME, response.getMetadata().getFirst(HttpHeaders.LOCATION).toString()); }
@POST public Response createRing(@Valid CassandraRing ring) { service.save(ring); URI location = UriBuilder.fromPath("{name}").build(ring.getName()); return Response.created(location).build(); }
CassandraRingResource { @POST public Response createRing(@Valid CassandraRing ring) { service.save(ring); URI location = UriBuilder.fromPath("{name}").build(ring.getName()); return Response.created(location).build(); } }
CassandraRingResource { @POST public Response createRing(@Valid CassandraRing ring) { service.save(ring); URI location = UriBuilder.fromPath("{name}").build(ring.getName()); return Response.created(location).build(); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); }
CassandraRingResource { @POST public Response createRing(@Valid CassandraRing ring) { service.save(ring); URI location = UriBuilder.fromPath("{name}").build(ring.getName()); return Response.created(location).build(); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); @GET Set<CassandraRing> findAll(); @POST Response createRing(@Valid CassandraRing ring); @GET @Path("{name}") CassandraRing findByName(@PathParam("name") String name); @DELETE @Path("{name}") Response deleteRing(@PathParam("name") String name); @Path("{name}/instances") CassandraInstanceResource getCassandraInstanceResource(@PathParam("name") String name); @Path("{name}/seeds") SeedResource getSeedResource(@PathParam("name") String name); }
CassandraRingResource { @POST public Response createRing(@Valid CassandraRing ring) { service.save(ring); URI location = UriBuilder.fromPath("{name}").build(ring.getName()); return Response.created(location).build(); } @Inject  CassandraRingResource(CassandraRingService service,
      CassandraInstanceResourceFactory instanceResourceFactory,
      SeedResourceFactory seedResourceFactory); @GET Set<CassandraRing> findAll(); @POST Response createRing(@Valid CassandraRing ring); @GET @Path("{name}") CassandraRing findByName(@PathParam("name") String name); @DELETE @Path("{name}") Response deleteRing(@PathParam("name") String name); @Path("{name}/instances") CassandraInstanceResource getCassandraInstanceResource(@PathParam("name") String name); @Path("{name}/seeds") SeedResource getSeedResource(@PathParam("name") String name);  }