use of com.yahoo.bullet.pubsub.Subscriber in project bullet-core by yahoo.
the class RESTPubSubTest method testGetSubscribers.
@Test
public void testGetSubscribers() throws PubSubException {
BulletConfig config = new BulletConfig("src/test/resources/test_config.yaml");
config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_SUBMISSION");
RESTPubSub pubSub = new RESTPubSub(config);
List<Subscriber> subscribers = pubSub.getSubscribers(8);
Assert.assertNotNull(subscribers);
Assert.assertTrue(subscribers.get(0) instanceof RESTSubscriber);
Assert.assertTrue(subscribers.get(7) instanceof RESTSubscriber);
config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_PROCESSING");
pubSub = new RESTPubSub(config);
subscribers = pubSub.getSubscribers(8);
Assert.assertNotNull(subscribers);
Assert.assertTrue(subscribers.get(0) instanceof RESTSubscriber);
Assert.assertTrue(subscribers.get(7) instanceof RESTSubscriber);
}
use of com.yahoo.bullet.pubsub.Subscriber in project bullet-storm by yahoo.
the class DRPCPubSubTest method testQuerySubmissionSingleInstanceTypes.
@Test
public void testQuerySubmissionSingleInstanceTypes() throws Exception {
config.set(DRPCConfig.PUBSUB_CONTEXT_NAME, PubSub.Context.QUERY_SUBMISSION.name());
DRPCPubSub pubSub = new DRPCPubSub(config);
Publisher publisher = pubSub.getPublisher();
Subscriber subscriber = pubSub.getSubscriber();
Assert.assertTrue(publisher instanceof DRPCQueryResultPubscriber);
Assert.assertTrue(subscriber instanceof DRPCQueryResultPubscriber);
}
use of com.yahoo.bullet.pubsub.Subscriber in project bullet-storm by yahoo.
the class DRPCPubSubTest method testQuerySubmissionMultipleInstancesAreTheSameInstances.
@Test
public void testQuerySubmissionMultipleInstancesAreTheSameInstances() throws Exception {
config.set(DRPCConfig.PUBSUB_CONTEXT_NAME, PubSub.Context.QUERY_SUBMISSION.name());
DRPCPubSub pubSub = new DRPCPubSub(config);
List<Publisher> publishers = pubSub.getPublishers(10);
List<Subscriber> subscribers = pubSub.getSubscribers(20);
Assert.assertEquals(publishers.size(), 10);
// If we ask for more, the size is the same as the first call
Assert.assertEquals(subscribers.size(), 10);
// If we ask for less, the size is the same as the first call
Assert.assertEquals(pubSub.getSubscribers(1).size(), 10);
// If we ask for the same, the size is the same as the first call
Assert.assertEquals(pubSub.getSubscribers(10).size(), 10);
// The corresponding items are the same
IntStream.range(0, 9).forEach(i -> Assert.assertTrue(publishers.get(i) == subscribers.get(i)));
Publisher publisher = pubSub.getPublisher();
Subscriber subscriber = pubSub.getSubscriber();
// If you ask for one, it's the first one in the list
Assert.assertTrue(publisher == subscriber);
Assert.assertTrue(publishers.get(0) == publisher);
}
use of com.yahoo.bullet.pubsub.Subscriber in project bullet-core by yahoo.
the class RESTPubSubTest method testGetSubscriber.
@Test
public void testGetSubscriber() throws PubSubException {
BulletConfig config = new BulletConfig("src/test/resources/test_config.yaml");
config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_SUBMISSION");
RESTPubSub pubSub = new RESTPubSub(config);
Subscriber subscriber = pubSub.getSubscriber();
Assert.assertNotNull(subscriber);
Assert.assertTrue(subscriber instanceof RESTSubscriber);
config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_PROCESSING");
pubSub = new RESTPubSub(config);
subscriber = pubSub.getSubscriber();
Assert.assertNotNull(subscriber);
Assert.assertTrue(subscriber instanceof RESTSubscriber);
}
use of com.yahoo.bullet.pubsub.Subscriber in project bullet-storm by yahoo.
the class DRPCPubSubTest method testQueryProcessingSingleInstanceTypes.
@Test
public void testQueryProcessingSingleInstanceTypes() throws Exception {
config.set(DRPCConfig.PUBSUB_CONTEXT_NAME, PubSub.Context.QUERY_PROCESSING.name());
DRPCPubSub pubSub = new DRPCPubSub(config);
Publisher publisher = pubSub.getPublisher();
Subscriber subscriber = pubSub.getSubscriber();
Assert.assertTrue(publisher instanceof DRPCResultPublisher);
Assert.assertTrue(subscriber instanceof DRPCQuerySubscriber);
}
Aggregations