use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespacesImpl method clearNamespaceBundleBacklog.
@Override
public void clearNamespaceBundleBacklog(String namespace, String bundle) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle).path("clearBacklog")).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespacesImpl method setNamespaceReplicationClusters.
@Override
public void setNamespaceReplicationClusters(String namespace, List<String> clusterIds) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("replication")).post(Entity.entity(clusterIds, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespacesImpl method clearNamespaceBacklogForSubscription.
@Override
public void clearNamespaceBacklogForSubscription(String namespace, String subscription) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("clearBacklog").path(subscription)).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespacesImpl method unloadNamespaceBundle.
@Override
public void unloadNamespaceBundle(String namespace, String bundle) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle).path("unload")).put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.
the class NamespaceBundleTest method testConstructor.
@Test
public void testConstructor() {
try {
new NamespaceBundle(null, null, null);
fail("Should have failed w/ null pointer exception");
} catch (NullPointerException npe) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar.old.ns"), null, null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.CLOSED, 0L, BoundType.OPEN), null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.OPEN, 1L, BoundType.OPEN), null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(1L, BoundType.CLOSED, 1L, BoundType.OPEN), null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.CLOSED, 1L, BoundType.CLOSED), null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.CLOSED, NamespaceBundles.FULL_UPPER_BOUND, BoundType.OPEN), null);
fail("Should have failed w/ illegal argument exception");
} catch (IllegalArgumentException iae) {
// OK, expected
}
try {
new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.CLOSED, NamespaceBundles.FULL_UPPER_BOUND, BoundType.CLOSED), null);
fail("Should have failed w/ null pointer exception");
} catch (NullPointerException npe) {
// OK, expected
}
NamespaceBundle bundle = new NamespaceBundle(new NamespaceName("pulsar/use/ns"), Range.range(0L, BoundType.CLOSED, 1L, BoundType.OPEN), factory);
assertTrue(bundle.getKeyRange().lowerEndpoint().equals(0L));
assertEquals(bundle.getKeyRange().lowerBoundType(), BoundType.CLOSED);
assertTrue(bundle.getKeyRange().upperEndpoint().equals(1L));
assertEquals(bundle.getKeyRange().upperBoundType(), BoundType.OPEN);
assertEquals(bundle.getNamespaceObject().toString(), "pulsar/use/ns");
}
Aggregations