@Test public void push() { final byte[] someData = "SomeData".getBytes(); final EncodedPayload payload = mock(EncodedPayload.class); when(payloadEncoder.decode(someData)).thenReturn(payload); final Response result = transactionResource.push(someData); assertThat(result.getStatus()).isEqualTo(201); assertThat(result.hasEntity()).isTrue(); verify(transactionManager).storePayload(payload); }
@ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) public Response push( @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload) { LOGGER.debug("Received push request"); final MessageHash messageHash = transactionManager.storePayload(encoder.decode(payload)); LOGGER.debug("Push request generated hash {}", messageHash); return Response.status(Response.Status.CREATED).entity(Objects.toString(messageHash)).build(); }
TransactionResource { @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) public Response push( @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload) { LOGGER.debug("Received push request"); final MessageHash messageHash = transactionManager.storePayload(encoder.decode(payload)); LOGGER.debug("Push request generated hash {}", messageHash); return Response.status(Response.Status.CREATED).entity(Objects.toString(messageHash)).build(); } }
TransactionResource { @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) public Response push( @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload) { LOGGER.debug("Received push request"); final MessageHash messageHash = transactionManager.storePayload(encoder.decode(payload)); LOGGER.debug("Push request generated hash {}", messageHash); return Response.status(Response.Status.CREATED).entity(Objects.toString(messageHash)).build(); } TransactionResource(final TransactionManager delegate, final PayloadEncoder payloadEncoder); }
TransactionResource { @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) public Response push( @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload) { LOGGER.debug("Received push request"); final MessageHash messageHash = transactionManager.storePayload(encoder.decode(payload)); LOGGER.debug("Push request generated hash {}", messageHash); return Response.status(Response.Status.CREATED).entity(Objects.toString(messageHash)).build(); } TransactionResource(final TransactionManager delegate, final PayloadEncoder payloadEncoder); @ApiOperation("Resend transactions for given key or message hash/recipient") @ApiResponses({ @ApiResponse(code = 200, message = "Encoded payload when TYPE is INDIVIDUAL", response = String.class), @ApiResponse(code = 500, message = "General error") }) @POST @Path("resend") @Consumes(APPLICATION_JSON) @Produces(TEXT_PLAIN) Response resend(
            @ApiParam(name = "resendRequest", required = true) @Valid @NotNull final ResendRequest resendRequest); @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) Response push(
            @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload); }
TransactionResource { @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) public Response push( @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload) { LOGGER.debug("Received push request"); final MessageHash messageHash = transactionManager.storePayload(encoder.decode(payload)); LOGGER.debug("Push request generated hash {}", messageHash); return Response.status(Response.Status.CREATED).entity(Objects.toString(messageHash)).build(); } TransactionResource(final TransactionManager delegate, final PayloadEncoder payloadEncoder); @ApiOperation("Resend transactions for given key or message hash/recipient") @ApiResponses({ @ApiResponse(code = 200, message = "Encoded payload when TYPE is INDIVIDUAL", response = String.class), @ApiResponse(code = 500, message = "General error") }) @POST @Path("resend") @Consumes(APPLICATION_JSON) @Produces(TEXT_PLAIN) Response resend(
            @ApiParam(name = "resendRequest", required = true) @Valid @NotNull final ResendRequest resendRequest); @ApiOperation(value = "Transmit encrypted payload between P2PRestApp Nodes") @ApiResponses({ @ApiResponse(code = 201, message = "Key created status"), @ApiResponse(code = 500, message = "General error") }) @POST @Path("push") @Consumes(APPLICATION_OCTET_STREAM) Response push(
            @ApiParam(name = "payload", required = true, value = "Key data to be stored.") final byte[] payload);  }