Search in sources :

Example 1 with KafkaConnectStatusBuilder

use of io.strimzi.api.kafka.model.status.KafkaConnectStatusBuilder in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class DebeziumOperandControllerTest method computeStatus.

@ParameterizedTest
@MethodSource
void computeStatus(String connectorState, List<Condition> connectorConditions, List<Condition> connectConditions, String expectedManagedConnectorState, String expectedReason) {
    ConnectorStatusSpec status = new ConnectorStatusSpec();
    DebeziumOperandSupport.computeStatus(status, new KafkaConnectBuilder().withStatus(new KafkaConnectStatusBuilder().addAllToConditions(connectConditions).build()).build(), new KafkaConnectorBuilder().withStatus(new KafkaConnectorStatusBuilder().addAllToConditions(connectorConditions).addToConnectorStatus("connector", new org.bf2.cos.fleetshard.operator.debezium.model.KafkaConnectorStatusBuilder().withState(connectorState).build()).build()).build());
    assertThat(status.getPhase()).isEqualTo(expectedManagedConnectorState);
    assertThat(status.getConditions()).anySatisfy(condition -> assertThat(condition).hasFieldOrPropertyWithValue("type", "Ready").hasFieldOrPropertyWithValue("status", null == expectedReason ? "True" : "False").hasFieldOrPropertyWithValue("reason", expectedReason));
}
Also used : KafkaConnectBuilder(io.strimzi.api.kafka.model.KafkaConnectBuilder) KafkaConnectorBuilder(io.strimzi.api.kafka.model.KafkaConnectorBuilder) KafkaConnectStatusBuilder(io.strimzi.api.kafka.model.status.KafkaConnectStatusBuilder) ConnectorStatusSpec(org.bf2.cos.fleetshard.api.ConnectorStatusSpec) KafkaConnectorStatusBuilder(io.strimzi.api.kafka.model.status.KafkaConnectorStatusBuilder) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

KafkaConnectBuilder (io.strimzi.api.kafka.model.KafkaConnectBuilder)1 KafkaConnectorBuilder (io.strimzi.api.kafka.model.KafkaConnectorBuilder)1 KafkaConnectStatusBuilder (io.strimzi.api.kafka.model.status.KafkaConnectStatusBuilder)1 KafkaConnectorStatusBuilder (io.strimzi.api.kafka.model.status.KafkaConnectorStatusBuilder)1 ConnectorStatusSpec (org.bf2.cos.fleetshard.api.ConnectorStatusSpec)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1