Search in sources :

Example 1 with ChannelBuilder

use of io.fabric8.knative.messaging.v1.ChannelBuilder in project kubernetes-client by fabric8io.

the class ChannelTest method builderShouldCreateObject.

@Test
void builderShouldCreateObject() {
    // Given
    ChannelBuilder channelBuilder = new ChannelBuilder().withNewMetadata().addToLabels("vendor", "OpenShift").withName("sample-channel").endMetadata().withNewSpec().withType("HelmRepo").withPathname("https://charts.helm.sh/stable").withNewConfigMapRef().withKind("ConfigMap").withName("test-configmap").endConfigMapRef().endSpec();
    // When
    Channel channel = channelBuilder.build();
    // Then
    assertNotNull(channel);
    assertEquals("sample-channel", channel.getMetadata().getName());
    assertEquals(1, channel.getMetadata().getLabels().size());
    assertEquals("HelmRepo", channel.getSpec().getType());
    assertEquals("https://charts.helm.sh/stable", channel.getSpec().getPathname());
    assertEquals("test-configmap", channel.getSpec().getConfigMapRef().getName());
    assertEquals("ConfigMap", channel.getSpec().getConfigMapRef().getKind());
}
Also used : Channel(io.fabric8.openclustermanagement.api.model.multicloudoperatorschannel.apps.v1.Channel) ChannelBuilder(io.fabric8.openclustermanagement.api.model.multicloudoperatorschannel.apps.v1.ChannelBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with ChannelBuilder

use of io.fabric8.knative.messaging.v1.ChannelBuilder in project yaks by citrusframework.

the class CreateChannelAction method doExecute.

@Override
public void doExecute(TestContext context) {
    Channel channel = new ChannelBuilder().withApiVersion(String.format("%s/%s", KnativeSupport.knativeMessagingGroup(), KnativeSupport.knativeApiVersion())).withNewMetadata().withNamespace(namespace(context)).withName(context.replaceDynamicContentInString(channelName)).withLabels(KnativeSettings.getDefaultLabels()).endMetadata().build();
    getKnativeClient().channels().inNamespace(namespace(context)).createOrReplace(channel);
}
Also used : Channel(io.fabric8.knative.messaging.v1.Channel) ChannelBuilder(io.fabric8.knative.messaging.v1.ChannelBuilder)

Aggregations

Channel (io.fabric8.knative.messaging.v1.Channel)1 ChannelBuilder (io.fabric8.knative.messaging.v1.ChannelBuilder)1 Channel (io.fabric8.openclustermanagement.api.model.multicloudoperatorschannel.apps.v1.Channel)1 ChannelBuilder (io.fabric8.openclustermanagement.api.model.multicloudoperatorschannel.apps.v1.ChannelBuilder)1 Test (org.junit.jupiter.api.Test)1