Search in sources :

Example 1 with PlacementBuilder

use of io.fabric8.openclustermanagement.api.model.cluster.v1alpha1.PlacementBuilder in project kubernetes-client by fabric8io.

the class PlacementTest method builderShouldCreateObject.

@Test
void builderShouldCreateObject() {
    // Given
    PlacementBuilder placementBuilder = new PlacementBuilder().withNewMetadata().withName("placement1").withNamespace("ns1").endMetadata().withNewSpec().addNewPredicate().withNewRequiredClusterSelector().withNewLabelSelector().addToMatchLabels("vendor", "OpenShift").endLabelSelector().endRequiredClusterSelector().endPredicate().endSpec();
    // When
    Placement placement = placementBuilder.build();
    // Then
    assertNotNull(placement);
    assertEquals("placement1", placement.getMetadata().getName());
    assertEquals(1, placement.getSpec().getPredicates().size());
    assertEquals("OpenShift", placement.getSpec().getPredicates().get(0).getRequiredClusterSelector().getLabelSelector().getMatchLabels().get("vendor"));
}
Also used : PlacementBuilder(io.fabric8.openclustermanagement.api.model.cluster.v1alpha1.PlacementBuilder) Placement(io.fabric8.openclustermanagement.api.model.cluster.v1alpha1.Placement) Test(org.junit.jupiter.api.Test)

Aggregations

Placement (io.fabric8.openclustermanagement.api.model.cluster.v1alpha1.Placement)1 PlacementBuilder (io.fabric8.openclustermanagement.api.model.cluster.v1alpha1.PlacementBuilder)1 Test (org.junit.jupiter.api.Test)1