Search in sources :

Example 1 with Properties

use of org.apache.pulsar.client.admin.Properties in project incubator-pulsar by apache.

the class PulsarAdminToolTest method properties.

@Test
void properties() throws Exception {
    PulsarAdmin admin = Mockito.mock(PulsarAdmin.class);
    Properties mockProperties = mock(Properties.class);
    when(admin.properties()).thenReturn(mockProperties);
    CmdProperties properties = new CmdProperties(admin);
    properties.run(split("list"));
    verify(mockProperties).getProperties();
    PropertyAdmin propertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("use"));
    properties.run(split("create property --admin-roles role1,role2 --allowed-clusters use"));
    verify(mockProperties).createProperty("property", propertyAdmin);
    propertyAdmin = new PropertyAdmin(Lists.newArrayList("role1", "role2"), Sets.newHashSet("usw"));
    properties.run(split("update property --admin-roles role1,role2 --allowed-clusters usw"));
    verify(mockProperties).updateProperty("property", propertyAdmin);
    properties.run(split("get property"));
    verify(mockProperties).getPropertyAdmin("property");
    properties.run(split("delete property"));
    verify(mockProperties).deleteProperty("property");
}
Also used : PulsarAdmin(org.apache.pulsar.client.admin.PulsarAdmin) PropertyAdmin(org.apache.pulsar.common.policies.data.PropertyAdmin) Properties(org.apache.pulsar.client.admin.Properties) Test(org.testng.annotations.Test)

Aggregations

Properties (org.apache.pulsar.client.admin.Properties)1 PulsarAdmin (org.apache.pulsar.client.admin.PulsarAdmin)1 PropertyAdmin (org.apache.pulsar.common.policies.data.PropertyAdmin)1 Test (org.testng.annotations.Test)1