use of io.kubernetes.client.models.V1beta1HTTPIngressPath in project weblogic-kubernetes-operator by oracle.
the class IngressHelperTest method testAddThenRemoveServer.
@Test
public void testAddThenRemoveServer() throws Throwable {
Packet p = new Packet();
p.getComponents().put(ProcessingConstants.DOMAIN_COMPONENT_NAME, Component.createFor(info));
p.put(ProcessingConstants.SERVER_SCAN, info.getScan().getServerConfig(server1Name));
p.put(ProcessingConstants.CLUSTER_SCAN, info.getScan().getClusterConfig(clusterName));
p.put(ProcessingConstants.SERVER_NAME, server1Name);
Fiber f = engine.createFiber();
Step s = IngressHelper.createClusterStep(null);
AtomicReference<Throwable> t = new AtomicReference<>();
f.start(s, p, new CompletionCallback() {
@Override
public void onCompletion(Packet packet) {
// no-op
}
@Override
public void onThrowable(Packet packet, Throwable throwable) {
t.set(throwable);
}
});
f.get(30, TimeUnit.SECONDS);
if (t.get() != null) {
throw t.get();
}
// Now check
CallBuilderFactory factory = new CallBuilderFactory(null);
V1beta1Ingress v1beta1Ingress = factory.create().readIngress(ingressName, namespace);
List<V1beta1HTTPIngressPath> v1beta1HTTPIngressPaths = getPathArray(v1beta1Ingress);
Assert.assertEquals("IngressPaths should have one instance of IngressPath", 1, v1beta1HTTPIngressPaths.size());
V1beta1HTTPIngressPath v1beta1HTTPIngressPath = v1beta1HTTPIngressPaths.get(0);
Assert.assertEquals("/", v1beta1HTTPIngressPath.getPath());
V1beta1IngressBackend v1beta1IngressBackend = v1beta1HTTPIngressPath.getBackend();
Assert.assertNotNull("IngressBackend Object should not be null", v1beta1IngressBackend);
Assert.assertEquals("Service name should be " + clusterServiceName, clusterServiceName, v1beta1IngressBackend.getServiceName());
Assert.assertEquals("Service port should be " + server1Port, server1Port, v1beta1IngressBackend.getServicePort().getIntValue());
}
use of io.kubernetes.client.models.V1beta1HTTPIngressPath in project weblogic-kubernetes-operator by oracle.
the class IngressHelperTest method getPathArray.
private List<V1beta1HTTPIngressPath> getPathArray(V1beta1Ingress v1beta1Ingress) {
Assert.assertNotNull("Ingress Object should not be null", v1beta1Ingress);
V1beta1IngressSpec v1beta1IngressSpec = v1beta1Ingress.getSpec();
Assert.assertNotNull("Spec Object should not be null", v1beta1IngressSpec);
List<V1beta1IngressRule> v1beta1IngressRules = v1beta1IngressSpec.getRules();
Assert.assertNotNull("Rules List should not be null", v1beta1IngressRules);
Assert.assertTrue("Rules List should have one instance of IngressRule", v1beta1IngressRules.size() == 1);
V1beta1IngressRule v1beta1IngressRule = v1beta1IngressRules.get(0);
Assert.assertNotNull("IngressRule Object should not be null", v1beta1IngressRule);
V1beta1HTTPIngressRuleValue v1beta1HTTPIngressRuleValue = v1beta1IngressRule.getHttp();
Assert.assertNotNull("IngressRuleValue Object should not be null", v1beta1HTTPIngressRuleValue);
List<V1beta1HTTPIngressPath> v1beta1HTTPIngressPaths = v1beta1HTTPIngressRuleValue.getPaths();
Assert.assertNotNull("IngressPath list should not be null", v1beta1HTTPIngressPaths);
return v1beta1HTTPIngressPaths;
}
Aggregations