Search in sources :

Example 1 with Config

use of com.yahoo.bullet.common.Config in project bullet-storm by yahoo.

the class DRPCQuerySubscriberTest method setup.

@BeforeMethod
public void setup() {
    DRPCConfig config = new DRPCConfig("src/test/resources/test_drpc_config.yaml");
    // 1 task for the component named "foo" with task index 0
    CustomTopologyContext context = new CustomTopologyContext(Collections.singletonList(1), "foo", 0);
    config.set(DRPCConfig.STORM_CONTEXT, context);
    Map stormConfig = new Config("src/test/resources/test_storm_config.yaml").getAll(Optional.empty());
    config.set(DRPCConfig.STORM_CONFIG, stormConfig);
    subscriber = new DRPCQuerySubscriber(config, 5);
    DRPCOutputCollector collector = subscriber.getCollector();
    // Override the DRPCSpout with our own that emits using our collector.
    injectedMockSpout = new MockDRPCSpout("foo", collector);
    subscriber.setSpout(injectedMockSpout);
}
Also used : DRPCOutputCollector(com.yahoo.bullet.storm.drpc.utils.DRPCOutputCollector) Config(com.yahoo.bullet.common.Config) CustomTopologyContext(com.yahoo.bullet.storm.testing.CustomTopologyContext) Map(java.util.Map) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with Config

use of com.yahoo.bullet.common.Config in project bullet-core by yahoo.

the class RESTPubSubConfigTest method testMerging.

@Test
public void testMerging() {
    RESTPubSubConfig config = new RESTPubSubConfig("src/test/resources/test_config.yaml");
    int configSize = config.getAll(Optional.empty()).size();
    Assert.assertEquals(config.get(RESTPubSubConfig.CONNECT_RETRY_LIMIT), 88);
    Assert.assertEquals(config.get(RESTPubSubConfig.PUBSUB_CLASS_NAME), "com.yahoo.bullet.pubsub.MockPubSub");
    Config another = new RESTPubSubConfig((String) null);
    another.clear();
    another.set(RESTPubSubConfig.CONNECT_RETRY_LIMIT, 51L);
    // This is a bad setting
    another.set(RESTPubSubConfig.AGGREGATION_MAX_SIZE, -1);
    // Some other non-Bullet setting
    config.set("pi", 3.14);
    config.merge(another);
    Assert.assertEquals(config.getAll(Optional.empty()).size(), configSize + 1);
    Assert.assertEquals(config.get(RESTPubSubConfig.CONNECT_RETRY_LIMIT), 51);
    // Bad setting gets defaulted.
    Assert.assertEquals(config.get(RESTPubSubConfig.AGGREGATION_MAX_SIZE), RESTPubSubConfig.DEFAULT_AGGREGATION_MAX_SIZE);
    // Other setting is preserved.
    Assert.assertEquals(config.get("pi"), 3.14);
    // Test null and verify it is unchanged
    config.merge(null);
    Assert.assertEquals(config.getAll(Optional.empty()).size(), configSize + 1);
    Assert.assertEquals(config.get(RESTPubSubConfig.CONNECT_RETRY_LIMIT), 51);
    Assert.assertEquals(config.get(RESTPubSubConfig.AGGREGATION_MAX_SIZE), RESTPubSubConfig.DEFAULT_AGGREGATION_MAX_SIZE);
    Assert.assertEquals(config.get("pi"), 3.14);
}
Also used : BulletConfig(com.yahoo.bullet.common.BulletConfig) Config(com.yahoo.bullet.common.Config) Test(org.testng.annotations.Test)

Example 3 with Config

use of com.yahoo.bullet.common.Config in project bullet-storm by yahoo.

the class DRPCPubSubTest method setup.

@BeforeMethod
public void setup() throws Exception {
    config = new DRPCConfig("src/test/resources/test_drpc_config.yaml");
    // 1 task for the component named "foo" with task index 0
    CustomTopologyContext context = new CustomTopologyContext(Collections.singletonList(1), "foo", 0);
    config.set(DRPCConfig.STORM_CONTEXT, context);
    Map stormConfig = new Config("src/test/resources/test_storm_config.yaml").getAll(Optional.empty());
    config.set(DRPCConfig.STORM_CONFIG, stormConfig);
}
Also used : Config(com.yahoo.bullet.common.Config) CustomTopologyContext(com.yahoo.bullet.storm.testing.CustomTopologyContext) Map(java.util.Map) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with Config

use of com.yahoo.bullet.common.Config in project bullet-storm by yahoo.

the class DRPCResultPublisherTest method setup.

@BeforeMethod
public void setup() {
    DRPCConfig config = new DRPCConfig("src/test/resources/test_drpc_config.yaml");
    Map stormConfig = new Config("src/test/resources/test_storm_config.yaml").getAll(Optional.empty());
    config.set(DRPCConfig.STORM_CONFIG, stormConfig);
    publisher = new DRPCResultPublisher(config);
    collector = publisher.getCollector();
    // Override the ReturnResults with our own that uses our collector and fails every two tuples
    injectedMockBolt = new MockReturnResults(collector, 5);
    publisher.setBolt(injectedMockBolt);
}
Also used : Config(com.yahoo.bullet.common.Config) Map(java.util.Map) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Config (com.yahoo.bullet.common.Config)4 Map (java.util.Map)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 CustomTopologyContext (com.yahoo.bullet.storm.testing.CustomTopologyContext)2 BulletConfig (com.yahoo.bullet.common.BulletConfig)1 DRPCOutputCollector (com.yahoo.bullet.storm.drpc.utils.DRPCOutputCollector)1 Test (org.testng.annotations.Test)1