diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/items/MetadataRegistryImpl.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/items/MetadataRegistryImpl.java index 26dde09016e..f7cafcf8cd1 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/items/MetadataRegistryImpl.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/internal/items/MetadataRegistryImpl.java @@ -43,8 +43,10 @@ public class MetadataRegistryImpl extends AbstractRegistry implements MetadataRegistry { - public MetadataRegistryImpl() { + @Activate + public MetadataRegistryImpl(final @Reference ReadyService readyService) { super(MetadataProvider.class); + super.setReadyService(readyService); } @Override diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataCommandDescriptionProviderTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataCommandDescriptionProviderTest.java index 9834de4c391..926e7649b2c 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataCommandDescriptionProviderTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataCommandDescriptionProviderTest.java @@ -30,6 +30,7 @@ import org.openhab.core.items.ManagedMetadataProvider; import org.openhab.core.items.Metadata; import org.openhab.core.items.MetadataKey; +import org.openhab.core.service.ReadyService; import org.openhab.core.types.CommandDescription; import org.openhab.core.types.CommandOption; import org.osgi.framework.BundleContext; @@ -52,6 +53,7 @@ public class MetadataCommandDescriptionProviderTest { private @Mock @NonNullByDefault({}) ManagedMetadataProvider managedProviderMock; private @Mock @NonNullByDefault({}) MetadataRegistryImpl metadataRegistryMock; + private @Mock @NonNullByDefault({}) ReadyService readyServiceMock; private @NonNullByDefault({}) MetadataCommandDescriptionProvider commandDescriptionProvider; private @NonNullByDefault({}) ServiceListener providerTracker; @@ -61,7 +63,7 @@ public class MetadataCommandDescriptionProviderTest { public void setup() throws Exception { when(bundleContextMock.getService(same(managedProviderRefMock))).thenReturn(managedProviderMock); - metadataRegistryMock = new MetadataRegistryImpl(); + metadataRegistryMock = new MetadataRegistryImpl(readyServiceMock); metadataRegistryMock.setManagedProvider(managedProviderMock); metadataRegistryMock.activate(bundleContextMock); metadataRegistryMock.waitForCompletedAsyncActivationTasks(); diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataRegistryImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataRegistryImplTest.java index 4ea5492ec14..dbb2516c811 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataRegistryImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataRegistryImplTest.java @@ -28,6 +28,7 @@ import org.openhab.core.items.ManagedMetadataProvider; import org.openhab.core.items.Metadata; import org.openhab.core.items.MetadataKey; +import org.openhab.core.service.ReadyService; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; @@ -44,6 +45,7 @@ public class MetadataRegistryImplTest { private @Mock @NonNullByDefault({}) ServiceReference managedProviderRefMock; private @Mock @NonNullByDefault({}) BundleContext bundleContextMock; private @Mock @NonNullByDefault({}) ManagedMetadataProvider managedProviderMock; + private @Mock @NonNullByDefault({}) ReadyService readyServiceMock; private @NonNullByDefault({}) MetadataRegistryImpl registry; private @NonNullByDefault({}) ServiceListener providerTracker; @@ -53,7 +55,7 @@ public class MetadataRegistryImplTest { public void setup() throws Exception { when(bundleContextMock.getService(same(managedProviderRefMock))).thenReturn(managedProviderMock); - registry = new MetadataRegistryImpl(); + registry = new MetadataRegistryImpl(readyServiceMock); registry.setManagedProvider(managedProviderMock); registry.activate(bundleContextMock); registry.waitForCompletedAsyncActivationTasks(); diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataStateDescriptionFragmentProviderTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataStateDescriptionFragmentProviderTest.java index a01dad3d03b..0891736188a 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataStateDescriptionFragmentProviderTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/MetadataStateDescriptionFragmentProviderTest.java @@ -31,6 +31,7 @@ import org.openhab.core.items.ManagedMetadataProvider; import org.openhab.core.items.Metadata; import org.openhab.core.items.MetadataKey; +import org.openhab.core.service.ReadyService; import org.openhab.core.types.StateDescriptionFragment; import org.openhab.core.types.StateOption; import org.osgi.framework.BundleContext; @@ -53,6 +54,8 @@ public class MetadataStateDescriptionFragmentProviderTest { private @Mock @NonNullByDefault({}) ManagedMetadataProvider managedProviderMock; private @Mock @NonNullByDefault({}) MetadataRegistryImpl metadataRegistryMock; + private @Mock @NonNullByDefault({}) ReadyService readyServiceMock; + private @NonNullByDefault({}) MetadataStateDescriptionFragmentProvider stateDescriptionFragmentProvider; private @NonNullByDefault({}) ServiceListener providerTracker; @@ -62,7 +65,7 @@ public class MetadataStateDescriptionFragmentProviderTest { public void setup() throws Exception { when(bundleContextMock.getService(same(managedProviderRefMock))).thenReturn(managedProviderMock); - metadataRegistryMock = new MetadataRegistryImpl(); + metadataRegistryMock = new MetadataRegistryImpl(readyServiceMock); metadataRegistryMock.setManagedProvider(managedProviderMock); metadataRegistryMock.activate(bundleContextMock); metadataRegistryMock.waitForCompletedAsyncActivationTasks();