@Test public void getReplacedAddress(@Mocked final InstanceIdentity identity) { final String replacedIp = "127.0.0.1"; new Expectations() { { priamServer.getInstanceIdentity(); result = identity; identity.getReplacedIp(); result = replacedIp; } }; Response response = resource.getReplacedIp(); assertEquals(200, response.getStatus()); assertEquals(replacedIp, response.getEntity()); }
@GET @Path("/get_replaced_ip") public Response getReplacedIp() { try { metrics.incGetReplacedIp(); return Response.ok(String.valueOf(priamServer.getInstanceIdentity().getReplacedIp())) .build(); } catch (Exception e) { logger.error("Error while executing get_replaced_ip", e); return Response.serverError().build(); } }
CassandraConfig { @GET @Path("/get_replaced_ip") public Response getReplacedIp() { try { metrics.incGetReplacedIp(); return Response.ok(String.valueOf(priamServer.getInstanceIdentity().getReplacedIp())) .build(); } catch (Exception e) { logger.error("Error while executing get_replaced_ip", e); return Response.serverError().build(); } } }
CassandraConfig { @GET @Path("/get_replaced_ip") public Response getReplacedIp() { try { metrics.incGetReplacedIp(); return Response.ok(String.valueOf(priamServer.getInstanceIdentity().getReplacedIp())) .build(); } catch (Exception e) { logger.error("Error while executing get_replaced_ip", e); return Response.serverError().build(); } } @Inject  CassandraConfig(PriamServer server, DoubleRing doubleRing, CassMonitorMetrics metrics); }
CassandraConfig { @GET @Path("/get_replaced_ip") public Response getReplacedIp() { try { metrics.incGetReplacedIp(); return Response.ok(String.valueOf(priamServer.getInstanceIdentity().getReplacedIp())) .build(); } catch (Exception e) { logger.error("Error while executing get_replaced_ip", e); return Response.serverError().build(); } } @Inject  CassandraConfig(PriamServer server, DoubleRing doubleRing, CassMonitorMetrics metrics); @GET @Path("/get_seeds") Response getSeeds(); @GET @Path("/get_token") Response getToken(); @GET @Path("/is_replace_token") Response isReplaceToken(); @GET @Path("/get_replaced_ip") Response getReplacedIp(); @POST @Path("/set_replaced_ip") Response setReplacedIp(@QueryParam("ip") String ip); @GET @Path("/get_extra_env_params") Response getExtraEnvParams(); @GET @Path("/double_ring") Response doubleRing(); }
CassandraConfig { @GET @Path("/get_replaced_ip") public Response getReplacedIp() { try { metrics.incGetReplacedIp(); return Response.ok(String.valueOf(priamServer.getInstanceIdentity().getReplacedIp())) .build(); } catch (Exception e) { logger.error("Error while executing get_replaced_ip", e); return Response.serverError().build(); } } @Inject  CassandraConfig(PriamServer server, DoubleRing doubleRing, CassMonitorMetrics metrics); @GET @Path("/get_seeds") Response getSeeds(); @GET @Path("/get_token") Response getToken(); @GET @Path("/is_replace_token") Response isReplaceToken(); @GET @Path("/get_replaced_ip") Response getReplacedIp(); @POST @Path("/set_replaced_ip") Response setReplacedIp(@QueryParam("ip") String ip); @GET @Path("/get_extra_env_params") Response getExtraEnvParams(); @GET @Path("/double_ring") Response doubleRing();  }