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");
}
Aggregations