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.
This commit is contained in:
Hugo Trippaers 2013-01-03 11:47:40 +01:00
parent 9122809e00
commit 6cf0c5683d
1 changed files with 2 additions and 1 deletions

View File

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