@Test public void getFrameworkSerializations() { Serialization mockedSerialization1 = new Serialization(); mockedSerialization1.setId("serialization-1"); mockedSerialization1.setTypeClass("streamflow.type.class.one"); mockedSerialization1.setSerializerClass("streamflow.serializer.class.one"); mockedSerialization1.setFramework("test-framework"); mockedSerialization1.setFrameworkLabel("Test Framework"); Serialization mockedSerialization2 = new Serialization(); mockedSerialization2.setId("serialization-2"); mockedSerialization1.setTypeClass("streamflow.type.class.two"); mockedSerialization1.setSerializerClass("streamflow.serializer.class.two"); mockedSerialization2.setFramework("test-framework"); mockedSerialization2.setFrameworkLabel("Test Framework"); List<Serialization> mockedSerializations = new ArrayList<Serialization>(); mockedSerializations.add(mockedSerialization1); mockedSerializations.add(mockedSerialization2); when(serializationServiceMock.listSerializationsWithFramework(anyString())) .thenReturn(mockedSerializations); List<Serialization> responseSerializations = resource().path("/api/frameworks/" + mockedSerialization1.getFramework() + "/serializations").accept(MediaType.APPLICATION_JSON) .get(new GenericType<List<Serialization>>(){}); assertEquals("Response serializations should match the mocked serializations", mockedSerializations, responseSerializations); verify(serializationServiceMock).listSerializationsWithFramework(anyString()); }
@GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) public List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId) { return serializationService.listSerializationsWithFramework(frameworkId); }
FrameworkResource { @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) public List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId) { return serializationService.listSerializationsWithFramework(frameworkId); } }
FrameworkResource { @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) public List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId) { return serializationService.listSerializationsWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); }
FrameworkResource { @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) public List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId) { return serializationService.listSerializationsWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); @GET @Produces(MediaType.APPLICATION_JSON) List<Framework> listFrameworks(); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) Framework saveFramework(@FormDataParam("file") byte[] frameworkJar, 
            @FormDataParam("isPublic") @DefaultValue("false") boolean isPublic); @GET @Path("/{frameworkId}") @Produces(MediaType.APPLICATION_JSON) Framework getFramework(@PathParam("frameworkId") String frameworkId); @DELETE @Path("/{frameworkId}") Response deleteFramework(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/jar") @Produces("application/java-archive") Response getFrameworkJar(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/components") @Produces(MediaType.APPLICATION_JSON) List<Component> getFrameworkComponents(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId); }
FrameworkResource { @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) public List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId) { return serializationService.listSerializationsWithFramework(frameworkId); } @Inject  FrameworkResource(FrameworkService frameworkService,
            ComponentService componentService, ResourceService resourceService,
            SerializationService serializationService); @GET @Produces(MediaType.APPLICATION_JSON) List<Framework> listFrameworks(); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) Framework saveFramework(@FormDataParam("file") byte[] frameworkJar, 
            @FormDataParam("isPublic") @DefaultValue("false") boolean isPublic); @GET @Path("/{frameworkId}") @Produces(MediaType.APPLICATION_JSON) Framework getFramework(@PathParam("frameworkId") String frameworkId); @DELETE @Path("/{frameworkId}") Response deleteFramework(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/jar") @Produces("application/java-archive") Response getFrameworkJar(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/components") @Produces(MediaType.APPLICATION_JSON) List<Component> getFrameworkComponents(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/resources") @Produces(MediaType.APPLICATION_JSON) List<Resource> getFrameworkResources(@PathParam("frameworkId") String frameworkId); @GET @Path("/{frameworkId}/serializations") @Produces(MediaType.APPLICATION_JSON) List<Serialization> getFrameworkSerializations(@PathParam("frameworkId") String frameworkId);  }