Class AbstractStorageIntegrationTest


  • public abstract class AbstractStorageIntegrationTest
    extends java.lang.Object
    Extend this class in order to create an integration test for your TimeSeriesStorage plugin. It simulates typical calls that you would expect from OpenNMS.
    • Field Detail

      • metrics

        protected java.util.List<org.opennms.integration.api.v1.timeseries.Metric> metrics
      • timeSeriesDataOfFirstMetric

        protected org.opennms.integration.api.v1.timeseries.TimeSeriesData timeSeriesDataOfFirstMetric
      • storage

        protected org.opennms.integration.api.v1.timeseries.TimeSeriesStorage storage
      • referenceTime

        protected java.time.Instant referenceTime
    • Constructor Detail

      • AbstractStorageIntegrationTest

        public AbstractStorageIntegrationTest()
    • 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.Exception
        Create 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.Exception
        Default 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
      • loadTimeSeriesDataForMetric

        protected org.opennms.integration.api.v1.timeseries.TimeSeriesData loadTimeSeriesDataForMetric​(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)