Search in sources :

Example 1 with JvmOptions

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

the class AbstractModelTest method testJvmPerformanceOptions.

@ParallelTest
public void testJvmPerformanceOptions() {
    JvmOptions opts = TestUtils.fromJson("{}", JvmOptions.class);
    assertThat(getPerformanceOptions(opts), is(nullValue()));
    opts = TestUtils.fromJson("{" + "    \"-XX\":" + "            {\"key1\": \"value1\"," + "            \"key2\": \"true\"," + "            \"key3\": false," + "            \"key4\": 10}" + "}", JvmOptions.class);
    assertThat(getPerformanceOptions(opts), is("-XX:key1=value1 -XX:+key2 -XX:-key3 -XX:key4=10"));
}
Also used : JvmOptions(io.strimzi.api.kafka.model.JvmOptions) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Example 2 with JvmOptions

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

the class AbstractModelTest method jvmOptions.

private static JvmOptions jvmOptions(String xmx, String xms) {
    JvmOptions result = new JvmOptions();
    result.setXms(xms);
    result.setXmx(xmx);
    return result;
}
Also used : JvmOptions(io.strimzi.api.kafka.model.JvmOptions)

Example 3 with JvmOptions

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

the class AbstractModelTest method getStringStringMap.

private Map<String, String> getStringStringMap(String xmx, String xms, double dynamicFraction, long dynamicMax, ResourceRequirements resources) {
    Kafka resource = new KafkaBuilder().withNewMetadata().endMetadata().build();
    AbstractModel am = new Model(resource);
    am.setLabels(Labels.forStrimziCluster("foo"));
    am.setJvmOptions(jvmOptions(xmx, xms));
    am.setResources(resources);
    List<EnvVar> envVars = new ArrayList<>(1);
    am.heapOptions(envVars, dynamicFraction, dynamicMax);
    return envVars.stream().collect(Collectors.toMap(e -> e.getName(), e -> e.getValue()));
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) CoreMatchers.is(org.hamcrest.CoreMatchers.is) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) Container(io.fabric8.kubernetes.api.model.Container) Storage(io.strimzi.api.kafka.model.storage.Storage) ParallelSuite(io.strimzi.test.annotations.ParallelSuite) ResourceRequirementsBuilder(io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder) EphemeralStorageBuilder(io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder) OwnerReference(io.fabric8.kubernetes.api.model.OwnerReference) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) ArrayList(java.util.ArrayList) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) ResourceRequirements(io.fabric8.kubernetes.api.model.ResourceRequirements) KafkaVersionTestUtils(io.strimzi.operator.cluster.KafkaVersionTestUtils) Map(java.util.Map) TestUtils(io.strimzi.test.TestUtils) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) JvmOptions(io.strimzi.api.kafka.model.JvmOptions) JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Collectors(java.util.stream.Collectors) Reconciliation(io.strimzi.operator.common.Reconciliation) List(java.util.List) Labels(io.strimzi.operator.common.model.Labels) KafkaListenerType(io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType) Assertions(org.junit.jupiter.api.Assertions) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Kafka(io.strimzi.api.kafka.model.Kafka) Kafka(io.strimzi.api.kafka.model.Kafka) ArrayList(java.util.ArrayList) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder)

Example 4 with JvmOptions

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

the class AbstractModelTest method getStringStringMap.

private Map<String, String> getStringStringMap(String xmx, String xms, double dynamicFraction, long dynamicMax, ResourceRequirements resources) {
    Kafka resource = new KafkaBuilder().withNewMetadata().endMetadata().build();
    AbstractModel am = new Model(resource);
    am.setLabels(Labels.forStrimziCluster("foo"));
    am.setJvmOptions(jvmOptions(xmx, xms));
    am.setResources(resources);
    List<EnvVar> envVars = new ArrayList<>(1);
    am.heapOptions(envVars, dynamicFraction, dynamicMax);
    return envVars.stream().collect(Collectors.toMap(e -> e.getName(), e -> e.getValue()));
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) CoreMatchers.is(org.hamcrest.CoreMatchers.is) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) Container(io.fabric8.kubernetes.api.model.Container) Storage(io.strimzi.api.kafka.model.storage.Storage) ParallelSuite(io.strimzi.test.annotations.ParallelSuite) ResourceRequirementsBuilder(io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder) EphemeralStorageBuilder(io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder) OwnerReference(io.fabric8.kubernetes.api.model.OwnerReference) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) ArrayList(java.util.ArrayList) PersistentClaimStorageBuilder(io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder) ResourceRequirements(io.fabric8.kubernetes.api.model.ResourceRequirements) KafkaVersionTestUtils(io.strimzi.operator.cluster.KafkaVersionTestUtils) Map(java.util.Map) TestUtils(io.strimzi.test.TestUtils) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) JvmOptions(io.strimzi.api.kafka.model.JvmOptions) JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) ParallelTest(io.strimzi.test.annotations.ParallelTest) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Collectors(java.util.stream.Collectors) Reconciliation(io.strimzi.operator.common.Reconciliation) List(java.util.List) Labels(io.strimzi.operator.common.model.Labels) KafkaListenerType(io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType) Assertions(org.junit.jupiter.api.Assertions) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Kafka(io.strimzi.api.kafka.model.Kafka) Kafka(io.strimzi.api.kafka.model.Kafka) ArrayList(java.util.ArrayList) EnvVar(io.fabric8.kubernetes.api.model.EnvVar) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder)

Example 5 with JvmOptions

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

the class AbstractModelTest method testJvmPerformanceOptions.

@ParallelTest
public void testJvmPerformanceOptions() {
    JvmOptions opts = TestUtils.fromJson("{}", JvmOptions.class);
    assertThat(getPerformanceOptions(opts), is(nullValue()));
    opts = TestUtils.fromJson("{" + "    \"-XX\":" + "            {\"key1\": \"value1\"," + "            \"key2\": \"true\"," + "            \"key3\": false," + "            \"key4\": 10}" + "}", JvmOptions.class);
    assertThat(getPerformanceOptions(opts), is("-XX:key1=value1 -XX:+key2 -XX:-key3 -XX:key4=10"));
}
Also used : JvmOptions(io.strimzi.api.kafka.model.JvmOptions) ParallelTest(io.strimzi.test.annotations.ParallelTest)

Aggregations

JvmOptions (io.strimzi.api.kafka.model.JvmOptions)6 ParallelTest (io.strimzi.test.annotations.ParallelTest)4 Container (io.fabric8.kubernetes.api.model.Container)2 EnvVar (io.fabric8.kubernetes.api.model.EnvVar)2 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)2 OwnerReference (io.fabric8.kubernetes.api.model.OwnerReference)2 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)2 Quantity (io.fabric8.kubernetes.api.model.Quantity)2 ResourceRequirements (io.fabric8.kubernetes.api.model.ResourceRequirements)2 ResourceRequirementsBuilder (io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder)2 Kafka (io.strimzi.api.kafka.model.Kafka)2 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)2 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)2 KafkaListenerType (io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType)2 EphemeralStorageBuilder (io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder)2 JbodStorageBuilder (io.strimzi.api.kafka.model.storage.JbodStorageBuilder)2 PersistentClaimStorageBuilder (io.strimzi.api.kafka.model.storage.PersistentClaimStorageBuilder)2 Storage (io.strimzi.api.kafka.model.storage.Storage)2 KafkaVersionTestUtils (io.strimzi.operator.cluster.KafkaVersionTestUtils)2 Reconciliation (io.strimzi.operator.common.Reconciliation)2