Search in sources :

Example 1 with JvmOptionsBuilder

use of io.strimzi.api.kafka.model.JvmOptionsBuilder in project strimzi by strimzi.

the class KafkaBridgeClusterTest method testJvmOptions.

@ParallelTest
public void testJvmOptions() {
    KafkaBridge resource = new KafkaBridgeBuilder(this.resource).editSpec().withJvmOptions(new JvmOptionsBuilder().withXms("128m").withXmx("256m").withXx(Collections.singletonMap("InitiatingHeapOccupancyPercent", "36")).withJavaSystemProperties(new SystemPropertyBuilder().withName("myProperty1").withValue("myValue1").build(), new SystemPropertyBuilder().withName("myProperty2").withValue("myValue2").build()).build()).endSpec().build();
    KafkaBridgeCluster kb = KafkaBridgeCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS);
    EnvVar systemProps = kb.getEnvVars().stream().filter(envVar -> AbstractModel.ENV_VAR_STRIMZI_JAVA_SYSTEM_PROPERTIES.equals(envVar.getName())).findFirst().orElse(null);
    assertThat(systemProps, is(notNullValue()));
    assertThat(systemProps.getValue(), containsString("-DmyProperty1=myValue1"));
    assertThat(systemProps.getValue(), containsString("-DmyProperty2=myValue2"));
    EnvVar javaOpts = kb.getEnvVars().stream().filter(envVar -> AbstractModel.ENV_VAR_STRIMZI_JAVA_OPTS.equals(envVar.getName())).findFirst().orElse(null);
    assertThat(javaOpts, is(notNullValue()));
    assertThat(javaOpts.getValue(), containsString("-Xms128m"));
    assertThat(javaOpts.getValue(), containsString("-Xmx256m"));
    assertThat(javaOpts.getValue(), containsString("-XX:InitiatingHeapOccupancyPercent=36"));
}
Also used : SystemPropertyBuilder(io.strimzi.api.kafka.model.SystemPropertyBuilder) KafkaBridge(io.strimzi.api.kafka.model.KafkaBridge) KafkaBridgeBuilder(io.strimzi.api.kafka.model.KafkaBridgeBuilder) JvmOptionsBuilder(io.strimzi.api.kafka.model.JvmOptionsBuilder) ContainerEnvVar(io.strimzi.api.kafka.model.ContainerEnvVar) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 2 with JvmOptionsBuilder

use of io.strimzi.api.kafka.model.JvmOptionsBuilder in project strimzi-kafka-operator by strimzi.

the class KafkaBridgeClusterTest method testJvmOptions.

@ParallelTest
public void testJvmOptions() {
    KafkaBridge resource = new KafkaBridgeBuilder(this.resource).editSpec().withJvmOptions(new JvmOptionsBuilder().withXms("128m").withXmx("256m").withXx(Collections.singletonMap("InitiatingHeapOccupancyPercent", "36")).withJavaSystemProperties(new SystemPropertyBuilder().withName("myProperty1").withValue("myValue1").build(), new SystemPropertyBuilder().withName("myProperty2").withValue("myValue2").build()).build()).endSpec().build();
    KafkaBridgeCluster kb = KafkaBridgeCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS);
    EnvVar systemProps = kb.getEnvVars().stream().filter(envVar -> AbstractModel.ENV_VAR_STRIMZI_JAVA_SYSTEM_PROPERTIES.equals(envVar.getName())).findFirst().orElse(null);
    assertThat(systemProps, is(notNullValue()));
    assertThat(systemProps.getValue(), containsString("-DmyProperty1=myValue1"));
    assertThat(systemProps.getValue(), containsString("-DmyProperty2=myValue2"));
    EnvVar javaOpts = kb.getEnvVars().stream().filter(envVar -> AbstractModel.ENV_VAR_STRIMZI_JAVA_OPTS.equals(envVar.getName())).findFirst().orElse(null);
    assertThat(javaOpts, is(notNullValue()));
    assertThat(javaOpts.getValue(), containsString("-Xms128m"));
    assertThat(javaOpts.getValue(), containsString("-Xmx256m"));
    assertThat(javaOpts.getValue(), containsString("-XX:InitiatingHeapOccupancyPercent=36"));
}
Also used : SystemPropertyBuilder(io.strimzi.api.kafka.model.SystemPropertyBuilder) KafkaBridge(io.strimzi.api.kafka.model.KafkaBridge) KafkaBridgeBuilder(io.strimzi.api.kafka.model.KafkaBridgeBuilder) JvmOptionsBuilder(io.strimzi.api.kafka.model.JvmOptionsBuilder) ContainerEnvVar(io.strimzi.api.kafka.model.ContainerEnvVar) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

EnvVar (io.fabric8.kubernetes.api.model.EnvVar)2 ContainerEnvVar (io.strimzi.api.kafka.model.ContainerEnvVar)2 JvmOptionsBuilder (io.strimzi.api.kafka.model.JvmOptionsBuilder)2 KafkaBridge (io.strimzi.api.kafka.model.KafkaBridge)2 KafkaBridgeBuilder (io.strimzi.api.kafka.model.KafkaBridgeBuilder)2 SystemPropertyBuilder (io.strimzi.api.kafka.model.SystemPropertyBuilder)2 ParallelTest (io.strimzi.test.annotations.ParallelTest)2