brooklyncentral/brooklyn — pull request #427 by aledsage (2012-12-19 21:55:16+00:00)
Title: Fix failing SensorSummary when multi action:open

- Ensure don't register duplicate NamedActionWithUrl hints
- In SensorSummary, don't fail to build links if come across multiple "action:open" hints.

---
Motivated by this exception encountered in customer test environment:

2012-12-19 21:05:57,997 WARN o.e.j.servlet.ServletHandler [qtp432440941-18]: /v1/applications/z8x1n3e7/entities/eVfEDlFI/sensors
java.lang.IllegalArgumentException: duplicate key: action:open
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:119) ~[guava-12.0.1.jar:na]
at com.google.common.collect.RegularImmutableMap.(RegularImmutableMap.java:70) ~[guava-12.0.1.jar:na]
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:250) ~[guava-12.0.1.jar:na]
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:236) ~[guava-12.0.1.jar:na]
at brooklyn.rest.domain.SensorSummary.(SensorSummary.java:69) ~[brooklyn-rest-0.5.0-SNAPSHOT.jar:na]
at brooklyn.rest.domain.SensorSummary.fromEntity(SensorSummary.java:88) ~[brooklyn-rest-0.5.0-SNAPSHOT.jar:na]
at brooklyn.rest.resources.SensorResource$2.apply(SensorResource.java:62) ~[brooklyn-rest-0.5.0-SNAPSHOT.jar:na]
at brooklyn.rest.resources.SensorResource$2.apply(SensorResource.java:1) ~[brooklyn-rest-0.5.0-SNAPSHOT.jar:na]
at com.google.common.collect.Iterators$9.transform(Iterators.java:845) ~[guava-12.0.1.jar:na]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) ~[guava-12.0.1.jar:na]
at com.google.common.collect.Lists.newArrayList(Lists.java:145) ~[guava-12.0.1.jar:na]
at com.google.common.collect.Lists.newArrayList(Lists.java:125) ~[guava-12.0.1.jar:na]
at brooklyn.rest.resources.SensorResource.list(SensorResource.java:51) ~[brooklyn-rest-0.5.0-SNAPSHOT.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_26]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObjectRule.java:100) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353) ~[jersey-server-1.12.jar:1.12]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414) ~[jersey-servlet-1.12.jar:1.12]