use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class ResourceQuotasImpl method resetNamespaceBundleResourceQuota.
public void resetNamespaceBundleResourceQuota(String namespace, String bundle) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(quotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)).delete();
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespaceBundleTest method testIncludes.
@Test
public void testIncludes() throws Exception {
DestinationName dn = DestinationName.get("persistent://pulsar/use/ns1/topic-1");
Long hashKey = factory.getLongHashCode(dn.toString());
Long upper = Math.max(hashKey + 1, NamespaceBundles.FULL_UPPER_BOUND);
BoundType upperType = upper.equals(NamespaceBundles.FULL_UPPER_BOUND) ? BoundType.CLOSED : BoundType.OPEN;
NamespaceBundle bundle = factory.getBundle(dn.getNamespaceObject(), Range.range(hashKey / 2, BoundType.CLOSED, upper, upperType));
assertTrue(bundle.includes(dn));
bundle = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(upper, BoundType.CLOSED, NamespaceBundles.FULL_UPPER_BOUND, BoundType.CLOSED));
assertTrue(!bundle.includes(dn));
NamespaceBundle otherBundle = factory.getBundle(new NamespaceName("pulsar/use/ns2"), Range.range(0l, BoundType.CLOSED, 0x40000000L, BoundType.OPEN));
assertTrue(!otherBundle.includes(dn));
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespaceBundleTest method testEquals.
@Test
public void testEquals() throws Exception {
NamespaceBundle bundle = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(0l, BoundType.CLOSED, 0x40000000L, BoundType.OPEN));
NamespaceBundle bundle2 = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(0x20000000l, BoundType.CLOSED, 0x40000000L, BoundType.OPEN));
assertTrue(!bundle.equals(bundle2));
NamespaceBundle bundle0 = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(0l, BoundType.CLOSED, 0x40000000L, BoundType.OPEN));
assertTrue(bundle0.equals(bundle));
NamespaceBundle otherBundle = factory.getBundle(new NamespaceName("pulsar/use/ns2"), Range.range(0l, BoundType.CLOSED, 0x40000000L, BoundType.OPEN));
assertTrue(!otherBundle.equals(bundle));
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespaceBundleTest method testGetBundle.
@Test
public void testGetBundle() throws Exception {
NamespaceBundle bundle = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(0L, BoundType.CLOSED, 0xffffffffL, BoundType.CLOSED));
assertNotNull(bundle);
NamespaceBundle bundle2 = factory.getBundle(new NamespaceName("pulsar/use/ns1"), Range.range(0L, BoundType.CLOSED, 0xffffffffL, BoundType.CLOSED));
// Don't call equals and make sure those two are the same instance
assertEquals(bundle, bundle2);
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespacesImpl method setNamespaceMessageTTL.
@Override
public void setNamespaceMessageTTL(String namespace, int ttlInSeconds) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("messageTTL")).post(Entity.entity(ttlInSeconds, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
Aggregations