NiciraNvpResource implements ServerResource { @Override public boolean configure(final String ignoredName, final Map<String, Object> params) throws ConfigurationException { name = (String) params.get("name"); if (name == null) { throw new ConfigurationException("Unable to find name"); } guid = (String) params.get("guid"); if (guid == null) { throw new ConfigurationException("Unable to find the guid"); } zoneId = (String) params.get("zoneId"); if (zoneId == null) { throw new ConfigurationException("Unable to find zone"); } final String ip = (String) params.get("ip"); if (ip == null) { throw new ConfigurationException("Unable to find IP"); } 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"); } niciraNvpUtilities = NiciraNvpUtilities.getInstance(); retryUtility = CommandRetryUtility.getInstance(); retryUtility.setServerResource(this); try { niciraNvpApi = createNiciraNvpApi(ip, adminuser, adminpass); } catch (final CloudstackRESTException e) { throw new ConfigurationException("Could not create a Nicira Nvp API client: " + e.getMessage()); } return true; }  @Override boolean configure(final String ignoredName, final Map<String, Object> params); NiciraNvpApi getNiciraNvpApi(); NiciraNvpUtilities getNiciraNvpUtilities(); CommandRetryUtility getRetryUtility(); @Override boolean start(); @Override boolean stop(); @Override String getName(); @Override Type getType(); @Override StartupCommand[] initialize(); @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[] generateStaticNatRulePair(final String insideIp, final String outsideIp); NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                    final String protocol); @Override void setName(final String name); @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; }
@Test(expected = ConfigurationException.class) public void resourceConfigureFailure() throws ConfigurationException { resource.configure("NiciraNvpResource", Collections.<String, Object> emptyMap()); }