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);
}
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);
}
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);
}
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);
}
Aggregations