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());
}
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);
}
Aggregations