Skip to content

Commit

Permalink
Using Storm 2.2 and moving to mockito 3 to avoid STORM-3663
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaisarma committed Nov 2, 2020
1 parent 3e955a7 commit 9356272
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<storm.version>2.1.0</storm.version>
<storm.metrics.version>2.1.0</storm.metrics.version>
<storm.version>2.2.0</storm.version>
<storm.metrics.version>2.2.0</storm.metrics.version>
<jackson.core.version>2.10.2</jackson.core.version>
<bullet.core.version>1.1.0</bullet.core.version>
<bullet.dsl.version>1.0.0</bullet.dsl.version>
Expand All @@ -51,8 +51,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>3.5.7</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/yahoo/bullet/storm/StormUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public static void submit(BulletStormConfig config, String recordComponent, Topo
// Metrics
Boolean enableMetrics = (Boolean) config.get(BulletStormConfig.TOPOLOGY_METRICS_ENABLE);
if (enableMetrics) {
stormConfig.put(Config.TOPOLOGY_ENABLE_V2_METRICS_TICK, true);
List<String> classNames = config.getAs(BulletStormConfig.TOPOLOGY_METRICS_CLASSES, List.class);
classNames.forEach(className -> ReflectionUtils.registerMetricsConsumer(className, stormConfig, config));
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/com/yahoo/bullet/storm/StormUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,14 @@ public void testHookingInCustomMetricsConsumer() {
config.set(BulletStormConfig.TOPOLOGY_METRICS_CLASSES, singletonList(CustomIMetricsConsumer.class.getName()));

Assert.assertNull(config.get(CustomIMetricsConsumer.CUSTOM_METRICS_REGISTERED));
Assert.assertNull(config.get(CustomIMetricsConsumer.CUSTOM_METRICS_V2_ENABLED));
Assert.assertFalse(builder.isTopologyCreated());

submitWithTopology("source");

Assert.assertTrue(builder.isTopologyCreated());
// This value is the value of the v2 metrics tick setting in the storm config
Assert.assertTrue((Boolean) config.get(CustomIMetricsConsumer.CUSTOM_METRICS_V2_ENABLED));
Assert.assertTrue((Boolean) config.get(CustomIMetricsConsumer.CUSTOM_METRICS_REGISTERED));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

public class CustomIMetricsConsumer implements IMetricsConsumer {
public static final String CUSTOM_METRICS_REGISTERED = "bullet.topology.custom.metrics.consumer.was.registered";
public static final String CUSTOM_METRICS_V2_ENABLED = "bullet.topology.custom.metrics.consumer.v2.enabled";
@Override
public void prepare(Map stormConf, Object registrationArgument, TopologyContext context, IErrorReporter errorReporter) {
}
Expand All @@ -30,6 +31,7 @@ public void cleanup() {

public static void register(Config stormConfig, BulletStormConfig bulletStormConfig) {
bulletStormConfig.set(CUSTOM_METRICS_REGISTERED, true);
bulletStormConfig.set(CUSTOM_METRICS_V2_ENABLED, stormConfig.get(Config.TOPOLOGY_ENABLE_V2_METRICS_TICK));
stormConfig.registerMetricsConsumer(CustomIMetricsConsumer.class);
}
}

0 comments on commit 9356272

Please sign in to comment.