Search in sources :

Example 1 with ManagedConnectorOperatorBuilder

use of org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class ManagedConnectorOperatorSteps method a_managedConnectorOperator.

@Given("^a ManagedConnectorOperator with:$")
public void a_managedConnectorOperator(Map<String, String> entry) {
    final String operatorId = entry.getOrDefault("operator.id", uid());
    final String operatorType = entry.get("operator.type");
    final String operatorVersion = entry.get("operator.version");
    final String operatorRuntime = entry.get("operator.runtime");
    var connector = new ManagedConnectorOperatorBuilder().withMetadata(new ObjectMetaBuilder().withName(operatorId).addToLabels(Resources.LABEL_OPERATOR_TYPE, operatorType).addToLabels(Resources.LABEL_OPERATOR_VERSION, operatorVersion).build()).withSpec(new ManagedConnectorOperatorSpecBuilder().withVersion(operatorVersion).withType(operatorType).withRuntime(operatorRuntime).build()).build();
    ctx.managedConnectorOperator(connector);
}
Also used : ManagedConnectorOperatorBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) ManagedConnectorOperatorSpecBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorSpecBuilder) Given(io.cucumber.java.en.Given)

Example 2 with ManagedConnectorOperatorBuilder

use of org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class ClusterStatusUpdaterWithOperatorTest method statusIsUpdated.

@Test
void statusIsUpdated() {
    final String statusUrl = "/api/connector_mgmt/v1/agent/kafka_connector_clusters/" + config.cluster().id() + "/status";
    final String operatorId = uid();
    kubernetesClient.resources(ManagedConnectorOperator.class).inNamespace(ns).create(new ManagedConnectorOperatorBuilder().withNewMetadata().withName(operatorId).endMetadata().withSpec(new ManagedConnectorOperatorSpecBuilder().withType("operator-type").withVersion("999").withRuntime("operator-runtime").build()).build());
    RestAssured.given().contentType(MediaType.TEXT_PLAIN).post("/test/provisioner/all");
    untilAsserted(() -> {
        server.verify(putRequestedFor(urlEqualTo(statusUrl)).withHeader(ContentTypeHeader.KEY, equalTo(APPLICATION_JSON)).withRequestBody(jp("$.phase", "ready")).withRequestBody(jp("$.operators.size()", "1")).withRequestBody(jp("$.operators[0].namespace", ns)).withRequestBody(jp("$.operators[0].status", "ready")).withRequestBody(jp("$.operators[0].operator.id", operatorId)).withRequestBody(jp("$.operators[0].operator.type", "operator-type")).withRequestBody(jp("$.operators[0].operator.version", "999")));
    });
}
Also used : ManagedConnectorOperatorBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder) ManagedConnectorOperatorSpecBuilder(org.bf2.cos.fleetshard.api.ManagedConnectorOperatorSpecBuilder) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

ManagedConnectorOperatorBuilder (org.bf2.cos.fleetshard.api.ManagedConnectorOperatorBuilder)2 ManagedConnectorOperatorSpecBuilder (org.bf2.cos.fleetshard.api.ManagedConnectorOperatorSpecBuilder)2 Given (io.cucumber.java.en.Given)1 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 Test (org.junit.jupiter.api.Test)1