Search in sources :

Example 1 with Clusters

use of com.yahoo.pulsar.client.admin.Clusters in project pulsar by yahoo.

the class PulsarAdminToolTest method clusters.

@Test
void clusters() throws Exception {
    PulsarAdmin admin = Mockito.mock(PulsarAdmin.class);
    Clusters mockClusters = mock(Clusters.class);
    when(admin.clusters()).thenReturn(mockClusters);
    CmdClusters clusters = new CmdClusters(admin);
    clusters.run(split("list"));
    verify(mockClusters).getClusters();
    clusters.run(split("get use"));
    verify(mockClusters).getCluster("use");
    clusters.run(split("create use --url http://my-service.url:8080"));
    verify(mockClusters).createCluster("use", new ClusterData("http://my-service.url:8080", null));
    clusters.run(split("update use --url http://my-service.url:8080"));
    verify(mockClusters).updateCluster("use", new ClusterData("http://my-service.url:8080", null));
    clusters.run(split("delete use"));
    verify(mockClusters).deleteCluster("use");
    // Re-create CmdClusters to avoid a issue.
    // See https://github.com/cbeust/jcommander/issues/271
    clusters = new CmdClusters(admin);
    clusters.run(split("create my-cluster --url http://my-service.url:8080 --url-secure https://my-service.url:4443"));
    verify(mockClusters).createCluster("my-cluster", new ClusterData("http://my-service.url:8080", "https://my-service.url:4443"));
    clusters.run(split("update my-cluster --url http://my-service.url:8080 --url-secure https://my-service.url:4443"));
    verify(mockClusters).updateCluster("my-cluster", new ClusterData("http://my-service.url:8080", "https://my-service.url:4443"));
    clusters.run(split("delete my-cluster"));
    verify(mockClusters).deleteCluster("my-cluster");
}
Also used : ClusterData(com.yahoo.pulsar.common.policies.data.ClusterData) PulsarAdmin(com.yahoo.pulsar.client.admin.PulsarAdmin) Clusters(com.yahoo.pulsar.client.admin.Clusters) Test(org.testng.annotations.Test)

Aggregations

Clusters (com.yahoo.pulsar.client.admin.Clusters)1 PulsarAdmin (com.yahoo.pulsar.client.admin.PulsarAdmin)1 ClusterData (com.yahoo.pulsar.common.policies.data.ClusterData)1 Test (org.testng.annotations.Test)1