Search in sources :

Example 1 with KubernetesMockServer

use of io.fabric8.kubernetes.client.server.mock.KubernetesMockServer in project fabric8 by fabric8io.

the class KubernetesConfigAdminBridgeTest method testOr.

@Test
public void testOr() {
    System.setProperty("fabric8.pid.filters", "appName=A;B");
    KubernetesMockServer plainServer = new KubernetesMockServer(false);
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A,B)&watch=true").andReturnChunked(200).always();
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A,B)").andReturn(200, cmEmptyList).once();
    KubernetesConfigAdminBridge kcab = new KubernetesConfigAdminBridge();
    kcab.bindConfigAdmin(caService);
    kcab.bindKubernetesClient(plainServer.createClient());
    kcab.activate();
}
Also used : KubernetesMockServer(io.fabric8.kubernetes.client.server.mock.KubernetesMockServer) Test(org.junit.Test)

Example 2 with KubernetesMockServer

use of io.fabric8.kubernetes.client.server.mock.KubernetesMockServer in project flink by apache.

the class MixedKubernetesServer method before.

public void before() {
    final HashMap<ServerRequest, Queue<ServerResponse>> response = new HashMap<>();
    mock = crudMode ? new KubernetesMockServer(new Context(), mockWebServer, response, new MixedDispatcher(response), true) : new KubernetesMockServer(mockWebServer, response, https);
    mock.init();
    client = mock.createClient();
}
Also used : Context(io.fabric8.mockwebserver.Context) HashMap(java.util.HashMap) ServerRequest(io.fabric8.mockwebserver.ServerRequest) Queue(java.util.Queue) KubernetesMockServer(io.fabric8.kubernetes.client.server.mock.KubernetesMockServer)

Example 3 with KubernetesMockServer

use of io.fabric8.kubernetes.client.server.mock.KubernetesMockServer in project fabric8 by fabric8io.

the class KubernetesConfigAdminBridgeTest method testAndOr.

@Test
public void testAndOr() {
    System.setProperty("fabric8.pid.filters", "appName=A;B,database.name=my.oracle.datasource");
    KubernetesMockServer plainServer = new KubernetesMockServer(false);
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A,B),database.name%20in%20(my.oracle.datasource)&watch=true").andReturnChunked(200).always();
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A,B),database.name%20in%20(my.oracle.datasource)").andReturn(200, cmEmptyList).once();
    KubernetesConfigAdminBridge kcab = new KubernetesConfigAdminBridge();
    kcab.bindConfigAdmin(caService);
    kcab.bindKubernetesClient(plainServer.createClient());
    kcab.activate();
}
Also used : KubernetesMockServer(io.fabric8.kubernetes.client.server.mock.KubernetesMockServer) Test(org.junit.Test)

Example 4 with KubernetesMockServer

use of io.fabric8.kubernetes.client.server.mock.KubernetesMockServer in project fabric8 by fabric8io.

the class KubernetesConfigAdminBridgeTest method testAand.

@Test
public void testAand() {
    System.setProperty("fabric8.pid.filters", "appName=A,database.name=my.oracle.datasource");
    KubernetesMockServer plainServer = new KubernetesMockServer(false);
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A),database.name%20in%20(my.oracle.datasource)&watch=true").andReturnChunked(200).always();
    plainServer.expect().get().withPath("/api/v1/namespaces/test/configmaps?labelSelector=karaf.pid,appName%20in%20(A),database.name%20in%20(my.oracle.datasource)").andReturn(200, cmEmptyList).once();
    KubernetesConfigAdminBridge kcab = new KubernetesConfigAdminBridge();
    kcab.bindConfigAdmin(caService);
    kcab.bindKubernetesClient(plainServer.createClient());
    kcab.activate();
}
Also used : KubernetesMockServer(io.fabric8.kubernetes.client.server.mock.KubernetesMockServer) Test(org.junit.Test)

Aggregations

KubernetesMockServer (io.fabric8.kubernetes.client.server.mock.KubernetesMockServer)4 Test (org.junit.Test)3 Context (io.fabric8.mockwebserver.Context)1 ServerRequest (io.fabric8.mockwebserver.ServerRequest)1 HashMap (java.util.HashMap)1 Queue (java.util.Queue)1