Search in sources :

Example 1 with Properties

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

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(com.yahoo.pulsar.client.admin.PulsarAdmin) PropertyAdmin(com.yahoo.pulsar.common.policies.data.PropertyAdmin) Properties(com.yahoo.pulsar.client.admin.Properties) Test(org.testng.annotations.Test)

Aggregations

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