Search in sources :

Example 1 with BacklogQuotaType

use of org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType in project incubator-pulsar by apache.

the class AdminApiTest method backlogQuotas.

@Test
public void backlogQuotas() throws Exception {
    assertEquals(admin.namespaces().getBacklogQuotaMap("prop-xyz/use/ns1"), Maps.newTreeMap());
    Map<BacklogQuotaType, BacklogQuota> quotaMap = admin.namespaces().getBacklogQuotaMap("prop-xyz/use/ns1");
    assertEquals(quotaMap.size(), 0);
    assertEquals(quotaMap.get(BacklogQuotaType.destination_storage), null);
    admin.namespaces().setBacklogQuota("prop-xyz/use/ns1", new BacklogQuota(1 * 1024 * 1024 * 1024, RetentionPolicy.producer_exception));
    quotaMap = admin.namespaces().getBacklogQuotaMap("prop-xyz/use/ns1");
    assertEquals(quotaMap.size(), 1);
    assertEquals(quotaMap.get(BacklogQuotaType.destination_storage), new BacklogQuota(1 * 1024 * 1024 * 1024, RetentionPolicy.producer_exception));
    admin.namespaces().removeBacklogQuota("prop-xyz/use/ns1");
    quotaMap = admin.namespaces().getBacklogQuotaMap("prop-xyz/use/ns1");
    assertEquals(quotaMap.size(), 0);
    assertEquals(quotaMap.get(BacklogQuotaType.destination_storage), null);
}
Also used : BacklogQuotaType(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType) BacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Aggregations

MockedPulsarServiceBaseTest (org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)1 BacklogQuota (org.apache.pulsar.common.policies.data.BacklogQuota)1 BacklogQuotaType (org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType)1 Test (org.testng.annotations.Test)1