@Test public void testGetStatus() { MessageReceiverImpl receiver = EasyMock.createMock(MessageReceiverImpl.class); EasyMock.expect(receiver.isConnected()).andReturn(true).once(); EasyMock.expect(receiver.isConnected()).andReturn(false).once(); MessageSenderImpl sender = EasyMock.createMock(MessageSenderImpl.class); EasyMock.expect(sender.isConnected()).andReturn(true).once(); EasyMock.expect(sender.isConnected()).andReturn(false).once(); EasyMock.replay(sender, receiver); MessageBrokerServiceEndpoint endpoint = new MessageBrokerServiceEndpoint(); endpoint.setMessageReceiver(receiver); endpoint.setMessageSender(sender); assertEquals(endpoint.getStatus().getStatus(), SC_NO_CONTENT); assertEquals(endpoint.getStatus().getStatus(), SC_SERVICE_UNAVAILABLE); }
@GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) public Response getStatus() { if (messageReceiver.isConnected() && messageSender.isConnected()) { return Response.status(SC_NO_CONTENT).build(); } return Response.status(SC_SERVICE_UNAVAILABLE).build(); }
MessageBrokerServiceEndpoint { @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) public Response getStatus() { if (messageReceiver.isConnected() && messageSender.isConnected()) { return Response.status(SC_NO_CONTENT).build(); } return Response.status(SC_SERVICE_UNAVAILABLE).build(); } }
MessageBrokerServiceEndpoint { @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) public Response getStatus() { if (messageReceiver.isConnected() && messageSender.isConnected()) { return Response.status(SC_NO_CONTENT).build(); } return Response.status(SC_SERVICE_UNAVAILABLE).build(); }  }
MessageBrokerServiceEndpoint { @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) public Response getStatus() { if (messageReceiver.isConnected() && messageSender.isConnected()) { return Response.status(SC_NO_CONTENT).build(); } return Response.status(SC_SERVICE_UNAVAILABLE).build(); }  @Reference(name = "messageReceiver") void setMessageReceiver(MessageReceiver messageReceiver); @Reference(name = "messageSender") void setMessageSender(MessageSender messageSender); @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) Response getStatus(); }
MessageBrokerServiceEndpoint { @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) public Response getStatus() { if (messageReceiver.isConnected() && messageSender.isConnected()) { return Response.status(SC_NO_CONTENT).build(); } return Response.status(SC_SERVICE_UNAVAILABLE).build(); }  @Reference(name = "messageReceiver") void setMessageReceiver(MessageReceiver messageReceiver); @Reference(name = "messageSender") void setMessageSender(MessageSender messageSender); @GET @Path("status") @RestQuery( name = "status", description = "Return status of message broker", returnDescription = "Return status of message broker", responses = { @RestResponse( responseCode = SC_NO_CONTENT, description = "Connection to message broker ok"), @RestResponse( responseCode = SC_SERVICE_UNAVAILABLE, description = "Not connected to message broker") }) Response getStatus();  }