Github user nakomis commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/191#discussion_r66404956
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/enricher/stock/TransformingEnricherTest.java
 ---
    @@ -225,17 +226,38 @@ public void testInfersTargetSensorSameAsSource() 
throws Exception {
             EntityAsserts.assertAttributeEqualsEventually(app, intSensorA, 3);
         }
     
    +    @Test
    +    public void testAllowCyclicPublishing() throws Exception {
    +        app.enrichers().add(EnricherSpec.create(Transformer.class)
    +                .configure(Transformer.SOURCE_SENSOR, intSensorA)
    +                .configure(Transformer.TARGET_SENSOR, intSensorA)
    +                .configure(Transformer.ALLOW_CYCLIC_PUBLISHING, true)
    +                .configure(Transformer.TRANSFORMATION_FROM_VALUE, new 
Function<Integer, Object>() {
    +                    @Override public Object apply(Integer input) {
    +                        if (input != null && input < 10) {
    +                            return input + 1;
    +                        } else {
    +                            return Entities.UNCHANGED;
    +                        }
    +                    }}));
    +
    +        app.sensors().set(intSensorA, 3);
    +
    +        EntityAsserts.assertAttributeEqualsEventually(app, intSensorA, 10);
    --- End diff --
    
    Follow up with `EntityAsserts.assertAttributeEqualsContinually` to ensure 
value remains at 10


---
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.
---

Reply via email to