GitHub user aledsage opened a pull request:

    https://github.com/apache/brooklyn-server/pull/728

    Change SetFromFlag tests

    This PR just changes tests, to stop testing things that we shouldn't 
support!
    
    We should stop supporting `@SetFromFlag` on entity fields. It's been 
discouraged for a long time, and is a bad idea - one should use config keys and 
sensors instead! Unfortunately it's not as easy to tell people to not use it on 
policies, enrichers and locations - those don't have sensors!
    
    In a subsequent PR, I'm going to add support for `deprecatedNames` on 
`ConfigKey`. Removing the need to support `@SetFromFlag` on entity fields will 
allow config code to be made simpler longer term.
    
    Here, I change the `EntitySetFromFlagTest` (which uses `@SetFromFlag` on 
fields) to be `PolicySetFromFlagTest`.
    
    This PR also changes `StubContainerLocation` (which is a test class) to 
remove the field `@SetFromFlag("owner") private StubContainer owner`. There is 
a config key on its super type `DynamicLocation.OWNER` that has the name 
"owner". Two reasons to change this:
    1. we shouldn't support `@SetFromFlag` on entity fields.
    2. people shouldn't rely on using a duplicate name of a config key and a 
field (or on two different config keys, or whatever). That's mad! The semantics 
of what it would mean if you subsequent change one of the values is unclear 
(e.g. does it impact the other config key).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aledsage/brooklyn-server 
change-SetFromFlag-tests

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-server/pull/728.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #728
    
----
commit 21d86217c2139da45111fd782d0b55e0a99fd34c
Author: Aled Sage <[email protected]>
Date:   2017-06-09T13:43:38Z

    SetFromFlag tests: not support entity fields

commit ec0509daf000f75b342bb5091136b65746439686
Author: Aled Sage <[email protected]>
Date:   2017-06-09T16:35:39Z

    Fix test StubContainerLocation use of SetFromFlag

----


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