test_class.file: src/server/src/test/java/io/cassandrareaper/jmx/JmxConnectionFactoryTest.java
test_class.identifier: JmxConnectionFactoryTest
test_case.body: @Test
    public void fetchingJmxCredentialsIsntPresentWhenNotDefinedAnywhere() {
      Cluster cluster = Cluster.builder().withName("FooCluster")
              .withSeedHosts(ImmutableSet.of("127.0.0.1")).build();
  
      JmxConnectionFactory connectionFactory = new JmxConnectionFactory(mock(AppContext.class), mock(Cryptograph.class));
  
      Optional<JmxCredentials> jmxCredentials = connectionFactory.getJmxCredentialsForCluster(Optional.of(cluster));
  
      assertFalse(jmxCredentials.isPresent());
    }
test_case.class_method_signature: JmxConnectionFactoryTest.fetchingJmxCredentialsIsntPresentWhenNotDefinedAnywhere()
test_case.full_signature: @Test public void fetchingJmxCredentialsIsntPresentWhenNotDefinedAnywhere()
test_case.identifier: fetchingJmxCredentialsIsntPresentWhenNotDefinedAnywhere
test_case.invocations: build withSeedHosts withName builder of mock mock getJmxCredentialsForCluster of assertFalse isPresent
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void fetchingJmxCredentialsIsntPresentWhenNotDefinedAnywhere()
focal_class.declarator: LOG = LoggerFactory.getLogger(JmxConnectionFactory.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(JmxConnectionFactory.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: JMX_CONNECTIONS = Maps.newConcurrentMap()
focal_class.modifier: private static final
focal_class.original_string: private static final ConcurrentMap<String, JmxProxy> JMX_CONNECTIONS = Maps.newConcurrentMap();
focal_class.type: ConcurrentMap<String, JmxProxy>
focal_class.var_name: JMX_CONNECTIONS
focal_class.declarator: metricRegistry
focal_class.modifier: private final
focal_class.original_string: private final MetricRegistry metricRegistry;
focal_class.type: MetricRegistry
focal_class.var_name: metricRegistry
focal_class.declarator: hostConnectionCounters
focal_class.modifier: private final
focal_class.original_string: private final HostConnectionCounters hostConnectionCounters;
focal_class.type: HostConnectionCounters
focal_class.var_name: hostConnectionCounters
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: 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.declarator: jmxPorts
focal_class.modifier: private
focal_class.original_string: private Map<String, Integer> jmxPorts;
focal_class.type: Map<String, Integer>
focal_class.var_name: jmxPorts
focal_class.declarator: jmxAuth
focal_class.modifier: private
focal_class.original_string: private JmxCredentials jmxAuth;
focal_class.type: JmxCredentials
focal_class.var_name: jmxAuth
focal_class.declarator: jmxmp
focal_class.modifier: private
focal_class.original_string: private Jmxmp jmxmp;
focal_class.type: Jmxmp
focal_class.var_name: jmxmp
focal_class.declarator: jmxCredentials
focal_class.modifier: private
focal_class.original_string: private Map<String, JmxCredentials> jmxCredentials;
focal_class.type: Map<String, JmxCredentials>
focal_class.var_name: jmxCredentials
focal_class.declarator: addressTranslator
focal_class.modifier: private
focal_class.original_string: private AddressTranslator addressTranslator;
focal_class.type: AddressTranslator
focal_class.var_name: addressTranslator
focal_class.declarator: accessibleDatacenters = Sets.newHashSet()
focal_class.modifier: private final
focal_class.original_string: private final Set<String> accessibleDatacenters = Sets.newHashSet();
focal_class.type: Set<String>
focal_class.var_name: accessibleDatacenters
focal_class.file: src/server/src/main/java/io/cassandrareaper/jmx/JmxConnectionFactory.java
focal_class.identifier: JmxConnectionFactory
focal_class.class_method_signature: JmxConnectionFactory.JmxConnectionFactory(AppContext context, Cryptograph cryptograph)
focal_class.full_signature: public  JmxConnectionFactory(AppContext context, Cryptograph cryptograph)
focal_class.identifier: JmxConnectionFactory
focal_class.modifiers: public
focal_class.parameters: (AppContext context, Cryptograph cryptograph)
focal_class.signature:  JmxConnectionFactory(AppContext context, Cryptograph cryptograph)
focal_class.class_method_signature: JmxConnectionFactory.registerConnectionsGauge()
focal_class.full_signature: private void registerConnectionsGauge()
focal_class.identifier: registerConnectionsGauge
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void registerConnectionsGauge()
focal_class.class_method_signature: JmxConnectionFactory.connectImpl(Node node)
focal_class.full_signature: protected JmxProxy connectImpl(Node node)
focal_class.identifier: connectImpl
focal_class.modifiers: protected
focal_class.parameters: (Node node)
focal_class.return: JmxProxy
focal_class.signature: JmxProxy connectImpl(Node node)
focal_class.class_method_signature: JmxConnectionFactory.connectAny(Collection<Node> nodes)
focal_class.full_signature: @VisibleForTesting public final JmxProxy connectAny(Collection<Node> nodes)
focal_class.identifier: connectAny
focal_class.modifiers: @VisibleForTesting public final
focal_class.parameters: (Collection<Node> nodes)
focal_class.return: JmxProxy
focal_class.signature: JmxProxy connectAny(Collection<Node> nodes)
focal_class.class_method_signature: JmxConnectionFactory.setJmxAuth(JmxCredentials jmxAuth)
focal_class.full_signature: public final void setJmxAuth(JmxCredentials jmxAuth)
focal_class.identifier: setJmxAuth
focal_class.modifiers: public final
focal_class.parameters: (JmxCredentials jmxAuth)
focal_class.return: void
focal_class.signature: void setJmxAuth(JmxCredentials jmxAuth)
focal_class.class_method_signature: JmxConnectionFactory.setJmxCredentials(Map<String, JmxCredentials> jmxCredentials)
focal_class.full_signature: public final void setJmxCredentials(Map<String, JmxCredentials> jmxCredentials)
focal_class.identifier: setJmxCredentials
focal_class.modifiers: public final
focal_class.parameters: (Map<String, JmxCredentials> jmxCredentials)
focal_class.return: void
focal_class.signature: void setJmxCredentials(Map<String, JmxCredentials> jmxCredentials)
focal_class.class_method_signature: JmxConnectionFactory.setJmxPorts(Map<String, Integer> jmxPorts)
focal_class.full_signature: public final void setJmxPorts(Map<String, Integer> jmxPorts)
focal_class.identifier: setJmxPorts
focal_class.modifiers: public final
focal_class.parameters: (Map<String, Integer> jmxPorts)
focal_class.return: void
focal_class.signature: void setJmxPorts(Map<String, Integer> jmxPorts)
focal_class.class_method_signature: JmxConnectionFactory.setAddressTranslator(AddressTranslator addressTranslator)
focal_class.full_signature: public final void setAddressTranslator(AddressTranslator addressTranslator)
focal_class.identifier: setAddressTranslator
focal_class.modifiers: public final
focal_class.parameters: (AddressTranslator addressTranslator)
focal_class.return: void
focal_class.signature: void setAddressTranslator(AddressTranslator addressTranslator)
focal_class.class_method_signature: JmxConnectionFactory.getJmxmp()
focal_class.full_signature: public Jmxmp getJmxmp()
focal_class.identifier: getJmxmp
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Jmxmp
focal_class.signature: Jmxmp getJmxmp()
focal_class.class_method_signature: JmxConnectionFactory.setJmxmp(Jmxmp jmxmp)
focal_class.full_signature: public void setJmxmp(Jmxmp jmxmp)
focal_class.identifier: setJmxmp
focal_class.modifiers: public
focal_class.parameters: (Jmxmp jmxmp)
focal_class.return: void
focal_class.signature: void setJmxmp(Jmxmp jmxmp)
focal_class.class_method_signature: JmxConnectionFactory.getHostConnectionCounters()
focal_class.full_signature: public final HostConnectionCounters getHostConnectionCounters()
focal_class.identifier: getHostConnectionCounters
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: HostConnectionCounters
focal_class.signature: HostConnectionCounters getHostConnectionCounters()
focal_class.class_method_signature: JmxConnectionFactory.getAccessibleDatacenters()
focal_class.full_signature: public final Set<String> getAccessibleDatacenters()
focal_class.identifier: getAccessibleDatacenters
focal_class.modifiers: public final
focal_class.parameters: ()
focal_class.return: Set<String>
focal_class.signature: Set<String> getAccessibleDatacenters()
focal_class.class_method_signature: JmxConnectionFactory.getJmxCredentialsForCluster(Optional<Cluster> cluster)
focal_class.full_signature: public Optional<JmxCredentials> getJmxCredentialsForCluster(Optional<Cluster> cluster)
focal_class.identifier: getJmxCredentialsForCluster
focal_class.modifiers: public
focal_class.parameters: (Optional<Cluster> cluster)
focal_class.return: Optional<JmxCredentials>
focal_class.signature: Optional<JmxCredentials> getJmxCredentialsForCluster(Optional<Cluster> cluster)
focal_method.body: public Optional<JmxCredentials> getJmxCredentialsForCluster(Optional<Cluster> cluster) {
      JmxCredentials credentials = cluster.flatMap(Cluster::getJmxCredentials).orElse(null);
      String clusterName = cluster.map(Cluster::getName).orElse("");
  
      if (credentials == null && jmxCredentials != null) {
        if (jmxCredentials.containsKey(clusterName)) {
          credentials = jmxCredentials.get(clusterName);
        } else if (jmxCredentials.containsKey(Cluster.toSymbolicName(clusterName))) {
          // As clusters get stored in the database with their "symbolic name" we have to look for that too
          credentials = jmxCredentials.get(Cluster.toSymbolicName(clusterName));
        }
      }
  
      if (credentials == null && jmxAuth != null) {
        credentials = jmxAuth;
      }
  
      return Optional.ofNullable(credentials);
    }
focal_method.class_method_signature: JmxConnectionFactory.getJmxCredentialsForCluster(Optional<Cluster> cluster)
focal_method.full_signature: public Optional<JmxCredentials> getJmxCredentialsForCluster(Optional<Cluster> cluster)
focal_method.identifier: getJmxCredentialsForCluster
focal_method.invocations: orElse flatMap orElse map containsKey get containsKey toSymbolicName get toSymbolicName ofNullable
focal_method.modifiers: public
focal_method.parameters: (Optional<Cluster> cluster)
focal_method.return: Optional<JmxCredentials>
focal_method.signature: Optional<JmxCredentials> getJmxCredentialsForCluster(Optional<Cluster> cluster)