Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/888#discussion_r39290389
--- Diff:
core/src/test/java/org/apache/brooklyn/enricher/stock/SensorPropagatingEnricherTest.java
---
@@ -215,4 +213,43 @@ public void
testEnricherSpecThrowsOnPropagatesAndPropagatesAllSet() throws Excep
if (ise == null) throw e;
}
}
+
+ @Test
+ public void testPropagateToDynamicSensor() {
--- End diff --
Would be good to have a specific test for the actual fix, rather than just
this more complicated example. Maybe something like:
@Test
public void
testSensorPropagatedWhenMappingUsedSameNameButDifferentType() throws Exception {
AttributeSensor<String> origSensor =
Sensors.newSensor(String.class, "origSensor");
AttributeSensor<Object> sourceSensorFromYaml =
Sensors.newSensor(Object.class, "origSensor");
AttributeSensor<Object> targetSensor =
Sensors.newSensor(Object.class, "newSensor");
app.addEnricher(Enrichers.builder()
.propagating(ImmutableMap.of(sourceSensorFromYaml,
targetSensor))
.from(entity)
.build());
entity.sensors().set(origSensor, "myval");
EntityTestUtils.assertAttributeEqualsEventually(app, targetSensor,
"myval");
}
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---