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 addingAClusterAutomaticallySetupSchedulingRepairsWhenEnabled() throws Exception {
      final MockObjects mocks = initMocks();
      when(mocks.jmxProxy.getLiveNodes()).thenReturn(Arrays.asList(SEED_HOST));
      when(mocks.jmxProxy.getKeyspaces()).thenReturn(Lists.newArrayList("keyspace1"));
  
      when(mocks.jmxProxy.getTablesForKeyspace("keyspace1"))
          .thenReturn(Sets.newHashSet(Table.builder().withName("table1").withCompactionStrategy(STCS).build()));
  
      mocks.context.config = TestRepairConfiguration.defaultConfigBuilder()
          .withAutoScheduling(
              TestRepairConfiguration.defaultAutoSchedulingConfigBuilder()
                  .thatIsEnabled()
                  .withTimeBeforeFirstSchedule(Duration.ofMinutes(1))
                  .build())
          .build();
  
      ClusterResource clusterResource = new ClusterResource(
              mocks.context,
              mocks.cryptograph,
              Executors.newFixedThreadPool(2));
  
      Response response = clusterResource
          .addOrUpdateCluster(mocks.uriInfo, Optional.of(SEED_HOST), Optional.of(Cluster.DEFAULT_JMX_PORT),
                  Optional.of(JMX_USERNAME), Optional.of(JMX_PASSWORD));
  
      assertEquals(HttpStatus.CREATED_201, response.getStatus());
      assertEquals(1, mocks.context.storage.getAllRepairSchedules().size());
      assertEquals(1, mocks.context.storage.getRepairSchedulesForClusterAndKeyspace(CLUSTER_NAME, "keyspace1").size());
    }
test_case.class_method_signature: ClusterResourceTest.addingAClusterAutomaticallySetupSchedulingRepairsWhenEnabled()
test_case.full_signature: @Test public void addingAClusterAutomaticallySetupSchedulingRepairsWhenEnabled()
test_case.identifier: addingAClusterAutomaticallySetupSchedulingRepairsWhenEnabled
test_case.invocations: initMocks thenReturn when getLiveNodes asList thenReturn when getKeyspaces newArrayList thenReturn when getTablesForKeyspace newHashSet build withCompactionStrategy withName builder build withAutoScheduling defaultConfigBuilder build withTimeBeforeFirstSchedule thatIsEnabled defaultAutoSchedulingConfigBuilder ofMinutes newFixedThreadPool addOrUpdateCluster of of of of assertEquals getStatus assertEquals size getAllRepairSchedules assertEquals size getRepairSchedulesForClusterAndKeyspace
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addingAClusterAutomaticallySetupSchedulingRepairsWhenEnabled()
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: @POST
    public Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort) {
  
      LOG.info("POST addOrUpdateCluster called with seedHost: {}", seedHost.orElse(null));
      return addOrUpdateCluster(uriInfo, Optional.empty(), seedHost, jmxPort, Optional.empty(), Optional.empty());
    }
focal_method.class_method_signature: ClusterResource.addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_method.full_signature: @POST public Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_method.identifier: addOrUpdateCluster
focal_method.invocations: info orElse addOrUpdateCluster empty empty empty
focal_method.modifiers: @POST public
focal_method.parameters: (
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)
focal_method.return: Response
focal_method.signature: Response addOrUpdateCluster(
        @Context UriInfo uriInfo,
        @QueryParam("seedHost") Optional<String> seedHost,
        @QueryParam("jmxPort") Optional<Integer> jmxPort)