use of io.strimzi.api.kafka.model.CruiseControlSpecBuilder in project strimzi-kafka-operator by strimzi.
the class CruiseControlTest method testJvmOptions.
@ParallelTest
public void testJvmOptions() {
CruiseControlSpec cruiseControlSpec = new CruiseControlSpecBuilder().withNewJvmOptions().withXms("128m").withXmx("256m").withXx(Map.of("InitiatingHeapOccupancyPercent", "36")).withJavaSystemProperties(new SystemPropertyBuilder().withName("myProperty").withValue("myValue").build(), new SystemPropertyBuilder().withName("myProperty2").withValue("myValue2").build()).endJvmOptions().build();
Kafka resource = createKafka(cruiseControlSpec);
CruiseControl cc = CruiseControl.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS, kafkaStorage);
EnvVar systemProps = cc.getEnvVars().stream().filter(var -> AbstractModel.ENV_VAR_STRIMZI_JAVA_SYSTEM_PROPERTIES.equals(var.getName())).findFirst().orElse(null);
assertThat(systemProps, is(notNullValue()));
assertThat(systemProps.getValue(), containsString("-DmyProperty=myValue"));
assertThat(systemProps.getValue(), containsString("-DmyProperty2=myValue2"));
EnvVar heapOpts = cc.getEnvVars().stream().filter(var -> AbstractModel.ENV_VAR_KAFKA_HEAP_OPTS.equals(var.getName())).findFirst().orElse(null);
assertThat(heapOpts, is(notNullValue()));
assertThat(heapOpts.getValue(), containsString("-Xms128m"));
assertThat(heapOpts.getValue(), containsString("-Xmx256m"));
EnvVar perfOptions = cc.getEnvVars().stream().filter(var -> AbstractModel.ENV_VAR_KAFKA_JVM_PERFORMANCE_OPTS.equals(var.getName())).findFirst().orElse(null);
assertThat(perfOptions, is(notNullValue()));
assertThat(perfOptions.getValue(), containsString("-XX:InitiatingHeapOccupancyPercent=36"));
}
Aggregations