Summary: Make canHandle protected Change access to canHandle so it's easier to unittest.
Make a note that answers can be null if the host is down, there should be a way to deal with this, but for now an NPE is an adequate indication that something is wrong. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6cf0c568 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6cf0c568 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6cf0c568 Branch: refs/heads/ui-plugins Commit: 6cf0c5683d518bd6dcd6c51bfa0290e96c6804f3 Parents: 9122809 Author: Hugo Trippaers <[email protected]> Authored: Thu Jan 3 11:47:40 2013 +0100 Committer: Hugo Trippaers <[email protected]> Committed: Thu Jan 3 11:56:26 2013 +0100 ---------------------------------------------------------------------- .../cloud/network/element/NiciraNvpElement.java | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6cf0c568/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java ---------------------------------------------------------------------- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java index b1e9af2..0a7d042 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java @@ -173,7 +173,7 @@ public class NiciraNvpElement extends AdapterBase implements return Provider.NiciraNvp; } - private boolean canHandle(Network network, Service service) { + protected boolean canHandle(Network network, Service service) { s_logger.debug("Checking if NiciraNvpElement can handle service " + service.getName() + " on network " + network.getDisplayText()); if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { @@ -845,6 +845,7 @@ public class NiciraNvpElement extends AdapterBase implements ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs); ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); + //FIXME answer can be null if the host is down return answer.getResult(); } else {
