Search in sources :

Example 1 with OffloadedReadPriority

use of org.apache.pulsar.common.policies.data.OffloadedReadPriority in project pulsar by apache.

the class AdminApiOffloadTest method testOffloadPolicies.

@Test
public void testOffloadPolicies() throws Exception {
    String namespaceName = "prop-xyz/ns1";
    String driver = "aws-s3";
    String region = "test-region";
    String bucket = "test-bucket";
    String endpoint = "test-endpoint";
    long offloadThresholdInBytes = 0;
    long offloadDeletionLagInMillis = 100L;
    OffloadedReadPriority priority = OffloadedReadPriority.TIERED_STORAGE_FIRST;
    OffloadPolicies offload1 = OffloadPoliciesImpl.create(driver, region, bucket, endpoint, null, null, null, null, 100, 100, offloadThresholdInBytes, offloadDeletionLagInMillis, priority);
    admin.namespaces().setOffloadPolicies(namespaceName, offload1);
    OffloadPolicies offload2 = admin.namespaces().getOffloadPolicies(namespaceName);
    assertEquals(offload1, offload2);
    admin.namespaces().removeOffloadPolicies(namespaceName);
    OffloadPolicies offload3 = admin.namespaces().getOffloadPolicies(namespaceName);
    assertNull(offload3);
}
Also used : OffloadPolicies(org.apache.pulsar.common.policies.data.OffloadPolicies) OffloadedReadPriority(org.apache.pulsar.common.policies.data.OffloadedReadPriority) Test(org.testng.annotations.Test) MockedPulsarServiceBaseTest(org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)

Aggregations

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