Class AbstractStorageIntegrationTest
- java.lang.Object
-
- org.opennms.integration.api.v1.timeseries.AbstractStorageIntegrationTest
-
public abstract class AbstractStorageIntegrationTest extends java.lang.ObjectExtend this class in order to create an integration test for your TimeSeriesStorage plugin. It simulates typical calls that you would expect from OpenNMS.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<org.opennms.integration.api.v1.timeseries.Metric>metricsprotected java.time.InstantreferenceTimeprotected java.util.List<org.opennms.integration.api.v1.timeseries.Sample>samplesOfFirstMetricprotected org.opennms.integration.api.v1.timeseries.TimeSeriesStoragestorage
-
Constructor Summary
Constructors Constructor Description AbstractStorageIntegrationTest()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static org.opennms.integration.api.v1.timeseries.MetriccreateMetric(java.lang.String uuid, int nodeId)protected static java.util.List<org.opennms.integration.api.v1.timeseries.Metric>createMetrics()protected static org.opennms.integration.api.v1.timeseries.SamplecreateSampleForMetric(org.opennms.integration.api.v1.timeseries.Metric metric, int index, java.time.Instant referenceTime)protected java.util.List<org.opennms.integration.api.v1.timeseries.Sample>createSamplesForMetric(org.opennms.integration.api.v1.timeseries.Metric metric)protected abstract org.opennms.integration.api.v1.timeseries.TimeSeriesStoragecreateStorage()Create the TimeSeriesStorage implementation.protected java.util.List<org.opennms.integration.api.v1.timeseries.Sample>loadSamplesForMetric(org.opennms.integration.api.v1.timeseries.Metric metric)voidsetUp()voidshouldDeleteMetrics()voidshouldFindOneMetricWithRegexMatching()voidshouldFindOneMetricWithRegexNotMatching()voidshouldFindOneMetricWithUniqueTag()voidshouldFindWithNotEquals()voidshouldGetSamplesForMetric()voidshouldLoadMultipleMetricsWithSameTag()voidshouldThrowExceptionWhenFindCalledWithoutTagMatcher()protected voidwaitForPersistingChanges()Default implementation does nothing.
-
-
-
Field Detail
-
metrics
protected java.util.List<org.opennms.integration.api.v1.timeseries.Metric> metrics
-
samplesOfFirstMetric
protected java.util.List<org.opennms.integration.api.v1.timeseries.Sample> samplesOfFirstMetric
-
storage
protected org.opennms.integration.api.v1.timeseries.TimeSeriesStorage storage
-
referenceTime
protected java.time.Instant referenceTime
-
-
Method Detail
-
setUp
public void setUp() throws java.lang.Exception- Throws:
java.lang.Exception
-
createStorage
protected abstract org.opennms.integration.api.v1.timeseries.TimeSeriesStorage createStorage() throws java.lang.ExceptionCreate the TimeSeriesStorage implementation. This method is called once per test method invocation (called in setUp()). If the creation is expensive you might want to do it only once per test class.- Throws:
java.lang.Exception
-
waitForPersistingChanges
protected void waitForPersistingChanges() throws java.lang.ExceptionDefault implementation does nothing. You might want to override and add a wait in case persisting is not handled synchronously.- Throws:
java.lang.Exception
-
shouldLoadMultipleMetricsWithSameTag
public void shouldLoadMultipleMetricsWithSameTag() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldFindOneMetricWithUniqueTag
public void shouldFindOneMetricWithUniqueTag() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldFindOneMetricWithRegexMatching
public void shouldFindOneMetricWithRegexMatching() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldFindWithNotEquals
public void shouldFindWithNotEquals() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldFindOneMetricWithRegexNotMatching
public void shouldFindOneMetricWithRegexNotMatching() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldThrowExceptionWhenFindCalledWithoutTagMatcher
public void shouldThrowExceptionWhenFindCalledWithoutTagMatcher() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldGetSamplesForMetric
public void shouldGetSamplesForMetric() throws java.lang.Exception- Throws:
java.lang.Exception
-
shouldDeleteMetrics
public void shouldDeleteMetrics() throws java.lang.Exception- Throws:
java.lang.Exception
-
loadSamplesForMetric
protected java.util.List<org.opennms.integration.api.v1.timeseries.Sample> loadSamplesForMetric(org.opennms.integration.api.v1.timeseries.Metric metric) throws java.lang.Exception- Throws:
java.lang.Exception
-
createSamplesForMetric
protected java.util.List<org.opennms.integration.api.v1.timeseries.Sample> createSamplesForMetric(org.opennms.integration.api.v1.timeseries.Metric metric)
-
createSampleForMetric
protected static org.opennms.integration.api.v1.timeseries.Sample createSampleForMetric(org.opennms.integration.api.v1.timeseries.Metric metric, int index, java.time.Instant referenceTime)
-
createMetrics
protected static java.util.List<org.opennms.integration.api.v1.timeseries.Metric> createMetrics()
-
createMetric
protected static org.opennms.integration.api.v1.timeseries.Metric createMetric(java.lang.String uuid, int nodeId)
-
-