Skip to content

Commit

Permalink
chore(knative): Add cluster type setting for Knative actions
Browse files Browse the repository at this point in the history
  • Loading branch information
christophd committed Nov 7, 2024
1 parent ca50d7e commit fc443f3
Show file tree
Hide file tree
Showing 30 changed files with 195 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public class KnativeSettings {

private static final String DEFAULT_LABELS_PROPERTY = KNATIVE_PROPERTY_PREFIX + "default.labels";
private static final String DEFAULT_LABELS_ENV = KNATIVE_ENV_PREFIX + "DEFAULT_LABELS";
private static final String DEFAULT_LABELS_DEFAULT = "app=citrus";

private KnativeSettings() {
// prevent instantiation of utility class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.CreateBrokerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "create-broker")
Expand All @@ -47,6 +48,12 @@ public CreateBroker actor(TestActor actor) {
return this;
}

@Override
public CreateBroker clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateBroker client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.messaging.CreateChannelAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "create-channel")
Expand All @@ -47,6 +48,12 @@ public CreateChannel actor(TestActor actor) {
return this;
}

@Override
public CreateChannel clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateChannel client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.messaging.CreateSubscriptionAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "create-subscription")
Expand Down Expand Up @@ -57,6 +58,12 @@ public CreateSubscription actor(TestActor actor) {
return this;
}

@Override
public CreateSubscription clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateSubscription client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.CreateTriggerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "create-trigger")
Expand Down Expand Up @@ -74,6 +75,12 @@ public CreateTrigger actor(TestActor actor) {
return this;
}

@Override
public CreateTrigger clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateTrigger client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.DeleteBrokerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "delete-broker")
Expand All @@ -47,6 +48,12 @@ public DeleteBroker actor(TestActor actor) {
return this;
}

@Override
public DeleteBroker clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public DeleteBroker client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.DeleteKnativeResourceAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "delete-channel")
Expand All @@ -47,6 +48,12 @@ public DeleteChannel actor(TestActor actor) {
return this;
}

@Override
public DeleteChannel clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public DeleteChannel client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.DeleteKnativeResourceAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "delete-resource")
Expand Down Expand Up @@ -57,6 +58,12 @@ public DeleteResource actor(TestActor actor) {
return this;
}

@Override
public DeleteResource clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public DeleteResource client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.DeleteKnativeResourceAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "delete-subscription")
Expand All @@ -47,6 +48,12 @@ public DeleteSubscription actor(TestActor actor) {
return this;
}

@Override
public DeleteSubscription clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public DeleteSubscription client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.DeleteTriggerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "delete-trigger")
Expand All @@ -47,6 +48,12 @@ public DeleteTrigger actor(TestActor actor) {
return this;
}

@Override
public DeleteTrigger clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public DeleteTrigger client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.KnativeAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;
import org.citrusframework.spi.ReferenceResolverAware;

Expand All @@ -42,6 +43,8 @@ public class Knative implements TestActionBuilder<KnativeAction>, ReferenceResol
private String knativeClient;
private String namespace;

private ClusterType clusterType;

private ReferenceResolver referenceResolver;

@XmlElement
Expand All @@ -62,6 +65,12 @@ public Knative setNamespace(String namespace) {
return this;
}

@XmlAttribute(name = "cluster-type")
public Knative setClusterType(String clusterType) {
this.clusterType = ClusterType.valueOf(clusterType);
return this;
}

@XmlAttribute(name = "kubernetes-client")
public Knative setKubernetesClient(String client) {
this.k8sClient = client;
Expand Down Expand Up @@ -151,6 +160,10 @@ public KnativeAction build() {
builder.description(description);
builder.inNamespace(namespace);

if (clusterType != null) {
builder.clusterType(clusterType);
}

if (referenceResolver != null) {
if (k8sClient != null) {
builder.client(referenceResolver.resolve(k8sClient, KubernetesClient.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.ReceiveEventAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;
import org.citrusframework.spi.ReferenceResolverAware;

Expand Down Expand Up @@ -73,6 +74,12 @@ public ReceiveEvent actor(TestActor actor) {
return this;
}

@Override
public ReceiveEvent clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public ReceiveEvent client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.SendEventAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;
import org.citrusframework.spi.ReferenceResolverAware;

Expand Down Expand Up @@ -77,6 +78,12 @@ public SendEvent actor(TestActor actor) {
return this;
}

@Override
public SendEvent clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public SendEvent client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.VerifyBrokerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

@XmlRootElement(name = "verify-broker")
Expand All @@ -47,6 +48,12 @@ public VerifyBroker actor(TestActor actor) {
return this;
}

@Override
public VerifyBroker clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public VerifyBroker client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.CreateBrokerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

public class CreateBroker extends AbstractKnativeAction.Builder<CreateBrokerAction, CreateBroker> {
Expand All @@ -43,6 +44,12 @@ public CreateBroker actor(TestActor actor) {
return this;
}

@Override
public CreateBroker clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateBroker client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.messaging.CreateChannelAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

public class CreateChannel extends AbstractKnativeAction.Builder<CreateChannelAction, CreateChannel> {
Expand All @@ -43,6 +44,12 @@ public CreateChannel actor(TestActor actor) {
return this;
}

@Override
public CreateChannel clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateChannel client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.messaging.CreateSubscriptionAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

public class CreateSubscription extends AbstractKnativeAction.Builder<CreateSubscriptionAction, CreateSubscription> {
Expand Down Expand Up @@ -51,6 +52,12 @@ public CreateSubscription actor(TestActor actor) {
return this;
}

@Override
public CreateSubscription clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateSubscription client(KubernetesClient client) {
delegate.client(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.citrusframework.TestActor;
import org.citrusframework.knative.actions.AbstractKnativeAction;
import org.citrusframework.knative.actions.eventing.CreateTriggerAction;
import org.citrusframework.kubernetes.ClusterType;
import org.citrusframework.spi.ReferenceResolver;

public class CreateTrigger extends AbstractKnativeAction.Builder<CreateTriggerAction, CreateTrigger> {
Expand Down Expand Up @@ -62,6 +63,12 @@ public CreateTrigger actor(TestActor actor) {
return this;
}

@Override
public CreateTrigger clusterType(ClusterType clusterType) {
delegate.clusterType(clusterType);
return this;
}

@Override
public CreateTrigger client(KubernetesClient client) {
delegate.client(client);
Expand Down
Loading

0 comments on commit fc443f3

Please sign in to comment.