Permalink
Browse files

Merge pull request #1813 from OpenNMS/jira/HZN-1199-dao

HZN-1202: Move non-SNMP-specific CollectionAgent classes to new project
  • Loading branch information...
j-white committed Jan 10, 2018
2 parents 8b340ba + bb75689 commit d37bed8696745bf5b59956622a4b8eb5c24af316
Showing with 719 additions and 603 deletions.
  1. +0 −15 core/test-api/collection/src/main/java/org/opennms/core/collection/test/MockCollectionAgent.java
  2. +0 −14 features/collection/api/src/main/java/org/opennms/netmgt/collection/api/CollectionAgent.java
  3. +10 −56 ...tures/collection/api/src/main/java/org/opennms/netmgt/collection/api}/CollectionAgentService.java
  4. +1 −4 ... → features/collection/api/src/main/java/org/opennms/netmgt/collection/api}/CollectionFailed.java
  5. +1 −3 ... features/collection/api/src/main/java/org/opennms/netmgt/collection/api}/CollectionTimedOut.java
  6. +1 −3 ...→ features/collection/api/src/main/java/org/opennms/netmgt/collection/api}/CollectionUnknown.java
  7. +1 −3 ...→ features/collection/api/src/main/java/org/opennms/netmgt/collection/api}/CollectionWarning.java
  8. +2 −21 features/collection/api/src/main/java/org/opennms/netmgt/collection/dto/CollectionAgentDTO.java
  9. +1 −2 ...ures/collection/api/src/test/java/org/opennms/features/collection/dto/CollectionAgentDTOTest.java
  10. +0 −12 features/collection/collectors/pom.xml
  11. +0 −48 ...res/collection/collectors/src/test/resources/META-INF/opennms/applicationContext-collectdTest.xml
  12. +47 −0 features/collection/core/pom.xml
  13. +3 −1 ...es/collection/core/src/main/java/org/opennms/netmgt/collection/core}/CollectionSpecification.java
  14. +1 −1 ...ection/core/src/main/java/org/opennms/netmgt/collection/core}/DefaultCollectdInstrumentation.java
  15. +26 −206 ...res/collection/core/src/main/java/org/opennms/netmgt/collection/core}/DefaultCollectionAgent.java
  16. +1 −1 ...lection/core/src/main/java/org/opennms/netmgt/collection/core}/DefaultCollectionAgentFactory.java
  17. +24 −150 ...lection/core/src/main/java/org/opennms/netmgt/collection/core}/DefaultCollectionAgentService.java
  18. +1 −0 features/collection/pom.xml
  19. +0 −10 ...collection/shell-commands/src/main/java/org/opennms/netmgt/collection/commands/StressCommand.java
  20. +12 −2 features/collection/test-api/pom.xml
  21. +10 −5 ...ection/test-api/src/main/java/org/opennms/netmgt/collection/test/api/CollectorComplianceTest.java
  22. +5 −3 ...collection/test-api/src/main/java/org/opennms/netmgt/collection/test/api}/CollectorTestUtils.java
  23. +1 −1 ...res/juniper-tca-collector/src/main/java/org/opennms/netmgt/collectd/tca/TcaCollectionHandler.java
  24. +9 −0 ...juniper-tca-collector/src/test/java/org/opennms/netmgt/collectd/tca/TcaCollectorComplianceIT.java
  25. +2 −2 features/juniper-tca-collector/src/test/java/org/opennms/netmgt/collectd/tca/TcaCollectorIT.java
  26. +1 −1 features/telemetry/daemon/src/main/resources/META-INF/opennms/applicationContext-telemetryDaemon.xml
  27. +14 −0 opennms-services/pom.xml
  28. +8 −3 opennms-services/src/main/java/org/opennms/netmgt/collectd/CollectableService.java
  29. +2 −0 opennms-services/src/main/java/org/opennms/netmgt/collectd/Collectd.java
  30. +224 −0 opennms-services/src/main/java/org/opennms/netmgt/collectd/DefaultSnmpCollectionAgent.java
  31. +181 −0 opennms-services/src/main/java/org/opennms/netmgt/collectd/DefaultSnmpCollectionAgentService.java
  32. +0 −9 opennms-services/src/main/java/org/opennms/netmgt/collectd/SnmpCollectionAgent.java
  33. +77 −0 opennms-services/src/main/java/org/opennms/netmgt/collectd/SnmpCollectionAgentService.java
  34. +3 −0 opennms-services/src/main/java/org/opennms/netmgt/collectd/SnmpCollectionSet.java
  35. +1 −1 opennms-services/src/main/resources/META-INF/opennms/applicationContext-collectd.xml
  36. +1 −0 opennms-services/src/test/java/org/opennms/netmgt/collectd/CollectableServiceTest.java
  37. +1 −0 opennms-services/src/test/java/org/opennms/netmgt/collectd/CollectdIntegrationTest.java
  38. +1 −0 opennms-services/src/test/java/org/opennms/netmgt/collectd/CollectdTest.java
  39. +14 −7 opennms-services/src/test/java/org/opennms/netmgt/collectd/DefaultCollectionAgentTest.java
  40. +1 −0 opennms-services/src/test/java/org/opennms/netmgt/collectd/DuplicatePrimaryAddressIT.java
  41. +4 −0 ...ion/collectors → opennms-services}/src/test/java/org/opennms/netmgt/collectd/HttpCollectorIT.java
  42. +1 −1 opennms-services/src/test/java/org/opennms/netmgt/collectd/PersistRegexSelectorStrategyTest.java
  43. +1 −1 opennms-services/src/test/java/org/opennms/netmgt/collectd/RrdPersistOperationBuilderTest.java
  44. +3 −4 opennms-services/src/test/java/org/opennms/netmgt/collectd/SnmpAttributeTest.java
  45. +5 −3 opennms-services/src/test/java/org/opennms/netmgt/collectd/SnmpCollectorIT.java
  46. +1 −1 opennms-services/src/test/java/org/opennms/netmgt/collectd/SnmpCollectorITCase.java
  47. +4 −3 opennms-services/src/test/java/org/opennms/netmgt/collectd/SnmpCollectorMinMaxValIT.java
  48. +4 −3 opennms-services/src/test/java/org/opennms/netmgt/collectd/SnmpCollectorWithMibPropertiesIT.java
  49. +2 −2 opennms-services/src/test/java/org/opennms/netmgt/collection/persistence/rrd/BasePersisterTest.java
  50. 0 ...ollection/collectors → opennms-services}/src/test/resources/HttpCollector_UnitTest2_127.0.0.1.txt
  51. 0 ...collection/collectors → opennms-services}/src/test/resources/HttpCollector_UnitTest_127.0.0.1.txt
  52. 0 ...ennms-services}/src/test/resources/org/opennms/netmgt/config/http-datacollection-broken-regex.xml
  53. 0 ...rvices}/src/test/resources/org/opennms/netmgt/config/http-datacollection-config-NMS4886-https.xml
  54. 0 ...nms-services}/src/test/resources/org/opennms/netmgt/config/http-datacollection-config-NMS4886.xml
  55. 0 ...s → opennms-services}/src/test/resources/org/opennms/netmgt/config/http-datacollection-config.xml
  56. 0 ...rvices}/src/test/resources/org/opennms/netmgt/config/http-datacollection-persist-apache-stats.xml
  57. 0 ...s}/src/test/resources/org/opennms/netmgt/config/http-datacollection-persist-https-test-config.xml
  58. 0 ...ervices}/src/test/resources/org/opennms/netmgt/config/http-datacollection-persist-test-config.xml
  59. 0 {features/collection/collectors → opennms-services}/src/test/resources/server-status/index.html
  60. +5 −0 pom.xml
  61. +1 −1 protocols/nsclient/src/test/java/org/opennms/protocols/nsclient/collector/NsclientCollectorTest.java
@@ -131,13 +131,6 @@ public String getHostAddress() {
return ipAddress.getHostAddress();
}
/* (non-Javadoc)
* @see org.opennms.netmgt.collection.api.CollectionAgent#setSavedIfCount(int)
*/
@Override
public void setSavedIfCount(int ifCount) {
}
/* (non-Javadoc)
* @see org.opennms.netmgt.collection.api.CollectionAgent#getNodeId()
*/
@@ -190,14 +183,6 @@ public ResourcePath getStorageResourcePath() {
}
}
/* (non-Javadoc)
* @see org.opennms.netmgt.collection.api.CollectionAgent#getSysObjectId()
*/
@Override
public String getSysObjectId() {
return null;
}
/* (non-Javadoc)
* @see org.opennms.netmgt.collection.api.CollectionAgent#getSavedSysUpTime()
*/
@@ -114,13 +114,6 @@
*/
String getHostAddress();
/**
* <p>setSavedIfCount</p>
*
* @param ifCount a int.
*/
void setSavedIfCount(int ifCount);
/**
* <p>getNodeId</p>
*
@@ -157,13 +150,6 @@
String getLocationName();
ResourcePath getStorageResourcePath();
/**
* <p>getSysObjectId</p>
*
* @return a {@link java.lang.String} object.
*/
String getSysObjectId();
/**
* <p>getSavedSysUpTime</p>
@@ -26,14 +26,11 @@
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.collectd;
package org.opennms.netmgt.collection.api;
import java.net.InetAddress;
import java.util.Set;
import org.opennms.netmgt.model.PrimaryType;
import org.opennms.netmgt.model.ResourcePath;
import org.opennms.netmgt.snmp.SnmpAgentConfig;
/**
* <p>CollectionAgentService interface.</p>
@@ -48,93 +45,50 @@
*
* @return a {@link java.lang.String} object.
*/
public abstract String getHostAddress();
/**
* <p>isStoreByForeignSource</p>
*
* @return a {@link java.lang.Boolean} object.
*/
public abstract Boolean isStoreByForeignSource();
String getHostAddress();
/**
* <p>getForeignSource</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getForeignSource();
String getForeignSource();
/**
* <p>getForeignId</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getForeignId();
String getForeignId();
/**
* <p>getLocationName</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getLocationName();
public abstract ResourcePath getStorageResourcePath();
String getLocationName();
ResourcePath getStorageResourcePath();
/**
* <p>getNodeId</p>
*
* @return a int.
*/
public abstract int getNodeId();
int getNodeId();
/**
* <p>getNodeLabel</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getNodeLabel();
/**
* <p>getIfIndex</p>
*
* @return a int.
*/
public abstract int getIfIndex();
/**
* <p>getSysObjectId</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getSysObjectId();
/**
* <p>getIsSnmpPrimary</p>
*
* @return a {@link org.opennms.netmgt.model.PrimaryType} object.
*/
public abstract PrimaryType getIsSnmpPrimary();
/**
* <p>getAgentConfig</p>
*
* @return a {@link org.opennms.netmgt.snmp.SnmpAgentConfig} object.
*/
public abstract SnmpAgentConfig getAgentConfig();
String getNodeLabel();
/**
* <p>getSnmpInterfaceData</p>
*
* @return a {@link java.util.Set} object.
*/
public abstract Set<SnmpIfData> getSnmpInterfaceData();
/**
* <p>getInetAddress</p>
*
* @return a {@link java.net.InetAddress} object.
*/
public abstract InetAddress getInetAddress();
InetAddress getInetAddress();
}
@@ -26,10 +26,7 @@
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.collectd;
import org.opennms.netmgt.collection.api.CollectionException;
import org.opennms.netmgt.collection.api.CollectionStatus;
package org.opennms.netmgt.collection.api;
/**
* <p>CollectionFailed class.</p>
@@ -26,9 +26,7 @@
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.collectd;
import org.opennms.netmgt.collection.api.CollectionException;
package org.opennms.netmgt.collection.api;
/**
* <p>CollectionTimedOut class.</p>
@@ -26,9 +26,7 @@
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.collectd;
import org.opennms.netmgt.collection.api.CollectionException;
package org.opennms.netmgt.collection.api;
/**
* This exception should be thrown by a {@link ServiceCollector} when
@@ -26,9 +26,7 @@
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.collectd;
import org.opennms.netmgt.collection.api.CollectionException;
package org.opennms.netmgt.collection.api;
/**
* <p>CollectionWarning class.</p>
@@ -79,9 +79,6 @@
@XmlAttribute(name = "storage-resource-path")
private String storageResourcePath;
@XmlAttribute(name = "sys-object-id")
private String sysObjectId;
@XmlAttribute(name = "sys-up-time")
private long sysUpTime;
@@ -100,7 +97,6 @@ public CollectionAgentDTO(CollectionAgent agent) {
foreignId = agent.getForeignId();
location = agent.getLocationName();
setStorageResourcePath(agent.getStorageResourcePath());
sysObjectId = agent.getSysObjectId();
sysUpTime = agent.getSavedSysUpTime();
}
@@ -161,11 +157,6 @@ public String getHostAddress() {
return address != null ? InetAddrUtils.str(address) : null;
}
@Override
public void setSavedIfCount(int ifCount) {
throw new UnsupportedOperationException();
}
@Override
public int getNodeId() {
return nodeId;
@@ -220,15 +211,6 @@ public void setStorageResourcePath(ResourcePath storageResourcePath) {
this.storageResourcePath = storageResourcePath != null ? ResourcePath.toString(storageResourcePath) : null;
}
@Override
public String getSysObjectId() {
return sysObjectId;
}
public void setSysObjectId(String sysObjectId) {
this.sysObjectId = sysObjectId;
}
@Override
public long getSavedSysUpTime() {
return sysUpTime;
@@ -245,14 +227,14 @@ public String toString() {
+ "nodeId=%d, nodeLabel=%s, foreignSource=%s, foreignId=%s, location=%s, storageDir=%s, "
+ "sysObjectId=%s, sysUpTime=%d]",
attributes, address != null ? InetAddrUtils.str(address) : null, storeByForeignSource,
nodeId, nodeLabel, foreignSource, foreignId, location, storageResourcePath, sysObjectId, sysUpTime);
nodeId, nodeLabel, foreignSource, foreignId, location, storageResourcePath, sysUpTime);
}
@Override
public int hashCode() {
return Objects.hash(attributes, address, storeByForeignSource,
nodeId, nodeLabel, foreignSource, foreignId, location,
storageResourcePath, sysObjectId, sysUpTime);
storageResourcePath, sysUpTime);
}
@Override
@@ -274,7 +256,6 @@ public boolean equals(Object obj) {
Objects.equals(this.foreignId, other.foreignId) &&
Objects.equals(this.location, other.location) &&
Objects.equals(this.storageResourcePath, other.storageResourcePath) &&
Objects.equals(this.sysObjectId, other.sysObjectId) &&
Objects.equals(this.sysUpTime, other.sysUpTime);
}
}
@@ -56,13 +56,12 @@ public CollectionAgentDTOTest(CollectionAgentDTO sampleObject, Object sampleXml)
collectionAgentDTO.setForeignId("fid");
collectionAgentDTO.setLocationName("HQ");
collectionAgentDTO.setStorageResourcePath(ResourcePath.get("tmp", "foo"));
collectionAgentDTO.setSysObjectId(".1.3.6");
collectionAgentDTO.setSavedSysUpTime(149);
return Arrays.asList(new Object[][] {
{
collectionAgentDTO,
"<agent address=\"192.168.1.1\" store-by-fs=\"true\" node-id=\"99\" node-label=\"switch\" foreign-source=\"fs\" foreign-id=\"fid\" location=\"HQ\" storage-resource-path=\"tmp/foo\" sys-object-id=\".1.3.6\" sys-up-time=\"149\">\n" +
"<agent address=\"192.168.1.1\" store-by-fs=\"true\" node-id=\"99\" node-label=\"switch\" foreign-source=\"fs\" foreign-id=\"fid\" location=\"HQ\" storage-resource-path=\"tmp/foo\" sys-up-time=\"149\">\n" +
" <attribute key=\"k1\"><![CDATA[v1]]></attribute>\n" +
"</agent>"
}
@@ -54,18 +54,6 @@
<artifactId>opennms-dao-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms</groupId>
<artifactId>opennms-services</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms</groupId>
<artifactId>opennms-services</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opennms.core.test-api</groupId>
<artifactId>org.opennms.core.test-api.collection</artifactId>

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit d37bed8

Please sign in to comment.