Github user geomacy commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/154#discussion_r64388088
--- Diff:
core/src/main/java/org/apache/brooklyn/enricher/stock/Propagator.java ---
@@ -113,33 +136,15 @@ public void setEntity(EntityLocal entity) {
return true;
}
};
- } else if (sensorMappingSet) {
- if (propagatingAll) {
- throw new IllegalStateException("Propagator enricher
"+this+" must not have 'sensorMapping' set at same time as either
'propagatingAll' or 'propagatingAllBut'");
- }
- this.sensorMapping = ImmutableMap.copyOf(sensorMappingTemp);
+ } else if (sensorMapping.size() > 0) {
+ this.sensorMapping = ImmutableMap.copyOf(sensorMapping);
this.sensorFilter = Predicates.alwaysTrue();
} else {
- this.sensorMapping = ImmutableMap.<Sensor<?>, Sensor<?>>of();
- if (!propagatingAll) {
- // default if nothing specified is to do all but the ones
not usually propagated
- propagatingAll = true;
- // user specified nothing, so *set* the all_but to the
default set
- // if desired, we could allow this to be dynamically
reconfigurable, remove this field and always look up;
- // slight performance hit (always looking up), and might
need to recompute subscriptions, so not supported currently
- // TODO this default is @Beta behaviour! -- maybe better
to throw?
- propagatingAllBut = SENSORS_NOT_USUALLY_PROPAGATED;
- } else {
- propagatingAllBut = getConfig(PROPAGATING_ALL_BUT);
- }
+ assert propagatingAll;
--- End diff --
Could this not use org.apache.brooklyn.test.Asserts or
com.google.common.base.Preconditions and add a message?
---
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.
---