@Test @Ignore("This is no longer really valid since we don't have to optimize in a separate pass") public final void testOptimizeAllDefs() throws IOException { String snmpConfigXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"http: " <definition version=\"v2c\">\n" + " <specific>192.168.0.5</specific>\n" + " </definition>\n" + " <definition read-community=\"opennmsrules\">\n" + " <range begin=\"192.168.100.1\" end=\"192.168.100.254\"/>\n" + " <range begin=\"192.168.101.1\" end=\"192.168.101.254\"/>\n" + " <range begin=\"192.168.102.1\" end=\"192.168.102.254\"/>\n" + " <range begin=\"192.168.103.1\" end=\"192.168.103.254\"/>\n" + " <range begin=\"192.168.104.1\" end=\"192.168.104.254\"/>\n" + " <range begin=\"192.168.105.1\" end=\"192.168.105.254\"/>\n" + " <range begin=\"192.168.106.1\" end=\"192.168.106.254\"/>\n" + " <range begin=\"192.168.107.1\" end=\"192.168.107.254\"/>\n" + " <range begin=\"192.168.0.1\" end=\"192.168.0.10\"/>\n" + " </definition>\n" + " <definition read-community=\"opennmsrules2\">\n" + " <range begin=\"192.168.100.0\" end=\"192.168.100.255\"/>\n" + " <range begin=\"192.168.101.0\" end=\"192.168.101.255\"/>\n" + " <range begin=\"192.168.102.0\" end=\"192.168.102.255\"/>\n" + " <range begin=\"192.168.103.0\" end=\"192.168.103.255\"/>\n" + " <range begin=\"192.168.104.0\" end=\"192.168.104.255\"/>\n" + " <range begin=\"192.168.105.0\" end=\"192.168.105.255\"/>\n" + " <range begin=\"192.168.106.0\" end=\"192.168.106.255\"/>\n" + " <range begin=\"192.168.107.0\" end=\"192.168.107.255\"/>\n" + " <range begin=\"192.168.0.1\" end=\"192.168.0.10\"/>\n" + " </definition>\n" + " <definition read-community=\"splice-test\" version=\"v2c\">\n" + " <range begin=\"10.1.2.1\" end=\"10.1.2.100\"/>\n" + " <range begin=\"11.1.2.1\" end=\"11.1.2.100\"/>\n" + " <range begin=\"12.1.2.1\" end=\"12.1.2.100\"/>\n" + " <specific>10.1.1.1</specific>\n" + " <specific>10.1.1.2</specific>\n" + " <specific>10.1.1.3</specific>\n" + " <specific>10.1.1.5</specific>\n" + " <specific>10.1.1.6</specific>\n" + " <specific>10.1.1.10</specific>\n" + " </definition>\n" + " <definition read-community=\"splice2-test\">\n" + " <range begin=\"10.1.1.11\" end=\"10.1.1.100\"/>\n" + " <range begin=\"11.1.2.1\" end=\"11.1.2.100\"/>\n" + " <range begin=\"12.1.2.1\" end=\"12.1.2.100\"/>\n" + " <specific>10.1.1.10</specific>\n" + " </definition>\n" + " <definition read-community=\"splice3-test\">\n" + " <range begin=\"10.1.1.11\" end=\"10.1.1.100\"/>\n" + " <range begin=\"11.1.2.1\" end=\"11.1.2.1\"/>\n" + " <range begin=\"12.1.2.1\" end=\"12.1.2.1\"/>\n" + " <specific>10.1.1.10</specific>\n" + " <specific>10.1.1.12</specific>\n" + " </definition>\n" + "</snmp-config>\n" + ""; String expectedConfig = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> standalone=\"yes\"\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"http: " <definition version=\"v2c\">\n" + " <specific>192.168.0.5</specific>\n" + " </definition>\n" + " <definition read-community=\"opennmsrules\">\n" + " <range begin=\"192.168.0.1\" end=\"192.168.0.10\"/>\n" + " <range begin=\"192.168.100.1\" end=\"192.168.100.254\"/>\n" + " <range begin=\"192.168.101.1\" end=\"192.168.101.254\"/>\n" + " <range begin=\"192.168.102.1\" end=\"192.168.102.254\"/>\n" + " <range begin=\"192.168.103.1\" end=\"192.168.103.254\"/>\n" + " <range begin=\"192.168.104.1\" end=\"192.168.104.254\"/>\n" + " <range begin=\"192.168.105.1\" end=\"192.168.105.254\"/>\n" + " <range begin=\"192.168.106.1\" end=\"192.168.106.254\"/>\n" + " <range begin=\"192.168.107.1\" end=\"192.168.107.254\"/>\n" + " </definition>\n" + " <definition read-community=\"opennmsrules2\">\n" + " <range begin=\"192.168.0.1\" end=\"192.168.0.10\"/>\n" + " <range begin=\"192.168.100.0\" end=\"192.168.107.255\"/>\n" + " </definition>\n" + " <definition read-community=\"splice-test\" version=\"v2c\">\n" + " <range begin=\"10.1.1.1\" end=\"10.1.1.3\"/>\n" + " <range begin=\"10.1.1.5\" end=\"10.1.1.6\"/>\n" + " <range begin=\"10.1.2.1\" end=\"10.1.2.100\"/>\n" + " <range begin=\"11.1.2.1\" end=\"11.1.2.100\"/>\n" + " <range begin=\"12.1.2.1\" end=\"12.1.2.100\"/>\n" + " <specific>10.1.1.10</specific>\n" + " </definition>\n" + " <definition read-community=\"splice2-test\">\n" + " <range begin=\"10.1.1.10\" end=\"10.1.1.100\"/>\n" + " <range begin=\"11.1.2.1\" end=\"11.1.2.100\"/>\n" + " <range begin=\"12.1.2.1\" end=\"12.1.2.100\"/>\n" + " </definition>\n" + " <definition read-community=\"splice3-test\">\n" + " <range begin=\"10.1.1.10\" end=\"10.1.1.100\"/>\n" + " <specific>11.1.2.1</specific>\n" + " <specific>12.1.2.1</specific>\n" + " </definition>\n" + "</snmp-config>\n" + ""; SnmpPeerFactory.setInstance(new SnmpPeerFactory(snmpConfigXml)); assertEquals(snmpConfigXml, SnmpPeerFactory.marshallConfig()); SnmpEventInfo info = new SnmpEventInfo(); SnmpConfig config = SnmpPeerFactory.getSnmpConfig(); assertEquals(6, config.getDefinitionCount()); info.setCommunityString("opennmsrules2"); new SnmpConfigManager(config).optimizeAllDefs(); String actualConfig = SnmpPeerFactory.marshallConfig(); assertEquals(expectedConfig, actualConfig); }
public void setCommunityString(String communityString) { m_communityString = communityString; }
SnmpEventInfo { public void setCommunityString(String communityString) { m_communityString = communityString; } }
SnmpEventInfo { public void setCommunityString(String communityString) { m_communityString = communityString; } SnmpEventInfo();  SnmpEventInfo(Event event); }
SnmpEventInfo { public void setCommunityString(String communityString) { m_communityString = communityString; } SnmpEventInfo();  SnmpEventInfo(Event event); String getCommunityString(); void setCommunityString(String communityString); String getFirstIPAddress(); void setFirstIPAddress(String firstIPAddress); void setFirstIPAddress(InetAddress firstIPAddress); String getLastIPAddress(); void setLastIPAddress(String lastIPAddress); void setLastIPAddress(InetAddress lastIPAddress); Range getRange(); int getRetryCount(); void setRetryCount(int retryCount); int getTimeout(); void setTimeout(int timeout); String getVersion(); void setVersion(String version); int getPort(); void setPort(int port); Definition createDef(); boolean isSpecific(); String toString(); }
SnmpEventInfo { public void setCommunityString(String communityString) { m_communityString = communityString; } SnmpEventInfo();  SnmpEventInfo(Event event); String getCommunityString(); void setCommunityString(String communityString); String getFirstIPAddress(); void setFirstIPAddress(String firstIPAddress); void setFirstIPAddress(InetAddress firstIPAddress); String getLastIPAddress(); void setLastIPAddress(String lastIPAddress); void setLastIPAddress(InetAddress lastIPAddress); Range getRange(); int getRetryCount(); void setRetryCount(int retryCount); int getTimeout(); void setTimeout(int timeout); String getVersion(); void setVersion(String version); int getPort(); void setPort(int port); Definition createDef(); boolean isSpecific(); String toString();  }