test_class.declarator: CLUSTER_NAME = "testcluster"
test_class.modifier: static final
test_class.original_string: static final String CLUSTER_NAME = "testcluster";
test_class.type: String
test_class.var_name: CLUSTER_NAME
test_class.declarator: PARTITIONER = "org.apache.cassandra.dht.RandomPartitioner"
test_class.modifier: static final
test_class.original_string: static final String PARTITIONER = "org.apache.cassandra.dht.RandomPartitioner";
test_class.type: String
test_class.var_name: PARTITIONER
test_class.declarator: SEED_HOST = "TestHost"
test_class.modifier: static final
test_class.original_string: static final String SEED_HOST = "TestHost";
test_class.type: String
test_class.var_name: SEED_HOST
test_class.declarator: SAMPLE_URI = URI.create("http://reaper_host/cluster/")
test_class.modifier: static final
test_class.original_string: static final URI SAMPLE_URI = URI.create("http://reaper_host/cluster/");
test_class.type: URI
test_class.var_name: SAMPLE_URI
test_class.declarator: I_DO_EXIST = "i_do_exist"
test_class.modifier: static final
test_class.original_string: static final String I_DO_EXIST = "i_do_exist";
test_class.type: String
test_class.var_name: I_DO_EXIST
test_class.declarator: I_DONT_EXIST = "i_dont_exist"
test_class.modifier: static final
test_class.original_string: static final String I_DONT_EXIST = "i_dont_exist";
test_class.type: String
test_class.var_name: I_DONT_EXIST
test_class.declarator: JMX_USERNAME = "foo"
test_class.modifier: static final
test_class.original_string: static final String JMX_USERNAME = "foo";
test_class.type: String
test_class.var_name: JMX_USERNAME
test_class.declarator: JMX_PASSWORD = "bar"
test_class.modifier: static final
test_class.original_string: static final String JMX_PASSWORD = "bar";
test_class.type: String
test_class.var_name: JMX_PASSWORD
test_class.declarator: STCS = "SizeTieredCompactionStrategy"
test_class.modifier: private static final
test_class.original_string: private static final String STCS = "SizeTieredCompactionStrategy";
test_class.type: String
test_class.var_name: STCS
test_class.declarator: EXECUTOR = Executors.newSingleThreadExecutor()
test_class.modifier: private static final
test_class.original_string: private static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor();
test_class.type: ExecutorService
test_class.var_name: EXECUTOR
test_class.file: src/server/src/test/java/io/cassandrareaper/resources/ClusterResourceTest.java
test_class.identifier: ClusterResourceTest
test_case.body: @Test
    public void testGetClusters_all() throws ReaperException {
      final MockObjects mocks = initMocks();
  
      Cluster cluster = Cluster.builder()
          .withName(CLUSTER_NAME)
          .withSeedHosts(ImmutableSet.of(SEED_HOST))
          .withState(Cluster.State.ACTIVE)
          .build();
  
      mocks.context.storage.addCluster(cluster);
  
      ClusterResource clusterResource = new ClusterResource(mocks.context, mocks.cryptograph, EXECUTOR);
      Response response = clusterResource.getClusterList(Optional.empty());
      Assertions.assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
      List<String> clusterNames = (List<String>) response.getEntity();
      Assertions.assertThat(clusterNames).hasSize(1);
      Assertions.assertThat(clusterNames).contains(CLUSTER_NAME);
    }
test_case.class_method_signature: ClusterResourceTest.testGetClusters_all()
test_case.full_signature: @Test public void testGetClusters_all()
test_case.identifier: testGetClusters_all
test_case.invocations: initMocks build withState withSeedHosts withName builder of addCluster getClusterList empty isEqualTo assertThat getStatus getEntity hasSize assertThat contains assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetClusters_all()
focal_class.declarator: LOG = LoggerFactory.getLogger(ClusterResource.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ClusterResource.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: context
focal_class.modifier: private final
focal_class.original_string: private final AppContext context;
focal_class.type: AppContext
focal_class.var_name: context
focal_class.declarator: executor
focal_class.modifier: private final
focal_class.original_string: private final ExecutorService executor;
focal_class.type: ExecutorService
focal_class.var_name: executor
focal_class.declarator: clusterRepairScheduler
focal_class.modifier: private final
focal_class.original_string: private final ClusterRepairScheduler clusterRepairScheduler;
focal_class.type: ClusterRepairScheduler
focal_class.var_name: clusterRepairScheduler
focal_class.declarator: clusterFacade
focal_class.modifier: private final
focal_class.original_string: private final ClusterFacade clusterFacade;
focal_class.type: ClusterFacade
focal_class.var_name: clusterFacade
focal_class.declarator: cryptograph
focal_class.modifier: private final
focal_class.original_string: private final Cryptograph cryptograph;
focal_class.type: Cryptograph
focal_class.var_name: cryptograph
focal_class.file: src/server/src/main/java/io/cassandrareaper/resources/ClusterResource.java
focal_class.identifier: ClusterResource
focal_class.class_method_signature: ClusterResource.ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor)
focal_class.full_signature: public  ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor)
focal_class.identifier: ClusterResource
focal_class.modifiers: public
focal_class.parameters: (AppContext context, Cryptograph cryptograph, ExecutorService executor)
focal_class.signature:  ClusterResource(AppContext context, Cryptograph cryptograph, ExecutorService executor)
focal_class.class_method_signature: ClusterResource.getClusterList(@QueryParam("seedHost") Optional<String> seedHost)
focal_class.full_signature: @GET public Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost)
focal_class.identifier: getClusterList
focal_class.modifiers: @GET public
focal_class.parameters: (@QueryParam("seedHost") Optional<String> seedHost)
focal_class.return: Response
focal_class.signature: Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost)
focal_class.class_method_signature: ClusterResource.getCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("limit") Optional<Integer> limit)
focal_class.full_signature: @GET @Path("/{cluster_name}") public Response getCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("limit") Optional<Integer> limit)
focal_class.identifier: getCluster
focal_class.modifiers: @GET @Path("/{cluster_name}") public
focal_class.parameters: (
        @PathParam("cluster_name") String clusterName,
        @QueryParam("limit") Optional<Integer> limit)
focal_class.return: Response
focal_class.signature: Response getCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("limit") Optional<Integer> limit)
focal_class.class_method_signature: ClusterResource.getClusterTables(@PathParam("cluster_name") String clusterName)
focal_class.full_signature: @GET @Path("/{cluster_name}/tables") public Response getClusterTables(@PathParam("cluster_name") String clusterName)
focal_class.identifier: getClusterTables
focal_class.modifiers: @GET @Path("/{cluster_name}/tables") public
focal_class.parameters: (@PathParam("cluster_name") String clusterName)
focal_class.return: Response
focal_class.signature: Response getClusterTables(@PathParam("cluster_name") String clusterName)
focal_class.class_method_signature: ClusterResource.addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.full_signature: @POST public Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.identifier: addOrUpdateCluster
focal_class.modifiers: @POST public
focal_class.parameters: (
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.return: Response
focal_class.signature: Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.class_method_signature: ClusterResource.addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @FormParam("seedHost") Optional<String> seedHost,
        @FormParam("jmxPort") Optional<Integer> jmxPort,
        @FormParam("jmxUsername") Optional<String> jmxUsername,
        @FormParam("jmxPassword") Optional<String> jmxPassword)
focal_class.full_signature: @POST @Path("/auth") public 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)
focal_class.identifier: addOrUpdateCluster
focal_class.modifiers: @POST @Path("/auth") public
focal_class.parameters: (
        @Context UriInfo uriInfo,
        @FormParam("seedHost") Optional<String> seedHost,
        @FormParam("jmxPort") Optional<Integer> jmxPort,
        @FormParam("jmxUsername") Optional<String> jmxUsername,
        @FormParam("jmxPassword") Optional<String> jmxPassword)
focal_class.return: Response
focal_class.signature: 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)
focal_class.class_method_signature: ClusterResource.addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @PathParam("cluster_name") String clusterName,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.full_signature: @PUT @Path("/{cluster_name}") public Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @PathParam("cluster_name") String clusterName,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.identifier: addOrUpdateCluster
focal_class.modifiers: @PUT @Path("/{cluster_name}") public
focal_class.parameters: (
        @Context UriInfo uriInfo,
        @PathParam("cluster_name") String clusterName,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.return: Response
focal_class.signature: Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @PathParam("cluster_name") String clusterName,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_class.class_method_signature: ClusterResource.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)
focal_class.full_signature: @PUT @Path("/auth/{cluster_name}") public 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)
focal_class.identifier: addOrUpdateCluster
focal_class.modifiers: @PUT @Path("/auth/{cluster_name}") public
focal_class.parameters: (
        @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)
focal_class.return: Response
focal_class.signature: 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)
focal_class.class_method_signature: ClusterResource.addOrUpdateCluster(
        UriInfo uriInfo,
        Optional<String> clusterName,
        Optional<String> seedHost,
        Optional<Integer> jmxPort,
        Optional<String> jmxUsername,
        Optional<String> jmxPassword)
focal_class.full_signature: private Response addOrUpdateCluster(
        UriInfo uriInfo,
        Optional<String> clusterName,
        Optional<String> seedHost,
        Optional<Integer> jmxPort,
        Optional<String> jmxUsername,
        Optional<String> jmxPassword)
focal_class.identifier: addOrUpdateCluster
focal_class.modifiers: private
focal_class.parameters: (
        UriInfo uriInfo,
        Optional<String> clusterName,
        Optional<String> seedHost,
        Optional<Integer> jmxPort,
        Optional<String> jmxUsername,
        Optional<String> jmxPassword)
focal_class.return: Response
focal_class.signature: Response addOrUpdateCluster(
        UriInfo uriInfo,
        Optional<String> clusterName,
        Optional<String> seedHost,
        Optional<Integer> jmxPort,
        Optional<String> jmxUsername,
        Optional<String> jmxPassword)
focal_class.class_method_signature: ClusterResource.findClusterWithSeedHost(String seedHost,
                                                     Optional<Integer> jmxPort,
                                                     Optional<JmxCredentials> jmxCredentials)
focal_class.full_signature: public Optional<Cluster> findClusterWithSeedHost(String seedHost,
                                                     Optional<Integer> jmxPort,
                                                     Optional<JmxCredentials> jmxCredentials)
focal_class.identifier: findClusterWithSeedHost
focal_class.modifiers: public
focal_class.parameters: (String seedHost,
                                                     Optional<Integer> jmxPort,
                                                     Optional<JmxCredentials> jmxCredentials)
focal_class.return: Optional<Cluster>
focal_class.signature: Optional<Cluster> findClusterWithSeedHost(String seedHost,
                                                     Optional<Integer> jmxPort,
                                                     Optional<JmxCredentials> jmxCredentials)
focal_class.class_method_signature: ClusterResource.updateClusterSeeds(Cluster cluster, String seedHosts)
focal_class.full_signature: private Cluster updateClusterSeeds(Cluster cluster, String seedHosts)
focal_class.identifier: updateClusterSeeds
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster, String seedHosts)
focal_class.return: Cluster
focal_class.signature: Cluster updateClusterSeeds(Cluster cluster, String seedHosts)
focal_class.class_method_signature: ClusterResource.deleteCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("force") Optional<Boolean> force)
focal_class.full_signature: @DELETE @Path("/{cluster_name}") public Response deleteCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("force") Optional<Boolean> force)
focal_class.identifier: deleteCluster
focal_class.modifiers: @DELETE @Path("/{cluster_name}") public
focal_class.parameters: (
        @PathParam("cluster_name") String clusterName,
        @QueryParam("force") Optional<Boolean> force)
focal_class.return: Response
focal_class.signature: Response deleteCluster(
        @PathParam("cluster_name") String clusterName,
        @QueryParam("force") Optional<Boolean> force)
focal_class.class_method_signature: ClusterResource.getEndpointState(Cluster cluster, Set<String> seeds)
focal_class.full_signature: private Callable<NodesStatus> getEndpointState(Cluster cluster, Set<String> seeds)
focal_class.identifier: getEndpointState
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster, Set<String> seeds)
focal_class.return: Callable<NodesStatus>
focal_class.signature: Callable<NodesStatus> getEndpointState(Cluster cluster, Set<String> seeds)
focal_class.class_method_signature: ClusterResource.getNodesStatus(Cluster cluster)
focal_class.full_signature: private NodesStatus getNodesStatus(Cluster cluster)
focal_class.identifier: getNodesStatus
focal_class.modifiers: private
focal_class.parameters: (Cluster cluster)
focal_class.return: NodesStatus
focal_class.signature: NodesStatus getNodesStatus(Cluster cluster)
focal_class.class_method_signature: ClusterResource.parseSeedHosts(String seedHost)
focal_class.full_signature: static Set<String> parseSeedHosts(String seedHost)
focal_class.identifier: parseSeedHosts
focal_class.modifiers: static
focal_class.parameters: (String seedHost)
focal_class.return: Set<String>
focal_class.signature: Set<String> parseSeedHosts(String seedHost)
focal_class.class_method_signature: ClusterResource.parseSeedHost(String seedHost)
focal_class.full_signature: static String parseSeedHost(String seedHost)
focal_class.identifier: parseSeedHost
focal_class.modifiers: static
focal_class.parameters: (String seedHost)
focal_class.return: String
focal_class.signature: String parseSeedHost(String seedHost)
focal_class.class_method_signature: ClusterResource.parseClusterNameFromSeedHost(String seedHost)
focal_class.full_signature: static Optional<String> parseClusterNameFromSeedHost(String seedHost)
focal_class.identifier: parseClusterNameFromSeedHost
focal_class.modifiers: static
focal_class.parameters: (String seedHost)
focal_class.return: Optional<String>
focal_class.signature: Optional<String> parseClusterNameFromSeedHost(String seedHost)
focal_method.body: @GET
    public Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost) {
      LOG.debug("get cluster list called");
  
      Collection<String> clusters = context.storage.getClusters()
          .stream()
          .filter(c -> !seedHost.isPresent() || c.getSeedHosts().contains(seedHost.get()))
          .sorted()
          .map(c -> c.getName())
          .collect(Collectors.toList());
  
      return Response.ok().entity(clusters).build();
    }
focal_method.class_method_signature: ClusterResource.getClusterList(@QueryParam("seedHost") Optional<String> seedHost)
focal_method.full_signature: @GET public Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost)
focal_method.identifier: getClusterList
focal_method.invocations: debug collect map sorted filter stream getClusters isPresent contains getSeedHosts get getName toList build entity ok
focal_method.modifiers: @GET public
focal_method.parameters: (@QueryParam("seedHost") Optional<String> seedHost)
focal_method.return: Response
focal_method.signature: Response getClusterList(@QueryParam("seedHost") Optional<String> seedHost)