@Test(expected = ConfigurationException.class) public void resourceConfigureFailure() throws ConfigurationException { resource.configure("NiciraNvpResource", Collections.<String, Object>emptyMap()); }
@Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { this.name = (String) params.get("name"); if (this.name == null) { throw new ConfigurationException("Unable to find name"); } this.guid = (String) params.get("guid"); if (this.guid == null) { throw new ConfigurationException("Unable to find the guid"); } this.zoneId = (String) params.get("zoneId"); if (this.zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ips = (String) params.get("ip"); if (ips == null) { throw new ConfigurationException("Unable to find IPs"); } final String adminuser = (String) params.get("adminuser"); if (adminuser == null) { throw new ConfigurationException("Unable to find admin username"); } final String adminpass = (String) params.get("adminpass"); if (adminpass == null) { throw new ConfigurationException("Unable to find admin password"); } this.niciraNvpUtilities = NiciraNvpUtilities.getInstance(); this.retryUtility = CommandRetryUtility.getInstance(); this.retryUtility.setServerResource(this); try { for (final String ip : ips.split(",")) { this.niciraNvpApis.add(createNiciraNvpApi(ip, adminuser, adminpass)); } } catch (final CosmicRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; }
NiciraNvpResource implements ServerResource { @Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { this.name = (String) params.get("name"); if (this.name == null) { throw new ConfigurationException("Unable to find name"); } this.guid = (String) params.get("guid"); if (this.guid == null) { throw new ConfigurationException("Unable to find the guid"); } this.zoneId = (String) params.get("zoneId"); if (this.zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ips = (String) params.get("ip"); if (ips == null) { throw new ConfigurationException("Unable to find IPs"); } final String adminuser = (String) params.get("adminuser"); if (adminuser == null) { throw new ConfigurationException("Unable to find admin username"); } final String adminpass = (String) params.get("adminpass"); if (adminpass == null) { throw new ConfigurationException("Unable to find admin password"); } this.niciraNvpUtilities = NiciraNvpUtilities.getInstance(); this.retryUtility = CommandRetryUtility.getInstance(); this.retryUtility.setServerResource(this); try { for (final String ip : ips.split(",")) { this.niciraNvpApis.add(createNiciraNvpApi(ip, adminuser, adminpass)); } } catch (final CosmicRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; } }
NiciraNvpResource implements ServerResource { @Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { this.name = (String) params.get("name"); if (this.name == null) { throw new ConfigurationException("Unable to find name"); } this.guid = (String) params.get("guid"); if (this.guid == null) { throw new ConfigurationException("Unable to find the guid"); } this.zoneId = (String) params.get("zoneId"); if (this.zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ips = (String) params.get("ip"); if (ips == null) { throw new ConfigurationException("Unable to find IPs"); } final String adminuser = (String) params.get("adminuser"); if (adminuser == null) { throw new ConfigurationException("Unable to find admin username"); } final String adminpass = (String) params.get("adminpass"); if (adminpass == null) { throw new ConfigurationException("Unable to find admin password"); } this.niciraNvpUtilities = NiciraNvpUtilities.getInstance(); this.retryUtility = CommandRetryUtility.getInstance(); this.retryUtility.setServerResource(this); try { for (final String ip : ips.split(",")) { this.niciraNvpApis.add(createNiciraNvpApi(ip, adminuser, adminpass)); } } catch (final CosmicRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; }  }
NiciraNvpResource implements ServerResource { @Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { this.name = (String) params.get("name"); if (this.name == null) { throw new ConfigurationException("Unable to find name"); } this.guid = (String) params.get("guid"); if (this.guid == null) { throw new ConfigurationException("Unable to find the guid"); } this.zoneId = (String) params.get("zoneId"); if (this.zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ips = (String) params.get("ip"); if (ips == null) { throw new ConfigurationException("Unable to find IPs"); } final String adminuser = (String) params.get("adminuser"); if (adminuser == null) { throw new ConfigurationException("Unable to find admin username"); } final String adminpass = (String) params.get("adminpass"); if (adminpass == null) { throw new ConfigurationException("Unable to find admin password"); } this.niciraNvpUtilities = NiciraNvpUtilities.getInstance(); this.retryUtility = CommandRetryUtility.getInstance(); this.retryUtility.setServerResource(this); try { for (final String ip : ips.split(",")) { this.niciraNvpApis.add(createNiciraNvpApi(ip, adminuser, adminpass)); } } catch (final CosmicRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; }  NiciraNvpApi getNiciraNvpApi(); NiciraNvpUtilities getNiciraNvpUtilities(); @Override boolean configure(final String ignoredName, final Map<String, Object> params); CommandRetryUtility getRetryUtility(); @Override String getName(); @Override void setName(final String name); @Override HostType getType(); @Override boolean start(); @Override StartupCommand[] initialize(); @Override boolean stop(); @Override PingCommand getCurrentStatus(final long id); @Override Answer executeRequest(final Command cmd); @Override void disconnected(); @Override IAgentControl getAgentControl(); @Override void setAgentControl(final IAgentControl agentControl); String natRuleToString(final NatRule rule); String truncate(final String string, final int length); NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                                                    final String protocol); NatRule[] generateStaticNatRulePair(final String insideIp, final String outsideIp); @Override void setConfigParams(final Map<String, Object> params); @Override Map<String, Object> getConfigParams(); @Override int getRunLevel(); @Override void setRunLevel(final int level); }
NiciraNvpResource implements ServerResource { @Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { this.name = (String) params.get("name"); if (this.name == null) { throw new ConfigurationException("Unable to find name"); } this.guid = (String) params.get("guid"); if (this.guid == null) { throw new ConfigurationException("Unable to find the guid"); } this.zoneId = (String) params.get("zoneId"); if (this.zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ips = (String) params.get("ip"); if (ips == null) { throw new ConfigurationException("Unable to find IPs"); } final String adminuser = (String) params.get("adminuser"); if (adminuser == null) { throw new ConfigurationException("Unable to find admin username"); } final String adminpass = (String) params.get("adminpass"); if (adminpass == null) { throw new ConfigurationException("Unable to find admin password"); } this.niciraNvpUtilities = NiciraNvpUtilities.getInstance(); this.retryUtility = CommandRetryUtility.getInstance(); this.retryUtility.setServerResource(this); try { for (final String ip : ips.split(",")) { this.niciraNvpApis.add(createNiciraNvpApi(ip, adminuser, adminpass)); } } catch (final CosmicRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; }  NiciraNvpApi getNiciraNvpApi(); NiciraNvpUtilities getNiciraNvpUtilities(); @Override boolean configure(final String ignoredName, final Map<String, Object> params); CommandRetryUtility getRetryUtility(); @Override String getName(); @Override void setName(final String name); @Override HostType getType(); @Override boolean start(); @Override StartupCommand[] initialize(); @Override boolean stop(); @Override PingCommand getCurrentStatus(final long id); @Override Answer executeRequest(final Command cmd); @Override void disconnected(); @Override IAgentControl getAgentControl(); @Override void setAgentControl(final IAgentControl agentControl); String natRuleToString(final NatRule rule); String truncate(final String string, final int length); NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                                                    final String protocol); NatRule[] generateStaticNatRulePair(final String insideIp, final String outsideIp); @Override void setConfigParams(final Map<String, Object> params); @Override Map<String, Object> getConfigParams(); @Override int getRunLevel(); @Override void setRunLevel(final int level); static final int NAME_MAX_LEN; static final int NUM_RETRIES; }