JmxTrans extends AbstractModel { public ConfigMap generateJmxTransConfigMap(JmxTransSpec spec, int numOfBrokers) throws JsonProcessingException { Map<String, String> data = new HashMap<>(1); String jmxConfig = generateJMXConfig(spec, numOfBrokers); data.put(JMXTRANS_CONFIGMAP_KEY, jmxConfig); configMapName = jmxTransConfigName(clusterName); return createConfigMap(jmxTransConfigName(clusterName), data); } protected  JmxTrans(HasMetadata resource); static JmxTrans fromCrd(Kafka kafkaAssembly, KafkaVersion.Lookup versions); Deployment generateDeployment(ImagePullPolicy imagePullPolicy, List<LocalObjectReference> imagePullSecrets); ConfigMap generateJmxTransConfigMap(JmxTransSpec spec, int numOfBrokers); List<Volume> getVolumes(); static String jmxTransName(String kafkaCluster); static String containerServiceAccountName(String kafkaCluster); static String jmxTransConfigName(String cluster); boolean isDeployed(); boolean isJmxAuthenticated(); static final Probe READINESS_PROBE_OPTIONS; static final String JMXTRANS_CONFIGMAP_KEY; static final String JMXTRANS_VOLUME_NAME; static final String CONFIG_MAP_ANNOTATION_KEY; static final String JMX_FILE_PATH; }
@Test public void testConfigMapOnScaleUp() throws JsonProcessingException { ConfigMap originalCM = jmxTrans.generateJmxTransConfigMap(jmxTransSpec, 1); ConfigMap scaledCM = jmxTrans.generateJmxTransConfigMap(jmxTransSpec, 2); assertThat(originalCM.getData().get(JmxTrans.JMXTRANS_CONFIGMAP_KEY).length() < scaledCM.getData().get(JmxTrans.JMXTRANS_CONFIGMAP_KEY).length(), is(true)); }
@Test public void testConfigMapOnScaleDown() throws JsonProcessingException { ConfigMap originalCM = jmxTrans.generateJmxTransConfigMap(jmxTransSpec, 2); ConfigMap scaledCM = jmxTrans.generateJmxTransConfigMap(jmxTransSpec, 1); assertThat(originalCM.getData().get(JmxTrans.JMXTRANS_CONFIGMAP_KEY).length() > scaledCM.getData().get(JmxTrans.JMXTRANS_CONFIGMAP_KEY).length(), is(true)); }