ClusterResource { static String parseSeedHost(String seedHost) { return Iterables.get(Splitter.on('@').split(seedHost), 0); } ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor); @GET Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost); @GET @Path("/{cluster_name}") Response getCluster(
      @PathParam("cluster_name") String clusterName,
      @QueryParam("limit") Optional<Integer> limit); @GET @Path("/{cluster_name}/tables") Response getClusterTables(@PathParam("cluster_name") String clusterName); @POST Response addOrUpdateCluster(
      @Context UriInfo uriInfo,
      @QueryParam("seedHost") Optional<String> seedHost,
      @QueryParam("jmxPort") Optional<Integer> jmxPort); @POST @Path("/auth") Response addOrUpdateCluster(
      @Context UriInfo uriInfo,
      @FormParam("seedHost") Optional<String> seedHost,
      @FormParam("jmxPort") Optional<Integer> jmxPort,
      @FormParam("jmxUsername") Optional<String> jmxUsername,
      @FormParam("jmxPassword") Optional<String> jmxPassword); @PUT @Path("/{cluster_name}") Response addOrUpdateCluster(
      @Context UriInfo uriInfo,
      @PathParam("cluster_name") String clusterName,
      @QueryParam("seedHost") Optional<String> seedHost,
      @QueryParam("jmxPort") Optional<Integer> jmxPort); @PUT @Path("/auth/{cluster_name}") Response addOrUpdateCluster(
      @Context UriInfo uriInfo,
      @PathParam("cluster_name") String clusterName,
      @FormParam("seedHost") Optional<String> seedHost,
      @FormParam("jmxPort") Optional<Integer> jmxPort,
      @FormParam("jmxUsername") Optional<String> jmxUsername,
      @FormParam("jmxPassword") Optional<String> jmxPassword); Optional<Cluster> findClusterWithSeedHost(String seedHost,
                                                   Optional<Integer> jmxPort,
                                                   Optional<JmxCredentials> jmxCredentials); @DELETE @Path("/{cluster_name}") Response deleteCluster(
      @PathParam("cluster_name") String clusterName,
      @QueryParam("force") Optional<Boolean> force);  }
@Test public void testParseSeedHost() { String seedHostStringList = "127.0.0.1 , 127.0.0.2, 127.0.0.3"; Set<String> seedHostSet = ClusterResource.parseSeedHosts(seedHostStringList); Set<String> seedHostExpectedSet = Sets.newHashSet("127.0.0.2", "127.0.0.1", "127.0.0.3"); assertEquals(seedHostSet, seedHostExpectedSet); }