@Test public void testBetter() throws SocketException { replay(); CassandraConfig example = new CassandraConfig(Main.JJ_DIR + "/cassandra"); example.setListen_address(LOCALHOST); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertTrue(example.better(CLASS_B)); assertTrue(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(LOCALHOSTV6); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertTrue(example.better(CLASS_B)); assertTrue(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(LOCALHOSTV6_0); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertTrue(example.better(CLASS_B)); assertTrue(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(LOCALHOSTV6_FULL); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertTrue(example.better(CLASS_B)); assertTrue(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(CLASS_C); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertTrue(example.better(CLASS_B)); assertFalse(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(CLASS_B); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertFalse(example.better(CLASS_B)); assertFalse(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); example.setListen_address(CLASS_B); assertTrue(example.better(PUBLIC)); assertTrue(example.better(IPV6_PRIV)); assertTrue(example.better(CLASS_A)); assertFalse(example.better(CLASS_B)); assertFalse(example.better(CLASS_C)); assertFalse(example.better(LOCALHOST)); }
boolean better(String newHost) { if (Network.CLASS_D_MULTICAST.is(newHost) || Network.IPV6_LINKLOCAL.is(newHost)) { return false; } String host = this.getListen_address(); if (Network.PUBLIC.is(newHost) && !Network.PUBLIC.is(host)) { return true; } if (Network.IPV6_PRIVATE.is(newHost) && (Network.CLASS_A_PRIVATE.is(host) || Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_A_PRIVATE.is(newHost) && (Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_B_PRIVATE.is(newHost) && (Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_C_PRIVATE.is(newHost) && Network.LOCALHOST.is(host)) { return true; } return false; }
CassandraConfig { boolean better(String newHost) { if (Network.CLASS_D_MULTICAST.is(newHost) || Network.IPV6_LINKLOCAL.is(newHost)) { return false; } String host = this.getListen_address(); if (Network.PUBLIC.is(newHost) && !Network.PUBLIC.is(host)) { return true; } if (Network.IPV6_PRIVATE.is(newHost) && (Network.CLASS_A_PRIVATE.is(host) || Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_A_PRIVATE.is(newHost) && (Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_B_PRIVATE.is(newHost) && (Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_C_PRIVATE.is(newHost) && Network.LOCALHOST.is(host)) { return true; } return false; } }
CassandraConfig { boolean better(String newHost) { if (Network.CLASS_D_MULTICAST.is(newHost) || Network.IPV6_LINKLOCAL.is(newHost)) { return false; } String host = this.getListen_address(); if (Network.PUBLIC.is(newHost) && !Network.PUBLIC.is(host)) { return true; } if (Network.IPV6_PRIVATE.is(newHost) && (Network.CLASS_A_PRIVATE.is(host) || Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_A_PRIVATE.is(newHost) && (Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_B_PRIVATE.is(newHost) && (Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_C_PRIVATE.is(newHost) && Network.LOCALHOST.is(host)) { return true; } return false; } @SuppressWarnings("unchecked")  CassandraConfig(String cassandraDir); }
CassandraConfig { boolean better(String newHost) { if (Network.CLASS_D_MULTICAST.is(newHost) || Network.IPV6_LINKLOCAL.is(newHost)) { return false; } String host = this.getListen_address(); if (Network.PUBLIC.is(newHost) && !Network.PUBLIC.is(host)) { return true; } if (Network.IPV6_PRIVATE.is(newHost) && (Network.CLASS_A_PRIVATE.is(host) || Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_A_PRIVATE.is(newHost) && (Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_B_PRIVATE.is(newHost) && (Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_C_PRIVATE.is(newHost) && Network.LOCALHOST.is(host)) { return true; } return false; } @SuppressWarnings("unchecked")  CassandraConfig(String cassandraDir); ArrayList getSeed_provider(); void setSeed_provider(ArrayList<Map<String, Object>> seed_provider); String guessIp(); String getCluster_name(); void setCluster_name(String cluster_name); String getListen_address(); @SuppressWarnings("unchecked") void setListen_address(String listen_address); String getCommitlog_sync(); void setCommitlog_sync(String commitlog_sync); Integer getCommitlog_sync_period_in_ms(); void setCommitlog_sync_period_in_ms(Integer commitlog_sync_period_in_ms); String getPartitioner(); void setPartitioner(String partitioner); String getEndpoint_snitch(); void setEndpoint_snitch(String endpoint_snitch); String getCommitlog_directory(); void setCommitlog_directory(String commitlog_directory); String getHints_directory(); void setHints_directory(String hints_directory); String getSaved_caches_directory(); void setSaved_caches_directory(String saved_caches_directory); String[] getData_file_directories(); void setData_file_directories(String[] data_file_directories); Boolean getStart_native_transport(); void setStart_native_transport(Boolean start_native_transport); String getAuthenticator(); void setAuthenticator(String authenticator); String getRpc_address(); void setRpc_address(String rpc_address); Integer getNum_tokens(); void setNum_tokens(Integer num_tokens); Integer getWrite_request_timeout_in_ms(); void setWrite_request_timeout_in_ms(Integer write_request_timeout_in_ms); String getCdc_raw_directory(); void setCdc_raw_directory(String cdc_raw_directory); Boolean getEnable_user_defined_functions(); void setEnable_user_defined_functions(Boolean enable_user_defined_functions); }
CassandraConfig { boolean better(String newHost) { if (Network.CLASS_D_MULTICAST.is(newHost) || Network.IPV6_LINKLOCAL.is(newHost)) { return false; } String host = this.getListen_address(); if (Network.PUBLIC.is(newHost) && !Network.PUBLIC.is(host)) { return true; } if (Network.IPV6_PRIVATE.is(newHost) && (Network.CLASS_A_PRIVATE.is(host) || Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_A_PRIVATE.is(newHost) && (Network.CLASS_B_PRIVATE.is(host) || Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_B_PRIVATE.is(newHost) && (Network.CLASS_C_PRIVATE.is(host) || Network.LOCALHOST.is(host))) { return true; } if (Network.CLASS_C_PRIVATE.is(newHost) && Network.LOCALHOST.is(host)) { return true; } return false; } @SuppressWarnings("unchecked")  CassandraConfig(String cassandraDir); ArrayList getSeed_provider(); void setSeed_provider(ArrayList<Map<String, Object>> seed_provider); String guessIp(); String getCluster_name(); void setCluster_name(String cluster_name); String getListen_address(); @SuppressWarnings("unchecked") void setListen_address(String listen_address); String getCommitlog_sync(); void setCommitlog_sync(String commitlog_sync); Integer getCommitlog_sync_period_in_ms(); void setCommitlog_sync_period_in_ms(Integer commitlog_sync_period_in_ms); String getPartitioner(); void setPartitioner(String partitioner); String getEndpoint_snitch(); void setEndpoint_snitch(String endpoint_snitch); String getCommitlog_directory(); void setCommitlog_directory(String commitlog_directory); String getHints_directory(); void setHints_directory(String hints_directory); String getSaved_caches_directory(); void setSaved_caches_directory(String saved_caches_directory); String[] getData_file_directories(); void setData_file_directories(String[] data_file_directories); Boolean getStart_native_transport(); void setStart_native_transport(Boolean start_native_transport); String getAuthenticator(); void setAuthenticator(String authenticator); String getRpc_address(); void setRpc_address(String rpc_address); Integer getNum_tokens(); void setNum_tokens(Integer num_tokens); Integer getWrite_request_timeout_in_ms(); void setWrite_request_timeout_in_ms(Integer write_request_timeout_in_ms); String getCdc_raw_directory(); void setCdc_raw_directory(String cdc_raw_directory); Boolean getEnable_user_defined_functions(); void setEnable_user_defined_functions(Boolean enable_user_defined_functions);  }