diff --git a/bom/compile-model/pom.xml b/bom/compile-model/pom.xml index 893a0a4f4..da8ad9007 100644 --- a/bom/compile-model/pom.xml +++ b/bom/compile-model/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/compile/pom.xml b/bom/compile/pom.xml index d808a0f7c..355230a6a 100644 --- a/bom/compile/pom.xml +++ b/bom/compile/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 @@ -220,7 +222,7 @@ compile - + com.hivemq hivemq-mqtt-client @@ -242,7 +244,7 @@ + compile --> org.vesalainen.comm javaxcomm diff --git a/bom/openhab-core-index/pom.xml b/bom/openhab-core-index/pom.xml index b952b3774..7cddc70e8 100644 --- a/bom/openhab-core-index/pom.xml +++ b/bom/openhab-core-index/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/openhab-core/pom.xml b/bom/openhab-core/pom.xml index 825ed32fd..0fa7c7a00 100644 --- a/bom/openhab-core/pom.xml +++ b/bom/openhab-core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/pom.xml b/bom/pom.xml index 9db79e5ed..0409992bb 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/runtime-index/pom.xml b/bom/runtime-index/pom.xml index 62b787983..b430623d5 100644 --- a/bom/runtime-index/pom.xml +++ b/bom/runtime-index/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/runtime/pom.xml b/bom/runtime/pom.xml index 615284fc0..34c3377ab 100644 --- a/bom/runtime/pom.xml +++ b/bom/runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 @@ -460,7 +462,7 @@ compile - + com.hivemq hivemq-mqtt-client diff --git a/bom/test-index/pom.xml b/bom/test-index/pom.xml index 77c18d560..68ad47be6 100644 --- a/bom/test-index/pom.xml +++ b/bom/test-index/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bom/test/pom.xml b/bom/test/pom.xml index 2d45aba27..825d7ed41 100644 --- a/bom/test/pom.xml +++ b/bom/test/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.audio/pom.xml b/bundles/org.openhab.core.audio/pom.xml index d83db69e6..a13569e1a 100644 --- a/bundles/org.openhab.core.audio/pom.xml +++ b/bundles/org.openhab.core.audio/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioConsoleCommandExtension.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioConsoleCommandExtension.java index 4cebd55d7..493cbcb0a 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioConsoleCommandExtension.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioConsoleCommandExtension.java @@ -27,10 +27,10 @@ import org.openhab.core.audio.AudioManager; import org.openhab.core.audio.AudioSink; import org.openhab.core.audio.AudioSource; import org.openhab.core.i18n.LocaleProvider; -import org.openhab.core.library.types.PercentType; import org.openhab.core.io.console.Console; import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; import org.openhab.core.io.console.extensions.ConsoleCommandExtension; +import org.openhab.core.library.types.PercentType; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java index d0bb2b56a..c02fa1da5 100644 --- a/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java +++ b/bundles/org.openhab.core.audio/src/main/java/org/openhab/core/audio/internal/AudioManagerImpl.java @@ -28,10 +28,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.config.core.ConfigOptionProvider; -import org.openhab.core.config.core.ConfigurableService; -import org.openhab.core.config.core.ParameterOption; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioManager; import org.openhab.core.audio.AudioSink; @@ -41,6 +37,10 @@ import org.openhab.core.audio.FileAudioStream; import org.openhab.core.audio.URLAudioStream; import org.openhab.core.audio.UnsupportedAudioFormatException; import org.openhab.core.audio.UnsupportedAudioStreamException; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.config.core.ConfigOptionProvider; +import org.openhab.core.config.core.ConfigurableService; +import org.openhab.core.config.core.ParameterOption; import org.openhab.core.library.types.PercentType; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AbstractAudioServletTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AbstractAudioServletTest.java index 9b9ca5c12..d5f260375 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AbstractAudioServletTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AbstractAudioServletTest.java @@ -21,6 +21,8 @@ import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.servlet.ServletHolder; +import org.junit.After; +import org.junit.Before; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioStream; import org.openhab.core.audio.ByteArrayAudioStream; @@ -28,8 +30,6 @@ import org.openhab.core.audio.FixedLengthAudioStream; import org.openhab.core.test.TestPortUtil; import org.openhab.core.test.TestServer; import org.openhab.core.test.java.JavaTest; -import org.junit.After; -import org.junit.Before; /** * Base class for tests using the {@link AudioServlet}. diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioConsoleTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioConsoleTest.java index eae9e666c..65a4d060e 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioConsoleTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioConsoleTest.java @@ -20,6 +20,9 @@ import java.io.File; import java.io.IOException; import java.util.Locale; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioSource; @@ -30,9 +33,6 @@ import org.openhab.core.audio.internal.fake.AudioSinkFake; import org.openhab.core.audio.internal.utils.BundledSoundFileHandler; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.io.console.Console; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * OSGi test for {@link AudioConsoleCommandExtension} diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioFormatTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioFormatTest.java index 658ca0109..8901013cc 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioFormatTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioFormatTest.java @@ -18,8 +18,8 @@ import static org.junit.Assert.assertThat; import java.util.HashSet; import java.util.Set; -import org.openhab.core.audio.AudioFormat; import org.junit.Test; +import org.openhab.core.audio.AudioFormat; /** * OSGi test for {@link AudioFormat} diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerServletTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerServletTest.java index 340dd9b5e..d6dd52572 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerServletTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerServletTest.java @@ -15,13 +15,13 @@ package org.openhab.core.audio.internal; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioStream; import org.openhab.core.audio.ByteArrayAudioStream; import org.openhab.core.audio.URLAudioStream; import org.openhab.core.audio.internal.fake.AudioSinkFake; -import org.junit.Before; -import org.junit.Test; /** * OSGi test for {@link AudioManagerImpl} diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerTest.java index 79be18c58..aa6616ff5 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioManagerTest.java @@ -25,7 +25,9 @@ import java.util.Collections; import java.util.Locale; import java.util.function.BiFunction; -import org.openhab.core.config.core.ParameterOption; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.audio.AudioException; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioSource; @@ -35,10 +37,8 @@ import org.openhab.core.audio.FileAudioStream; import org.openhab.core.audio.UnsupportedAudioStreamException; import org.openhab.core.audio.internal.fake.AudioSinkFake; import org.openhab.core.audio.internal.utils.BundledSoundFileHandler; +import org.openhab.core.config.core.ParameterOption; import org.openhab.core.library.types.PercentType; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * OSGi test for {@link AudioManagerImpl} diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioServletTest.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioServletTest.java index 377d5dbe0..ed8895692 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioServletTest.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/AudioServletTest.java @@ -21,11 +21,11 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.http.HttpStatus; +import org.junit.Test; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioStream; import org.openhab.core.audio.FileAudioStream; import org.openhab.core.audio.internal.utils.BundledSoundFileHandler; -import org.junit.Test; /** * Test cases for {@link AudioServlet} diff --git a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/utils/BundledSoundFileHandler.java b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/utils/BundledSoundFileHandler.java index 4a070b929..d8795b488 100644 --- a/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/utils/BundledSoundFileHandler.java +++ b/bundles/org.openhab.core.audio/src/test/java/org/openhab/core/audio/internal/utils/BundledSoundFileHandler.java @@ -22,8 +22,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; -import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.audio.internal.AudioManagerTest; +import org.openhab.core.config.core.ConfigConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.auth.jaas/pom.xml b/bundles/org.openhab.core.auth.jaas/pom.xml index 08f840c83..7de86b64a 100644 --- a/bundles/org.openhab.core.auth.jaas/pom.xml +++ b/bundles/org.openhab.core.auth.jaas/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.auth.oauth2client/pom.xml b/bundles/org.openhab.core.auth.oauth2client/pom.xml index 9e96f8952..dd690464f 100644 --- a/bundles/org.openhab.core.auth.oauth2client/pom.xml +++ b/bundles/org.openhab.core.auth.oauth2client/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/Keyword.java b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/Keyword.java index 189cc1b52..2e2e35c44 100644 --- a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/Keyword.java +++ b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/Keyword.java @@ -19,22 +19,22 @@ package org.openhab.core.auth.oauth2client.internal; */ public interface Keyword { - String CLIENT_ID = "client_id"; - String CLIENT_SECRET = "client_secret"; + String CLIENT_ID = "client_id"; + String CLIENT_SECRET = "client_secret"; - String GRANT_TYPE = "grant_type"; - String USERNAME = "username"; - String PASSWORD = "password"; - String CLIENT_CREDENTIALS = "client_credentials"; - String AUTHORIZATION_CODE = "authorization_code"; + String GRANT_TYPE = "grant_type"; + String USERNAME = "username"; + String PASSWORD = "password"; + String CLIENT_CREDENTIALS = "client_credentials"; + String AUTHORIZATION_CODE = "authorization_code"; - String SCOPE = "scope"; + String SCOPE = "scope"; - String REFRESH_TOKEN = "refresh_token"; - String REDIRECT_URI = "redirect_uri"; + String REFRESH_TOKEN = "refresh_token"; + String REDIRECT_URI = "redirect_uri"; - String CODE = "code"; // https://tools.ietf.org/html/rfc6749#section-4.1 + String CODE = "code"; // https://tools.ietf.org/html/rfc6749#section-4.1 - String STATE = "state"; // https://tools.ietf.org/html/rfc6749#section-4.1 + String STATE = "state"; // https://tools.ietf.org/html/rfc6749#section-4.1 } diff --git a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthStoreHandlerImpl.java b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthStoreHandlerImpl.java index 44d73d6ef..a9d42ac02 100644 --- a/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthStoreHandlerImpl.java +++ b/bundles/org.openhab.core.auth.oauth2client/src/main/java/org/openhab/core/auth/oauth2client/internal/OAuthStoreHandlerImpl.java @@ -28,9 +28,9 @@ import java.util.concurrent.locks.ReentrantLock; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.auth.oauth2client.internal.cipher.SymmetricKeyCipher; import org.openhab.core.auth.client.oauth2.AccessTokenResponse; import org.openhab.core.auth.client.oauth2.StorageCipher; +import org.openhab.core.auth.oauth2client.internal.cipher.SymmetricKeyCipher; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.automation.module.media/pom.xml b/bundles/org.openhab.core.automation.module.media/pom.xml index 3fcbb7a83..62cd75355 100644 --- a/bundles/org.openhab.core.automation.module.media/pom.xml +++ b/bundles/org.openhab.core.automation.module.media/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java index 324569b5a..76816a020 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaActionTypeProvider.java @@ -24,18 +24,18 @@ import java.util.stream.Stream; import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.audio.AudioManager; +import org.openhab.core.audio.AudioSink; +import org.openhab.core.automation.Visibility; +import org.openhab.core.automation.type.ActionType; +import org.openhab.core.automation.type.ModuleType; +import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.audio.AudioManager; -import org.openhab.core.audio.AudioSink; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.automation.Visibility; -import org.openhab.core.automation.type.ActionType; -import org.openhab.core.automation.type.ModuleType; -import org.openhab.core.automation.type.ModuleTypeProvider; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaModuleHandlerFactory.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaModuleHandlerFactory.java index 9d77c89f2..627f3df2f 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaModuleHandlerFactory.java @@ -18,12 +18,12 @@ import static java.util.Collections.unmodifiableList; import java.util.Collection; import org.openhab.core.audio.AudioManager; -import org.openhab.core.voice.VoiceManager; import org.openhab.core.automation.Action; import org.openhab.core.automation.Module; import org.openhab.core.automation.handler.BaseModuleHandlerFactory; import org.openhab.core.automation.handler.ModuleHandler; import org.openhab.core.automation.handler.ModuleHandlerFactory; +import org.openhab.core.voice.VoiceManager; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaScriptScopeProvider.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaScriptScopeProvider.java index a0aaabc36..25172c0ce 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaScriptScopeProvider.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/MediaScriptScopeProvider.java @@ -18,8 +18,8 @@ import java.util.HashMap; import java.util.Map; import org.openhab.core.audio.AudioManager; -import org.openhab.core.voice.VoiceManager; import org.openhab.core.automation.module.script.ScriptExtensionProvider; +import org.openhab.core.voice.VoiceManager; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java index 9c9f20628..498f67a19 100644 --- a/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java +++ b/bundles/org.openhab.core.automation.module.media/src/main/java/org/openhab/core/automation/module/media/internal/SayActionHandler.java @@ -14,9 +14,9 @@ package org.openhab.core.automation.module.media.internal; import java.util.Map; -import org.openhab.core.voice.VoiceManager; import org.openhab.core.automation.Action; import org.openhab.core.automation.handler.BaseActionModuleHandler; +import org.openhab.core.voice.VoiceManager; /** * This is an ModuleHandler implementation for Actions that trigger a TTS output through "say". diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/pom.xml b/bundles/org.openhab.core.automation.module.script.rulesupport/pom.xml index 44e542254..814a9c674 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/pom.xml +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/RuleSupportScriptExtension.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/RuleSupportScriptExtension.java index 5cb1f4a02..478759294 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/RuleSupportScriptExtension.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/RuleSupportScriptExtension.java @@ -21,8 +21,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Rule; @@ -47,6 +45,8 @@ import org.openhab.core.automation.util.ActionBuilder; import org.openhab.core.automation.util.ConditionBuilder; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.TriggerBuilder; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/ScriptedCustomModuleTypeProvider.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/ScriptedCustomModuleTypeProvider.java index 4ed8ccfa7..e95aee708 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/ScriptedCustomModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/ScriptedCustomModuleTypeProvider.java @@ -21,9 +21,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.service.component.annotations.Component; /** diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/loader/ScriptFileWatcher.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/loader/ScriptFileWatcher.java index d6e0b0aad..04cb747f1 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/loader/ScriptFileWatcher.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/internal/loader/ScriptFileWatcher.java @@ -35,10 +35,10 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.service.AbstractWatchService; import org.openhab.core.automation.module.script.ScriptEngineContainer; import org.openhab.core.automation.module.script.ScriptEngineManager; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.service.AbstractWatchService; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/RuleSupportRuleRegistryDelegate.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/RuleSupportRuleRegistryDelegate.java index 47bebec27..b269d34fc 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/RuleSupportRuleRegistryDelegate.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/RuleSupportRuleRegistryDelegate.java @@ -19,9 +19,9 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.automation.Rule; import org.openhab.core.automation.RuleRegistry; +import org.openhab.core.common.registry.RegistryChangeListener; /** * The {@link RuleSupportRuleRegistryDelegate} is wrapping a {@link RuleRegistry} to provide a comfortable way to add diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedAutomationManager.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedAutomationManager.java index 2f1617c8f..3064af7a8 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedAutomationManager.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedAutomationManager.java @@ -17,7 +17,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Rule; @@ -36,6 +35,7 @@ import org.openhab.core.automation.type.TriggerType; import org.openhab.core.automation.util.ActionBuilder; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedRuleProvider.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedRuleProvider.java index 14666c886..ed41861ff 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedRuleProvider.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/ScriptedRuleProvider.java @@ -17,9 +17,9 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.Rule; import org.openhab.core.automation.RuleProvider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.service.component.annotations.Component; /** diff --git a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/simple/SimpleRule.java b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/simple/SimpleRule.java index cc74f9452..26c73a7c0 100644 --- a/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/simple/SimpleRule.java +++ b/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/simple/SimpleRule.java @@ -20,8 +20,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -33,6 +31,8 @@ import org.openhab.core.automation.RuleStatusInfo; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; import org.openhab.core.automation.template.RuleTemplate; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; /** * convenience Rule class with an action handler. This allows to define Rules which have a execution block. diff --git a/bundles/org.openhab.core.automation.module.script/pom.xml b/bundles/org.openhab.core.automation.module.script/pom.xml index 703d3c302..dc065d59e 100644 --- a/bundles/org.openhab.core.automation.module.script/pom.xml +++ b/bundles/org.openhab.core.automation.module.script/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java index 342f623a2..5afdd0483 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/defaultscope/DefaultScriptScopeProvider.java @@ -22,6 +22,8 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; +import org.openhab.core.automation.RuleRegistry; +import org.openhab.core.automation.module.script.ScriptExtensionProvider; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.ItemRegistry; import org.openhab.core.library.types.DateTimeType; @@ -52,8 +54,6 @@ import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.openhab.core.automation.RuleRegistry; -import org.openhab.core.automation.module.script.ScriptExtensionProvider; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/AbstractScriptModuleHandler.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/AbstractScriptModuleHandler.java index 5ff20c5d3..2a9fcfda8 100644 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/AbstractScriptModuleHandler.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/AbstractScriptModuleHandler.java @@ -22,11 +22,11 @@ import javax.script.ScriptContext; import javax.script.ScriptEngine; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Module; import org.openhab.core.automation.handler.BaseModuleHandler; import org.openhab.core.automation.module.script.ScriptEngineContainer; import org.openhab.core.automation.module.script.ScriptEngineManager; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java index d6b2a2ef5..fe8654f9c 100755 --- a/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/provider/ScriptModuleTypeProvider.java @@ -23,11 +23,6 @@ import java.util.stream.Stream; import javax.script.ScriptEngine; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; -import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.Visibility; import org.openhab.core.automation.module.script.ScriptEngineFactory; import org.openhab.core.automation.module.script.internal.handler.AbstractScriptModuleHandler; @@ -38,6 +33,11 @@ import org.openhab.core.automation.type.ConditionType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.type.Output; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; +import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; +import org.openhab.core.config.core.ParameterOption; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.automation.rest/pom.xml b/bundles/org.openhab.core.automation.rest/pom.xml index 677878983..3340d1fa4 100644 --- a/bundles/org.openhab.core.automation.rest/pom.xml +++ b/bundles/org.openhab.core.automation.rest/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ModuleTypeResource.java b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ModuleTypeResource.java index d84f70354..90452141e 100644 --- a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ModuleTypeResource.java +++ b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/ModuleTypeResource.java @@ -30,8 +30,6 @@ import javax.ws.rs.core.UriInfo; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; import org.openhab.core.automation.dto.ActionTypeDTOMapper; import org.openhab.core.automation.dto.ConditionTypeDTOMapper; import org.openhab.core.automation.dto.ModuleTypeDTO; @@ -44,6 +42,8 @@ import org.openhab.core.automation.type.ConditionType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java index 0e3d0fc7c..4007386a0 100644 --- a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java +++ b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/RuleResource.java @@ -37,10 +37,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.openhab.core.config.core.ConfigUtil; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.RESTResource; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -61,6 +57,10 @@ import org.openhab.core.automation.rest.internal.dto.EnrichedRuleDTO; import org.openhab.core.automation.rest.internal.dto.EnrichedRuleDTOMapper; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.config.core.ConfigUtil; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/TemplateResource.java b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/TemplateResource.java index 04cf09cf9..f621e05ef 100644 --- a/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/TemplateResource.java +++ b/bundles/org.openhab.core.automation.rest/src/main/java/org/openhab/core/automation/rest/internal/TemplateResource.java @@ -29,13 +29,13 @@ import javax.ws.rs.core.UriInfo; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; import org.openhab.core.automation.dto.RuleTemplateDTO; import org.openhab.core.automation.dto.RuleTemplateDTOMapper; import org.openhab.core.automation.template.RuleTemplate; import org.openhab.core.automation.template.Template; import org.openhab.core.automation.template.TemplateRegistry; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.automation/pom.xml b/bundles/org.openhab.core.automation/pom.xml index 076c3af93..80d95a6ee 100644 --- a/bundles/org.openhab.core.automation/pom.xml +++ b/bundles/org.openhab.core.automation/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Action.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Action.java index 3a12ce604..204b53eee 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Action.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Action.java @@ -15,10 +15,10 @@ package org.openhab.core.automation; import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This interface represents automation {@code Action} modules which are the expected result of {@link Rule}s execution. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Condition.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Condition.java index 65071bff2..77401f929 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Condition.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Condition.java @@ -15,10 +15,10 @@ package org.openhab.core.automation; import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.type.ConditionType; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This interface represents automation {@code Condition} modules which are working as a filter for {@link Rule}'s diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/ManagedRuleProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/ManagedRuleProvider.java index 1c272db31..2016fe0a9 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/ManagedRuleProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/ManagedRuleProvider.java @@ -12,10 +12,10 @@ */ package org.openhab.core.automation; -import org.openhab.core.common.registry.AbstractManagedProvider; -import org.openhab.core.storage.StorageService; import org.openhab.core.automation.dto.RuleDTO; import org.openhab.core.automation.dto.RuleDTOMapper; +import org.openhab.core.common.registry.AbstractManagedProvider; +import org.openhab.core.storage.StorageService; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Module.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Module.java index 41306d951..bc55301d4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Module.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Module.java @@ -14,11 +14,11 @@ package org.openhab.core.automation; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; /** * This interface represents automation {@code Modules} which are building components of the {@link Rule}s. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Rule.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Rule.java index 0271e8786..5e3ddf635 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Rule.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Rule.java @@ -17,10 +17,10 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.automation.template.RuleTemplate; +import org.openhab.core.common.registry.Identifiable; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.Identifiable; -import org.openhab.core.automation.template.RuleTemplate; /** * An automation Rule is built from {@link Module}s and consists of three parts: diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/RuleStatusInfo.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/RuleStatusInfo.java index f883efee0..d039679a2 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/RuleStatusInfo.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/RuleStatusInfo.java @@ -44,7 +44,7 @@ public class RuleStatusInfo { /** * Constructs a status info. * - * @param status the status (must not be null) + * @param status the status (must not be null) * @param statusDetail the detail of the status (must not be null) * @throws IllegalArgumentException if status or status detail is null */ @@ -55,9 +55,9 @@ public class RuleStatusInfo { /** * Constructs a status info. * - * @param status the status (must not be null) + * @param status the status (must not be null) * @param statusDetail the detail of the status (must not be null) - * @param description the description of the status + * @param description the description of the status * @throws IllegalArgumentException if status or status detail is null */ public RuleStatusInfo(RuleStatus status, RuleStatusDetail statusDetail, String description) diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/StatusInfoCallback.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/StatusInfoCallback.java index d24d6e7a0..af8db6b37 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/StatusInfoCallback.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/StatusInfoCallback.java @@ -22,7 +22,7 @@ public interface StatusInfoCallback { /** * The method is called when the rule has update of its status. * - * @param ruleUID UID of the {@link Rule} + * @param ruleUID UID of the {@link Rule} * @param statusInfo new status info releated to the {@link Rule} */ void statusInfoChanged(String ruleUID, RuleStatusInfo statusInfo); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Trigger.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Trigger.java index b69f34660..61be57871 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Trigger.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/Trigger.java @@ -13,10 +13,10 @@ package org.openhab.core.automation; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This interface represents automation {@code Trigger} modules which define what phenomenon will start the execution diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionDTOMapper.java index 96ff6b436..8a6c740f4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionDTOMapper.java @@ -16,9 +16,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.config.core.Configuration; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionTypeDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionTypeDTOMapper.java index 0b0d29a92..07e46598c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionTypeDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ActionTypeDTOMapper.java @@ -16,9 +16,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.CompositeActionType; +import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionDTOMapper.java index d834986c7..bf394d76a 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionDTOMapper.java @@ -15,9 +15,9 @@ package org.openhab.core.automation.dto; import java.util.ArrayList; import java.util.List; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Condition; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.config.core.Configuration; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionTypeDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionTypeDTOMapper.java index e510298a6..cba9fb230 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionTypeDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ConditionTypeDTOMapper.java @@ -16,9 +16,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; import org.openhab.core.automation.type.CompositeConditionType; import org.openhab.core.automation.type.ConditionType; +import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleDTOMapper.java index 6f13d34bf..4b0b62d7f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleDTOMapper.java @@ -13,7 +13,6 @@ package org.openhab.core.automation.dto; import org.openhab.core.automation.Module; -import org.openhab.core.automation.dto.ModuleDTO; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTO.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTO.java index c7fee6ef9..fa6e6e33b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTO.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTO.java @@ -15,8 +15,8 @@ package org.openhab.core.automation.dto; import java.util.List; import java.util.Set; -import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; /** * This is a data transfer object that is used to serialize the respective class. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTOMapper.java index 8f1f72764..3d657e7d8 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/ModuleTypeDTOMapper.java @@ -12,9 +12,8 @@ */ package org.openhab.core.automation.dto; -import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; -import org.openhab.core.automation.dto.ModuleTypeDTO; import org.openhab.core.automation.type.ModuleType; +import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTO.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTO.java index ef9825fac..3bd0f889d 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTO.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTO.java @@ -16,8 +16,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; /** * This is a data transfer object that is used to serialize rules. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTOMapper.java index 2a5e25e61..f56cbe2fd 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleDTOMapper.java @@ -12,11 +12,10 @@ */ package org.openhab.core.automation.dto; +import org.openhab.core.automation.Rule; +import org.openhab.core.automation.util.RuleBuilder; import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; -import org.openhab.core.automation.Rule; -import org.openhab.core.automation.dto.RuleDTO; -import org.openhab.core.automation.util.RuleBuilder; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTO.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTO.java index 2dff019ae..6f518b1d0 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTO.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTO.java @@ -15,8 +15,8 @@ package org.openhab.core.automation.dto; import java.util.List; import java.util.Set; -import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; /** * This is a data transfer object that is used to serialize the rule templates. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTOMapper.java index 62850d65a..87e135b01 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/RuleTemplateDTOMapper.java @@ -12,9 +12,8 @@ */ package org.openhab.core.automation.dto; -import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; -import org.openhab.core.automation.dto.RuleTemplateDTO; import org.openhab.core.automation.template.RuleTemplate; +import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; /** * This is a utility class to convert between the Rule Templates and RuleTemplateDTO objects. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerDTOMapper.java index c9115c54b..5c8678467 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerDTOMapper.java @@ -16,9 +16,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.config.core.Configuration; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerTypeDTOMapper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerTypeDTOMapper.java index 939f64b55..149b0fbdb 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerTypeDTOMapper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/dto/TriggerTypeDTOMapper.java @@ -16,9 +16,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; import org.openhab.core.automation.type.CompositeTriggerType; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; /** * This is a utility class to convert between the respective object and its DTO. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/AbstractRuleRegistryEvent.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/AbstractRuleRegistryEvent.java index a56f1e083..b4dd3756b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/AbstractRuleRegistryEvent.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/AbstractRuleRegistryEvent.java @@ -12,8 +12,8 @@ */ package org.openhab.core.automation.events; -import org.openhab.core.events.AbstractEvent; import org.openhab.core.automation.dto.RuleDTO; +import org.openhab.core.events.AbstractEvent; /** * abstract class for rule events @@ -28,9 +28,9 @@ public abstract class AbstractRuleRegistryEvent extends AbstractEvent { /** * Must be called in subclass constructor to create a new rule registry event. * - * @param topic the topic of the event + * @param topic the topic of the event * @param payload the payload of the event - * @param source the source of the event + * @param source the source of the event * @param ruleDTO the ruleDTO for which this event is created */ public AbstractRuleRegistryEvent(String topic, String payload, String source, RuleDTO rule) { diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleAddedEvent.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleAddedEvent.java index 5ab7f8a5f..d89e0b5a2 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleAddedEvent.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleAddedEvent.java @@ -26,9 +26,9 @@ public class RuleAddedEvent extends AbstractRuleRegistryEvent { /** * constructs a new rule added event * - * @param topic the topic of the event + * @param topic the topic of the event * @param payload the payload of the event - * @param source the source of the event + * @param source the source of the event * @param ruleDTO the rule for which this event is created */ public RuleAddedEvent(String topic, String payload, String source, RuleDTO rule) { diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleRemovedEvent.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleRemovedEvent.java index a471d5f60..9aa778a9e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleRemovedEvent.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleRemovedEvent.java @@ -26,10 +26,10 @@ public class RuleRemovedEvent extends AbstractRuleRegistryEvent { /** * Constructs a new rule removed event * - * @param topic the topic of the event + * @param topic the topic of the event * @param payload the payload of the event - * @param source the source of the event - * @param rule the rule for which this event is + * @param source the source of the event + * @param rule the rule for which this event is */ public RuleRemovedEvent(String topic, String payload, String source, RuleDTO rule) { super(topic, payload, source, rule); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleStatusInfoEvent.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleStatusInfoEvent.java index 2746b90f2..de4c92386 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleStatusInfoEvent.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleStatusInfoEvent.java @@ -12,8 +12,8 @@ */ package org.openhab.core.automation.events; -import org.openhab.core.events.AbstractEvent; import org.openhab.core.automation.RuleStatusInfo; +import org.openhab.core.events.AbstractEvent; /** * An {@link RuleStatusInfoEvent} notifies subscribers that a rule status has been updated. @@ -31,11 +31,11 @@ public class RuleStatusInfoEvent extends AbstractEvent { /** * constructs a new rule status event * - * @param topic the topic of the event - * @param payload the payload of the event - * @param source the source of the event + * @param topic the topic of the event + * @param payload the payload of the event + * @param source the source of the event * @param statusInfo the status info for this event - * @param ruleId the rule for which this event is + * @param ruleId the rule for which this event is */ public RuleStatusInfoEvent(String topic, String payload, String source, RuleStatusInfo statusInfo, String ruleId) { super(topic, payload, source); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleUpdatedEvent.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleUpdatedEvent.java index c1b388cfb..ba2d906f6 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleUpdatedEvent.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/events/RuleUpdatedEvent.java @@ -28,10 +28,10 @@ public class RuleUpdatedEvent extends AbstractRuleRegistryEvent { /** * constructs a new rule updated event * - * @param topic the topic of the event + * @param topic the topic of the event * @param payload the payload of the event - * @param source the source of the event - * @param rule the rule for which is this event + * @param source the source of the event + * @param rule the rule for which is this event * @param oldRule the rule that has been updated */ public RuleUpdatedEvent(String topic, String payload, String source, RuleDTO rule, RuleDTO oldRule) { diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ModuleHandlerFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ModuleHandlerFactory.java index 314f3e81c..bc560892c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/ModuleHandlerFactory.java @@ -50,7 +50,7 @@ public interface ModuleHandlerFactory { * Creates a {@link ModuleHandler} instance needed for the operation of the {@link Module}s * included in {@link Rule}s. * - * @param module the {@link Module} for which a {@link ModuleHandler} instance must be created. + * @param module the {@link Module} for which a {@link ModuleHandler} instance must be created. * @param ruleUID the identifier of the {@link Rule} that the given module belongs to. * @return a new {@link ModuleHandler} instance, or {@code null} if the type of the * {@code module} parameter is not supported by this factory. @@ -62,7 +62,7 @@ public interface ModuleHandlerFactory { * for handling the specified {@code module} in the {@link Rule} with the specified {@code ruleUID}. * If no other {@link Rule}s and {@link Module}s use this {@code handler} instance, it should be disposed. * - * @param module the {@link Module} for which the {@code handler} was created. + * @param module the {@link Module} for which the {@code handler} was created. * @param ruleUID the identifier of the {@link Rule} that the given module belongs to. * @param handler the {@link ModuleHandler} instance that is no longer needed. */ diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/TriggerHandlerCallback.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/TriggerHandlerCallback.java index a51305d31..9dcb11d7c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/TriggerHandlerCallback.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/handler/TriggerHandlerCallback.java @@ -35,14 +35,14 @@ public interface TriggerHandlerCallback extends ModuleHandlerCallback { * the liked {@link Trigger} instance was fired. * * @param trigger instance of trigger which was fired. When one TriggerHandler - * serve more then one {@link Trigger} instances, this parameter - * defines which trigger was fired. + * serve more then one {@link Trigger} instances, this parameter + * defines which trigger was fired. * @param context is a {@link Map} of output values of the triggered {@link Trigger}. Each entry of the map - * contains: - *
    - *
  • key - the id of the {@link Output} , - *
  • value - represents output value of the {@link Trigger}'s {@link Output} - *
+ * contains: + *
    + *
  • key - the id of the {@link Output} , + *
  • value - represents output value of the {@link Trigger}'s {@link Output} + *
*/ public void triggered(Trigger trigger, Map context); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ActionImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ActionImpl.java index 95ef0ba2e..f6464c7cf 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ActionImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ActionImpl.java @@ -17,11 +17,11 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Module; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.Configuration; /** * This class is implementation of {@link Action} modules used in the {@link RuleEngineImpl}s. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ConditionImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ConditionImpl.java index 506a14553..840c5425b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ConditionImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ConditionImpl.java @@ -17,11 +17,11 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.Configuration; /** * This class is implementation of {@link Condition} modules used in the {@link RuleEngineImpl}s. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ModuleImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ModuleImpl.java index dc50dd864..a9b1851e4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ModuleImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ModuleImpl.java @@ -13,13 +13,13 @@ package org.openhab.core.automation.internal; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Module; import org.openhab.core.automation.Rule; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; /** * Modules are building components of the {@link Rule}s. Each ModuleImpl is diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java index ee2d41568..84756a1e4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEngineImpl.java @@ -31,11 +31,6 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.RegistryChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.storage.Storage; -import org.openhab.core.storage.StorageService; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -72,6 +67,11 @@ import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; import org.openhab.core.automation.util.ReferenceResolver; +import org.openhab.core.common.registry.RegistryChangeListener; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.storage.Storage; +import org.openhab.core.storage.StorageService; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.ComponentPropertyType; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEventFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEventFactory.java index 4f5f15aff..ae2ff8c88 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEventFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleEventFactory.java @@ -17,9 +17,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import org.openhab.core.events.AbstractEventFactory; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFactory; import org.openhab.core.automation.Rule; import org.openhab.core.automation.RuleStatusInfo; import org.openhab.core.automation.dto.RuleDTO; @@ -28,6 +25,9 @@ import org.openhab.core.automation.events.RuleAddedEvent; import org.openhab.core.automation.events.RuleRemovedEvent; import org.openhab.core.automation.events.RuleStatusInfoEvent; import org.openhab.core.automation.events.RuleUpdatedEvent; +import org.openhab.core.events.AbstractEventFactory; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFactory; import org.osgi.service.component.annotations.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleImpl.java index 7f25d094d..a2ad01768 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleImpl.java @@ -21,8 +21,6 @@ import java.util.UUID; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -31,6 +29,8 @@ import org.openhab.core.automation.RuleRegistry; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; import org.openhab.core.automation.template.RuleTemplate; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; /** * This is the internal implementation of a {@link Rule}, which comes with full getters and setters. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleRegistryImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleRegistryImpl.java index 3209827f7..010fec52c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleRegistryImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/RuleRegistryImpl.java @@ -25,14 +25,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.AbstractRegistry; -import org.openhab.core.common.registry.Provider; -import org.openhab.core.common.registry.RegistryChangeListener; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.storage.StorageService; import org.openhab.core.automation.ManagedRuleProvider; import org.openhab.core.automation.Module; import org.openhab.core.automation.Rule; @@ -47,6 +39,14 @@ import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ConfigurationNormalizer; import org.openhab.core.automation.util.ReferenceResolver; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.AbstractRegistry; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.common.registry.RegistryChangeListener; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.storage.StorageService; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/TriggerImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/TriggerImpl.java index bf5fc2a9e..8dbc11f07 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/TriggerImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/TriggerImpl.java @@ -14,8 +14,8 @@ package org.openhab.core.automation.internal; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Trigger; +import org.openhab.core.config.core.Configuration; /** * This class is implementation of {@link Trigger} modules used in the {@link RuleEngine}s. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AbstractCommandProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AbstractCommandProvider.java index 80144a6d3..20ef19d73 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AbstractCommandProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AbstractCommandProvider.java @@ -25,11 +25,11 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.parser.ParsingException; import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java index 630766935..8b326cb19 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/AutomationCommandsPluggable.java @@ -22,8 +22,6 @@ import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.automation.Rule; import org.openhab.core.automation.RuleManager; import org.openhab.core.automation.RuleRegistry; @@ -36,6 +34,8 @@ import org.openhab.core.automation.type.ConditionType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineModuleTypeProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineModuleTypeProvider.java index b0fef5da0..1a390a759 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineModuleTypeProvider.java @@ -28,7 +28,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.parser.ParsingException; import org.openhab.core.automation.parser.ParsingNestedException; @@ -36,6 +35,7 @@ import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.type.ModuleTypeRegistry; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineTemplateProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineTemplateProvider.java index 0bbeb95aa..16b1dfd99 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineTemplateProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/CommandlineTemplateProvider.java @@ -26,7 +26,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.parser.ParsingException; import org.openhab.core.automation.parser.ParsingNestedException; @@ -37,6 +36,7 @@ import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.template.TemplateRegistry; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/Printer.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/Printer.java index 6ce895f1d..4167a3db2 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/Printer.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/commands/Printer.java @@ -19,9 +19,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.FilterCriteria; -import org.openhab.core.config.core.ParameterOption; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -38,6 +35,9 @@ import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.FilterCriteria; +import org.openhab.core.config.core.ParameterOption; /** * This class provides the functionality responsible for printing the automation objects as a result of commands. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeModuleHandlerFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeModuleHandlerFactory.java index 9db98d567..265af8047 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/composite/CompositeModuleHandlerFactory.java @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -38,6 +37,7 @@ import org.openhab.core.automation.type.CompositeTriggerType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ReferenceResolver; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/CoreModuleHandlerFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/CoreModuleHandlerFactory.java index e968b66ff..32ffd0b1a 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/CoreModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/CoreModuleHandlerFactory.java @@ -15,8 +15,6 @@ package org.openhab.core.automation.internal.module.factory; import java.util.Arrays; import java.util.Collection; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.items.ItemRegistry; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; @@ -35,6 +33,8 @@ import org.openhab.core.automation.internal.module.handler.ItemStateTriggerHandl import org.openhab.core.automation.internal.module.handler.RuleEnablementActionHandler; import org.openhab.core.automation.internal.module.handler.RunRuleActionHandler; import org.openhab.core.automation.internal.module.handler.ThingStatusTriggerHandler; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.items.ItemRegistry; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/EphemerisModuleHandlerFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/EphemerisModuleHandlerFactory.java index 9bd358bed..7cd768736 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/EphemerisModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/factory/EphemerisModuleHandlerFactory.java @@ -19,13 +19,13 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.ephemeris.EphemerisManager; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.handler.BaseModuleHandlerFactory; import org.openhab.core.automation.handler.ModuleHandler; import org.openhab.core.automation.handler.ModuleHandlerFactory; import org.openhab.core.automation.internal.module.handler.EphemerisConditionHandler; +import org.openhab.core.ephemeris.EphemerisManager; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ChannelEventTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ChannelEventTriggerHandler.java index ba9eeb52e..5c9f4a3b4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ChannelEventTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ChannelEventTriggerHandler.java @@ -19,13 +19,13 @@ import java.util.Hashtable; import java.util.Map; import java.util.Set; +import org.openhab.core.automation.Trigger; +import org.openhab.core.automation.handler.BaseTriggerModuleHandler; +import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; import org.openhab.core.thing.events.ChannelTriggeredEvent; -import org.openhab.core.automation.Trigger; -import org.openhab.core.automation.handler.BaseTriggerModuleHandler; -import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/CompareConditionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/CompareConditionHandler.java index f250988a6..f8c3fb5ac 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/CompareConditionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/CompareConditionHandler.java @@ -18,11 +18,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.openhab.core.types.State; -import org.openhab.core.types.TypeParser; import org.openhab.core.automation.Condition; import org.openhab.core.automation.handler.BaseConditionModuleHandler; import org.openhab.core.automation.internal.module.exception.UncomparableException; +import org.openhab.core.types.State; +import org.openhab.core.types.TypeParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/EphemerisConditionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/EphemerisConditionHandler.java index e2cd91fb1..8f80cad1b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/EphemerisConditionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/EphemerisConditionHandler.java @@ -17,11 +17,11 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.ephemeris.EphemerisManager; import org.openhab.core.automation.Condition; import org.openhab.core.automation.handler.BaseModuleHandler; import org.openhab.core.automation.handler.ConditionHandler; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.ephemeris.EphemerisManager; /** * ConditionHandler implementation for Ephemeris based conditions. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericCronTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericCronTriggerHandler.java index 17bed011c..dd2685f9b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericCronTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericCronTriggerHandler.java @@ -12,13 +12,13 @@ */ package org.openhab.core.automation.internal.module.handler; -import org.openhab.core.scheduler.CronScheduler; -import org.openhab.core.scheduler.SchedulerRunnable; import org.openhab.core.automation.ModuleHandlerCallback; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.handler.BaseTriggerModuleHandler; import org.openhab.core.automation.handler.TriggerHandlerCallback; +import org.openhab.core.scheduler.CronScheduler; import org.openhab.core.scheduler.ScheduledCompletableFuture; +import org.openhab.core.scheduler.SchedulerRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventConditionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventConditionHandler.java index 346d83084..91a219432 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventConditionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventConditionHandler.java @@ -14,9 +14,9 @@ package org.openhab.core.automation.internal.module.handler; import java.util.Map; -import org.openhab.core.events.Event; import org.openhab.core.automation.Condition; import org.openhab.core.automation.handler.BaseConditionModuleHandler; +import org.openhab.core.events.Event; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventTriggerHandler.java index 78934b883..662f33564 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/GenericEventTriggerHandler.java @@ -21,12 +21,12 @@ import java.util.Hashtable; import java.util.Map; import java.util.Set; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventSubscriber; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.handler.BaseTriggerModuleHandler; import org.openhab.core.automation.handler.TriggerHandlerCallback; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventSubscriber; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java index 86daa8f20..8eeec8919 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandActionHandler.java @@ -14,6 +14,8 @@ package org.openhab.core.automation.internal.module.handler; import java.util.Map; +import org.openhab.core.automation.Action; +import org.openhab.core.automation.handler.BaseActionModuleHandler; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; @@ -22,8 +24,6 @@ import org.openhab.core.items.events.ItemCommandEvent; import org.openhab.core.items.events.ItemEventFactory; import org.openhab.core.types.Command; import org.openhab.core.types.TypeParser; -import org.openhab.core.automation.Action; -import org.openhab.core.automation.handler.BaseActionModuleHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandTriggerHandler.java index 014ab9926..3e32fb069 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemCommandTriggerHandler.java @@ -19,14 +19,14 @@ import java.util.Hashtable; import java.util.Map; import java.util.Set; +import org.openhab.core.automation.Trigger; +import org.openhab.core.automation.handler.BaseTriggerModuleHandler; +import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; import org.openhab.core.items.events.ItemCommandEvent; import org.openhab.core.types.Command; -import org.openhab.core.automation.Trigger; -import org.openhab.core.automation.handler.BaseTriggerModuleHandler; -import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateConditionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateConditionHandler.java index 283de0716..10e86a67c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateConditionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateConditionHandler.java @@ -14,14 +14,14 @@ package org.openhab.core.automation.internal.module.handler; import java.util.Map; +import org.openhab.core.automation.Condition; +import org.openhab.core.automation.handler.BaseConditionModuleHandler; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemRegistry; import org.openhab.core.library.types.DecimalType; import org.openhab.core.types.State; import org.openhab.core.types.TypeParser; -import org.openhab.core.automation.Condition; -import org.openhab.core.automation.handler.BaseConditionModuleHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateTriggerHandler.java index 138f89d1b..61292ab09 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ItemStateTriggerHandler.java @@ -20,6 +20,9 @@ import java.util.Hashtable; import java.util.Map; import java.util.Set; +import org.openhab.core.automation.Trigger; +import org.openhab.core.automation.handler.BaseTriggerModuleHandler; +import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; @@ -27,9 +30,6 @@ import org.openhab.core.items.events.GroupItemStateChangedEvent; import org.openhab.core.items.events.ItemStateChangedEvent; import org.openhab.core.items.events.ItemStateEvent; import org.openhab.core.types.State; -import org.openhab.core.automation.Trigger; -import org.openhab.core.automation.handler.BaseTriggerModuleHandler; -import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java index ccc44af25..835cf8cbe 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RuleEnablementActionHandler.java @@ -15,10 +15,10 @@ package org.openhab.core.automation.internal.module.handler; import java.util.List; import java.util.Map; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.RuleRegistry; import org.openhab.core.automation.handler.BaseActionModuleHandler; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java index 4cb2ee54d..08d9f8391 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/RunRuleActionHandler.java @@ -15,9 +15,9 @@ package org.openhab.core.automation.internal.module.handler; import java.util.List; import java.util.Map; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.handler.BaseActionModuleHandler; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ThingStatusTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ThingStatusTriggerHandler.java index dc85333e4..748fa9223 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ThingStatusTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/ThingStatusTriggerHandler.java @@ -21,16 +21,16 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.automation.ModuleHandlerCallback; +import org.openhab.core.automation.Trigger; +import org.openhab.core.automation.handler.BaseTriggerModuleHandler; +import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.events.ThingStatusInfoChangedEvent; import org.openhab.core.thing.events.ThingStatusInfoEvent; -import org.openhab.core.automation.ModuleHandlerCallback; -import org.openhab.core.automation.Trigger; -import org.openhab.core.automation.handler.BaseTriggerModuleHandler; -import org.openhab.core.automation.handler.TriggerHandlerCallback; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.slf4j.Logger; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayConditionHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayConditionHandler.java index 92a7cef4b..fd6b862ec 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayConditionHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayConditionHandler.java @@ -16,9 +16,9 @@ import java.time.LocalTime; import java.time.temporal.ChronoUnit; import java.util.Map; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Condition; import org.openhab.core.automation.handler.BaseConditionModuleHandler; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayTriggerHandler.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayTriggerHandler.java index a48784a7c..d5f04eb3c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayTriggerHandler.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimeOfDayTriggerHandler.java @@ -14,13 +14,13 @@ package org.openhab.core.automation.internal.module.handler; import java.text.MessageFormat; -import org.openhab.core.scheduler.CronScheduler; -import org.openhab.core.scheduler.ScheduledCompletableFuture; -import org.openhab.core.scheduler.SchedulerRunnable; import org.openhab.core.automation.ModuleHandlerCallback; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.handler.BaseTriggerModuleHandler; import org.openhab.core.automation.handler.TriggerHandlerCallback; +import org.openhab.core.scheduler.CronScheduler; +import org.openhab.core.scheduler.ScheduledCompletableFuture; +import org.openhab.core.scheduler.SchedulerRunnable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimerModuleHandlerFactory.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimerModuleHandlerFactory.java index 63b18754f..243d9f1e5 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimerModuleHandlerFactory.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/handler/TimerModuleHandlerFactory.java @@ -15,13 +15,13 @@ package org.openhab.core.automation.internal.module.handler; import java.util.Arrays; import java.util.Collection; -import org.openhab.core.scheduler.CronScheduler; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.handler.BaseModuleHandlerFactory; import org.openhab.core.automation.handler.ModuleHandler; import org.openhab.core.automation.handler.ModuleHandlerFactory; +import org.openhab.core.scheduler.CronScheduler; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/provider/AnnotatedActionModuleTypeProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/provider/AnnotatedActionModuleTypeProvider.java index 9e074c439..77523bcad 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/provider/AnnotatedActionModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/module/provider/AnnotatedActionModuleTypeProvider.java @@ -23,8 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.Action; import org.openhab.core.automation.AnnotatedActions; import org.openhab.core.automation.Module; @@ -38,6 +36,8 @@ import org.openhab.core.automation.module.provider.i18n.ModuleTypeI18nService; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigConstants; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/parser/gson/AbstractGSONParser.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/parser/gson/AbstractGSONParser.java index 37307c21b..728057a4b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/parser/gson/AbstractGSONParser.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/parser/gson/AbstractGSONParser.java @@ -16,13 +16,13 @@ import java.io.OutputStreamWriter; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.config.core.ConfigurationDeserializer; -import org.openhab.core.config.core.ConfigurationSerializer; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.type.CompositeActionType; import org.openhab.core.automation.type.CompositeConditionType; import org.openhab.core.automation.type.CompositeTriggerType; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.config.core.ConfigurationDeserializer; +import org.openhab.core.config.core.ConfigurationSerializer; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AbstractResourceBundleProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AbstractResourceBundleProvider.java index ac7399590..a3b3a2210 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AbstractResourceBundleProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AbstractResourceBundleProvider.java @@ -34,10 +34,6 @@ import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; -import org.openhab.core.common.registry.Provider; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.Rule; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.parser.ParsingException; @@ -46,6 +42,10 @@ import org.openhab.core.automation.template.Template; import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.util.tracker.BundleTrackerCustomizer; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AutomationResourceBundlesTracker.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AutomationResourceBundlesTracker.java index 9a66914a7..c932caa0c 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AutomationResourceBundlesTracker.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/AutomationResourceBundlesTracker.java @@ -18,12 +18,12 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.openhab.core.common.registry.Provider; import org.openhab.core.automation.ManagedRuleProvider; import org.openhab.core.automation.Rule; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.template.Template; import org.openhab.core.automation.type.ModuleType; +import org.openhab.core.common.registry.Provider; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/ModuleTypeResourceBundleProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/ModuleTypeResourceBundleProvider.java index bb5d887e7..790d43c5b 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/ModuleTypeResourceBundleProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/ModuleTypeResourceBundleProvider.java @@ -20,13 +20,13 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.Provider; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.module.provider.i18n.ModuleTypeI18nService; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.type.ModuleTypeRegistry; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.common.registry.ProviderChangeListener; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/TemplateResourceBundleProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/TemplateResourceBundleProvider.java index 0aa64ea1c..80db11afc 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/TemplateResourceBundleProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/TemplateResourceBundleProvider.java @@ -20,11 +20,6 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; -import org.openhab.core.common.registry.Provider; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Trigger; @@ -36,6 +31,11 @@ import org.openhab.core.automation.template.RuleTemplateProvider; import org.openhab.core.automation.template.Template; import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.type.ModuleType; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; +import org.openhab.core.i18n.TranslationProvider; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/Vendor.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/Vendor.java index 90c04f17d..c33566b4e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/Vendor.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/Vendor.java @@ -22,7 +22,7 @@ import java.util.StringTokenizer; * @author Ana Dimova - Initial contribution */ public class Vendor { - + private static final String DELIMITER = ";"; /** @@ -45,7 +45,7 @@ public class Vendor { * This field keeps the count of the rules provided from this vendor. */ private int rulesCount = 0; - + public Vendor(String nameversion) { int index = nameversion.indexOf(DELIMITER); vendorSymbolicName = nameversion.substring(0, index); @@ -130,7 +130,7 @@ public class Vendor { public int hashCode() { return vendorSymbolicName.hashCode() + vendorVersion.hashCode(); } - + /** * @see java.lang.Object#toString() */ diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/file/AbstractFileProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/file/AbstractFileProvider.java index df402e4c7..4ddd1125d 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/file/AbstractFileProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/file/AbstractFileProvider.java @@ -27,15 +27,15 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.common.registry.Provider; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.parser.Parser; import org.openhab.core.automation.parser.ParsingException; import org.openhab.core.automation.template.Template; import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.Provider; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleI18nUtil.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleI18nUtil.java index 6abf5f646..830e20b55 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleI18nUtil.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleI18nUtil.java @@ -18,13 +18,13 @@ import java.util.Locale; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.i18n.I18nUtil; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.i18n.I18nUtil; +import org.openhab.core.i18n.TranslationProvider; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nServiceImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nServiceImpl.java index 6a21ccdee..5c7c8cabd 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nServiceImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nServiceImpl.java @@ -19,10 +19,6 @@ import java.util.Locale; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescription; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Trigger; @@ -36,6 +32,10 @@ import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.config.core.ConfigDescription; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; +import org.openhab.core.i18n.TranslationProvider; import org.osgi.framework.Bundle; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nUtil.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nUtil.java index 70c1f8173..c2dbcc95f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nUtil.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/ModuleTypeI18nUtil.java @@ -18,10 +18,10 @@ import java.util.Locale; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.i18n.I18nUtil; -import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.i18n.I18nUtil; +import org.openhab.core.i18n.TranslationProvider; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/RuleTemplateI18nUtil.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/RuleTemplateI18nUtil.java index 1abf5c35b..892dd09eb 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/RuleTemplateI18nUtil.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/provider/i18n/RuleTemplateI18nUtil.java @@ -16,9 +16,9 @@ import java.util.Locale; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.automation.template.RuleTemplate; import org.openhab.core.i18n.I18nUtil; import org.openhab.core.i18n.TranslationProvider; -import org.openhab.core.automation.template.RuleTemplate; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ruleengine/WrappedRule.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ruleengine/WrappedRule.java index 9d2d277be..9bb167a04 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ruleengine/WrappedRule.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/ruleengine/WrappedRule.java @@ -38,7 +38,7 @@ public class WrappedRule { private static List map(final List in, Function factory, final Collection> coll) { // explicit cast to List as JDK compiler complains - return Collections.unmodifiableList((List )in.stream().map(module -> { + return Collections.unmodifiableList((List) in.stream().map(module -> { final T impl = factory.apply(module); coll.add(impl); return impl; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/template/RuleTemplateRegistry.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/template/RuleTemplateRegistry.java index c7fb3a284..9763c1963 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/template/RuleTemplateRegistry.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/template/RuleTemplateRegistry.java @@ -23,12 +23,12 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.AbstractRegistry; -import org.openhab.core.common.registry.Provider; import org.openhab.core.automation.template.RuleTemplate; import org.openhab.core.automation.template.RuleTemplateProvider; import org.openhab.core.automation.template.TemplateProvider; import org.openhab.core.automation.template.TemplateRegistry; +import org.openhab.core.common.registry.AbstractRegistry; +import org.openhab.core.common.registry.Provider; import org.osgi.service.component.annotations.Component; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/type/ModuleTypeRegistryImpl.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/type/ModuleTypeRegistryImpl.java index db1b5a3d1..4d452a30a 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/type/ModuleTypeRegistryImpl.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/internal/type/ModuleTypeRegistryImpl.java @@ -22,8 +22,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.AbstractRegistry; -import org.openhab.core.common.registry.Provider; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.CompositeActionType; import org.openhab.core.automation.type.CompositeConditionType; @@ -33,6 +31,8 @@ import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.common.registry.AbstractRegistry; +import org.openhab.core.common.registry.Provider; import org.osgi.service.component.annotations.Component; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/module/provider/AnnotationActionModuleTypeHelper.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/module/provider/AnnotationActionModuleTypeHelper.java index b54f55fe7..58797ba59 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/module/provider/AnnotationActionModuleTypeHelper.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/module/provider/AnnotationActionModuleTypeHelper.java @@ -26,11 +26,6 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.config.core.ParameterOption; import org.openhab.core.automation.Action; import org.openhab.core.automation.annotation.ActionInput; import org.openhab.core.automation.annotation.ActionOutput; @@ -40,6 +35,11 @@ import org.openhab.core.automation.annotation.RuleAction; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; +import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.config.core.ParameterOption; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/parser/ParsingNestedException.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/parser/ParsingNestedException.java index 1fd6ec8df..10274ca2e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/parser/ParsingNestedException.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/parser/ParsingNestedException.java @@ -40,9 +40,9 @@ public class ParsingNestedException extends Exception { * object, its UID and additional message with additional information about the parsing process. * * @param type is the type of the automation object for parsing. - * @param id is the UID of the automation object for parsing. - * @param msg is the additional message with additional information about the parsing process. - * @param t is the exception thrown during the parsing. + * @param id is the UID of the automation object for parsing. + * @param msg is the additional message with additional information about the parsing process. + * @param t is the exception thrown during the parsing. */ public ParsingNestedException(int type, String id, String msg, Throwable t) { super(msg, t); @@ -55,8 +55,8 @@ public class ParsingNestedException extends Exception { * automation object and its UID. * * @param type is the type of the automation object for parsing. - * @param id is the UID of the automation object for parsing. - * @param t is the exception thrown during the parsing. + * @param id is the UID of the automation object for parsing. + * @param t is the exception thrown during the parsing. */ public ParsingNestedException(int type, String id, Throwable t) { super(t); diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/RuleTemplate.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/RuleTemplate.java index 9ea9a5a83..e3e361c0f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/RuleTemplate.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/RuleTemplate.java @@ -20,13 +20,13 @@ import java.util.UUID; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.Rule; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class is used to define {@code Rule Templates} which are shared combination of ready to use modules, which can diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/Template.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/Template.java index 57cb8b773..adf99aaf1 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/Template.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/template/Template.java @@ -16,8 +16,8 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.Identifiable; import org.openhab.core.automation.Visibility; +import org.openhab.core.common.registry.Identifiable; /** * The templates define types of shared, ready to use definitions of automation objects, which diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/thingsupport/AnnotatedThingActionModuleTypeProvider.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/thingsupport/AnnotatedThingActionModuleTypeProvider.java index 226f4f81c..7a1e25582 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/thingsupport/AnnotatedThingActionModuleTypeProvider.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/thingsupport/AnnotatedThingActionModuleTypeProvider.java @@ -23,10 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.thing.binding.ThingActions; -import org.openhab.core.thing.binding.ThingActionsScope; -import org.openhab.core.thing.binding.ThingHandler; import org.openhab.core.automation.Action; import org.openhab.core.automation.Module; import org.openhab.core.automation.handler.BaseModuleHandlerFactory; @@ -39,6 +35,10 @@ import org.openhab.core.automation.module.provider.i18n.ModuleTypeI18nService; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.thing.binding.ThingActions; +import org.openhab.core.thing.binding.ThingActionsScope; +import org.openhab.core.thing.binding.ThingHandler; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ActionType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ActionType.java index 85bf9d780..73cccd1b7 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ActionType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ActionType.java @@ -17,10 +17,10 @@ import java.util.List; import java.util.Set; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Action; import org.openhab.core.automation.Module; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class provides common functionality for creating {@link Action} instances by supplying their meta-information. @@ -50,11 +50,11 @@ public class ActionType extends ModuleType { * Creates an instance of {@link ActionType} with base properties - UID, a {@link List} of configuration * descriptions and a {@link List} of {@link Input} definitions. * - * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Action} instances. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Action} instances. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Action} instances. */ public ActionType(@Nullable String UID, @Nullable List configDescriptions, List inputs) { @@ -65,13 +65,13 @@ public class ActionType extends ModuleType { * Creates an instance of the {@link ActionType} with UID, a {@link List} of configuration descriptions, * a {@link List} of {@link Input} definitions and a {@link List} of {@link Output} descriptions. * - * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Action} instances. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Action} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Action} instances. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Action} instances. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Action} instances. */ public ActionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable List inputs, @Nullable List outputs) { @@ -83,19 +83,19 @@ public class ActionType extends ModuleType { * a {@link List} of configuration descriptions, a {@link List} of {@link Input} descriptions and a {@link List} * of {@link Output} descriptions. * - * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Action} instances. - * @param label is a short and accurate name of the {@link ActionType}. - * @param description is a short and understandable description of which can be used the {@link ActionType}. - * @param tags defines categories that fit the {@link ActionType} and which can serve as criteria for - * searching or filtering it. - * @param visibility determines whether the {@link ActionType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Action} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Action} instances. + * @param label is a short and accurate name of the {@link ActionType}. + * @param description is a short and understandable description of which can be used the {@link ActionType}. + * @param tags defines categories that fit the {@link ActionType} and which can serve as criteria for + * searching or filtering it. + * @param visibility determines whether the {@link ActionType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Action} instances. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Action} instances. */ public ActionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeActionType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeActionType.java index 2b09ce948..898d0453f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeActionType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeActionType.java @@ -18,9 +18,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Action; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class is as {@link ActionType} which logically combines {@link Action} instances. The composite action hides @@ -40,15 +40,15 @@ public class CompositeActionType extends ActionType { * Creates an instance of {@code CompositeActionType} with list of {@link Action}s. It initializes only base * properties of the {@code CompositeActionType}. * - * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Action} instances. - * @param children is a {@link List} of {@link Action}s. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Action} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Action} instances. - * @param children is a {@link List} of {@link Action}s. + * @param children is a {@link List} of {@link Action}s. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Action} instances. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Action} instances. + * @param children is a {@link List} of {@link Action}s. */ public CompositeActionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable List inputs, @Nullable List outputs, @Nullable List children) { @@ -60,20 +60,20 @@ public class CompositeActionType extends ActionType { * Creates an instance of {@code CompositeActionType} with list of {@link Action}s. It initializes all properties of * the {@code CompositeActionType}. * - * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link ActionType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Action} instances. - * @param label a short and accurate, human-readable label of the {@link ActionType}. - * @param description a detailed, human-readable description of usage of {@link ActionType} and its benefits. - * @param tags defines categories that fit the {@link ActionType} and which can serve as criteria for - * searching or filtering it. - * @param visibility determines whether the {@link ActionType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Action} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Action} instances. - * @param children is a {@link List} of {@link Action}s. + * @param label a short and accurate, human-readable label of the {@link ActionType}. + * @param description a detailed, human-readable description of usage of {@link ActionType} and its benefits. + * @param tags defines categories that fit the {@link ActionType} and which can serve as criteria for + * searching or filtering it. + * @param visibility determines whether the {@link ActionType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Action} instances. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Action} instances. + * @param children is a {@link List} of {@link Action}s. */ public CompositeActionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeConditionType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeConditionType.java index 2aebb9df5..0b8f378cd 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeConditionType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeConditionType.java @@ -18,9 +18,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class is as {@link ConditionType} which logically combines {@link Condition} modules. The composite condition @@ -39,13 +39,13 @@ public class CompositeConditionType extends ConditionType { * Creates an instance of {@code CompositeConditionType} with ordered set of {@link Condition}s. It initializes * only base properties of the {@code CompositeConditionType}. * - * @param UID is the {@link ConditionType}'s identifier, or {@code null} if a random identifier - * should be generated. + * @param UID is the {@link ConditionType}'s identifier, or {@code null} if a random identifier + * should be generated. * @param configDescriptions is a {@link List} of configuration descriptions describing meta-data for the - * configuration of the future {@link Condition} instances. - * @param inputs is a {@link List} with {@link Input}'s meta-information descriptions of the future - * {@link Condition} instances. - * @param children is a {@link List} of {@link Condition}s. + * configuration of the future {@link Condition} instances. + * @param inputs is a {@link List} with {@link Input}'s meta-information descriptions of the future + * {@link Condition} instances. + * @param children is a {@link List} of {@link Condition}s. */ public CompositeConditionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable List inputs, @Nullable List children) { @@ -57,22 +57,22 @@ public class CompositeConditionType extends ConditionType { * Creates an instance of {@code CompositeConditionType} with ordered set of {@link Condition}s. It initializes * all properties of the {@code CompositeConditionType}. * - * @param UID is the {@link ConditionType}'s identifier, or {@code null} if a random identifier - * should be generated. + * @param UID is the {@link ConditionType}'s identifier, or {@code null} if a random identifier + * should be generated. * @param configDescriptions is a {@link List} of configuration descriptions describing meta-data for the - * configuration of the future {@link Condition} instances. - * @param label a short and accurate, human-readable label of the {@code CompositeConditionType}. - * @param description a detailed, human-readable description of usage of {@code CompositeConditionType} and - * its benefits. - * @param tags defines categories that fit the {@code CompositeConditionType} and which can serve as - * criteria for searching or filtering it. - * @param visibility determines whether the {@code CompositeConditionType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * If {@code null} is provided the default visibility {@link Visibility#VISIBLE} will be - * used. - * @param inputs is a {@link List} with {@link Input}'s meta-information descriptions of the future - * {@link Condition} instances. - * @param children is a {@link List} of {@link Condition}s. + * configuration of the future {@link Condition} instances. + * @param label a short and accurate, human-readable label of the {@code CompositeConditionType}. + * @param description a detailed, human-readable description of usage of {@code CompositeConditionType} and + * its benefits. + * @param tags defines categories that fit the {@code CompositeConditionType} and which can serve as + * criteria for searching or filtering it. + * @param visibility determines whether the {@code CompositeConditionType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * If {@code null} is provided the default visibility {@link Visibility#VISIBLE} will be + * used. + * @param inputs is a {@link List} with {@link Input}'s meta-information descriptions of the future + * {@link Condition} instances. + * @param children is a {@link List} of {@link Condition}s. */ public CompositeConditionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeTriggerType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeTriggerType.java index e5b3d3e0e..b2be82351 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeTriggerType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/CompositeTriggerType.java @@ -18,9 +18,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class is as {@link TriggerType} which logically combines {@link Trigger} modules. The composite trigger hides @@ -39,12 +39,12 @@ public class CompositeTriggerType extends TriggerType { * Creates an instance of {@code CompositeTriggerType} with ordered set of {@link Trigger} modules. It initializes * only base properties of the {@code CompositeTriggerType}. * - * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Trigger} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Trigger} instances. - * @param children is a {@link List} of {@link Trigger} modules. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Trigger} instances. + * @param children is a {@link List} of {@link Trigger} modules. * */ public CompositeTriggerType(@Nullable String UID, @Nullable List configDescriptions, @@ -57,19 +57,19 @@ public class CompositeTriggerType extends TriggerType { * Creates an instance of {@code CompositeTriggerType} with ordered set of {@link Trigger} modules. It initializes * all properties of the {@code CompositeTriggerType}. * - * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Trigger} instances. - * @param label a short and accurate, human-readable label of the {@link TriggerType}. - * @param description a detailed, human-readable description of usage of {@link TriggerType} and its - * benefits. - * @param tags defines categories that fit the {@link TriggerType} and which can serve as criteria for - * searching or filtering it. - * @param visibility determines whether the {@link TriggerType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Trigger} instances. - * @param children is a {@link List} of {@link Trigger} modules. + * @param label a short and accurate, human-readable label of the {@link TriggerType}. + * @param description a detailed, human-readable description of usage of {@link TriggerType} and its + * benefits. + * @param tags defines categories that fit the {@link TriggerType} and which can serve as criteria for + * searching or filtering it. + * @param visibility determines whether the {@link TriggerType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Trigger} instances. + * @param children is a {@link List} of {@link Trigger} modules. */ public CompositeTriggerType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ConditionType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ConditionType.java index 057ab0287..55a58f69e 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ConditionType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ConditionType.java @@ -17,9 +17,9 @@ import java.util.List; import java.util.Set; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class provides common functionality for creating {@link Condition} instances by supplying their @@ -39,11 +39,11 @@ public class ConditionType extends ModuleType { * Creates an instance of {@link ConditionType} with base properties - UID, a {@link List} of configuration * descriptions and a {@link List} of {@link Input} descriptions. * - * @param UID the {@link ConditionType}'s identifier, or {@code null} if a random identifier should - * be generated. + * @param UID the {@link ConditionType}'s identifier, or {@code null} if a random identifier should + * be generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Condition} instances. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Condition} instances. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Condition} instances. */ public ConditionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable List inputs) { @@ -55,18 +55,18 @@ public class ConditionType extends ModuleType { * Creates an instance of {@link ConditionType} with UID, label, description, a {@link Set} of tags, visibility, * a {@link List} of configuration descriptions and a {@link List} of {@link Input} descriptions. * - * @param UID the {@link ConditionType}'s identifier, or {@code null} if a random identifier should - * be generated. + * @param UID the {@link ConditionType}'s identifier, or {@code null} if a random identifier should + * be generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Condition} instances. - * @param label a short and accurate, human-readable label of the {@link ConditionType}. - * @param description a detailed, human-readable description of usage of {@link ConditionType} and its - * benefits. - * @param tags defines categories that fit the {@link ConditionType} and which can serve as criteria - * for searching or filtering it. - * @param visibility determines whether the {@link ConditionType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future - * {@link Condition} instances. + * @param label a short and accurate, human-readable label of the {@link ConditionType}. + * @param description a detailed, human-readable description of usage of {@link ConditionType} and its + * benefits. + * @param tags defines categories that fit the {@link ConditionType} and which can serve as criteria + * for searching or filtering it. + * @param visibility determines whether the {@link ConditionType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * @param inputs a {@link List} with {@link Input} meta-information descriptions of the future + * {@link Condition} instances. */ public ConditionType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Input.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Input.java index 415be98c3..03f3ca579 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Input.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Input.java @@ -96,22 +96,22 @@ public class Input { * Creates an {@code Input} instance base on the specified parameters. Type of accepted data and input name are * required information and can't be null. * - * @param name unique name of the {@code Input} in scope of the module. - * @param type the acceptable data type for this {@link Input}. - * @param label a single word description of the {@code Input}. - * @param description user friendly description of the {@code Input}. - * @param tags are associated with the {@code Input}. The tags adds additional restrictions to connections - * between {@code Input}s and {@link Output}s. The input tags must be subset of the output tags - * to succeed the connection. - * For example: When we want to connect input to output and both have same java.lang.double data - * type. The the output has assign "temperature" and "celsius" tags then the input must have at - * least one of these output's tags (i.e. "temperature") to connect this {@code Input} to the - * selected output. - * @param required determines if the {@code Input} is required or optional. - * @param reference refers to the input of parent module type or null. If this input is part of the system module - * the reference should be null. + * @param name unique name of the {@code Input} in scope of the module. + * @param type the acceptable data type for this {@link Input}. + * @param label a single word description of the {@code Input}. + * @param description user friendly description of the {@code Input}. + * @param tags are associated with the {@code Input}. The tags adds additional restrictions to connections + * between {@code Input}s and {@link Output}s. The input tags must be subset of the output tags + * to succeed the connection. + * For example: When we want to connect input to output and both have same java.lang.double data + * type. The the output has assign "temperature" and "celsius" tags then the input must have at + * least one of these output's tags (i.e. "temperature") to connect this {@code Input} to the + * selected output. + * @param required determines if the {@code Input} is required or optional. + * @param reference refers to the input of parent module type or null. If this input is part of the system module + * the reference should be null. * @param defaultValue default value takes place when there is no value for this Input. Type of the default value - * must be the type the Input. + * must be the type the Input. * @throws IllegalArgumentException If one of the name or type parameters is null. */ public Input(String name, String type, String label, String description, Set tags, boolean required, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ModuleType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ModuleType.java index 34753bcbf..2115135e4 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ModuleType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/ModuleType.java @@ -19,11 +19,11 @@ import java.util.UUID; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.common.registry.Identifiable; import org.openhab.core.automation.Module; import org.openhab.core.automation.Rule; import org.openhab.core.automation.Visibility; +import org.openhab.core.common.registry.Identifiable; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class provides common functionality for creating {@link ModuleType} instances. Each {@link ModuleType} instance diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Output.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Output.java index 59bcf8324..9d0c1b39f 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Output.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/Output.java @@ -109,21 +109,21 @@ public class Output { /** * Constructs an {@code Output} instance with the specified parameters. * - * @param name a unique name of the {@code Output}. - * @param type the type of the output data. - * @param label a single word description of the {@code Output}. - * @param description is an user friendly description of the {@code Output}. - * @param tags are associated with the {@code Output}. The tags add additional restrictions to connections - * between {@link Input}s and {@link Output}s. The {@link Input}'s tags must be subset of the - * {@code Output}'s tags to succeed the connection.
- * For example: When we want to connect {@link Input} to - * {@code Output} and both have same java.lang.double data type. The the output has assign - * "temperature" and "celsius" tags then the input must have at least one of these output's tags - * (i.e. "temperature") to connect this input to the selected {@code Output}. - * @param reference refers to the data source. It defines what part of complex data should be used as source of - * this {@code Output}. + * @param name a unique name of the {@code Output}. + * @param type the type of the output data. + * @param label a single word description of the {@code Output}. + * @param description is an user friendly description of the {@code Output}. + * @param tags are associated with the {@code Output}. The tags add additional restrictions to connections + * between {@link Input}s and {@link Output}s. The {@link Input}'s tags must be subset of the + * {@code Output}'s tags to succeed the connection.
+ * For example: When we want to connect {@link Input} to + * {@code Output} and both have same java.lang.double data type. The the output has assign + * "temperature" and "celsius" tags then the input must have at least one of these output's tags + * (i.e. "temperature") to connect this input to the selected {@code Output}. + * @param reference refers to the data source. It defines what part of complex data should be used as source of + * this {@code Output}. * @param defaultValue takes place when there is no runtime value for this {@code Output}. Type of the default value - * must be the type of the {@code Output}. + * must be the type of the {@code Output}. * @throws IllegalArgumentException If one of the name or type parameters is null. */ public Output(String name, String type, String label, String description, Set tags, String reference, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/TriggerType.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/TriggerType.java index 4fcfdfa44..3eb327601 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/TriggerType.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/type/TriggerType.java @@ -18,9 +18,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; +import org.openhab.core.config.core.ConfigDescriptionParameter; /** * This class provides common functionality for creating {@link Trigger} instances by supplying their meta-information. @@ -39,11 +39,11 @@ public class TriggerType extends ModuleType { * Creates an instance of {@link TriggerType} with base properties - UID, a {@link List} of configuration * descriptions and a {@link List} of {@link Output} descriptions. * - * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Trigger} instances. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Trigger} instances. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Trigger} instances. */ public TriggerType(@Nullable String UID, @Nullable List configDescriptions, @Nullable List outputs) { @@ -55,20 +55,20 @@ public class TriggerType extends ModuleType { * Creates an instance of {@link TriggerType} with UID, label, description, a {@link Set} of tags, visibility, * a {@link List} of configuration descriptions and a {@link List} of {@link Output} descriptions. * - * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be - * generated. + * @param UID the {@link TriggerType}'s identifier, or {@code null} if a random identifier should be + * generated. * @param configDescriptions describing meta-data for the configuration of the future {@link Trigger} instances. - * @param label a short and accurate, human-readable label of the {@link TriggerType}. - * @param description a detailed, human-readable description of usage of {@link TriggerType} and its - * benefits. - * @param tags defines categories that fit the {@link TriggerType} and which can serve as criteria for - * searching or filtering it. - * @param visibility determines whether the {@link TriggerType} can be used by anyone if it is - * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. - * If {@code null} is provided the default visibility {@link Visibility#VISIBLE} will be - * used. - * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future - * {@link Trigger} instances. + * @param label a short and accurate, human-readable label of the {@link TriggerType}. + * @param description a detailed, human-readable description of usage of {@link TriggerType} and its + * benefits. + * @param tags defines categories that fit the {@link TriggerType} and which can serve as criteria for + * searching or filtering it. + * @param visibility determines whether the {@link TriggerType} can be used by anyone if it is + * {@link Visibility#VISIBLE} or only by its creator if it is {@link Visibility#HIDDEN}. + * If {@code null} is provided the default visibility {@link Visibility#VISIBLE} will be + * used. + * @param outputs a {@link List} with {@link Output} meta-information descriptions of the future + * {@link Trigger} instances. */ public TriggerType(@Nullable String UID, @Nullable List configDescriptions, @Nullable String label, @Nullable String description, @Nullable Set tags, diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ConfigurationNormalizer.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ConfigurationNormalizer.java index 654cd9ecf..a0d2e09f1 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ConfigurationNormalizer.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ConfigurationNormalizer.java @@ -17,15 +17,15 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigUtil; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Module; import org.openhab.core.automation.RuleRegistry; import org.openhab.core.automation.internal.ModuleImpl; import org.openhab.core.automation.internal.RuleImpl; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeRegistry; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigUtil; +import org.openhab.core.config.core.Configuration; /** * This class provides utility methods used by {@link RuleRegistry} to resolve and normalize the {@link RuleImpl}s diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ModuleBuilder.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ModuleBuilder.java index 7fb56abe1..2b361d6e9 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ModuleBuilder.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ModuleBuilder.java @@ -14,11 +14,11 @@ package org.openhab.core.automation.util; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; import org.openhab.core.automation.Trigger; +import org.openhab.core.config.core.Configuration; /** * This class allows the easy construction of a {@link Module} instance using the builder pattern. diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ReferenceResolver.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ReferenceResolver.java index 238c25115..0c50d2446 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ReferenceResolver.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/ReferenceResolver.java @@ -21,10 +21,10 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Module; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; /** diff --git a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/RuleBuilder.java b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/RuleBuilder.java index adf6d6960..c4c9555db 100644 --- a/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/RuleBuilder.java +++ b/bundles/org.openhab.core.automation/src/main/java/org/openhab/core/automation/util/RuleBuilder.java @@ -22,8 +22,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; import org.openhab.core.automation.Action; import org.openhab.core.automation.Condition; import org.openhab.core.automation.Rule; @@ -31,6 +29,8 @@ import org.openhab.core.automation.Trigger; import org.openhab.core.automation.Visibility; import org.openhab.core.automation.internal.RuleImpl; import org.openhab.core.automation.template.RuleTemplate; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; /** * This class allows the easy construction of a {@link Rule} instance using the builder pattern. diff --git a/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/internal/module/provider/AnnotationActionModuleTypeProviderTest.java b/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/internal/module/provider/AnnotationActionModuleTypeProviderTest.java index 57b9a08a8..7f818a787 100644 --- a/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/internal/module/provider/AnnotationActionModuleTypeProviderTest.java +++ b/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/internal/module/provider/AnnotationActionModuleTypeProviderTest.java @@ -22,10 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.test.java.JavaTest; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.AnnotatedActions; @@ -40,6 +36,10 @@ import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.Output; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.test.java.JavaTest; /** * Tests for the {@link AnnotatedActionModuleTypeProvider} diff --git a/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/util/ReferenceResolverUtilTest.java b/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/util/ReferenceResolverUtilTest.java index d0618fd05..89e41f714 100644 --- a/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/util/ReferenceResolverUtilTest.java +++ b/bundles/org.openhab.core.automation/src/test/java/org/openhab/core/automation/util/ReferenceResolverUtilTest.java @@ -18,10 +18,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openhab.core.config.core.Configuration; import org.junit.Assert; import org.junit.Test; import org.openhab.core.automation.Module; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.binding.xml/pom.xml b/bundles/org.openhab.core.binding.xml/pom.xml index 5df50abbb..d481bf602 100644 --- a/bundles/org.openhab.core.binding.xml/pom.xml +++ b/bundles/org.openhab.core.binding.xml/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoConverter.java b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoConverter.java index 8e65bce85..effb1f5f0 100644 --- a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoConverter.java +++ b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoConverter.java @@ -17,11 +17,11 @@ import java.net.URISyntaxException; import java.util.List; import java.util.Map; +import org.openhab.core.binding.BindingInfo; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.xml.util.ConverterAttributeMapValidator; import org.openhab.core.config.xml.util.GenericUnmarshaller; import org.openhab.core.config.xml.util.NodeIterator; -import org.openhab.core.binding.BindingInfo; import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.converters.Converter; diff --git a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlProvider.java b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlProvider.java index 219e9bb3b..b2be74775 100644 --- a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlProvider.java +++ b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlProvider.java @@ -14,11 +14,11 @@ package org.openhab.core.binding.xml.internal; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.binding.BindingInfo; +import org.openhab.core.binding.BindingInfoProvider; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider; import org.openhab.core.config.xml.osgi.XmlDocumentProvider; -import org.openhab.core.binding.BindingInfo; -import org.openhab.core.binding.BindingInfoProvider; import org.osgi.framework.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlResult.java b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlResult.java index df85722f6..9765d694e 100644 --- a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlResult.java +++ b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/BindingInfoXmlResult.java @@ -14,9 +14,9 @@ package org.openhab.core.binding.xml.internal; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.binding.BindingInfo; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionProvider; -import org.openhab.core.binding.BindingInfo; /** * The {@link BindingInfoXmlResult} is an intermediate XML conversion result object which diff --git a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/XmlBindingInfoProvider.java b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/XmlBindingInfoProvider.java index 8487ce877..8fce73f9e 100644 --- a/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/XmlBindingInfoProvider.java +++ b/bundles/org.openhab.core.binding.xml/src/main/java/org/openhab/core/binding/xml/internal/XmlBindingInfoProvider.java @@ -19,6 +19,10 @@ import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.binding.BindingInfo; +import org.openhab.core.binding.BindingInfoProvider; +import org.openhab.core.binding.i18n.BindingI18nLocalizationService; +import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.config.core.ConfigDescriptionProvider; import org.openhab.core.config.xml.AbstractXmlBasedProvider; import org.openhab.core.config.xml.AbstractXmlConfigDescriptionProvider; @@ -26,10 +30,6 @@ import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker; import org.openhab.core.config.xml.osgi.XmlDocumentProvider; import org.openhab.core.config.xml.osgi.XmlDocumentProviderFactory; import org.openhab.core.config.xml.util.XmlDocumentReader; -import org.openhab.core.binding.BindingInfo; -import org.openhab.core.binding.BindingInfoProvider; -import org.openhab.core.binding.i18n.BindingI18nLocalizationService; -import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.service.ReadyService; import org.osgi.framework.Bundle; import org.osgi.service.component.ComponentContext; diff --git a/bundles/org.openhab.core.boot/pom.xml b/bundles/org.openhab.core.boot/pom.xml index c863a57a9..3fd4d17dc 100644 --- a/bundles/org.openhab.core.boot/pom.xml +++ b/bundles/org.openhab.core.boot/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/internal/item/DefaultSitemapProvider.java b/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/internal/item/DefaultSitemapProvider.java index 136a72829..7b6c6a837 100644 --- a/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/internal/item/DefaultSitemapProvider.java +++ b/bundles/org.openhab.core.boot/src/main/java/org/openhab/core/internal/item/DefaultSitemapProvider.java @@ -15,10 +15,6 @@ package org.openhab.core.internal.item; import java.util.Collections; import java.util.Set; -import org.openhab.core.thing.Channel; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingRegistry; -import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.openhab.core.model.core.ModelRepositoryChangeListener; import org.openhab.core.model.sitemap.SitemapProvider; import org.openhab.core.model.sitemap.sitemap.Sitemap; @@ -27,6 +23,10 @@ import org.openhab.core.model.sitemap.sitemap.impl.DefaultImpl; import org.openhab.core.model.sitemap.sitemap.impl.FrameImpl; import org.openhab.core.model.sitemap.sitemap.impl.SitemapImpl; import org.openhab.core.model.sitemap.sitemap.impl.TextImpl; +import org.openhab.core.thing.Channel; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingRegistry; +import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.config.core/pom.xml b/bundles/org.openhab.core.config.core/pom.xml index 707474350..1e4ea745d 100644 --- a/bundles/org.openhab.core.config.core/pom.xml +++ b/bundles/org.openhab.core.config.core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigDescriptionParameterGroup.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigDescriptionParameterGroup.java index 630f81b0a..e22daad93 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigDescriptionParameterGroup.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigDescriptionParameterGroup.java @@ -1,111 +1,111 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.core; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * The {@link ConfigDescriptionParameterGroup} specifies information about parameter groups. - * A parameter group is used to group a number of parameters together so they can - * be displayed together in the UI (eg in a single tab). - *

- * A {@link ConfigDescriptionParameter} instance must also contain the groupName. It should be permissible to use the - * groupId in the {@link ConfigDesctiptionParameter} without supplying a corresponding - * {@link ConfigDescriptionParameterGroup} - in this way the UI can group the parameters together, but doesn't have the - * group information. - * - * @author Chris Jackson - Initial contribution - */ -@NonNullByDefault -public class ConfigDescriptionParameterGroup { - - private final String name; - private final @Nullable String context; - private final boolean advanced; - private final @Nullable String label; - private final @Nullable String description; - - /** - * Create a Parameter Group. A group is used by the user interface to display groups - * of parameters together. - * - * @param name the name, used to link the group, to the parameter - * @param context a context string. Can be used to provide some context to the group - * @param advanced a flag that is set to true if this group contains advanced settings - * @param label the human readable group label - * @param description a description that can be provided to the user - */ - public ConfigDescriptionParameterGroup(String name, @Nullable String context, Boolean advanced, - @Nullable String label, @Nullable String description) { - this.name = name; - this.context = context; - this.advanced = advanced; - this.label = label; - this.description = description; - } - - /** - * Get the name of the group. - * - * @return groupName as string - */ - public String getName() { - return name; - } - - /** - * Get the context of the group. - * - * @return group context as a string - */ - public @Nullable String getContext() { - return context; - } - - /** - * Gets the advanced flag for this group. - * - * @return advanced flag - true if the group contains advanced properties - */ - public boolean isAdvanced() { - return advanced; - } - - /** - * Get the human readable label of the group - * - * @return group label as a string - */ - @Nullable - public String getLabel() { - return label; - } - - /** - * Get the human readable description of the parameter group - * - * @return group description as a string - */ - @Nullable - public String getDescription() { - return description; - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + " [groupId=\"" + name + "\", context=\"" + context + "\", advanced=\"" - + advanced + "\"" + (label != null ? ", label=\"" + label + "\"" : "") - + (description != null ? ", description=\"" + description + "\"" : "") + "]"; - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.core; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * The {@link ConfigDescriptionParameterGroup} specifies information about parameter groups. + * A parameter group is used to group a number of parameters together so they can + * be displayed together in the UI (eg in a single tab). + *

+ * A {@link ConfigDescriptionParameter} instance must also contain the groupName. It should be permissible to use the + * groupId in the {@link ConfigDesctiptionParameter} without supplying a corresponding + * {@link ConfigDescriptionParameterGroup} - in this way the UI can group the parameters together, but doesn't have the + * group information. + * + * @author Chris Jackson - Initial contribution + */ +@NonNullByDefault +public class ConfigDescriptionParameterGroup { + + private final String name; + private final @Nullable String context; + private final boolean advanced; + private final @Nullable String label; + private final @Nullable String description; + + /** + * Create a Parameter Group. A group is used by the user interface to display groups + * of parameters together. + * + * @param name the name, used to link the group, to the parameter + * @param context a context string. Can be used to provide some context to the group + * @param advanced a flag that is set to true if this group contains advanced settings + * @param label the human readable group label + * @param description a description that can be provided to the user + */ + public ConfigDescriptionParameterGroup(String name, @Nullable String context, Boolean advanced, + @Nullable String label, @Nullable String description) { + this.name = name; + this.context = context; + this.advanced = advanced; + this.label = label; + this.description = description; + } + + /** + * Get the name of the group. + * + * @return groupName as string + */ + public String getName() { + return name; + } + + /** + * Get the context of the group. + * + * @return group context as a string + */ + public @Nullable String getContext() { + return context; + } + + /** + * Gets the advanced flag for this group. + * + * @return advanced flag - true if the group contains advanced properties + */ + public boolean isAdvanced() { + return advanced; + } + + /** + * Get the human readable label of the group + * + * @return group label as a string + */ + @Nullable + public String getLabel() { + return label; + } + + /** + * Get the human readable description of the parameter group + * + * @return group description as a string + */ + @Nullable + public String getDescription() { + return description; + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " [groupId=\"" + name + "\", context=\"" + context + "\", advanced=\"" + + advanced + "\"" + (label != null ? ", label=\"" + label + "\"" : "") + + (description != null ? ", description=\"" + description + "\"" : "") + "]"; + } +} diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigOptionProvider.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigOptionProvider.java index 4ad3089e4..e17cd1f97 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigOptionProvider.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ConfigOptionProvider.java @@ -34,8 +34,8 @@ public interface ConfigOptionProvider { * * @deprecated Use {@link getParameterOptions} with context instead. * - * @param uri the uri of the config description - * @param param the parameter name for which the requested options shall be returned + * @param uri the uri of the config description + * @param param the parameter name for which the requested options shall be returned * @param locale the locale in which the result is expected * @return the configuration options provided by this provider if any or {@code null} otherwise */ @@ -46,10 +46,10 @@ public interface ConfigOptionProvider { /** * Provides a collection of {@link ParameterOptions}s. * - * @param uri the uri of the config description - * @param param the parameter name for which the requested options shall be returned + * @param uri the uri of the config description + * @param param the parameter name for which the requested options shall be returned * @param context the defined context of the parameter - * @param locale the locale in which the result is expected + * @param locale the locale in which the result is expected * @return the configuration options provided by this provider if any or {@code null} otherwise */ default @Nullable Collection getParameterOptions(URI uri, String param, @Nullable String context, diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/FilterCriteria.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/FilterCriteria.java index a8a824621..19e0a1587 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/FilterCriteria.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/FilterCriteria.java @@ -1,54 +1,54 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.core; - -/** - * The {@link FilterCriteria} specifies a filter for dynamic selection list - * providers of a {@link ConfigDescriptionParameter}. - *

- * The {@link FilterCriteria} and its name is related to the context of the containing - * {@link ConfigDescriptionParameter}. - * - * @author Alex Tugarev - Initial contribution - * @author Markus Rathgeb - Add default constructor for deserialization - */ -public class FilterCriteria { - - private String value; - private String name; - - /** - * Default constructor for deserialization e.g. by Gson. - */ - protected FilterCriteria() { - } - - public FilterCriteria(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + " [name=\"" + name + "\", value=\"" + value + "\"]"; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.core; + +/** + * The {@link FilterCriteria} specifies a filter for dynamic selection list + * providers of a {@link ConfigDescriptionParameter}. + *

+ * The {@link FilterCriteria} and its name is related to the context of the containing + * {@link ConfigDescriptionParameter}. + * + * @author Alex Tugarev - Initial contribution + * @author Markus Rathgeb - Add default constructor for deserialization + */ +public class FilterCriteria { + + private String value; + private String name; + + /** + * Default constructor for deserialization e.g. by Gson. + */ + protected FilterCriteria() { + } + + public FilterCriteria(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " [name=\"" + name + "\", value=\"" + value + "\"]"; + } + +} diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ParameterOption.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ParameterOption.java index d066eafe8..b221132ba 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ParameterOption.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/ParameterOption.java @@ -1,90 +1,90 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.core; - -/** - * The {@link ParameterOption} specifies one option of a static selection list. - *

- * A {@link ConfigDescriptionParameter} instance can contain a list of {@link ParameterOption}s to define a static - * selection list for the parameter value. - * - * @author Alex Tugarev - Initial contribution - */ -public class ParameterOption { - - private String label; - private String value; - - /** - * Default constructor for deserialization e.g. by Gson. - */ - protected ParameterOption() { - } - - public ParameterOption(String value, String label) { - this.value = value; - this.label = label; - } - - public String getLabel() { - return label; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + " [value=\"" + value + "\", label=\"" + label + "\"]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((label == null) ? 0 : label.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ParameterOption other = (ParameterOption) obj; - if (label == null) { - if (other.label != null) { - return false; - } - } else if (!label.equals(other.label)) { - return false; - } - if (value == null) { - if (other.value != null) { - return false; - } - } else if (!value.equals(other.value)) { - return false; - } - return true; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.core; + +/** + * The {@link ParameterOption} specifies one option of a static selection list. + *

+ * A {@link ConfigDescriptionParameter} instance can contain a list of {@link ParameterOption}s to define a static + * selection list for the parameter value. + * + * @author Alex Tugarev - Initial contribution + */ +public class ParameterOption { + + private String label; + private String value; + + /** + * Default constructor for deserialization e.g. by Gson. + */ + protected ParameterOption() { + } + + public ParameterOption(String value, String label) { + this.value = value; + this.label = label; + } + + public String getLabel() { + return label; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " [value=\"" + value + "\", label=\"" + label + "\"]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((label == null) ? 0 : label.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ParameterOption other = (ParameterOption) obj; + if (label == null) { + if (other.label != null) { + return false; + } + } else if (!label.equals(other.label)) { + return false; + } + if (value == null) { + if (other.value != null) { + return false; + } + } else if (!value.equals(other.value)) { + return false; + } + return true; + } + +} diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ConfigDescriptionParameterGroupDTO.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ConfigDescriptionParameterGroupDTO.java index fb10f443c..30f097ac0 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ConfigDescriptionParameterGroupDTO.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ConfigDescriptionParameterGroupDTO.java @@ -29,7 +29,8 @@ public class ConfigDescriptionParameterGroupDTO { public ConfigDescriptionParameterGroupDTO() { } - public ConfigDescriptionParameterGroupDTO(String name, String context, Boolean advanced, String label, String description) { + public ConfigDescriptionParameterGroupDTO(String name, String context, Boolean advanced, String label, + String description) { this.name = name; this.context = context; this.advanced = advanced; diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/FilterCriteriaDTO.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/FilterCriteriaDTO.java index 2f450a7ec..975e21831 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/FilterCriteriaDTO.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/FilterCriteriaDTO.java @@ -1,33 +1,33 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.core.dto; - -/** - * This is a data transfer object that is used to serialize filter criteria of a - * parameter. - * - * @author Alex Tugarev - Initial contribution - */ -public class FilterCriteriaDTO { - - public String value; - public String name; - - public FilterCriteriaDTO() { - } - - public FilterCriteriaDTO(String name, String value) { - this.name = name; - this.value = value; - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.core.dto; + +/** + * This is a data transfer object that is used to serialize filter criteria of a + * parameter. + * + * @author Alex Tugarev - Initial contribution + */ +public class FilterCriteriaDTO { + + public String value; + public String name; + + public FilterCriteriaDTO() { + } + + public FilterCriteriaDTO(String name, String value) { + this.name = name; + this.value = value; + } +} diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ParameterOptionDTO.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ParameterOptionDTO.java index 5108b81de..e312411c9 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ParameterOptionDTO.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/dto/ParameterOptionDTO.java @@ -1,33 +1,33 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.core.dto; - -/** - * This is a data transfer object that is used to serialize options of a - * parameter. - * - * @author Alex Tugarev - Initial contribution - */ -public class ParameterOptionDTO { - - public String label; - public String value; - - public ParameterOptionDTO() { - } - - public ParameterOptionDTO(String value, String label) { - this.value = value; - this.label = label; - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.core.dto; + +/** + * This is a data transfer object that is used to serialize options of a + * parameter. + * + * @author Alex Tugarev - Initial contribution + */ +public class ParameterOptionDTO { + + public String label; + public String value; + + public ParameterOptionDTO() { + } + + public ParameterOptionDTO(String value, String label) { + this.value = value; + this.label = label; + } +} diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImpl.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImpl.java index 8b3d69224..4d8b7ff11 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImpl.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImpl.java @@ -25,10 +25,10 @@ import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.metadata.MetadataConfigDescriptionProvider; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ConfigDescriptionProvider; import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.config.core.metadata.MetadataConfigDescriptionProvider; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/MinMaxValidator.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/MinMaxValidator.java index a98e4933f..d0d8c2c49 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/MinMaxValidator.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/MinMaxValidator.java @@ -16,8 +16,8 @@ import java.math.BigDecimal; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.internal.validation.TypeIntrospections.TypeIntrospection; import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.config.core.internal.validation.TypeIntrospections.TypeIntrospection; import org.openhab.core.config.core.validation.ConfigValidationMessage; /** @@ -67,6 +67,7 @@ final class MinMaxValidator implements ConfigDescriptionParameterValidator { private static ConfigValidationMessage createMinMaxViolationMessage(String parameterName, MessageKey messageKey, BigDecimal minMax) { - return new ConfigValidationMessage(parameterName, messageKey.defaultMessage, messageKey.key, String.valueOf(minMax)); + return new ConfigValidationMessage(parameterName, messageKey.defaultMessage, messageKey.key, + String.valueOf(minMax)); } } diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/PatternValidator.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/PatternValidator.java index e2f3c2215..32930e869 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/PatternValidator.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/internal/validation/PatternValidator.java @@ -32,8 +32,8 @@ final class PatternValidator implements ConfigDescriptionParameterValidator { if (!((String) value).matches(parameter.getPattern())) { MessageKey messageKey = MessageKey.PATTERN_VIOLATED; - return new ConfigValidationMessage(parameter.getName(), messageKey.defaultMessage, messageKey.key, String.valueOf(value), - parameter.getPattern()); + return new ConfigValidationMessage(parameter.getName(), messageKey.defaultMessage, messageKey.key, + String.valueOf(value), parameter.getPattern()); } return null; diff --git a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/status/ConfigStatusService.java b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/status/ConfigStatusService.java index c43d001a4..8ed6fbbd4 100644 --- a/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/status/ConfigStatusService.java +++ b/bundles/org.openhab.core.config.core/src/main/java/org/openhab/core/config/core/status/ConfigStatusService.java @@ -18,8 +18,8 @@ import java.util.Locale; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; -import org.openhab.core.config.core.status.events.ConfigStatusInfoEvent; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.core.status.events.ConfigStatusInfoEvent; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.TranslationProvider; diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionBuilderTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionBuilderTest.java index f6a16c8b7..5245df560 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionBuilderTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionBuilderTest.java @@ -20,9 +20,9 @@ import java.net.URI; import java.util.Arrays; import java.util.List; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; /** * Tests for {@link ConfigDescriptionBuilder) class. diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionParameterBuilderTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionParameterBuilderTest.java index 24c4490d8..036ff174f 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionParameterBuilderTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionParameterBuilderTest.java @@ -18,8 +18,8 @@ import static org.junit.Assert.*; import java.math.BigDecimal; import java.util.Arrays; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.junit.Test; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; /** * Tests for {@link ConfigDescriptionParameterBuilder) class. diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionRegistryTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionRegistryTest.java index 9cf05c3b2..cf876a570 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionRegistryTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigDescriptionRegistryTest.java @@ -24,10 +24,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.openhab.core.test.java.JavaTest; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.test.java.JavaTest; /** * Tests {@link ConfigDescriptionRegistry}. diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigUtilTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigUtilTest.java index 9939c2b00..775b76051 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigUtilTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/ConfigUtilTest.java @@ -12,9 +12,9 @@ */ package org.openhab.core.config.core; -import static org.openhab.core.config.core.ConfigDescriptionParameter.Type.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.config.core.ConfigDescriptionParameter.Type.*; import java.math.BigDecimal; import java.net.URI; diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/i18n/I18nConfigOptionsProviderTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/i18n/I18nConfigOptionsProviderTest.java index 5578671f5..62ba630bf 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/i18n/I18nConfigOptionsProviderTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/i18n/I18nConfigOptionsProviderTest.java @@ -18,10 +18,10 @@ import static org.junit.Assert.assertThat; import java.net.URI; import java.util.Locale; -import org.openhab.core.config.core.ParameterOption; import org.hamcrest.collection.IsEmptyCollection; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.ParameterOption; /** * Tests for {@link I18nConfigOptionsProvider} diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java index 06f64e71a..b1fae524e 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/metadata/MetadataConfigDescriptionProviderImplTest.java @@ -12,17 +12,20 @@ */ package org.openhab.core.config.core.internal.metadata; -import static org.openhab.core.config.core.internal.metadata.MetadataConfigDescriptionProviderImpl.*; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; +import static org.openhab.core.config.core.internal.metadata.MetadataConfigDescriptionProviderImpl.*; import java.net.URI; import java.util.Arrays; import java.util.Collection; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; @@ -30,9 +33,6 @@ import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ParameterOption; import org.openhab.core.config.core.metadata.MetadataConfigDescriptionProvider; import org.openhab.core.test.java.JavaTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/normalization/NormalizerTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/normalization/NormalizerTest.java index ee99671a0..8ffa5a519 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/normalization/NormalizerTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/normalization/NormalizerTest.java @@ -21,9 +21,9 @@ import java.util.List; import java.util.TreeSet; import java.util.stream.Stream; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.junit.Test; /** * @author Simon Kaufmann - Initial contribution diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigDescriptionValidatorTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigDescriptionValidatorTest.java index e17d71abe..d4b05eede 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigDescriptionValidatorTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigDescriptionValidatorTest.java @@ -28,6 +28,10 @@ import java.util.List; import java.util.Map; import java.util.stream.Stream; +import org.junit.Before; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; @@ -36,10 +40,6 @@ import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.validation.ConfigDescriptionValidator; import org.openhab.core.config.core.validation.ConfigValidationException; import org.openhab.core.config.core.validation.ConfigValidationMessage; -import org.junit.Before; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigValidationExceptionTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigValidationExceptionTest.java index 0bd997521..d12f8de4b 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigValidationExceptionTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/internal/validation/ConfigValidationExceptionTest.java @@ -25,11 +25,11 @@ import java.util.Map; import java.util.stream.Stream; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Test; +import org.mockito.Mockito; import org.openhab.core.config.core.validation.ConfigValidationException; import org.openhab.core.config.core.validation.ConfigValidationMessage; import org.openhab.core.i18n.TranslationProvider; -import org.junit.Test; -import org.mockito.Mockito; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusInfoTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusInfoTest.java index eb65f8c0c..65b2e629a 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusInfoTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusInfoTest.java @@ -20,8 +20,8 @@ import static org.junit.Assert.assertThat; import java.util.List; import java.util.stream.Stream; -import org.openhab.core.config.core.status.ConfigStatusMessage.Type; import org.junit.Test; +import org.openhab.core.config.core.status.ConfigStatusMessage.Type; /** * Testing the {@link ConfigStatusInfo}. diff --git a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusServiceTest.java b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusServiceTest.java index 00883d5b9..9edcfee5d 100644 --- a/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusServiceTest.java +++ b/bundles/org.openhab.core.config.core/src/test/java/org/openhab/core/config/core/status/ConfigStatusServiceTest.java @@ -23,14 +23,14 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.status.ConfigStatusMessage.Type; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.TranslationProvider; -import org.openhab.core.util.BundleResolver; import org.openhab.core.test.java.JavaTest; -import org.junit.Before; -import org.junit.Test; +import org.openhab.core.util.BundleResolver; /** * Testing the {@link ConfigStatusService} OSGi service. diff --git a/bundles/org.openhab.core.config.discovery.mdns/pom.xml b/bundles/org.openhab.core.config.discovery.mdns/pom.xml index 15edf0bf4..91abba294 100644 --- a/bundles/org.openhab.core.config.discovery.mdns/pom.xml +++ b/bundles/org.openhab.core.config.discovery.mdns/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.discovery.mdns/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryService.java b/bundles/org.openhab.core.config.discovery.mdns/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryService.java index 297e35e02..e829cda8c 100644 --- a/bundles/org.openhab.core.config.discovery.mdns/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryService.java +++ b/bundles/org.openhab.core.config.discovery.mdns/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryService.java @@ -29,9 +29,9 @@ import org.openhab.core.config.discovery.AbstractDiscoveryService; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryService; import org.openhab.core.config.discovery.mdns.MDNSDiscoveryParticipant; +import org.openhab.core.io.transport.mdns.MDNSClient; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.openhab.core.io.transport.mdns.MDNSClient; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Modified; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.config.discovery.upnp/pom.xml b/bundles/org.openhab.core.config.discovery.upnp/pom.xml index d1ca0d5b1..4966469a4 100644 --- a/bundles/org.openhab.core.config.discovery.upnp/pom.xml +++ b/bundles/org.openhab.core.config.discovery.upnp/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/UpnpDiscoveryParticipant.java b/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/UpnpDiscoveryParticipant.java index 3461dbaa3..6540362ad 100644 --- a/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/UpnpDiscoveryParticipant.java +++ b/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/UpnpDiscoveryParticipant.java @@ -16,10 +16,10 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.jupnp.model.meta.RemoteDevice; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.jupnp.model.meta.RemoteDevice; /** * A {@link UpnpDiscoveryParticipant} that is registered as a service is picked up by the UpnpDiscoveryService diff --git a/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/internal/UpnpDiscoveryService.java b/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/internal/UpnpDiscoveryService.java index d0e4b3b89..d7eb20a70 100644 --- a/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/internal/UpnpDiscoveryService.java +++ b/bundles/org.openhab.core.config.discovery.upnp/src/main/java/org/openhab/core/config/discovery/upnp/internal/UpnpDiscoveryService.java @@ -19,6 +19,12 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import org.jupnp.UpnpService; +import org.jupnp.model.meta.LocalDevice; +import org.jupnp.model.meta.RemoteDevice; +import org.jupnp.registry.Registry; +import org.jupnp.registry.RegistryListener; +import org.jupnp.transport.RouterException; import org.openhab.core.config.discovery.AbstractDiscoveryService; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryService; @@ -28,12 +34,6 @@ import org.openhab.core.net.NetworkAddressChangeListener; import org.openhab.core.net.NetworkAddressService; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.jupnp.UpnpService; -import org.jupnp.model.meta.LocalDevice; -import org.jupnp.model.meta.RemoteDevice; -import org.jupnp.registry.Registry; -import org.jupnp.registry.RegistryListener; -import org.jupnp.transport.RouterException; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Modified; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/pom.xml b/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/pom.xml index c7dc2e33e..d0ac9621a 100644 --- a/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/pom.xml +++ b/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScanner.java b/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScanner.java index f72d20c7a..52e137304 100644 --- a/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScanner.java +++ b/bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScanner.java @@ -26,11 +26,11 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.ThreadFactoryBuilder; import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; import org.openhab.core.config.discovery.usbserial.UsbSerialDiscovery; import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryListener; import org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.DeltaUsbSerialScanner.Delta; -import org.openhab.core.common.ThreadFactoryBuilder; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.config.discovery.usbserial/pom.xml b/bundles/org.openhab.core.config.discovery.usbserial/pom.xml index a7a99fa81..13ebdb707 100644 --- a/bundles/org.openhab.core.config.discovery.usbserial/pom.xml +++ b/bundles/org.openhab.core.config.discovery.usbserial/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.discovery/pom.xml b/bundles/org.openhab.core.config.discovery/pom.xml index 12c304f7b..d84496aee 100644 --- a/bundles/org.openhab.core.config.discovery/pom.xml +++ b/bundles/org.openhab.core.config.discovery/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/AbstractDiscoveryService.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/AbstractDiscoveryService.java index 4cd9c0eaa..af45c91b1 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/AbstractDiscoveryService.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/AbstractDiscoveryService.java @@ -27,8 +27,8 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.discovery.internal.DiscoveryResultImpl; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.discovery.internal.DiscoveryResultImpl; import org.openhab.core.i18n.I18nUtil; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.TranslationProvider; diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/UpnpDiscoveryParticipant.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/UpnpDiscoveryParticipant.java index 82ad742d3..ecc49cfc4 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/UpnpDiscoveryParticipant.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/UpnpDiscoveryParticipant.java @@ -16,9 +16,9 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.jupnp.model.meta.RemoteDevice; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.jupnp.model.meta.RemoteDevice; /** * A {@link UpnpDiscoveryParticipant} that is registered as a service is picked up by the UpnpDiscoveryService diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessor.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessor.java index 246566a13..5eb0f1db5 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessor.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessor.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.config.core.Configuration; import org.openhab.core.config.discovery.DiscoveryResult; @@ -31,7 +32,6 @@ import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.config.discovery.inbox.Inbox; import org.openhab.core.config.discovery.inbox.InboxAutoApprovePredicate; import org.openhab.core.config.discovery.inbox.InboxListener; -import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.events.AbstractTypedEventSubscriber; import org.openhab.core.events.EventSubscriber; import org.openhab.core.thing.Thing; @@ -87,8 +87,7 @@ import org.slf4j.LoggerFactory; * @author Henning Sudbrock - added hook for selectively auto-approving inbox entries */ @Component(immediate = true, configurationPid = "org.openhab.core.inbox", service = EventSubscriber.class, property = { - Constants.SERVICE_PID + "=org.openhab.core.inbox", - ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=system", + Constants.SERVICE_PID + "=org.openhab.core.inbox", ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=system", ConfigurableService.SERVICE_PROPERTY_LABEL + "=Inbox", ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI + "=system:inbox" }) @NonNullByDefault diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java index baa79a9a2..763da9e0f 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/DiscoveryServiceRegistryImpl.java @@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.SafeCaller; import org.openhab.core.config.discovery.DiscoveryListener; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryService; @@ -36,7 +37,6 @@ import org.openhab.core.config.discovery.DiscoveryServiceCallback; import org.openhab.core.config.discovery.DiscoveryServiceRegistry; import org.openhab.core.config.discovery.ExtendedDiscoveryService; import org.openhab.core.config.discovery.ScanListener; -import org.openhab.core.common.SafeCaller; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/PersistentInbox.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/PersistentInbox.java index b009f033b..7dbb93fd4 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/PersistentInbox.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/PersistentInbox.java @@ -35,6 +35,7 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionRegistry; @@ -49,7 +50,6 @@ import org.openhab.core.config.discovery.inbox.Inbox; import org.openhab.core.config.discovery.inbox.InboxFilterCriteria; import org.openhab.core.config.discovery.inbox.InboxListener; import org.openhab.core.config.discovery.inbox.events.InboxEventFactory; -import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.events.EventPublisher; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/DiscoveryConsoleCommandExtension.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/DiscoveryConsoleCommandExtension.java index 6f91387a3..c22872e90 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/DiscoveryConsoleCommandExtension.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/DiscoveryConsoleCommandExtension.java @@ -20,10 +20,10 @@ import java.util.List; import org.openhab.core.config.discovery.DiscoveryService; import org.openhab.core.config.discovery.DiscoveryServiceRegistry; -import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.io.console.Console; import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; import org.openhab.core.io.console.extensions.ConsoleCommandExtension; +import org.openhab.core.thing.ThingTypeUID; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/InboxConsoleCommandExtension.java b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/InboxConsoleCommandExtension.java index 418447e56..d09ecd560 100644 --- a/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/InboxConsoleCommandExtension.java +++ b/bundles/org.openhab.core.config.discovery/src/main/java/org/openhab/core/config/discovery/internal/console/InboxConsoleCommandExtension.java @@ -24,11 +24,11 @@ import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.config.discovery.inbox.Inbox; import org.openhab.core.config.discovery.internal.PersistentInbox; -import org.openhab.core.thing.ThingTypeUID; -import org.openhab.core.thing.ThingUID; import org.openhab.core.io.console.Console; import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; import org.openhab.core.io.console.extensions.ConsoleCommandExtension; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.ThingUID; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/InboxPredicatesTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/InboxPredicatesTest.java index 482d84fbb..f81341d8b 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/InboxPredicatesTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/InboxPredicatesTest.java @@ -12,9 +12,9 @@ */ package org.openhab.core.config.discovery.inbox; -import static org.openhab.core.config.discovery.inbox.InboxPredicates.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.config.discovery.inbox.InboxPredicates.*; import java.util.AbstractMap.SimpleEntry; import java.util.Arrays; @@ -25,13 +25,13 @@ import java.util.Map.Entry; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.config.discovery.internal.DiscoveryResultImpl; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.junit.Before; -import org.junit.Test; /** * Tests for {@link InboxPredicates}. diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/events/InboxEventFactoryTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/events/InboxEventFactoryTest.java index ed018b7ef..0e9582321 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/events/InboxEventFactoryTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/inbox/events/InboxEventFactoryTest.java @@ -15,13 +15,13 @@ package org.openhab.core.config.discovery.inbox.events; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import org.junit.Test; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.dto.DiscoveryResultDTOMapper; import org.openhab.core.config.discovery.internal.DiscoveryResultImpl; import org.openhab.core.events.Event; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.junit.Test; import com.google.gson.Gson; diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessorTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessorTest.java index 38e13950b..5c773ccfb 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessorTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/AutomaticInboxProcessorTest.java @@ -12,13 +12,13 @@ */ package org.openhab.core.config.discovery.internal; -import static org.openhab.core.config.discovery.inbox.InboxPredicates.withFlag; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; +import static org.openhab.core.config.discovery.inbox.InboxPredicates.withFlag; import java.util.Collections; import java.util.HashMap; @@ -27,12 +27,18 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.Configuration; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryResultBuilder; import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.config.discovery.DiscoveryServiceRegistry; +import org.openhab.core.test.storage.VolatileStorageService; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; @@ -47,12 +53,6 @@ import org.openhab.core.thing.events.ThingStatusInfoChangedEvent; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; -import org.openhab.core.test.storage.VolatileStorageService; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; /** * @author Andre Fuechsel - Initial contribution diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/DiscoveryResultImplTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/DiscoveryResultImplTest.java index dd02a2e80..68d78fd4a 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/DiscoveryResultImplTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/DiscoveryResultImplTest.java @@ -17,11 +17,11 @@ import static org.junit.Assert.*; import java.util.HashMap; import java.util.Map; +import org.junit.Test; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.junit.Test; /** * The {@link DiscoveryResultImplTest} checks if any invalid input parameters diff --git a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/PersistentInboxTest.java b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/PersistentInboxTest.java index 41ee7dda2..1b4e6794e 100644 --- a/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/PersistentInboxTest.java +++ b/bundles/org.openhab.core.config.discovery/src/test/java/org/openhab/core/config/discovery/internal/PersistentInboxTest.java @@ -25,6 +25,10 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; @@ -49,10 +53,6 @@ import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; /** * @author Simon Kaufmann - Initial contribution diff --git a/bundles/org.openhab.core.config.dispatch/pom.xml b/bundles/org.openhab.core.config.dispatch/pom.xml index e35f017ae..b9e4acd8b 100644 --- a/bundles/org.openhab.core.config.dispatch/pom.xml +++ b/bundles/org.openhab.core.config.dispatch/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java b/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java index 467cb154c..3cfe07bd4 100644 --- a/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java +++ b/bundles/org.openhab.core.config.dispatch/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcher.java @@ -1,567 +1,567 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.dispatch.internal; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; -import org.osgi.service.cm.ManagedService; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Reference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.Gson; -import com.google.gson.JsonIOException; -import com.google.gson.JsonSyntaxException; - -/** - * This class provides a mean to read any kind of configuration data from - * config folder files and dispatch it to the different bundles using the {@link ConfigurationAdmin} service. - * - *

- * The name of the configuration folder can be provided as a program argument "smarthome.configdir" (default is "conf"). - * Configurations for OSGi services are kept in a subfolder that can be provided as a program argument - * "smarthome.servicedir" (default is "services"). Any file in this folder with the extension .cfg will be processed. - * - *

- * The format of the configuration file is similar to a standard property file, with the exception that the property - * name can be prefixed by the service pid of the {@link ManagedService}: - * - *

- * <service-pid>:<property>=<value> - * - *

- * In case the pid does not contain any ".", the default service pid namespace is prefixed, which can be defined by the - * program argument "smarthome.servicepid" (default is "org.openhab.core"). - * - *

- * If no pid is defined in the property line, the default pid namespace will be used together with the filename. E.g. if - * you have a file "security.cfg", the pid that will be used is "org.openhab.core.security". - * - *

- * Last but not least, a pid can be defined in the first line of a cfg file by prefixing it with "pid:", e.g. - * "pid: com.acme.smarthome.security". - * - *

- * The value can be surrounded by square brackets ('[' and ']') and optionally contain value delimiters to be - * interpreted as a list of tokens. Default value delimiter is the comma ','. So the following property definition - * "property = [This property, has multiple, values]" will result in a collection with three values. - * - * @author Kai Kreuzer - Initial contribution - * @author Petar Valchev - Added sort by modification time, when configuration files are read - * @author Ana Dimova - Reduce to a single watch thread for all class instances - * @author Henning Treu - Delete orphan exclusive configuration from configAdmin - * @author Stefan Triller - Add support for service contexts - * @author Christoph Weitkamp - Added support for value containing a list of configuration options - */ -@Component(immediate = true, service = ConfigDispatcher.class) -public class ConfigDispatcher { - - private final Logger logger = LoggerFactory.getLogger(ConfigDispatcher.class); - - private final Gson gson = new Gson(); - - /** The program argument name for setting the service pid namespace */ - public static final String SERVICEPID_PROG_ARGUMENT = "smarthome.servicepid"; - - /** The property to recognize a service instance created by a service factory */ - public static final String SERVICE_CONTEXT = "esh.servicecontext"; - - /** The property to separate service PIDs from their contexts */ - public static final String SERVICE_CONTEXT_MARKER = "#"; - - /** - * The program argument name for setting the default services config file - * name - */ - public static final String SERVICECFG_PROG_ARGUMENT = "smarthome.servicecfg"; - - /** The default namespace for service pids */ - public static final String SERVICE_PID_NAMESPACE = "org.openhab.core"; - - /** The default services configuration filename */ - public static final String SERVICE_CFG_FILE = "smarthome.cfg"; - - private static final String PID_MARKER = "pid:"; - - private static final String EXCLUSIVE_PID_STORE_FILE = "configdispatcher_pid_list.json"; - - private static final String DEFAULT_PID_DELIMITER = ":"; - private static final String DEFAULT_VALUE_DELIMITER = "="; - private static final String DEFAULT_LIST_STARTING_CHARACTER = "["; - private static final String DEFAULT_LIST_ENDING_CHARACTER = "]"; - private static final String DEFAULT_LIST_DELIMITER = ","; - - private ExclusivePIDMap exclusivePIDMap; - - private final ConfigurationAdmin configAdmin; - - private File exclusivePIDStore; - - @Activate - public ConfigDispatcher(final @Reference ConfigurationAdmin configAdmin) { - this.configAdmin = configAdmin; - } - - @Activate - public void activate(BundleContext bundleContext) { - exclusivePIDStore = bundleContext.getDataFile(EXCLUSIVE_PID_STORE_FILE); - loadExclusivePIDList(); - readDefaultConfig(); - } - - private void loadExclusivePIDList() { - try (FileReader reader = new FileReader(exclusivePIDStore)) { - exclusivePIDMap = gson.fromJson(reader, ExclusivePIDMap.class); - if (exclusivePIDMap != null) { - exclusivePIDMap.initializeProcessPIDMapping(); - } - } catch (JsonSyntaxException | JsonIOException e) { - logger.error("Error parsing exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), - e.getMessage()); - } catch (IOException e) { - logger.debug("Error loading exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), - e.getMessage()); - } finally { - if (exclusivePIDMap == null) { - exclusivePIDMap = new ExclusivePIDMap(); - } - } - } - - private void storeCurrentExclusivePIDList() { - try (FileWriter writer = new FileWriter(exclusivePIDStore)) { - exclusivePIDMap.setCurrentExclusivePIDList(); - gson.toJson(exclusivePIDMap, writer); - } catch (JsonIOException | IOException e) { - logger.error("Error storing exclusive PID list in bundle data file: {}", e.getMessage()); - } - } - - private Configuration getConfigurationWithContext(String pidWithContext) - throws IOException, InvalidSyntaxException { - if (!pidWithContext.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { - throw new IllegalArgumentException("Given PID should be followed by a context"); - } - String pid = pidWithContext.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[0]; - String context = pidWithContext.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[1]; - - Configuration[] configs = configAdmin.listConfigurations("(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" - + pid + ")(" + ConfigConstants.SERVICE_CONTEXT + "=" + context + "))"); - - if (configs == null || configs.length == 0) { - return null; - } - Configuration configuration = configs[0]; - - if (configs.length > 1) { - logger.error("More than one configuration with PID '{}' exists, using entry '{}'.", pidWithContext, - configuration.getProperties().get(Constants.SERVICE_PID)); - } - - return configuration; - } - - private void processOrphanExclusivePIDs() { - for (String orphanPID : exclusivePIDMap.getOrphanPIDs()) { - try { - Configuration configuration = null; - if (orphanPID.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { - configuration = getConfigurationWithContext(orphanPID); - } else { - configuration = configAdmin.getConfiguration(orphanPID, null); - } - if (configuration != null) { - configuration.delete(); - } - logger.debug("Deleting configuration for orphan pid {}", orphanPID); - } catch (IOException | InvalidSyntaxException e) { - logger.error("Error deleting configuration for orphan pid {}.", orphanPID); - } - } - } - - private String getDefaultServiceConfigPath() { - String progArg = System.getProperty(SERVICECFG_PROG_ARGUMENT); - if (progArg != null) { - return progArg; - } else { - return ConfigConstants.getConfigFolder() + File.separator + SERVICE_CFG_FILE; - } - } - - private void readDefaultConfig() { - String defaultCfgPath = getDefaultServiceConfigPath(); - try { - internalProcessConfigFile(new File(defaultCfgPath)); - } catch (IOException e) { - logger.warn("Could not process default config file '{}': {}", defaultCfgPath, e.getMessage()); - } - } - - public void processConfigFile(File dir) { - if (dir.isDirectory() && dir.exists()) { - File[] files = dir.listFiles(); - // Sort the files by modification time, - // so that the last modified file is processed last. - Arrays.sort(files, new Comparator() { - @Override - public int compare(File left, File right) { - return Long.valueOf(left.lastModified()).compareTo(right.lastModified()); - } - }); - for (File file : files) { - try { - internalProcessConfigFile(file); - } catch (IOException e) { - logger.warn("Could not process config file '{}': {}", file.getName(), e.getMessage()); - } - } - } else { - try { - internalProcessConfigFile(dir); - } catch (IOException e) { - logger.warn("Could not process config file '{}': {}", dir.getName(), e.getMessage()); - } - } - processOrphanExclusivePIDs(); - storeCurrentExclusivePIDList(); - } - - private static String getServicePidNamespace() { - String progArg = System.getProperty(SERVICEPID_PROG_ARGUMENT); - if (progArg != null) { - return progArg; - } else { - return SERVICE_PID_NAMESPACE; - } - } - - /** - * The filename of a given configuration file is assumed to be the service PID. If the filename - * without extension contains ".", we assume it is the fully qualified name. - * - * @param configFile The configuration file - * @return The PID - */ - private String pidFromFilename(File configFile) { - String filenameWithoutExt = StringUtils.substringBeforeLast(configFile.getName(), "."); - if (filenameWithoutExt.contains(".")) { - // it is a fully qualified namespace - return filenameWithoutExt; - } else { - return getServicePidNamespace() + "." + filenameWithoutExt; - } - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private void internalProcessConfigFile(File configFile) throws IOException, FileNotFoundException { - if (configFile.isDirectory() || !configFile.getName().endsWith(".cfg")) { - logger.debug("Ignoring file '{}'", configFile.getName()); - return; - } - logger.debug("Processing config file '{}'", configFile.getName()); - - // we need to remember which configuration needs to be updated - // because values have changed. - Map configsToUpdate = new HashMap<>(); - - // also cache the already retrieved configurations for each pid - Map configMap = new HashMap<>(); - - String pid = pidFromFilename(configFile); - String context = null; - - // configuration file contains a PID Marker - List lines = IOUtils.readLines(new FileInputStream(configFile)); - String exclusivePID = lines.size() > 0 ? getPIDFromLine(lines.get(0)) : null; - if (exclusivePID != null) { - if (exclusivePIDMap.contains(exclusivePID)) { - logger.warn( - "The file {} subsequently defines the exclusive PID '{}'. Overriding existing configuration now.", - configFile.getAbsolutePath(), exclusivePID); - } - - pid = exclusivePID; - - if (exclusivePID.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { - // split pid and context - pid = exclusivePID.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[0]; - context = exclusivePID.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[1]; - } - - lines = lines.subList(1, lines.size()); - exclusivePIDMap.setProcessedPID(exclusivePID, configFile.getAbsolutePath()); - } else if (exclusivePIDMap.contains(pid)) { - // the pid was once from an exclusive file but there is either a second non-exclusive-file with config - // entries or the `pid:` marker was removed. - exclusivePIDMap.removeExclusivePID(pid); - } - - Configuration configuration = null; - // if we have a context we need to create a service factory - if (context != null) { - try { - // try to find configuration using our context property - configuration = getConfigurationWithContext(exclusivePID); - } catch (InvalidSyntaxException e) { - logger.error("Failed to lookup config for file '{}' for PID '{}' with context '{}'", - configFile.getName(), pid, context); - } - - if (configuration == null) { - logger.debug("Creating factory configuration for PID '{}' with context '{}'", pid, context); - configuration = configAdmin.createFactoryConfiguration(pid, null); - } else { - logger.warn("Configuration for '{}' already exists, updating it with file '{}'.", exclusivePID, - configFile.getName()); - } - } else { - configuration = configAdmin.getConfiguration(pid, null); - } - - // this file does only contain entries for this PID and no other files do contain further entries for this PID. - if (context == null && exclusivePIDMap.contains(pid)) { - configMap.put(configuration, new Properties()); - } else if (context != null && exclusivePIDMap.contains(exclusivePID)) { - Dictionary p = new Properties(); - p.put(ConfigConstants.SERVICE_CONTEXT, context); - configMap.put(configuration, p); - } - - for (String line : lines) { - ParseLineResult parsedLine = parseLine(configFile.getPath(), line); - // no valid configuration line, so continue - if (parsedLine.isEmpty()) { - continue; - } - - if (exclusivePIDMap.contains(pid) && parsedLine.pid != null && !pid.equals(parsedLine.pid)) { - logger.error("Error parsing config file {}. Exclusive PID {} found but line starts with {}.", - configFile.getName(), pid, parsedLine.pid); - return; - } - - if (!exclusivePIDMap.contains(pid) && parsedLine.pid != null && exclusivePIDMap.contains(parsedLine.pid)) { - logger.error( - "Error parsing config file {}. The PID {} is exclusive but defined in another file, skipping the line.", - configFile.getName(), parsedLine.pid); - continue; - } - - if (parsedLine.pid != null) { - pid = parsedLine.pid; - configuration = configAdmin.getConfiguration(pid, null); - } - - Dictionary configProperties = configMap.get(configuration); - if (configProperties == null) { - configProperties = configuration.getProperties() != null ? configuration.getProperties() - : new Properties(); - configMap.put(configuration, configProperties); - } - if (parsedLine.value != null && !parsedLine.value.equals(configProperties.get(parsedLine.property))) { - configProperties.put(parsedLine.property, parsedLine.value); - configsToUpdate.put(configuration, configProperties); - } - } - - for (Entry entry : configsToUpdate.entrySet()) { - entry.getKey().update(entry.getValue()); - } - - storeCurrentExclusivePIDList(); - } - - public void fileRemoved(String path) { - exclusivePIDMap.setFileRemoved(path); - processOrphanExclusivePIDs(); - storeCurrentExclusivePIDList(); - } - - private String getPIDFromLine(String line) { - if (line.startsWith(PID_MARKER)) { - return line.substring(PID_MARKER.length()).trim(); - } - - return null; - } - - private ParseLineResult parseLine(final String filePath, final String line) { - String trimmedLine = line.trim(); - if (trimmedLine.startsWith("#") || trimmedLine.isEmpty()) { - return new ParseLineResult(); - } - - String pid = null; // no override of the pid is default - String key = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); - if (key.contains(DEFAULT_PID_DELIMITER)) { - pid = StringUtils.substringBefore(key, DEFAULT_PID_DELIMITER); - trimmedLine = trimmedLine.substring(pid.length() + 1); - pid = pid.trim(); - // PID is not fully qualified, so prefix with namespace - if (!pid.contains(".")) { - pid = getServicePidNamespace() + "." + pid; - } - } - if (!trimmedLine.isEmpty() && trimmedLine.substring(1).contains(DEFAULT_VALUE_DELIMITER)) { - String property = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); - String value = trimmedLine.substring(property.length() + 1).trim(); - if (value.startsWith(DEFAULT_LIST_STARTING_CHARACTER) && value.endsWith(DEFAULT_LIST_ENDING_CHARACTER)) { - logger.debug("Found list in value '{}'", value); - List values = Arrays.asList(value // - .replace(DEFAULT_LIST_STARTING_CHARACTER, "") // - .replace(DEFAULT_LIST_ENDING_CHARACTER, "")// - .split(DEFAULT_LIST_DELIMITER))// - .stream()// - .map(v -> v.trim())// - .filter(v -> !v.isEmpty())// - .collect(Collectors.toList()); - return new ParseLineResult(pid, property.trim(), values); - } else { - return new ParseLineResult(pid, property.trim(), value); - } - } else { - logger.warn("Could not parse line '{}'", line); - return new ParseLineResult(); - } - } - - /** - * Represents a result of parseLine(). - */ - @NonNullByDefault - private class ParseLineResult { - public @Nullable String pid; - public @Nullable String property; - public @Nullable Object value; - - public ParseLineResult() { - this(null, null, null); - } - - public ParseLineResult(@Nullable String pid, @Nullable String property, @Nullable Object value) { - this.pid = pid; - this.property = property; - this.value = value; - } - - public boolean isEmpty() { - return pid == null && property == null && value == null; - } - } - - /** - * The {@link ExclusivePIDMap} serves two purposes: - * 1. Store the exclusive PIDs which where processed by the {@link ConfigDispatcher} in the bundle data file in JSON - * format. - * 2. Map the processed PIDs to the absolute file paths of their config files. This way orphan PIDs from the bundle - * data file will be recognised and their corresponding configuration will be deleted from configAdmin. - */ - public static class ExclusivePIDMap { - - /** - * The list will be stored in the bundle cache and loaded on bundle start. - * This way we can sync the processed files and delete all orphan configurations from the configAdmin. - */ - private List exclusivePIDs = new ArrayList<>(); - - /** - * The internal Map of PIDs to filenames will only be used during runtime to determine exclusively used - * service config files. - * The map will hold a 1:1 relation mapping from an exclusive PID to its absolute path in the file system. - */ - private transient Map processedPIDMapping = new HashMap<>(); - - /** - * Package protected default constructor to allow reflective instantiation. - * - * !!! DO NOT REMOVE - Gson needs it !!! - */ - ExclusivePIDMap() { - } - - public void setProcessedPID(String pid, String pathToFile) { - processedPIDMapping.put(pid, pathToFile); - } - - public void removeExclusivePID(String pid) { - processedPIDMapping.remove(pid); - } - - public void setFileRemoved(String absolutePath) { - for (Entry entry : processedPIDMapping.entrySet()) { - if (entry.getValue().equals(absolutePath)) { - entry.setValue(null); - return; // we expect a 1:1 relation between PID and path - } - } - } - - public void initializeProcessPIDMapping() { - processedPIDMapping = new HashMap<>(); - for (String pid : exclusivePIDs) { - processedPIDMapping.put(pid, null); - } - } - - /** - * Collect PIDs which where not processed (mapped path is null). - * - * @return the list of PIDs which where not processed either during #activate or on file deleted event. - */ - public List getOrphanPIDs() { - return processedPIDMapping.entrySet().stream().filter(e -> e.getValue() == null).map(e -> e.getKey()) - .collect(Collectors.toList()); - } - - /** - * Set the exclusivePID list to the processed PIDs (mapped path is not null). - */ - public void setCurrentExclusivePIDList() { - exclusivePIDs = processedPIDMapping.entrySet().stream().filter(e -> e.getValue() != null) - .map(e -> e.getKey()).collect(Collectors.toList()); - } - - public boolean contains(String pid) { - return processedPIDMapping.containsKey(pid); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.dispatch.internal; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.stream.Collectors; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.config.core.ConfigConstants; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; +import org.osgi.service.cm.ManagedService; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Reference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; +import com.google.gson.JsonIOException; +import com.google.gson.JsonSyntaxException; + +/** + * This class provides a mean to read any kind of configuration data from + * config folder files and dispatch it to the different bundles using the {@link ConfigurationAdmin} service. + * + *

+ * The name of the configuration folder can be provided as a program argument "smarthome.configdir" (default is "conf"). + * Configurations for OSGi services are kept in a subfolder that can be provided as a program argument + * "smarthome.servicedir" (default is "services"). Any file in this folder with the extension .cfg will be processed. + * + *

+ * The format of the configuration file is similar to a standard property file, with the exception that the property + * name can be prefixed by the service pid of the {@link ManagedService}: + * + *

+ * <service-pid>:<property>=<value> + * + *

+ * In case the pid does not contain any ".", the default service pid namespace is prefixed, which can be defined by the + * program argument "smarthome.servicepid" (default is "org.openhab.core"). + * + *

+ * If no pid is defined in the property line, the default pid namespace will be used together with the filename. E.g. if + * you have a file "security.cfg", the pid that will be used is "org.openhab.core.security". + * + *

+ * Last but not least, a pid can be defined in the first line of a cfg file by prefixing it with "pid:", e.g. + * "pid: com.acme.smarthome.security". + * + *

+ * The value can be surrounded by square brackets ('[' and ']') and optionally contain value delimiters to be + * interpreted as a list of tokens. Default value delimiter is the comma ','. So the following property definition + * "property = [This property, has multiple, values]" will result in a collection with three values. + * + * @author Kai Kreuzer - Initial contribution + * @author Petar Valchev - Added sort by modification time, when configuration files are read + * @author Ana Dimova - Reduce to a single watch thread for all class instances + * @author Henning Treu - Delete orphan exclusive configuration from configAdmin + * @author Stefan Triller - Add support for service contexts + * @author Christoph Weitkamp - Added support for value containing a list of configuration options + */ +@Component(immediate = true, service = ConfigDispatcher.class) +public class ConfigDispatcher { + + private final Logger logger = LoggerFactory.getLogger(ConfigDispatcher.class); + + private final Gson gson = new Gson(); + + /** The program argument name for setting the service pid namespace */ + public static final String SERVICEPID_PROG_ARGUMENT = "smarthome.servicepid"; + + /** The property to recognize a service instance created by a service factory */ + public static final String SERVICE_CONTEXT = "esh.servicecontext"; + + /** The property to separate service PIDs from their contexts */ + public static final String SERVICE_CONTEXT_MARKER = "#"; + + /** + * The program argument name for setting the default services config file + * name + */ + public static final String SERVICECFG_PROG_ARGUMENT = "smarthome.servicecfg"; + + /** The default namespace for service pids */ + public static final String SERVICE_PID_NAMESPACE = "org.openhab.core"; + + /** The default services configuration filename */ + public static final String SERVICE_CFG_FILE = "smarthome.cfg"; + + private static final String PID_MARKER = "pid:"; + + private static final String EXCLUSIVE_PID_STORE_FILE = "configdispatcher_pid_list.json"; + + private static final String DEFAULT_PID_DELIMITER = ":"; + private static final String DEFAULT_VALUE_DELIMITER = "="; + private static final String DEFAULT_LIST_STARTING_CHARACTER = "["; + private static final String DEFAULT_LIST_ENDING_CHARACTER = "]"; + private static final String DEFAULT_LIST_DELIMITER = ","; + + private ExclusivePIDMap exclusivePIDMap; + + private final ConfigurationAdmin configAdmin; + + private File exclusivePIDStore; + + @Activate + public ConfigDispatcher(final @Reference ConfigurationAdmin configAdmin) { + this.configAdmin = configAdmin; + } + + @Activate + public void activate(BundleContext bundleContext) { + exclusivePIDStore = bundleContext.getDataFile(EXCLUSIVE_PID_STORE_FILE); + loadExclusivePIDList(); + readDefaultConfig(); + } + + private void loadExclusivePIDList() { + try (FileReader reader = new FileReader(exclusivePIDStore)) { + exclusivePIDMap = gson.fromJson(reader, ExclusivePIDMap.class); + if (exclusivePIDMap != null) { + exclusivePIDMap.initializeProcessPIDMapping(); + } + } catch (JsonSyntaxException | JsonIOException e) { + logger.error("Error parsing exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), + e.getMessage()); + } catch (IOException e) { + logger.debug("Error loading exclusive pids from '{}': {}", exclusivePIDStore.getAbsolutePath(), + e.getMessage()); + } finally { + if (exclusivePIDMap == null) { + exclusivePIDMap = new ExclusivePIDMap(); + } + } + } + + private void storeCurrentExclusivePIDList() { + try (FileWriter writer = new FileWriter(exclusivePIDStore)) { + exclusivePIDMap.setCurrentExclusivePIDList(); + gson.toJson(exclusivePIDMap, writer); + } catch (JsonIOException | IOException e) { + logger.error("Error storing exclusive PID list in bundle data file: {}", e.getMessage()); + } + } + + private Configuration getConfigurationWithContext(String pidWithContext) + throws IOException, InvalidSyntaxException { + if (!pidWithContext.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { + throw new IllegalArgumentException("Given PID should be followed by a context"); + } + String pid = pidWithContext.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[0]; + String context = pidWithContext.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[1]; + + Configuration[] configs = configAdmin.listConfigurations("(&(" + ConfigurationAdmin.SERVICE_FACTORYPID + "=" + + pid + ")(" + ConfigConstants.SERVICE_CONTEXT + "=" + context + "))"); + + if (configs == null || configs.length == 0) { + return null; + } + Configuration configuration = configs[0]; + + if (configs.length > 1) { + logger.error("More than one configuration with PID '{}' exists, using entry '{}'.", pidWithContext, + configuration.getProperties().get(Constants.SERVICE_PID)); + } + + return configuration; + } + + private void processOrphanExclusivePIDs() { + for (String orphanPID : exclusivePIDMap.getOrphanPIDs()) { + try { + Configuration configuration = null; + if (orphanPID.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { + configuration = getConfigurationWithContext(orphanPID); + } else { + configuration = configAdmin.getConfiguration(orphanPID, null); + } + if (configuration != null) { + configuration.delete(); + } + logger.debug("Deleting configuration for orphan pid {}", orphanPID); + } catch (IOException | InvalidSyntaxException e) { + logger.error("Error deleting configuration for orphan pid {}.", orphanPID); + } + } + } + + private String getDefaultServiceConfigPath() { + String progArg = System.getProperty(SERVICECFG_PROG_ARGUMENT); + if (progArg != null) { + return progArg; + } else { + return ConfigConstants.getConfigFolder() + File.separator + SERVICE_CFG_FILE; + } + } + + private void readDefaultConfig() { + String defaultCfgPath = getDefaultServiceConfigPath(); + try { + internalProcessConfigFile(new File(defaultCfgPath)); + } catch (IOException e) { + logger.warn("Could not process default config file '{}': {}", defaultCfgPath, e.getMessage()); + } + } + + public void processConfigFile(File dir) { + if (dir.isDirectory() && dir.exists()) { + File[] files = dir.listFiles(); + // Sort the files by modification time, + // so that the last modified file is processed last. + Arrays.sort(files, new Comparator() { + @Override + public int compare(File left, File right) { + return Long.valueOf(left.lastModified()).compareTo(right.lastModified()); + } + }); + for (File file : files) { + try { + internalProcessConfigFile(file); + } catch (IOException e) { + logger.warn("Could not process config file '{}': {}", file.getName(), e.getMessage()); + } + } + } else { + try { + internalProcessConfigFile(dir); + } catch (IOException e) { + logger.warn("Could not process config file '{}': {}", dir.getName(), e.getMessage()); + } + } + processOrphanExclusivePIDs(); + storeCurrentExclusivePIDList(); + } + + private static String getServicePidNamespace() { + String progArg = System.getProperty(SERVICEPID_PROG_ARGUMENT); + if (progArg != null) { + return progArg; + } else { + return SERVICE_PID_NAMESPACE; + } + } + + /** + * The filename of a given configuration file is assumed to be the service PID. If the filename + * without extension contains ".", we assume it is the fully qualified name. + * + * @param configFile The configuration file + * @return The PID + */ + private String pidFromFilename(File configFile) { + String filenameWithoutExt = StringUtils.substringBeforeLast(configFile.getName(), "."); + if (filenameWithoutExt.contains(".")) { + // it is a fully qualified namespace + return filenameWithoutExt; + } else { + return getServicePidNamespace() + "." + filenameWithoutExt; + } + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void internalProcessConfigFile(File configFile) throws IOException, FileNotFoundException { + if (configFile.isDirectory() || !configFile.getName().endsWith(".cfg")) { + logger.debug("Ignoring file '{}'", configFile.getName()); + return; + } + logger.debug("Processing config file '{}'", configFile.getName()); + + // we need to remember which configuration needs to be updated + // because values have changed. + Map configsToUpdate = new HashMap<>(); + + // also cache the already retrieved configurations for each pid + Map configMap = new HashMap<>(); + + String pid = pidFromFilename(configFile); + String context = null; + + // configuration file contains a PID Marker + List lines = IOUtils.readLines(new FileInputStream(configFile)); + String exclusivePID = lines.size() > 0 ? getPIDFromLine(lines.get(0)) : null; + if (exclusivePID != null) { + if (exclusivePIDMap.contains(exclusivePID)) { + logger.warn( + "The file {} subsequently defines the exclusive PID '{}'. Overriding existing configuration now.", + configFile.getAbsolutePath(), exclusivePID); + } + + pid = exclusivePID; + + if (exclusivePID.contains(ConfigConstants.SERVICE_CONTEXT_MARKER)) { + // split pid and context + pid = exclusivePID.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[0]; + context = exclusivePID.split(ConfigConstants.SERVICE_CONTEXT_MARKER)[1]; + } + + lines = lines.subList(1, lines.size()); + exclusivePIDMap.setProcessedPID(exclusivePID, configFile.getAbsolutePath()); + } else if (exclusivePIDMap.contains(pid)) { + // the pid was once from an exclusive file but there is either a second non-exclusive-file with config + // entries or the `pid:` marker was removed. + exclusivePIDMap.removeExclusivePID(pid); + } + + Configuration configuration = null; + // if we have a context we need to create a service factory + if (context != null) { + try { + // try to find configuration using our context property + configuration = getConfigurationWithContext(exclusivePID); + } catch (InvalidSyntaxException e) { + logger.error("Failed to lookup config for file '{}' for PID '{}' with context '{}'", + configFile.getName(), pid, context); + } + + if (configuration == null) { + logger.debug("Creating factory configuration for PID '{}' with context '{}'", pid, context); + configuration = configAdmin.createFactoryConfiguration(pid, null); + } else { + logger.warn("Configuration for '{}' already exists, updating it with file '{}'.", exclusivePID, + configFile.getName()); + } + } else { + configuration = configAdmin.getConfiguration(pid, null); + } + + // this file does only contain entries for this PID and no other files do contain further entries for this PID. + if (context == null && exclusivePIDMap.contains(pid)) { + configMap.put(configuration, new Properties()); + } else if (context != null && exclusivePIDMap.contains(exclusivePID)) { + Dictionary p = new Properties(); + p.put(ConfigConstants.SERVICE_CONTEXT, context); + configMap.put(configuration, p); + } + + for (String line : lines) { + ParseLineResult parsedLine = parseLine(configFile.getPath(), line); + // no valid configuration line, so continue + if (parsedLine.isEmpty()) { + continue; + } + + if (exclusivePIDMap.contains(pid) && parsedLine.pid != null && !pid.equals(parsedLine.pid)) { + logger.error("Error parsing config file {}. Exclusive PID {} found but line starts with {}.", + configFile.getName(), pid, parsedLine.pid); + return; + } + + if (!exclusivePIDMap.contains(pid) && parsedLine.pid != null && exclusivePIDMap.contains(parsedLine.pid)) { + logger.error( + "Error parsing config file {}. The PID {} is exclusive but defined in another file, skipping the line.", + configFile.getName(), parsedLine.pid); + continue; + } + + if (parsedLine.pid != null) { + pid = parsedLine.pid; + configuration = configAdmin.getConfiguration(pid, null); + } + + Dictionary configProperties = configMap.get(configuration); + if (configProperties == null) { + configProperties = configuration.getProperties() != null ? configuration.getProperties() + : new Properties(); + configMap.put(configuration, configProperties); + } + if (parsedLine.value != null && !parsedLine.value.equals(configProperties.get(parsedLine.property))) { + configProperties.put(parsedLine.property, parsedLine.value); + configsToUpdate.put(configuration, configProperties); + } + } + + for (Entry entry : configsToUpdate.entrySet()) { + entry.getKey().update(entry.getValue()); + } + + storeCurrentExclusivePIDList(); + } + + public void fileRemoved(String path) { + exclusivePIDMap.setFileRemoved(path); + processOrphanExclusivePIDs(); + storeCurrentExclusivePIDList(); + } + + private String getPIDFromLine(String line) { + if (line.startsWith(PID_MARKER)) { + return line.substring(PID_MARKER.length()).trim(); + } + + return null; + } + + private ParseLineResult parseLine(final String filePath, final String line) { + String trimmedLine = line.trim(); + if (trimmedLine.startsWith("#") || trimmedLine.isEmpty()) { + return new ParseLineResult(); + } + + String pid = null; // no override of the pid is default + String key = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); + if (key.contains(DEFAULT_PID_DELIMITER)) { + pid = StringUtils.substringBefore(key, DEFAULT_PID_DELIMITER); + trimmedLine = trimmedLine.substring(pid.length() + 1); + pid = pid.trim(); + // PID is not fully qualified, so prefix with namespace + if (!pid.contains(".")) { + pid = getServicePidNamespace() + "." + pid; + } + } + if (!trimmedLine.isEmpty() && trimmedLine.substring(1).contains(DEFAULT_VALUE_DELIMITER)) { + String property = StringUtils.substringBefore(trimmedLine, DEFAULT_VALUE_DELIMITER); + String value = trimmedLine.substring(property.length() + 1).trim(); + if (value.startsWith(DEFAULT_LIST_STARTING_CHARACTER) && value.endsWith(DEFAULT_LIST_ENDING_CHARACTER)) { + logger.debug("Found list in value '{}'", value); + List values = Arrays.asList(value // + .replace(DEFAULT_LIST_STARTING_CHARACTER, "") // + .replace(DEFAULT_LIST_ENDING_CHARACTER, "")// + .split(DEFAULT_LIST_DELIMITER))// + .stream()// + .map(v -> v.trim())// + .filter(v -> !v.isEmpty())// + .collect(Collectors.toList()); + return new ParseLineResult(pid, property.trim(), values); + } else { + return new ParseLineResult(pid, property.trim(), value); + } + } else { + logger.warn("Could not parse line '{}'", line); + return new ParseLineResult(); + } + } + + /** + * Represents a result of parseLine(). + */ + @NonNullByDefault + private class ParseLineResult { + public @Nullable String pid; + public @Nullable String property; + public @Nullable Object value; + + public ParseLineResult() { + this(null, null, null); + } + + public ParseLineResult(@Nullable String pid, @Nullable String property, @Nullable Object value) { + this.pid = pid; + this.property = property; + this.value = value; + } + + public boolean isEmpty() { + return pid == null && property == null && value == null; + } + } + + /** + * The {@link ExclusivePIDMap} serves two purposes: + * 1. Store the exclusive PIDs which where processed by the {@link ConfigDispatcher} in the bundle data file in JSON + * format. + * 2. Map the processed PIDs to the absolute file paths of their config files. This way orphan PIDs from the bundle + * data file will be recognised and their corresponding configuration will be deleted from configAdmin. + */ + public static class ExclusivePIDMap { + + /** + * The list will be stored in the bundle cache and loaded on bundle start. + * This way we can sync the processed files and delete all orphan configurations from the configAdmin. + */ + private List exclusivePIDs = new ArrayList<>(); + + /** + * The internal Map of PIDs to filenames will only be used during runtime to determine exclusively used + * service config files. + * The map will hold a 1:1 relation mapping from an exclusive PID to its absolute path in the file system. + */ + private transient Map processedPIDMapping = new HashMap<>(); + + /** + * Package protected default constructor to allow reflective instantiation. + * + * !!! DO NOT REMOVE - Gson needs it !!! + */ + ExclusivePIDMap() { + } + + public void setProcessedPID(String pid, String pathToFile) { + processedPIDMapping.put(pid, pathToFile); + } + + public void removeExclusivePID(String pid) { + processedPIDMapping.remove(pid); + } + + public void setFileRemoved(String absolutePath) { + for (Entry entry : processedPIDMapping.entrySet()) { + if (entry.getValue().equals(absolutePath)) { + entry.setValue(null); + return; // we expect a 1:1 relation between PID and path + } + } + } + + public void initializeProcessPIDMapping() { + processedPIDMapping = new HashMap<>(); + for (String pid : exclusivePIDs) { + processedPIDMapping.put(pid, null); + } + } + + /** + * Collect PIDs which where not processed (mapped path is null). + * + * @return the list of PIDs which where not processed either during #activate or on file deleted event. + */ + public List getOrphanPIDs() { + return processedPIDMapping.entrySet().stream().filter(e -> e.getValue() == null).map(e -> e.getKey()) + .collect(Collectors.toList()); + } + + /** + * Set the exclusivePID list to the processed PIDs (mapped path is not null). + */ + public void setCurrentExclusivePIDList() { + exclusivePIDs = processedPIDMapping.entrySet().stream().filter(e -> e.getValue() != null) + .map(e -> e.getKey()).collect(Collectors.toList()); + } + + public boolean contains(String pid) { + return processedPIDMapping.containsKey(pid); + } + } + +} diff --git a/bundles/org.openhab.core.config.serial/pom.xml b/bundles/org.openhab.core.config.serial/pom.xml index eb1661249..4bb380863 100644 --- a/bundles/org.openhab.core.config.serial/pom.xml +++ b/bundles/org.openhab.core.config.serial/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.xml/pom.xml b/bundles/org.openhab.core.config.xml/pom.xml index a13604215..1f1051182 100644 --- a/bundles/org.openhab.core.config.xml/pom.xml +++ b/bundles/org.openhab.core.config.xml/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigDescriptionParameterGroupConverter.java b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigDescriptionParameterGroupConverter.java index 39658c322..6fd86676e 100644 --- a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigDescriptionParameterGroupConverter.java +++ b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigDescriptionParameterGroupConverter.java @@ -1,49 +1,49 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.xml; - -import org.openhab.core.config.core.ConfigDescriptionParameterGroup; -import org.openhab.core.config.xml.util.ConverterValueMap; -import org.openhab.core.config.xml.util.GenericUnmarshaller; - -import com.thoughtworks.xstream.converters.UnmarshallingContext; -import com.thoughtworks.xstream.io.HierarchicalStreamReader; - -/** - * The {@link ConfigDescriptionParameterGroupConverter} creates a {@link ConfigDescriptionParameterGroup} instance from - * a {@code option} XML - * node. - * - * @author Chris Jackson - Initial contribution - */ -public class ConfigDescriptionParameterGroupConverter extends GenericUnmarshaller { - - public ConfigDescriptionParameterGroupConverter() { - super(ConfigDescriptionParameterGroup.class); - } - - @Override - public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext marshallingContext) { - String name = reader.getAttribute("name"); - - // Read values - ConverterValueMap valueMap = new ConverterValueMap(reader, marshallingContext); - - String context = valueMap.getString("context"); - String description = valueMap.getString("description"); - String label = valueMap.getString("label"); - Boolean advanced = valueMap.getBoolean("advanced", false); - - return new ConfigDescriptionParameterGroup(name, context, advanced, label, description); - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.xml; + +import org.openhab.core.config.core.ConfigDescriptionParameterGroup; +import org.openhab.core.config.xml.util.ConverterValueMap; +import org.openhab.core.config.xml.util.GenericUnmarshaller; + +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; + +/** + * The {@link ConfigDescriptionParameterGroupConverter} creates a {@link ConfigDescriptionParameterGroup} instance from + * a {@code option} XML + * node. + * + * @author Chris Jackson - Initial contribution + */ +public class ConfigDescriptionParameterGroupConverter extends GenericUnmarshaller { + + public ConfigDescriptionParameterGroupConverter() { + super(ConfigDescriptionParameterGroup.class); + } + + @Override + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext marshallingContext) { + String name = reader.getAttribute("name"); + + // Read values + ConverterValueMap valueMap = new ConverterValueMap(reader, marshallingContext); + + String context = valueMap.getString("context"); + String description = valueMap.getString("description"); + String label = valueMap.getString("label"); + Boolean advanced = valueMap.getBoolean("advanced", false); + + return new ConfigDescriptionParameterGroup(name, context, advanced, label, description); + } +} diff --git a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigXmlConfigDescriptionProvider.java b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigXmlConfigDescriptionProvider.java index 3e22d5779..e95ebc132 100644 --- a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigXmlConfigDescriptionProvider.java +++ b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/ConfigXmlConfigDescriptionProvider.java @@ -18,6 +18,7 @@ import java.util.concurrent.ScheduledExecutorService; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionProvider; import org.openhab.core.config.core.i18n.ConfigI18nLocalizationService; @@ -27,7 +28,6 @@ import org.openhab.core.config.xml.osgi.XmlDocumentBundleTracker; import org.openhab.core.config.xml.osgi.XmlDocumentProvider; import org.openhab.core.config.xml.osgi.XmlDocumentProviderFactory; import org.openhab.core.config.xml.util.XmlDocumentReader; -import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.service.ReadyService; import org.osgi.framework.Bundle; import org.osgi.service.component.ComponentContext; diff --git a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/FilterCriteriaConverter.java b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/FilterCriteriaConverter.java index bb6a049d4..a7fb1aefd 100644 --- a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/FilterCriteriaConverter.java +++ b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/FilterCriteriaConverter.java @@ -1,40 +1,40 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.config.xml; - -import org.openhab.core.config.core.FilterCriteria; -import org.openhab.core.config.xml.util.GenericUnmarshaller; - -import com.thoughtworks.xstream.converters.UnmarshallingContext; -import com.thoughtworks.xstream.io.HierarchicalStreamReader; - -/** - * The {@link FilterCriteriaConverter} creates a {@link FilterCriteria} instance - * from a {@code criteria} XML node. - * - * @author Alex Tugarev - Initial contribution - */ -public class FilterCriteriaConverter extends GenericUnmarshaller { - - public FilterCriteriaConverter() { - super(FilterCriteria.class); - } - - @Override - public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { - String name = reader.getAttribute("name"); - String criteria = reader.getValue(); - return new FilterCriteria(name, criteria); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.config.xml; + +import org.openhab.core.config.core.FilterCriteria; +import org.openhab.core.config.xml.util.GenericUnmarshaller; + +import com.thoughtworks.xstream.converters.UnmarshallingContext; +import com.thoughtworks.xstream.io.HierarchicalStreamReader; + +/** + * The {@link FilterCriteriaConverter} creates a {@link FilterCriteria} instance + * from a {@code criteria} XML node. + * + * @author Alex Tugarev - Initial contribution + */ +public class FilterCriteriaConverter extends GenericUnmarshaller { + + public FilterCriteriaConverter() { + super(FilterCriteria.class); + } + + @Override + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { + String name = reader.getAttribute("name"); + String criteria = reader.getValue(); + return new FilterCriteria(name, criteria); + } + +} diff --git a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/osgi/XmlDocumentBundleTracker.java b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/osgi/XmlDocumentBundleTracker.java index 6cee4eb00..dbc500194 100644 --- a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/osgi/XmlDocumentBundleTracker.java +++ b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/osgi/XmlDocumentBundleTracker.java @@ -32,8 +32,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Supplier; import java.util.stream.Collectors; -import org.openhab.core.config.xml.util.XmlDocumentReader; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.xml.util.XmlDocumentReader; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyMarkerUtils; import org.openhab.core.service.ReadyService; diff --git a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/util/NodeIterator.java b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/util/NodeIterator.java index f0570f199..02d79c4e3 100644 --- a/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/util/NodeIterator.java +++ b/bundles/org.openhab.core.config.xml/src/main/java/org/openhab/core/config/xml/util/NodeIterator.java @@ -83,8 +83,8 @@ public class NodeIterator implements Iterator { nodes.add(next()); } - throw new ConversionException("The document is invalid, it contains further" + " unsupported data: " - + nodes + "!"); + throw new ConversionException( + "The document is invalid, it contains further" + " unsupported data: " + nodes + "!"); } } @@ -151,8 +151,8 @@ public class NodeIterator implements Iterator { } if (required) { - throw new ConversionException("The attribute '" + attributeName + "' in the node '" + nodeName - + "' is missing!"); + throw new ConversionException( + "The attribute '" + attributeName + "' in the node '" + nodeName + "' is missing!"); } return null; diff --git a/bundles/org.openhab.core.ephemeris/pom.xml b/bundles/org.openhab.core.ephemeris/pom.xml index 6522a13a2..f829d7130 100644 --- a/bundles/org.openhab.core.ephemeris/pom.xml +++ b/bundles/org.openhab.core.ephemeris/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.extension.sample/pom.xml b/bundles/org.openhab.core.extension.sample/pom.xml index 416834dda..cf4b8770b 100644 --- a/bundles/org.openhab.core.extension.sample/pom.xml +++ b/bundles/org.openhab.core.extension.sample/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.id/pom.xml b/bundles/org.openhab.core.id/pom.xml index 6a20b9dff..5e56c2694 100644 --- a/bundles/org.openhab.core.id/pom.xml +++ b/bundles/org.openhab.core.id/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.id/src/test/java/org/openhab/core/id/UUIDTest.java b/bundles/org.openhab.core.id/src/test/java/org/openhab/core/id/UUIDTest.java index 5aab995c4..e24b1250c 100644 --- a/bundles/org.openhab.core.id/src/test/java/org/openhab/core/id/UUIDTest.java +++ b/bundles/org.openhab.core.id/src/test/java/org/openhab/core/id/UUIDTest.java @@ -19,8 +19,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import org.openhab.core.config.core.ConfigConstants; import org.junit.Test; +import org.openhab.core.config.core.ConfigConstants; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core.io.bin2json/pom.xml b/bundles/org.openhab.core.io.bin2json/pom.xml index c7c163f70..e8c3699dc 100644 --- a/bundles/org.openhab.core.io.bin2json/pom.xml +++ b/bundles/org.openhab.core.io.bin2json/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.console.eclipse/pom.xml b/bundles/org.openhab.core.io.console.eclipse/pom.xml index b8c7e3332..210efd5fe 100644 --- a/bundles/org.openhab.core.io.console.eclipse/pom.xml +++ b/bundles/org.openhab.core.io.console.eclipse/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.console.karaf/pom.xml b/bundles/org.openhab.core.io.console.karaf/pom.xml index 766d278e8..2ee091070 100644 --- a/bundles/org.openhab.core.io.console.karaf/pom.xml +++ b/bundles/org.openhab.core.io.console.karaf/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.console.rfc147/pom.xml b/bundles/org.openhab.core.io.console.rfc147/pom.xml index 22be51b11..c54ba36f6 100644 --- a/bundles/org.openhab.core.io.console.rfc147/pom.xml +++ b/bundles/org.openhab.core.io.console.rfc147/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.console.rfc147/src/main/java/org/openhab/core/io/console/rfc147/internal/CommandWrapper.java b/bundles/org.openhab.core.io.console.rfc147/src/main/java/org/openhab/core/io/console/rfc147/internal/CommandWrapper.java index 0058a0060..58946c307 100644 --- a/bundles/org.openhab.core.io.console.rfc147/src/main/java/org/openhab/core/io/console/rfc147/internal/CommandWrapper.java +++ b/bundles/org.openhab.core.io.console.rfc147/src/main/java/org/openhab/core/io/console/rfc147/internal/CommandWrapper.java @@ -43,8 +43,8 @@ public class CommandWrapper { if (cmd.equals(command.getCommand())) { ConsoleInterpreter.execute(ConsoleSupportRfc147.CONSOLE, command, cmdArgs); } else { - System.out.println(String.format("The command (%s) differs from expected one (%s).", cmd, - command.getCommand())); + System.out.println( + String.format("The command (%s) differs from expected one (%s).", cmd, command.getCommand())); } } } diff --git a/bundles/org.openhab.core.io.console/pom.xml b/bundles/org.openhab.core.io.console/pom.xml index d85cf6085..ae161f11e 100644 --- a/bundles/org.openhab.core.io.console/pom.xml +++ b/bundles/org.openhab.core.io.console/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/ItemConsoleCommandExtension.java b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/ItemConsoleCommandExtension.java index 51266f164..7b7edde88 100644 --- a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/ItemConsoleCommandExtension.java +++ b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/ItemConsoleCommandExtension.java @@ -19,13 +19,13 @@ import java.util.List; import java.util.function.Consumer; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.GenericItem; import org.openhab.core.items.Item; import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.ManagedItemProvider; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/MetadataConsoleCommandExtension.java b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/MetadataConsoleCommandExtension.java index c0a40c908..10a72965d 100644 --- a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/MetadataConsoleCommandExtension.java +++ b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/MetadataConsoleCommandExtension.java @@ -19,14 +19,14 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.Metadata; import org.openhab.core.items.MetadataKey; import org.openhab.core.items.MetadataPredicates; import org.openhab.core.items.MetadataRegistry; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/SendConsoleCommandExtension.java b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/SendConsoleCommandExtension.java index f632811d1..2ed1855e3 100644 --- a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/SendConsoleCommandExtension.java +++ b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/SendConsoleCommandExtension.java @@ -17,6 +17,9 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemNotUniqueException; @@ -24,9 +27,6 @@ import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.events.ItemEventFactory; import org.openhab.core.types.Command; import org.openhab.core.types.TypeParser; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/StatusConsoleCommandExtension.java b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/StatusConsoleCommandExtension.java index 0cace17fa..5155dd327 100644 --- a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/StatusConsoleCommandExtension.java +++ b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/StatusConsoleCommandExtension.java @@ -16,13 +16,13 @@ import java.util.Collections; import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemNotUniqueException; import org.openhab.core.items.ItemRegistry; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/UpdateConsoleCommandExtension.java b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/UpdateConsoleCommandExtension.java index 97ed912be..f917170ec 100644 --- a/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/UpdateConsoleCommandExtension.java +++ b/bundles/org.openhab.core.io.console/src/main/java/org/openhab/core/io/console/internal/extension/UpdateConsoleCommandExtension.java @@ -17,6 +17,9 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemNotUniqueException; @@ -24,9 +27,6 @@ import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.events.ItemEventFactory; import org.openhab.core.types.State; import org.openhab.core.types.TypeParser; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.http.auth.basic/pom.xml b/bundles/org.openhab.core.io.http.auth.basic/pom.xml index 33e29bb8a..84c506763 100644 --- a/bundles/org.openhab.core.io.http.auth.basic/pom.xml +++ b/bundles/org.openhab.core.io.http.auth.basic/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.http.auth/pom.xml b/bundles/org.openhab.core.io.http.auth/pom.xml index 65f0f17b8..1e34b5674 100644 --- a/bundles/org.openhab.core.io.http.auth/pom.xml +++ b/bundles/org.openhab.core.io.http.auth/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.http/pom.xml b/bundles/org.openhab.core.io.http/pom.xml index 9dfa18a23..800cbad74 100644 --- a/bundles/org.openhab.core.io.http/pom.xml +++ b/bundles/org.openhab.core.io.http/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.http/src/test/java/org/openhab/core/io/http/internal/HttpContextFactoryServiceImplTest.java b/bundles/org.openhab.core.io.http/src/test/java/org/openhab/core/io/http/internal/HttpContextFactoryServiceImplTest.java index acbe5ed04..ecf06d5c9 100644 --- a/bundles/org.openhab.core.io.http/src/test/java/org/openhab/core/io/http/internal/HttpContextFactoryServiceImplTest.java +++ b/bundles/org.openhab.core.io.http/src/test/java/org/openhab/core/io/http/internal/HttpContextFactoryServiceImplTest.java @@ -17,10 +17,10 @@ import static org.junit.Assert.assertThat; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.io.http.WrappingHttpContext; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.io.http.WrappingHttpContext; import org.osgi.framework.Bundle; import org.osgi.service.http.HttpContext; diff --git a/bundles/org.openhab.core.io.jetty.certificate/pom.xml b/bundles/org.openhab.core.io.jetty.certificate/pom.xml index 34bcdf245..5939cb80c 100644 --- a/bundles/org.openhab.core.io.jetty.certificate/pom.xml +++ b/bundles/org.openhab.core.io.jetty.certificate/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 @@ -49,7 +51,8 @@ true - + . diff --git a/bundles/org.openhab.core.io.monitor/pom.xml b/bundles/org.openhab.core.io.monitor/pom.xml index b62255009..38ee6d2d9 100644 --- a/bundles/org.openhab.core.io.monitor/pom.xml +++ b/bundles/org.openhab.core.io.monitor/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.net/pom.xml b/bundles/org.openhab.core.io.net/pom.xml index dadef60fa..e153f8450 100644 --- a/bundles/org.openhab.core.io.net/pom.xml +++ b/bundles/org.openhab.core.io.net/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java index a7b3c69f9..324dc65a0 100644 --- a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java +++ b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/ExtensibleTrustManagerImplTest.java @@ -30,10 +30,10 @@ import javax.net.ssl.X509ExtendedTrustManager; import javax.security.auth.x500.X500Principal; import org.apache.commons.lang.reflect.FieldUtils; -import org.openhab.core.io.net.http.TlsTrustManagerProvider; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.io.net.http.TlsTrustManagerProvider; /** * Tests which validate the behavior of the ExtensibleTrustManager diff --git a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/WebClientFactoryImplTest.java b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/WebClientFactoryImplTest.java index b1f878955..7b06f5de2 100644 --- a/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/WebClientFactoryImplTest.java +++ b/bundles/org.openhab.core.io.net/src/test/java/org/openhab/core/io/net/http/internal/WebClientFactoryImplTest.java @@ -37,7 +37,6 @@ import javax.net.ssl.SSLHandshakeException; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.websocket.client.WebSocketClient; -import org.openhab.core.io.net.http.TrustManagerProvider; import org.junit.After; import org.junit.Before; import org.junit.Ignore; @@ -45,6 +44,7 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Mock; +import org.openhab.core.io.net.http.TrustManagerProvider; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core.io.net/src/test/resources/google_weather_response.xml b/bundles/org.openhab.core.io.net/src/test/resources/google_weather_response.xml index a0b0b3570..631908149 100644 --- a/bundles/org.openhab.core.io.net/src/test/resources/google_weather_response.xml +++ b/bundles/org.openhab.core.io.net/src/test/resources/google_weather_response.xml @@ -1,7 +1,6 @@ - + diff --git a/bundles/org.openhab.core.io.rest.audio/pom.xml b/bundles/org.openhab.core.io.rest.audio/pom.xml index 3f326eee7..c9279ad64 100644 --- a/bundles/org.openhab.core.io.rest.audio/pom.xml +++ b/bundles/org.openhab.core.io.rest.audio/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.auth/pom.xml b/bundles/org.openhab.core.io.rest.auth/pom.xml index 6f3881514..1b84b07e6 100644 --- a/bundles/org.openhab.core.io.rest.auth/pom.xml +++ b/bundles/org.openhab.core.io.rest.auth/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.core/pom.xml b/bundles/org.openhab.core.io.rest.core/pom.xml index fe9e1a7ab..08aec7754 100644 --- a/bundles/org.openhab.core.io.rest.core/pom.xml +++ b/bundles/org.openhab.core.io.rest.core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/RESTCoreActivator.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/RESTCoreActivator.java index 55a2dcb66..f2c9e50f1 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/RESTCoreActivator.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/RESTCoreActivator.java @@ -35,7 +35,8 @@ public class RESTCoreActivator implements BundleActivator { @Override public void start(BundleContext bc) throws Exception { context = bc; - mExcMapper = bc.registerService(JSONResponse.ExceptionMapper.class.getName(), new JSONResponse.ExceptionMapper(), null); + mExcMapper = bc.registerService(JSONResponse.ExceptionMapper.class.getName(), + new JSONResponse.ExceptionMapper(), null); } /** diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/binding/BindingResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/binding/BindingResource.java index 21a90c87f..f49446808 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/binding/BindingResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/binding/BindingResource.java @@ -34,14 +34,14 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.openhab.core.config.core.ConfigDescription; -import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.config.core.ConfigUtil; -import org.openhab.core.config.core.Configuration; import org.openhab.core.auth.Role; import org.openhab.core.binding.BindingInfo; import org.openhab.core.binding.BindingInfoRegistry; import org.openhab.core.binding.dto.BindingInfoDTO; +import org.openhab.core.config.core.ConfigDescription; +import org.openhab.core.config.core.ConfigDescriptionRegistry; +import org.openhab.core.config.core.ConfigUtil; +import org.openhab.core.config.core.Configuration; import org.openhab.core.io.rest.LocaleService; import org.openhab.core.io.rest.RESTResource; import org.openhab.core.io.rest.Stream2JSONInputStream; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResource.java index 9e83de0b9..fcaa025e1 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResource.java @@ -30,13 +30,16 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.dto.ConfigDescriptionDTO; import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.config.core.dto.ConfigDescriptionParameterGroupDTO; -import org.openhab.core.auth.Role; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; import org.openhab.core.thing.dto.ChannelTypeDTO; import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileTypeRegistry; @@ -45,9 +48,6 @@ import org.openhab.core.thing.type.ChannelKind; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java index 301ad3dd1..b6c52bf2d 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/config/ConfigDescriptionResource.java @@ -30,10 +30,10 @@ import javax.ws.rs.core.UriBuilder; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.dto.ConfigDescriptionDTO; -import org.openhab.core.auth.Role; import org.openhab.core.io.rest.JSONResponse; import org.openhab.core.io.rest.LocaleService; import org.openhab.core.io.rest.RESTResource; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/DiscoveryResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/DiscoveryResource.java index b533d81d8..9f8271c4f 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/DiscoveryResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/DiscoveryResource.java @@ -26,9 +26,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import org.openhab.core.auth.Role; import org.openhab.core.config.discovery.DiscoveryServiceRegistry; import org.openhab.core.config.discovery.ScanListener; -import org.openhab.core.auth.Role; import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResource.java index 360bfda8f..85eb9c14c 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResource.java @@ -30,16 +30,16 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; +import org.openhab.core.auth.Role; import org.openhab.core.config.discovery.DiscoveryResultFlag; import org.openhab.core.config.discovery.dto.DiscoveryResultDTO; import org.openhab.core.config.discovery.dto.DiscoveryResultDTOMapper; import org.openhab.core.config.discovery.inbox.Inbox; -import org.openhab.core.auth.Role; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingUID; import org.openhab.core.io.rest.JSONResponse; import org.openhab.core.io.rest.RESTResource; import org.openhab.core.io.rest.Stream2JSONInputStream; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingUID; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java index 77c589665..1b724c383 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResource.java @@ -47,6 +47,14 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.auth.Role; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.rest.DTOMapper; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; +import org.openhab.core.io.rest.core.item.EnrichedGroupItemDTO; +import org.openhab.core.io.rest.core.item.EnrichedItemDTO; +import org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; @@ -68,14 +76,6 @@ import org.openhab.core.library.types.UpDownType; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.TypeParser; -import org.openhab.core.io.rest.DTOMapper; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; -import org.openhab.core.io.rest.core.item.EnrichedGroupItemDTO; -import org.openhab.core.io.rest.core.item.EnrichedItemDTO; -import org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcher.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcher.java index e2473c3da..17b4fadf8 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcher.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcher.java @@ -25,9 +25,9 @@ import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.AbstractUID; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.common.AbstractUID; import org.openhab.core.items.MetadataRegistry; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java index 594b64704..2ba505047 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/link/ItemChannelLinkResource.java @@ -29,17 +29,17 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.openhab.core.config.core.Configuration; import org.openhab.core.auth.Role; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.link.AbstractLink; import org.openhab.core.thing.link.ItemChannelLink; import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.openhab.core.thing.link.ThingLinkManager; import org.openhab.core.thing.link.dto.ItemChannelLinkDTO; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java index 221e44ed5..2ab3ccabc 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java @@ -37,6 +37,9 @@ import javax.ws.rs.core.Response.Status; import org.openhab.core.auth.Role; import org.openhab.core.i18n.TimeZoneProvider; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemRegistry; @@ -54,9 +57,6 @@ import org.openhab.core.persistence.dto.ItemHistoryDTO; import org.openhab.core.persistence.dto.PersistenceServiceDTO; import org.openhab.core.types.State; import org.openhab.core.types.TypeParser; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java index 3c0324f26..928bc7f4c 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResource.java @@ -29,6 +29,9 @@ import javax.ws.rs.core.Response; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.auth.Role; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; import org.openhab.core.items.ItemUtil; import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileTypeRegistry; @@ -39,9 +42,6 @@ import org.openhab.core.thing.profiles.dto.ProfileTypeDTOMapper; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java index d94d301ae..0b1dcd58b 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResource.java @@ -35,13 +35,13 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.ConfigUtil; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.config.core.Configuration; -import org.openhab.core.auth.Role; import org.openhab.core.io.rest.RESTResource; import org.openhab.core.io.rest.core.config.ConfigurationService; import org.openhab.core.io.rest.core.internal.RESTCoreActivator; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java index 8f9c9dfad..cdda4a502 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingResource.java @@ -47,6 +47,7 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.apache.commons.lang.StringUtils; +import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.ConfigUtil; @@ -54,7 +55,12 @@ import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.status.ConfigStatusInfo; import org.openhab.core.config.core.status.ConfigStatusService; import org.openhab.core.config.core.validation.ConfigValidationException; -import org.openhab.core.auth.Role; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; +import org.openhab.core.io.rest.core.thing.EnrichedThingDTO; +import org.openhab.core.io.rest.core.thing.EnrichedThingDTOMapper; import org.openhab.core.items.ItemFactory; import org.openhab.core.items.ItemRegistry; import org.openhab.core.items.ManagedItemProvider; @@ -88,12 +94,6 @@ import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeRegistry; import org.openhab.core.thing.util.ThingHelper; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; -import org.openhab.core.io.rest.core.thing.EnrichedThingDTO; -import org.openhab.core.io.rest.core.thing.EnrichedThingDTOMapper; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; @@ -919,7 +919,8 @@ public class ThingResource implements RESTResource { && managedItemChannelLinkProvider != null && managedItemProvider != null && managedThingProvider != null && thingRegistry != null && configStatusService != null && configDescRegistry != null && thingTypeRegistry != null && channelTypeRegistry != null && firmwareUpdateService != null - && thingStatusInfoI18nLocalizationService != null && firmwareRegistry != null && localeService != null && thingManager != null; + && thingStatusInfoI18nLocalizationService != null && firmwareRegistry != null && localeService != null + && thingManager != null; } } diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingTypeResource.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingTypeResource.java index c5a50819d..6a59eb534 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingTypeResource.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/thing/ThingTypeResource.java @@ -27,13 +27,16 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import org.openhab.core.auth.Role; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.dto.ConfigDescriptionDTO; import org.openhab.core.config.core.dto.ConfigDescriptionDTOMapper; import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; import org.openhab.core.config.core.dto.ConfigDescriptionParameterGroupDTO; -import org.openhab.core.auth.Role; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; +import org.openhab.core.io.rest.Stream2JSONInputStream; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.dto.ChannelDefinitionDTO; import org.openhab.core.thing.dto.ChannelGroupDefinitionDTO; @@ -49,9 +52,6 @@ import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeRegistry; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; -import org.openhab.core.io.rest.Stream2JSONInputStream; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedGroupItemDTO.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedGroupItemDTO.java index 9f46d6db3..e2eb15ece 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedGroupItemDTO.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedGroupItemDTO.java @@ -1,39 +1,39 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.io.rest.core.item; - -import org.openhab.core.items.dto.GroupFunctionDTO; -import org.openhab.core.items.dto.GroupItemDTO; -import org.openhab.core.items.dto.ItemDTO; -import org.openhab.core.types.StateDescription; - -/** - * This is an enriched data transfer object that is used to serialize group items. - * - * @author Dennis Nobel - Initial contribution - */ -public class EnrichedGroupItemDTO extends EnrichedItemDTO { - - public EnrichedGroupItemDTO(ItemDTO itemDTO, EnrichedItemDTO[] members, String link, String state, - String transformedState, StateDescription stateDescription) { - super(itemDTO, link, state, transformedState, stateDescription, null); - this.members = members; - this.groupType = ((GroupItemDTO) itemDTO).groupType; - this.function = ((GroupItemDTO) itemDTO).function; - } - - public EnrichedItemDTO[] members; - public String groupType; - public GroupFunctionDTO function; - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.io.rest.core.item; + +import org.openhab.core.items.dto.GroupFunctionDTO; +import org.openhab.core.items.dto.GroupItemDTO; +import org.openhab.core.items.dto.ItemDTO; +import org.openhab.core.types.StateDescription; + +/** + * This is an enriched data transfer object that is used to serialize group items. + * + * @author Dennis Nobel - Initial contribution + */ +public class EnrichedGroupItemDTO extends EnrichedItemDTO { + + public EnrichedGroupItemDTO(ItemDTO itemDTO, EnrichedItemDTO[] members, String link, String state, + String transformedState, StateDescription stateDescription) { + super(itemDTO, link, state, transformedState, stateDescription, null); + this.members = members; + this.groupType = ((GroupItemDTO) itemDTO).groupType; + this.function = ((GroupItemDTO) itemDTO).function; + } + + public EnrichedItemDTO[] members; + public String groupType; + public GroupFunctionDTO function; + +} diff --git a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapper.java b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapper.java index c3b09ef64..b73277dcc 100644 --- a/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapper.java +++ b/bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapper.java @@ -20,6 +20,8 @@ import java.util.function.Predicate; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.io.rest.core.internal.RESTCoreActivator; +import org.openhab.core.io.rest.core.internal.item.ItemResource; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; import org.openhab.core.items.dto.ItemDTO; @@ -28,8 +30,6 @@ import org.openhab.core.transform.TransformationException; import org.openhab.core.transform.TransformationHelper; import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescriptionFragmentBuilder; -import org.openhab.core.io.rest.core.internal.RESTCoreActivator; -import org.openhab.core.io.rest.core.internal.item.ItemResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionDTOMapperTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionDTOMapperTest.java index c9bcbca4d..dc1c8f790 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionDTOMapperTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/config/EnrichedConfigDescriptionDTOMapperTest.java @@ -19,13 +19,13 @@ import static org.junit.Assert.assertThat; import java.net.URI; import java.util.Arrays; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.dto.ConfigDescriptionDTO; import org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO; -import org.junit.Test; /** * @author Christoph Weitkamp - Initial contribution diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResourceTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResourceTest.java index d36d6081e..05ff28ca4 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResourceTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/channel/ChannelTypeResourceTest.java @@ -26,6 +26,11 @@ import java.util.Set; import javax.ws.rs.core.Response; +import org.hamcrest.core.IsCollectionContaining; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.openhab.core.io.rest.LocaleServiceImpl; import org.openhab.core.thing.profiles.ProfileTypeRegistry; import org.openhab.core.thing.profiles.ProfileTypeUID; import org.openhab.core.thing.profiles.TriggerProfileType; @@ -33,11 +38,6 @@ import org.openhab.core.thing.type.ChannelKind; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.io.rest.LocaleServiceImpl; -import org.hamcrest.core.IsCollectionContaining; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * @author Henning Treu - Initial contribution diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcherTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcherTest.java index c47bc9432..47a7eebab 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcherTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/internal/item/MetadataSelectorMatcherTest.java @@ -26,13 +26,13 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionBuilder; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.items.MetadataRegistry; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * Test the {@link MetadataSelectorMatcher}. diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperTest.java index 5a3e5d65d..198b90b83 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperTest.java @@ -17,12 +17,12 @@ import static org.junit.Assert.assertThat; import java.net.URI; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.test.java.JavaTest; -import org.junit.Before; -import org.junit.Test; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/thing/EnrichedThingDTOMapperTest.java b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/thing/EnrichedThingDTOMapperTest.java index 9b33818ad..adb9369b5 100644 --- a/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/thing/EnrichedThingDTOMapperTest.java +++ b/bundles/org.openhab.core.io.rest.core/src/test/java/org/openhab/core/io/rest/core/thing/EnrichedThingDTOMapperTest.java @@ -26,6 +26,10 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.hamcrest.CoreMatchers; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.config.core.Configuration; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; @@ -35,10 +39,6 @@ import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; import org.openhab.core.thing.firmware.dto.FirmwareStatusDTO; -import org.hamcrest.CoreMatchers; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * @author Henning Treu - Initial contribution diff --git a/bundles/org.openhab.core.io.rest.log/pom.xml b/bundles/org.openhab.core.io.rest.log/pom.xml index 49807cdce..502ce60ef 100644 --- a/bundles/org.openhab.core.io.rest.log/pom.xml +++ b/bundles/org.openhab.core.io.rest.log/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.mdns/pom.xml b/bundles/org.openhab.core.io.rest.mdns/pom.xml index 35fedfe85..1ed8b98d1 100644 --- a/bundles/org.openhab.core.io.rest.mdns/pom.xml +++ b/bundles/org.openhab.core.io.rest.mdns/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.mdns/src/main/java/org/openhab/core/io/rest/mdns/internal/MDNSAnnouncer.java b/bundles/org.openhab.core.io.rest.mdns/src/main/java/org/openhab/core/io/rest/mdns/internal/MDNSAnnouncer.java index 0b17d92dd..0ff157b3b 100644 --- a/bundles/org.openhab.core.io.rest.mdns/src/main/java/org/openhab/core/io/rest/mdns/internal/MDNSAnnouncer.java +++ b/bundles/org.openhab.core.io.rest.mdns/src/main/java/org/openhab/core/io/rest/mdns/internal/MDNSAnnouncer.java @@ -15,10 +15,10 @@ package org.openhab.core.io.rest.mdns.internal; import java.util.Hashtable; import java.util.Map; -import org.openhab.core.net.HttpServiceUtil; import org.openhab.core.io.rest.RESTConstants; import org.openhab.core.io.transport.mdns.MDNSService; import org.openhab.core.io.transport.mdns.ServiceDescription; +import org.openhab.core.net.HttpServiceUtil; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; diff --git a/bundles/org.openhab.core.io.rest.optimize/pom.xml b/bundles/org.openhab.core.io.rest.optimize/pom.xml index bcc062207..5512c026b 100644 --- a/bundles/org.openhab.core.io.rest.optimize/pom.xml +++ b/bundles/org.openhab.core.io.rest.optimize/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.sitemap/pom.xml b/bundles/org.openhab.core.io.rest.sitemap/pom.xml index 1d31a4ed1..f416b9052 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/pom.xml +++ b/bundles/org.openhab.core.io.rest.sitemap/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java index d0541a313..aa987a1ec 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/SitemapSubscriptionService.java @@ -29,11 +29,11 @@ import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; +import org.openhab.core.io.rest.sitemap.internal.PageChangeListener; +import org.openhab.core.io.rest.sitemap.internal.SitemapEvent; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; import org.openhab.core.items.events.ItemStatePredictedEvent; -import org.openhab.core.io.rest.sitemap.internal.PageChangeListener; -import org.openhab.core.io.rest.sitemap.internal.SitemapEvent; import org.openhab.core.model.core.EventType; import org.openhab.core.model.core.ModelRepositoryChangeListener; import org.openhab.core.model.sitemap.SitemapProvider; diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/MappingDTO.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/MappingDTO.java index 4b9ea3ad0..02d84b3af 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/MappingDTO.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/MappingDTO.java @@ -1,28 +1,28 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.io.rest.sitemap.internal; - -/** - * This is a data transfer object that is used to serialize command mappings. - * - * @author Kai Kreuzer - Initial contribution - */ -public class MappingDTO { - - public String command; - public String label; - - public MappingDTO() { - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.io.rest.sitemap.internal; + +/** + * This is a data transfer object that is used to serialize command mappings. + * + * @author Kai Kreuzer - Initial contribution + */ +public class MappingDTO { + + public String command; + public String label; + + public MappingDTO() { + } + +} diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageChangeListener.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageChangeListener.java index ed7625d6a..c0c457397 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageChangeListener.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageChangeListener.java @@ -23,20 +23,20 @@ import java.util.function.Predicate; import org.eclipse.emf.common.util.EList; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper; +import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService.SitemapSubscriptionCallback; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.StateChangeListener; import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.types.State; -import org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper; -import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService.SitemapSubscriptionCallback; import org.openhab.core.model.sitemap.sitemap.Chart; import org.openhab.core.model.sitemap.sitemap.ColorArray; import org.openhab.core.model.sitemap.sitemap.Frame; import org.openhab.core.model.sitemap.sitemap.VisibilityRule; import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.types.State; import org.openhab.core.ui.items.ItemUIRegistry; /** diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageDTO.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageDTO.java index ac1d358ad..3765b58b6 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageDTO.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/PageDTO.java @@ -1,39 +1,39 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.io.rest.sitemap.internal; - -import java.util.ArrayList; -import java.util.List; - -/** - * This is a data transfer object that is used to serialize page content. - * - * @author Kai Kreuzer - Initial contribution - */ -public class PageDTO { - - public String id; - - public String title; - public String icon; - public String link; - public PageDTO parent; - public boolean leaf; - public boolean timeout; - - public List widgets = new ArrayList<>(); - - public PageDTO() { - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.io.rest.sitemap.internal; + +import java.util.ArrayList; +import java.util.List; + +/** + * This is a data transfer object that is used to serialize page content. + * + * @author Kai Kreuzer - Initial contribution + */ +public class PageDTO { + + public String id; + + public String title; + public String icon; + public String link; + public PageDTO parent; + public boolean leaf; + public boolean timeout; + + public List widgets = new ArrayList<>(); + + public PageDTO() { + } + +} diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapEventOutput.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapEventOutput.java index 342461cab..71e4cffa0 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapEventOutput.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapEventOutput.java @@ -14,9 +14,9 @@ package org.openhab.core.io.rest.sitemap.internal; import java.io.IOException; -import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService; import org.glassfish.jersey.media.sse.EventOutput; import org.glassfish.jersey.media.sse.OutboundEvent; +import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java index cbe8a6981..92af9d261 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/main/java/org/openhab/core/io/rest/sitemap/internal/SitemapResource.java @@ -48,20 +48,25 @@ import javax.ws.rs.core.UriInfo; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; +import org.glassfish.jersey.media.sse.EventOutput; +import org.glassfish.jersey.media.sse.OutboundEvent; +import org.glassfish.jersey.media.sse.SseBroadcaster; +import org.glassfish.jersey.media.sse.SseFeature; +import org.glassfish.jersey.server.BroadcasterListener; +import org.glassfish.jersey.server.ChunkedOutput; import org.openhab.core.auth.Role; import org.openhab.core.common.ThreadPoolManager; -import org.openhab.core.items.GenericItem; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.StateChangeListener; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.types.State; import org.openhab.core.io.rest.JSONResponse; import org.openhab.core.io.rest.LocaleService; import org.openhab.core.io.rest.RESTResource; import org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper; import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService; import org.openhab.core.io.rest.sitemap.SitemapSubscriptionService.SitemapSubscriptionCallback; +import org.openhab.core.items.GenericItem; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.StateChangeListener; +import org.openhab.core.library.CoreItemFactory; import org.openhab.core.model.sitemap.SitemapProvider; import org.openhab.core.model.sitemap.sitemap.Chart; import org.openhab.core.model.sitemap.sitemap.ColorArray; @@ -80,13 +85,8 @@ import org.openhab.core.model.sitemap.sitemap.Video; import org.openhab.core.model.sitemap.sitemap.VisibilityRule; import org.openhab.core.model.sitemap.sitemap.Webview; import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.types.State; import org.openhab.core.ui.items.ItemUIRegistry; -import org.glassfish.jersey.media.sse.EventOutput; -import org.glassfish.jersey.media.sse.OutboundEvent; -import org.glassfish.jersey.media.sse.SseBroadcaster; -import org.glassfish.jersey.media.sse.SseFeature; -import org.glassfish.jersey.server.BroadcasterListener; -import org.glassfish.jersey.server.ChunkedOutput; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/openhab/core/io/rest/sitemap/internal/SitemapResourceTest.java b/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/openhab/core/io/rest/sitemap/internal/SitemapResourceTest.java index be00db2c6..b000ea64d 100644 --- a/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/openhab/core/io/rest/sitemap/internal/SitemapResourceTest.java +++ b/bundles/org.openhab.core.io.rest.sitemap/src/test/java/org/openhab/core/io/rest/sitemap/internal/SitemapResourceTest.java @@ -34,24 +34,24 @@ import javax.ws.rs.core.UriInfo; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.openhab.core.io.rest.LocaleService; import org.openhab.core.items.GenericItem; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; -import org.openhab.core.types.Command; -import org.openhab.core.types.State; -import org.openhab.core.io.rest.LocaleService; import org.openhab.core.model.sitemap.SitemapProvider; import org.openhab.core.model.sitemap.sitemap.ColorArray; import org.openhab.core.model.sitemap.sitemap.Sitemap; import org.openhab.core.model.sitemap.sitemap.VisibilityRule; import org.openhab.core.model.sitemap.sitemap.Widget; import org.openhab.core.test.java.JavaTest; +import org.openhab.core.types.Command; +import org.openhab.core.types.State; import org.openhab.core.ui.items.ItemUIRegistry; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * Test aspects of the {@link SitemapResource}. diff --git a/bundles/org.openhab.core.io.rest.sse/pom.xml b/bundles/org.openhab.core.io.rest.sse/pom.xml index fe91c554d..cd94d1976 100644 --- a/bundles/org.openhab.core.io.rest.sse/pom.xml +++ b/bundles/org.openhab.core.io.rest.sse/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/SseResource.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/SseResource.java index aaa379be5..b4c3dd547 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/SseResource.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/SseResource.java @@ -30,13 +30,13 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; +import org.glassfish.jersey.media.sse.EventOutput; +import org.glassfish.jersey.media.sse.SseBroadcaster; +import org.glassfish.jersey.media.sse.SseFeature; import org.openhab.core.auth.Role; import org.openhab.core.events.Event; import org.openhab.core.io.rest.sse.internal.SseEventOutput; import org.openhab.core.io.rest.sse.internal.util.SseUtil; -import org.glassfish.jersey.media.sse.EventOutput; -import org.glassfish.jersey.media.sse.SseBroadcaster; -import org.glassfish.jersey.media.sse.SseFeature; import org.osgi.service.component.annotations.Component; import io.swagger.annotations.Api; diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/beans/EventBean.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/beans/EventBean.java index 67fe84d31..a6c1cb1c4 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/beans/EventBean.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/beans/EventBean.java @@ -23,7 +23,7 @@ public class EventBean { public String topic; public String payload; - + public String type; } diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseEventOutput.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseEventOutput.java index 9a43ce2dd..cf94bf3a6 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseEventOutput.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseEventOutput.java @@ -15,10 +15,10 @@ package org.openhab.core.io.rest.sse.internal; import java.io.IOException; import java.util.List; -import org.openhab.core.io.rest.sse.beans.EventBean; -import org.openhab.core.io.rest.sse.internal.util.SseUtil; import org.glassfish.jersey.media.sse.EventOutput; import org.glassfish.jersey.media.sse.OutboundEvent; +import org.openhab.core.io.rest.sse.beans.EventBean; +import org.openhab.core.io.rest.sse.internal.util.SseUtil; /** * {@link EventOutput} implementation that takes a filter parameter and only writes out events that match this filter. diff --git a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java index b47222c2e..da5b1daf2 100644 --- a/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java +++ b/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/util/SseUtil.java @@ -19,9 +19,9 @@ import java.util.StringTokenizer; import javax.ws.rs.core.MediaType; import org.apache.commons.lang.StringUtils; +import org.glassfish.jersey.media.sse.OutboundEvent; import org.openhab.core.events.Event; import org.openhab.core.io.rest.sse.beans.EventBean; -import org.glassfish.jersey.media.sse.OutboundEvent; /** * Utility class containing helper methods for the SSE implementation. diff --git a/bundles/org.openhab.core.io.rest.voice/pom.xml b/bundles/org.openhab.core.io.rest.voice/pom.xml index d791d0026..b5430fdc1 100644 --- a/bundles/org.openhab.core.io.rest.voice/pom.xml +++ b/bundles/org.openhab.core.io.rest.voice/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java b/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java index dab0a96e2..f3c7c5291 100644 --- a/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java +++ b/bundles/org.openhab.core.io.rest.voice/src/main/java/org/openhab/core/io/rest/voice/internal/VoiceResource.java @@ -34,13 +34,13 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.openhab.core.auth.Role; +import org.openhab.core.io.rest.JSONResponse; +import org.openhab.core.io.rest.LocaleService; +import org.openhab.core.io.rest.RESTResource; import org.openhab.core.voice.Voice; import org.openhab.core.voice.VoiceManager; import org.openhab.core.voice.text.HumanLanguageInterpreter; import org.openhab.core.voice.text.InterpretationException; -import org.openhab.core.io.rest.JSONResponse; -import org.openhab.core.io.rest.LocaleService; -import org.openhab.core.io.rest.RESTResource; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.io.rest/pom.xml b/bundles/org.openhab.core.io.rest/pom.xml index 75374f583..71a45bb5d 100644 --- a/bundles/org.openhab.core.io.rest/pom.xml +++ b/bundles/org.openhab.core.io.rest/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/resources/beans/RootBean.java b/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/resources/beans/RootBean.java index 8373a740b..952648eb0 100644 --- a/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/resources/beans/RootBean.java +++ b/bundles/org.openhab.core.io.rest/src/main/java/org/openhab/core/io/rest/internal/resources/beans/RootBean.java @@ -1,39 +1,39 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.io.rest.internal.resources.beans; - -import java.util.ArrayList; -import java.util.List; - -/** - * This is a java bean that is used to define the root entry - * page of the REST interface. - * - * @author Kai Kreuzer - Initial contribution - */ -public class RootBean { - - public final String version = "3"; - - public final List links = new ArrayList<>(); - - public static class Links { - public Links(String type, String url) { - this.type = type; - this.url = url; - } - - public String type; - public String url; - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.io.rest.internal.resources.beans; + +import java.util.ArrayList; +import java.util.List; + +/** + * This is a java bean that is used to define the root entry + * page of the REST interface. + * + * @author Kai Kreuzer - Initial contribution + */ +public class RootBean { + + public final String version = "3"; + + public final List links = new ArrayList<>(); + + public static class Links { + public Links(String type, String url) { + this.type = type; + this.url = url; + } + + public String type; + public String url; + } +} diff --git a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/CorsFilterTest.java b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/CorsFilterTest.java index 054a6da33..743fd9f8a 100644 --- a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/CorsFilterTest.java +++ b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/CorsFilterTest.java @@ -14,9 +14,9 @@ package org.openhab.core.io.rest.internal.filter; import static java.util.Collections.*; import static java.util.stream.Collectors.toList; -import static org.openhab.core.io.rest.internal.filter.CorsFilter.*; import static org.junit.Assert.*; import static org.mockito.Mockito.when; +import static org.openhab.core.io.rest.internal.filter.CorsFilter.*; import java.io.IOException; import java.util.stream.Stream; diff --git a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/ProxyFilterTest.java b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/ProxyFilterTest.java index 0eebd4d94..ecf5e1817 100644 --- a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/ProxyFilterTest.java +++ b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/ProxyFilterTest.java @@ -12,9 +12,9 @@ */ package org.openhab.core.io.rest.internal.filter; -import static org.openhab.core.io.rest.internal.filter.ProxyFilter.*; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; +import static org.openhab.core.io.rest.internal.filter.ProxyFilter.*; import java.net.URI; import java.net.URISyntaxException; diff --git a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/SatisfiableResourceFilterTest.java b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/SatisfiableResourceFilterTest.java index ab857177a..1688dfa6a 100644 --- a/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/SatisfiableResourceFilterTest.java +++ b/bundles/org.openhab.core.io.rest/src/test/java/org/openhab/core/io/rest/internal/filter/SatisfiableResourceFilterTest.java @@ -24,7 +24,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; -import org.openhab.core.io.rest.RESTResource; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -32,6 +31,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; +import org.openhab.core.io.rest.RESTResource; /** * Test for {@link SatisfiableResourceFilter} diff --git a/bundles/org.openhab.core.io.transport.dbus/pom.xml b/bundles/org.openhab.core.io.transport.dbus/pom.xml index 8e87a68a1..2c6440f35 100755 --- a/bundles/org.openhab.core.io.transport.dbus/pom.xml +++ b/bundles/org.openhab.core.io.transport.dbus/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.mdns/pom.xml b/bundles/org.openhab.core.io.transport.mdns/pom.xml index c5a65740d..3b82a9f42 100644 --- a/bundles/org.openhab.core.io.transport.mdns/pom.xml +++ b/bundles/org.openhab.core.io.transport.mdns/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.mdns/src/main/java/org/openhab/core/io/transport/mdns/internal/MDNSClientImpl.java b/bundles/org.openhab.core.io.transport.mdns/src/main/java/org/openhab/core/io/transport/mdns/internal/MDNSClientImpl.java index 4d8092365..7b14e6b84 100644 --- a/bundles/org.openhab.core.io.transport.mdns/src/main/java/org/openhab/core/io/transport/mdns/internal/MDNSClientImpl.java +++ b/bundles/org.openhab.core.io.transport.mdns/src/main/java/org/openhab/core/io/transport/mdns/internal/MDNSClientImpl.java @@ -30,11 +30,11 @@ import javax.jmdns.JmDNS; import javax.jmdns.ServiceInfo; import javax.jmdns.ServiceListener; +import org.openhab.core.io.transport.mdns.MDNSClient; +import org.openhab.core.io.transport.mdns.ServiceDescription; import org.openhab.core.net.CidrAddress; import org.openhab.core.net.NetworkAddressChangeListener; import org.openhab.core.net.NetworkAddressService; -import org.openhab.core.io.transport.mdns.MDNSClient; -import org.openhab.core.io.transport.mdns.ServiceDescription; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.io.transport.mqtt/pom.xml b/bundles/org.openhab.core.io.transport.mqtt/pom.xml index b36a6a99a..7131e9999 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/pom.xml +++ b/bundles/org.openhab.core.io.transport.mqtt/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnection.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnection.java index 419c98526..3669f0e59 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnection.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnection.java @@ -14,7 +14,6 @@ package org.openhab.core.io.transport.mqtt; import java.nio.file.Path; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -67,14 +66,16 @@ public class MqttBrokerConnection { * MQTT transport protocols */ public enum Protocol { - TCP, WEBSOCKETS + TCP, + WEBSOCKETS } /** * MQTT version (currently v3 and v5) */ public enum MqttVersion { - V3, V5 + V3, + V5 } // Connection parameters @@ -189,9 +190,9 @@ public class MqttBrokerConnection { * @param port A port or null to select the default port for a secure or insecure connection * @param secure A secure connection * @param clientId Client id. Each client on a MQTT server has a unique client id. Sometimes client ids are - * used for access restriction implementations. - * If none is specified, a default is generated. The client id cannot be longer than 65535 - * characters. + * used for access restriction implementations. + * If none is specified, a default is generated. The client id cannot be longer than 65535 + * characters. * @throws IllegalArgumentException If the client id or port is not valid. */ public MqttBrokerConnection(String host, @Nullable Integer port, boolean secure, @Nullable String clientId) { @@ -206,9 +207,9 @@ public class MqttBrokerConnection { * @param port A port or null to select the default port for a secure or insecure connection * @param secure A secure connection * @param clientId Client id. Each client on a MQTT server has a unique client id. Sometimes client ids are - * used for access restriction implementations. - * If none is specified, a default is generated. The client id cannot be longer than 65535 - * characters. + * used for access restriction implementations. + * If none is specified, a default is generated. The client id cannot be longer than 65535 + * characters. * @throws IllegalArgumentException If the client id or port is not valid. */ @Deprecated @@ -226,9 +227,9 @@ public class MqttBrokerConnection { * @param port A port or null to select the default port for a secure or insecure connection * @param secure A secure connection * @param clientId Client id. Each client on a MQTT server has a unique client id. Sometimes client ids are - * used for access restriction implementations. - * If none is specified, a default is generated. The client id cannot be longer than 65535 - * characters. + * used for access restriction implementations. + * If none is specified, a default is generated. The client id cannot be longer than 65535 + * characters. * @throws IllegalArgumentException If the client id or port is not valid. */ public MqttBrokerConnection(Protocol protocol, MqttVersion mqttVersion, String host, @Nullable Integer port, @@ -419,7 +420,7 @@ public class MqttBrokerConnection { * * @param lastWill The last will object or null. * @param applyImmediately If true, the connection will stopped and started for the new last-will to take effect - * immediately. + * immediately. * @throws MqttException * @throws ConfigurationException */ @@ -475,9 +476,8 @@ public class MqttBrokerConnection { if (isConnecting) { return MqttConnectionState.CONNECTING; } - return (client != null && client.getState().isConnected()) ? - MqttConnectionState.CONNECTED : - MqttConnectionState.DISCONNECTED; + return (client != null && client.getState().isConnected()) ? MqttConnectionState.CONNECTED + : MqttConnectionState.DISCONNECTED; } /** @@ -513,7 +513,7 @@ public class MqttBrokerConnection { * Set the ssl context provider. The default provider is {@see AcceptAllCertifcatesSSLContext}. * * @return The ssl context provider. Should not be null, but the ssl context will in fact - * only be used if a ssl:// url is given. + * only be used if a ssl:// url is given. */ @Deprecated public void setSSLContextProvider(SSLContextProvider sslContextProvider) { @@ -636,7 +636,7 @@ public class MqttBrokerConnection { * @param client The client connection * @param topic The topic to unsubscribe from * @return Completes with true if successful. Completes with false if no broker connection is established. - * Exceptionally otherwise. + * Exceptionally otherwise. */ protected CompletableFuture unsubscribeRaw(MqttAsyncClientWrapper client, String topic) { logger.trace("Unsubscribing message consumer for topic '{}' from broker '{}'", topic, host); @@ -686,7 +686,7 @@ public class MqttBrokerConnection { * do nothing if there is already an active connection. * * @return Returns a future that completes with true if already connected or connecting, - * completes with false if a connection timeout has happened and completes exceptionally otherwise. + * completes with false if a connection timeout has happened and completes exceptionally otherwise. */ public CompletableFuture start() { // We don't want multiple concurrent threads to start a connection @@ -872,7 +872,7 @@ public class MqttBrokerConnection { * @param topic The topic * @param payload The message payload * @return Returns a future that completes with a result of true if the publishing succeeded and completes - * exceptionally on an error or with a result of false if no broker connection is established. + * exceptionally on an error or with a result of false if no broker connection is established. */ public CompletableFuture publish(String topic, byte[] payload) { return publish(topic, payload, getQos(), isRetain()); @@ -886,7 +886,7 @@ public class MqttBrokerConnection { * @param qos The quality of service for this message * @param retain Set to true to retain the message on the broker * @return Returns a future that completes with a result of true if the publishing succeeded and completes - * exceptionally on an error or with a result of false if no broker connection is established. + * exceptionally on an error or with a result of false if no broker connection is established. */ public CompletableFuture publish(String topic, byte[] payload, int qos, boolean retain) { final MqttAsyncClientWrapper client = this.client; diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java index cc9b7e2d5..497205aea 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/main/java/org/openhab/core/io/transport/mqtt/internal/client/MqttAsyncClientWrapper.java @@ -20,11 +20,11 @@ import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.io.transport.mqtt.MqttWillAndTestament; import org.openhab.core.io.transport.mqtt.internal.ClientCallback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.hivemq.client.mqtt.MqttClientState; import com.hivemq.client.mqtt.datatypes.MqttQos; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * The {@link MqttAsyncClientWrapper} is the base class for async client wrappers diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnectionTests.java b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnectionTests.java index a2f4f38b0..28d97f49b 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnectionTests.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/MqttBrokerConnectionTests.java @@ -28,11 +28,11 @@ import java.util.concurrent.TimeoutException; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Test; import org.openhab.core.io.transport.mqtt.internal.client.MqttAsyncClientWrapper; import org.openhab.core.io.transport.mqtt.reconnect.AbstractReconnectStrategy; import org.openhab.core.io.transport.mqtt.reconnect.PeriodicReconnectStrategy; import org.openhab.core.test.java.JavaTest; -import org.junit.Test; import org.osgi.service.cm.ConfigurationException; import com.hivemq.client.mqtt.lifecycle.MqttClientDisconnectedContext; diff --git a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceTests.java b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceTests.java index 08ea065b5..c54c3a38a 100644 --- a/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceTests.java +++ b/bundles/org.openhab.core.io.transport.mqtt/src/test/java/org/openhab/core/io/transport/mqtt/internal/MqttServiceTests.java @@ -16,12 +16,12 @@ import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import static org.mockito.Mockito.*; +import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.openhab.core.io.transport.mqtt.MqttBrokerConnection; import org.openhab.core.io.transport.mqtt.MqttBrokerConnectionEx; import org.openhab.core.io.transport.mqtt.MqttService; import org.openhab.core.io.transport.mqtt.MqttServiceObserver; -import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.osgi.service.cm.ConfigurationException; /** diff --git a/bundles/org.openhab.core.io.transport.serial.javacomm/pom.xml b/bundles/org.openhab.core.io.transport.serial.javacomm/pom.xml index 9be63adbe..e58be81c6 100644 --- a/bundles/org.openhab.core.io.transport.serial.javacomm/pom.xml +++ b/bundles/org.openhab.core.io.transport.serial.javacomm/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/pom.xml b/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/pom.xml index c574b135d..802dd7492 100644 --- a/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/pom.xml +++ b/bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.serial.rxtx/pom.xml b/bundles/org.openhab.core.io.transport.serial.rxtx/pom.xml index 2409ac824..c7843d2a4 100644 --- a/bundles/org.openhab.core.io.transport.serial.rxtx/pom.xml +++ b/bundles/org.openhab.core.io.transport.serial.rxtx/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.serial/pom.xml b/bundles/org.openhab.core.io.transport.serial/pom.xml index 72358f63f..5c4d501e1 100644 --- a/bundles/org.openhab.core.io.transport.serial/pom.xml +++ b/bundles/org.openhab.core.io.transport.serial/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.serial/src/main/java/org/openhab/core/io/transport/serial/SerialPortIdentifier.java b/bundles/org.openhab.core.io.transport.serial/src/main/java/org/openhab/core/io/transport/serial/SerialPortIdentifier.java index 99ed7625e..66b2f15c2 100644 --- a/bundles/org.openhab.core.io.transport.serial/src/main/java/org/openhab/core/io/transport/serial/SerialPortIdentifier.java +++ b/bundles/org.openhab.core.io.transport.serial/src/main/java/org/openhab/core/io/transport/serial/SerialPortIdentifier.java @@ -55,5 +55,6 @@ public interface SerialPortIdentifier { * * @return the port owner or null if the port is not currently owned */ - @Nullable String getCurrentOwner(); + @Nullable + String getCurrentOwner(); } diff --git a/bundles/org.openhab.core.io.transport.upnp/pom.xml b/bundles/org.openhab.core.io.transport.upnp/pom.xml index 77b20d9ba..4833e2bbe 100644 --- a/bundles/org.openhab.core.io.transport.upnp/pom.xml +++ b/bundles/org.openhab.core.io.transport.upnp/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java b/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java index 2d678711b..1b5806e85 100644 --- a/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java +++ b/bundles/org.openhab.core.io.transport.upnp/src/main/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceImpl.java @@ -23,9 +23,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import org.openhab.core.common.ThreadPoolManager; -import org.openhab.core.io.transport.upnp.UpnpIOParticipant; -import org.openhab.core.io.transport.upnp.UpnpIOService; import org.jupnp.UpnpService; import org.jupnp.controlpoint.ActionCallback; import org.jupnp.controlpoint.ControlPoint; @@ -48,6 +45,9 @@ import org.jupnp.model.types.UDAServiceId; import org.jupnp.model.types.UDN; import org.jupnp.registry.Registry; import org.jupnp.registry.RegistryListener; +import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.io.transport.upnp.UpnpIOParticipant; +import org.openhab.core.io.transport.upnp.UpnpIOService; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceTest.java b/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceTest.java index 4ff9efed3..39b007bc4 100644 --- a/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceTest.java +++ b/bundles/org.openhab.core.io.transport.upnp/src/test/java/org/openhab/core/io/transport/upnp/internal/UpnpIOServiceTest.java @@ -17,7 +17,6 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.io.transport.upnp.UpnpIOParticipant; import org.junit.Before; import org.junit.Test; import org.jupnp.UpnpService; @@ -33,6 +32,7 @@ import org.jupnp.model.types.UDAServiceId; import org.jupnp.model.types.UDN; import org.jupnp.registry.Registry; import org.mockito.Mock; +import org.openhab.core.io.transport.upnp.UpnpIOParticipant; /** * Tests {@link UpnpIOServiceImpl}. diff --git a/bundles/org.openhab.core.karaf/pom.xml b/bundles/org.openhab.core.karaf/pom.xml index ac48eddd3..512cdd5db 100644 --- a/bundles/org.openhab.core.karaf/pom.xml +++ b/bundles/org.openhab.core.karaf/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java index ec124050b..dde2cd25e 100644 --- a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java +++ b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/FeatureInstaller.java @@ -38,12 +38,12 @@ import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; import org.apache.karaf.features.Feature; import org.apache.karaf.features.FeaturesService; +import org.openhab.core.OpenHAB; import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.events.Event; import org.openhab.core.events.EventPublisher; import org.openhab.core.extension.ExtensionEventFactory; -import org.openhab.core.OpenHAB; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.cm.ConfigurationEvent; diff --git a/bundles/org.openhab.core.karaf/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.karaf/src/main/resources/ESH-INF/config/config.xml index 25d02aaaa..60f5d54bd 100644 --- a/bundles/org.openhab.core.karaf/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.karaf/src/main/resources/ESH-INF/config/config.xml @@ -13,7 +13,8 @@ - Also allows the installation of 1.x bindings for which there is already a 2.x version available (requires remote repo access!). + Also allows the installation of 1.x bindings for which there is already a 2.x version available + (requires remote repo access!). false diff --git a/bundles/org.openhab.core.model.core/pom.xml b/bundles/org.openhab.core.model.core/pom.xml index 607b1b2d3..5e0e3c897 100644 --- a/bundles/org.openhab.core.model.core/pom.xml +++ b/bundles/org.openhab.core.model.core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/EventType.java b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/EventType.java index 57b1dc85c..85bbe9034 100644 --- a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/EventType.java +++ b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/EventType.java @@ -13,10 +13,12 @@ package org.openhab.core.model.core; /** - * These are the event types that can occur as model repository changes + * These are the event types that can occur as model repository changes * * @author Kai Kreuzer - Initial contribution */ public enum EventType { - ADDED, REMOVED, MODIFIED + ADDED, + REMOVED, + MODIFIED } diff --git a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/ModelRepositoryImpl.java b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/ModelRepositoryImpl.java index 9476fe3dc..8be60c235 100644 --- a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/ModelRepositoryImpl.java +++ b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/ModelRepositoryImpl.java @@ -35,13 +35,13 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.Resource.Diagnostic; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.Diagnostician; +import org.eclipse.xtext.resource.SynchronizedXtextResourceSet; +import org.eclipse.xtext.resource.XtextResource; +import org.eclipse.xtext.resource.XtextResourceSet; import org.openhab.core.model.core.EventType; import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.core.ModelRepositoryChangeListener; import org.openhab.core.model.core.SafeEMF; -import org.eclipse.xtext.resource.SynchronizedXtextResourceSet; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.resource.XtextResourceSet; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserver.java b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserver.java index 13bb6e2e1..863270a6c 100644 --- a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserver.java +++ b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserver.java @@ -36,9 +36,9 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.service.AbstractWatchService; import org.openhab.core.model.core.ModelParser; import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.service.AbstractWatchService; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/valueconverter/ValueTypeToStringConverter.java b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/valueconverter/ValueTypeToStringConverter.java index 91418eba2..f1088de9e 100644 --- a/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/valueconverter/ValueTypeToStringConverter.java +++ b/bundles/org.openhab.core.model.core/src/main/java/org/openhab/core/model/core/valueconverter/ValueTypeToStringConverter.java @@ -1,73 +1,73 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.model.core.valueconverter; - -import java.math.BigDecimal; - -import org.eclipse.xtext.conversion.IValueConverter; -import org.eclipse.xtext.conversion.ValueConverterException; -import org.eclipse.xtext.nodemodel.INode; -import org.eclipse.xtext.util.Strings; - -/** - * A {@link ValueTypeToStringConverter} is used to create a {@link String}, {@link Boolean}, or {@link BigDecimal} from - * an input string and vice versa. - * - * @author Alex Tugarev - Initial contribution - */ -public class ValueTypeToStringConverter implements IValueConverter { - - @Override - public Object toValue(String string, INode node) throws ValueConverterException { - if (string == null) { - return null; - } - if (string.startsWith("\"") && string.endsWith("\"")) { - try { - return Strings.convertFromJavaString(string.substring(1, string.length() - 1), true); - } catch (IllegalArgumentException e) { - throw new ValueConverterException(e.getMessage(), node, e); - } - } - if (string.equals("true") || string.equals("false")) { - return Boolean.valueOf(string); - } - try { - return new BigDecimal(string); - } catch (NumberFormatException e) { - throw new ValueConverterException("Number expected.", node, e); - } - } - - @Override - public String toString(Object value) throws ValueConverterException { - if (value == null) { - throw new ValueConverterException("Value may not be null.", null, null); - } - if (value instanceof String) { - return toEscapedString((String) value); - } - if (value instanceof BigDecimal) { - BigDecimal decimalValue = (BigDecimal) value; - return decimalValue.toPlainString(); - } - if (value instanceof Boolean) { - return ((Boolean) value).toString(); - } - throw new ValueConverterException("Unknown value type: " + value.getClass().getSimpleName(), null, null); - } - - protected String toEscapedString(String value) { - return '"' + Strings.convertToJavaString(value, false) + '"'; - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.model.core.valueconverter; + +import java.math.BigDecimal; + +import org.eclipse.xtext.conversion.IValueConverter; +import org.eclipse.xtext.conversion.ValueConverterException; +import org.eclipse.xtext.nodemodel.INode; +import org.eclipse.xtext.util.Strings; + +/** + * A {@link ValueTypeToStringConverter} is used to create a {@link String}, {@link Boolean}, or {@link BigDecimal} from + * an input string and vice versa. + * + * @author Alex Tugarev - Initial contribution + */ +public class ValueTypeToStringConverter implements IValueConverter { + + @Override + public Object toValue(String string, INode node) throws ValueConverterException { + if (string == null) { + return null; + } + if (string.startsWith("\"") && string.endsWith("\"")) { + try { + return Strings.convertFromJavaString(string.substring(1, string.length() - 1), true); + } catch (IllegalArgumentException e) { + throw new ValueConverterException(e.getMessage(), node, e); + } + } + if (string.equals("true") || string.equals("false")) { + return Boolean.valueOf(string); + } + try { + return new BigDecimal(string); + } catch (NumberFormatException e) { + throw new ValueConverterException("Number expected.", node, e); + } + } + + @Override + public String toString(Object value) throws ValueConverterException { + if (value == null) { + throw new ValueConverterException("Value may not be null.", null, null); + } + if (value instanceof String) { + return toEscapedString((String) value); + } + if (value instanceof BigDecimal) { + BigDecimal decimalValue = (BigDecimal) value; + return decimalValue.toPlainString(); + } + if (value instanceof Boolean) { + return ((Boolean) value).toString(); + } + throw new ValueConverterException("Unknown value type: " + value.getClass().getSimpleName(), null, null); + } + + protected String toEscapedString(String value) { + return '"' + Strings.convertToJavaString(value, false) + '"'; + } +} diff --git a/bundles/org.openhab.core.model.item.ide/pom.xml b/bundles/org.openhab.core.model.item.ide/pom.xml index 92b494cf2..0bccae06f 100644 --- a/bundles/org.openhab.core.model.item.ide/pom.xml +++ b/bundles/org.openhab.core.model.item.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.item.runtime/pom.xml b/bundles/org.openhab.core.model.item.runtime/pom.xml index e6dca15c8..43c422750 100644 --- a/bundles/org.openhab.core.model.item.runtime/pom.xml +++ b/bundles/org.openhab.core.model.item.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.item/pom.xml b/bundles/org.openhab.core.model.item/pom.xml index 8c1fc4edf..81cfdf974 100644 --- a/bundles/org.openhab.core.model.item/pom.xml +++ b/bundles/org.openhab.core.model.item/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.lazygen/pom.xml b/bundles/org.openhab.core.model.lazygen/pom.xml index 4d23a87c2..1e93f5a58 100644 --- a/bundles/org.openhab.core.model.lazygen/pom.xml +++ b/bundles/org.openhab.core.model.lazygen/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.lsp/pom.xml b/bundles/org.openhab.core.model.lsp/pom.xml index bf11d153a..b54c373fe 100644 --- a/bundles/org.openhab.core.model.lsp/pom.xml +++ b/bundles/org.openhab.core.model.lsp/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/ModelServer.java b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/ModelServer.java index aa501277e..80b2137de 100644 --- a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/ModelServer.java +++ b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/ModelServer.java @@ -23,11 +23,11 @@ import java.util.concurrent.Future; import org.eclipse.lsp4j.jsonrpc.Launcher; import org.eclipse.lsp4j.launch.LSPLauncher; import org.eclipse.lsp4j.services.LanguageClient; -import org.openhab.core.config.core.ConfigurableService; +import org.eclipse.xtext.ide.server.LanguageServerImpl; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.model.script.ScriptServiceUtil; import org.openhab.core.model.script.engine.ScriptEngine; -import org.eclipse.xtext.ide.server.LanguageServerImpl; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RegistryProvider.java b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RegistryProvider.java index 0f1de734b..26e31f497 100644 --- a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RegistryProvider.java +++ b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RegistryProvider.java @@ -16,6 +16,13 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl; import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; +import org.eclipse.xtext.XtextPackage; +import org.eclipse.xtext.resource.FileExtensionProvider; +import org.eclipse.xtext.resource.IResourceFactory; +import org.eclipse.xtext.resource.IResourceServiceProvider; +import org.eclipse.xtext.resource.IResourceServiceProvider.Registry; +import org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl; +import org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl; import org.openhab.core.model.ide.ItemsIdeSetup; import org.openhab.core.model.persistence.ide.PersistenceIdeSetup; import org.openhab.core.model.rule.ide.RulesIdeSetup; @@ -24,13 +31,6 @@ import org.openhab.core.model.script.engine.ScriptEngine; import org.openhab.core.model.script.ide.ScriptIdeSetup; import org.openhab.core.model.sitemap.ide.SitemapIdeSetup; import org.openhab.core.model.thing.ide.ThingIdeSetup; -import org.eclipse.xtext.XtextPackage; -import org.eclipse.xtext.resource.FileExtensionProvider; -import org.eclipse.xtext.resource.IResourceFactory; -import org.eclipse.xtext.resource.IResourceServiceProvider; -import org.eclipse.xtext.resource.IResourceServiceProvider.Registry; -import org.eclipse.xtext.resource.impl.BinaryGrammarResourceFactoryImpl; -import org.eclipse.xtext.resource.impl.ResourceServiceProviderRegistryImpl; import com.google.inject.Injector; import com.google.inject.Provider; diff --git a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RuntimeServerModule.java b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RuntimeServerModule.java index 9f11ced58..8585d1779 100644 --- a/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RuntimeServerModule.java +++ b/bundles/org.openhab.core.model.lsp/src/main/java/org/openhab/core/model/lsp/internal/RuntimeServerModule.java @@ -15,9 +15,6 @@ package org.openhab.core.model.lsp.internal; import java.util.concurrent.ExecutorService; import org.eclipse.lsp4j.services.LanguageServer; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.model.script.ScriptServiceUtil; -import org.openhab.core.model.script.engine.ScriptEngine; import org.eclipse.xtext.ide.ExecutorServiceProvider; import org.eclipse.xtext.ide.server.DefaultProjectDescriptionFactory; import org.eclipse.xtext.ide.server.ILanguageServerShutdownAndExitHandler; @@ -29,6 +26,9 @@ import org.eclipse.xtext.ide.server.UriExtensions; import org.eclipse.xtext.resource.IContainer; import org.eclipse.xtext.resource.IResourceServiceProvider; import org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.model.script.ScriptServiceUtil; +import org.openhab.core.model.script.engine.ScriptEngine; import com.google.inject.AbstractModule; diff --git a/bundles/org.openhab.core.model.lsp/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.model.lsp/src/main/resources/ESH-INF/config/config.xml index eadffe083..2f48539d4 100644 --- a/bundles/org.openhab.core.model.lsp/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.model.lsp/src/main/resources/ESH-INF/config/config.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.model.persistence.ide/pom.xml b/bundles/org.openhab.core.model.persistence.ide/pom.xml index 2ea160db0..6d5c5b41a 100644 --- a/bundles/org.openhab.core.model.persistence.ide/pom.xml +++ b/bundles/org.openhab.core.model.persistence.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.persistence.runtime/pom.xml b/bundles/org.openhab.core.model.persistence.runtime/pom.xml index e758ec05d..cbfef8922 100644 --- a/bundles/org.openhab.core.model.persistence.runtime/pom.xml +++ b/bundles/org.openhab.core.model.persistence.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.persistence/pom.xml b/bundles/org.openhab.core.model.persistence/pom.xml index 5befe6d3c..5bf756b42 100644 --- a/bundles/org.openhab.core.model.persistence/pom.xml +++ b/bundles/org.openhab.core.model.persistence/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.rule.ide/pom.xml b/bundles/org.openhab.core.model.rule.ide/pom.xml index 63d05560c..1a2d7aeeb 100644 --- a/bundles/org.openhab.core.model.rule.ide/pom.xml +++ b/bundles/org.openhab.core.model.rule.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.rule.runtime/pom.xml b/bundles/org.openhab.core.model.rule.runtime/pom.xml index c4bd60c2f..a8a4b9804 100644 --- a/bundles/org.openhab.core.model.rule.runtime/pom.xml +++ b/bundles/org.openhab.core.model.rule.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.rule/pom.xml b/bundles/org.openhab.core.model.rule/pom.xml index 55ee774cf..655b7b6a2 100644 --- a/bundles/org.openhab.core.model.rule/pom.xml +++ b/bundles/org.openhab.core.model.rule/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.script.ide/pom.xml b/bundles/org.openhab.core.model.script.ide/pom.xml index 7e066de2d..f51089a1f 100644 --- a/bundles/org.openhab.core.model.script.ide/pom.xml +++ b/bundles/org.openhab.core.model.script.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.script.runtime/pom.xml b/bundles/org.openhab.core.model.script.runtime/pom.xml index 6c6d034c5..5b0f4f932 100644 --- a/bundles/org.openhab.core.model.script.runtime/pom.xml +++ b/bundles/org.openhab.core.model.script.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.script/pom.xml b/bundles/org.openhab.core.model.script/pom.xml index 1c2fd023f..90784ec35 100644 --- a/bundles/org.openhab.core.model.script/pom.xml +++ b/bundles/org.openhab.core.model.script/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.sitemap.ide/pom.xml b/bundles/org.openhab.core.model.sitemap.ide/pom.xml index 73bc10947..9e9157f86 100644 --- a/bundles/org.openhab.core.model.sitemap.ide/pom.xml +++ b/bundles/org.openhab.core.model.sitemap.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.sitemap.runtime/pom.xml b/bundles/org.openhab.core.model.sitemap.runtime/pom.xml index 2b5dba516..d8e259588 100644 --- a/bundles/org.openhab.core.model.sitemap.runtime/pom.xml +++ b/bundles/org.openhab.core.model.sitemap.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.sitemap/pom.xml b/bundles/org.openhab.core.model.sitemap/pom.xml index 1f8ccdc07..bd4be635a 100644 --- a/bundles/org.openhab.core.model.sitemap/pom.xml +++ b/bundles/org.openhab.core.model.sitemap/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.thing.ide/pom.xml b/bundles/org.openhab.core.model.thing.ide/pom.xml index 09dcb55eb..323ae3a21 100644 --- a/bundles/org.openhab.core.model.thing.ide/pom.xml +++ b/bundles/org.openhab.core.model.thing.ide/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.thing.runtime/pom.xml b/bundles/org.openhab.core.model.thing.runtime/pom.xml index 46bad809f..d46ca3d81 100644 --- a/bundles/org.openhab.core.model.thing.runtime/pom.xml +++ b/bundles/org.openhab.core.model.thing.runtime/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.model.thing/pom.xml b/bundles/org.openhab.core.model.thing/pom.xml index 58c1b42ae..0f62ca7f2 100644 --- a/bundles/org.openhab.core.model.thing/pom.xml +++ b/bundles/org.openhab.core.model.thing/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.persistence/pom.xml b/bundles/org.openhab.core.persistence/pom.xml index 3fb489427..96868eb14 100644 --- a/bundles/org.openhab.core.persistence/pom.xml +++ b/bundles/org.openhab.core.persistence/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/FilterCriteria.java b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/FilterCriteria.java index 186853d67..a49d3cb66 100644 --- a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/FilterCriteria.java +++ b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/FilterCriteria.java @@ -1,245 +1,245 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.persistence; - -import java.time.ZonedDateTime; -import java.util.Date; -import java.util.TimeZone; - -import org.openhab.core.types.State; - -/** - * This class is used to define a filter for queries to a {@link PersistenceService}. - * - *

- * It is designed as a Java bean, for which the different properties are constraints on the query result. These - * properties include the item name, begin and end date and the item state. A compare operator can be defined to compare - * not only state equality, but also its decimal value (<,>). - * - *

- * Additionally, the filter criteria supports ordering and paging of the result, so the caller can ask to only return - * chunks of the result of a certain size (=pageSize) from a starting index (pageNumber*pageSize). - * - *

- * All setter methods return the filter criteria instance, so that the methods can be easily chained in order to define - * a filter. - * - * @author Kai Kreuzer - Initial contribution - * @author Lyubomir Papazov - Deprecate methods using java.util and add methods - * that use Java8's ZonedDateTime - */ -public class FilterCriteria { - - /** Enumeration with all possible compare options */ - public enum Operator { - EQ("="), - NEQ("!="), - GT(">"), - LT("<"), - GTE(">="), - LTE("<="); - - private final String symbol; - - Operator(String symbol) { - this.symbol = symbol; - } - - String getSymbol() { - return symbol; - } - } - - /** Enumeration with all ordering options */ - public enum Ordering { - ASCENDING, - DESCENDING - } - - /** filter result to only contain entries for the given item */ - private String itemName; - - /** filter result to only contain entries that are newer than the given date */ - private ZonedDateTime beginDate; - - /** filter result to only contain entries that are older than the given date */ - private ZonedDateTime endDate; - - /** return the result list from starting index pageNumber*pageSize only */ - private int pageNumber = 0; - - /** return at most this many results */ - private int pageSize = Integer.MAX_VALUE; - - /** use this operator to compare the item state */ - private Operator operator = Operator.EQ; - - /** how to sort the result list by date */ - private Ordering ordering = Ordering.DESCENDING; - - /** Filter result to only contain entries that evaluate to true with the given operator and state */ - private State state; - - public String getItemName() { - return itemName; - } - - /** - * @deprecated - * Please use {@link #getBeginDateZoned()} method which returns Java 8's - * ZonedDateTime. ZonedDateTime allows additional methods about time and time - * zone to be added for more specific filter queries. - * - * @return {@link java.util.Date} object that contains information about the - * date after which only newer entries are queried - */ - @Deprecated - public Date getBeginDate() { - if (beginDate != null) { - return Date.from(beginDate.toInstant()); - } else { - return null; - } - } - - public ZonedDateTime getBeginDateZoned() { - return beginDate; - } - - /** - * @deprecated - * Please use {@link #getEndDateZoned()} method which returns Java 8's - * ZonedDateTime. ZonedDateTime allows additional methods about time and time - * zone to be added for more specific filter queries. - * - * @return {@link java.util.Date} object that contains information about the - * date after which only older entries are queried - */ - @Deprecated - public Date getEndDate() { - if (endDate != null) { - return Date.from(endDate.toInstant()); - } else { - return null; - } - } - - public ZonedDateTime getEndDateZoned() { - return endDate; - } - - public int getPageNumber() { - return pageNumber; - } - - public int getPageSize() { - return pageSize; - } - - public Operator getOperator() { - return operator; - } - - public Ordering getOrdering() { - return ordering; - } - - public State getState() { - return state; - } - - public FilterCriteria setItemName(String itemName) { - this.itemName = itemName; - return this; - } - - /** - * @deprecated - * Please use the {@link #setBeginDate(ZonedDateTime)} method which takes Java 8's - * ZonedDateTime as a parameter. The Date object will be converted to a - * ZonedDateTime using the default time zone. ZonedDateTime allows additional - * methods about time and time zone to be added for more specific filter - * queries. - * - * @param beginDate A date for which to filter only newer entries. - * @return this FilterCriteria instance, so that the methods can be easily - * chained in order to define a filter - */ - @Deprecated - public FilterCriteria setBeginDate(Date beginDate) { - if (beginDate != null) { - this.beginDate = ZonedDateTime.ofInstant(beginDate.toInstant(), TimeZone.getDefault().toZoneId()); - } else { - this.beginDate = null; - } - return this; - } - - public FilterCriteria setBeginDate(ZonedDateTime beginDate) { - this.beginDate = beginDate; - return this; - } - - /** - * @deprecated - * Please use the {@link #setEndDate(ZonedDateTime)} method which takes Java 8's - * ZonedDateTime as a parameter. The Date object will be converted to a - * ZonedDateTime using the default time zone. ZonedDateTime allows additional - * methods about time and time zone to be added for more specific filter - * queries. - * - * @param endDate A date for which to filter only newer entries. - * @return this FilterCriteria instance, so that the methods can be easily - * chained in order to define a filter - */ - @Deprecated - public FilterCriteria setEndDate(Date endDate) { - if (endDate != null) { - this.endDate = ZonedDateTime.ofInstant(endDate.toInstant(), TimeZone.getDefault().toZoneId()); - } else { - this.endDate = null; - } - return this; - } - - public FilterCriteria setEndDate(ZonedDateTime endDate) { - this.endDate = endDate; - return this; - } - - public FilterCriteria setPageNumber(int pageNumber) { - this.pageNumber = pageNumber; - return this; - } - - public FilterCriteria setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - public FilterCriteria setOperator(Operator operator) { - this.operator = operator; - return this; - } - - public FilterCriteria setOrdering(Ordering ordering) { - this.ordering = ordering; - return this; - } - - public FilterCriteria setState(State state) { - this.state = state; - return this; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.persistence; + +import java.time.ZonedDateTime; +import java.util.Date; +import java.util.TimeZone; + +import org.openhab.core.types.State; + +/** + * This class is used to define a filter for queries to a {@link PersistenceService}. + * + *

+ * It is designed as a Java bean, for which the different properties are constraints on the query result. These + * properties include the item name, begin and end date and the item state. A compare operator can be defined to compare + * not only state equality, but also its decimal value (<,>). + * + *

+ * Additionally, the filter criteria supports ordering and paging of the result, so the caller can ask to only return + * chunks of the result of a certain size (=pageSize) from a starting index (pageNumber*pageSize). + * + *

+ * All setter methods return the filter criteria instance, so that the methods can be easily chained in order to define + * a filter. + * + * @author Kai Kreuzer - Initial contribution + * @author Lyubomir Papazov - Deprecate methods using java.util and add methods + * that use Java8's ZonedDateTime + */ +public class FilterCriteria { + + /** Enumeration with all possible compare options */ + public enum Operator { + EQ("="), + NEQ("!="), + GT(">"), + LT("<"), + GTE(">="), + LTE("<="); + + private final String symbol; + + Operator(String symbol) { + this.symbol = symbol; + } + + String getSymbol() { + return symbol; + } + } + + /** Enumeration with all ordering options */ + public enum Ordering { + ASCENDING, + DESCENDING + } + + /** filter result to only contain entries for the given item */ + private String itemName; + + /** filter result to only contain entries that are newer than the given date */ + private ZonedDateTime beginDate; + + /** filter result to only contain entries that are older than the given date */ + private ZonedDateTime endDate; + + /** return the result list from starting index pageNumber*pageSize only */ + private int pageNumber = 0; + + /** return at most this many results */ + private int pageSize = Integer.MAX_VALUE; + + /** use this operator to compare the item state */ + private Operator operator = Operator.EQ; + + /** how to sort the result list by date */ + private Ordering ordering = Ordering.DESCENDING; + + /** Filter result to only contain entries that evaluate to true with the given operator and state */ + private State state; + + public String getItemName() { + return itemName; + } + + /** + * @deprecated + * Please use {@link #getBeginDateZoned()} method which returns Java 8's + * ZonedDateTime. ZonedDateTime allows additional methods about time and time + * zone to be added for more specific filter queries. + * + * @return {@link java.util.Date} object that contains information about the + * date after which only newer entries are queried + */ + @Deprecated + public Date getBeginDate() { + if (beginDate != null) { + return Date.from(beginDate.toInstant()); + } else { + return null; + } + } + + public ZonedDateTime getBeginDateZoned() { + return beginDate; + } + + /** + * @deprecated + * Please use {@link #getEndDateZoned()} method which returns Java 8's + * ZonedDateTime. ZonedDateTime allows additional methods about time and time + * zone to be added for more specific filter queries. + * + * @return {@link java.util.Date} object that contains information about the + * date after which only older entries are queried + */ + @Deprecated + public Date getEndDate() { + if (endDate != null) { + return Date.from(endDate.toInstant()); + } else { + return null; + } + } + + public ZonedDateTime getEndDateZoned() { + return endDate; + } + + public int getPageNumber() { + return pageNumber; + } + + public int getPageSize() { + return pageSize; + } + + public Operator getOperator() { + return operator; + } + + public Ordering getOrdering() { + return ordering; + } + + public State getState() { + return state; + } + + public FilterCriteria setItemName(String itemName) { + this.itemName = itemName; + return this; + } + + /** + * @deprecated + * Please use the {@link #setBeginDate(ZonedDateTime)} method which takes Java 8's + * ZonedDateTime as a parameter. The Date object will be converted to a + * ZonedDateTime using the default time zone. ZonedDateTime allows additional + * methods about time and time zone to be added for more specific filter + * queries. + * + * @param beginDate A date for which to filter only newer entries. + * @return this FilterCriteria instance, so that the methods can be easily + * chained in order to define a filter + */ + @Deprecated + public FilterCriteria setBeginDate(Date beginDate) { + if (beginDate != null) { + this.beginDate = ZonedDateTime.ofInstant(beginDate.toInstant(), TimeZone.getDefault().toZoneId()); + } else { + this.beginDate = null; + } + return this; + } + + public FilterCriteria setBeginDate(ZonedDateTime beginDate) { + this.beginDate = beginDate; + return this; + } + + /** + * @deprecated + * Please use the {@link #setEndDate(ZonedDateTime)} method which takes Java 8's + * ZonedDateTime as a parameter. The Date object will be converted to a + * ZonedDateTime using the default time zone. ZonedDateTime allows additional + * methods about time and time zone to be added for more specific filter + * queries. + * + * @param endDate A date for which to filter only newer entries. + * @return this FilterCriteria instance, so that the methods can be easily + * chained in order to define a filter + */ + @Deprecated + public FilterCriteria setEndDate(Date endDate) { + if (endDate != null) { + this.endDate = ZonedDateTime.ofInstant(endDate.toInstant(), TimeZone.getDefault().toZoneId()); + } else { + this.endDate = null; + } + return this; + } + + public FilterCriteria setEndDate(ZonedDateTime endDate) { + this.endDate = endDate; + return this; + } + + public FilterCriteria setPageNumber(int pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + public FilterCriteria setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + public FilterCriteria setOperator(Operator operator) { + this.operator = operator; + return this; + } + + public FilterCriteria setOrdering(Ordering ordering) { + this.ordering = ordering; + return this; + } + + public FilterCriteria setState(State state) { + this.state = state; + return this; + } + +} diff --git a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/HistoricItem.java b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/HistoricItem.java index d200959da..2db83dda6 100644 --- a/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/HistoricItem.java +++ b/bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/HistoricItem.java @@ -1,57 +1,57 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.persistence; - -import java.util.Date; - -import org.eclipse.jdt.annotation.NonNull; -import org.openhab.core.items.Item; -import org.openhab.core.types.State; - -/** - * This interface is used by persistence services to represent an item - * with a certain state at a given point in time. - * - *

- * Note that this interface does not extend {@link Item} as the persistence services could not provide an implementation - * that correctly implement getAcceptedXTypes() and getGroupNames(). - * - * @author Kai Kreuzer - Initial contribution - */ -public interface HistoricItem { - - /** - * returns the timestamp of the persisted item - * - * @return the timestamp of the item - */ - @NonNull - Date getTimestamp(); - - /** - * returns the current state of the item - * - * @return the current state - */ - @NonNull - State getState(); - - /** - * returns the name of the item - * - * @return the name of the item - */ - @NonNull - String getName(); - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.persistence; + +import java.util.Date; + +import org.eclipse.jdt.annotation.NonNull; +import org.openhab.core.items.Item; +import org.openhab.core.types.State; + +/** + * This interface is used by persistence services to represent an item + * with a certain state at a given point in time. + * + *

+ * Note that this interface does not extend {@link Item} as the persistence services could not provide an implementation + * that correctly implement getAcceptedXTypes() and getGroupNames(). + * + * @author Kai Kreuzer - Initial contribution + */ +public interface HistoricItem { + + /** + * returns the timestamp of the persisted item + * + * @return the timestamp of the item + */ + @NonNull + Date getTimestamp(); + + /** + * returns the current state of the item + * + * @return the current state + */ + @NonNull + State getState(); + + /** + * returns the name of the item + * + * @return the name of the item + */ + @NonNull + String getName(); + +} diff --git a/bundles/org.openhab.core.scheduler/pom.xml b/bundles/org.openhab.core.scheduler/pom.xml index be85e222f..7443c35d4 100644 --- a/bundles/org.openhab.core.scheduler/pom.xml +++ b/bundles/org.openhab.core.scheduler/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.semantics/pom.xml b/bundles/org.openhab.core.semantics/pom.xml index eb3393312..231dc4aee 100644 --- a/bundles/org.openhab.core.semantics/pom.xml +++ b/bundles/org.openhab.core.semantics/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java index 9bef9f023..b6053c47f 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/equipment/Equipments.java @@ -12,8 +12,8 @@ */ package org.openhab.core.semantics.model.equipment; -import java.util.Set; import java.util.HashSet; +import java.util.Set; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java index 176be98c9..2b0ee825b 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/location/Locations.java @@ -12,8 +12,8 @@ */ package org.openhab.core.semantics.model.location; -import java.util.Set; import java.util.HashSet; +import java.util.Set; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java index ddf0a3a65..013adba5c 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/point/Points.java @@ -12,8 +12,8 @@ */ package org.openhab.core.semantics.model.point; -import java.util.Set; import java.util.HashSet; +import java.util.Set; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java index 7b5ec4326..9f554b34b 100644 --- a/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java +++ b/bundles/org.openhab.core.semantics/src/main/java/org/openhab/core/semantics/model/property/Properties.java @@ -12,8 +12,8 @@ */ package org.openhab.core.semantics.model.property; -import java.util.Set; import java.util.HashSet; +import java.util.Set; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java index bdac8f86f..da218bec6 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/SemanticTagsTest.java @@ -16,6 +16,8 @@ import static org.junit.Assert.*; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.library.CoreItemFactory; @@ -26,8 +28,6 @@ import org.openhab.core.semantics.model.location.Kitchen; import org.openhab.core.semantics.model.location.Room; import org.openhab.core.semantics.model.point.Measurement; import org.openhab.core.semantics.model.property.Temperature; -import org.junit.Before; -import org.junit.Test; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java index 14eda0a5d..207bd6eb0 100644 --- a/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java +++ b/bundles/org.openhab.core.semantics/src/test/java/org/openhab/core/semantics/internal/SemanticsServiceImplTest.java @@ -21,6 +21,9 @@ import java.util.Locale; import java.util.Set; import java.util.stream.Stream; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; @@ -29,9 +32,6 @@ import org.openhab.core.items.MetadataRegistry; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.semantics.model.location.Bathroom; import org.openhab.core.semantics.model.location.LivingRoom; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core.storage.json/pom.xml b/bundles/org.openhab.core.storage.json/pom.xml index 17a7e5895..8e86e8462 100644 --- a/bundles/org.openhab.core.storage.json/pom.xml +++ b/bundles/org.openhab.core.storage.json/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.storage.json/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.storage.json/src/main/resources/ESH-INF/config/config.xml index 67290de3c..84389412d 100644 --- a/bundles/org.openhab.core.storage.json/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.storage.json/src/main/resources/ESH-INF/config/config.xml @@ -13,12 +13,14 @@ - Sets the time to wait before writing changes to disk. This can reduce the number of writes when many changes are being introduced within a short period. Time is defined in milliseconds. + Sets the time to wait before writing changes to disk. This can reduce the number of writes when many + changes are being introduced within a short period. Time is defined in milliseconds. 500 - Sets the maximum period the service will wait to write data to disk in the event that many changes are happening continually. + Sets the maximum period the service will wait to write data to disk in the event that many changes are + happening continually. 30000 diff --git a/bundles/org.openhab.core.storage.json/src/test/java/org/openhab/core/storage/json/internal/JsonStorageTest.java b/bundles/org.openhab.core.storage.json/src/test/java/org/openhab/core/storage/json/internal/JsonStorageTest.java index 15e330a38..b6df74097 100644 --- a/bundles/org.openhab.core.storage.json/src/test/java/org/openhab/core/storage/json/internal/JsonStorageTest.java +++ b/bundles/org.openhab.core.storage.json/src/test/java/org/openhab/core/storage/json/internal/JsonStorageTest.java @@ -22,10 +22,10 @@ import java.util.Arrays; import java.util.List; import org.apache.commons.io.FileUtils; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.test.java.JavaTest; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.test.java.JavaTest; /** * This test makes sure that the JsonStorage loads all stored numbers as BigDecimal diff --git a/bundles/org.openhab.core.storage.mapdb/pom.xml b/bundles/org.openhab.core.storage.mapdb/pom.xml index 6c0cf0e58..5929625bf 100644 --- a/bundles/org.openhab.core.storage.mapdb/pom.xml +++ b/bundles/org.openhab.core.storage.mapdb/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorage.java b/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorage.java index 64824fce1..477b0d9e2 100644 --- a/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorage.java +++ b/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorage.java @@ -20,11 +20,11 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.mapdb.DB; import org.openhab.core.items.ManagedItemProvider.PersistedItem; import org.openhab.core.items.ManagedItemProvider.PersistedItemInstanceCreator; import org.openhab.core.storage.DeletableStorage; import org.openhab.core.storage.Storage; -import org.mapdb.DB; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorageService.java b/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorageService.java index 0f3c9cf7a..7c9937ed7 100644 --- a/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorageService.java +++ b/bundles/org.openhab.core.storage.mapdb/src/main/java/org/openhab/core/storage/mapdb/internal/MapDbStorageService.java @@ -16,12 +16,12 @@ import java.io.File; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.mapdb.DB; +import org.mapdb.DBMaker; import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.storage.DeletableStorage; import org.openhab.core.storage.DeletableStorageService; import org.openhab.core.storage.StorageService; -import org.mapdb.DB; -import org.mapdb.DBMaker; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; diff --git a/bundles/org.openhab.core.storage.mapdb/src/test/java/org/openhab/core/storage/mapdb/internal/MapDbStorageServiceTest.java b/bundles/org.openhab.core.storage.mapdb/src/test/java/org/openhab/core/storage/mapdb/internal/MapDbStorageServiceTest.java index 77852c670..80a5d40c8 100644 --- a/bundles/org.openhab.core.storage.mapdb/src/test/java/org/openhab/core/storage/mapdb/internal/MapDbStorageServiceTest.java +++ b/bundles/org.openhab.core.storage.mapdb/src/test/java/org/openhab/core/storage/mapdb/internal/MapDbStorageServiceTest.java @@ -25,15 +25,15 @@ import java.util.Objects; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.storage.DeletableStorage; -import org.openhab.core.storage.Storage; import org.hamcrest.Matchers; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.storage.DeletableStorage; +import org.openhab.core.storage.Storage; /** * @author Thomas Eichstaedt-Engelen - Initial contribution diff --git a/bundles/org.openhab.core.test.magic/pom.xml b/bundles/org.openhab.core.test.magic/pom.xml index 712af8627..dfcb3e4e5 100644 --- a/bundles/org.openhab.core.test.magic/pom.xml +++ b/bundles/org.openhab.core.test.magic/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicActionModuleThingHandler.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicActionModuleThingHandler.java index 199b54b43..097282ea9 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicActionModuleThingHandler.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicActionModuleThingHandler.java @@ -16,13 +16,13 @@ import java.util.Collection; import java.util.Collections; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.magic.binding.internal.automation.modules.MagicThingActionsService; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.binding.BaseThingHandler; import org.openhab.core.thing.binding.ThingHandlerService; import org.openhab.core.types.Command; -import org.openhab.core.magic.binding.internal.automation.modules.MagicThingActionsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicDynamicStateDescriptionThingHandler.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicDynamicStateDescriptionThingHandler.java index 689c9f5ea..ba1cba708 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicDynamicStateDescriptionThingHandler.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicDynamicStateDescriptionThingHandler.java @@ -17,13 +17,13 @@ import static org.openhab.core.magic.binding.MagicBindingConstants.*; import java.util.Arrays; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.magic.binding.internal.MagicDynamicStateDescriptionProvider; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.binding.BaseThingHandler; import org.openhab.core.types.Command; import org.openhab.core.types.StateOption; -import org.openhab.core.magic.binding.internal.MagicDynamicStateDescriptionProvider; /** * ThingHandler which provides channels with dynamic state descriptions. diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicFirmwareUpdateThingHandler.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicFirmwareUpdateThingHandler.java index 0b8fecfcb..7ef617ae4 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicFirmwareUpdateThingHandler.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicFirmwareUpdateThingHandler.java @@ -13,6 +13,7 @@ package org.openhab.core.magic.binding.handler; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.magic.binding.MagicBindingConstants; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingStatus; @@ -23,7 +24,6 @@ import org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler; import org.openhab.core.thing.binding.firmware.ProgressCallback; import org.openhab.core.thing.binding.firmware.ProgressStep; import org.openhab.core.types.Command; -import org.openhab.core.magic.binding.MagicBindingConstants; /** * Handler for firmware updatable magic things. Defines full progress sequence and simulates firmware update with small diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicImageHandler.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicImageHandler.java index 94286dccf..e1a7e6e09 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicImageHandler.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/handler/MagicImageHandler.java @@ -12,6 +12,7 @@ */ package org.openhab.core.magic.binding.handler; +import org.openhab.core.io.net.http.HttpUtil; import org.openhab.core.library.types.RawType; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; @@ -20,7 +21,6 @@ import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.binding.BaseThingHandler; import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; -import org.openhab.core.io.net.http.HttpUtil; /** * The {@link MagicImageHandler} is responsible for handling commands, which are diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicHandlerFactory.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicHandlerFactory.java index e0a722ce2..6cbaf6877 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicHandlerFactory.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicHandlerFactory.java @@ -19,12 +19,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.openhab.core.thing.Bridge; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingTypeUID; -import org.openhab.core.thing.binding.BaseThingHandlerFactory; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.thing.binding.ThingHandlerFactory; import org.openhab.core.magic.binding.handler.MagicActionModuleThingHandler; import org.openhab.core.magic.binding.handler.MagicBridgeHandler; import org.openhab.core.magic.binding.handler.MagicBridgedThingHandler; @@ -44,6 +38,12 @@ import org.openhab.core.magic.binding.handler.MagicOnlineOfflineHandler; import org.openhab.core.magic.binding.handler.MagicPlayerHandler; import org.openhab.core.magic.binding.handler.MagicRolllershutterHandler; import org.openhab.core.magic.binding.handler.MagicThermostatThingHandler; +import org.openhab.core.thing.Bridge; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.binding.BaseThingHandlerFactory; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerFactory; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicServiceImpl.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicServiceImpl.java index ca93af0b6..d7c51f858 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicServiceImpl.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/MagicServiceImpl.java @@ -34,8 +34,8 @@ import org.slf4j.LoggerFactory; * @author Henning Treu - Initial contribution */ @Component(configurationPid = "org.openhab.core.magic", service = ConfigOptionProvider.class, immediate = true, property = { - "service.pid=org.openhab.core.magic", "service.config.description.uri=test:magic", - "service.config.label=Magic", "service.config.category=test" }) + "service.pid=org.openhab.core.magic", "service.config.description.uri=test:magic", "service.config.label=Magic", + "service.config.category=test" }) public class MagicServiceImpl implements MagicService { private final Logger logger = LoggerFactory.getLogger(MagicServiceImpl.class); diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicSingleActionService.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicSingleActionService.java index 7a221d772..b7377b18f 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicSingleActionService.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicSingleActionService.java @@ -15,12 +15,12 @@ package org.openhab.core.magic.binding.internal.automation.modules; import java.util.HashMap; import java.util.Map; -import org.openhab.core.config.core.ConfigurableService; import org.openhab.core.automation.AnnotatedActions; import org.openhab.core.automation.annotation.ActionInput; import org.openhab.core.automation.annotation.ActionOutput; import org.openhab.core.automation.annotation.ActionScope; import org.openhab.core.automation.annotation.RuleAction; +import org.openhab.core.config.core.ConfigurableService; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicThingActionsService.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicThingActionsService.java index 9a9b1d49b..73bfde012 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicThingActionsService.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/automation/modules/MagicThingActionsService.java @@ -15,13 +15,13 @@ package org.openhab.core.magic.binding.internal.automation.modules; import java.util.HashMap; import java.util.Map; -import org.openhab.core.thing.binding.ThingActions; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.magic.binding.handler.MagicActionModuleThingHandler; import org.openhab.core.automation.annotation.ActionInput; import org.openhab.core.automation.annotation.ActionOutput; import org.openhab.core.automation.annotation.ActionScope; import org.openhab.core.automation.annotation.RuleAction; +import org.openhab.core.magic.binding.handler.MagicActionModuleThingHandler; +import org.openhab.core.thing.binding.ThingActions; +import org.openhab.core.thing.binding.ThingHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/firmware/MagicFirmwareProvider.java b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/firmware/MagicFirmwareProvider.java index 86b0a5290..bb949e914 100644 --- a/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/firmware/MagicFirmwareProvider.java +++ b/bundles/org.openhab.core.test.magic/src/main/java/org/openhab/core/magic/binding/internal/firmware/MagicFirmwareProvider.java @@ -17,11 +17,11 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.openhab.core.magic.binding.MagicBindingConstants; import org.openhab.core.thing.Thing; import org.openhab.core.thing.binding.firmware.Firmware; import org.openhab.core.thing.binding.firmware.FirmwareBuilder; import org.openhab.core.thing.firmware.FirmwareProvider; -import org.openhab.core.magic.binding.MagicBindingConstants; import org.osgi.service.component.annotations.Component; /** diff --git a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/binding/binding.xml b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/binding/binding.xml index a91dd1298..209d57a6e 100644 --- a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/binding/binding.xml +++ b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/binding/binding.xml @@ -1,6 +1,5 @@ - diff --git a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/config.xml index 51a74a1cd..154df89dd 100644 --- a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/config.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicMultiAction.xml b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicMultiAction.xml index f9dc38363..7a53d29b0 100644 --- a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicMultiAction.xml +++ b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicMultiAction.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicSingleAction.xml b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicSingleAction.xml index 4fc5cde39..3862be81c 100644 --- a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicSingleAction.xml +++ b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/magicSingleAction.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/multipleConfig.xml b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/multipleConfig.xml index 515dbdbad..cfeb24ddd 100644 --- a/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/multipleConfig.xml +++ b/bundles/org.openhab.core.test.magic/src/main/resources/ESH-INF/config/multipleConfig.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicColorLightHandlerTest.java b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicColorLightHandlerTest.java index 5736c2664..0288a00e0 100644 --- a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicColorLightHandlerTest.java +++ b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicColorLightHandlerTest.java @@ -17,16 +17,16 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingStatus; -import org.openhab.core.thing.ThingStatusInfo; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.thing.binding.ThingHandlerCallback; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingStatusInfo; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerCallback; /** * Tests cases for {@link MagicONOffLightHandler}. The tests provide mocks for supporting entities using Mockito. diff --git a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicDimmableLightHandlerTest.java b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicDimmableLightHandlerTest.java index d4a8beefc..e4eabf551 100644 --- a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicDimmableLightHandlerTest.java +++ b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicDimmableLightHandlerTest.java @@ -17,16 +17,16 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingStatus; -import org.openhab.core.thing.ThingStatusInfo; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.thing.binding.ThingHandlerCallback; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingStatusInfo; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerCallback; /** * Tests cases for {@link MagicDimmableLightHandler}. The tests provide mocks for supporting entities using Mockito. diff --git a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicOnOffLightHandlerTest.java b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicOnOffLightHandlerTest.java index 16278da14..a4797c719 100644 --- a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicOnOffLightHandlerTest.java +++ b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/handler/MagicOnOffLightHandlerTest.java @@ -17,16 +17,16 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingStatus; -import org.openhab.core.thing.ThingStatusInfo; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.thing.binding.ThingHandlerCallback; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingStatusInfo; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.ThingHandlerCallback; /** * Tests cases for {@link MagicOnOffLightHandler}. The tests provide mocks for supporting entities using Mockito. diff --git a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicHandlerFactoryTest.java b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicHandlerFactoryTest.java index 216e9bfb8..8549aeed5 100644 --- a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicHandlerFactoryTest.java +++ b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicHandlerFactoryTest.java @@ -16,14 +16,14 @@ import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.*; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingTypeUID; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.magic.binding.MagicBindingConstants; import org.openhab.core.magic.binding.handler.MagicColorLightHandler; import org.openhab.core.magic.binding.handler.MagicDimmableLightHandler; import org.openhab.core.magic.binding.handler.MagicOnOffLightHandler; -import org.junit.Before; -import org.junit.Test; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingTypeUID; /** * Tests cases for {@link MagicHandlerFactory}. diff --git a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicServiceImplTest.java b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicServiceImplTest.java index cf0db27a6..903e13406 100644 --- a/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicServiceImplTest.java +++ b/bundles/org.openhab.core.test.magic/src/test/java/org/openhab/core/magic/binding/internal/MagicServiceImplTest.java @@ -18,10 +18,10 @@ import static org.junit.Assert.*; import java.net.URI; import java.util.Collection; -import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.magic.binding.MagicService; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.magic.binding.MagicService; /** * Tests cases for {@link MagicService}. diff --git a/bundles/org.openhab.core.test/pom.xml b/bundles/org.openhab.core.test/pom.xml index af8887bc2..2224ce14a 100644 --- a/bundles/org.openhab.core.test/pom.xml +++ b/bundles/org.openhab.core.test/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/SyntheticBundleInstaller.java b/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/SyntheticBundleInstaller.java index c84965644..140584446 100644 --- a/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/SyntheticBundleInstaller.java +++ b/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/SyntheticBundleInstaller.java @@ -34,10 +34,10 @@ import java.util.stream.Stream; import java.util.zip.ZipEntry; import org.apache.commons.io.IOUtils; +import org.junit.Assert; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyMarkerUtils; import org.openhab.core.service.ReadyService; -import org.junit.Assert; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; diff --git a/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/java/JavaOSGiTest.java b/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/java/JavaOSGiTest.java index efe0969bf..feb39fa75 100644 --- a/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/java/JavaOSGiTest.java +++ b/bundles/org.openhab.core.test/src/main/java/org/openhab/core/test/java/JavaOSGiTest.java @@ -27,11 +27,11 @@ import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.test.internal.java.MissingServiceAnalyzer; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.After; import org.junit.Assert; import org.junit.Before; +import org.openhab.core.test.internal.java.MissingServiceAnalyzer; +import org.openhab.core.test.storage.VolatileStorageService; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; diff --git a/bundles/org.openhab.core.thing.xml/pom.xml b/bundles/org.openhab.core.thing.xml/pom.xml index 20512cf75..1d526a529 100644 --- a/bundles/org.openhab.core.thing.xml/pom.xml +++ b/bundles/org.openhab.core.thing.xml/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.thing.xml/src/main/java/org/openhab/core/thing/xml/internal/ThingDescriptionConverter.java b/bundles/org.openhab.core.thing.xml/src/main/java/org/openhab/core/thing/xml/internal/ThingDescriptionConverter.java index 7ee2d1ff5..9e39f21b7 100644 --- a/bundles/org.openhab.core.thing.xml/src/main/java/org/openhab/core/thing/xml/internal/ThingDescriptionConverter.java +++ b/bundles/org.openhab.core.thing.xml/src/main/java/org/openhab/core/thing/xml/internal/ThingDescriptionConverter.java @@ -38,8 +38,8 @@ public class ThingDescriptionConverter extends GenericUnmarshaller - + - - - - - + + + + + - - My own great HUE Lamp. + + My own great HUE Lamp. - - - - + + + + - - - Color - - The color channel allows to control the color of a light. - It is also possible to dim values and switch the light on and off. - - - Hue - ColorLamp - + + + Color + + The color channel allows to control the color of a light. + It is also possible to dim values and switch the light on and off. + + + Hue + ColorLamp + - - - - + + + + - - - Dimmer - - The brightness channel allows to control the brightness of a light. - It is also possible to switch the light on and off. - - - Hue - DimmableLamp - + + + Dimmer + + The brightness channel allows to control the brightness of a light. + It is also possible to switch the light on and off. + + + Hue + DimmableLamp + - - - - + + + + - - - Dimmer - - The color temperature channel allows to set the color - temperature of a light from 0 (cold) to 100 (warm). - - Hue - AmbientLamp - - + + + Dimmer + + The color temperature channel allows to set the color + temperature of a light from 0 (cold) to 100 (warm). + + Hue + AmbientLamp + + - - - Number - - The light blinks if alarm is set. - ALARM - - Hue - AlarmSystem - - - - - - - + + + Number + + The light blinks if alarm is set. + ALARM + + Hue + AlarmSystem + + + + + + + - - - Number - - The sensor detecting motion. - MOTION - - Hue - AlarmSystem - - + + + Number + + The sensor detecting motion. + MOTION + + Hue + AlarmSystem + + - - - - The alarm system. - - - - - - - + + + + The alarm system. + + + + + + + diff --git a/bundles/org.openhab.core.thing/pom.xml b/bundles/org.openhab.core.thing/pom.xml index 12a93bf78..6d56e1566 100644 --- a/bundles/org.openhab.core.thing/pom.xml +++ b/bundles/org.openhab.core.thing/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/Thing.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/Thing.java index 32f5a93e6..1a9ab9350 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/Thing.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/Thing.java @@ -17,8 +17,8 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.common.registry.Identifiable; +import org.openhab.core.config.core.Configuration; import org.openhab.core.items.Item; import org.openhab.core.thing.binding.ThingHandler; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingRegistry.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingRegistry.java index 90f5e07ce..0de332345 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingRegistry.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/ThingRegistry.java @@ -16,9 +16,9 @@ import java.util.Map; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.common.registry.Registry; import org.openhab.core.config.core.Configuration; import org.openhab.core.config.core.validation.ConfigValidationException; -import org.openhab.core.common.registry.Registry; import org.openhab.core.thing.binding.ThingHandler; import org.openhab.core.thing.internal.ThingTracker; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/BaseDynamicCommandDescriptionProvider.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/BaseDynamicCommandDescriptionProvider.java index e1a1ca49c..b5bbe0f37 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/BaseDynamicCommandDescriptionProvider.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/binding/BaseDynamicCommandDescriptionProvider.java @@ -69,7 +69,8 @@ public abstract class BaseDynamicCommandDescriptionProvider implements DynamicCo return null; } - return CommandDescriptionBuilder.create().withCommandOptions(localizedCommandOptions(options, channel, locale)).build(); + return CommandDescriptionBuilder.create().withCommandOptions(localizedCommandOptions(options, channel, locale)) + .build(); } /** diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingAddedEvent.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingAddedEvent.java index 64d934f8e..e00413ac9 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingAddedEvent.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingAddedEvent.java @@ -16,7 +16,7 @@ import org.openhab.core.thing.dto.ThingDTO; /** * A {@link ThingAddedEvent} notifies subscribers that a thing has been added. - * Thing added events must be created with the {@link ThingEventFactory}. + * Thing added events must be created with the {@link ThingEventFactory}. * * @author Stefan Bußweiler - Initial contribution */ diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingRemovedEvent.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingRemovedEvent.java index 68e68a9b6..7844f4430 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingRemovedEvent.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingRemovedEvent.java @@ -16,7 +16,7 @@ import org.openhab.core.thing.dto.ThingDTO; /** * A {@link ThingRemovedEvent} notifies subscribers that a thing has been removed. - * Thing removed events must be created with the {@link ThingEventFactory}. + * Thing removed events must be created with the {@link ThingEventFactory}. * * @author Stefan Bußweiler - Initial contribution */ diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingUpdatedEvent.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingUpdatedEvent.java index 89dd5661c..84e3a32a0 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingUpdatedEvent.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/events/ThingUpdatedEvent.java @@ -16,7 +16,7 @@ import org.openhab.core.thing.dto.ThingDTO; /** * A {@link ThingUpdatedEvent} notifies subscribers that a thing has been updated. - * Thing updated events must be created with the {@link ThingEventFactory}. + * Thing updated events must be created with the {@link ThingEventFactory}. * * @author Stefan Bußweiler - Initial contribution */ diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ProfileContextImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ProfileContextImpl.java index fe145a59f..1b0d19d48 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ProfileContextImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ProfileContextImpl.java @@ -15,8 +15,8 @@ package org.openhab.core.thing.internal; import java.util.concurrent.ScheduledExecutorService; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.Configuration; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.core.Configuration; import org.openhab.core.thing.profiles.ProfileContext; /** diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingManagerImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingManagerImpl.java index d6c7a038f..339464201 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingManagerImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingManagerImpl.java @@ -35,16 +35,16 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.function.Function; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescription; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.config.core.validation.ConfigDescriptionValidator; import org.openhab.core.common.SafeCaller; import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.common.registry.Identifiable; import org.openhab.core.common.registry.ManagedProvider; import org.openhab.core.common.registry.Provider; +import org.openhab.core.config.core.ConfigDescription; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigDescriptionRegistry; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.config.core.validation.ConfigDescriptionValidator; import org.openhab.core.events.EventPublisher; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyMarkerFilter; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingRegistryImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingRegistryImpl.java index 273ae84a2..cce6ff9fa 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingRegistryImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingRegistryImpl.java @@ -18,8 +18,8 @@ import java.util.concurrent.CopyOnWriteArrayList; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; import org.openhab.core.common.registry.AbstractRegistry; +import org.openhab.core.config.core.Configuration; import org.openhab.core.events.EventPublisher; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Channel; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingTracker.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingTracker.java index 0c44d215c..ae065d24e 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingTracker.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ThingTracker.java @@ -28,7 +28,12 @@ import org.openhab.core.thing.ThingRegistryChangeListener; public interface ThingTracker { public enum ThingTrackerEvent { - THING_ADDED, THING_REMOVING, THING_REMOVED, THING_UPDATED, TRACKER_ADDED, TRACKER_REMOVED + THING_ADDED, + THING_REMOVING, + THING_REMOVED, + THING_UPDATED, + TRACKER_ADDED, + TRACKER_REMOVED } /** @@ -40,7 +45,8 @@ public interface ThingTracker { void thingAdded(Thing thing, ThingTrackerEvent thingTrackerEvent); /** - * This method is called for every thing that is going to be removed from the {@link ThingRegistryImpl}. Moreover the method is + * This method is called for every thing that is going to be removed from the {@link ThingRegistryImpl}. Moreover + * the method is * called for every thing, * that exists in the {@link ThingRegistryImpl}, when the tracker is * unregistered. diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/FirmwareUpdateConsoleCommandExtension.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/FirmwareUpdateConsoleCommandExtension.java index 29153a661..ee8129a2e 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/FirmwareUpdateConsoleCommandExtension.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/FirmwareUpdateConsoleCommandExtension.java @@ -17,6 +17,9 @@ import java.util.Collection; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; import org.openhab.core.thing.ThingUID; @@ -25,9 +28,6 @@ import org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler; import org.openhab.core.thing.firmware.FirmwareRegistry; import org.openhab.core.thing.firmware.FirmwareStatusInfo; import org.openhab.core.thing.firmware.FirmwareUpdateService; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/LinkConsoleCommandExtension.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/LinkConsoleCommandExtension.java index e77df6128..d80951d9f 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/LinkConsoleCommandExtension.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/LinkConsoleCommandExtension.java @@ -16,12 +16,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import org.openhab.core.thing.ChannelUID; -import org.openhab.core.thing.link.ItemChannelLink; -import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.openhab.core.io.console.Console; import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; import org.openhab.core.io.console.extensions.ConsoleCommandExtension; +import org.openhab.core.thing.ChannelUID; +import org.openhab.core.thing.link.ItemChannelLink; +import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/ThingConsoleCommandExtension.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/ThingConsoleCommandExtension.java index dfeba1cee..f0b25c67b 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/ThingConsoleCommandExtension.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/console/ThingConsoleCommandExtension.java @@ -22,6 +22,9 @@ import java.util.List; import java.util.Map; import org.openhab.core.events.EventPublisher; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; @@ -33,9 +36,6 @@ import org.openhab.core.thing.ThingStatusInfo; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.events.ThingEventFactory; import org.openhab.core.thing.i18n.ThingStatusInfoI18nLocalizationService; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceImpl.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceImpl.java index 3b5d28ef8..ca187bcf7 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceImpl.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceImpl.java @@ -33,10 +33,10 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.validation.ConfigDescriptionValidator; -import org.openhab.core.config.core.validation.ConfigValidationException; import org.openhab.core.common.SafeCaller; import org.openhab.core.common.ThreadPoolManager; +import org.openhab.core.config.core.validation.ConfigDescriptionValidator; +import org.openhab.core.config.core.validation.ConfigValidationException; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelGroupI18nUtil.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelGroupI18nUtil.java index d6afa170b..096c2abfc 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelGroupI18nUtil.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelGroupI18nUtil.java @@ -20,7 +20,6 @@ import java.util.function.Function; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.thing.i18n.ChannelGroupTypeI18nLocalizationService; -import org.openhab.core.thing.i18n.ThingTypeI18nLocalizationService; import org.openhab.core.thing.type.ChannelGroupDefinition; import org.openhab.core.thing.type.ChannelGroupType; import org.openhab.core.thing.type.ChannelGroupTypeRegistry; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelI18nUtil.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelI18nUtil.java index a63b8b480..605c096f2 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelI18nUtil.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/i18n/ChannelI18nUtil.java @@ -19,9 +19,7 @@ import java.util.function.Function; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.thing.i18n.ChannelGroupTypeI18nLocalizationService; import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; -import org.openhab.core.thing.i18n.ThingTypeI18nLocalizationService; import org.openhab.core.thing.type.ChannelDefinition; import org.openhab.core.thing.type.ChannelDefinitionBuilder; import org.openhab.core.thing.type.ChannelType; diff --git a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/i18n/ProfileI18nUtil.java b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/i18n/ProfileI18nUtil.java index ca773b884..f161a79f9 100644 --- a/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/i18n/ProfileI18nUtil.java +++ b/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/profiles/i18n/ProfileI18nUtil.java @@ -21,7 +21,6 @@ import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.thing.profiles.Profile; import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileTypeUID; -import org.openhab.core.thing.profiles.i18n.ProfileTypeI18nLocalizationService; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.thing/src/main/resources/ESH-INF/config/offsetProfile.xml b/bundles/org.openhab.core.thing/src/main/resources/ESH-INF/config/offsetProfile.xml index 615433738..a9c980c27 100644 --- a/bundles/org.openhab.core.thing/src/main/resources/ESH-INF/config/offsetProfile.xml +++ b/bundles/org.openhab.core.thing/src/main/resources/ESH-INF/config/offsetProfile.xml @@ -8,7 +8,8 @@ - Offset (plain number or number with unit) to be applied on the state towards the item. The negative offset will be applied in the reverse direction. + Offset (plain number or number with unit) to be applied on the state towards the item. The negative + offset will be applied in the reverse direction. diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/UIDTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/UIDTest.java index f39307f09..0e250c80e 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/UIDTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/UIDTest.java @@ -1,35 +1,35 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.thing; - -import org.junit.Test; - -/** - * @author Alex Tugarev - Initial contribution - */ -public class UIDTest { - - @Test(expected = IllegalArgumentException.class) - public void testInvalidCharacters() { - new ThingUID("binding:type:id_with_invalidchar#"); - } - - @Test - public void testValidUIDs() { - new ThingUID("binding:type:id-1"); - new ThingUID("binding:type:id_1"); - new ThingUID("binding:type:ID"); - new ThingUID("00:type:ID"); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.thing; + +import org.junit.Test; + +/** + * @author Alex Tugarev - Initial contribution + */ +public class UIDTest { + + @Test(expected = IllegalArgumentException.class) + public void testInvalidCharacters() { + new ThingUID("binding:type:id_with_invalidchar#"); + } + + @Test + public void testValidUIDs() { + new ThingUID("binding:type:id-1"); + new ThingUID("binding:type:id_1"); + new ThingUID("binding:type:ID"); + new ThingUID("00:type:ID"); + } + +} diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java index 3da23e77a..fe499a8cb 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ChannelBuilderTest.java @@ -12,14 +12,16 @@ */ package org.openhab.core.thing.binding.builder; -import static org.openhab.core.thing.DefaultSystemChannelTypeProvider.SYSTEM_OUTDOOR_TEMPERATURE; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.thing.DefaultSystemChannelTypeProvider.SYSTEM_OUTDOOR_TEMPERATURE; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ThingTypeUID; @@ -27,8 +29,6 @@ import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.type.ChannelKind; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; -import org.junit.Before; -import org.junit.Test; /** * Tests the {@link ChannelBuilder}. diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingBuilderTest.java index 70052d896..7e9364311 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingBuilderTest.java @@ -20,14 +20,14 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.internal.BridgeImpl; import org.openhab.core.thing.internal.ThingImpl; -import org.junit.Before; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingStatusInfoBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingStatusInfoBuilderTest.java index 9c77eb780..46556afc8 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingStatusInfoBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/binding/builder/ThingStatusInfoBuilderTest.java @@ -15,11 +15,11 @@ package org.openhab.core.thing.binding.builder; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.thing.ThingStatusInfo; -import org.junit.Before; -import org.junit.Test; /** * Tests the {@link ThingStatusInfoBuilder}. diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/firmware/FirmwareEventFactoryTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/firmware/FirmwareEventFactoryTest.java index 8d26949d0..c5f0599b5 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/firmware/FirmwareEventFactoryTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/firmware/FirmwareEventFactoryTest.java @@ -19,13 +19,13 @@ import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.Set; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; +import org.openhab.core.test.java.JavaTest; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.firmware.ProgressStep; -import org.openhab.core.test.java.JavaTest; -import org.junit.Before; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/AutoUpdateManagerTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/AutoUpdateManagerTest.java index 48eb0aa18..7807225d6 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/AutoUpdateManagerTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/AutoUpdateManagerTest.java @@ -23,6 +23,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; import org.openhab.core.events.Event; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.GenericItem; @@ -44,10 +48,6 @@ import org.openhab.core.thing.link.ItemChannelLink; import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.openhab.core.thing.type.AutoUpdatePolicy; import org.openhab.core.thing.type.ChannelTypeRegistry; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ChannelItemProviderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ChannelItemProviderTest.java index a556610dd..e26fb8da0 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ChannelItemProviderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ChannelItemProviderTest.java @@ -24,6 +24,9 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.items.Item; @@ -41,9 +44,6 @@ import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.link.ItemChannelLink; import org.openhab.core.thing.link.ItemChannelLinkRegistry; import org.openhab.core.thing.type.ChannelTypeRegistry; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * @author Simon Kaufmann - Initial contribution diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingImplTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingImplTest.java index 916eb7591..825ef9f25 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingImplTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingImplTest.java @@ -14,6 +14,7 @@ package org.openhab.core.thing.internal; import static org.junit.Assert.*; +import org.junit.Test; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; @@ -21,7 +22,6 @@ import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingManagerImplTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingManagerImplTest.java index 76691a880..b0eee445f 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingManagerImplTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/ThingManagerImplTest.java @@ -17,6 +17,9 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.service.ReadyService; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; @@ -24,9 +27,6 @@ import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.ThingHandlerFactory; import org.openhab.core.util.BundleResolver; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; import org.osgi.framework.Bundle; import org.osgi.service.component.ComponentContext; diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/firmware/ProgressCallbackTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/firmware/ProgressCallbackTest.java index 3290f53f9..0fd22428d 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/firmware/ProgressCallbackTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/firmware/ProgressCallbackTest.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Locale; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.TranslationProvider; @@ -38,8 +40,6 @@ import org.openhab.core.thing.firmware.FirmwareUpdateProgressInfoEvent; import org.openhab.core.thing.firmware.FirmwareUpdateResult; import org.openhab.core.thing.firmware.FirmwareUpdateResultInfoEvent; import org.openhab.core.util.BundleResolver; -import org.junit.Before; -import org.junit.Test; import org.osgi.framework.Bundle; /** diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonOnOffSwitchProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonOnOffSwitchProfileTest.java index ba40e44f1..7f8783153 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonOnOffSwitchProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonOnOffSwitchProfileTest.java @@ -15,14 +15,14 @@ package org.openhab.core.thing.internal.profiles; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.library.types.OnOffType; import org.openhab.core.thing.CommonTriggerEvents; import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.TriggerProfile; import org.openhab.core.types.Command; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * Tests for the system:rawbutton-on-off-switch profile diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonToggleSwitchProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonToggleSwitchProfileTest.java index 23f3419a6..8719ddd9d 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonToggleSwitchProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/RawButtonToggleSwitchProfileTest.java @@ -15,6 +15,9 @@ package org.openhab.core.thing.internal.profiles; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; @@ -24,9 +27,6 @@ import org.openhab.core.thing.profiles.TriggerProfile; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemDefaultProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemDefaultProfileTest.java index 14d7d9858..8266c4140 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemDefaultProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemDefaultProfileTest.java @@ -16,11 +16,11 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.thing.profiles.ProfileCallback; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.thing.profiles.ProfileCallback; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemFollowProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemFollowProfileTest.java index d7d2af1c7..3b2f4008f 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemFollowProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemFollowProfileTest.java @@ -16,11 +16,11 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.thing.profiles.ProfileCallback; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.thing.profiles.ProfileCallback; /** * diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemOffsetProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemOffsetProfileTest.java index 5014286b2..a99de9cf5 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemOffsetProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/SystemOffsetProfileTest.java @@ -20,6 +20,9 @@ import static org.mockito.Mockito.*; import javax.measure.Unit; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.openhab.core.config.core.Configuration; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.QuantityType; @@ -29,9 +32,6 @@ import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.ProfileContext; import org.openhab.core.types.Command; import org.openhab.core.types.State; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; /** * Tests for the system:offset profile diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/TimestampProfileTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/TimestampProfileTest.java index a5083c7b3..2b5c936b5 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/TimestampProfileTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/profiles/TimestampProfileTest.java @@ -18,13 +18,13 @@ import static org.mockito.Mockito.*; import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; -import org.openhab.core.library.types.DateTimeType; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.thing.profiles.ProfileCallback; -import org.openhab.core.types.State; -import org.openhab.core.test.java.JavaTest; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.openhab.core.library.types.DateTimeType; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.test.java.JavaTest; +import org.openhab.core.thing.profiles.ProfileCallback; +import org.openhab.core.types.State; /** * Tests for the system:timestamp-update profile diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ChannelTypeBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ChannelTypeBuilderTest.java index d65ed210b..eb251b022 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ChannelTypeBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ChannelTypeBuilderTest.java @@ -22,12 +22,12 @@ import java.net.URISyntaxException; import java.util.Arrays; import java.util.List; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.thing.CommonTriggerEvents; import org.openhab.core.types.EventDescription; import org.openhab.core.types.EventOption; import org.openhab.core.types.StateDescription; -import org.junit.Before; -import org.junit.Test; /** * Tests the {@link ChannelTypeBuilder}. diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ThingTypeBuilderTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ThingTypeBuilderTest.java index 57fc43448..46843f450 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ThingTypeBuilderTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/type/ThingTypeBuilderTest.java @@ -25,9 +25,9 @@ import java.util.List; import java.util.Map; import org.eclipse.jdt.annotation.NonNull; -import org.openhab.core.thing.ThingTypeUID; import org.junit.Before; import org.junit.Test; +import org.openhab.core.thing.ThingTypeUID; /** * Tests the {@link ThingTypeBuilder}. diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHandlerHelperTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHandlerHelperTest.java index 31b07f2e4..4ffeb6980 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHandlerHelperTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHandlerHelperTest.java @@ -12,24 +12,24 @@ */ package org.openhab.core.thing.util; -import static org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder.create; -import static org.openhab.core.thing.util.ThingHandlerHelper.isHandlerInitialized; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.when; +import static org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder.create; +import static org.openhab.core.thing.util.ThingHandlerHelper.isHandlerInitialized; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingStatus; -import org.openhab.core.thing.ThingTypeUID; -import org.openhab.core.thing.ThingUID; -import org.openhab.core.thing.binding.ThingHandler; -import org.openhab.core.thing.binding.builder.ThingBuilder; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.ThingUID; +import org.openhab.core.thing.binding.ThingHandler; +import org.openhab.core.thing.binding.builder.ThingBuilder; /** * Test for the ThingHandlerHelper diff --git a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHelperTest.java b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHelperTest.java index 7f1060bae..799ed7335 100644 --- a/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHelperTest.java +++ b/bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/util/ThingHelperTest.java @@ -1,143 +1,143 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.thing.util; - -import static java.util.Collections.singletonList; -import static java.util.stream.Collectors.toList; -import static org.junit.Assert.*; - -import java.util.stream.Stream; - -import org.openhab.core.config.core.Configuration; -import org.openhab.core.thing.ChannelUID; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingTypeUID; -import org.openhab.core.thing.ThingUID; -import org.openhab.core.thing.binding.builder.ChannelBuilder; -import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.openhab.core.thing.internal.ThingImpl; -import org.junit.Test; - -/** - * @author Alex Tugarev - Initial contribution - */ -public class ThingHelperTest { - - private static final ThingTypeUID THING_TYPE_UID = new ThingTypeUID("binding:type"); - private static final ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "thingId"); - - @Test - public void twoTechnicalEqualThingInstancesAreDetectedAsEqual() { - Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID) - .withChannels( - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build(), - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build()) - .withConfiguration(new Configuration()).build(); - - thingA.getConfiguration().put("prop1", "value1"); - thingA.getConfiguration().put("prop2", "value2"); - - assertTrue(ThingHelper.equals(thingA, thingA)); - - Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID) - .withChannels( - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build(), - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build()) - .withConfiguration(new Configuration()).build(); - thingB.getConfiguration().put("prop2", "value2"); - thingB.getConfiguration().put("prop1", "value1"); - - assertTrue(ThingHelper.equals(thingA, thingB)); - } - - @Test - public void twoThingsAreDifferentAfterPropertiesWereModified() { - Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID) - .withChannels( - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build(), - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build()) - .withConfiguration(new Configuration()).build(); - thingA.getConfiguration().put("prop1", "value1"); - - Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID) - .withChannels( - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build(), - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build()) - .withConfiguration(new Configuration()).build(); - thingB.getConfiguration().put("prop1", "value1"); - - assertTrue(ThingHelper.equals(thingA, thingB)); - - thingB.getConfiguration().put("prop3", "value3"); - - assertFalse(ThingHelper.equals(thingA, thingB)); - } - - @Test - public void twoThingsAreDifferentAfterChannelsWereModified() { - Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()).build(); - Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()).build(); - - assertTrue(ThingHelper.equals(thingA, thingB)); - - ((ThingImpl) thingB).setChannels(singletonList( - ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel3"), "itemType3").build())); - - assertFalse(ThingHelper.equals(thingA, thingB)); - } - - @Test - public void twoThingsAreDifferentAfterLabelWasModified() { - Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) - .withLabel("foo").build(); - Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) - .withLabel("foo").build(); - - assertTrue(ThingHelper.equals(thingA, thingB)); - - thingB.setLabel("bar"); - - assertFalse(ThingHelper.equals(thingA, thingB)); - } - - @Test - public void twoThingsAreDifferentAfterLocationWasModified() { - Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) - .withLocation("foo").build(); - Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) - .withLocation("foo").build(); - - assertTrue(ThingHelper.equals(thingA, thingB)); - - thingB.setLocation("bar"); - - assertFalse(ThingHelper.equals(thingA, thingB)); - } - - @Test(expected = IllegalArgumentException.class) - public void assertThatNoDuplicateChannelsCanBeAdded() { - ThingTypeUID thingTypeUID = new ThingTypeUID("test", "test"); - ThingUID thingUID = new ThingUID(thingTypeUID, "test"); - - Thing thing = ThingBuilder.create(thingTypeUID, thingUID) - .withChannels(ChannelBuilder.create(new ChannelUID(thingUID, "channel1"), "").build(), - ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build()) - .build(); - - ThingHelper - .addChannelsToThing(thing, - Stream.of(ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build(), - ChannelBuilder.create(new ChannelUID(thingUID, "channel3"), "").build()) - .collect(toList())); - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.thing.util; + +import static java.util.Collections.singletonList; +import static java.util.stream.Collectors.toList; +import static org.junit.Assert.*; + +import java.util.stream.Stream; + +import org.junit.Test; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.thing.ChannelUID; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.ThingUID; +import org.openhab.core.thing.binding.builder.ChannelBuilder; +import org.openhab.core.thing.binding.builder.ThingBuilder; +import org.openhab.core.thing.internal.ThingImpl; + +/** + * @author Alex Tugarev - Initial contribution + */ +public class ThingHelperTest { + + private static final ThingTypeUID THING_TYPE_UID = new ThingTypeUID("binding:type"); + private static final ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "thingId"); + + @Test + public void twoTechnicalEqualThingInstancesAreDetectedAsEqual() { + Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID) + .withChannels( + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build(), + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build()) + .withConfiguration(new Configuration()).build(); + + thingA.getConfiguration().put("prop1", "value1"); + thingA.getConfiguration().put("prop2", "value2"); + + assertTrue(ThingHelper.equals(thingA, thingA)); + + Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID) + .withChannels( + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build(), + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build()) + .withConfiguration(new Configuration()).build(); + thingB.getConfiguration().put("prop2", "value2"); + thingB.getConfiguration().put("prop1", "value1"); + + assertTrue(ThingHelper.equals(thingA, thingB)); + } + + @Test + public void twoThingsAreDifferentAfterPropertiesWereModified() { + Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID) + .withChannels( + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build(), + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build()) + .withConfiguration(new Configuration()).build(); + thingA.getConfiguration().put("prop1", "value1"); + + Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID) + .withChannels( + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel2"), "itemType").build(), + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel1"), "itemType").build()) + .withConfiguration(new Configuration()).build(); + thingB.getConfiguration().put("prop1", "value1"); + + assertTrue(ThingHelper.equals(thingA, thingB)); + + thingB.getConfiguration().put("prop3", "value3"); + + assertFalse(ThingHelper.equals(thingA, thingB)); + } + + @Test + public void twoThingsAreDifferentAfterChannelsWereModified() { + Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()).build(); + Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()).build(); + + assertTrue(ThingHelper.equals(thingA, thingB)); + + ((ThingImpl) thingB).setChannels(singletonList( + ChannelBuilder.create(new ChannelUID("binding:type:thingId:channel3"), "itemType3").build())); + + assertFalse(ThingHelper.equals(thingA, thingB)); + } + + @Test + public void twoThingsAreDifferentAfterLabelWasModified() { + Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) + .withLabel("foo").build(); + Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) + .withLabel("foo").build(); + + assertTrue(ThingHelper.equals(thingA, thingB)); + + thingB.setLabel("bar"); + + assertFalse(ThingHelper.equals(thingA, thingB)); + } + + @Test + public void twoThingsAreDifferentAfterLocationWasModified() { + Thing thingA = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) + .withLocation("foo").build(); + Thing thingB = ThingBuilder.create(THING_TYPE_UID, THING_UID).withConfiguration(new Configuration()) + .withLocation("foo").build(); + + assertTrue(ThingHelper.equals(thingA, thingB)); + + thingB.setLocation("bar"); + + assertFalse(ThingHelper.equals(thingA, thingB)); + } + + @Test(expected = IllegalArgumentException.class) + public void assertThatNoDuplicateChannelsCanBeAdded() { + ThingTypeUID thingTypeUID = new ThingTypeUID("test", "test"); + ThingUID thingUID = new ThingUID(thingTypeUID, "test"); + + Thing thing = ThingBuilder.create(thingTypeUID, thingUID) + .withChannels(ChannelBuilder.create(new ChannelUID(thingUID, "channel1"), "").build(), + ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build()) + .build(); + + ThingHelper + .addChannelsToThing(thing, + Stream.of(ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build(), + ChannelBuilder.create(new ChannelUID(thingUID, "channel3"), "").build()) + .collect(toList())); + } +} diff --git a/bundles/org.openhab.core.transform/pom.xml b/bundles/org.openhab.core.transform/pom.xml index 7f7512b8f..0704826b0 100644 --- a/bundles/org.openhab.core.transform/pom.xml +++ b/bundles/org.openhab.core.transform/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.transform/src/test/java/org/openhab/core/transform/actions/TransformationTest.java b/bundles/org.openhab.core.transform/src/test/java/org/openhab/core/transform/actions/TransformationTest.java index a76cf0969..c8e3fe83a 100644 --- a/bundles/org.openhab.core.transform/src/test/java/org/openhab/core/transform/actions/TransformationTest.java +++ b/bundles/org.openhab.core.transform/src/test/java/org/openhab/core/transform/actions/TransformationTest.java @@ -14,8 +14,8 @@ package org.openhab.core.transform.actions; import static org.junit.Assert.assertEquals; -import org.openhab.core.transform.TransformationException; import org.junit.Test; +import org.openhab.core.transform.TransformationException; /** * @author Stefan Triller - Initial contribution diff --git a/bundles/org.openhab.core.ui.icon/pom.xml b/bundles/org.openhab.core.ui.icon/pom.xml index d4ea8d4f5..015fb9237 100644 --- a/bundles/org.openhab.core.ui.icon/pom.xml +++ b/bundles/org.openhab.core.ui.icon/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/CustomIconProvider.java b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/CustomIconProvider.java index 0ce06d87c..dac9a23a2 100644 --- a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/CustomIconProvider.java +++ b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/CustomIconProvider.java @@ -32,7 +32,7 @@ import org.osgi.service.component.annotations.Component; * * @author Kai Kreuzer - Initial contribution */ -@Component(immediate = true, service = {IconProvider.class} ) +@Component(immediate = true, service = { IconProvider.class }) public class CustomIconProvider extends AbstractResourceIconProvider { private File getIconFile(String filename, String iconSetId) { diff --git a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java index b0829c7a9..7468efbf8 100644 --- a/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java +++ b/bundles/org.openhab.core.ui.icon/src/main/java/org/openhab/core/ui/icon/internal/IconSetResource.java @@ -47,7 +47,7 @@ public class IconSetResource implements RESTResource { private LocaleService localeService; - @Reference(cardinality=ReferenceCardinality.MULTIPLE, policy=ReferencePolicy.DYNAMIC) + @Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC) protected void addIconProvider(IconProvider iconProvider) { this.iconProviders.add(iconProvider); } @@ -60,7 +60,7 @@ public class IconSetResource implements RESTResource { protected void setLocaleService(LocaleService localeService) { this.localeService = localeService; } - + protected void unsetLocaleService(LocaleService localeService) { this.localeService = null; } diff --git a/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/AbstractResourceIconProviderTest.java b/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/AbstractResourceIconProviderTest.java index 40755bb1b..3945aecc0 100644 --- a/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/AbstractResourceIconProviderTest.java +++ b/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/AbstractResourceIconProviderTest.java @@ -24,9 +24,9 @@ import java.util.Set; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.openhab.core.ui.icon.IconSet.Format; import org.junit.Before; import org.junit.Test; +import org.openhab.core.ui.icon.IconSet.Format; /** * Tests for {@link AbstractResourceIconProvider}. diff --git a/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/internal/IconServletTest.java b/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/internal/IconServletTest.java index 6bfec98f4..c5313b6e7 100644 --- a/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/internal/IconServletTest.java +++ b/bundles/org.openhab.core.ui.icon/src/test/java/org/openhab/core/ui/icon/internal/IconServletTest.java @@ -12,10 +12,10 @@ */ package org.openhab.core.ui.icon.internal; -import static org.openhab.core.ui.icon.internal.IconServlet.*; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; +import static org.openhab.core.ui.icon.internal.IconServlet.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -27,14 +27,14 @@ import javax.servlet.WriteListener; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.openhab.core.ui.icon.IconProvider; -import org.openhab.core.ui.icon.IconSet.Format; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; +import org.openhab.core.ui.icon.IconProvider; +import org.openhab.core.ui.icon.IconSet.Format; /** * Tests for {@link IconServlet}. diff --git a/bundles/org.openhab.core.ui/pom.xml b/bundles/org.openhab.core.ui/pom.xml index 7fc7bb29f..4ab698091 100644 --- a/bundles/org.openhab.core.ui/pom.xml +++ b/bundles/org.openhab.core.ui/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/UIActivator.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/UIActivator.java index 2e7b2618d..d51fb628d 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/UIActivator.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/UIActivator.java @@ -1,47 +1,47 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.ui.internal; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; - -/** - * Extension of the default OSGi bundle activator - * - * @author Kai Kreuzer - Initial contribution - */ -public final class UIActivator implements BundleActivator { - - private static BundleContext context; - - /** - * Called whenever the OSGi framework starts our bundle - */ - @Override - public void start(BundleContext bc) throws Exception { - context = bc; - } - - /** - * Called whenever the OSGi framework stops our bundle - */ - @Override - public void stop(BundleContext bc) throws Exception { - context = null; - } - - public static BundleContext getContext() { - return context; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.ui.internal; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * Extension of the default OSGi bundle activator + * + * @author Kai Kreuzer - Initial contribution + */ +public final class UIActivator implements BundleActivator { + + private static BundleContext context; + + /** + * Called whenever the OSGi framework starts our bundle + */ + @Override + public void start(BundleContext bc) throws Exception { + context = bc; + } + + /** + * Called whenever the OSGi framework stops our bundle + */ + @Override + public void stop(BundleContext bc) throws Exception { + context = null; + } + + public static BundleContext getContext() { + return context; + } + +} diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/ChartServlet.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/ChartServlet.java index ea22cd18b..3a973ef5e 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/ChartServlet.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/ChartServlet.java @@ -37,8 +37,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.BooleanUtils; import org.openhab.core.config.core.ConfigurableService; -import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.io.http.servlet.SmartHomeServlet; +import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.ui.chart.ChartProvider; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; @@ -70,8 +70,7 @@ import org.osgi.service.http.HttpService; * @author Holger Reichert - Support for themes, DPI, legend hiding */ @Component(immediate = true, service = ChartServlet.class, configurationPid = "org.openhab.core.chart", property = { - Constants.SERVICE_PID + "=org.openhab.core.chart", - ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=system", + Constants.SERVICE_PID + "=org.openhab.core.chart", ConfigurableService.SERVICE_PROPERTY_CATEGORY + "=system", ConfigurableService.SERVICE_PROPERTY_LABEL + "=Charts", ConfigurableService.SERVICE_PROPERTY_DESCRIPTION_URI + "=" + "system:chart" }) public class ChartServlet extends SmartHomeServlet { diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java index 5f83d18a0..b3febf6a1 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/chart/defaultchartprovider/DefaultChartProvider.java @@ -28,6 +28,11 @@ import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.lang.StringUtils; +import org.knowm.xchart.Chart; +import org.knowm.xchart.ChartBuilder; +import org.knowm.xchart.Series; +import org.knowm.xchart.SeriesMarker; +import org.knowm.xchart.StyleManager.LegendPosition; import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; @@ -45,11 +50,6 @@ import org.openhab.core.types.State; import org.openhab.core.ui.chart.ChartProvider; import org.openhab.core.ui.internal.chart.ChartServlet; import org.openhab.core.ui.items.ItemUIRegistry; -import org.knowm.xchart.Chart; -import org.knowm.xchart.ChartBuilder; -import org.knowm.xchart.Series; -import org.knowm.xchart.SeriesMarker; -import org.knowm.xchart.StyleManager.LegendPosition; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java index 66bc2baef..1c2c34a04 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java @@ -64,16 +64,6 @@ import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.PlayPauseType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.StringType; -import org.openhab.core.transform.TransformationException; -import org.openhab.core.transform.TransformationHelper; -import org.openhab.core.transform.TransformationService; -import org.openhab.core.types.CommandDescription; -import org.openhab.core.types.State; -import org.openhab.core.types.StateDescription; -import org.openhab.core.types.StateOption; -import org.openhab.core.types.Type; -import org.openhab.core.types.UnDefType; -import org.openhab.core.types.util.UnitUtils; import org.openhab.core.model.sitemap.sitemap.ColorArray; import org.openhab.core.model.sitemap.sitemap.Default; import org.openhab.core.model.sitemap.sitemap.Group; @@ -85,6 +75,16 @@ import org.openhab.core.model.sitemap.sitemap.Slider; import org.openhab.core.model.sitemap.sitemap.Switch; import org.openhab.core.model.sitemap.sitemap.VisibilityRule; import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.transform.TransformationException; +import org.openhab.core.transform.TransformationHelper; +import org.openhab.core.transform.TransformationService; +import org.openhab.core.types.CommandDescription; +import org.openhab.core.types.State; +import org.openhab.core.types.StateDescription; +import org.openhab.core.types.StateOption; +import org.openhab.core.types.Type; +import org.openhab.core.types.UnDefType; +import org.openhab.core.types.util.UnitUtils; import org.openhab.core.ui.internal.UIActivator; import org.openhab.core.ui.items.ItemUIProvider; import org.openhab.core.ui.items.ItemUIRegistry; diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/proxy/ProxyServletService.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/proxy/ProxyServletService.java index 6f2a818a8..a1bda9a13 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/proxy/ProxyServletService.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/proxy/ProxyServletService.java @@ -32,12 +32,12 @@ import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.StringUtil; import org.openhab.core.library.types.StringType; -import org.openhab.core.types.State; import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.sitemap.sitemap.Image; import org.openhab.core.model.sitemap.sitemap.Sitemap; import org.openhab.core.model.sitemap.sitemap.Video; import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.types.State; import org.openhab.core.ui.items.ItemUIRegistry; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIProvider.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIProvider.java index 65d2ba9c6..9c41ab307 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIProvider.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIProvider.java @@ -1,70 +1,70 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.ui.items; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.items.Item; -import org.openhab.core.model.sitemap.sitemap.Widget; - -/** - * This interface describes the methods that need to be implemented by a provider that - * wants to define the appearance of an item in the UI. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface ItemUIProvider { - - /** - * Returns the category to use. - * - * @param itemName the name of the item to return the icon for - * @return the name of the category to use or null if undefined. - */ - public @Nullable String getCategory(String itemName); - - /** - * Returns the label text to be used for an item in the UI. - * - * @param item the name of the item to return the label text for - * @return the label text to be used in the UI or null if undefined. - */ - public @Nullable String getLabel(String itemName); - - /** - * Provides a default widget for a given item (class). This is used whenever - * the UI needs to be created dynamically and there is no other source - * of information about the widgets. - * - * @param itemType the class of the item or null, if unknown - * @param itemName the item name to get the default widget for - * @return a widget implementation that can be used for the given item or null, if no default is available for the - * type - */ - public @Nullable Widget getDefaultWidget(@Nullable Class itemType, String itemName); - - /** - *

- * Provides a widget for a given item. This can be used to overwrite the widget listed in the sitemap. A use case - * for this is that the sitemap defines merely the parent-child-relation of widgets, but the concrete widget to be - * used for rendering might be selected dynamically at runtime. - * - *

- * If the sitemap widget should not be overridden, this method must return null. - * - * @param itemName the item name to get the widget for - * @return a widget to use for the given item or null if sitemap should not be overridden. - */ - public @Nullable Widget getWidget(String itemName); -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.ui.items; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.items.Item; +import org.openhab.core.model.sitemap.sitemap.Widget; + +/** + * This interface describes the methods that need to be implemented by a provider that + * wants to define the appearance of an item in the UI. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface ItemUIProvider { + + /** + * Returns the category to use. + * + * @param itemName the name of the item to return the icon for + * @return the name of the category to use or null if undefined. + */ + public @Nullable String getCategory(String itemName); + + /** + * Returns the label text to be used for an item in the UI. + * + * @param item the name of the item to return the label text for + * @return the label text to be used in the UI or null if undefined. + */ + public @Nullable String getLabel(String itemName); + + /** + * Provides a default widget for a given item (class). This is used whenever + * the UI needs to be created dynamically and there is no other source + * of information about the widgets. + * + * @param itemType the class of the item or null, if unknown + * @param itemName the item name to get the default widget for + * @return a widget implementation that can be used for the given item or null, if no default is available for the + * type + */ + public @Nullable Widget getDefaultWidget(@Nullable Class itemType, String itemName); + + /** + *

+ * Provides a widget for a given item. This can be used to overwrite the widget listed in the sitemap. A use case + * for this is that the sitemap defines merely the parent-child-relation of widgets, but the concrete widget to be + * used for rendering might be selected dynamically at runtime. + * + *

+ * If the sitemap widget should not be overridden, this method must return null. + * + * @param itemName the item name to get the widget for + * @return a widget to use for the given item or null if sitemap should not be overridden. + */ + public @Nullable Widget getWidget(String itemName); +} diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIRegistry.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIRegistry.java index cb6594bc2..6b05daca2 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIRegistry.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/items/ItemUIRegistry.java @@ -21,10 +21,10 @@ import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.items.Item; import org.openhab.core.items.ItemRegistry; import org.openhab.core.library.types.QuantityType; -import org.openhab.core.types.State; import org.openhab.core.model.sitemap.sitemap.LinkableWidget; import org.openhab.core.model.sitemap.sitemap.Sitemap; import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.types.State; /** * This interface is used by a service which combines the core item registry diff --git a/bundles/org.openhab.core.ui/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.ui/src/main/resources/ESH-INF/config/config.xml index d0209c9c5..b9093814f 100644 --- a/bundles/org.openhab.core.ui/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.ui/src/main/resources/ESH-INF/config/config.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/items/ItemUIRegistryImplTest.java b/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/items/ItemUIRegistryImplTest.java index 8776a012b..9e6e18ce7 100644 --- a/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/items/ItemUIRegistryImplTest.java +++ b/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/items/ItemUIRegistryImplTest.java @@ -1,694 +1,694 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.ui.internal.items; - -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.text.DecimalFormatSymbols; -import java.util.ArrayList; -import java.util.List; -import java.util.TimeZone; - -import org.eclipse.emf.common.util.BasicEList; -import org.openhab.core.i18n.UnitProvider; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.library.items.ColorItem; -import org.openhab.core.library.types.DateTimeType; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.library.types.HSBType; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.PercentType; -import org.openhab.core.library.types.QuantityType; -import org.openhab.core.library.types.StringType; -import org.openhab.core.types.State; -import org.openhab.core.types.StateDescription; -import org.openhab.core.types.StateOption; -import org.openhab.core.types.UnDefType; -import org.openhab.core.types.util.UnitUtils; -import org.openhab.core.model.sitemap.sitemap.ColorArray; -import org.openhab.core.model.sitemap.sitemap.Mapping; -import org.openhab.core.model.sitemap.sitemap.Sitemap; -import org.openhab.core.model.sitemap.sitemap.SitemapFactory; -import org.openhab.core.model.sitemap.sitemap.Slider; -import org.openhab.core.model.sitemap.sitemap.Switch; -import org.openhab.core.model.sitemap.sitemap.Widget; -import org.openhab.core.ui.items.ItemUIProvider; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -/** - * @author Kai Kreuzer - Initial contribution - */ -public class ItemUIRegistryImplTest { - - // we need to get the decimal separator of the default locale for our tests - private static final char SEP = (new DecimalFormatSymbols().getDecimalSeparator()); - - private ItemUIRegistryImpl uiRegistry; - - @Mock - private ItemRegistry registry; - - @Mock - private Widget widget; - - @Mock - private Item item; - - @Mock - private UnitProvider unitProvider; - - @Before - public void setup() throws Exception { - initMocks(this); - uiRegistry = new ItemUIRegistryImpl(); - uiRegistry.setItemRegistry(registry); - - when(widget.getItem()).thenReturn("Item"); - when(registry.getItem("Item")).thenReturn(item); - - // Set default time zone to GMT-6 - TimeZone.setDefault(TimeZone.getTimeZone("GMT-6")); - } - - @Test - public void getLabelPlainLabel() { - String testLabel = "This is a plain text"; - - when(widget.getLabel()).thenReturn(testLabel); - String label = uiRegistry.getLabel(widget); - assertEquals(testLabel, label); - } - - @Test - public void getLabelLabelWithStaticValue() { - String testLabel = "Label [value]"; - - when(widget.getLabel()).thenReturn(testLabel); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [value]", label); - } - - @Test - public void getLabelLabelWithStringValue() { - String testLabel = "Label [%s]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [State]", label); - } - - @Test - public void getLabelLabelWithStringValueFunction() { - String testLabel = "Label [%s]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new StringType("foo(x):y")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [foo(x):y]", label); - } - - @Test - public void getLabelLabelWithIntegerValue() { - String testLabel = "Label [%d]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DecimalType(20)); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [20]", label); - } - - @Test - public void getLabelLabelWithIntegerValueAndWidth() { - String testLabel = "Label [%3d]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DecimalType(20)); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [ 20]", label); - } - - @Test - public void getLabelLabelWithHexValueAndWidth() { - String testLabel = "Label [%3x]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DecimalType(20)); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [ 14]", label); - } - - @Test - public void getLabelLabelWithDecimalValue() { - String testLabel = "Label [%.3f]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DecimalType(10f / 3f)); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(10f / 3f)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3" + SEP + "333]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit() { - String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " °C")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3" + SEP + "333 °C]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit2() { - String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " °C")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3 °C]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit3() { - String testLabel = "Label [%d %%]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3 %]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit4() { - String testLabel = "Label [%.0f %%]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3 %]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit5() { - String testLabel = "Label [%d " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("33 %")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [33 %]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit6() { - String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3 %]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnit7() { - String testLabel = "Label [%d %%]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("33 %")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [33 %]", label); - } - - @Test - public void getLabelLabelWithDecimalValueAndUnitConversion() { - String testLabel = "Label [%.2f °F]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new QuantityType<>("22 °C")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [71" + SEP + "60 °F]", label); - } - - @Test - public void getLabelLabelWithPercent() { - String testLabel = "Label [%.1f %%]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DecimalType(10f / 3f)); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(10f / 3f)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [3" + SEP + "3 %]", label); - } - - @Test - public void getLabelLabelWithPercentType() { - String testLabel = "Label [%d %%]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new PercentType(42)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [42 %]", label); - } - - @Test - public void getLabelLabelWithDate() { - String testLabel = "Label [%1$td.%1$tm.%1$tY]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [01.06.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00Z")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [31.05.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00+02")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [31.05.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-06")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [01.06.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-07")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [01.06.2011]", label); - } - - @Test - public void getLabelLabelWithZonedDate() throws ItemNotFoundException { - String testLabel = "Label [%1$td.%1$tm.%1$tY]"; - - Widget w = mock(Widget.class); - Item item = mock(Item.class); - when(w.getLabel()).thenReturn(testLabel); - when(w.getItem()).thenReturn("Item"); - when(registry.getItem("Item")).thenReturn(item); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00")); - String label = uiRegistry.getLabel(w); - assertEquals("Label [01.06.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00Z")); - label = uiRegistry.getLabel(w); - assertEquals("Label [31.05.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00+02")); - label = uiRegistry.getLabel(w); - assertEquals("Label [31.05.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-06")); - label = uiRegistry.getLabel(w); - assertEquals("Label [01.06.2011]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-07")); - label = uiRegistry.getLabel(w); - assertEquals("Label [01.06.2011]", label); - } - - @Test - public void getLabelLabelWithTime() { - String testLabel = "Label [%1$tT]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [15:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59Z")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [09:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59+02")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [07:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-06")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [15:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-07")); - label = uiRegistry.getLabel(widget); - assertEquals("Label [16:30:59]", label); - } - - @Test - public void getLabelLabelWithZonedTime() throws ItemNotFoundException { - String testLabel = "Label [%1$tT]"; - - Widget w = mock(Widget.class); - Item item = mock(Item.class); - when(w.getLabel()).thenReturn(testLabel); - when(w.getItem()).thenReturn("Item"); - when(registry.getItem("Item")).thenReturn(item); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59")); - String label = uiRegistry.getLabel(w); - assertEquals("Label [15:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59Z")); - label = uiRegistry.getLabel(w); - assertEquals("Label [09:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59+02")); - label = uiRegistry.getLabel(w); - assertEquals("Label [07:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-06")); - label = uiRegistry.getLabel(w); - assertEquals("Label [15:30:59]", label); - when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-07")); - label = uiRegistry.getLabel(w); - assertEquals("Label [16:30:59]", label); - } - - @Test - public void getLabelWidgetWithoutLabelAndItem() { - Widget w = mock(Widget.class); - String label = uiRegistry.getLabel(w); - assertEquals("", label); - } - - @Test - public void getLabelWidgetWithoutLabel() { - String label = uiRegistry.getLabel(widget); - assertEquals("Item", label); - } - - @Test - public void getLabelLabelFromUIProvider() { - ItemUIProvider provider = mock(ItemUIProvider.class); - uiRegistry.addItemUIProvider(provider); - when(provider.getLabel(anyString())).thenReturn("ProviderLabel"); - String label = uiRegistry.getLabel(widget); - assertEquals("ProviderLabel", label); - uiRegistry.removeItemUIProvider(provider); - } - - @Test - public void getLabelLabelForUndefinedStringItemState() { - String testLabel = "Label [%s]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(UnDefType.UNDEF); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [-]", label); - } - - @Test - public void getLabelLabelForUndefinedIntegerItemState() { - String testLabel = "Label [%d]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(UnDefType.UNDEF); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [-]", label); - } - - @Test - public void getLabelLabelForUndefinedDecimalItemState() { - String testLabel = "Label [%.2f]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(UnDefType.UNDEF); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [-]", label); - } - - @Test - public void getLabelLabelForUndefinedDateItemState() { - String testLabel = "Label [%1$td.%1$tm.%1$tY]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(UnDefType.UNDEF); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [-.-.-]", label); - } - - @Test - public void getLabelLabelForUndefinedQuantityItemState() { - String testLabel = "Label [%.2f " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(UnDefType.UNDEF); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [- -]", label); - } - - @Test - public void getLabelItemNotFound() throws ItemNotFoundException { - String testLabel = "Label [%s]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(widget.eClass()).thenReturn(SitemapFactory.eINSTANCE.createText().eClass()); - when(registry.getItem("Item")).thenThrow(new ItemNotFoundException("Item")); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [-]", label); - } - - @Test - public void getLabelLabelWithFunctionValue() { - String testLabel = "Label [MAP(de.map):%s]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [State]", label); - } - - @Test - public void getLabelGroupLabelWithValue() { - String testLabel = "Label [%d]"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getState()).thenReturn(OnOffType.ON); - when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(5)); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [5]", label); - } - - @Test - public void getWidgetUnknownPageId() throws ItemNotFoundException { - Sitemap sitemap = SitemapFactory.eINSTANCE.createSitemap(); - when(registry.getItem("unknown")).thenThrow(new ItemNotFoundException("unknown")); - Widget w = uiRegistry.getWidget(sitemap, "unknown"); - assertNull(w); - } - - @Test - public void testFormatDefault() { - assertEquals("Server [(-)]", uiRegistry.formatUndefined("Server [(%d)]")); - assertEquals("Anruf [von - an -]", uiRegistry.formatUndefined("Anruf [von %2$s an %1$s]")); - assertEquals("Zeit [-.-.- -]", uiRegistry.formatUndefined("Zeit [%1$td.%1$tm.%1$tY %1$tT]")); - assertEquals("Temperatur [- °C]", uiRegistry.formatUndefined("Temperatur [%.1f °C]")); - assertEquals("Luftfeuchte [- %]", uiRegistry.formatUndefined("Luftfeuchte [%.1f %%]")); - } - - @Test - public void testStateConversionForSwitchWidgetThroughGetState() throws ItemNotFoundException { - State colorState = new HSBType("23,42,50"); - - ColorItem colorItem = new ColorItem("myItem"); - colorItem.setLabel("myItem"); - colorItem.setState(colorState); - - when(registry.getItem("myItem")).thenReturn(colorItem); - - Switch switchWidget = mock(Switch.class); - when(switchWidget.getItem()).thenReturn("myItem"); - when(switchWidget.getMappings()).thenReturn(new BasicEList<>()); - - State stateForSwitch = uiRegistry.getState(switchWidget); - - assertEquals(OnOffType.ON, stateForSwitch); - } - - @Test - public void testStateConversionForSwitchWidgetWithMappingThroughGetState() throws ItemNotFoundException { - State colorState = new HSBType("23,42,50"); - - ColorItem colorItem = new ColorItem("myItem"); - colorItem.setLabel("myItem"); - colorItem.setState(colorState); - - when(registry.getItem("myItem")).thenReturn(colorItem); - - Switch switchWidget = mock(Switch.class); - when(switchWidget.getItem()).thenReturn("myItem"); - - Mapping mapping = mock(Mapping.class); - BasicEList mappings = new BasicEList<>(); - mappings.add(mapping); - when(switchWidget.getMappings()).thenReturn(mappings); - - State stateForSwitch = uiRegistry.getState(switchWidget); - - assertEquals(colorState, stateForSwitch); - } - - @Test - public void testStateConversionForSliderWidgetThroughGetState() throws ItemNotFoundException { - State colorState = new HSBType("23,42,75"); - - ColorItem colorItem = new ColorItem("myItem"); - colorItem.setLabel("myItem"); - colorItem.setState(colorState); - - when(registry.getItem("myItem")).thenReturn(colorItem); - - Slider sliderWidget = mock(Slider.class); - when(sliderWidget.getItem()).thenReturn("myItem"); - - State stateForSlider = uiRegistry.getState(sliderWidget); - - assertTrue(stateForSlider instanceof PercentType); - - PercentType pt = (PercentType) stateForSlider; - - assertEquals(75, pt.longValue()); - } - - @Test - public void getLabelLabelWithoutStateDescription() { - String testLabel = "Label"; - - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(null); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label", label); - } - - @Test - public void getLabelLabelWithoutPatternInStateDescription() { - String testLabel = "Label"; - - StateDescription stateDescription = mock(StateDescription.class); - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(stateDescription); - when(stateDescription.getPattern()).thenReturn(null); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label", label); - } - - @Test - public void getLabelLabelWithPatternInStateDescription() { - String testLabel = "Label"; - - StateDescription stateDescription = mock(StateDescription.class); - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(stateDescription); - when(stateDescription.getPattern()).thenReturn("%s"); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [State]", label); - } - - @Test - public void getLabelLabelWithEmptyPattern() { - String testLabel = "Label []"; - - StateDescription stateDescription = mock(StateDescription.class); - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(stateDescription); - when(stateDescription.getPattern()).thenReturn("%s"); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label", label); - } - - @Test - public void getLabelLabelWithMappedOption() { - String testLabel = "Label"; - - StateDescription stateDescription = mock(StateDescription.class); - List options = new ArrayList<>(); - options.add(new StateOption("State0", "This is the state 0")); - options.add(new StateOption("State1", "This is the state 1")); - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(stateDescription); - when(stateDescription.getPattern()).thenReturn("%s"); - when(stateDescription.getOptions()).thenReturn(options); - when(item.getState()).thenReturn(new StringType("State1")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [This is the state 1]", label); - } - - @Test - public void getLabelLabelWithUnmappedOption() { - String testLabel = "Label"; - - StateDescription stateDescription = mock(StateDescription.class); - List options = new ArrayList<>(); - options.add(new StateOption("State0", "This is the state 0")); - options.add(new StateOption("State1", "This is the state 1")); - when(widget.getLabel()).thenReturn(testLabel); - when(item.getStateDescription()).thenReturn(stateDescription); - when(stateDescription.getPattern()).thenReturn("%s"); - when(stateDescription.getOptions()).thenReturn(options); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(widget); - assertEquals("Label [State]", label); - } - - @Test - public void getLabelTransformationContainingPercentS() throws ItemNotFoundException { - // It doesn't matter that "FOO" doesn't exist - this is to assert it doesn't fail before because of the two "%s" - String testLabel = "Memory [FOO(echo %s):%s]"; - Widget w = mock(Widget.class); - Item item = mock(Item.class); - when(w.getLabel()).thenReturn(testLabel); - when(w.getItem()).thenReturn("Item"); - when(registry.getItem("Item")).thenReturn(item); - when(item.getState()).thenReturn(new StringType("State")); - String label = uiRegistry.getLabel(w); - assertEquals("Memory [State]", label); - } - - @Test - public void getLabelColorLabelWithDecimalValue() { - String testLabel = "Label [%.3f]"; - - when(widget.getLabel()).thenReturn(testLabel); - - ColorArray colorArray = mock(ColorArray.class); - when(colorArray.getState()).thenReturn("21"); - when(colorArray.getCondition()).thenReturn("<"); - when(colorArray.getArg()).thenReturn("yellow"); - BasicEList colorArrays = new BasicEList<>(); - colorArrays.add(colorArray); - when(widget.getLabelColor()).thenReturn(colorArrays); - - when(item.getState()).thenReturn(new DecimalType(10f / 3f)); - - String color = uiRegistry.getLabelColor(widget); - assertEquals("yellow", color); - } - - @Test - public void getLabelColorLabelWithUnitValue() { - String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; - - when(widget.getLabel()).thenReturn(testLabel); - - ColorArray colorArray = mock(ColorArray.class); - when(colorArray.getState()).thenReturn("20"); - when(colorArray.getCondition()).thenReturn("=="); - when(colorArray.getArg()).thenReturn("yellow"); - BasicEList colorArrays = new BasicEList<>(); - colorArrays.add(colorArray); - when(widget.getLabelColor()).thenReturn(colorArrays); - - when(item.getState()).thenReturn(new QuantityType<>("20 °C")); - - String color = uiRegistry.getLabelColor(widget); - assertEquals("yellow", color); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.ui.internal.items; + +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.initMocks; + +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.List; +import java.util.TimeZone; + +import org.eclipse.emf.common.util.BasicEList; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.openhab.core.i18n.UnitProvider; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.library.items.ColorItem; +import org.openhab.core.library.types.DateTimeType; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.library.types.HSBType; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.library.types.PercentType; +import org.openhab.core.library.types.QuantityType; +import org.openhab.core.library.types.StringType; +import org.openhab.core.model.sitemap.sitemap.ColorArray; +import org.openhab.core.model.sitemap.sitemap.Mapping; +import org.openhab.core.model.sitemap.sitemap.Sitemap; +import org.openhab.core.model.sitemap.sitemap.SitemapFactory; +import org.openhab.core.model.sitemap.sitemap.Slider; +import org.openhab.core.model.sitemap.sitemap.Switch; +import org.openhab.core.model.sitemap.sitemap.Widget; +import org.openhab.core.types.State; +import org.openhab.core.types.StateDescription; +import org.openhab.core.types.StateOption; +import org.openhab.core.types.UnDefType; +import org.openhab.core.types.util.UnitUtils; +import org.openhab.core.ui.items.ItemUIProvider; + +/** + * @author Kai Kreuzer - Initial contribution + */ +public class ItemUIRegistryImplTest { + + // we need to get the decimal separator of the default locale for our tests + private static final char SEP = (new DecimalFormatSymbols().getDecimalSeparator()); + + private ItemUIRegistryImpl uiRegistry; + + @Mock + private ItemRegistry registry; + + @Mock + private Widget widget; + + @Mock + private Item item; + + @Mock + private UnitProvider unitProvider; + + @Before + public void setup() throws Exception { + initMocks(this); + uiRegistry = new ItemUIRegistryImpl(); + uiRegistry.setItemRegistry(registry); + + when(widget.getItem()).thenReturn("Item"); + when(registry.getItem("Item")).thenReturn(item); + + // Set default time zone to GMT-6 + TimeZone.setDefault(TimeZone.getTimeZone("GMT-6")); + } + + @Test + public void getLabelPlainLabel() { + String testLabel = "This is a plain text"; + + when(widget.getLabel()).thenReturn(testLabel); + String label = uiRegistry.getLabel(widget); + assertEquals(testLabel, label); + } + + @Test + public void getLabelLabelWithStaticValue() { + String testLabel = "Label [value]"; + + when(widget.getLabel()).thenReturn(testLabel); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [value]", label); + } + + @Test + public void getLabelLabelWithStringValue() { + String testLabel = "Label [%s]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [State]", label); + } + + @Test + public void getLabelLabelWithStringValueFunction() { + String testLabel = "Label [%s]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new StringType("foo(x):y")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [foo(x):y]", label); + } + + @Test + public void getLabelLabelWithIntegerValue() { + String testLabel = "Label [%d]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DecimalType(20)); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [20]", label); + } + + @Test + public void getLabelLabelWithIntegerValueAndWidth() { + String testLabel = "Label [%3d]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DecimalType(20)); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [ 20]", label); + } + + @Test + public void getLabelLabelWithHexValueAndWidth() { + String testLabel = "Label [%3x]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DecimalType(20)); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(20)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [ 14]", label); + } + + @Test + public void getLabelLabelWithDecimalValue() { + String testLabel = "Label [%.3f]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DecimalType(10f / 3f)); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(10f / 3f)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3" + SEP + "333]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit() { + String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " °C")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3" + SEP + "333 °C]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit2() { + String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " °C")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3 °C]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit3() { + String testLabel = "Label [%d %%]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3 %]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit4() { + String testLabel = "Label [%.0f %%]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3 %]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit5() { + String testLabel = "Label [%d " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("33 %")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [33 %]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit6() { + String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("" + 10f / 3f + " %")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3 %]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnit7() { + String testLabel = "Label [%d %%]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("33 %")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [33 %]", label); + } + + @Test + public void getLabelLabelWithDecimalValueAndUnitConversion() { + String testLabel = "Label [%.2f °F]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new QuantityType<>("22 °C")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [71" + SEP + "60 °F]", label); + } + + @Test + public void getLabelLabelWithPercent() { + String testLabel = "Label [%.1f %%]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DecimalType(10f / 3f)); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(10f / 3f)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [3" + SEP + "3 %]", label); + } + + @Test + public void getLabelLabelWithPercentType() { + String testLabel = "Label [%d %%]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new PercentType(42)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [42 %]", label); + } + + @Test + public void getLabelLabelWithDate() { + String testLabel = "Label [%1$td.%1$tm.%1$tY]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [01.06.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00Z")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [31.05.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00+02")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [31.05.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-06")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [01.06.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-07")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [01.06.2011]", label); + } + + @Test + public void getLabelLabelWithZonedDate() throws ItemNotFoundException { + String testLabel = "Label [%1$td.%1$tm.%1$tY]"; + + Widget w = mock(Widget.class); + Item item = mock(Item.class); + when(w.getLabel()).thenReturn(testLabel); + when(w.getItem()).thenReturn("Item"); + when(registry.getItem("Item")).thenReturn(item); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00")); + String label = uiRegistry.getLabel(w); + assertEquals("Label [01.06.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00Z")); + label = uiRegistry.getLabel(w); + assertEquals("Label [31.05.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00+02")); + label = uiRegistry.getLabel(w); + assertEquals("Label [31.05.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-06")); + label = uiRegistry.getLabel(w); + assertEquals("Label [01.06.2011]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T00:00:00-07")); + label = uiRegistry.getLabel(w); + assertEquals("Label [01.06.2011]", label); + } + + @Test + public void getLabelLabelWithTime() { + String testLabel = "Label [%1$tT]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [15:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59Z")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [09:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59+02")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [07:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-06")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [15:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-07")); + label = uiRegistry.getLabel(widget); + assertEquals("Label [16:30:59]", label); + } + + @Test + public void getLabelLabelWithZonedTime() throws ItemNotFoundException { + String testLabel = "Label [%1$tT]"; + + Widget w = mock(Widget.class); + Item item = mock(Item.class); + when(w.getLabel()).thenReturn(testLabel); + when(w.getItem()).thenReturn("Item"); + when(registry.getItem("Item")).thenReturn(item); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59")); + String label = uiRegistry.getLabel(w); + assertEquals("Label [15:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59Z")); + label = uiRegistry.getLabel(w); + assertEquals("Label [09:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59+02")); + label = uiRegistry.getLabel(w); + assertEquals("Label [07:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-06")); + label = uiRegistry.getLabel(w); + assertEquals("Label [15:30:59]", label); + when(item.getState()).thenReturn(new DateTimeType("2011-06-01T15:30:59-07")); + label = uiRegistry.getLabel(w); + assertEquals("Label [16:30:59]", label); + } + + @Test + public void getLabelWidgetWithoutLabelAndItem() { + Widget w = mock(Widget.class); + String label = uiRegistry.getLabel(w); + assertEquals("", label); + } + + @Test + public void getLabelWidgetWithoutLabel() { + String label = uiRegistry.getLabel(widget); + assertEquals("Item", label); + } + + @Test + public void getLabelLabelFromUIProvider() { + ItemUIProvider provider = mock(ItemUIProvider.class); + uiRegistry.addItemUIProvider(provider); + when(provider.getLabel(anyString())).thenReturn("ProviderLabel"); + String label = uiRegistry.getLabel(widget); + assertEquals("ProviderLabel", label); + uiRegistry.removeItemUIProvider(provider); + } + + @Test + public void getLabelLabelForUndefinedStringItemState() { + String testLabel = "Label [%s]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(UnDefType.UNDEF); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [-]", label); + } + + @Test + public void getLabelLabelForUndefinedIntegerItemState() { + String testLabel = "Label [%d]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(UnDefType.UNDEF); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [-]", label); + } + + @Test + public void getLabelLabelForUndefinedDecimalItemState() { + String testLabel = "Label [%.2f]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(UnDefType.UNDEF); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [-]", label); + } + + @Test + public void getLabelLabelForUndefinedDateItemState() { + String testLabel = "Label [%1$td.%1$tm.%1$tY]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(UnDefType.UNDEF); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [-.-.-]", label); + } + + @Test + public void getLabelLabelForUndefinedQuantityItemState() { + String testLabel = "Label [%.2f " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(UnDefType.UNDEF); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [- -]", label); + } + + @Test + public void getLabelItemNotFound() throws ItemNotFoundException { + String testLabel = "Label [%s]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(widget.eClass()).thenReturn(SitemapFactory.eINSTANCE.createText().eClass()); + when(registry.getItem("Item")).thenThrow(new ItemNotFoundException("Item")); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [-]", label); + } + + @Test + public void getLabelLabelWithFunctionValue() { + String testLabel = "Label [MAP(de.map):%s]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [State]", label); + } + + @Test + public void getLabelGroupLabelWithValue() { + String testLabel = "Label [%d]"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getState()).thenReturn(OnOffType.ON); + when(item.getStateAs(DecimalType.class)).thenReturn(new DecimalType(5)); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [5]", label); + } + + @Test + public void getWidgetUnknownPageId() throws ItemNotFoundException { + Sitemap sitemap = SitemapFactory.eINSTANCE.createSitemap(); + when(registry.getItem("unknown")).thenThrow(new ItemNotFoundException("unknown")); + Widget w = uiRegistry.getWidget(sitemap, "unknown"); + assertNull(w); + } + + @Test + public void testFormatDefault() { + assertEquals("Server [(-)]", uiRegistry.formatUndefined("Server [(%d)]")); + assertEquals("Anruf [von - an -]", uiRegistry.formatUndefined("Anruf [von %2$s an %1$s]")); + assertEquals("Zeit [-.-.- -]", uiRegistry.formatUndefined("Zeit [%1$td.%1$tm.%1$tY %1$tT]")); + assertEquals("Temperatur [- °C]", uiRegistry.formatUndefined("Temperatur [%.1f °C]")); + assertEquals("Luftfeuchte [- %]", uiRegistry.formatUndefined("Luftfeuchte [%.1f %%]")); + } + + @Test + public void testStateConversionForSwitchWidgetThroughGetState() throws ItemNotFoundException { + State colorState = new HSBType("23,42,50"); + + ColorItem colorItem = new ColorItem("myItem"); + colorItem.setLabel("myItem"); + colorItem.setState(colorState); + + when(registry.getItem("myItem")).thenReturn(colorItem); + + Switch switchWidget = mock(Switch.class); + when(switchWidget.getItem()).thenReturn("myItem"); + when(switchWidget.getMappings()).thenReturn(new BasicEList<>()); + + State stateForSwitch = uiRegistry.getState(switchWidget); + + assertEquals(OnOffType.ON, stateForSwitch); + } + + @Test + public void testStateConversionForSwitchWidgetWithMappingThroughGetState() throws ItemNotFoundException { + State colorState = new HSBType("23,42,50"); + + ColorItem colorItem = new ColorItem("myItem"); + colorItem.setLabel("myItem"); + colorItem.setState(colorState); + + when(registry.getItem("myItem")).thenReturn(colorItem); + + Switch switchWidget = mock(Switch.class); + when(switchWidget.getItem()).thenReturn("myItem"); + + Mapping mapping = mock(Mapping.class); + BasicEList mappings = new BasicEList<>(); + mappings.add(mapping); + when(switchWidget.getMappings()).thenReturn(mappings); + + State stateForSwitch = uiRegistry.getState(switchWidget); + + assertEquals(colorState, stateForSwitch); + } + + @Test + public void testStateConversionForSliderWidgetThroughGetState() throws ItemNotFoundException { + State colorState = new HSBType("23,42,75"); + + ColorItem colorItem = new ColorItem("myItem"); + colorItem.setLabel("myItem"); + colorItem.setState(colorState); + + when(registry.getItem("myItem")).thenReturn(colorItem); + + Slider sliderWidget = mock(Slider.class); + when(sliderWidget.getItem()).thenReturn("myItem"); + + State stateForSlider = uiRegistry.getState(sliderWidget); + + assertTrue(stateForSlider instanceof PercentType); + + PercentType pt = (PercentType) stateForSlider; + + assertEquals(75, pt.longValue()); + } + + @Test + public void getLabelLabelWithoutStateDescription() { + String testLabel = "Label"; + + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(null); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label", label); + } + + @Test + public void getLabelLabelWithoutPatternInStateDescription() { + String testLabel = "Label"; + + StateDescription stateDescription = mock(StateDescription.class); + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(stateDescription); + when(stateDescription.getPattern()).thenReturn(null); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label", label); + } + + @Test + public void getLabelLabelWithPatternInStateDescription() { + String testLabel = "Label"; + + StateDescription stateDescription = mock(StateDescription.class); + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(stateDescription); + when(stateDescription.getPattern()).thenReturn("%s"); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [State]", label); + } + + @Test + public void getLabelLabelWithEmptyPattern() { + String testLabel = "Label []"; + + StateDescription stateDescription = mock(StateDescription.class); + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(stateDescription); + when(stateDescription.getPattern()).thenReturn("%s"); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label", label); + } + + @Test + public void getLabelLabelWithMappedOption() { + String testLabel = "Label"; + + StateDescription stateDescription = mock(StateDescription.class); + List options = new ArrayList<>(); + options.add(new StateOption("State0", "This is the state 0")); + options.add(new StateOption("State1", "This is the state 1")); + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(stateDescription); + when(stateDescription.getPattern()).thenReturn("%s"); + when(stateDescription.getOptions()).thenReturn(options); + when(item.getState()).thenReturn(new StringType("State1")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [This is the state 1]", label); + } + + @Test + public void getLabelLabelWithUnmappedOption() { + String testLabel = "Label"; + + StateDescription stateDescription = mock(StateDescription.class); + List options = new ArrayList<>(); + options.add(new StateOption("State0", "This is the state 0")); + options.add(new StateOption("State1", "This is the state 1")); + when(widget.getLabel()).thenReturn(testLabel); + when(item.getStateDescription()).thenReturn(stateDescription); + when(stateDescription.getPattern()).thenReturn("%s"); + when(stateDescription.getOptions()).thenReturn(options); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(widget); + assertEquals("Label [State]", label); + } + + @Test + public void getLabelTransformationContainingPercentS() throws ItemNotFoundException { + // It doesn't matter that "FOO" doesn't exist - this is to assert it doesn't fail before because of the two "%s" + String testLabel = "Memory [FOO(echo %s):%s]"; + Widget w = mock(Widget.class); + Item item = mock(Item.class); + when(w.getLabel()).thenReturn(testLabel); + when(w.getItem()).thenReturn("Item"); + when(registry.getItem("Item")).thenReturn(item); + when(item.getState()).thenReturn(new StringType("State")); + String label = uiRegistry.getLabel(w); + assertEquals("Memory [State]", label); + } + + @Test + public void getLabelColorLabelWithDecimalValue() { + String testLabel = "Label [%.3f]"; + + when(widget.getLabel()).thenReturn(testLabel); + + ColorArray colorArray = mock(ColorArray.class); + when(colorArray.getState()).thenReturn("21"); + when(colorArray.getCondition()).thenReturn("<"); + when(colorArray.getArg()).thenReturn("yellow"); + BasicEList colorArrays = new BasicEList<>(); + colorArrays.add(colorArray); + when(widget.getLabelColor()).thenReturn(colorArrays); + + when(item.getState()).thenReturn(new DecimalType(10f / 3f)); + + String color = uiRegistry.getLabelColor(widget); + assertEquals("yellow", color); + } + + @Test + public void getLabelColorLabelWithUnitValue() { + String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]"; + + when(widget.getLabel()).thenReturn(testLabel); + + ColorArray colorArray = mock(ColorArray.class); + when(colorArray.getState()).thenReturn("20"); + when(colorArray.getCondition()).thenReturn("=="); + when(colorArray.getArg()).thenReturn("yellow"); + BasicEList colorArrays = new BasicEList<>(); + colorArrays.add(colorArray); + when(widget.getLabelColor()).thenReturn(colorArrays); + + when(item.getState()).thenReturn(new QuantityType<>("20 °C")); + + String color = uiRegistry.getLabelColor(widget); + assertEquals("yellow", color); + } + +} diff --git a/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/proxy/ProxyServletServiceTest.java b/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/proxy/ProxyServletServiceTest.java index 88d662a8e..899df2ea2 100644 --- a/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/proxy/ProxyServletServiceTest.java +++ b/bundles/org.openhab.core.ui/src/test/java/org/openhab/core/ui/internal/proxy/ProxyServletServiceTest.java @@ -1,279 +1,279 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.ui.internal.proxy; - -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.*; - -import java.net.URI; -import java.net.URISyntaxException; - -import javax.servlet.http.HttpServletRequest; - -import org.eclipse.jetty.client.api.Request; -import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.util.B64Code; -import org.eclipse.jetty.util.StringUtil; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.StringType; -import org.openhab.core.types.UnDefType; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.sitemap.sitemap.Image; -import org.openhab.core.model.sitemap.sitemap.Sitemap; -import org.openhab.core.model.sitemap.sitemap.Switch; -import org.openhab.core.model.sitemap.sitemap.Video; -import org.openhab.core.ui.items.ItemUIRegistry; -import org.junit.Before; -import org.junit.Test; - -/** - * Unit tests for the {@link ProxyServletService} class. - * - * @author Kai Kreuzer - Initial contribution - */ -public class ProxyServletServiceTest { - - private static final String SITEMAP_NAME = "testSitemap"; - - private static final String SWITCH_WIDGET_ID = "switchWidget"; - private static final String IMAGE_WIDGET_ID = "imageWidget"; - private static final String VIDEO_WIDGET_ID = "videoWidget"; - - private static final String ITEM_NAME_UNDEF_STATE = "itemUNDEF"; - private static final String ITEM_NAME_NULL_STATE = "itemNULL"; - private static final String ITEM_NAME_ON_STATE = "itemON"; - private static final String ITEM_NAME_INVALID_URL = "itemInvalidUrl"; - private static final String ITEM_NAME_VALID_IMAGE_URL = "itemValidImageUrl"; - private static final String ITEM_NAME_VALID_VIDEO_URL = "itemValidVideoUrl"; - - private static final String INVALID_URL = "test"; - private static final String ITEM_VALID_IMAGE_URL = "https://openhab.org/item.jpg"; - private static final String ITEM_VALID_VIDEO_URL = "https://openhab.org/item.mp4"; - private static final String VALID_IMAGE_URL = "https://openhab.org/test.jpg"; - private static final String VALID_VIDEO_URL = "https://openhab.org/test.mp4"; - - private static ProxyServletService service; - - private ItemUIRegistry itemUIRegistry; - private ModelRepository modelRepository; - private Sitemap sitemap; - private HttpServletRequest request; - private Switch switchWidget; - private Image imageWidget; - private Video videoWidget; - - @Before - public void setUp() { - service = new ProxyServletService(); - - itemUIRegistry = mock(ItemUIRegistry.class); - modelRepository = mock(ModelRepository.class); - service.setModelRepository(modelRepository); - service.setItemUIRegistry(itemUIRegistry); - - sitemap = mock(Sitemap.class); - when(modelRepository.getModel(eq(SITEMAP_NAME))).thenReturn(sitemap); - - switchWidget = mock(Switch.class); - when(itemUIRegistry.getWidget(eq(sitemap), eq(SWITCH_WIDGET_ID))).thenReturn(switchWidget); - imageWidget = mock(Image.class); - when(itemUIRegistry.getWidget(eq(sitemap), eq(IMAGE_WIDGET_ID))).thenReturn(imageWidget); - videoWidget = mock(Video.class); - when(itemUIRegistry.getWidget(eq(sitemap), eq(VIDEO_WIDGET_ID))).thenReturn(videoWidget); - - when(itemUIRegistry.getItemState(eq(ITEM_NAME_UNDEF_STATE))).thenReturn(UnDefType.UNDEF); - when(itemUIRegistry.getItemState(eq(ITEM_NAME_NULL_STATE))).thenReturn(UnDefType.NULL); - when(itemUIRegistry.getItemState(eq(ITEM_NAME_ON_STATE))).thenReturn(OnOffType.ON); - when(itemUIRegistry.getItemState(eq(ITEM_NAME_INVALID_URL))).thenReturn(new StringType(INVALID_URL)); - when(itemUIRegistry.getItemState(eq(ITEM_NAME_VALID_IMAGE_URL))) - .thenReturn(new StringType(ITEM_VALID_IMAGE_URL)); - when(itemUIRegistry.getItemState(eq(ITEM_NAME_VALID_VIDEO_URL))) - .thenReturn(new StringType(ITEM_VALID_VIDEO_URL)); - - request = mock(HttpServletRequest.class); - when(request.getParameter(eq("sitemap"))).thenReturn(SITEMAP_NAME); - } - - @Test - public void testMaybeAppendAuthHeaderWithFullCredentials() throws URISyntaxException { - Request request = mock(Request.class); - URI uri = new URI("http://testuser:testpassword@127.0.0.1:8080/content"); - service.maybeAppendAuthHeader(uri, request); - verify(request).header(HttpHeader.AUTHORIZATION, - "Basic " + B64Code.encode("testuser:testpassword", StringUtil.__ISO_8859_1)); - } - - @Test - public void testMaybeAppendAuthHeaderWithoutPassword() throws URISyntaxException { - Request request = mock(Request.class); - URI uri = new URI("http://testuser@127.0.0.1:8080/content"); - service.maybeAppendAuthHeader(uri, request); - verify(request).header(HttpHeader.AUTHORIZATION, - "Basic " + B64Code.encode("testuser:", StringUtil.__ISO_8859_1)); - } - - @Test - public void testMaybeAppendAuthHeaderWithoutCredentials() throws URISyntaxException { - Request request = mock(Request.class); - URI uri = new URI("http://127.0.0.1:8080/content"); - service.maybeAppendAuthHeader(uri, request); - verify(request, never()).header(any(HttpHeader.class), anyString()); - } - - @Test - public void testProxyUriUnexpectedWidgetType() { - when(request.getParameter(eq("widgetId"))).thenReturn(SWITCH_WIDGET_ID); - URI uri = service.uriFromRequest(request); - assertNull(uri); - } - - @Test - public void testProxyUriImageWithoutItemButValidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(null); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_IMAGE_URL); - } - - @Test - public void testProxyUriImageWithoutItemAndInvalidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(INVALID_URL); - when(imageWidget.getItem()).thenReturn(null); - URI uri = service.uriFromRequest(request); - assertNull(uri); - } - - @Test - public void testProxyUriImageWithItemButUndefState() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(ITEM_NAME_UNDEF_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_IMAGE_URL); - } - - @Test - public void testProxyUriImageWithItemButNullState() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(ITEM_NAME_NULL_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_IMAGE_URL); - } - - @Test - public void testProxyUriImageWithItemButUnexpectedState() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(ITEM_NAME_ON_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_IMAGE_URL); - } - - @Test - public void testProxyUriImageWithItemButStateWithInvalidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(ITEM_NAME_INVALID_URL); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_IMAGE_URL); - } - - @Test - public void testProxyUriImageWithItemAndStateWithValidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); - when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); - when(imageWidget.getItem()).thenReturn(ITEM_NAME_VALID_IMAGE_URL); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), ITEM_VALID_IMAGE_URL); - } - - @Test - public void testProxyUriVideoWithoutItemButValidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(null); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_VIDEO_URL); - } - - @Test - public void testProxyUriVideoWithoutItemAndInvalidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(INVALID_URL); - when(videoWidget.getItem()).thenReturn(null); - URI uri = service.uriFromRequest(request); - assertNull(uri); - } - - @Test - public void testProxyUriVideoWithItemButUndefState() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(ITEM_NAME_UNDEF_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_VIDEO_URL); - } - - @Test - public void testProxyUriVideoWithItemButNullState() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(ITEM_NAME_NULL_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_VIDEO_URL); - } - - @Test - public void testProxyUriVideoWithItemButUnexpectedState() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(ITEM_NAME_ON_STATE); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_VIDEO_URL); - } - - @Test - public void testProxyUriVideoWithItemButStateWithInvalidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(ITEM_NAME_INVALID_URL); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), VALID_VIDEO_URL); - } - - @Test - public void testProxyUriVideoWithItemAndStateWithValidUrl() { - when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); - when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); - when(videoWidget.getItem()).thenReturn(ITEM_NAME_VALID_VIDEO_URL); - URI uri = service.uriFromRequest(request); - assertNotNull(uri); - assertEquals(uri.toString(), ITEM_VALID_VIDEO_URL); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.ui.internal.proxy; + +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; + +import java.net.URI; +import java.net.URISyntaxException; + +import javax.servlet.http.HttpServletRequest; + +import org.eclipse.jetty.client.api.Request; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.util.B64Code; +import org.eclipse.jetty.util.StringUtil; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.library.types.StringType; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.sitemap.sitemap.Image; +import org.openhab.core.model.sitemap.sitemap.Sitemap; +import org.openhab.core.model.sitemap.sitemap.Switch; +import org.openhab.core.model.sitemap.sitemap.Video; +import org.openhab.core.types.UnDefType; +import org.openhab.core.ui.items.ItemUIRegistry; + +/** + * Unit tests for the {@link ProxyServletService} class. + * + * @author Kai Kreuzer - Initial contribution + */ +public class ProxyServletServiceTest { + + private static final String SITEMAP_NAME = "testSitemap"; + + private static final String SWITCH_WIDGET_ID = "switchWidget"; + private static final String IMAGE_WIDGET_ID = "imageWidget"; + private static final String VIDEO_WIDGET_ID = "videoWidget"; + + private static final String ITEM_NAME_UNDEF_STATE = "itemUNDEF"; + private static final String ITEM_NAME_NULL_STATE = "itemNULL"; + private static final String ITEM_NAME_ON_STATE = "itemON"; + private static final String ITEM_NAME_INVALID_URL = "itemInvalidUrl"; + private static final String ITEM_NAME_VALID_IMAGE_URL = "itemValidImageUrl"; + private static final String ITEM_NAME_VALID_VIDEO_URL = "itemValidVideoUrl"; + + private static final String INVALID_URL = "test"; + private static final String ITEM_VALID_IMAGE_URL = "https://openhab.org/item.jpg"; + private static final String ITEM_VALID_VIDEO_URL = "https://openhab.org/item.mp4"; + private static final String VALID_IMAGE_URL = "https://openhab.org/test.jpg"; + private static final String VALID_VIDEO_URL = "https://openhab.org/test.mp4"; + + private static ProxyServletService service; + + private ItemUIRegistry itemUIRegistry; + private ModelRepository modelRepository; + private Sitemap sitemap; + private HttpServletRequest request; + private Switch switchWidget; + private Image imageWidget; + private Video videoWidget; + + @Before + public void setUp() { + service = new ProxyServletService(); + + itemUIRegistry = mock(ItemUIRegistry.class); + modelRepository = mock(ModelRepository.class); + service.setModelRepository(modelRepository); + service.setItemUIRegistry(itemUIRegistry); + + sitemap = mock(Sitemap.class); + when(modelRepository.getModel(eq(SITEMAP_NAME))).thenReturn(sitemap); + + switchWidget = mock(Switch.class); + when(itemUIRegistry.getWidget(eq(sitemap), eq(SWITCH_WIDGET_ID))).thenReturn(switchWidget); + imageWidget = mock(Image.class); + when(itemUIRegistry.getWidget(eq(sitemap), eq(IMAGE_WIDGET_ID))).thenReturn(imageWidget); + videoWidget = mock(Video.class); + when(itemUIRegistry.getWidget(eq(sitemap), eq(VIDEO_WIDGET_ID))).thenReturn(videoWidget); + + when(itemUIRegistry.getItemState(eq(ITEM_NAME_UNDEF_STATE))).thenReturn(UnDefType.UNDEF); + when(itemUIRegistry.getItemState(eq(ITEM_NAME_NULL_STATE))).thenReturn(UnDefType.NULL); + when(itemUIRegistry.getItemState(eq(ITEM_NAME_ON_STATE))).thenReturn(OnOffType.ON); + when(itemUIRegistry.getItemState(eq(ITEM_NAME_INVALID_URL))).thenReturn(new StringType(INVALID_URL)); + when(itemUIRegistry.getItemState(eq(ITEM_NAME_VALID_IMAGE_URL))) + .thenReturn(new StringType(ITEM_VALID_IMAGE_URL)); + when(itemUIRegistry.getItemState(eq(ITEM_NAME_VALID_VIDEO_URL))) + .thenReturn(new StringType(ITEM_VALID_VIDEO_URL)); + + request = mock(HttpServletRequest.class); + when(request.getParameter(eq("sitemap"))).thenReturn(SITEMAP_NAME); + } + + @Test + public void testMaybeAppendAuthHeaderWithFullCredentials() throws URISyntaxException { + Request request = mock(Request.class); + URI uri = new URI("http://testuser:testpassword@127.0.0.1:8080/content"); + service.maybeAppendAuthHeader(uri, request); + verify(request).header(HttpHeader.AUTHORIZATION, + "Basic " + B64Code.encode("testuser:testpassword", StringUtil.__ISO_8859_1)); + } + + @Test + public void testMaybeAppendAuthHeaderWithoutPassword() throws URISyntaxException { + Request request = mock(Request.class); + URI uri = new URI("http://testuser@127.0.0.1:8080/content"); + service.maybeAppendAuthHeader(uri, request); + verify(request).header(HttpHeader.AUTHORIZATION, + "Basic " + B64Code.encode("testuser:", StringUtil.__ISO_8859_1)); + } + + @Test + public void testMaybeAppendAuthHeaderWithoutCredentials() throws URISyntaxException { + Request request = mock(Request.class); + URI uri = new URI("http://127.0.0.1:8080/content"); + service.maybeAppendAuthHeader(uri, request); + verify(request, never()).header(any(HttpHeader.class), anyString()); + } + + @Test + public void testProxyUriUnexpectedWidgetType() { + when(request.getParameter(eq("widgetId"))).thenReturn(SWITCH_WIDGET_ID); + URI uri = service.uriFromRequest(request); + assertNull(uri); + } + + @Test + public void testProxyUriImageWithoutItemButValidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(null); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_IMAGE_URL); + } + + @Test + public void testProxyUriImageWithoutItemAndInvalidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(INVALID_URL); + when(imageWidget.getItem()).thenReturn(null); + URI uri = service.uriFromRequest(request); + assertNull(uri); + } + + @Test + public void testProxyUriImageWithItemButUndefState() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(ITEM_NAME_UNDEF_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_IMAGE_URL); + } + + @Test + public void testProxyUriImageWithItemButNullState() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(ITEM_NAME_NULL_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_IMAGE_URL); + } + + @Test + public void testProxyUriImageWithItemButUnexpectedState() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(ITEM_NAME_ON_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_IMAGE_URL); + } + + @Test + public void testProxyUriImageWithItemButStateWithInvalidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(ITEM_NAME_INVALID_URL); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_IMAGE_URL); + } + + @Test + public void testProxyUriImageWithItemAndStateWithValidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(IMAGE_WIDGET_ID); + when(imageWidget.getUrl()).thenReturn(VALID_IMAGE_URL); + when(imageWidget.getItem()).thenReturn(ITEM_NAME_VALID_IMAGE_URL); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), ITEM_VALID_IMAGE_URL); + } + + @Test + public void testProxyUriVideoWithoutItemButValidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(null); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_VIDEO_URL); + } + + @Test + public void testProxyUriVideoWithoutItemAndInvalidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(INVALID_URL); + when(videoWidget.getItem()).thenReturn(null); + URI uri = service.uriFromRequest(request); + assertNull(uri); + } + + @Test + public void testProxyUriVideoWithItemButUndefState() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(ITEM_NAME_UNDEF_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_VIDEO_URL); + } + + @Test + public void testProxyUriVideoWithItemButNullState() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(ITEM_NAME_NULL_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_VIDEO_URL); + } + + @Test + public void testProxyUriVideoWithItemButUnexpectedState() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(ITEM_NAME_ON_STATE); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_VIDEO_URL); + } + + @Test + public void testProxyUriVideoWithItemButStateWithInvalidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(ITEM_NAME_INVALID_URL); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), VALID_VIDEO_URL); + } + + @Test + public void testProxyUriVideoWithItemAndStateWithValidUrl() { + when(request.getParameter(eq("widgetId"))).thenReturn(VIDEO_WIDGET_ID); + when(videoWidget.getUrl()).thenReturn(VALID_VIDEO_URL); + when(videoWidget.getItem()).thenReturn(ITEM_NAME_VALID_VIDEO_URL); + URI uri = service.uriFromRequest(request); + assertNotNull(uri); + assertEquals(uri.toString(), ITEM_VALID_VIDEO_URL); + } + +} diff --git a/bundles/org.openhab.core.voice/pom.xml b/bundles/org.openhab.core.voice/pom.xml index 1055910f0..9bb4b83e9 100644 --- a/bundles/org.openhab.core.voice/pom.xml +++ b/bundles/org.openhab.core.voice/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSErrorEvent.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSErrorEvent.java index 26218d6c3..a1afce445 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSErrorEvent.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSErrorEvent.java @@ -18,25 +18,25 @@ package org.openhab.core.voice; * @author Kelly Davis - Initial contribution */ public class KSErrorEvent implements KSEvent { - /** - * The message describing the error - */ + /** + * The message describing the error + */ private final String message; - /** - * Constructs an instance with the passed {@code message}. - * - * @param message The message describing the error - */ + /** + * Constructs an instance with the passed {@code message}. + * + * @param message The message describing the error + */ public KSErrorEvent(String message) { this.message = message; } - /** - * Gets the message describing this error - * - * @return The message describing this error - */ + /** + * Gets the message describing this error + * + * @return The message describing this error + */ public String getMessage() { return this.message; } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSException.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSException.java index a3cd65e26..17b4f65c9 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSException.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSException.java @@ -21,37 +21,37 @@ public class KSException extends Exception { private static final long serialVersionUID = 1L; - /** - * Constructs a new exception with null as its detail message. - */ + /** + * Constructs a new exception with null as its detail message. + */ public KSException() { super(); } - /** - * Constructs a new exception with the specified detail message and cause. - * - * @param message Detail message - * @param cause The cause - */ + /** + * Constructs a new exception with the specified detail message and cause. + * + * @param message Detail message + * @param cause The cause + */ public KSException(String message, Throwable cause) { super(message, cause); } - /** - * Constructs a new exception with the specified detail message. - * - * @param message Detail message - */ + /** + * Constructs a new exception with the specified detail message. + * + * @param message Detail message + */ public KSException(String message) { super(message); } - /** - * Constructs a new exception with the specified cause. - * - * @param cause The cause - */ + /** + * Constructs a new exception with the specified cause. + * + * @param cause The cause + */ public KSException(Throwable cause) { super(cause); } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSServiceHandle.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSServiceHandle.java index 80f5dae0d..c2b317295 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSServiceHandle.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/KSServiceHandle.java @@ -18,8 +18,8 @@ package org.openhab.core.voice; * @author Kelly Davis - Initial contribution */ public interface KSServiceHandle { - /** - * Aborts keyword spotting in the associated {@link KSService} - */ + /** + * Aborts keyword spotting in the associated {@link KSService} + */ public void abort(); } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTException.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTException.java index 1392d5a95..80ee7078a 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTException.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTException.java @@ -21,37 +21,37 @@ public class STTException extends Exception { private static final long serialVersionUID = 1L; - /** - * Constructs a new exception with null as its detail message. - */ + /** + * Constructs a new exception with null as its detail message. + */ public STTException() { super(); } - /** - * Constructs a new exception with the specified detail message and cause. - * - * @param message Detail message - * @param cause The cause - */ + /** + * Constructs a new exception with the specified detail message and cause. + * + * @param message Detail message + * @param cause The cause + */ public STTException(String message, Throwable cause) { super(message, cause); } - /** - * Constructs a new exception with the specified detail message. - * - * @param message Detail message - */ + /** + * Constructs a new exception with the specified detail message. + * + * @param message Detail message + */ public STTException(String message) { super(message); } - /** - * Constructs a new exception with the specified cause. - * - * @param cause The cause - */ + /** + * Constructs a new exception with the specified cause. + * + * @param cause The cause + */ public STTException(Throwable cause) { super(cause); } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTServiceHandle.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTServiceHandle.java index c9a28b347..7de89c325 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTServiceHandle.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/STTServiceHandle.java @@ -18,8 +18,8 @@ package org.openhab.core.voice; * @author Kelly Davis - Initial contribution */ public interface STTServiceHandle { - /** - * Aborts recognition in the associated {@link STTService} - */ + /** + * Aborts recognition in the associated {@link STTService} + */ public void abort(); } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionErrorEvent.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionErrorEvent.java index 28d861fe6..e4b7db3ee 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionErrorEvent.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionErrorEvent.java @@ -18,25 +18,25 @@ package org.openhab.core.voice; * @author Kelly Davis - Initial contribution */ public class SpeechRecognitionErrorEvent implements STTEvent { - /** - * The message describing the error - */ + /** + * The message describing the error + */ private final String message; - /** - * Constructs an instance with the passed {@code message}. - * - * @param message The message describing the error - */ + /** + * Constructs an instance with the passed {@code message}. + * + * @param message The message describing the error + */ public SpeechRecognitionErrorEvent(String message) { this.message = message; } - /** - * Gets the message describing this error - * - * @return The message describing this error - */ + /** + * Gets the message describing this error + * + * @return The message describing this error + */ public String getMessage() { return this.message; } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionEvent.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionEvent.java index decc5035c..53bad3db5 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionEvent.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/SpeechRecognitionEvent.java @@ -17,27 +17,27 @@ package org.openhab.core.voice; * * @author Kelly Davis - Initial contribution */ -public class SpeechRecognitionEvent implements STTEvent { - /** - * Confidence of recognized speech - */ +public class SpeechRecognitionEvent implements STTEvent { + /** + * Confidence of recognized speech + */ private final float confidence; - /** - * Transcript of recognized speech - */ + /** + * Transcript of recognized speech + */ private final String transcript; - /** - * Constructs an instance with the passed {@code transcript} and {@code confidence}. - * - * The confidence represents a numeric estimate between 0 and 1, inclusively, of how - * confident the recognition engine is of the transcript. A higher number means the - * system is more confident. - * - * @param transcript The transcript of the recognized speech - * @param confidence The confidence of the transcript - */ + /** + * Constructs an instance with the passed {@code transcript} and {@code confidence}. + * + * The confidence represents a numeric estimate between 0 and 1, inclusively, of how + * confident the recognition engine is of the transcript. A higher number means the + * system is more confident. + * + * @param transcript The transcript of the recognized speech + * @param confidence The confidence of the transcript + */ public SpeechRecognitionEvent(String transcript, float confidence) { if ((null == transcript) || (transcript.isEmpty())) { throw new IllegalArgumentException("The passed transcript is null or empty"); @@ -50,24 +50,24 @@ public class SpeechRecognitionEvent implements STTEvent { this.confidence = confidence; } - /** - * Returns the transcript of the recognized speech. - * - * @return The transcript of the recognized speech. - */ + /** + * Returns the transcript of the recognized speech. + * + * @return The transcript of the recognized speech. + */ public String getTranscript() { return this.transcript; } - /** - * Returns the confidence of the transcript. - * - * The confidence represents a numeric estimate between 0 and 1, inclusively, of how - * confident the recognition engine is of the transcript. A higher number means the - * system is more confident. - * - * @return The transcript of the recognized speech. - */ + /** + * Returns the confidence of the transcript. + * + * The confidence represents a numeric estimate between 0 and 1, inclusively, of how + * confident the recognition engine is of the transcript. A higher number means the + * system is more confident. + * + * @return The transcript of the recognized speech. + */ public float getConfidence() { return this.confidence; } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSException.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSException.java index 7473a0edc..08e49ddba 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSException.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSException.java @@ -21,37 +21,37 @@ public class TTSException extends Exception { private static final long serialVersionUID = 1L; - /** - * Constructs a new exception with null as its detail message. - */ + /** + * Constructs a new exception with null as its detail message. + */ public TTSException() { super(); } - /** - * Constructs a new exception with the specified detail message and cause. - * - * @param message Detail message - * @param cause The cause - */ + /** + * Constructs a new exception with the specified detail message and cause. + * + * @param message Detail message + * @param cause The cause + */ public TTSException(String message, Throwable cause) { super(message, cause); } - /** - * Constructs a new exception with the specified detail message. - * - * @param message Detail message - */ + /** + * Constructs a new exception with the specified detail message. + * + * @param message Detail message + */ public TTSException(String message) { super(message); } - /** - * Constructs a new exception with the specified cause. - * - * @param cause The cause - */ + /** + * Constructs a new exception with the specified cause. + * + * @param cause The cause + */ public TTSException(Throwable cause) { super(cause); } diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSService.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSService.java index d4bead225..e286329c9 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSService.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/TTSService.java @@ -1,72 +1,72 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.voice; - -import java.util.Locale; -import java.util.Set; - -import org.openhab.core.audio.AudioFormat; -import org.openhab.core.audio.AudioStream; - -/** - * This is the interface that a text-to-speech service has to implement. - * - * @author Kelly Davis - Initial contribution - * @author Kai Kreuzer - Refactored to use AudioStreams - */ -public interface TTSService { - - /** - * Returns a simple string that uniquely identifies this service - * - * @return an id that identifies this service - */ - public String getId(); - - /** - * Returns a localized human readable label that can be used within UIs. - * - * @param locale the locale to provide the label for - * @return a localized string to be used in UIs - */ - public String getLabel(Locale locale); - - /** - * Obtain the voices available from this TTSService - * - * @return The voices available from this service - */ - public Set getAvailableVoices(); - - /** - * Obtain the audio formats supported by this TTSService - * - * @return The audio formats supported by this service - */ - public Set getSupportedFormats(); - - /** - * Returns an {@link AudioStream} containing the TTS results. Note, one - * can only request a supported {@code Voice} and {@link AudioStream} or - * an exception is thrown. - * - * @param text The text to convert to speech - * @param voice The voice to use for speech - * @param requestedFormat The audio format to return the results in - * @return AudioStream containing the TTS results - * @throws TTSException If {@code voice} and/or {@code requestedFormat} - * are not supported or another error occurs while creating an - * {@link AudioStream} - */ - public AudioStream synthesize(String text, Voice voice, AudioFormat requestedFormat) throws TTSException; -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.voice; + +import java.util.Locale; +import java.util.Set; + +import org.openhab.core.audio.AudioFormat; +import org.openhab.core.audio.AudioStream; + +/** + * This is the interface that a text-to-speech service has to implement. + * + * @author Kelly Davis - Initial contribution + * @author Kai Kreuzer - Refactored to use AudioStreams + */ +public interface TTSService { + + /** + * Returns a simple string that uniquely identifies this service + * + * @return an id that identifies this service + */ + public String getId(); + + /** + * Returns a localized human readable label that can be used within UIs. + * + * @param locale the locale to provide the label for + * @return a localized string to be used in UIs + */ + public String getLabel(Locale locale); + + /** + * Obtain the voices available from this TTSService + * + * @return The voices available from this service + */ + public Set getAvailableVoices(); + + /** + * Obtain the audio formats supported by this TTSService + * + * @return The audio formats supported by this service + */ + public Set getSupportedFormats(); + + /** + * Returns an {@link AudioStream} containing the TTS results. Note, one + * can only request a supported {@code Voice} and {@link AudioStream} or + * an exception is thrown. + * + * @param text The text to convert to speech + * @param voice The voice to use for speech + * @param requestedFormat The audio format to return the results in + * @return AudioStream containing the TTS results + * @throws TTSException If {@code voice} and/or {@code requestedFormat} + * are not supported or another error occurs while creating an + * {@link AudioStream} + */ + public AudioStream synthesize(String text, Voice voice, AudioFormat requestedFormat) throws TTSException; +} diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceConsoleCommandExtension.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceConsoleCommandExtension.java index 7b7012732..256ba2e50 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceConsoleCommandExtension.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceConsoleCommandExtension.java @@ -19,6 +19,9 @@ import java.util.Locale; import org.apache.commons.lang.ArrayUtils; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.i18n.LocaleProvider; +import org.openhab.core.io.console.Console; +import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemNotUniqueException; @@ -27,9 +30,6 @@ import org.openhab.core.voice.TTSService; import org.openhab.core.voice.Voice; import org.openhab.core.voice.VoiceManager; import org.openhab.core.voice.text.InterpretationException; -import org.openhab.core.io.console.Console; -import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java index 17f1b6252..15f6d9b1f 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/internal/VoiceManagerImpl.java @@ -30,9 +30,6 @@ import java.util.Objects; import java.util.Set; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigOptionProvider; -import org.openhab.core.config.core.ConfigurableService; -import org.openhab.core.config.core.ParameterOption; import org.openhab.core.audio.AudioFormat; import org.openhab.core.audio.AudioManager; import org.openhab.core.audio.AudioSink; @@ -40,6 +37,9 @@ import org.openhab.core.audio.AudioSource; import org.openhab.core.audio.AudioStream; import org.openhab.core.audio.UnsupportedAudioFormatException; import org.openhab.core.audio.UnsupportedAudioStreamException; +import org.openhab.core.config.core.ConfigOptionProvider; +import org.openhab.core.config.core.ConfigurableService; +import org.openhab.core.config.core.ParameterOption; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.library.types.PercentType; diff --git a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/text/ASTNode.java b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/text/ASTNode.java index 20dd2fba0..e5254fc13 100644 --- a/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/text/ASTNode.java +++ b/bundles/org.openhab.core.voice/src/main/java/org/openhab/core/voice/text/ASTNode.java @@ -66,9 +66,7 @@ public class ASTNode { * @return the value of this node as {@link String[]} */ public String[] getValueAsStringArray() { - Object[] objs = value instanceof Object[] ? (Object[]) value : new Object[] { - value - }; + Object[] objs = value instanceof Object[] ? (Object[]) value : new Object[] { value }; String[] result = new String[objs.length]; for (int i = 0; i < objs.length; i++) { result[i] = objs[i] == null ? "" : ("" + objs[i]); diff --git a/bundles/org.openhab.core.voice/src/main/resources/ESH-INF/config/config.xml b/bundles/org.openhab.core.voice/src/main/resources/ESH-INF/config/config.xml index bc0418bfc..abc010874 100644 --- a/bundles/org.openhab.core.voice/src/main/resources/ESH-INF/config/config.xml +++ b/bundles/org.openhab.core.voice/src/main/resources/ESH-INF/config/config.xml @@ -31,9 +31,12 @@ item - Switch + + Switch + - If provided, the item will be switched on during the period when the dialog processor has spotted the keyword and is listening for commands. + If provided, the item will be switched on during the period when the dialog processor has spotted the + keyword and is listening for commands. diff --git a/bundles/org.openhab.core/pom.xml b/bundles/org.openhab.core/pom.xml index d8edaa54c..9c53c10dc 100644 --- a/bundles/org.openhab.core/pom.xml +++ b/bundles/org.openhab.core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/Event.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/Event.java index dac6abfd0..bff3cc2bc 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/Event.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/Event.java @@ -1,56 +1,56 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.events; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * {@link Event} objects are delivered by the {@link EventPublisher} through the openHAB event bus. - * The callback interface {@link EventSubscriber} can be implemented in order to receive such events. - * - * @author Stefan Bußweiler - Initial contribution - */ -@NonNullByDefault -public interface Event { - - /** - * Gets the event type. - * - * @return the event type - */ - String getType(); - - /** - * Gets the topic of an event. - * - * @return the event topic - */ - String getTopic(); - - /** - * Gets the payload as a serialized string. - * - * @return the serialized event - */ - String getPayload(); - - /** - * Gets the name of the source identifying the sender. - * - * @return the name of the source - */ - @Nullable - String getSource(); - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.events; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * {@link Event} objects are delivered by the {@link EventPublisher} through the openHAB event bus. + * The callback interface {@link EventSubscriber} can be implemented in order to receive such events. + * + * @author Stefan Bußweiler - Initial contribution + */ +@NonNullByDefault +public interface Event { + + /** + * Gets the event type. + * + * @return the event type + */ + String getType(); + + /** + * Gets the topic of an event. + * + * @return the event topic + */ + String getTopic(); + + /** + * Gets the payload as a serialized string. + * + * @return the serialized event + */ + String getPayload(); + + /** + * Gets the name of the source identifying the sender. + * + * @return the name of the source + */ + @Nullable + String getSource(); + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/EventFilter.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/EventFilter.java index 110fbb178..237b048c6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/EventFilter.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/EventFilter.java @@ -1,37 +1,37 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.events; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * An {@link EventFilter} can be provided by an {@link EventSubscriber} in order - * to receive specific {@link Event}s by an {@link EventPublisher} if the filter applies. - * - * @author Stefan Bußweiler - Initial contribution - */ -@NonNullByDefault -public interface EventFilter { - - /** - * Apply the filter on an event. - *

- * This method is called for each subscribed {@link Event} of an - * {@link EventSubscriber}. If the filter applies, the event will be dispatched to the - * {@link EventSubscriber#receive(Event)} method. - * - * @param event the event (not null) - * @return true if the filter criterion applies - */ - boolean apply(Event event); -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.events; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * An {@link EventFilter} can be provided by an {@link EventSubscriber} in order + * to receive specific {@link Event}s by an {@link EventPublisher} if the filter applies. + * + * @author Stefan Bußweiler - Initial contribution + */ +@NonNullByDefault +public interface EventFilter { + + /** + * Apply the filter on an event. + *

+ * This method is called for each subscribed {@link Event} of an + * {@link EventSubscriber}. If the filter applies, the event will be dispatched to the + * {@link EventSubscriber#receive(Event)} method. + * + * @param event the event (not null) + * @return true if the filter criterion applies + */ + boolean apply(Event event); +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/TopicEventFilter.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/TopicEventFilter.java index 99c0de920..201abd24f 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/events/TopicEventFilter.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/events/TopicEventFilter.java @@ -21,7 +21,7 @@ package org.openhab.core.events; public class TopicEventFilter implements EventFilter { private final String topicRegex; - + /** * Constructs a new topic event filter. * @@ -31,7 +31,7 @@ public class TopicEventFilter implements EventFilter { public TopicEventFilter(String topicRegex) { this.topicRegex = topicRegex; } - + @Override public boolean apply(Event event) { return event.getTopic().matches(topicRegex); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupFunction.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupFunction.java index 663c1fc0b..b5f4d3785 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupFunction.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupFunction.java @@ -1,97 +1,97 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items; - -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * Group functions are used by active group items to calculate a state for the group - * out of the states of all its member items. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface GroupFunction { - - /** - * Determines the current state of a group based on a list of items - * - * @param items the items to calculate a group state for - * @return the calculated group state - */ - State calculate(@Nullable Set items); - - /** - * Calculates the group state and returns it as a state of the requested type. - * - * @param items the items to calculate a group state for - * @param stateClass the type in which the state should be returned - * @return the calculated group state of the requested type or null, if type is not supported - */ - @Nullable - T getStateAs(@Nullable Set items, Class stateClass); - - /** - * Returns the parameters of the function as an array. - * - * @return the parameters of this function - */ - State[] getParameters(); - - /** - * This is the default group function that does nothing else than to check if all member items - * have the same state. If this is the case, this state is returned, otherwise UNDEF is returned. - * - * @author Kai Kreuzer - Initial contribution - */ - static class Equality implements GroupFunction { - - @Override - public State calculate(@Nullable Set items) { - if (items == null || items.isEmpty()) { - return UnDefType.UNDEF; - } else { - Iterator it = items.iterator(); - State state = it.next().getState(); - while (it.hasNext()) { - if (!state.equals(it.next().getState())) { - return UnDefType.UNDEF; - } - } - return state; - } - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[0]; - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items; + +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * Group functions are used by active group items to calculate a state for the group + * out of the states of all its member items. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface GroupFunction { + + /** + * Determines the current state of a group based on a list of items + * + * @param items the items to calculate a group state for + * @return the calculated group state + */ + State calculate(@Nullable Set items); + + /** + * Calculates the group state and returns it as a state of the requested type. + * + * @param items the items to calculate a group state for + * @param stateClass the type in which the state should be returned + * @return the calculated group state of the requested type or null, if type is not supported + */ + @Nullable + T getStateAs(@Nullable Set items, Class stateClass); + + /** + * Returns the parameters of the function as an array. + * + * @return the parameters of this function + */ + State[] getParameters(); + + /** + * This is the default group function that does nothing else than to check if all member items + * have the same state. If this is the case, this state is returned, otherwise UNDEF is returned. + * + * @author Kai Kreuzer - Initial contribution + */ + static class Equality implements GroupFunction { + + @Override + public State calculate(@Nullable Set items) { + if (items == null || items.isEmpty()) { + return UnDefType.UNDEF; + } else { + Iterator it = items.iterator(); + State state = it.next().getState(); + while (it.hasNext()) { + if (!state.equals(it.next().getState())) { + return UnDefType.UNDEF; + } + } + return state; + } + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[0]; + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupItem.java index 2b547a0a9..430bcdc3a 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/GroupItem.java @@ -1,430 +1,430 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.i18n.UnitProvider; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.types.Command; -import org.openhab.core.types.State; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class GroupItem extends GenericItem implements StateChangeListener { - - public static final String TYPE = "Group"; - - private final Logger logger = LoggerFactory.getLogger(GroupItem.class); - - protected @Nullable final Item baseItem; - - protected final CopyOnWriteArrayList members; - - protected @Nullable GroupFunction function; - - /** - * Creates a plain GroupItem - * - * @param name name of the group - */ - public GroupItem(String name) { - this(name, null, null); - } - - public GroupItem(String name, @Nullable Item baseItem) { - // only baseItem but no function set -> use Equality - this(name, baseItem, new GroupFunction.Equality()); - } - - /** - * Creates a GroupItem with function - * - * @param name name of the group - * @param baseItem type of items in the group - * @param function function to calculate group status out of member status - */ - public GroupItem(String name, @Nullable Item baseItem, @Nullable GroupFunction function) { - super(TYPE, name); - - // we only allow GroupItem with BOTH, baseItem AND function set, or NONE of them set - if (baseItem == null || function == null) { - this.baseItem = null; - this.function = null; - } else { - this.function = function; - this.baseItem = baseItem; - } - - members = new CopyOnWriteArrayList<>(); - } - - @Override - public void dispose() { - super.dispose(); - for (Item member : getMembers()) { - unregisterStateListener(member); - } - members.clear(); - } - - /** - * Returns the base item of this {@link GroupItem}. This method is only - * intended to allow instance checks of the underlying BaseItem. It must - * not be changed in any way. - * - * @return the base item of this GroupItem - */ - public @Nullable Item getBaseItem() { - return baseItem; - } - - /** - * Returns the function of this {@link GroupItem}. - * - * @return the function of this GroupItem - */ - public @Nullable GroupFunction getFunction() { - return function; - } - - /** - * Returns the direct members of this {@link GroupItem} regardless if these - * members are {@link GroupItem}s as well. - * - * @return the direct members of this {@link GroupItem} - */ - public Set getMembers() { - return Collections.unmodifiableSet(new LinkedHashSet<>(members)); - } - - /** - * Returns the direct members of this {@link GroupItem} and recursively all - * members of the potentially contained {@link GroupItem}s as well. The {@link GroupItem}s itself aren't contained. - * The returned items are unique. - * - * @return all members of this and all contained {@link GroupItem}s - */ - public Set getAllMembers() { - return Collections.unmodifiableSet(new LinkedHashSet<>(getMembers((Item i) -> !(i instanceof GroupItem)))); - } - - private void collectMembers(Collection allMembers, Collection members) { - for (Item member : members) { - if (allMembers.contains(member)) { - continue; - } - allMembers.add(member); - if (member instanceof GroupItem) { - collectMembers(allMembers, ((GroupItem) member).members); - } - } - } - - /** - * Retrieves ALL members of this group and filters it with the given Predicate - * - * @param filterItem Predicate with settings to filter member list - * @return Set of member items filtered by filterItem - */ - public Set getMembers(Predicate filterItem) { - Set allMembers = new LinkedHashSet<>(); - collectMembers(allMembers, members); - return allMembers.stream().filter(filterItem).collect(Collectors.toSet()); - } - - /** - * Adds the given item to the members of this group item. - * - * @param item the item to be added (must not be null) - * @throws IllegalArgumentException if the given item is null - */ - public void addMember(Item item) { - if (item == null) { - throw new IllegalArgumentException("Item must not be null!"); - } - - boolean added = members.addIfAbsent(item); - - // in case membership is constructed programmatically this sanitizes - // the group names on the item: - if (added && item instanceof GenericItem) { - ((GenericItem) item).addGroupName(getName()); - } - registerStateListener(item); - } - - private void registerStateListener(Item item) { - if (item instanceof GenericItem) { - GenericItem genericItem = (GenericItem) item; - genericItem.addStateChangeListener(this); - } - } - - private void unregisterStateListener(Item old) { - if (old instanceof GenericItem) { - GenericItem genericItem = (GenericItem) old; - genericItem.removeStateChangeListener(this); - } - } - - public void replaceMember(Item oldItem, Item newItem) { - if (oldItem == null || newItem == null) { - throw new IllegalArgumentException("Items must not be null!"); - } - int index = members.indexOf(oldItem); - if (index > -1) { - Item old = members.set(index, newItem); - unregisterStateListener(old); - } - registerStateListener(newItem); - } - - /** - * Removes the given item from the members of this group item. - * - * @param item the item to be removed (must not be null) - * @throws IllegalArgumentException if the given item is null - */ - public void removeMember(Item item) { - if (item == null) { - throw new IllegalArgumentException("Item must not be null!"); - } - members.remove(item); - unregisterStateListener(item); - } - - @Override - public void setUnitProvider(@Nullable UnitProvider unitProvider) { - super.setUnitProvider(unitProvider); - if (baseItem != null && baseItem instanceof GenericItem) { - ((GenericItem) baseItem).setUnitProvider(unitProvider); - } - } - - /** - * The accepted data types of a group item is the same as of the underlying base item. - * If none is defined, the intersection of all sets of accepted data types of all group - * members is used instead. - * - * @return the accepted data types of this group item - */ - @Override - @SuppressWarnings("unchecked") - public List> getAcceptedDataTypes() { - if (baseItem != null) { - return baseItem.getAcceptedDataTypes(); - } else { - List> acceptedDataTypes = null; - - for (Item item : members) { - if (acceptedDataTypes == null) { - acceptedDataTypes = new ArrayList<>(item.getAcceptedDataTypes()); - } else { - acceptedDataTypes.retainAll(item.getAcceptedDataTypes()); - } - } - return acceptedDataTypes == null ? Collections.unmodifiableList(Collections.EMPTY_LIST) - : Collections.unmodifiableList(acceptedDataTypes); - } - } - - /** - * The accepted command types of a group item is the same as of the underlying base item. - * If none is defined, the intersection of all sets of accepted command types of all group - * members is used instead. - * - * @return the accepted command types of this group item - */ - @Override - @SuppressWarnings("unchecked") - public List> getAcceptedCommandTypes() { - if (baseItem != null) { - return baseItem.getAcceptedCommandTypes(); - } else { - List> acceptedCommandTypes = null; - - for (Item item : members) { - if (acceptedCommandTypes == null) { - acceptedCommandTypes = new ArrayList<>(item.getAcceptedCommandTypes()); - } else { - acceptedCommandTypes.retainAll(item.getAcceptedCommandTypes()); - } - } - return acceptedCommandTypes == null ? Collections.unmodifiableList(Collections.EMPTY_LIST) - : Collections.unmodifiableList(acceptedCommandTypes); - } - } - - public void send(Command command) { - if (getAcceptedCommandTypes().contains(command.getClass())) { - internalSend(command); - } else { - logger.warn("Command '{}' has been ignored for group '{}' as it is not accepted.", command, getName()); - } - } - - @Override - protected void internalSend(Command command) { - if (eventPublisher != null) { - for (Item member : members) { - // try to send the command to the bus - eventPublisher.post(ItemEventFactory.createCommandEvent(member.getName(), command)); - } - } - } - - @Override - public @Nullable T getStateAs(Class typeClass) { - // if a group does not have a function it cannot have a state - @Nullable - T newState = null; - if (function != null) { - newState = function.getStateAs(getStateMembers(getMembers()), typeClass); - } - - if (newState == null && baseItem != null && baseItem instanceof GenericItem) { - // we use the transformation method from the base item - ((GenericItem) baseItem).setState(state); - newState = baseItem.getStateAs(typeClass); - } - if (newState == null) { - newState = super.getStateAs(typeClass); - } - return newState; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getName()); - sb.append(" ("); - sb.append("Type="); - sb.append(getClass().getSimpleName()); - sb.append(", "); - if (getBaseItem() != null) { - sb.append("BaseType="); - sb.append(baseItem.getClass().getSimpleName()); - sb.append(", "); - } - sb.append("Members="); - sb.append(members.size()); - sb.append(", "); - sb.append("State="); - sb.append(getState()); - sb.append(", "); - sb.append("Label="); - sb.append(getLabel()); - sb.append(", "); - sb.append("Category="); - sb.append(getCategory()); - if (!getTags().isEmpty()) { - sb.append(", "); - sb.append("Tags=["); - sb.append(getTags().stream().collect(Collectors.joining(", "))); - sb.append("]"); - } - if (!getGroupNames().isEmpty()) { - sb.append(", "); - sb.append("Groups=["); - sb.append(getGroupNames().stream().collect(Collectors.joining(", "))); - sb.append("]"); - } - sb.append(")"); - return sb.toString(); - } - - @Override - public void stateChanged(Item item, State oldState, State newState) { - } - - @Override - public void stateUpdated(Item item, State state) { - State oldState = this.state; - State newState = oldState; - if (function != null && baseItem != null && itemStateConverter != null) { - State calculatedState = function.calculate(getStateMembers(getMembers())); - newState = itemStateConverter.convertToAcceptedState(calculatedState, baseItem); - setState(newState); - } - if (!oldState.equals(newState)) { - sendGroupStateChangedEvent(item.getName(), newState, oldState); - } - } - - @Override - public void setState(State state) { - State oldState = this.state; - if (baseItem != null && baseItem instanceof GenericItem) { - ((GenericItem) baseItem).setState(state); - this.state = baseItem.getState(); - } else { - this.state = state; - } - notifyListeners(oldState, state); - } - - private void sendGroupStateChangedEvent(String memberName, State newState, State oldState) { - if (eventPublisher != null) { - eventPublisher - .post(ItemEventFactory.createGroupStateChangedEvent(getName(), memberName, newState, oldState)); - } - } - - private Set getStateMembers(Set items) { - Set result = new HashSet<>(); - collectStateMembers(result, items); - - // filter out group items w/o state. we had those in to detect cyclic membership. - return result.stream().filter(i -> !isGroupItem(i) || hasOwnState((GroupItem) i)).collect(Collectors.toSet()); - } - - private void collectStateMembers(Set result, Set items) { - for (Item item : items) { - if (result.contains(item)) { - continue; - } - if (!isGroupItem(item) || (isGroupItem(item) && hasOwnState((GroupItem) item))) { - result.add(item); - } else { - result.add(item); // also add group items w/o state to detect cyclic membership. - collectStateMembers(result, ((GroupItem) item).getMembers()); - } - } - } - - private boolean isGroupItem(Item item) { - return item instanceof GroupItem; - } - - private boolean hasOwnState(GroupItem item) { - return item.getFunction() != null && item.getBaseItem() != null; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.i18n.UnitProvider; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.types.Command; +import org.openhab.core.types.State; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class GroupItem extends GenericItem implements StateChangeListener { + + public static final String TYPE = "Group"; + + private final Logger logger = LoggerFactory.getLogger(GroupItem.class); + + protected @Nullable final Item baseItem; + + protected final CopyOnWriteArrayList members; + + protected @Nullable GroupFunction function; + + /** + * Creates a plain GroupItem + * + * @param name name of the group + */ + public GroupItem(String name) { + this(name, null, null); + } + + public GroupItem(String name, @Nullable Item baseItem) { + // only baseItem but no function set -> use Equality + this(name, baseItem, new GroupFunction.Equality()); + } + + /** + * Creates a GroupItem with function + * + * @param name name of the group + * @param baseItem type of items in the group + * @param function function to calculate group status out of member status + */ + public GroupItem(String name, @Nullable Item baseItem, @Nullable GroupFunction function) { + super(TYPE, name); + + // we only allow GroupItem with BOTH, baseItem AND function set, or NONE of them set + if (baseItem == null || function == null) { + this.baseItem = null; + this.function = null; + } else { + this.function = function; + this.baseItem = baseItem; + } + + members = new CopyOnWriteArrayList<>(); + } + + @Override + public void dispose() { + super.dispose(); + for (Item member : getMembers()) { + unregisterStateListener(member); + } + members.clear(); + } + + /** + * Returns the base item of this {@link GroupItem}. This method is only + * intended to allow instance checks of the underlying BaseItem. It must + * not be changed in any way. + * + * @return the base item of this GroupItem + */ + public @Nullable Item getBaseItem() { + return baseItem; + } + + /** + * Returns the function of this {@link GroupItem}. + * + * @return the function of this GroupItem + */ + public @Nullable GroupFunction getFunction() { + return function; + } + + /** + * Returns the direct members of this {@link GroupItem} regardless if these + * members are {@link GroupItem}s as well. + * + * @return the direct members of this {@link GroupItem} + */ + public Set getMembers() { + return Collections.unmodifiableSet(new LinkedHashSet<>(members)); + } + + /** + * Returns the direct members of this {@link GroupItem} and recursively all + * members of the potentially contained {@link GroupItem}s as well. The {@link GroupItem}s itself aren't contained. + * The returned items are unique. + * + * @return all members of this and all contained {@link GroupItem}s + */ + public Set getAllMembers() { + return Collections.unmodifiableSet(new LinkedHashSet<>(getMembers((Item i) -> !(i instanceof GroupItem)))); + } + + private void collectMembers(Collection allMembers, Collection members) { + for (Item member : members) { + if (allMembers.contains(member)) { + continue; + } + allMembers.add(member); + if (member instanceof GroupItem) { + collectMembers(allMembers, ((GroupItem) member).members); + } + } + } + + /** + * Retrieves ALL members of this group and filters it with the given Predicate + * + * @param filterItem Predicate with settings to filter member list + * @return Set of member items filtered by filterItem + */ + public Set getMembers(Predicate filterItem) { + Set allMembers = new LinkedHashSet<>(); + collectMembers(allMembers, members); + return allMembers.stream().filter(filterItem).collect(Collectors.toSet()); + } + + /** + * Adds the given item to the members of this group item. + * + * @param item the item to be added (must not be null) + * @throws IllegalArgumentException if the given item is null + */ + public void addMember(Item item) { + if (item == null) { + throw new IllegalArgumentException("Item must not be null!"); + } + + boolean added = members.addIfAbsent(item); + + // in case membership is constructed programmatically this sanitizes + // the group names on the item: + if (added && item instanceof GenericItem) { + ((GenericItem) item).addGroupName(getName()); + } + registerStateListener(item); + } + + private void registerStateListener(Item item) { + if (item instanceof GenericItem) { + GenericItem genericItem = (GenericItem) item; + genericItem.addStateChangeListener(this); + } + } + + private void unregisterStateListener(Item old) { + if (old instanceof GenericItem) { + GenericItem genericItem = (GenericItem) old; + genericItem.removeStateChangeListener(this); + } + } + + public void replaceMember(Item oldItem, Item newItem) { + if (oldItem == null || newItem == null) { + throw new IllegalArgumentException("Items must not be null!"); + } + int index = members.indexOf(oldItem); + if (index > -1) { + Item old = members.set(index, newItem); + unregisterStateListener(old); + } + registerStateListener(newItem); + } + + /** + * Removes the given item from the members of this group item. + * + * @param item the item to be removed (must not be null) + * @throws IllegalArgumentException if the given item is null + */ + public void removeMember(Item item) { + if (item == null) { + throw new IllegalArgumentException("Item must not be null!"); + } + members.remove(item); + unregisterStateListener(item); + } + + @Override + public void setUnitProvider(@Nullable UnitProvider unitProvider) { + super.setUnitProvider(unitProvider); + if (baseItem != null && baseItem instanceof GenericItem) { + ((GenericItem) baseItem).setUnitProvider(unitProvider); + } + } + + /** + * The accepted data types of a group item is the same as of the underlying base item. + * If none is defined, the intersection of all sets of accepted data types of all group + * members is used instead. + * + * @return the accepted data types of this group item + */ + @Override + @SuppressWarnings("unchecked") + public List> getAcceptedDataTypes() { + if (baseItem != null) { + return baseItem.getAcceptedDataTypes(); + } else { + List> acceptedDataTypes = null; + + for (Item item : members) { + if (acceptedDataTypes == null) { + acceptedDataTypes = new ArrayList<>(item.getAcceptedDataTypes()); + } else { + acceptedDataTypes.retainAll(item.getAcceptedDataTypes()); + } + } + return acceptedDataTypes == null ? Collections.unmodifiableList(Collections.EMPTY_LIST) + : Collections.unmodifiableList(acceptedDataTypes); + } + } + + /** + * The accepted command types of a group item is the same as of the underlying base item. + * If none is defined, the intersection of all sets of accepted command types of all group + * members is used instead. + * + * @return the accepted command types of this group item + */ + @Override + @SuppressWarnings("unchecked") + public List> getAcceptedCommandTypes() { + if (baseItem != null) { + return baseItem.getAcceptedCommandTypes(); + } else { + List> acceptedCommandTypes = null; + + for (Item item : members) { + if (acceptedCommandTypes == null) { + acceptedCommandTypes = new ArrayList<>(item.getAcceptedCommandTypes()); + } else { + acceptedCommandTypes.retainAll(item.getAcceptedCommandTypes()); + } + } + return acceptedCommandTypes == null ? Collections.unmodifiableList(Collections.EMPTY_LIST) + : Collections.unmodifiableList(acceptedCommandTypes); + } + } + + public void send(Command command) { + if (getAcceptedCommandTypes().contains(command.getClass())) { + internalSend(command); + } else { + logger.warn("Command '{}' has been ignored for group '{}' as it is not accepted.", command, getName()); + } + } + + @Override + protected void internalSend(Command command) { + if (eventPublisher != null) { + for (Item member : members) { + // try to send the command to the bus + eventPublisher.post(ItemEventFactory.createCommandEvent(member.getName(), command)); + } + } + } + + @Override + public @Nullable T getStateAs(Class typeClass) { + // if a group does not have a function it cannot have a state + @Nullable + T newState = null; + if (function != null) { + newState = function.getStateAs(getStateMembers(getMembers()), typeClass); + } + + if (newState == null && baseItem != null && baseItem instanceof GenericItem) { + // we use the transformation method from the base item + ((GenericItem) baseItem).setState(state); + newState = baseItem.getStateAs(typeClass); + } + if (newState == null) { + newState = super.getStateAs(typeClass); + } + return newState; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getName()); + sb.append(" ("); + sb.append("Type="); + sb.append(getClass().getSimpleName()); + sb.append(", "); + if (getBaseItem() != null) { + sb.append("BaseType="); + sb.append(baseItem.getClass().getSimpleName()); + sb.append(", "); + } + sb.append("Members="); + sb.append(members.size()); + sb.append(", "); + sb.append("State="); + sb.append(getState()); + sb.append(", "); + sb.append("Label="); + sb.append(getLabel()); + sb.append(", "); + sb.append("Category="); + sb.append(getCategory()); + if (!getTags().isEmpty()) { + sb.append(", "); + sb.append("Tags=["); + sb.append(getTags().stream().collect(Collectors.joining(", "))); + sb.append("]"); + } + if (!getGroupNames().isEmpty()) { + sb.append(", "); + sb.append("Groups=["); + sb.append(getGroupNames().stream().collect(Collectors.joining(", "))); + sb.append("]"); + } + sb.append(")"); + return sb.toString(); + } + + @Override + public void stateChanged(Item item, State oldState, State newState) { + } + + @Override + public void stateUpdated(Item item, State state) { + State oldState = this.state; + State newState = oldState; + if (function != null && baseItem != null && itemStateConverter != null) { + State calculatedState = function.calculate(getStateMembers(getMembers())); + newState = itemStateConverter.convertToAcceptedState(calculatedState, baseItem); + setState(newState); + } + if (!oldState.equals(newState)) { + sendGroupStateChangedEvent(item.getName(), newState, oldState); + } + } + + @Override + public void setState(State state) { + State oldState = this.state; + if (baseItem != null && baseItem instanceof GenericItem) { + ((GenericItem) baseItem).setState(state); + this.state = baseItem.getState(); + } else { + this.state = state; + } + notifyListeners(oldState, state); + } + + private void sendGroupStateChangedEvent(String memberName, State newState, State oldState) { + if (eventPublisher != null) { + eventPublisher + .post(ItemEventFactory.createGroupStateChangedEvent(getName(), memberName, newState, oldState)); + } + } + + private Set getStateMembers(Set items) { + Set result = new HashSet<>(); + collectStateMembers(result, items); + + // filter out group items w/o state. we had those in to detect cyclic membership. + return result.stream().filter(i -> !isGroupItem(i) || hasOwnState((GroupItem) i)).collect(Collectors.toSet()); + } + + private void collectStateMembers(Set result, Set items) { + for (Item item : items) { + if (result.contains(item)) { + continue; + } + if (!isGroupItem(item) || (isGroupItem(item) && hasOwnState((GroupItem) item))) { + result.add(item); + } else { + result.add(item); // also add group items w/o state to detect cyclic membership. + collectStateMembers(result, ((GroupItem) item).getMembers()); + } + } + } + + private boolean isGroupItem(Item item) { + return item instanceof GroupItem; + } + + private boolean hasOwnState(GroupItem item) { + return item.getFunction() != null && item.getBaseItem() != null; + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemRegistryChangeListener.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemRegistryChangeListener.java index b0b82d426..392f1e551 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemRegistryChangeListener.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/ItemRegistryChangeListener.java @@ -1,36 +1,36 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items; - -import java.util.Collection; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.common.registry.RegistryChangeListener; - -/** - * This is a listener interface which should be implemented where ever the item registry is - * used in order to be notified of any dynamic changes in the provided items. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface ItemRegistryChangeListener extends RegistryChangeListener { - - /** - * Notifies the listener that all items in the registry have changed and thus should be reloaded. - * - * @param oldItemNames a collection of all previous item names, so that references can be removed - */ - void allItemsChanged(Collection oldItemNames); - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items; + +import java.util.Collection; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.common.registry.RegistryChangeListener; + +/** + * This is a listener interface which should be implemented where ever the item registry is + * used in order to be notified of any dynamic changes in the provided items. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface ItemRegistryChangeListener extends RegistryChangeListener { + + /** + * Notifies the listener that all items in the registry have changed and thus should be reloaded. + * + * @param oldItemNames a collection of all previous item names, so that references can be removed + */ + void allItemsChanged(Collection oldItemNames); + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/GroupItemDTO.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/GroupItemDTO.java index b41fa509b..51beadecd 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/GroupItemDTO.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/GroupItemDTO.java @@ -1,25 +1,25 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items.dto; - -/** - * This is a data transfer object that is used to serialize group items. - * - * @author Kai Kreuzer - Initial contribution - */ -public class GroupItemDTO extends ItemDTO { - - public String groupType; - public GroupFunctionDTO function; - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items.dto; + +/** + * This is a data transfer object that is used to serialize group items. + * + * @author Kai Kreuzer - Initial contribution + */ +public class GroupItemDTO extends ItemDTO { + + public String groupType; + public GroupFunctionDTO function; + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTO.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTO.java index c06592515..cfacd099a 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTO.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/ItemDTO.java @@ -1,36 +1,36 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items.dto; - -import java.util.List; -import java.util.Set; - -/** - * This is a data transfer object that is used to serialize items. - * - * @author Kai Kreuzer - Initial contribution - * @author Andre Fuechsel - added tag support - */ -public class ItemDTO { - - public String type; - public String name; - public String label; - public String category; - public Set tags; - public List groupNames; - - public ItemDTO() { - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items.dto; + +import java.util.List; +import java.util.Set; + +/** + * This is a data transfer object that is used to serialize items. + * + * @author Kai Kreuzer - Initial contribution + * @author Andre Fuechsel - added tag support + */ +public class ItemDTO { + + public String type; + public String name; + public String label; + public String category; + public Set tags; + public List groupNames; + + public ItemDTO() { + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/MetadataDTO.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/MetadataDTO.java index 7214394a3..b4a2077ca 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/MetadataDTO.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/dto/MetadataDTO.java @@ -1,31 +1,31 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items.dto; - -import java.util.Map; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * This is a data transfer object that is used to serialize metadata for a certain namespace and item. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class MetadataDTO { - - public @Nullable String value; - public @Nullable Map config; - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items.dto; + +import java.util.Map; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * This is a data transfer object that is used to serialize metadata for a certain namespace and item. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class MetadataDTO { + + public @Nullable String value; + public @Nullable Map config; + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemCommandEvent.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemCommandEvent.java index f196938c3..e80b4049b 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemCommandEvent.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemCommandEvent.java @@ -1,78 +1,78 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.items.events; - -import org.openhab.core.events.AbstractEvent; -import org.openhab.core.types.Command; - -/** - * {@link ItemCommandEvent}s can be used to deliver commands through the openHAB event bus. - * Command events must be created with the {@link ItemEventFactory}. - * - * @author Stefan Bußweiler - Initial contribution - */ -public class ItemCommandEvent extends AbstractEvent { - - /** - * The item command event type. - */ - public static final String TYPE = ItemCommandEvent.class.getSimpleName(); - - private final String itemName; - - private final Command command; - - /** - * Constructs a new item command event object. - * - * @param topic the topic - * @param payload the payload - * @param itemName the item name - * @param command the command - * @param source the source, can be null - */ - protected ItemCommandEvent(String topic, String payload, String itemName, Command command, String source) { - super(topic, payload, source); - this.itemName = itemName; - this.command = command; - } - - @Override - public String getType() { - return TYPE; - } - - /** - * Gets the item name. - * - * @return the item name - */ - public String getItemName() { - return itemName; - } - - /** - * Gets the item command. - * - * @return the item command - */ - public Command getItemCommand() { - return command; - } - - @Override - public String toString() { - return "Item '" + itemName + "' received command " + command; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.items.events; + +import org.openhab.core.events.AbstractEvent; +import org.openhab.core.types.Command; + +/** + * {@link ItemCommandEvent}s can be used to deliver commands through the openHAB event bus. + * Command events must be created with the {@link ItemEventFactory}. + * + * @author Stefan Bußweiler - Initial contribution + */ +public class ItemCommandEvent extends AbstractEvent { + + /** + * The item command event type. + */ + public static final String TYPE = ItemCommandEvent.class.getSimpleName(); + + private final String itemName; + + private final Command command; + + /** + * Constructs a new item command event object. + * + * @param topic the topic + * @param payload the payload + * @param itemName the item name + * @param command the command + * @param source the source, can be null + */ + protected ItemCommandEvent(String topic, String payload, String itemName, Command command, String source) { + super(topic, payload, source); + this.itemName = itemName; + this.command = command; + } + + @Override + public String getType() { + return TYPE; + } + + /** + * Gets the item name. + * + * @return the item name + */ + public String getItemName() { + return itemName; + } + + /** + * Gets the item command. + * + * @return the item command + */ + public Command getItemCommand() { + return command; + } + + @Override + public String toString() { + return "Item '" + itemName + "' received command " + command; + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemUpdatedEvent.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemUpdatedEvent.java index 7ec9fb639..c5ec04fc6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemUpdatedEvent.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/items/events/ItemUpdatedEvent.java @@ -23,7 +23,7 @@ import org.openhab.core.items.dto.ItemDTO; public class ItemUpdatedEvent extends AbstractItemRegistryEvent { private final ItemDTO oldItem; - + /** * The item updated event type. */ diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ContactItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ContactItem.java index f1f0e2121..50706e665 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ContactItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ContactItem.java @@ -1,69 +1,69 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.OpenClosedType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * A ContactItem can be used for sensors that return an "open" or "close" as a state. - * This is useful for doors, windows, etc. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class ContactItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(OpenClosedType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(RefreshType.class); - } - - public ContactItem(String name) { - super(CoreItemFactory.CONTACT, name); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.OpenClosedType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * A ContactItem can be used for sensors that return an "open" or "close" as a state. + * This is useful for doors, windows, etc. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class ContactItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(OpenClosedType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(RefreshType.class); + } + + public ContactItem(String name) { + super(CoreItemFactory.CONTACT, name); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DateTimeItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DateTimeItem.java index 6a341b080..b065016bd 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DateTimeItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DateTimeItem.java @@ -1,80 +1,80 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.DateTimeType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * A DateTimeItem stores a timestamp including a valid time zone. - * - * @author Thomas Eichstaedt-Engelen - Initial contribution - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class DateTimeItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(DateTimeType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(RefreshType.class); - acceptedCommandTypes.add(DateTimeType.class); - } - - public DateTimeItem(String name) { - super(CoreItemFactory.DATETIME, name); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - public void send(DateTimeType command) { - internalSend(command); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - // try conversion - State convertedState = state.as(DateTimeType.class); - if (convertedState != null) { - applyState(convertedState); - } else { - applyState(state); - } - } else { - logSetTypeError(state); - } - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.DateTimeType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * A DateTimeItem stores a timestamp including a valid time zone. + * + * @author Thomas Eichstaedt-Engelen - Initial contribution + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class DateTimeItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(DateTimeType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(RefreshType.class); + acceptedCommandTypes.add(DateTimeType.class); + } + + public DateTimeItem(String name) { + super(CoreItemFactory.DATETIME, name); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + public void send(DateTimeType command) { + internalSend(command); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + // try conversion + State convertedState = state.as(DateTimeType.class); + if (convertedState != null) { + applyState(convertedState); + } else { + applyState(state); + } + } else { + logSetTypeError(state); + } + } +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DimmerItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DimmerItem.java index a371efed0..3834fe7e6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DimmerItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/DimmerItem.java @@ -1,90 +1,90 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.IncreaseDecreaseType; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.library.types.PercentType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * A DimmerItem can be used as a switch (ON/OFF), but it also accepts percent values - * to reflect the dimmed state. - * - * @author Kai Kreuzer - Initial contribution - * @author Markus Rathgeb - Support more types for getStateAs - */ -@NonNullByDefault -public class DimmerItem extends SwitchItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(PercentType.class); - acceptedDataTypes.add(OnOffType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(PercentType.class); - acceptedCommandTypes.add(OnOffType.class); - acceptedCommandTypes.add(IncreaseDecreaseType.class); - acceptedCommandTypes.add(RefreshType.class); - } - - public DimmerItem(String name) { - super(CoreItemFactory.DIMMER, name); - } - - /* package */ DimmerItem(String type, String name) { - super(type, name); - } - - public void send(PercentType command) { - internalSend(command); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - // try conversion - State convertedState = state.as(PercentType.class); - if (convertedState != null) { - applyState(convertedState); - } else { - applyState(state); - } - } else { - logSetTypeError(state); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.IncreaseDecreaseType; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.library.types.PercentType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * A DimmerItem can be used as a switch (ON/OFF), but it also accepts percent values + * to reflect the dimmed state. + * + * @author Kai Kreuzer - Initial contribution + * @author Markus Rathgeb - Support more types for getStateAs + */ +@NonNullByDefault +public class DimmerItem extends SwitchItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(PercentType.class); + acceptedDataTypes.add(OnOffType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(PercentType.class); + acceptedCommandTypes.add(OnOffType.class); + acceptedCommandTypes.add(IncreaseDecreaseType.class); + acceptedCommandTypes.add(RefreshType.class); + } + + public DimmerItem(String name) { + super(CoreItemFactory.DIMMER, name); + } + + /* package */ DimmerItem(String type, String name) { + super(type, name); + } + + public void send(PercentType command) { + internalSend(command); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + // try conversion + State convertedState = state.as(PercentType.class); + if (convertedState != null) { + applyState(convertedState); + } else { + applyState(state); + } + } else { + logSetTypeError(state); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ImageItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ImageItem.java index 7f68bb301..8c757e80d 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ImageItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/ImageItem.java @@ -1,68 +1,68 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.RawType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * An ImageItem holds the binary image data as its status. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class ImageItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(RawType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(RefreshType.class); - } - - public ImageItem(String name) { - super(CoreItemFactory.IMAGE, name); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.RawType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * An ImageItem holds the binary image data as its status. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class ImageItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(RawType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(RefreshType.class); + } + + public ImageItem(String name) { + super(CoreItemFactory.IMAGE, name); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java index 2142fe662..1bcecb961 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java @@ -1,223 +1,223 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -import javax.measure.Dimension; -import javax.measure.Quantity; -import javax.measure.Unit; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.items.GenericItem; -import org.openhab.core.items.ItemUtil; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.library.types.QuantityType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.StateDescription; -import org.openhab.core.types.StateDescriptionFragmentBuilder; -import org.openhab.core.types.UnDefType; -import org.openhab.core.types.util.UnitUtils; - -/** - * A NumberItem has a decimal value and is usually used for all kinds - * of sensors, like temperature, brightness, wind, etc. - * It can also be used as a counter or as any other thing that can be expressed - * as a number. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class NumberItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - @Nullable - private Class> dimension; - - static { - acceptedDataTypes.add(DecimalType.class); - acceptedDataTypes.add(QuantityType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(DecimalType.class); - acceptedCommandTypes.add(QuantityType.class); - acceptedCommandTypes.add(RefreshType.class); - } - - public NumberItem(String name) { - this(CoreItemFactory.NUMBER, name); - } - - public NumberItem(String type, String name) { - super(type, name); - - String itemTypeExtension = ItemUtil.getItemTypeExtension(getType()); - if (itemTypeExtension != null) { - dimension = UnitUtils.parseDimension(itemTypeExtension); - } - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - public void send(DecimalType command) { - internalSend(command); - } - - @Override - public @Nullable StateDescription getStateDescription(@Nullable Locale locale) { - StateDescription stateDescription = super.getStateDescription(locale); - if (getDimension() == null && stateDescription != null && stateDescription.getPattern() != null - && stateDescription.getPattern().contains(UnitUtils.UNIT_PLACEHOLDER)) { - return StateDescriptionFragmentBuilder.create(stateDescription) - .withPattern(stateDescription.getPattern().replaceAll(UnitUtils.UNIT_PLACEHOLDER, "").trim()) - .build().toStateDescription(); - } - - return stateDescription; - } - - /** - * Returns the {@link Dimension} associated with this {@link NumberItem}, may be null. - * - * @return the {@link Dimension} associated with this {@link NumberItem}, may be null. - */ - public @Nullable Class> getDimension() { - return dimension; - } - - @Override - public void setState(State state) { - // DecimalType update for a NumberItem with dimension, convert to QuantityType: - if (state instanceof DecimalType && dimension != null) { - Unit unit = getUnit(); - if (unit != null) { - super.setState(new QuantityType<>(((DecimalType) state).doubleValue(), unit)); - return; - } - } - - // QuantityType update, check unit and convert if necessary: - if (state instanceof QuantityType) { - Unit itemUnit = getUnit(); - Unit stateUnit = ((QuantityType) state).getUnit(); - if (itemUnit != null && (!stateUnit.getSystemUnit().equals(itemUnit.getSystemUnit()) - || UnitUtils.isDifferentMeasurementSystem(itemUnit, stateUnit))) { - QuantityType convertedState = ((QuantityType) state).toUnit(itemUnit); - if (convertedState != null) { - super.setState(convertedState); - return; - } - - // the state could not be converted to an accepted unit. - return; - } - } - - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } - - /** - * Returns the optional unit symbol for this {@link NumberItem}. - * - * @return the optional unit symbol for this {@link NumberItem}. - */ - public @Nullable String getUnitSymbol() { - Unit unit = getUnit(); - return unit != null ? unit.toString() : null; - } - - /** - * Derive the unit for this item by the following priority: - *

    - *
  • the unit parsed from the state description
  • - *
  • the default system unit from the item's dimension
  • - *
- * - * @return the {@link Unit} for this item if available, {@code null} otherwise. - */ - public @Nullable Unit> getUnit() { - return getUnit(dimension); - } - - /** - * Try to convert a {@link DecimalType} into a new {@link QuantityType}. The unit for the new - * type is derived either from the state description (which might also give a hint on items w/o dimension) or from - * the system default unit of the given dimension. - * - * @param originalType the source {@link DecimalType}. - * @param dimension the dimension to which the new {@link QuantityType} should adhere. - * @return the new {@link QuantityType} from the given originalType, {@code null} if a unit could not be calculated. - */ - public @Nullable QuantityType toQuantityType(DecimalType originalType, - @Nullable Class> dimension) { - Unit> itemUnit = getUnit(dimension); - if (itemUnit != null) { - return new QuantityType<>(originalType.toBigDecimal(), itemUnit); - } - - return null; - } - - /** - * Derive the unit for this item by the following priority: - *
    - *
  • the unit parsed from the state description
  • - *
  • the default system unit from the (optional) dimension parameter
  • - *
- * - * @param dimension the (optional) dimension - * @return the {@link Unit} for this item if available, {@code null} otherwise. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - private @Nullable Unit> getUnit(@Nullable Class> dimension) { - StateDescription stateDescription = getStateDescription(); - if (stateDescription != null) { - String pattern = stateDescription.getPattern(); - if (pattern != null) { - Unit stateDescriptionUnit = UnitUtils.parseUnit(pattern); - if (stateDescriptionUnit != null) { - return stateDescriptionUnit; - } - } - } - - if (dimension != null && unitProvider != null) { - // explicit cast to Class as JDK compiler complains - return unitProvider.getUnit((Class) dimension); - } - - return null; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Locale; + +import javax.measure.Dimension; +import javax.measure.Quantity; +import javax.measure.Unit; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.items.GenericItem; +import org.openhab.core.items.ItemUtil; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.library.types.QuantityType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.StateDescription; +import org.openhab.core.types.StateDescriptionFragmentBuilder; +import org.openhab.core.types.UnDefType; +import org.openhab.core.types.util.UnitUtils; + +/** + * A NumberItem has a decimal value and is usually used for all kinds + * of sensors, like temperature, brightness, wind, etc. + * It can also be used as a counter or as any other thing that can be expressed + * as a number. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class NumberItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + @Nullable + private Class> dimension; + + static { + acceptedDataTypes.add(DecimalType.class); + acceptedDataTypes.add(QuantityType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(DecimalType.class); + acceptedCommandTypes.add(QuantityType.class); + acceptedCommandTypes.add(RefreshType.class); + } + + public NumberItem(String name) { + this(CoreItemFactory.NUMBER, name); + } + + public NumberItem(String type, String name) { + super(type, name); + + String itemTypeExtension = ItemUtil.getItemTypeExtension(getType()); + if (itemTypeExtension != null) { + dimension = UnitUtils.parseDimension(itemTypeExtension); + } + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + public void send(DecimalType command) { + internalSend(command); + } + + @Override + public @Nullable StateDescription getStateDescription(@Nullable Locale locale) { + StateDescription stateDescription = super.getStateDescription(locale); + if (getDimension() == null && stateDescription != null && stateDescription.getPattern() != null + && stateDescription.getPattern().contains(UnitUtils.UNIT_PLACEHOLDER)) { + return StateDescriptionFragmentBuilder.create(stateDescription) + .withPattern(stateDescription.getPattern().replaceAll(UnitUtils.UNIT_PLACEHOLDER, "").trim()) + .build().toStateDescription(); + } + + return stateDescription; + } + + /** + * Returns the {@link Dimension} associated with this {@link NumberItem}, may be null. + * + * @return the {@link Dimension} associated with this {@link NumberItem}, may be null. + */ + public @Nullable Class> getDimension() { + return dimension; + } + + @Override + public void setState(State state) { + // DecimalType update for a NumberItem with dimension, convert to QuantityType: + if (state instanceof DecimalType && dimension != null) { + Unit unit = getUnit(); + if (unit != null) { + super.setState(new QuantityType<>(((DecimalType) state).doubleValue(), unit)); + return; + } + } + + // QuantityType update, check unit and convert if necessary: + if (state instanceof QuantityType) { + Unit itemUnit = getUnit(); + Unit stateUnit = ((QuantityType) state).getUnit(); + if (itemUnit != null && (!stateUnit.getSystemUnit().equals(itemUnit.getSystemUnit()) + || UnitUtils.isDifferentMeasurementSystem(itemUnit, stateUnit))) { + QuantityType convertedState = ((QuantityType) state).toUnit(itemUnit); + if (convertedState != null) { + super.setState(convertedState); + return; + } + + // the state could not be converted to an accepted unit. + return; + } + } + + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } + + /** + * Returns the optional unit symbol for this {@link NumberItem}. + * + * @return the optional unit symbol for this {@link NumberItem}. + */ + public @Nullable String getUnitSymbol() { + Unit unit = getUnit(); + return unit != null ? unit.toString() : null; + } + + /** + * Derive the unit for this item by the following priority: + *
    + *
  • the unit parsed from the state description
  • + *
  • the default system unit from the item's dimension
  • + *
+ * + * @return the {@link Unit} for this item if available, {@code null} otherwise. + */ + public @Nullable Unit> getUnit() { + return getUnit(dimension); + } + + /** + * Try to convert a {@link DecimalType} into a new {@link QuantityType}. The unit for the new + * type is derived either from the state description (which might also give a hint on items w/o dimension) or from + * the system default unit of the given dimension. + * + * @param originalType the source {@link DecimalType}. + * @param dimension the dimension to which the new {@link QuantityType} should adhere. + * @return the new {@link QuantityType} from the given originalType, {@code null} if a unit could not be calculated. + */ + public @Nullable QuantityType toQuantityType(DecimalType originalType, + @Nullable Class> dimension) { + Unit> itemUnit = getUnit(dimension); + if (itemUnit != null) { + return new QuantityType<>(originalType.toBigDecimal(), itemUnit); + } + + return null; + } + + /** + * Derive the unit for this item by the following priority: + *
    + *
  • the unit parsed from the state description
  • + *
  • the default system unit from the (optional) dimension parameter
  • + *
+ * + * @param dimension the (optional) dimension + * @return the {@link Unit} for this item if available, {@code null} otherwise. + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + private @Nullable Unit> getUnit(@Nullable Class> dimension) { + StateDescription stateDescription = getStateDescription(); + if (stateDescription != null) { + String pattern = stateDescription.getPattern(); + if (pattern != null) { + Unit stateDescriptionUnit = UnitUtils.parseUnit(pattern); + if (stateDescriptionUnit != null) { + return stateDescriptionUnit; + } + } + } + + if (dimension != null && unitProvider != null) { + // explicit cast to Class as JDK compiler complains + return unitProvider.getUnit((Class) dimension); + } + + return null; + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/PlayerItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/PlayerItem.java index f70b5f94c..11b24fec6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/PlayerItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/PlayerItem.java @@ -1,91 +1,91 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.NextPreviousType; -import org.openhab.core.library.types.PlayPauseType; -import org.openhab.core.library.types.RewindFastforwardType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * An {@link PlayerItem} allows to control a player, e.g. an audio player. - * - * @author Alex Tugarev - Initial contribution - */ -@NonNullByDefault -public class PlayerItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(PlayPauseType.class); - acceptedDataTypes.add(RewindFastforwardType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(PlayPauseType.class); - acceptedCommandTypes.add(RewindFastforwardType.class); - acceptedCommandTypes.add(NextPreviousType.class); - acceptedCommandTypes.add(RefreshType.class); - } - - public PlayerItem(String name) { - super(CoreItemFactory.PLAYER, name); - } - - /* package */ PlayerItem(String type, String name) { - super(type, name); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - public void send(PlayPauseType command) { - internalSend(command); - } - - public void send(RewindFastforwardType command) { - internalSend(command); - } - - public void send(NextPreviousType command) { - internalSend(command); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.NextPreviousType; +import org.openhab.core.library.types.PlayPauseType; +import org.openhab.core.library.types.RewindFastforwardType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * An {@link PlayerItem} allows to control a player, e.g. an audio player. + * + * @author Alex Tugarev - Initial contribution + */ +@NonNullByDefault +public class PlayerItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(PlayPauseType.class); + acceptedDataTypes.add(RewindFastforwardType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(PlayPauseType.class); + acceptedCommandTypes.add(RewindFastforwardType.class); + acceptedCommandTypes.add(NextPreviousType.class); + acceptedCommandTypes.add(RefreshType.class); + } + + public PlayerItem(String name) { + super(CoreItemFactory.PLAYER, name); + } + + /* package */ PlayerItem(String type, String name) { + super(type, name); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + public void send(PlayPauseType command) { + internalSend(command); + } + + public void send(RewindFastforwardType command) { + internalSend(command); + } + + public void send(NextPreviousType command) { + internalSend(command); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/RollershutterItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/RollershutterItem.java index 2a45ba203..77290ffcf 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/RollershutterItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/RollershutterItem.java @@ -1,96 +1,96 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.PercentType; -import org.openhab.core.library.types.StopMoveType; -import org.openhab.core.library.types.UpDownType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * A RollershutterItem allows the control of roller shutters, i.e. - * moving them up, down, stopping or setting it to close to a certain percentage. - * - * @author Kai Kreuzer - Initial contribution - * @author Markus Rathgeb - Support more types for getStateAs - */ -@NonNullByDefault -public class RollershutterItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(PercentType.class); - acceptedDataTypes.add(UpDownType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(UpDownType.class); - acceptedCommandTypes.add(StopMoveType.class); - acceptedCommandTypes.add(PercentType.class); - - acceptedCommandTypes.add(RefreshType.class); - } - - public RollershutterItem(String name) { - super(CoreItemFactory.ROLLERSHUTTER, name); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - public void send(UpDownType command) { - internalSend(command); - } - - public void send(StopMoveType command) { - internalSend(command); - } - - public void send(PercentType command) { - internalSend(command); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - // try conversion - State convertedState = state.as(PercentType.class); - if (convertedState != null) { - applyState(convertedState); - } else { - applyState(state); - } - } else { - logSetTypeError(state); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.PercentType; +import org.openhab.core.library.types.StopMoveType; +import org.openhab.core.library.types.UpDownType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * A RollershutterItem allows the control of roller shutters, i.e. + * moving them up, down, stopping or setting it to close to a certain percentage. + * + * @author Kai Kreuzer - Initial contribution + * @author Markus Rathgeb - Support more types for getStateAs + */ +@NonNullByDefault +public class RollershutterItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(PercentType.class); + acceptedDataTypes.add(UpDownType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(UpDownType.class); + acceptedCommandTypes.add(StopMoveType.class); + acceptedCommandTypes.add(PercentType.class); + + acceptedCommandTypes.add(RefreshType.class); + } + + public RollershutterItem(String name) { + super(CoreItemFactory.ROLLERSHUTTER, name); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + public void send(UpDownType command) { + internalSend(command); + } + + public void send(StopMoveType command) { + internalSend(command); + } + + public void send(PercentType command) { + internalSend(command); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + // try conversion + State convertedState = state.as(PercentType.class); + if (convertedState != null) { + applyState(convertedState); + } else { + applyState(state); + } + } else { + logSetTypeError(state); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/StringItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/StringItem.java index 751b071b6..960c4c8cd 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/StringItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/StringItem.java @@ -1,90 +1,90 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.DateTimeType; -import org.openhab.core.library.types.StringType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.TypeParser; -import org.openhab.core.types.UnDefType; - -/** - * A StringItem can be used for any kind of string to either send or receive - * from a device. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class StringItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(UnDefType.class); - acceptedDataTypes.add(StringType.class); - acceptedDataTypes.add(DateTimeType.class); - - acceptedCommandTypes.add(RefreshType.class); - acceptedCommandTypes.add(StringType.class); - } - - public StringItem(String name) { - super(CoreItemFactory.STRING, name); - } - - public void send(StringType command) { - internalSend(command); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - @Override - public @Nullable T getStateAs(Class typeClass) { - List> list = new ArrayList<>(); - list.add(typeClass); - State convertedState = TypeParser.parseState(list, state.toString()); - if (typeClass.isInstance(convertedState)) { - return typeClass.cast(convertedState); - } else { - return super.getStateAs(typeClass); - } - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.DateTimeType; +import org.openhab.core.library.types.StringType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.TypeParser; +import org.openhab.core.types.UnDefType; + +/** + * A StringItem can be used for any kind of string to either send or receive + * from a device. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class StringItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(UnDefType.class); + acceptedDataTypes.add(StringType.class); + acceptedDataTypes.add(DateTimeType.class); + + acceptedCommandTypes.add(RefreshType.class); + acceptedCommandTypes.add(StringType.class); + } + + public StringItem(String name) { + super(CoreItemFactory.STRING, name); + } + + public void send(StringType command) { + internalSend(command); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + @Override + public @Nullable T getStateAs(Class typeClass) { + List> list = new ArrayList<>(); + list.add(typeClass); + State convertedState = TypeParser.parseState(list, state.toString()); + if (typeClass.isInstance(convertedState)) { + return typeClass.cast(convertedState); + } else { + return super.getStateAs(typeClass); + } + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/SwitchItem.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/SwitchItem.java index f1340a8d1..734317ec1 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/SwitchItem.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/SwitchItem.java @@ -1,79 +1,79 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.items; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.CoreItemFactory; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.types.Command; -import org.openhab.core.types.RefreshType; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * A SwitchItem represents a normal switch that can be ON or OFF. - * Useful for normal lights, presence detection etc. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class SwitchItem extends GenericItem { - - private static List> acceptedDataTypes = new ArrayList<>(); - private static List> acceptedCommandTypes = new ArrayList<>(); - - static { - acceptedDataTypes.add(OnOffType.class); - acceptedDataTypes.add(UnDefType.class); - - acceptedCommandTypes.add(OnOffType.class); - acceptedCommandTypes.add(RefreshType.class); - } - - public SwitchItem(String name) { - super(CoreItemFactory.SWITCH, name); - } - - /* package */ SwitchItem(String type, String name) { - super(type, name); - } - - public void send(OnOffType command) { - internalSend(command); - } - - @Override - public List> getAcceptedDataTypes() { - return Collections.unmodifiableList(acceptedDataTypes); - } - - @Override - public List> getAcceptedCommandTypes() { - return Collections.unmodifiableList(acceptedCommandTypes); - } - - @Override - public void setState(State state) { - if (isAcceptedState(acceptedDataTypes, state)) { - super.setState(state); - } else { - logSetTypeError(state); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.items; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * A SwitchItem represents a normal switch that can be ON or OFF. + * Useful for normal lights, presence detection etc. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class SwitchItem extends GenericItem { + + private static List> acceptedDataTypes = new ArrayList<>(); + private static List> acceptedCommandTypes = new ArrayList<>(); + + static { + acceptedDataTypes.add(OnOffType.class); + acceptedDataTypes.add(UnDefType.class); + + acceptedCommandTypes.add(OnOffType.class); + acceptedCommandTypes.add(RefreshType.class); + } + + public SwitchItem(String name) { + super(CoreItemFactory.SWITCH, name); + } + + /* package */ SwitchItem(String type, String name) { + super(type, name); + } + + public void send(OnOffType command) { + internalSend(command); + } + + @Override + public List> getAcceptedDataTypes() { + return Collections.unmodifiableList(acceptedDataTypes); + } + + @Override + public List> getAcceptedCommandTypes() { + return Collections.unmodifiableList(acceptedCommandTypes); + } + + @Override + public void setState(State state) { + if (isAcceptedState(acceptedDataTypes, state)) { + super.setState(state); + } else { + logSetTypeError(state); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/ArithmeticGroupFunction.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/ArithmeticGroupFunction.java index d2edf33eb..cdd662825 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/ArithmeticGroupFunction.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/ArithmeticGroupFunction.java @@ -1,430 +1,430 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.items.GroupFunction; -import org.openhab.core.items.Item; -import org.openhab.core.types.State; -import org.openhab.core.types.UnDefType; - -/** - * This interface is only a container for functions that require the core type library - * for its calculations. - * - * @author Kai Kreuzer - Initial contribution - * @author Thomas Eichstädt-Engelen - Added "N" functions - * @author Gaël L'hopital - Added count function - */ -@NonNullByDefault -public interface ArithmeticGroupFunction extends GroupFunction { - - /** - * This does a logical 'and' operation. Only if all items are of 'activeState' this - * is returned, otherwise the 'passiveState' is returned. - * - * Through the getStateAs() method, it can be determined, how many - * items actually are not in the 'activeState'. - */ - static class And implements GroupFunction { - - protected final State activeState; - protected final State passiveState; - - public And(@Nullable State activeValue, @Nullable State passiveValue) { - if (activeValue == null || passiveValue == null) { - throw new IllegalArgumentException("Parameters must not be null!"); - } - this.activeState = activeValue; - this.passiveState = passiveValue; - } - - @Override - public State calculate(@Nullable Set items) { - if (items == null || items.isEmpty()) { - // if we do not have any items, we return the passive state - return passiveState; - } else { - for (Item item : items) { - if (!activeState.equals(item.getStateAs(activeState.getClass()))) { - return passiveState; - } - } - return activeState; - } - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - if (stateClass == DecimalType.class) { - if (items != null) { - return stateClass.cast(new DecimalType(items.size() - count(items, activeState))); - } else { - return stateClass.cast(DecimalType.ZERO); - } - } else { - return null; - } - } - } - - private int count(Set items, State state) { - int count = 0; - for (Item item : items) { - if (state.equals(item.getStateAs(state.getClass()))) { - count++; - } - } - return count; - } - - @Override - public State[] getParameters() { - return new State[] { activeState, passiveState }; - } - } - - /** - * This does a logical 'or' operation. If at least one item is of 'activeState' this - * is returned, otherwise the 'passiveState' is returned. - * - * Through the getStateAs() method, it can be determined, how many - * items actually are in the 'activeState'. - */ - static class Or implements GroupFunction { - - protected final State activeState; - protected final State passiveState; - - public Or(@Nullable State activeValue, @Nullable State passiveValue) { - if (activeValue == null || passiveValue == null) { - throw new IllegalArgumentException("Parameters must not be null!"); - } - this.activeState = activeValue; - this.passiveState = passiveValue; - } - - @Override - public State calculate(@Nullable Set items) { - if (items != null) { - for (Item item : items) { - if (activeState.equals(item.getStateAs(activeState.getClass()))) { - return activeState; - } - } - } - return passiveState; - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - if (stateClass == DecimalType.class) { - if (items != null) { - return stateClass.cast(new DecimalType(count(items, activeState))); - } else { - return stateClass.cast(DecimalType.ZERO); - } - } else { - return null; - } - } - } - - private int count(Set items, State state) { - int count = 0; - for (Item item : items) { - if (state.equals(item.getStateAs(state.getClass()))) { - count++; - } - } - return count; - } - - @Override - public State[] getParameters() { - return new State[] { activeState, passiveState }; - } - } - - /** - * This does a logical 'nand' operation. The state is 'calculated' by - * the normal 'and' operation and than negated by returning the opposite - * value. E.g. when the 'and' operation calculates the activeValue the - * passiveValue will be returned and vice versa. - */ - static class NAnd extends And { - - public NAnd(@Nullable State activeValue, @Nullable State passiveValue) { - super(activeValue, passiveValue); - } - - @Override - public State calculate(@Nullable Set items) { - State result = super.calculate(items); - return activeState.equals(result) ? passiveState : activeState; - } - - } - - /** - * This does a logical 'nor' operation. The state is 'calculated' by - * the normal 'or' operation and than negated by returning the opposite - * value. E.g. when the 'or' operation calculates the activeValue the - * passiveValue will be returned and vice versa. - */ - static class NOr extends Or { - - public NOr(@Nullable State activeValue, @Nullable State passiveValue) { - super(activeValue, passiveValue); - } - - @Override - public State calculate(@Nullable Set items) { - State result = super.calculate(items); - return activeState.equals(result) ? passiveState : activeState; - } - - } - - /** - * This calculates the numeric average over all item states of decimal type. - */ - static class Avg implements GroupFunction { - - public Avg() { - } - - @Override - public State calculate(@Nullable Set items) { - BigDecimal sum = BigDecimal.ZERO; - int count = 0; - if (items != null) { - for (Item item : items) { - DecimalType itemState = item.getStateAs(DecimalType.class); - if (itemState != null) { - sum = sum.add(itemState.toBigDecimal()); - count++; - } - } - } - if (count > 0) { - return new DecimalType(sum.divide(BigDecimal.valueOf(count), RoundingMode.HALF_UP)); - } else { - return UnDefType.UNDEF; - } - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[0]; - } - } - - /** - * This calculates the numeric sum over all item states of decimal type. - */ - static class Sum implements GroupFunction { - - public Sum() { - } - - @Override - public State calculate(@Nullable Set items) { - BigDecimal sum = BigDecimal.ZERO; - if (items != null) { - for (Item item : items) { - DecimalType itemState = item.getStateAs(DecimalType.class); - if (itemState != null) { - sum = sum.add(itemState.toBigDecimal()); - } - } - } - return new DecimalType(sum); - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[0]; - } - } - - /** - * This calculates the minimum value of all item states of decimal type. - */ - static class Min implements GroupFunction { - - public Min() { - } - - @Override - public State calculate(@Nullable Set items) { - if (items != null && !items.isEmpty()) { - BigDecimal min = null; - for (Item item : items) { - DecimalType itemState = item.getStateAs(DecimalType.class); - if (itemState != null) { - if (min == null || min.compareTo(itemState.toBigDecimal()) > 0) { - min = itemState.toBigDecimal(); - } - } - } - if (min != null) { - return new DecimalType(min); - } - } - return UnDefType.UNDEF; - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[0]; - } - } - - /** - * This calculates the maximum value of all item states of decimal type. - */ - static class Max implements GroupFunction { - - public Max() { - } - - @Override - public State calculate(@Nullable Set items) { - if (items != null && !items.isEmpty()) { - BigDecimal max = null; - for (Item item : items) { - DecimalType itemState = item.getStateAs(DecimalType.class); - if (itemState != null) { - if (max == null || max.compareTo(itemState.toBigDecimal()) < 0) { - max = itemState.toBigDecimal(); - } - } - } - if (max != null) { - return new DecimalType(max); - } - } - return UnDefType.UNDEF; - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[0]; - } - } - - /** - * This calculates the number of items in the group matching the - * regular expression passed in parameter - * Group:Number:COUNT(".") will count all items having a string state of one character - * Group:Number:COUNT("[5-9]") will count all items having a string state between 5 and 9 - * ... - */ - static class Count implements GroupFunction { - - protected final Pattern pattern; - - public Count(@Nullable State regExpr) { - if (regExpr == null) { - throw new IllegalArgumentException("Parameter must not be null!"); - } - this.pattern = Pattern.compile(regExpr.toString()); - } - - @Override - public State calculate(@Nullable Set items) { - int count = 0; - if (items != null) { - for (Item item : items) { - Matcher matcher = pattern.matcher(item.getState().toString()); - if (matcher.matches()) { - count++; - } - } - } - return new DecimalType(count); - } - - @Override - public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { - State state = calculate(items); - if (stateClass.isInstance(state)) { - return stateClass.cast(state); - } else { - return null; - } - } - - @Override - public State[] getParameters() { - return new State[] { new StringType(pattern.pattern()) }; - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.items.GroupFunction; +import org.openhab.core.items.Item; +import org.openhab.core.types.State; +import org.openhab.core.types.UnDefType; + +/** + * This interface is only a container for functions that require the core type library + * for its calculations. + * + * @author Kai Kreuzer - Initial contribution + * @author Thomas Eichstädt-Engelen - Added "N" functions + * @author Gaël L'hopital - Added count function + */ +@NonNullByDefault +public interface ArithmeticGroupFunction extends GroupFunction { + + /** + * This does a logical 'and' operation. Only if all items are of 'activeState' this + * is returned, otherwise the 'passiveState' is returned. + * + * Through the getStateAs() method, it can be determined, how many + * items actually are not in the 'activeState'. + */ + static class And implements GroupFunction { + + protected final State activeState; + protected final State passiveState; + + public And(@Nullable State activeValue, @Nullable State passiveValue) { + if (activeValue == null || passiveValue == null) { + throw new IllegalArgumentException("Parameters must not be null!"); + } + this.activeState = activeValue; + this.passiveState = passiveValue; + } + + @Override + public State calculate(@Nullable Set items) { + if (items == null || items.isEmpty()) { + // if we do not have any items, we return the passive state + return passiveState; + } else { + for (Item item : items) { + if (!activeState.equals(item.getStateAs(activeState.getClass()))) { + return passiveState; + } + } + return activeState; + } + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + if (stateClass == DecimalType.class) { + if (items != null) { + return stateClass.cast(new DecimalType(items.size() - count(items, activeState))); + } else { + return stateClass.cast(DecimalType.ZERO); + } + } else { + return null; + } + } + } + + private int count(Set items, State state) { + int count = 0; + for (Item item : items) { + if (state.equals(item.getStateAs(state.getClass()))) { + count++; + } + } + return count; + } + + @Override + public State[] getParameters() { + return new State[] { activeState, passiveState }; + } + } + + /** + * This does a logical 'or' operation. If at least one item is of 'activeState' this + * is returned, otherwise the 'passiveState' is returned. + * + * Through the getStateAs() method, it can be determined, how many + * items actually are in the 'activeState'. + */ + static class Or implements GroupFunction { + + protected final State activeState; + protected final State passiveState; + + public Or(@Nullable State activeValue, @Nullable State passiveValue) { + if (activeValue == null || passiveValue == null) { + throw new IllegalArgumentException("Parameters must not be null!"); + } + this.activeState = activeValue; + this.passiveState = passiveValue; + } + + @Override + public State calculate(@Nullable Set items) { + if (items != null) { + for (Item item : items) { + if (activeState.equals(item.getStateAs(activeState.getClass()))) { + return activeState; + } + } + } + return passiveState; + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + if (stateClass == DecimalType.class) { + if (items != null) { + return stateClass.cast(new DecimalType(count(items, activeState))); + } else { + return stateClass.cast(DecimalType.ZERO); + } + } else { + return null; + } + } + } + + private int count(Set items, State state) { + int count = 0; + for (Item item : items) { + if (state.equals(item.getStateAs(state.getClass()))) { + count++; + } + } + return count; + } + + @Override + public State[] getParameters() { + return new State[] { activeState, passiveState }; + } + } + + /** + * This does a logical 'nand' operation. The state is 'calculated' by + * the normal 'and' operation and than negated by returning the opposite + * value. E.g. when the 'and' operation calculates the activeValue the + * passiveValue will be returned and vice versa. + */ + static class NAnd extends And { + + public NAnd(@Nullable State activeValue, @Nullable State passiveValue) { + super(activeValue, passiveValue); + } + + @Override + public State calculate(@Nullable Set items) { + State result = super.calculate(items); + return activeState.equals(result) ? passiveState : activeState; + } + + } + + /** + * This does a logical 'nor' operation. The state is 'calculated' by + * the normal 'or' operation and than negated by returning the opposite + * value. E.g. when the 'or' operation calculates the activeValue the + * passiveValue will be returned and vice versa. + */ + static class NOr extends Or { + + public NOr(@Nullable State activeValue, @Nullable State passiveValue) { + super(activeValue, passiveValue); + } + + @Override + public State calculate(@Nullable Set items) { + State result = super.calculate(items); + return activeState.equals(result) ? passiveState : activeState; + } + + } + + /** + * This calculates the numeric average over all item states of decimal type. + */ + static class Avg implements GroupFunction { + + public Avg() { + } + + @Override + public State calculate(@Nullable Set items) { + BigDecimal sum = BigDecimal.ZERO; + int count = 0; + if (items != null) { + for (Item item : items) { + DecimalType itemState = item.getStateAs(DecimalType.class); + if (itemState != null) { + sum = sum.add(itemState.toBigDecimal()); + count++; + } + } + } + if (count > 0) { + return new DecimalType(sum.divide(BigDecimal.valueOf(count), RoundingMode.HALF_UP)); + } else { + return UnDefType.UNDEF; + } + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[0]; + } + } + + /** + * This calculates the numeric sum over all item states of decimal type. + */ + static class Sum implements GroupFunction { + + public Sum() { + } + + @Override + public State calculate(@Nullable Set items) { + BigDecimal sum = BigDecimal.ZERO; + if (items != null) { + for (Item item : items) { + DecimalType itemState = item.getStateAs(DecimalType.class); + if (itemState != null) { + sum = sum.add(itemState.toBigDecimal()); + } + } + } + return new DecimalType(sum); + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[0]; + } + } + + /** + * This calculates the minimum value of all item states of decimal type. + */ + static class Min implements GroupFunction { + + public Min() { + } + + @Override + public State calculate(@Nullable Set items) { + if (items != null && !items.isEmpty()) { + BigDecimal min = null; + for (Item item : items) { + DecimalType itemState = item.getStateAs(DecimalType.class); + if (itemState != null) { + if (min == null || min.compareTo(itemState.toBigDecimal()) > 0) { + min = itemState.toBigDecimal(); + } + } + } + if (min != null) { + return new DecimalType(min); + } + } + return UnDefType.UNDEF; + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[0]; + } + } + + /** + * This calculates the maximum value of all item states of decimal type. + */ + static class Max implements GroupFunction { + + public Max() { + } + + @Override + public State calculate(@Nullable Set items) { + if (items != null && !items.isEmpty()) { + BigDecimal max = null; + for (Item item : items) { + DecimalType itemState = item.getStateAs(DecimalType.class); + if (itemState != null) { + if (max == null || max.compareTo(itemState.toBigDecimal()) < 0) { + max = itemState.toBigDecimal(); + } + } + } + if (max != null) { + return new DecimalType(max); + } + } + return UnDefType.UNDEF; + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[0]; + } + } + + /** + * This calculates the number of items in the group matching the + * regular expression passed in parameter + * Group:Number:COUNT(".") will count all items having a string state of one character + * Group:Number:COUNT("[5-9]") will count all items having a string state between 5 and 9 + * ... + */ + static class Count implements GroupFunction { + + protected final Pattern pattern; + + public Count(@Nullable State regExpr) { + if (regExpr == null) { + throw new IllegalArgumentException("Parameter must not be null!"); + } + this.pattern = Pattern.compile(regExpr.toString()); + } + + @Override + public State calculate(@Nullable Set items) { + int count = 0; + if (items != null) { + for (Item item : items) { + Matcher matcher = pattern.matcher(item.getState().toString()); + if (matcher.matches()) { + count++; + } + } + } + return new DecimalType(count); + } + + @Override + public @Nullable T getStateAs(@Nullable Set items, Class stateClass) { + State state = calculate(items); + if (stateClass.isInstance(state)) { + return stateClass.cast(state); + } else { + return null; + } + } + + @Override + public State[] getParameters() { + return new State[] { new StringType(pattern.pattern()) }; + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DateTimeType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DateTimeType.java index 0f8f4348e..fa340ced3 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DateTimeType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DateTimeType.java @@ -1,265 +1,265 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.time.DateTimeException; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -import java.time.zone.ZoneRulesException; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.Locale; -import java.util.TimeZone; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * - * @author Kai Kreuzer - Initial contribution - * @author Erdoan Hadzhiyusein - Refactored to use ZonedDateTime - * @author Jan N. Klug - add ability to use time or date only - * @author Wouter Born - increase parsing and formatting precision - * @author Laurent Garnier - added methods toLocaleZone and toZone - * @author Gaël L'hopital - added ability to use second and milliseconds unix time - */ -@NonNullByDefault -public class DateTimeType implements PrimitiveType, State, Command { - - // external format patterns for output - public static final String DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; - public static final String DATE_PATTERN_WITH_TZ = "yyyy-MM-dd'T'HH:mm:ssz"; - // this pattern returns the time zone in RFC822 format - public static final String DATE_PATTERN_WITH_TZ_AND_MS = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; - public static final String DATE_PATTERN_WITH_TZ_AND_MS_GENERAL = "yyyy-MM-dd'T'HH:mm:ss.SSSz"; - public static final String DATE_PATTERN_WITH_TZ_AND_MS_ISO = "yyyy-MM-dd'T'HH:mm:ss.SSSX"; - - // internal patterns for parsing - private static final String DATE_PARSE_PATTERN_WITHOUT_TZ = "yyyy-MM-dd'T'HH:mm" - + "[:ss[.SSSSSSSSS][.SSSSSSSS][.SSSSSSS][.SSSSSS][.SSSSS][.SSSS][.SSS][.SS][.S]]"; - private static final String DATE_PARSE_PATTERN_WITH_TZ = DATE_PARSE_PATTERN_WITHOUT_TZ + "z"; - private static final String DATE_PARSE_PATTERN_WITH_TZ_RFC = DATE_PARSE_PATTERN_WITHOUT_TZ + "Z"; - private static final String DATE_PARSE_PATTERN_WITH_TZ_ISO = DATE_PARSE_PATTERN_WITHOUT_TZ + "X"; - - private static final DateTimeFormatter PARSER = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITHOUT_TZ); - private static final DateTimeFormatter PARSER_TZ = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ); - private static final DateTimeFormatter PARSER_TZ_RFC = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ_RFC); - private static final DateTimeFormatter PARSER_TZ_ISO = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ_ISO); - - // internal patterns for formatting - private static final String DATE_FORMAT_PATTERN_WITH_TZ_RFC = "yyyy-MM-dd'T'HH:mm[:ss[.SSSSSSSSS]]Z"; - private static final DateTimeFormatter FORMATTER_TZ_RFC = DateTimeFormatter - .ofPattern(DATE_FORMAT_PATTERN_WITH_TZ_RFC); - - private ZonedDateTime zonedDateTime; - - /** - * @deprecated The constructor uses Calendar object hence it doesn't store time zone. A new constructor is - * available. Use {@link #DateTimeType(ZonedDateTime)} instead. - * - * @param calendar The Calendar object containing the time stamp. - */ - @Deprecated - public DateTimeType(Calendar calendar) { - this.zonedDateTime = ZonedDateTime.ofInstant(calendar.toInstant(), TimeZone.getDefault().toZoneId()) - .withFixedOffsetZone(); - } - - public DateTimeType() { - this(ZonedDateTime.now()); - } - - public DateTimeType(ZonedDateTime zoned) { - this.zonedDateTime = ZonedDateTime.from(zoned).withFixedOffsetZone(); - } - - public DateTimeType(String zonedValue) { - ZonedDateTime date = null; - - try { - // direct parsing (date and time) - try { - date = parse(zonedValue); - } catch (DateTimeParseException fullDtException) { - // time only - try { - date = parse("1970-01-01T" + zonedValue); - } catch (DateTimeParseException timeOnlyException) { - try { - long epoch = Double.valueOf(zonedValue).longValue(); - int length = (int) (Math.log10(epoch >= 0 ? epoch : epoch * -1) + 1); - Instant i; - // Assume that below 12 digits we're in seconds - if (length < 12) { - i = Instant.ofEpochSecond(epoch); - } else { - i = Instant.ofEpochMilli(epoch); - } - date = ZonedDateTime.ofInstant(i, ZoneOffset.UTC); - } catch (NumberFormatException notANumberException) { - // date only - if (zonedValue.length() == 10) { - date = parse(zonedValue + "T00:00:00"); - } else { - date = parse(zonedValue.substring(0, 10) + "T00:00:00" + zonedValue.substring(10)); - } - } - } - } - } catch (DateTimeParseException invalidFormatException) { - throw new IllegalArgumentException(zonedValue + " is not in a valid format.", invalidFormatException); - } - - zonedDateTime = date.withFixedOffsetZone(); - } - - /** - * @deprecated The method is deprecated. You can use {@link #getZonedDateTime()} instead. - */ - @Deprecated - public Calendar getCalendar() { - return GregorianCalendar.from(zonedDateTime); - } - - public ZonedDateTime getZonedDateTime() { - return zonedDateTime; - } - - public static DateTimeType valueOf(String value) { - return new DateTimeType(value); - } - - @Override - public String format(@Nullable String pattern) { - if (pattern == null) { - return DateTimeFormatter.ofPattern(DATE_PATTERN).format(zonedDateTime); - } - - return String.format(pattern, zonedDateTime); - } - - public String format(Locale locale, String pattern) { - return String.format(locale, pattern, zonedDateTime); - } - - /** - * Create a {@link DateTimeType} being the translation of the current object to the locale time zone - * - * @return a {@link DateTimeType} translated to the locale time zone - * @throws DateTimeException if the converted zone ID has an invalid format or the result exceeds the supported date - * range - * @throws ZoneRulesException if the converted zone region ID cannot be found - */ - public DateTimeType toLocaleZone() throws DateTimeException, ZoneRulesException { - return toZone(ZoneId.systemDefault()); - } - - /** - * Create a {@link DateTimeType} being the translation of the current object to a given zone - * - * @param zone the target zone as a string - * @return a {@link DateTimeType} translated to the given zone - * @throws DateTimeException if the zone has an invalid format or the result exceeds the supported date range - * @throws ZoneRulesException if the zone is a region ID that cannot be found - */ - public DateTimeType toZone(String zone) throws DateTimeException, ZoneRulesException { - return toZone(ZoneId.of(zone)); - } - - /** - * Create a {@link DateTimeType} being the translation of the current object to a given zone - * - * @param zoneId the target {@link ZoneId} - * @return a {@link DateTimeType} translated to the given zone - * @throws DateTimeException if the result exceeds the supported date range - */ - public DateTimeType toZone(ZoneId zoneId) throws DateTimeException { - return new DateTimeType(zonedDateTime.withZoneSameInstant(zoneId)); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - String formatted = zonedDateTime.format(FORMATTER_TZ_RFC); - if (formatted.contains(".")) { - String sign = ""; - if (formatted.contains("+")) { - sign = "+"; - } else if (formatted.contains("-")) { - sign = "-"; - } - if (!sign.isEmpty()) { - // the formatted string contains 9 fraction-of-second digits - // truncate at most 2 trailing groups of 000s - return formatted.replace("000" + sign, sign).replace("000" + sign, sign); - } - } - return formatted; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + getZonedDateTime().hashCode(); - return result; - } - - @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - DateTimeType other = (DateTimeType) obj; - return zonedDateTime.compareTo(other.zonedDateTime) == 0; - } - - private ZonedDateTime parse(String value) throws DateTimeParseException { - ZonedDateTime date = null; - try { - date = ZonedDateTime.parse(value, PARSER_TZ_RFC); - } catch (DateTimeParseException tzMsRfcException) { - try { - date = ZonedDateTime.parse(value, PARSER_TZ_ISO); - } catch (DateTimeParseException tzMsIsoException) { - try { - date = ZonedDateTime.parse(value, PARSER_TZ); - } catch (DateTimeParseException tzException) { - LocalDateTime localDateTime = LocalDateTime.parse(value, PARSER); - date = ZonedDateTime.of(localDateTime, ZoneId.systemDefault()); - } - } - } - - return date; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.time.DateTimeException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.time.zone.ZoneRulesException; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Locale; +import java.util.TimeZone; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * + * @author Kai Kreuzer - Initial contribution + * @author Erdoan Hadzhiyusein - Refactored to use ZonedDateTime + * @author Jan N. Klug - add ability to use time or date only + * @author Wouter Born - increase parsing and formatting precision + * @author Laurent Garnier - added methods toLocaleZone and toZone + * @author Gaël L'hopital - added ability to use second and milliseconds unix time + */ +@NonNullByDefault +public class DateTimeType implements PrimitiveType, State, Command { + + // external format patterns for output + public static final String DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss"; + public static final String DATE_PATTERN_WITH_TZ = "yyyy-MM-dd'T'HH:mm:ssz"; + // this pattern returns the time zone in RFC822 format + public static final String DATE_PATTERN_WITH_TZ_AND_MS = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + public static final String DATE_PATTERN_WITH_TZ_AND_MS_GENERAL = "yyyy-MM-dd'T'HH:mm:ss.SSSz"; + public static final String DATE_PATTERN_WITH_TZ_AND_MS_ISO = "yyyy-MM-dd'T'HH:mm:ss.SSSX"; + + // internal patterns for parsing + private static final String DATE_PARSE_PATTERN_WITHOUT_TZ = "yyyy-MM-dd'T'HH:mm" + + "[:ss[.SSSSSSSSS][.SSSSSSSS][.SSSSSSS][.SSSSSS][.SSSSS][.SSSS][.SSS][.SS][.S]]"; + private static final String DATE_PARSE_PATTERN_WITH_TZ = DATE_PARSE_PATTERN_WITHOUT_TZ + "z"; + private static final String DATE_PARSE_PATTERN_WITH_TZ_RFC = DATE_PARSE_PATTERN_WITHOUT_TZ + "Z"; + private static final String DATE_PARSE_PATTERN_WITH_TZ_ISO = DATE_PARSE_PATTERN_WITHOUT_TZ + "X"; + + private static final DateTimeFormatter PARSER = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITHOUT_TZ); + private static final DateTimeFormatter PARSER_TZ = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ); + private static final DateTimeFormatter PARSER_TZ_RFC = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ_RFC); + private static final DateTimeFormatter PARSER_TZ_ISO = DateTimeFormatter.ofPattern(DATE_PARSE_PATTERN_WITH_TZ_ISO); + + // internal patterns for formatting + private static final String DATE_FORMAT_PATTERN_WITH_TZ_RFC = "yyyy-MM-dd'T'HH:mm[:ss[.SSSSSSSSS]]Z"; + private static final DateTimeFormatter FORMATTER_TZ_RFC = DateTimeFormatter + .ofPattern(DATE_FORMAT_PATTERN_WITH_TZ_RFC); + + private ZonedDateTime zonedDateTime; + + /** + * @deprecated The constructor uses Calendar object hence it doesn't store time zone. A new constructor is + * available. Use {@link #DateTimeType(ZonedDateTime)} instead. + * + * @param calendar The Calendar object containing the time stamp. + */ + @Deprecated + public DateTimeType(Calendar calendar) { + this.zonedDateTime = ZonedDateTime.ofInstant(calendar.toInstant(), TimeZone.getDefault().toZoneId()) + .withFixedOffsetZone(); + } + + public DateTimeType() { + this(ZonedDateTime.now()); + } + + public DateTimeType(ZonedDateTime zoned) { + this.zonedDateTime = ZonedDateTime.from(zoned).withFixedOffsetZone(); + } + + public DateTimeType(String zonedValue) { + ZonedDateTime date = null; + + try { + // direct parsing (date and time) + try { + date = parse(zonedValue); + } catch (DateTimeParseException fullDtException) { + // time only + try { + date = parse("1970-01-01T" + zonedValue); + } catch (DateTimeParseException timeOnlyException) { + try { + long epoch = Double.valueOf(zonedValue).longValue(); + int length = (int) (Math.log10(epoch >= 0 ? epoch : epoch * -1) + 1); + Instant i; + // Assume that below 12 digits we're in seconds + if (length < 12) { + i = Instant.ofEpochSecond(epoch); + } else { + i = Instant.ofEpochMilli(epoch); + } + date = ZonedDateTime.ofInstant(i, ZoneOffset.UTC); + } catch (NumberFormatException notANumberException) { + // date only + if (zonedValue.length() == 10) { + date = parse(zonedValue + "T00:00:00"); + } else { + date = parse(zonedValue.substring(0, 10) + "T00:00:00" + zonedValue.substring(10)); + } + } + } + } + } catch (DateTimeParseException invalidFormatException) { + throw new IllegalArgumentException(zonedValue + " is not in a valid format.", invalidFormatException); + } + + zonedDateTime = date.withFixedOffsetZone(); + } + + /** + * @deprecated The method is deprecated. You can use {@link #getZonedDateTime()} instead. + */ + @Deprecated + public Calendar getCalendar() { + return GregorianCalendar.from(zonedDateTime); + } + + public ZonedDateTime getZonedDateTime() { + return zonedDateTime; + } + + public static DateTimeType valueOf(String value) { + return new DateTimeType(value); + } + + @Override + public String format(@Nullable String pattern) { + if (pattern == null) { + return DateTimeFormatter.ofPattern(DATE_PATTERN).format(zonedDateTime); + } + + return String.format(pattern, zonedDateTime); + } + + public String format(Locale locale, String pattern) { + return String.format(locale, pattern, zonedDateTime); + } + + /** + * Create a {@link DateTimeType} being the translation of the current object to the locale time zone + * + * @return a {@link DateTimeType} translated to the locale time zone + * @throws DateTimeException if the converted zone ID has an invalid format or the result exceeds the supported date + * range + * @throws ZoneRulesException if the converted zone region ID cannot be found + */ + public DateTimeType toLocaleZone() throws DateTimeException, ZoneRulesException { + return toZone(ZoneId.systemDefault()); + } + + /** + * Create a {@link DateTimeType} being the translation of the current object to a given zone + * + * @param zone the target zone as a string + * @return a {@link DateTimeType} translated to the given zone + * @throws DateTimeException if the zone has an invalid format or the result exceeds the supported date range + * @throws ZoneRulesException if the zone is a region ID that cannot be found + */ + public DateTimeType toZone(String zone) throws DateTimeException, ZoneRulesException { + return toZone(ZoneId.of(zone)); + } + + /** + * Create a {@link DateTimeType} being the translation of the current object to a given zone + * + * @param zoneId the target {@link ZoneId} + * @return a {@link DateTimeType} translated to the given zone + * @throws DateTimeException if the result exceeds the supported date range + */ + public DateTimeType toZone(ZoneId zoneId) throws DateTimeException { + return new DateTimeType(zonedDateTime.withZoneSameInstant(zoneId)); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + String formatted = zonedDateTime.format(FORMATTER_TZ_RFC); + if (formatted.contains(".")) { + String sign = ""; + if (formatted.contains("+")) { + sign = "+"; + } else if (formatted.contains("-")) { + sign = "-"; + } + if (!sign.isEmpty()) { + // the formatted string contains 9 fraction-of-second digits + // truncate at most 2 trailing groups of 000s + return formatted.replace("000" + sign, sign).replace("000" + sign, sign); + } + } + return formatted; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getZonedDateTime().hashCode(); + return result; + } + + @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + DateTimeType other = (DateTimeType) obj; + return zonedDateTime.compareTo(other.zonedDateTime) == 0; + } + + private ZonedDateTime parse(String value) throws DateTimeParseException { + ZonedDateTime date = null; + try { + date = ZonedDateTime.parse(value, PARSER_TZ_RFC); + } catch (DateTimeParseException tzMsRfcException) { + try { + date = ZonedDateTime.parse(value, PARSER_TZ_ISO); + } catch (DateTimeParseException tzMsIsoException) { + try { + date = ZonedDateTime.parse(value, PARSER_TZ); + } catch (DateTimeParseException tzException) { + LocalDateTime localDateTime = LocalDateTime.parse(value, PARSER); + date = ZonedDateTime.of(localDateTime, ZoneId.systemDefault()); + } + } + } + + return date; + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java index f104013cd..b5bbe9534 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/DecimalType.java @@ -1,179 +1,179 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.math.BigDecimal; -import java.util.IllegalFormatConversionException; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * The decimal type uses a BigDecimal internally and thus can be used for - * integers, longs and floating point numbers alike. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class DecimalType extends Number implements PrimitiveType, State, Command, Comparable { - - private static final long serialVersionUID = 4226845847123464690L; - - public static final DecimalType ZERO = new DecimalType(0); - - protected BigDecimal value; - - public DecimalType() { - this.value = BigDecimal.ZERO; - } - - public DecimalType(BigDecimal value) { - this.value = value; - } - - public DecimalType(long value) { - this.value = BigDecimal.valueOf(value); - } - - public DecimalType(double value) { - this.value = BigDecimal.valueOf(value); - } - - public DecimalType(String value) { - this.value = new BigDecimal(value); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return value.toPlainString(); - } - - public static DecimalType valueOf(String value) { - return new DecimalType(value); - } - - @Override - public String format(String pattern) { - // The value could be an integer value. Try to convert to BigInteger in - // order to have access to more conversion formats. - try { - return String.format(pattern, value.toBigIntegerExact()); - } catch (ArithmeticException ae) { - // Could not convert to integer value without loss of - // information. Fall through to default behavior. - } catch (IllegalFormatConversionException ifce) { - // The conversion is not valid for the type BigInteger. This - // happens, if the format is like "%.1f" but the value is an - // integer. Fall through to default behavior. - } - - return String.format(pattern, value); - } - - public BigDecimal toBigDecimal() { - return value; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + value.hashCode(); - return result; - } - - @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof DecimalType)) { - return false; - } - DecimalType other = (DecimalType) obj; - return value.compareTo(other.value) == 0; - } - - @Override - public int compareTo(DecimalType o) { - return value.compareTo(o.toBigDecimal()); - } - - @Override - public double doubleValue() { - return value.doubleValue(); - } - - @Override - public float floatValue() { - return value.floatValue(); - } - - @Override - public int intValue() { - return value.intValue(); - } - - @Override - public long longValue() { - return value.longValue(); - } - - protected @Nullable T defaultConversion(@Nullable Class target) { - return State.super.as(target); - } - - @Override - public @Nullable T as(@Nullable Class target) { - if (target == OnOffType.class) { - return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); - } else if (target == PercentType.class) { - return target.cast(new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100)))); - } else if (target == UpDownType.class) { - if (equals(ZERO)) { - return target.cast(UpDownType.UP); - } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { - return target.cast(UpDownType.DOWN); - } else { - return null; - } - } else if (target == OpenClosedType.class) { - if (equals(ZERO)) { - return target.cast(OpenClosedType.CLOSED); - } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { - return target.cast(OpenClosedType.OPEN); - } else { - return null; - } - } else if (target == HSBType.class) { - return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, - new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100))))); - } else if (target == DateTimeType.class) { - return target.cast(new DateTimeType(value.toString())); - } else { - return defaultConversion(target); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.math.BigDecimal; +import java.util.IllegalFormatConversionException; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * The decimal type uses a BigDecimal internally and thus can be used for + * integers, longs and floating point numbers alike. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class DecimalType extends Number implements PrimitiveType, State, Command, Comparable { + + private static final long serialVersionUID = 4226845847123464690L; + + public static final DecimalType ZERO = new DecimalType(0); + + protected BigDecimal value; + + public DecimalType() { + this.value = BigDecimal.ZERO; + } + + public DecimalType(BigDecimal value) { + this.value = value; + } + + public DecimalType(long value) { + this.value = BigDecimal.valueOf(value); + } + + public DecimalType(double value) { + this.value = BigDecimal.valueOf(value); + } + + public DecimalType(String value) { + this.value = new BigDecimal(value); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return value.toPlainString(); + } + + public static DecimalType valueOf(String value) { + return new DecimalType(value); + } + + @Override + public String format(String pattern) { + // The value could be an integer value. Try to convert to BigInteger in + // order to have access to more conversion formats. + try { + return String.format(pattern, value.toBigIntegerExact()); + } catch (ArithmeticException ae) { + // Could not convert to integer value without loss of + // information. Fall through to default behavior. + } catch (IllegalFormatConversionException ifce) { + // The conversion is not valid for the type BigInteger. This + // happens, if the format is like "%.1f" but the value is an + // integer. Fall through to default behavior. + } + + return String.format(pattern, value); + } + + public BigDecimal toBigDecimal() { + return value; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + value.hashCode(); + return result; + } + + @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof DecimalType)) { + return false; + } + DecimalType other = (DecimalType) obj; + return value.compareTo(other.value) == 0; + } + + @Override + public int compareTo(DecimalType o) { + return value.compareTo(o.toBigDecimal()); + } + + @Override + public double doubleValue() { + return value.doubleValue(); + } + + @Override + public float floatValue() { + return value.floatValue(); + } + + @Override + public int intValue() { + return value.intValue(); + } + + @Override + public long longValue() { + return value.longValue(); + } + + protected @Nullable T defaultConversion(@Nullable Class target) { + return State.super.as(target); + } + + @Override + public @Nullable T as(@Nullable Class target) { + if (target == OnOffType.class) { + return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); + } else if (target == PercentType.class) { + return target.cast(new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100)))); + } else if (target == UpDownType.class) { + if (equals(ZERO)) { + return target.cast(UpDownType.UP); + } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { + return target.cast(UpDownType.DOWN); + } else { + return null; + } + } else if (target == OpenClosedType.class) { + if (equals(ZERO)) { + return target.cast(OpenClosedType.CLOSED); + } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { + return target.cast(OpenClosedType.OPEN); + } else { + return null; + } + } else if (target == HSBType.class) { + return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, + new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100))))); + } else if (target == DateTimeType.class) { + return target.cast(new DateTimeType(value.toString())); + } else { + return defaultConversion(target); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/IncreaseDecreaseType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/IncreaseDecreaseType.java index c5aa49c01..f3ffe59e8 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/IncreaseDecreaseType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/IncreaseDecreaseType.java @@ -1,43 +1,43 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum IncreaseDecreaseType implements PrimitiveType, Command { - INCREASE, - DECREASE; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum IncreaseDecreaseType implements PrimitiveType, Command { + INCREASE, + DECREASE; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/NextPreviousType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/NextPreviousType.java index 6a852cf73..2a3772f56 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/NextPreviousType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/NextPreviousType.java @@ -1,45 +1,45 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.library.items.PlayerItem; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; - -/** - * This type is used by the {@link PlayerItem}. - * - * @author Alex Tugarev - Initial contribution - */ -@NonNullByDefault -public enum NextPreviousType implements PrimitiveType, Command { - NEXT, - PREVIOUS; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.library.items.PlayerItem; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; + +/** + * This type is used by the {@link PlayerItem}. + * + * @author Alex Tugarev - Initial contribution + */ +@NonNullByDefault +public enum NextPreviousType implements PrimitiveType, Command { + NEXT, + PREVIOUS; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OnOffType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OnOffType.java index 0cde58ccc..174dc76d9 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OnOffType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OnOffType.java @@ -1,76 +1,76 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum OnOffType implements PrimitiveType, State, Command { - ON, - OFF; - - /** - * Converts a String value "ON" or "1" to {@link OnOffType#ON} or else to {@link OnOffType#OFF}. - * - * @param state String to convert to {@link OnOffType} - * @return returns the ON or OFF state based on the String - */ - public static OnOffType from(String state) { - return from("ON".equalsIgnoreCase(state) || "1".equalsIgnoreCase(state)); - } - - /** - * @param state boolean to convert to {@link OnOffType} - * @return returns the ON or OFF state based on the boolean - */ - public static OnOffType from(boolean state) { - return state ? ON : OFF; - } - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - - @Override - public @Nullable T as(@Nullable Class target) { - if (target == DecimalType.class) { - return target.cast(this == ON ? new DecimalType(1) : DecimalType.ZERO); - } else if (target == PercentType.class) { - return target.cast(this == ON ? PercentType.HUNDRED : PercentType.ZERO); - } else if (target == HSBType.class) { - return target.cast(this == ON ? HSBType.WHITE : HSBType.BLACK); - } else { - return State.super.as(target); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum OnOffType implements PrimitiveType, State, Command { + ON, + OFF; + + /** + * Converts a String value "ON" or "1" to {@link OnOffType#ON} or else to {@link OnOffType#OFF}. + * + * @param state String to convert to {@link OnOffType} + * @return returns the ON or OFF state based on the String + */ + public static OnOffType from(String state) { + return from("ON".equalsIgnoreCase(state) || "1".equalsIgnoreCase(state)); + } + + /** + * @param state boolean to convert to {@link OnOffType} + * @return returns the ON or OFF state based on the boolean + */ + public static OnOffType from(boolean state) { + return state ? ON : OFF; + } + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + + @Override + public @Nullable T as(@Nullable Class target) { + if (target == DecimalType.class) { + return target.cast(this == ON ? new DecimalType(1) : DecimalType.ZERO); + } else if (target == PercentType.class) { + return target.cast(this == ON ? PercentType.HUNDRED : PercentType.ZERO); + } else if (target == HSBType.class) { + return target.cast(this == ON ? HSBType.WHITE : HSBType.BLACK); + } else { + return State.super.as(target); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OpenClosedType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OpenClosedType.java index 27771f0d7..088e1e0ad 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OpenClosedType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/OpenClosedType.java @@ -1,56 +1,56 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum OpenClosedType implements PrimitiveType, State, Command { - OPEN, - CLOSED; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - - @Override - public @Nullable T as(@Nullable Class target) { - if (target == DecimalType.class) { - return target.cast(this == OPEN ? new DecimalType(1) : DecimalType.ZERO); - } else if (target == PercentType.class) { - return target.cast(this == OPEN ? PercentType.HUNDRED : PercentType.ZERO); - } else { - return State.super.as(target); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum OpenClosedType implements PrimitiveType, State, Command { + OPEN, + CLOSED; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + + @Override + public @Nullable T as(@Nullable Class target) { + if (target == DecimalType.class) { + return target.cast(this == OPEN ? new DecimalType(1) : DecimalType.ZERO); + } else if (target == PercentType.class) { + return target.cast(this == OPEN ? PercentType.HUNDRED : PercentType.ZERO); + } else { + return State.super.as(target); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java index aed460593..87c6ff514 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PercentType.java @@ -1,96 +1,96 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.math.BigDecimal; -import java.math.RoundingMode; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.library.unit.SmartHomeUnits; -import org.openhab.core.types.State; - -/** - * The PercentType extends the {@link DecimalType} by putting constraints for its value on top (0-100). - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class PercentType extends DecimalType { - - private static final long serialVersionUID = -9066279845951780879L; - - public static final PercentType ZERO = new PercentType(0); - public static final PercentType HUNDRED = new PercentType(100); - - public PercentType() { - this(0); - } - - public PercentType(int value) { - super(value); - validateValue(this.value); - } - - public PercentType(String value) { - super(value); - validateValue(this.value); - } - - public PercentType(BigDecimal value) { - super(value); - validateValue(this.value); - } - - private void validateValue(BigDecimal value) { - if (BigDecimal.ZERO.compareTo(value) > 0 || BigDecimal.valueOf(100).compareTo(value) < 0) { - throw new IllegalArgumentException("Value must be between 0 and 100"); - } - } - - public static PercentType valueOf(String value) { - return new PercentType(value); - } - - @Override - public @Nullable T as(@Nullable Class target) { - if (target == OnOffType.class) { - return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); - } else if (target == DecimalType.class) { - return target.cast(new DecimalType(toBigDecimal().divide(BigDecimal.valueOf(100), 8, RoundingMode.UP))); - } else if (target == UpDownType.class) { - if (equals(ZERO)) { - return target.cast(UpDownType.UP); - } else if (equals(HUNDRED)) { - return target.cast(UpDownType.DOWN); - } else { - return null; - } - } else if (target == OpenClosedType.class) { - if (equals(ZERO)) { - return target.cast(OpenClosedType.CLOSED); - } else if (equals(HUNDRED)) { - return target.cast(OpenClosedType.OPEN); - } else { - return null; - } - } else if (target == HSBType.class) { - return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, this)); - } else if (target == QuantityType.class) { - return target.cast(new QuantityType<>(toBigDecimal().doubleValue(), SmartHomeUnits.PERCENT)); - } else { - return defaultConversion(target); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.library.unit.SmartHomeUnits; +import org.openhab.core.types.State; + +/** + * The PercentType extends the {@link DecimalType} by putting constraints for its value on top (0-100). + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class PercentType extends DecimalType { + + private static final long serialVersionUID = -9066279845951780879L; + + public static final PercentType ZERO = new PercentType(0); + public static final PercentType HUNDRED = new PercentType(100); + + public PercentType() { + this(0); + } + + public PercentType(int value) { + super(value); + validateValue(this.value); + } + + public PercentType(String value) { + super(value); + validateValue(this.value); + } + + public PercentType(BigDecimal value) { + super(value); + validateValue(this.value); + } + + private void validateValue(BigDecimal value) { + if (BigDecimal.ZERO.compareTo(value) > 0 || BigDecimal.valueOf(100).compareTo(value) < 0) { + throw new IllegalArgumentException("Value must be between 0 and 100"); + } + } + + public static PercentType valueOf(String value) { + return new PercentType(value); + } + + @Override + public @Nullable T as(@Nullable Class target) { + if (target == OnOffType.class) { + return target.cast(equals(ZERO) ? OnOffType.OFF : OnOffType.ON); + } else if (target == DecimalType.class) { + return target.cast(new DecimalType(toBigDecimal().divide(BigDecimal.valueOf(100), 8, RoundingMode.UP))); + } else if (target == UpDownType.class) { + if (equals(ZERO)) { + return target.cast(UpDownType.UP); + } else if (equals(HUNDRED)) { + return target.cast(UpDownType.DOWN); + } else { + return null; + } + } else if (target == OpenClosedType.class) { + if (equals(ZERO)) { + return target.cast(OpenClosedType.CLOSED); + } else if (equals(HUNDRED)) { + return target.cast(OpenClosedType.OPEN); + } else { + return null; + } + } else if (target == HSBType.class) { + return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, this)); + } else if (target == QuantityType.class) { + return target.cast(new QuantityType<>(toBigDecimal().doubleValue(), SmartHomeUnits.PERCENT)); + } else { + return defaultConversion(target); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PlayPauseType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PlayPauseType.java index 1c0bfddb8..0d248dd57 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PlayPauseType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/PlayPauseType.java @@ -1,46 +1,46 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.library.items.PlayerItem; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * This type is used by the {@link PlayerItem}. - * - * @author Alex Tugarev - Initial contribution - */ -@NonNullByDefault -public enum PlayPauseType implements PrimitiveType, State, Command { - PLAY, - PAUSE; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.library.items.PlayerItem; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * This type is used by the {@link PlayerItem}. + * + * @author Alex Tugarev - Initial contribution + */ +@NonNullByDefault +public enum PlayPauseType implements PrimitiveType, State, Command { + PLAY, + PAUSE; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java index 9fca8e3af..4cfd9ffde 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/QuantityType.java @@ -313,8 +313,8 @@ public class QuantityType> extends Number return null; } } else if (target == HSBType.class) { - return target.cast(new HSBType(DecimalType.ZERO, PercentType.ZERO, - new PercentType(toBigDecimal().multiply(HUNDRED)))); + return target.cast( + new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(toBigDecimal().multiply(HUNDRED)))); } else if (target == PercentType.class) { if (SmartHomeUnits.PERCENT.equals(getUnit())) { return target.cast(new PercentType(toBigDecimal())); diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RawType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RawType.java index 0545fa9a4..513e3be81 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RawType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RawType.java @@ -1,120 +1,120 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.util.Arrays; -import java.util.Base64; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * This type can be used for all binary data such as images, documents, sounds etc. - * Note that it is NOT adequate for any kind of streams, but only for fixed-size data. - * - * @author Kai Kreuzer - Initial contribution - * @author Laurent Garnier - add MIME type - */ -@NonNullByDefault -public class RawType implements PrimitiveType, State { - - public static final String DEFAULT_MIME_TYPE = "application/octet-stream"; - - protected byte[] bytes; - protected String mimeType; - - @Deprecated - public RawType() { - this(new byte[0], DEFAULT_MIME_TYPE); - } - - @Deprecated - public RawType(byte[] bytes) { - this(bytes, DEFAULT_MIME_TYPE); - } - - public RawType(byte[] bytes, String mimeType) { - if (mimeType.isEmpty()) { - throw new IllegalArgumentException("mimeType argument must not be blank"); - } - this.bytes = bytes; - this.mimeType = mimeType; - } - - public byte[] getBytes() { - return bytes; - } - - public String getMimeType() { - return mimeType; - } - - public static RawType valueOf(String value) { - int idx, idx2; - if (value.isEmpty()) { - throw new IllegalArgumentException("Argument must not be blank"); - } else if (!value.startsWith("data:") || ((idx = value.indexOf(",")) < 0)) { - throw new IllegalArgumentException("Invalid data URI syntax for argument " + value); - } else if ((idx2 = value.indexOf(";")) <= 5) { - throw new IllegalArgumentException("Missing MIME type in argument " + value); - } - return new RawType(Base64.getDecoder().decode(value.substring(idx + 1)), value.substring(5, idx2)); - } - - @Override - public String toString() { - return String.format("raw type (%s): %d bytes", mimeType, bytes.length); - } - - @Override - public String toFullString() { - return String.format("data:%s;base64,%s", mimeType, Base64.getEncoder().encodeToString(bytes)); - } - - @Override - public String format(String pattern) { - return toFullString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode(bytes); - return result; - } - - @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - RawType other = (RawType) obj; - if (!mimeType.equals(other.mimeType)) { - return false; - } - if (!Arrays.equals(bytes, other.bytes)) { - return false; - } - return true; - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.util.Arrays; +import java.util.Base64; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * This type can be used for all binary data such as images, documents, sounds etc. + * Note that it is NOT adequate for any kind of streams, but only for fixed-size data. + * + * @author Kai Kreuzer - Initial contribution + * @author Laurent Garnier - add MIME type + */ +@NonNullByDefault +public class RawType implements PrimitiveType, State { + + public static final String DEFAULT_MIME_TYPE = "application/octet-stream"; + + protected byte[] bytes; + protected String mimeType; + + @Deprecated + public RawType() { + this(new byte[0], DEFAULT_MIME_TYPE); + } + + @Deprecated + public RawType(byte[] bytes) { + this(bytes, DEFAULT_MIME_TYPE); + } + + public RawType(byte[] bytes, String mimeType) { + if (mimeType.isEmpty()) { + throw new IllegalArgumentException("mimeType argument must not be blank"); + } + this.bytes = bytes; + this.mimeType = mimeType; + } + + public byte[] getBytes() { + return bytes; + } + + public String getMimeType() { + return mimeType; + } + + public static RawType valueOf(String value) { + int idx, idx2; + if (value.isEmpty()) { + throw new IllegalArgumentException("Argument must not be blank"); + } else if (!value.startsWith("data:") || ((idx = value.indexOf(",")) < 0)) { + throw new IllegalArgumentException("Invalid data URI syntax for argument " + value); + } else if ((idx2 = value.indexOf(";")) <= 5) { + throw new IllegalArgumentException("Missing MIME type in argument " + value); + } + return new RawType(Base64.getDecoder().decode(value.substring(idx + 1)), value.substring(5, idx2)); + } + + @Override + public String toString() { + return String.format("raw type (%s): %d bytes", mimeType, bytes.length); + } + + @Override + public String toFullString() { + return String.format("data:%s;base64,%s", mimeType, Base64.getEncoder().encodeToString(bytes)); + } + + @Override + public String format(String pattern) { + return toFullString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode(bytes); + return result; + } + + @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + RawType other = (RawType) obj; + if (!mimeType.equals(other.mimeType)) { + return false; + } + if (!Arrays.equals(bytes, other.bytes)) { + return false; + } + return true; + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RewindFastforwardType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RewindFastforwardType.java index a7b4a456e..12f61621d 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RewindFastforwardType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/RewindFastforwardType.java @@ -1,46 +1,46 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.library.items.PlayerItem; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * This type is used by the {@link PlayerItem}. - * - * @author Alex Tugarev - Initial contribution - */ -@NonNullByDefault -public enum RewindFastforwardType implements PrimitiveType, State, Command { - REWIND, - FASTFORWARD; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.library.items.PlayerItem; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * This type is used by the {@link PlayerItem}. + * + * @author Alex Tugarev - Initial contribution + */ +@NonNullByDefault +public enum RewindFastforwardType implements PrimitiveType, State, Command { + REWIND, + FASTFORWARD; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StopMoveType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StopMoveType.java index 860de34ac..4267dcdec 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StopMoveType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StopMoveType.java @@ -1,43 +1,43 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum StopMoveType implements PrimitiveType, Command { - STOP, - MOVE; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum StopMoveType implements PrimitiveType, Command { + STOP, + MOVE; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringListType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringListType.java index a36156e41..cba088182 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringListType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringListType.java @@ -78,7 +78,7 @@ public class StringListType implements Command, State { * (alphabetical) order of their keys. * * @param pattern the pattern to use containing indexes to reference the - * single elements of this type. + * single elements of this type. */ @Override public String format(String pattern) { diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringType.java index 0e4408e9d..63ada4fd2 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/StringType.java @@ -1,84 +1,84 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.util.Objects; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public class StringType implements PrimitiveType, State, Command { - - public static final StringType EMPTY = new StringType(); - - private final String value; - - public StringType() { - this(""); - } - - public StringType(@Nullable String value) { - this.value = value != null ? value : ""; - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return value; - } - - public static StringType valueOf(@Nullable String value) { - return new StringType(value); - } - - @Override - public String format(String pattern) { - return String.format(pattern, value); - } - - @Override - public int hashCode() { - return value.hashCode(); - } - - @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (obj instanceof String) { - return obj.equals(value); - } - if (getClass() != obj.getClass()) { - return false; - } - StringType other = (StringType) obj; - return Objects.equals(this.value, other.value); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.util.Objects; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public class StringType implements PrimitiveType, State, Command { + + public static final StringType EMPTY = new StringType(); + + private final String value; + + public StringType() { + this(""); + } + + public StringType(@Nullable String value) { + this.value = value != null ? value : ""; + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return value; + } + + public static StringType valueOf(@Nullable String value) { + return new StringType(value); + } + + @Override + public String format(String pattern) { + return String.format(pattern, value); + } + + @Override + public int hashCode() { + return value.hashCode(); + } + + @Override + public boolean equals(@Nullable Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (obj instanceof String) { + return obj.equals(value); + } + if (getClass() != obj.getClass()) { + return false; + } + StringType other = (StringType) obj; + return Objects.equals(this.value, other.value); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/UpDownType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/UpDownType.java index 064c719ad..9242a49f6 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/UpDownType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/types/UpDownType.java @@ -1,58 +1,58 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.library.types; - -import java.math.BigDecimal; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.types.Command; -import org.openhab.core.types.PrimitiveType; -import org.openhab.core.types.State; - -/** - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum UpDownType implements PrimitiveType, State, Command { - UP, - DOWN; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - - @Override - public @Nullable T as(@Nullable Class target) { - if (target == DecimalType.class) { - return target.cast(equals(UP) ? DecimalType.ZERO : new DecimalType(new BigDecimal("1.0"))); - } else if (target == PercentType.class) { - return target.cast(equals(UP) ? PercentType.ZERO : PercentType.HUNDRED); - } else { - return State.super.as(target); - } - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.library.types; + +import java.math.BigDecimal; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.types.Command; +import org.openhab.core.types.PrimitiveType; +import org.openhab.core.types.State; + +/** + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum UpDownType implements PrimitiveType, State, Command { + UP, + DOWN; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + + @Override + public @Nullable T as(@Nullable Class target) { + if (target == DecimalType.class) { + return target.cast(equals(UP) ? DecimalType.ZERO : new DecimalType(new BigDecimal("1.0"))); + } else if (target == PercentType.class) { + return target.cast(equals(UP) ? PercentType.ZERO : PercentType.HUNDRED); + } else { + return State.super.as(target); + } + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/Command.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/Command.java index dbbd51a8f..6d9ce80c2 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/Command.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/Command.java @@ -1,25 +1,25 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * This is a marker interface for all command types. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface Command extends Type { - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * This is a marker interface for all command types. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface Command extends Type { + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/ComplexType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/ComplexType.java index 63498aec9..a948dfa54 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/ComplexType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/ComplexType.java @@ -1,35 +1,35 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import java.util.SortedMap; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * A complex type consists out of a sorted list of primitive constituents. - * Each constituent can be referred to by a unique name. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface ComplexType extends Type { - - /** - * Returns all constituents with their names as a sorted map - * - * @return all constituents with their names - */ - public SortedMap getConstituents(); - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import java.util.SortedMap; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * A complex type consists out of a sorted list of primitive constituents. + * Each constituent can be referred to by a unique name. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface ComplexType extends Type { + + /** + * Returns all constituents with their names as a sorted map + * + * @return all constituents with their names + */ + public SortedMap getConstituents(); + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/PrimitiveType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/PrimitiveType.java index 33fdb42b9..f4e848158 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/PrimitiveType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/PrimitiveType.java @@ -1,25 +1,25 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * A primitive type consists of a single value like a string, a number, etc. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface PrimitiveType extends Type { - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * A primitive type consists of a single value like a string, a number, etc. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface PrimitiveType extends Type { + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/RefreshType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/RefreshType.java index a802cbca9..e6b66943c 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/RefreshType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/RefreshType.java @@ -1,41 +1,41 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * - * @author Oliver Libutzki - Initial contribution - */ -@NonNullByDefault -public enum RefreshType implements PrimitiveType, Command { - - REFRESH; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * + * @author Oliver Libutzki - Initial contribution + */ +@NonNullByDefault +public enum RefreshType implements PrimitiveType, Command { + + REFRESH; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/State.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/State.java index 9412db10c..efd32dcf3 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/State.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/State.java @@ -1,40 +1,40 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.eclipse.jdt.annotation.Nullable; - -/** - * This is a marker interface for all state types. - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public interface State extends Type { - - /** - * Convert this {@link State}'s value into another type - * - * @param target the desired {@link State} type - * @return the {@link State}'s value in the given type's representation, or null if the conversion was - * not possible - */ - default @Nullable T as(@Nullable Class target) { - if (target != null && target.isInstance(this)) { - return target.cast(this); - } else { - return null; - } - } -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; + +/** + * This is a marker interface for all state types. + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public interface State extends Type { + + /** + * Convert this {@link State}'s value into another type + * + * @param target the desired {@link State} type + * @return the {@link State}'s value in the given type's representation, or null if the conversion was + * not possible + */ + default @Nullable T as(@Nullable Class target) { + if (target != null && target.isInstance(this)) { + return target.cast(this); + } else { + return null; + } + } +} diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/UnDefType.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/UnDefType.java index 713aeb3ce..85c1aac17 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/types/UnDefType.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/types/UnDefType.java @@ -1,46 +1,46 @@ -/** - * Copyright (c) 2010-2019 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.core.types; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * There are situations when item states do not have any defined value. - * This might be because they have not been initialized yet (never - * received an state update so far) or because their state is ambiguous - * (e.g. a dimmed light that is treated as a switch (ON/OFF) will have - * an undefined state if it is dimmed to 50%). - * - * @author Kai Kreuzer - Initial contribution - */ -@NonNullByDefault -public enum UnDefType implements PrimitiveType, State { - UNDEF, - NULL; - - @Override - public String format(String pattern) { - return String.format(pattern, this.toString()); - } - - @Override - public String toString() { - return toFullString(); - } - - @Override - public String toFullString() { - return super.toString(); - } - -} +/** + * Copyright (c) 2010-2019 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.core.types; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * There are situations when item states do not have any defined value. + * This might be because they have not been initialized yet (never + * received an state update so far) or because their state is ambiguous + * (e.g. a dimmed light that is treated as a switch (ON/OFF) will have + * an undefined state if it is dimmed to 50%). + * + * @author Kai Kreuzer - Initial contribution + */ +@NonNullByDefault +public enum UnDefType implements PrimitiveType, State { + UNDEF, + NULL; + + @Override + public String format(String pattern) { + return String.format(pattern, this.toString()); + } + + @Override + public String toString() { + return toFullString(); + } + + @Override + public String toFullString() { + return super.toString(); + } + +} diff --git a/bundles/org.openhab.core/src/main/resources/ESH-INF/config/i18n.xml b/bundles/org.openhab.core/src/main/resources/ESH-INF/config/i18n.xml index a8a7e076f..2345b1a08 100644 --- a/bundles/org.openhab.core/src/main/resources/ESH-INF/config/i18n.xml +++ b/bundles/org.openhab.core/src/main/resources/ESH-INF/config/i18n.xml @@ -1,5 +1,6 @@ - diff --git a/bundles/org.openhab.core/src/main/resources/ESH-INF/config/networkinterface.xml b/bundles/org.openhab.core/src/main/resources/ESH-INF/config/networkinterface.xml index 2668aecb1..5bff466be 100644 --- a/bundles/org.openhab.core/src/main/resources/ESH-INF/config/networkinterface.xml +++ b/bundles/org.openhab.core/src/main/resources/ESH-INF/config/networkinterface.xml @@ -1,5 +1,6 @@ - @@ -7,7 +8,9 @@ - A subnet (e.g. 192.168.1.0/24) + + A subnet (e.g. 192.168.1.0/24) + true diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/i18n/I18nProviderImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/i18n/I18nProviderImplTest.java index e185af354..9f7a52b8b 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/i18n/I18nProviderImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/i18n/I18nProviderImplTest.java @@ -12,11 +12,11 @@ */ package org.openhab.core.internal.i18n; -import static org.openhab.core.internal.i18n.I18nProviderImpl.*; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; +import static org.openhab.core.internal.i18n.I18nProviderImpl.*; import java.time.ZoneId; import java.util.Dictionary; @@ -25,10 +25,10 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import org.openhab.core.library.types.PointType; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.library.types.PointType; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemBuilderTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemBuilderTest.java index cdc1484d3..22e2c67fa 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemBuilderTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemBuilderTest.java @@ -20,14 +20,14 @@ import static org.mockito.MockitoAnnotations.initMocks; import java.util.Arrays; import java.util.Collections; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.items.ActiveItem; import org.openhab.core.items.GroupFunction; import org.openhab.core.items.GroupItem; import org.openhab.core.items.Item; import org.openhab.core.items.ItemFactory; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemStateConverterImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemStateConverterImplTest.java index 16b018567..f19f7e9bc 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemStateConverterImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemStateConverterImplTest.java @@ -19,6 +19,8 @@ import static org.mockito.Mockito.*; import javax.measure.quantity.Length; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.items.Item; import org.openhab.core.library.items.NumberItem; @@ -29,8 +31,6 @@ import org.openhab.core.library.unit.ImperialUnits; import org.openhab.core.types.State; import org.openhab.core.types.StateDescription; import org.openhab.core.types.UnDefType; -import org.junit.Before; -import org.junit.Test; /** * Test the {@link ItemStateConverterImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemTagTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemTagTest.java index 9303d63ef..7d52c1252 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemTagTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/items/ItemTagTest.java @@ -17,8 +17,8 @@ import static org.junit.Assert.assertThat; import java.util.Arrays; -import org.openhab.core.library.items.SwitchItem; import org.junit.Test; +import org.openhab.core.library.items.SwitchItem; /** * Test Item Tag handling. 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 f2603cde8..bfb23a339 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 @@ -19,14 +19,14 @@ import static org.mockito.MockitoAnnotations.initMocks; import java.util.Collections; -import org.openhab.core.items.Item; -import org.openhab.core.items.ManagedMetadataProvider; -import org.openhab.core.items.Metadata; -import org.openhab.core.items.MetadataKey; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; +import org.openhab.core.items.Item; +import org.openhab.core.items.ManagedMetadataProvider; +import org.openhab.core.items.Metadata; +import org.openhab.core.items.MetadataKey; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceListener; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronSchedulerImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronSchedulerImplTest.java index 469b3cbd7..b67c56a0f 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronSchedulerImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/CronSchedulerImplTest.java @@ -19,9 +19,9 @@ import java.util.Map; import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicReference; +import org.junit.Test; import org.openhab.core.scheduler.CronJob; import org.openhab.core.scheduler.ScheduledCompletableFuture; -import org.junit.Test; /** * Test class for {@link CronSchedulerImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/DelegatedSchedulerTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/DelegatedSchedulerTest.java index 6658c14e9..07827ee4a 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/DelegatedSchedulerTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/DelegatedSchedulerTest.java @@ -24,10 +24,10 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiFunction; -import org.openhab.core.scheduler.ScheduledCompletableFuture; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.scheduler.ScheduledCompletableFuture; /** * Test class for {@link DelegatedSchedulerImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImplTest.java index 4d8d63803..c37fc71d8 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/PeriodicSchedulerImplTest.java @@ -21,8 +21,8 @@ import java.util.Queue; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; -import org.openhab.core.scheduler.ScheduledCompletableFuture; import org.junit.Test; +import org.openhab.core.scheduler.ScheduledCompletableFuture; /** * Test class for {@link PeriodicSchedulerImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/SchedulerImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/SchedulerImplTest.java index dfff0e862..df3a0f601 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/SchedulerImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/scheduler/SchedulerImplTest.java @@ -30,10 +30,10 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Test; import org.openhab.core.scheduler.ScheduledCompletableFuture; import org.openhab.core.scheduler.SchedulerRunnable; import org.openhab.core.scheduler.SchedulerTemporalAdjuster; -import org.junit.Test; /** * Test class for {@link SchedulerImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/ReadyServiceImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/ReadyServiceImplTest.java index 61dd6c10d..ddedc621e 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/ReadyServiceImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/ReadyServiceImplTest.java @@ -16,10 +16,10 @@ import static org.junit.Assert.*; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.*; +import org.junit.Test; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyMarkerFilter; import org.openhab.core.service.ReadyService.ReadyTracker; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/StateDescriptionServiceImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/StateDescriptionServiceImplTest.java index 9d96bf1a6..9b00e58b4 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/StateDescriptionServiceImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/service/StateDescriptionServiceImplTest.java @@ -21,6 +21,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.library.items.NumberItem; import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescriptionFragment; @@ -28,8 +30,6 @@ import org.openhab.core.types.StateDescriptionFragmentBuilder; import org.openhab.core.types.StateDescriptionFragmentProvider; import org.openhab.core.types.StateDescriptionProvider; import org.openhab.core.types.StateOption; -import org.junit.Before; -import org.junit.Test; /** * Tests for the StateDescriptionService implementation diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/types/StateDescriptionFragmentImplTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/types/StateDescriptionFragmentImplTest.java index 2016bd35c..d34bc9de2 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/types/StateDescriptionFragmentImplTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/internal/types/StateDescriptionFragmentImplTest.java @@ -18,11 +18,11 @@ import static org.junit.Assert.assertThat; import java.math.BigDecimal; import java.util.Collections; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescriptionFragment; import org.openhab.core.types.StateOption; -import org.junit.Before; -import org.junit.Test; /** * Test the {@link StateDescriptionFragmentImpl}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/GenericItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/GenericItemTest.java index 05b6a751c..9d7727f65 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/GenericItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/GenericItemTest.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Locale; import org.eclipse.jdt.annotation.NonNull; +import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.items.events.ItemStateChangedEvent; @@ -36,8 +38,6 @@ import org.openhab.core.types.CommandOption; import org.openhab.core.types.State; import org.openhab.core.types.StateDescriptionFragmentBuilder; import org.openhab.core.types.StateOption; -import org.junit.Test; -import org.mockito.ArgumentCaptor; /** * The GenericItemTest tests functionality of the GenericItem. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/dto/ItemDTOMapperTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/dto/ItemDTOMapperTest.java index 6f74ae84b..bfd5c51e2 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/dto/ItemDTOMapperTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/dto/ItemDTOMapperTest.java @@ -18,11 +18,11 @@ package org.openhab.core.items.dto; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import org.junit.Test; import org.openhab.core.items.GroupFunction; import org.openhab.core.library.items.NumberItem; import org.openhab.core.library.types.ArithmeticGroupFunction; import org.openhab.core.library.types.StringType; -import org.junit.Test; /** * @author Stefan Triller - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/AbstractEventFactoryTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/AbstractEventFactoryTest.java index 1044fac49..f15fffad8 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/AbstractEventFactoryTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/AbstractEventFactoryTest.java @@ -14,8 +14,8 @@ package org.openhab.core.items.events; import static org.junit.Assert.*; -import org.openhab.core.events.AbstractEventFactory; import org.junit.Test; +import org.openhab.core.events.AbstractEventFactory; /** * {@link AbstractEventFactoryTests} tests the {@link AbstractEventFactory}. diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/ItemEventFactoryTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/ItemEventFactoryTest.java index 30e782f7b..737c31e19 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/ItemEventFactoryTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/items/events/ItemEventFactoryTest.java @@ -15,6 +15,7 @@ package org.openhab.core.items.events; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.items.Item; import org.openhab.core.items.dto.ItemDTOMapper; @@ -26,7 +27,6 @@ import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.junit.Test; import com.google.gson.Gson; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/CoreItemFactoryTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/CoreItemFactoryTest.java index a36485543..8777fd5dd 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/CoreItemFactoryTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/CoreItemFactoryTest.java @@ -21,10 +21,10 @@ import java.util.List; import javax.measure.quantity.Temperature; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.items.NumberItem; import org.junit.Before; import org.junit.Test; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.items.NumberItem; /** * @author Henning Treu - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/dimension/VolumetricFlowRateTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/dimension/VolumetricFlowRateTest.java index 8f24db8a9..407fbbce7 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/dimension/VolumetricFlowRateTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/dimension/VolumetricFlowRateTest.java @@ -17,12 +17,12 @@ import static org.junit.Assert.assertThat; import javax.measure.Unit; -import org.openhab.core.library.unit.SmartHomeUnits; -import org.openhab.core.types.util.UnitUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; +import org.openhab.core.library.unit.SmartHomeUnits; +import org.openhab.core.types.util.UnitUtils; import tec.uom.se.ComparableQuantity; import tec.uom.se.quantity.Quantities; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/CallItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/CallItemTest.java index cb2309052..8b5829945 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/CallItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/CallItemTest.java @@ -14,8 +14,8 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; -import org.openhab.core.library.types.StringListType; import org.junit.Test; +import org.openhab.core.library.types.StringListType; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ColorItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ColorItemTest.java index efa5a8b8f..8fcbd3856 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ColorItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ColorItemTest.java @@ -14,11 +14,11 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ContactItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ContactItemTest.java index aa891e28e..a87aa5cfc 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ContactItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ContactItemTest.java @@ -14,8 +14,8 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; -import org.openhab.core.library.types.OpenClosedType; import org.junit.Test; +import org.openhab.core.library.types.OpenClosedType; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DateTimeItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DateTimeItemTest.java index e0ca52957..b51a3af7d 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DateTimeItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DateTimeItemTest.java @@ -14,8 +14,8 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; -import org.openhab.core.library.types.DateTimeType; import org.junit.Test; +import org.openhab.core.library.types.DateTimeType; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DimmerItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DimmerItemTest.java index 61dc57b41..97e1582e7 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DimmerItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/DimmerItemTest.java @@ -16,12 +16,12 @@ import static org.junit.Assert.assertEquals; import java.math.BigDecimal; +import org.junit.Test; import org.openhab.core.items.Item; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; import org.openhab.core.types.State; -import org.junit.Test; /** * @author Chris Jackson - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ImageItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ImageItemTest.java index e7d180deb..41e50e62c 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ImageItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/ImageItemTest.java @@ -14,9 +14,9 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.RawType; import org.openhab.core.types.State; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/LocationItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/LocationItemTest.java index f547b17df..9c1823c57 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/LocationItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/LocationItemTest.java @@ -14,9 +14,9 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.PointType; -import org.junit.Test; /** * @author Gaël L'hopital - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/NumberItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/NumberItemTest.java index fd37e16c0..1dbf400aa 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/NumberItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/NumberItemTest.java @@ -19,6 +19,9 @@ import static org.mockito.MockitoAnnotations.initMocks; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.HSBType; @@ -31,9 +34,6 @@ import org.openhab.core.types.State; import org.openhab.core.types.StateDescriptionFragmentBuilder; import org.openhab.core.types.UnDefType; import org.openhab.core.types.util.UnitUtils; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/PlayerItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/PlayerItemTest.java index 5b68e2035..a77487c9b 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/PlayerItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/PlayerItemTest.java @@ -14,9 +14,9 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.PlayPauseType; import org.openhab.core.library.types.RewindFastforwardType; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/RollershutterItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/RollershutterItemTest.java index af53ddd0b..e9446a8ad 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/RollershutterItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/RollershutterItemTest.java @@ -14,11 +14,11 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.UpDownType; import org.openhab.core.types.State; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/StringItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/StringItemTest.java index f91d690d6..aae68d654 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/StringItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/StringItemTest.java @@ -14,10 +14,10 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.StringType; import org.openhab.core.types.State; -import org.junit.Test; /** * diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/SwitchItemTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/SwitchItemTest.java index b957a1c31..9aeb3f2a2 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/SwitchItemTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/items/SwitchItemTest.java @@ -14,11 +14,11 @@ package org.openhab.core.library.items; import static org.junit.Assert.assertEquals; +import org.junit.Test; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.HSBType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.library.types.PercentType; -import org.junit.Test; /** * @author Chris Jackson - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/ArithmeticGroupFunctionTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/ArithmeticGroupFunctionTest.java index cb14a1833..d9fb8b895 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/ArithmeticGroupFunctionTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/ArithmeticGroupFunctionTest.java @@ -19,6 +19,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupFunction; import org.openhab.core.items.Item; @@ -27,8 +29,6 @@ import org.openhab.core.library.items.SwitchItem; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.junit.Before; -import org.junit.Test; /** * @author Thomas Eichstaedt-Engelen - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/DateTimeGroupFunctionTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/DateTimeGroupFunctionTest.java index f0a5ba75d..20b4dd117 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/DateTimeGroupFunctionTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/DateTimeGroupFunctionTest.java @@ -20,14 +20,14 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.GenericItem; import org.openhab.core.items.GroupFunction; import org.openhab.core.items.Item; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.junit.Before; -import org.junit.Test; /** * @author Robert Michalak - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/PercentTypeTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/PercentTypeTest.java index 949ff29ff..5a4469702 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/PercentTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/PercentTypeTest.java @@ -14,8 +14,8 @@ package org.openhab.core.library.types; import static org.junit.Assert.*; -import org.openhab.core.library.unit.SmartHomeUnits; import org.junit.Test; +import org.openhab.core.library.unit.SmartHomeUnits; /** * @author Kai Kreuzer - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeArithmeticGroupFunctionTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeArithmeticGroupFunctionTest.java index 3c1e36f66..c54a752c4 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeArithmeticGroupFunctionTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeArithmeticGroupFunctionTest.java @@ -25,6 +25,9 @@ import javax.measure.quantity.Power; import javax.measure.quantity.Pressure; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.i18n.UnitProvider; import org.openhab.core.items.GroupFunction; import org.openhab.core.items.GroupItem; @@ -33,9 +36,6 @@ import org.openhab.core.library.CoreItemFactory; import org.openhab.core.library.items.NumberItem; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; import tec.uom.se.unit.Units; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeTest.java index d224e1559..b15327dda 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/types/QuantityTypeTest.java @@ -12,9 +12,9 @@ */ package org.openhab.core.library.types; -import static org.openhab.core.library.unit.MetricPrefix.CENTI; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; +import static org.openhab.core.library.unit.MetricPrefix.CENTI; import java.math.BigDecimal; @@ -25,6 +25,7 @@ import javax.measure.quantity.Pressure; import javax.measure.quantity.Speed; import javax.measure.quantity.Temperature; +import org.junit.Test; import org.openhab.core.library.dimension.DataAmount; import org.openhab.core.library.dimension.DataTransferRate; import org.openhab.core.library.dimension.Density; @@ -32,7 +33,6 @@ import org.openhab.core.library.dimension.Intensity; import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.SIUnits; import org.openhab.core.library.unit.SmartHomeUnits; -import org.junit.Test; import tec.uom.se.quantity.QuantityDimension; import tec.uom.se.unit.Units; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/SmartHomeUnitsTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/SmartHomeUnitsTest.java index 1cc99f648..4e4e75b52 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/SmartHomeUnitsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/SmartHomeUnitsTest.java @@ -12,10 +12,10 @@ */ package org.openhab.core.library.unit; -import static org.openhab.core.library.unit.MetricPrefix.HECTO; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.number.IsCloseTo.closeTo; import static org.junit.Assert.*; +import static org.openhab.core.library.unit.MetricPrefix.HECTO; import java.math.BigDecimal; @@ -26,11 +26,11 @@ import javax.measure.quantity.Pressure; import javax.measure.quantity.Speed; import javax.measure.quantity.Temperature; +import org.junit.Test; import org.openhab.core.library.dimension.ArealDensity; import org.openhab.core.library.dimension.Density; import org.openhab.core.library.dimension.Intensity; import org.openhab.core.library.types.QuantityType; -import org.junit.Test; import tec.uom.se.quantity.Quantities; import tec.uom.se.unit.Units; diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/types/util/UnitUtilsTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/types/util/UnitUtilsTest.java index 68c3c7f20..065f3a0c1 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/types/util/UnitUtilsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/types/util/UnitUtilsTest.java @@ -12,10 +12,10 @@ */ package org.openhab.core.types.util; -import static org.openhab.core.library.unit.MetricPrefix.*; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.number.IsCloseTo.closeTo; import static org.junit.Assert.*; +import static org.openhab.core.library.unit.MetricPrefix.*; import javax.measure.Quantity; import javax.measure.Unit; @@ -24,12 +24,12 @@ import javax.measure.quantity.Length; import javax.measure.quantity.Power; import javax.measure.quantity.Temperature; +import org.junit.Test; import org.openhab.core.library.dimension.Intensity; import org.openhab.core.library.unit.ImperialUnits; import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.SIUnits; import org.openhab.core.library.unit.SmartHomeUnits; -import org.junit.Test; /** * @author Henning Treu - Initial contribution diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/util/UIDUtilsTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/util/UIDUtilsTest.java index 83ce93c79..9d23b7170 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/util/UIDUtilsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/util/UIDUtilsTest.java @@ -14,10 +14,10 @@ package org.openhab.core.util; import java.util.function.Consumer; -import org.openhab.core.common.AbstractUID; import org.hamcrest.core.IsEqual; import org.junit.Assert; import org.junit.Test; +import org.openhab.core.common.AbstractUID; /** * Tests for {@link AbstractUID}. diff --git a/bundles/pom.xml b/bundles/pom.xml index e6e73bcb8..c0747c227 100644 --- a/bundles/pom.xml +++ b/bundles/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/features/karaf/openhab-core/pom.xml b/features/karaf/openhab-core/pom.xml index 0b50dfb3e..879a6be83 100644 --- a/features/karaf/openhab-core/pom.xml +++ b/features/karaf/openhab-core/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/features/karaf/openhab-core/src/main/feature/feature.xml b/features/karaf/openhab-core/src/main/feature/feature.xml index 1f1aee80a..fc007c34a 100644 --- a/features/karaf/openhab-core/src/main/feature/feature.xml +++ b/features/karaf/openhab-core/src/main/feature/feature.xml @@ -15,493 +15,495 @@ --> - mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/${project.version}/xml/features - - -
openHAB Core base bundles
- - openhab.tp;filter:="(feature=base)" - openhab.tp-base - - openhab.tp-gson - - openhab.tp;filter:="(&(feature=xtext)(version>=2.19.0)(!(version>=2.20.0)))" - openhab.tp-xtext - - openhab.tp;filter:="(feature=jax-rs)" - openhab.tp-jax-rs - - openhab.tp;filter:="(feature=httpclient)" - openhab.tp-httpclient - - mvn:org.openhab.core.bundles/org.openhab.core.config.core/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.discovery/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.dispatch/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.xml/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core/${project.version} - openhab-core-storage-mapdb - mvn:org.openhab.core.bundles/org.openhab.core.binding.xml/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.id/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.persistence/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.semantics/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.scheduler/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.thing/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.thing.xml/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.transform/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.audio/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.voice/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.console/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.monitor/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.net/${project.version} - pax-http-whiteboard - mvn:org.openhab.core.bundles/org.openhab.core.io.http/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.rest/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.optimize/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.core/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.sse/${project.version} -
- - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.auth.jaas/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.auth.oauth2client/${project.version} - - - - openhab-core-base - openhab-core-ephemeris - mvn:org.openhab.core.bundles/org.openhab.core.automation/${project.version} - - - - openhab-core-base - openhab-core-automation - mvn:org.openhab.core.bundles/org.openhab.core.automation.module.script/${project.version} - - - - openhab-core-base - openhab-core-automation - openhab-core-automation-module-script - mvn:org.openhab.core.bundles/org.openhab.core.automation.module.script.rulesupport/${project.version} - - - - openhab-core-base - openhab-core-automation - openhab-core-automation-module-script - mvn:org.openhab.core.bundles/org.openhab.core.automation.module.media/${project.version} - - - - openhab-core-base - openhab-core-automation - mvn:org.openhab.core.bundles/org.openhab.core.automation.rest/${project.version} - - - - openhab-core-base - openhab-core-io-transport-serial - mvn:org.openhab.core.bundles/org.openhab.core.config.serial/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/${project.version} - - - - openhab.tp;filter:="(feature=jollyday)" - openhab.tp-jollyday - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.ephemeris/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.bin2json/${project.version} - openhab.tp;filter:="(feature=jbbp)" - openhab.tp-jbbp - - - - openhab-core-base - shell - mvn:org.openhab.core.bundles/org.openhab.core.io.console.karaf/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.http.auth/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.http.auth.basic/${project.version} - - openhab-core-io-http-auth - - enabled = true - - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.auth/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.log/${project.version} - - - - openhab-core-base - openhab-core-ui - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.sitemap/${project.version} - openhab-core-model-sitemap - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.audio/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.voice/${project.version} - - - - openhab-core-base - openhab-core-io-transport-mdns - mvn:org.openhab.core.bundles/org.openhab.core.io.rest.mdns/${project.version} - - - - openhab-core-base - - openhab.tp;filter:="(feature=coap)" - openhab.tp-coap - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.dbus/${project.version} - - - - openhab-core-base - - openhab.tp;filter:="(feature=httpclient)" - openhab.tp-httpclient - - - - openhab-core-base - - openhab.tp;filter:="(feature=jmdns)" - openhab.tp-jmdns - - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.mdns/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.mdns/${project.version} - - - - openhab-core-base - - openhab.tp;filter:="(feature=hivemqclient)" - openhab.tp-hivemqclient - - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.mqtt/${project.version} - - - - openhab-core-base - osgi.service;filter:="(objectClass=org.openhab.core.io.transport.serial.SerialPortManager)" - osgi.service;filter:="(objectClass=org.openhab.core.io.transport.serial.SerialPortProvider)" - openhab-core-io-transport-serial-rxtx - - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} - - - - openhab-core-base - - openhab.tp;filter:="(&(feature=serial)(impl=javacomm))" - openhab.tp-serial-javacomm - - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.javacomm/${project.version} - + mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/${project.version}/xml/features + + +
openHAB Core base bundles
+ + openhab.tp;filter:="(feature=base)" + openhab.tp-base + + openhab.tp-gson + + openhab.tp;filter:="(&(feature=xtext)(version>=2.19.0)(!(version>=2.20.0)))" + openhab.tp-xtext + + openhab.tp;filter:="(feature=jax-rs)" + openhab.tp-jax-rs + + openhab.tp;filter:="(feature=httpclient)" + openhab.tp-httpclient + + mvn:org.openhab.core.bundles/org.openhab.core.config.core/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.dispatch/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.xml/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core/${project.version} + openhab-core-storage-mapdb + mvn:org.openhab.core.bundles/org.openhab.core.binding.xml/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.id/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.persistence/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.semantics/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.scheduler/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.thing/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.thing.xml/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.transform/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.audio/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.voice/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.console/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.monitor/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.net/${project.version} + pax-http-whiteboard + mvn:org.openhab.core.bundles/org.openhab.core.io.http/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.rest/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.optimize/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.core/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.sse/${project.version} +
+ + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.auth.jaas/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.auth.oauth2client/${project.version} + + + + openhab-core-base + openhab-core-ephemeris + mvn:org.openhab.core.bundles/org.openhab.core.automation/${project.version} + + + + openhab-core-base + openhab-core-automation + mvn:org.openhab.core.bundles/org.openhab.core.automation.module.script/${project.version} + + + + openhab-core-base + openhab-core-automation + openhab-core-automation-module-script + mvn:org.openhab.core.bundles/org.openhab.core.automation.module.script.rulesupport/${project.version} + + + + openhab-core-base + openhab-core-automation + openhab-core-automation-module-script + mvn:org.openhab.core.bundles/org.openhab.core.automation.module.media/${project.version} + + + + openhab-core-base + openhab-core-automation + mvn:org.openhab.core.bundles/org.openhab.core.automation.rest/${project.version} + + + + openhab-core-base + openhab-core-io-transport-serial + mvn:org.openhab.core.bundles/org.openhab.core.config.serial/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.usbserial.linuxsysfs/${project.version} + + + + openhab.tp;filter:="(feature=jollyday)" + openhab.tp-jollyday + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.ephemeris/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.bin2json/${project.version} + openhab.tp;filter:="(feature=jbbp)" + openhab.tp-jbbp + + + + openhab-core-base + shell + mvn:org.openhab.core.bundles/org.openhab.core.io.console.karaf/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.http.auth/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.http.auth.basic/${project.version} + + openhab-core-io-http-auth + + enabled = true + + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.auth/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.log/${project.version} + + + + openhab-core-base + openhab-core-ui + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.sitemap/${project.version} + openhab-core-model-sitemap + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.audio/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.voice/${project.version} + + + + openhab-core-base + openhab-core-io-transport-mdns + mvn:org.openhab.core.bundles/org.openhab.core.io.rest.mdns/${project.version} + + + + openhab-core-base + + openhab.tp;filter:="(feature=coap)" + openhab.tp-coap + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.dbus/${project.version} + + + + openhab-core-base + + openhab.tp;filter:="(feature=httpclient)" + openhab.tp-httpclient + + + + openhab-core-base + + openhab.tp;filter:="(feature=jmdns)" + openhab.tp-jmdns + + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.mdns/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.mdns/${project.version} + + + + openhab-core-base + + openhab.tp;filter:="(feature=hivemqclient)" + openhab.tp-hivemqclient + + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.mqtt/${project.version} + + + + openhab-core-base + osgi.service;filter:="(objectClass=org.openhab.core.io.transport.serial.SerialPortManager)" + osgi.service;filter:="(objectClass=org.openhab.core.io.transport.serial.SerialPortProvider)" + openhab-core-io-transport-serial-rxtx + + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} + + + + openhab-core-base + + openhab.tp;filter:="(&(feature=serial)(impl=javacomm))" + openhab.tp-serial-javacomm + + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.javacomm/${project.version} + - - openhab-core-base + + openhab-core-base - openhab.tp;filter:="(&(feature=serial)(impl=rxtx))" - openhab.tp-serial-rxtx + openhab.tp;filter:="(&(feature=serial)(impl=rxtx))" + openhab.tp-serial-rxtx - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx/${project.version} + - - openhab-core-base + + openhab-core-base - openhab.tp;filter:="(&(feature=serial)(impl=rxtx))" - openhab-core-io-transport-serial-rxtx + openhab.tp;filter:="(&(feature=serial)(impl=rxtx))" + openhab-core-io-transport-serial-rxtx - openhab.tp;filter:="(feature=commons-net)" - openhab.tp-commons-net + openhab.tp;filter:="(feature=commons-net)" + openhab.tp-commons-net - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.serial.rxtx.rfc2217/${project.version} + - - openhab-core-base + + openhab-core-base - openhab.tp;filter:="(feature=jupnp)" - openhab.tp-jupnp + openhab.tp;filter:="(feature=jupnp)" + openhab.tp-jupnp - mvn:org.openhab.core.bundles/org.openhab.core.io.transport.upnp/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.upnp/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.io.transport.upnp/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.config.discovery.upnp/${project.version} + - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.model.core/${project.version} - + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.model.core/${project.version} + - - openhab-core-base - openhab.inc-model-core - mvn:org.openhab.core.bundles/org.openhab.core.model.item/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.item.runtime/${project.version} - + + openhab-core-base + openhab.inc-model-core + mvn:org.openhab.core.bundles/org.openhab.core.model.item/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.item.runtime/${project.version} + - - openhab-core-model-item + + openhab-core-model-item - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide - mvn:org.openhab.core.bundles/org.openhab.core.model.item.ide/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.model.item.ide/${project.version} + - - openhab-core-base - openhab-core-model-item - mvn:org.openhab.core.bundles/org.openhab.core.model.persistence/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.persistence.runtime/${project.version} - + + openhab-core-base + openhab-core-model-item + mvn:org.openhab.core.bundles/org.openhab.core.model.persistence/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.persistence.runtime/${project.version} + - - openhab-core-model-persistence + + openhab-core-model-persistence - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide - mvn:org.openhab.core.bundles/org.openhab.core.model.persistence.ide/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.model.persistence.ide/${project.version} + - - openhab-core-base - openhab-core-model-item - openhab-core-model-persistence - openhab-core-model-script - mvn:org.openhab.core.bundles/org.openhab.core.model.rule/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.rule.runtime/${project.version} - + + openhab-core-base + openhab-core-model-item + openhab-core-model-persistence + openhab-core-model-script + mvn:org.openhab.core.bundles/org.openhab.core.model.rule/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.rule.runtime/${project.version} + - - openhab-core-model-rule + + openhab-core-model-rule - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide - mvn:org.openhab.core.bundles/org.openhab.core.model.rule.ide/${project.version} - + mvn:org.openhab.core.bundles/org.openhab.core.model.rule.ide/${project.version} + - - openhab-core-base - openhab-core-ephemeris - openhab-core-model-persistence - mvn:org.openhab.core.bundles/org.openhab.core.model.script/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.script.runtime/${project.version} - - - - openhab-core-model-script - - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide - - mvn:org.openhab.core.bundles/org.openhab.core.model.script.ide/${project.version} - - - - openhab-core-base - openhab.inc-model-core - mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap.runtime/${project.version} - - - - openhab-core-model-sitemap - - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide - - mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap.ide/${project.version} - - - - openhab-core-base - openhab-core-model-item - mvn:org.openhab.core.bundles/org.openhab.core.model.thing/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.model.thing.runtime/${project.version} - - - - openhab-core-model-thing - - openhab.tp;filter:="(feature=xtext-ide)" - openhab.tp-xtext-ide - - mvn:org.openhab.core.bundles/org.openhab.core.model.thing.ide/${project.version} - - - - - openhab.tp;filter:="(&(feature=xtext-ide)(version>=2.19.0)(!(version>=2.20.0)))" - openhab.tp-xtext-ide - - openhab.tp;filter:="(&(feature=lsp4j)(version>=0.8.0)(!(version>=0.9.0)))" - openhab.tp-lsp4j - - openhab-core-model-item-ide - openhab-core-model-persistence-ide - openhab-core-model-rule-ide - openhab-core-model-script-ide - openhab-core-model-sitemap-ide - openhab-core-model-thing-ide - mvn:org.openhab.core.bundles/org.openhab.core.model.lsp/${project.version} - - - - openhab-core-base - - mvn:org.openhab.core.bundles/org.openhab.core.storage.mapdb/${project.version} - - openhab.tp;filter:="(feature=mapdb)" - openhab.tp-mapdb - - - - openhab-core-base - - mvn:org.openhab.core.bundles/org.openhab.core.storage.json/${project.version} - - - - openhab-core-base - openhab-core-model-item - openhab-core-model-sitemap - mvn:org.openhab.core.bundles/org.openhab.core.ui/${project.version} - - - - openhab-core-base - mvn:org.openhab.core.bundles/org.openhab.core.ui.icon/${project.version} - - - - mvn:com.google.guava/guava/18.0 - openhab.tp;filter:="(feature=commons-net)" - openhab.tp-commons-net - openhab-core-base - openhab-core-ephemeris - openhab-core-io-console-karaf - openhab-core-io-rest-sitemap - openhab-core-io-rest-audio - openhab-core-io-rest-voice - openhab-core-io-rest-mdns - openhab-core-model-lsp - openhab-core-model-item - openhab-core-model-persistence - openhab-core-model-rule - openhab-core-model-script - openhab-core-model-sitemap - openhab-core-model-thing - openhab-core-ui-icon - openhab-core-storage-json - openhab-runtime-certificate - openhab-transport-mdns - openhab-transport-http - shell - wrapper - - - - mvn:org.openhab.core.bundles/org.openhab.core.boot/${project.version} - mvn:org.openhab.core.bundles/org.openhab.core.karaf/${project.version} - - defaultSink = enhancedjavasound - - - defaultHLI = rulehli - - - - - mvn:org.openhab.core.bundles/org.openhab.core.io.jetty.certificate/${project.version} - - - - mvn:net.java.dev.jna/jna/${jna.version} - mvn:net.java.dev.jna/jna-platform/${jna.version} - - - - openhab-core-io-transport-coap - - - - openhab.tp;feature=httpclient;version=${jetty.version} - openhab-core-auth-oauth2client - mvn:javax.servlet/javax.servlet-api/3.1.0 - mvn:org.eclipse.jetty/jetty-client/${jetty.version} - mvn:org.eclipse.jetty/jetty-http/${jetty.version} - mvn:org.eclipse.jetty/jetty-util/${jetty.version} - mvn:org.eclipse.jetty/jetty-io/${jetty.version} - mvn:org.eclipse.jetty/jetty-proxy/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-api/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-common/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-client/${jetty.version} - - - - openhab-core-io-transport-mdns - - - - openhab-core-io-transport-mqtt - - - - openhab-core-io-transport-serial-rfc2217 - openhab-core-config-serial - openhab-core-config-discovery-usbserial - - - - openhab-core-io-transport-upnp - + + openhab-core-base + openhab-core-ephemeris + openhab-core-model-persistence + mvn:org.openhab.core.bundles/org.openhab.core.model.script/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.script.runtime/${project.version} + + + + openhab-core-model-script + + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide + + mvn:org.openhab.core.bundles/org.openhab.core.model.script.ide/${project.version} + + + + openhab-core-base + openhab.inc-model-core + mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap.runtime/${project.version} + + + + openhab-core-model-sitemap + + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide + + mvn:org.openhab.core.bundles/org.openhab.core.model.sitemap.ide/${project.version} + + + + openhab-core-base + openhab-core-model-item + mvn:org.openhab.core.bundles/org.openhab.core.model.thing/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.model.thing.runtime/${project.version} + + + + openhab-core-model-thing + + openhab.tp;filter:="(feature=xtext-ide)" + openhab.tp-xtext-ide + + mvn:org.openhab.core.bundles/org.openhab.core.model.thing.ide/${project.version} + + + + + openhab.tp;filter:="(&(feature=xtext-ide)(version>=2.19.0)(!(version>=2.20.0)))" + openhab.tp-xtext-ide + + openhab.tp;filter:="(&(feature=lsp4j)(version>=0.8.0)(!(version>=0.9.0)))" + openhab.tp-lsp4j + + openhab-core-model-item-ide + openhab-core-model-persistence-ide + openhab-core-model-rule-ide + openhab-core-model-script-ide + openhab-core-model-sitemap-ide + openhab-core-model-thing-ide + mvn:org.openhab.core.bundles/org.openhab.core.model.lsp/${project.version} + + + + openhab-core-base + + mvn:org.openhab.core.bundles/org.openhab.core.storage.mapdb/${project.version} + + openhab.tp;filter:="(feature=mapdb)" + openhab.tp-mapdb + + + + openhab-core-base + + mvn:org.openhab.core.bundles/org.openhab.core.storage.json/${project.version} + + + + openhab-core-base + openhab-core-model-item + openhab-core-model-sitemap + mvn:org.openhab.core.bundles/org.openhab.core.ui/${project.version} + + + + openhab-core-base + mvn:org.openhab.core.bundles/org.openhab.core.ui.icon/${project.version} + + + + mvn:com.google.guava/guava/18.0 + openhab.tp;filter:="(feature=commons-net)" + openhab.tp-commons-net + openhab-core-base + openhab-core-ephemeris + openhab-core-io-console-karaf + openhab-core-io-rest-sitemap + openhab-core-io-rest-audio + openhab-core-io-rest-voice + openhab-core-io-rest-mdns + openhab-core-model-lsp + openhab-core-model-item + openhab-core-model-persistence + openhab-core-model-rule + openhab-core-model-script + openhab-core-model-sitemap + openhab-core-model-thing + openhab-core-ui-icon + openhab-core-storage-json + openhab-runtime-certificate + openhab-transport-mdns + openhab-transport-http + shell + wrapper + + + + mvn:org.openhab.core.bundles/org.openhab.core.boot/${project.version} + mvn:org.openhab.core.bundles/org.openhab.core.karaf/${project.version} + + defaultSink = enhancedjavasound + + + defaultHLI = rulehli + + + + + mvn:org.openhab.core.bundles/org.openhab.core.io.jetty.certificate/${project.version} + + + + mvn:net.java.dev.jna/jna/${jna.version} + mvn:net.java.dev.jna/jna-platform/${jna.version} + + + + openhab-core-io-transport-coap + + + + openhab.tp;feature=httpclient;version=${jetty.version} + openhab-core-auth-oauth2client + mvn:javax.servlet/javax.servlet-api/3.1.0 + mvn:org.eclipse.jetty/jetty-client/${jetty.version} + mvn:org.eclipse.jetty/jetty-http/${jetty.version} + mvn:org.eclipse.jetty/jetty-util/${jetty.version} + mvn:org.eclipse.jetty/jetty-io/${jetty.version} + mvn:org.eclipse.jetty/jetty-proxy/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-api/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-common/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-client/${jetty.version} + + + + openhab-core-io-transport-mdns + + + + openhab-core-io-transport-mqtt + + + + openhab-core-io-transport-serial-rfc2217 + openhab-core-config-serial + openhab-core-config-discovery-usbserial + + + + openhab-core-io-transport-upnp +
diff --git a/features/karaf/openhab-tp/pom.xml b/features/karaf/openhab-tp/pom.xml index 184817b4f..50a7ea5a8 100644 --- a/features/karaf/openhab-tp/pom.xml +++ b/features/karaf/openhab-tp/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/features/karaf/openhab-tp/src/main/feature/feature.xml b/features/karaf/openhab-tp/src/main/feature/feature.xml index 620df8283..04a59c6c4 100644 --- a/features/karaf/openhab-tp/src/main/feature/feature.xml +++ b/features/karaf/openhab-tp/src/main/feature/feature.xml @@ -15,296 +15,297 @@ --> - - openhab.tp;feature=base;version=1.0.0 + + openhab.tp;feature=base;version=1.0.0 - scr - eventadmin + scr + eventadmin - - mvn:commons-codec/commons-codec/1.6 - mvn:org.apache.commons/commons-exec/1.1 - mvn:commons-io/commons-io/2.2 - mvn:commons-lang/commons-lang/2.6 + + mvn:commons-codec/commons-codec/1.6 + mvn:org.apache.commons/commons-exec/1.1 + mvn:commons-io/commons-io/2.2 + mvn:commons-lang/commons-lang/2.6 - - mvn:javax.measure/unit-api/1.0 - mvn:tec.uom/uom-se/1.0.10 - mvn:tec.uom.lib/uom-lib-common/1.0.3 + + mvn:javax.measure/unit-api/1.0 + mvn:tec.uom/uom-se/1.0.10 + mvn:tec.uom.lib/uom-lib-common/1.0.3 - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream/1.4.7_1 - mvn:joda-time/joda-time/2.9.2 - + + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream/1.4.7_1 + mvn:joda-time/joda-time/2.9.2 + - - openhab.tp;feature=coap;version=2.0.0 - mvn:org.eclipse.californium/californium-osgi/2.0.0 - mvn:org.eclipse.californium/californium-core/2.0.0 - mvn:org.eclipse.californium/element-connector/2.0.0 - mvn:org.eclipse.californium/scandium/2.0.0 - + + openhab.tp;feature=coap;version=2.0.0 + mvn:org.eclipse.californium/californium-osgi/2.0.0 + mvn:org.eclipse.californium/californium-core/2.0.0 + mvn:org.eclipse.californium/element-connector/2.0.0 + mvn:org.eclipse.californium/scandium/2.0.0 + - - openhab.tp;feature=commons-net;version=3.3 - mvn:commons-net/commons-net/3.3 - + + openhab.tp;feature=commons-net;version=3.3 + mvn:commons-net/commons-net/3.3 + - - openhab.tp;feature=gson;version=2.8.2.v20180104-1110 - mvn:org.eclipse.orbit.bundles/com.google.gson/2.8.2.v20180104-1110 - + + openhab.tp;feature=gson;version=2.8.2.v20180104-1110 + mvn:org.eclipse.orbit.bundles/com.google.gson/2.8.2.v20180104-1110 + - - openhab.tp;feature=hivemqclient;version=1.1.1 - openhab.tp-netty - mvn:org.jctools/jctools-core/2.1.2 - mvn:io.reactivex.rxjava2/rxjava/2.2.5 - mvn:org.reactivestreams/reactive-streams/1.0.2 - mvn:org.openhab.osgiify/com.google.dagger/2.20 - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2 - mvn:com.hivemq/hivemq-mqtt-client/1.1.2 - + + openhab.tp;feature=hivemqclient;version=1.1.1 + openhab.tp-netty + mvn:org.jctools/jctools-core/2.1.2 + mvn:io.reactivex.rxjava2/rxjava/2.2.5 + mvn:org.reactivestreams/reactive-streams/1.0.2 + mvn:org.openhab.osgiify/com.google.dagger/2.20 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2 + mvn:com.hivemq/hivemq-mqtt-client/1.1.2 + - - openhab.tp;feature=httpclient;version=${jetty.version} - mvn:javax.servlet/javax.servlet-api/3.1.0 - mvn:org.eclipse.jetty/jetty-client/${jetty.version} - mvn:org.eclipse.jetty/jetty-http/${jetty.version} - mvn:org.eclipse.jetty/jetty-util/${jetty.version} - mvn:org.eclipse.jetty/jetty-io/${jetty.version} - mvn:org.eclipse.jetty/jetty-proxy/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-api/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-common/${jetty.version} - mvn:org.eclipse.jetty.websocket/websocket-client/${jetty.version} - + + openhab.tp;feature=httpclient;version=${jetty.version} + mvn:javax.servlet/javax.servlet-api/3.1.0 + mvn:org.eclipse.jetty/jetty-client/${jetty.version} + mvn:org.eclipse.jetty/jetty-http/${jetty.version} + mvn:org.eclipse.jetty/jetty-util/${jetty.version} + mvn:org.eclipse.jetty/jetty-io/${jetty.version} + mvn:org.eclipse.jetty/jetty-proxy/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-api/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-common/${jetty.version} + mvn:org.eclipse.jetty.websocket/websocket-client/${jetty.version} + - - openhab.tp;feature=jackson;version=2.9.10 - mvn:com.fasterxml.jackson.core/jackson-annotations/2.9.10 - mvn:com.fasterxml.jackson.core/jackson-core/2.9.10 - mvn:com.fasterxml.jackson.core/jackson-databind/2.9.10 - mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.9.10 - mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.9.10 - mvn:com.fasterxml.jackson.datatype/jackson-datatype-joda/2.9.10 - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.9.10 - mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.10 - mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.9.10 - mvn:org.yaml/snakeyaml/1.23 - + + openhab.tp;feature=jackson;version=2.9.10 + mvn:com.fasterxml.jackson.core/jackson-annotations/2.9.10 + mvn:com.fasterxml.jackson.core/jackson-core/2.9.10 + mvn:com.fasterxml.jackson.core/jackson-databind/2.9.10 + mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-xml/2.9.10 + mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/2.9.10 + mvn:com.fasterxml.jackson.datatype/jackson-datatype-joda/2.9.10 + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.9.10 + mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.9.10 + mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.9.10 + mvn:org.yaml/snakeyaml/1.23 + - - openhab.tp;feature=jax-rs;version=5.3.1 - openhab.tp-jax-rs-min - + + openhab.tp;feature=jax-rs;version=5.3.1 + openhab.tp-jax-rs-min + - - openhab.tp;feature=jax-rs-min;version=5.3.1 - http - openhab.tp-kat.cpy-jersey-min-2.22.2 - mvn:com.eclipsesource.jaxrs/publisher/5.3.1 - - root=/rest - - + + openhab.tp;feature=jax-rs-min;version=5.3.1 + http + openhab.tp-kat.cpy-jersey-min-2.22.2 + mvn:com.eclipsesource.jaxrs/publisher/5.3.1 + + root=/rest + + - - openhab.tp;feature=jbbp;version=1.4.1 - mvn:org.openhab.osgiify/com.igormaznitsa.jbbp/1.4.1 - - - - http - mvn:org.glassfish.jersey.containers/jersey-container-servlet/2.22.2 - mvn:org.glassfish.jersey.media/jersey-media-sse/2.22.2 - mvn:org.glassfish.jersey.media/jersey-media-multipart/2.22.2 - mvn:org.glassfish.jersey.containers/jersey-container-servlet-core/2.22.2 - mvn:org.glassfish.jersey.core/jersey-common/2.22.2 - mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/2.22.2 - mvn:org.glassfish.jersey.core/jersey-server/2.22.2 - mvn:org.glassfish.jersey.core/jersey-client/2.22.2 - mvn:org.glassfish.jersey.media/jersey-media-jaxb/2.22.2 - mvn:org.glassfish.hk2/hk2-api/2.4.0-b34 - mvn:org.glassfish.hk2/hk2-locator/2.4.0-b34 - mvn:org.glassfish.hk2/hk2-utils/2.4.0-b34 - mvn:org.glassfish.hk2/osgi-resource-locator/1.0.1 - mvn:org.glassfish.hk2.external/javax.inject/2.4.0-b34 - mvn:org.glassfish.hk2.external/aopalliance-repackaged/2.4.0-b34 - mvn:javax.annotation/javax.annotation-api/1.2 - mvn:javax.validation/validation-api/1.1.0.Final - mvn:javax.ws.rs/javax.ws.rs-api/2.0.1 - mvn:org.javassist/javassist/3.18.1-GA - mvn:org.jvnet.mimepull/mimepull/1.9.6 - + + openhab.tp;feature=jbbp;version=1.4.1 + mvn:org.openhab.osgiify/com.igormaznitsa.jbbp/1.4.1 + - - openhab.tp;feature=netty;version=4.1.42.Final - mvn:io.netty/netty-buffer/4.1.42.Final - mvn:io.netty/netty-common/4.1.42.Final - mvn:io.netty/netty-codec/4.1.42.Final - mvn:io.netty/netty-codec-http/4.1.42.Final - mvn:io.netty/netty-codec-mqtt/4.1.42.Final - mvn:io.netty/netty-handler/4.1.42.Final - mvn:io.netty/netty-resolver/4.1.42.Final - mvn:io.netty/netty-transport/4.1.42.Final - mvn:io.netty/netty-transport-native-epoll/4.1.42.Final - mvn:io.netty/netty-transport-native-unix-common/4.1.42.Final - + + http + mvn:org.glassfish.jersey.containers/jersey-container-servlet/2.22.2 + mvn:org.glassfish.jersey.media/jersey-media-sse/2.22.2 + mvn:org.glassfish.jersey.media/jersey-media-multipart/2.22.2 + mvn:org.glassfish.jersey.containers/jersey-container-servlet-core/2.22.2 + mvn:org.glassfish.jersey.core/jersey-common/2.22.2 + mvn:org.glassfish.jersey.bundles.repackaged/jersey-guava/2.22.2 + mvn:org.glassfish.jersey.core/jersey-server/2.22.2 + mvn:org.glassfish.jersey.core/jersey-client/2.22.2 + mvn:org.glassfish.jersey.media/jersey-media-jaxb/2.22.2 + mvn:org.glassfish.hk2/hk2-api/2.4.0-b34 + mvn:org.glassfish.hk2/hk2-locator/2.4.0-b34 + mvn:org.glassfish.hk2/hk2-utils/2.4.0-b34 + mvn:org.glassfish.hk2/osgi-resource-locator/1.0.1 + mvn:org.glassfish.hk2.external/javax.inject/2.4.0-b34 + mvn:org.glassfish.hk2.external/aopalliance-repackaged/2.4.0-b34 + mvn:javax.annotation/javax.annotation-api/1.2 + mvn:javax.validation/validation-api/1.1.0.Final + mvn:javax.ws.rs/javax.ws.rs-api/2.0.1 + mvn:org.javassist/javassist/3.18.1-GA + mvn:org.jvnet.mimepull/mimepull/1.9.6 + - - openhab.tp;feature=jaxb;version=2.9.0 - mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0 - mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/2.9.0 - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.11_1 - + + openhab.tp;feature=netty;version=4.1.42.Final + mvn:io.netty/netty-buffer/4.1.42.Final + mvn:io.netty/netty-common/4.1.42.Final + mvn:io.netty/netty-codec/4.1.42.Final + mvn:io.netty/netty-codec-http/4.1.42.Final + mvn:io.netty/netty-codec-mqtt/4.1.42.Final + mvn:io.netty/netty-handler/4.1.42.Final + mvn:io.netty/netty-resolver/4.1.42.Final + mvn:io.netty/netty-transport/4.1.42.Final + mvn:io.netty/netty-transport-native-epoll/4.1.42.Final + mvn:io.netty/netty-transport-native-unix-common/4.1.42.Final + - - openhab.tp;feature=jax-ws;version=2.9.0 - mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/2.9.0 - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/1.3.23_2 - mvn:org.jvnet.staxex/stax-ex/1.7.4 - + + openhab.tp;feature=jaxb;version=2.9.0 + mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0 + mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/2.9.0 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.11_1 + - - openhab.tp;feature=jollyday;version=0.5.8 - mvn:org.threeten/threeten-extra/1.4 - mvn:de.jollyday/jollyday/0.5.8 - + + openhab.tp;feature=jax-ws;version=2.9.0 + mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/2.9.0 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/1.3.23_2 + mvn:org.jvnet.staxex/stax-ex/1.7.4 + - - openhab.tp;feature=jmdns;version=3.5.5 - mvn:org.jmdns/jmdns/3.5.5 - + + openhab.tp;feature=jollyday;version=0.5.8 + mvn:org.threeten/threeten-extra/1.4 + mvn:de.jollyday/jollyday/0.5.8 + - - openhab.tp;feature=jupnp;version=2.5.2 - http - scr - openhab.tp-httpclient - mvn:org.jupnp/org.jupnp/2.5.2 - + + openhab.tp;feature=jmdns;version=3.5.5 + mvn:org.jmdns/jmdns/3.5.5 + - - openhab.tp;feature=lsp4j;version=0.8.0 - mvn:org.eclipse.lsp4j/org.eclipse.lsp4j/0.8.0 - mvn:org.eclipse.lsp4j/org.eclipse.lsp4j.jsonrpc/0.8.0 + + openhab.tp;feature=jupnp;version=2.5.2 + http + scr + openhab.tp-httpclient + mvn:org.jupnp/org.jupnp/2.5.2 + - openhab.tp-gson - openhab.tp-xtext - + + openhab.tp;feature=lsp4j;version=0.8.0 + mvn:org.eclipse.lsp4j/org.eclipse.lsp4j/0.8.0 + mvn:org.eclipse.lsp4j/org.eclipse.lsp4j.jsonrpc/0.8.0 - - openhab.tp;feature=mapdb;version=1.0.9 + openhab.tp-gson + openhab.tp-xtext + - mvn:org.mapdb/mapdb/1.0.9 - + + openhab.tp;feature=mapdb;version=1.0.9 - - openhab.tp;feature=serial;impl=javacomm - mvn:org.eclipse.kura/org.eclipse.soda.dk.comm/1.2.201 - mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.armv6hf/1.2.201 - mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.aarch64/1.2.201 - mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.x86_64/1.2.201 - + mvn:org.mapdb/mapdb/1.0.9 + - - openhab.tp;feature=serial;impl=rxtx + + openhab.tp;feature=serial;impl=javacomm + mvn:org.eclipse.kura/org.eclipse.soda.dk.comm/1.2.201 + mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.armv6hf/1.2.201 + mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.aarch64/1.2.201 + mvn:org.eclipse.kura/org.eclipse.soda.dk.comm.x86_64/1.2.201 + - - - - - mvn:org.openhab/nrjavaserial/3.15.0.OH2 - + + openhab.tp;feature=serial;impl=rxtx - - openhab.tp;feature=xtext;version=2.19.0 + + + + + mvn:org.openhab/nrjavaserial/3.15.0.OH2 + - mvn:org.eclipse.xtext/org.eclipse.xtext/2.19.0 + + openhab.tp;feature=xtext;version=2.19.0 - mvn:org.eclipse.orbit.bundles/io.github.classgraph/4.8.35.v20190528-1517 + mvn:org.eclipse.xtext/org.eclipse.xtext/2.19.0 - mvn:org.eclipse.emf/org.eclipse.emf.common/2.12.0 - mvn:org.eclipse.emf/org.eclipse.emf.ecore/2.12.0 - mvn:org.eclipse.emf/org.eclipse.emf.ecore.change/2.11.0 - mvn:org.eclipse.emf/org.eclipse.emf.ecore.xmi/2.12.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.common.types/2.19.0 + mvn:org.eclipse.orbit.bundles/io.github.classgraph/4.8.35.v20190528-1517 - mvn:javax.annotation/javax.annotation-api/1.2 + mvn:org.eclipse.emf/org.eclipse.emf.common/2.12.0 + mvn:org.eclipse.emf/org.eclipse.emf.ecore/2.12.0 + mvn:org.eclipse.emf/org.eclipse.emf.ecore.change/2.11.0 + mvn:org.eclipse.emf/org.eclipse.emf.ecore.xmi/2.12.0 + mvn:org.eclipse.xtext/org.eclipse.xtext.common.types/2.19.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.xbase/2.19.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.xbase.lib/2.19.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.smap/2.19.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.util/2.19.0 - mvn:org.eclipse.xtend/org.eclipse.xtend.lib/2.19.0 - mvn:org.eclipse.xtend/org.eclipse.xtend.lib.macro/2.19.0 + mvn:javax.annotation/javax.annotation-api/1.2 - mvn:com.google.guava/failureaccess/1.0.1 - mvn:com.google.guava/guava/27.1-jre - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2 + mvn:org.eclipse.xtext/org.eclipse.xtext.xbase/2.19.0 + mvn:org.eclipse.xtext/org.eclipse.xtext.xbase.lib/2.19.0 + mvn:org.eclipse.xtext/org.eclipse.xtext.smap/2.19.0 + mvn:org.eclipse.xtext/org.eclipse.xtext.util/2.19.0 + mvn:org.eclipse.xtend/org.eclipse.xtend.lib/2.19.0 + mvn:org.eclipse.xtend/org.eclipse.xtend.lib.macro/2.19.0 - - - + mvn:com.google.guava/failureaccess/1.0.1 + mvn:com.google.guava/guava/27.1-jre + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2 + + + + - mvn:de.maggu2810.p2redist/com.google.inject/3.0.0.v201312141243 - mvn:de.maggu2810.p2redist/org.antlr.runtime/3.2.0.v201101311130 + mvn:de.maggu2810.p2redist/com.google.inject/3.0.0.v201312141243 + mvn:de.maggu2810.p2redist/org.antlr.runtime/3.2.0.v201101311130 - mvn:org.eclipse.platform/org.eclipse.equinox.common/3.10.400 - mvn:org.eclipse.platform/org.eclipse.equinox.registry/3.8.400 - mvn:org.eclipse.platform/org.eclipse.equinox.supplement/1.9.0 + mvn:org.eclipse.platform/org.eclipse.equinox.common/3.10.400 + mvn:org.eclipse.platform/org.eclipse.equinox.registry/3.8.400 + mvn:org.eclipse.platform/org.eclipse.equinox.supplement/1.9.0 - - - mvn:org.ow2.asm/asm/7.1 - + + + mvn:org.ow2.asm/asm/7.1 + - - openhab.tp;feature=xtext-ide;version=2.19.0 - openhab.tp-xtext + + openhab.tp;feature=xtext-ide;version=2.19.0 + openhab.tp-xtext - - mvn:org.eclipse.xtext/org.eclipse.xtext.ide/2.19.0 - mvn:org.eclipse.xtext/org.eclipse.xtext.xbase.ide/2.19.0 - + + mvn:org.eclipse.xtext/org.eclipse.xtext.ide/2.19.0 + mvn:org.eclipse.xtext/org.eclipse.xtext.xbase.ide/2.19.0 + - + - -
- This feature is currently only for external usage by products and not used by openHAB Core itself. -
- openhab.tp;feature=jax-rs-provider-swagger;version=1.1.1 - openhab.tp-jax-rs-min - openhab.tp-jackson - - openhab.tp-kat.cpy-jersey-min-2.22.2 - mvn:de.maggu2810.thirdparty.modified.io.swagger/swagger-jersey2-jaxrs/1.5.8.v20160511-1038 - mvn:io.swagger/swagger-annotations/1.5.8 - mvn:io.swagger/swagger-core/1.5.8 - mvn:io.swagger/swagger-jaxrs/1.5.8 - mvn:io.swagger/swagger-models/1.5.8 - mvn:de.maggu2810.thirdparty.modified.org.reflections/reflections/0.9.10.v20160429-1435 - mvn:com.google.code.findbugs/annotations/2.0.1 - mvn:com.google.guava/guava/18.0 - mvn:javax.validation/validation-api/1.1.0.Final - mvn:joda-time/joda-time/2.2 - mvn:org.apache.commons/commons-lang3/3.2.1 - mvn:org.codehaus.woodstox/stax2-api/3.1.4 - mvn:org.javassist/javassist/3.19.0-GA - mvn:org.slf4j/slf4j-api/1.7.7 - + +
+ This feature is currently only for external usage by products and not used by openHAB Core itself. +
+ openhab.tp;feature=jax-rs-provider-swagger;version=1.1.1 + openhab.tp-jax-rs-min + openhab.tp-jackson + + openhab.tp-kat.cpy-jersey-min-2.22.2 + mvn:de.maggu2810.thirdparty.modified.io.swagger/swagger-jersey2-jaxrs/1.5.8.v20160511-1038 + mvn:io.swagger/swagger-annotations/1.5.8 + mvn:io.swagger/swagger-core/1.5.8 + mvn:io.swagger/swagger-jaxrs/1.5.8 + mvn:io.swagger/swagger-models/1.5.8 + mvn:de.maggu2810.thirdparty.modified.org.reflections/reflections/0.9.10.v20160429-1435 + mvn:com.google.code.findbugs/annotations/2.0.1 + mvn:com.google.guava/guava/18.0 + mvn:javax.validation/validation-api/1.1.0.Final + mvn:joda-time/joda-time/2.2 + mvn:org.apache.commons/commons-lang3/3.2.1 + mvn:org.codehaus.woodstox/stax2-api/3.1.4 + mvn:org.javassist/javassist/3.19.0-GA + mvn:org.slf4j/slf4j-api/1.7.7 + - mvn:de.maggu2810.thirdparty.modified.com.eclipsesource.jaxrs/provider-swagger/1.1.1.201605111122 - - swagger.basePath=/rest - swagger.info.title=openHAB REST API - -
+ mvn:de.maggu2810.thirdparty.modified.com.eclipsesource.jaxrs/provider-swagger/1.1.1.201605111122 + + swagger.basePath=/rest + swagger.info.title=openHAB REST API + +
diff --git a/features/karaf/pom.xml b/features/karaf/pom.xml index 420ea890b..62f60a568 100644 --- a/features/karaf/pom.xml +++ b/features/karaf/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/features/pom.xml b/features/pom.xml index 1c16cb0f1..377fe70c8 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.auth.oauth2client.tests/pom.xml b/itests/org.openhab.core.auth.oauth2client.tests/pom.xml index 4a8c66fc2..a6c0cd9c1 100644 --- a/itests/org.openhab.core.auth.oauth2client.tests/pom.xml +++ b/itests/org.openhab.core.auth.oauth2client.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/cipher/CipherTest.java b/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/cipher/CipherTest.java index 6dc486b32..3217102e1 100644 --- a/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/cipher/CipherTest.java +++ b/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/cipher/CipherTest.java @@ -22,9 +22,9 @@ import java.security.NoSuchAlgorithmException; import java.util.Dictionary; import java.util.Hashtable; -import org.openhab.core.auth.oauth2client.internal.cipher.SymmetricKeyCipher; import org.junit.Before; import org.junit.Test; +import org.openhab.core.auth.oauth2client.internal.cipher.SymmetricKeyCipher; import org.osgi.framework.InvalidSyntaxException; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/console/ConsoleOAuthCommandExtension.java b/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/console/ConsoleOAuthCommandExtension.java index 121f62854..01f4f82b6 100644 --- a/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/console/ConsoleOAuthCommandExtension.java +++ b/itests/org.openhab.core.auth.oauth2client.tests/src/main/java/org/openhab/core/auth/oauth2client/test/internal/console/ConsoleOAuthCommandExtension.java @@ -16,14 +16,14 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; -import org.openhab.core.auth.oauth2client.test.internal.AbstractTestAgent; -import org.openhab.core.auth.oauth2client.test.internal.AuthorizationCodeTestAgent; -import org.openhab.core.auth.oauth2client.test.internal.ResourceOwnerTestAgent; -import org.openhab.core.auth.oauth2client.test.internal.TestAgent; import org.openhab.core.auth.client.oauth2.AccessTokenResponse; import org.openhab.core.auth.client.oauth2.OAuthClientService; import org.openhab.core.auth.client.oauth2.OAuthException; import org.openhab.core.auth.client.oauth2.OAuthResponseException; +import org.openhab.core.auth.oauth2client.test.internal.AbstractTestAgent; +import org.openhab.core.auth.oauth2client.test.internal.AuthorizationCodeTestAgent; +import org.openhab.core.auth.oauth2client.test.internal.ResourceOwnerTestAgent; +import org.openhab.core.auth.oauth2client.test.internal.TestAgent; import org.openhab.core.io.console.Console; import org.openhab.core.io.console.extensions.AbstractConsoleCommandExtension; import org.openhab.core.io.console.extensions.ConsoleCommandExtension; diff --git a/itests/org.openhab.core.automation.integration.tests/pom.xml b/itests/org.openhab.core.automation.integration.tests/pom.xml index 3af30b42f..b986bc272 100644 --- a/itests/org.openhab.core.automation.integration.tests/pom.xml +++ b/itests/org.openhab.core.automation.integration.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationJsonTest.java b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationJsonTest.java index 492d0ab40..01c2ebd25 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationJsonTest.java +++ b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationJsonTest.java @@ -23,23 +23,6 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.storage.StorageService; -import org.openhab.core.types.UnDefType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -58,6 +41,23 @@ import org.openhab.core.automation.type.Input; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; +import org.openhab.core.types.UnDefType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationTest.java b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationTest.java index b53c2369a..7efc707cb 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationTest.java +++ b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/AutomationIntegrationTest.java @@ -31,23 +31,6 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.storage.StorageService; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -76,6 +59,23 @@ import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.type.TriggerType; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/HostFragmentSupportTest.java b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/HostFragmentSupportTest.java index 2a0c7c701..c192e87ac 100644 --- a/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/HostFragmentSupportTest.java +++ b/itests/org.openhab.core.automation.integration.tests/src/main/java/org/openhab/core/automation/integration/test/HostFragmentSupportTest.java @@ -19,12 +19,12 @@ import java.util.Arrays; import java.util.List; import java.util.Locale; -import org.openhab.core.storage.StorageService; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.type.ModuleTypeRegistry; +import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; import org.osgi.framework.FrameworkEvent; diff --git a/itests/org.openhab.core.automation.module.core.tests/pom.xml b/itests/org.openhab.core.automation.module.core.tests/pom.xml index c33b82452..189a3fdf6 100644 --- a/itests/org.openhab.core.automation.module.core.tests/pom.xml +++ b/itests/org.openhab.core.automation.module.core.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RunRuleModuleTest.java b/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RunRuleModuleTest.java index 1ac04087a..41ad67fbf 100644 --- a/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RunRuleModuleTest.java +++ b/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RunRuleModuleTest.java @@ -26,8 +26,17 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.openhab.core.config.core.Configuration; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.automation.Rule; +import org.openhab.core.automation.RuleManager; +import org.openhab.core.automation.RuleRegistry; +import org.openhab.core.automation.RuleStatus; +import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.automation.util.RuleBuilder; import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; @@ -42,15 +51,6 @@ import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.OnOffType; import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.test.storage.VolatileStorageService; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.openhab.core.automation.Rule; -import org.openhab.core.automation.RuleManager; -import org.openhab.core.automation.RuleRegistry; -import org.openhab.core.automation.RuleStatus; -import org.openhab.core.automation.util.ModuleBuilder; -import org.openhab.core.automation.util.RuleBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RuntimeRuleTest.java b/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RuntimeRuleTest.java index 1f082cca7..b83edd63c 100644 --- a/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RuntimeRuleTest.java +++ b/itests/org.openhab.core.automation.module.core.tests/src/main/java/org/openhab/core/automation/internal/module/RuntimeRuleTest.java @@ -26,23 +26,6 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.types.TypeParser; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -58,6 +41,23 @@ import org.openhab.core.automation.internal.module.handler.CompareConditionHandl import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; +import org.openhab.core.types.TypeParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.script.defaultscope.tests/pom.xml b/itests/org.openhab.core.automation.module.script.defaultscope.tests/pom.xml index 9201a1a50..dcc5626a6 100644 --- a/itests/org.openhab.core.automation.module.script.defaultscope.tests/pom.xml +++ b/itests/org.openhab.core.automation.module.script.defaultscope.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/java/org/openhab/core/automation/module/script/defaultscope/internal/ScopeTest.java b/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/java/org/openhab/core/automation/module/script/defaultscope/internal/ScopeTest.java index 0403d1f92..6a421234a 100644 --- a/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/java/org/openhab/core/automation/module/script/defaultscope/internal/ScopeTest.java +++ b/itests/org.openhab.core.automation.module.script.defaultscope.tests/src/main/java/org/openhab/core/automation/module/script/defaultscope/internal/ScopeTest.java @@ -19,11 +19,11 @@ import java.net.URL; import javax.script.ScriptEngine; import javax.script.ScriptException; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.module.script.ScriptEngineContainer; import org.openhab.core.automation.module.script.ScriptEngineManager; +import org.openhab.core.test.java.JavaOSGiTest; /** * This tests the script modules diff --git a/itests/org.openhab.core.automation.module.script.tests/pom.xml b/itests/org.openhab.core.automation.module.script.tests/pom.xml index 75708580b..70d82fc13 100644 --- a/itests/org.openhab.core.automation.module.script.tests/pom.xml +++ b/itests/org.openhab.core.automation.module.script.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.module.script.tests/src/main/java/org/openhab/core/automation/module/script/ScriptRuleTest.java b/itests/org.openhab.core.automation.module.script.tests/src/main/java/org/openhab/core/automation/module/script/ScriptRuleTest.java index 0c0a8c16a..1f10ec4e4 100644 --- a/itests/org.openhab.core.automation.module.script.tests/src/main/java/org/openhab/core/automation/module/script/ScriptRuleTest.java +++ b/itests/org.openhab.core.automation.module.script.tests/src/main/java/org/openhab/core/automation/module/script/ScriptRuleTest.java @@ -22,6 +22,16 @@ import java.util.Optional; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.automation.Action; +import org.openhab.core.automation.Condition; +import org.openhab.core.automation.Rule; +import org.openhab.core.automation.RuleManager; +import org.openhab.core.automation.RuleRegistry; +import org.openhab.core.automation.RuleStatus; +import org.openhab.core.automation.RuleStatusInfo; +import org.openhab.core.automation.Trigger; import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; @@ -37,16 +47,6 @@ import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.OnOffType; import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.test.storage.VolatileStorageService; -import org.junit.Before; -import org.junit.Test; -import org.openhab.core.automation.Action; -import org.openhab.core.automation.Condition; -import org.openhab.core.automation.Rule; -import org.openhab.core.automation.RuleManager; -import org.openhab.core.automation.RuleRegistry; -import org.openhab.core.automation.RuleStatus; -import org.openhab.core.automation.RuleStatusInfo; -import org.openhab.core.automation.Trigger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.timer.tests/pom.xml b/itests/org.openhab.core.automation.module.timer.tests/pom.xml index 66794a55e..5a5e5baa4 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/pom.xml +++ b/itests/org.openhab.core.automation.module.timer.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/BasicConditionHandlerTest.java b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/BasicConditionHandlerTest.java index 75907494f..4fdfe2027 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/BasicConditionHandlerTest.java +++ b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/BasicConditionHandlerTest.java @@ -25,22 +25,6 @@ import java.util.Random; import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.Action; @@ -55,6 +39,22 @@ import org.openhab.core.automation.internal.module.handler.ItemCommandActionHand import org.openhab.core.automation.internal.module.handler.ItemStateTriggerHandler; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/DayOfWeekConditionHandlerTest.java b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/DayOfWeekConditionHandlerTest.java index 9ced33fdc..4b204915b 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/DayOfWeekConditionHandlerTest.java +++ b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/DayOfWeekConditionHandlerTest.java @@ -21,12 +21,12 @@ import java.util.Calendar; import java.util.Collections; import java.util.Locale; -import org.openhab.core.config.core.Configuration; import org.junit.Test; import org.openhab.core.automation.Condition; import org.openhab.core.automation.internal.module.handler.DayOfWeekConditionHandler; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.config.core.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/RuntimeRuleTest.java b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/RuntimeRuleTest.java index 5310bcaae..1f8684391 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/RuntimeRuleTest.java +++ b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/RuntimeRuleTest.java @@ -24,17 +24,6 @@ import java.util.Map; import java.util.Random; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.Action; @@ -49,6 +38,17 @@ import org.openhab.core.automation.internal.module.handler.GenericCronTriggerHan import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayConditionHandlerTest.java b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayConditionHandlerTest.java index 9a43962c3..2b9fbebb7 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayConditionHandlerTest.java +++ b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayConditionHandlerTest.java @@ -22,13 +22,13 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import org.openhab.core.config.core.Configuration; import org.junit.Test; import org.openhab.core.automation.Condition; import org.openhab.core.automation.internal.module.handler.DayOfWeekConditionHandler; import org.openhab.core.automation.internal.module.handler.TimeOfDayConditionHandler; import org.openhab.core.automation.type.ModuleTypeRegistry; import org.openhab.core.automation.util.ModuleBuilder; +import org.openhab.core.config.core.Configuration; /** * This tests the TimeOfDay Condition. diff --git a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayTriggerHandlerTest.java b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayTriggerHandlerTest.java index cf3858d85..365a7b3a6 100644 --- a/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayTriggerHandlerTest.java +++ b/itests/org.openhab.core.automation.module.timer.tests/src/main/java/org/openhab/core/automation/module/timer/internal/TimeOfDayTriggerHandlerTest.java @@ -15,13 +15,13 @@ package org.openhab.core.automation.module.timer.internal; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.RuleRegistry; import org.openhab.core.automation.internal.module.handler.TimeOfDayTriggerHandler; import org.openhab.core.automation.type.ModuleTypeRegistry; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; /** * this tests the timeOfDay trigger diff --git a/itests/org.openhab.core.automation.tests/pom.xml b/itests/org.openhab.core.automation.tests/pom.xml index 937337bea..2c920c9ec 100644 --- a/itests/org.openhab.core.automation.tests/pom.xml +++ b/itests/org.openhab.core.automation.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/event/RuleEventTest.java b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/event/RuleEventTest.java index 97b5fdc40..566318e1d 100644 --- a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/event/RuleEventTest.java +++ b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/event/RuleEventTest.java @@ -28,22 +28,6 @@ import java.util.Set; import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNull; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.ProviderChangeListener; -import org.openhab.core.events.Event; -import org.openhab.core.events.EventFilter; -import org.openhab.core.events.EventPublisher; -import org.openhab.core.events.EventSubscriber; -import org.openhab.core.items.Item; -import org.openhab.core.items.ItemNotFoundException; -import org.openhab.core.items.ItemProvider; -import org.openhab.core.items.ItemRegistry; -import org.openhab.core.items.events.ItemCommandEvent; -import org.openhab.core.items.events.ItemEventFactory; -import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.library.types.OnOffType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.openhab.core.test.storage.VolatileStorageService; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.Action; @@ -58,6 +42,22 @@ import org.openhab.core.automation.events.RuleStatusInfoEvent; import org.openhab.core.automation.events.RuleUpdatedEvent; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.events.Event; +import org.openhab.core.events.EventFilter; +import org.openhab.core.events.EventPublisher; +import org.openhab.core.events.EventSubscriber; +import org.openhab.core.items.Item; +import org.openhab.core.items.ItemNotFoundException; +import org.openhab.core.items.ItemProvider; +import org.openhab.core.items.ItemRegistry; +import org.openhab.core.items.events.ItemCommandEvent; +import org.openhab.core.items.events.ItemEventFactory; +import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.library.types.OnOffType; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.test.storage.VolatileStorageService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleEngineTest.java b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleEngineTest.java index 165101d2e..e39f37fb3 100644 --- a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleEngineTest.java +++ b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleEngineTest.java @@ -20,13 +20,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.openhab.core.config.core.ConfigDescriptionParameter; -import org.openhab.core.config.core.ConfigDescriptionParameter.Type; -import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; -import org.openhab.core.config.core.Configuration; -import org.openhab.core.config.core.FilterCriteria; -import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -40,6 +33,13 @@ import org.openhab.core.automation.Trigger; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.util.ModuleBuilder; import org.openhab.core.automation.util.RuleBuilder; +import org.openhab.core.config.core.ConfigDescriptionParameter; +import org.openhab.core.config.core.ConfigDescriptionParameter.Type; +import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; +import org.openhab.core.config.core.Configuration; +import org.openhab.core.config.core.FilterCriteria; +import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.test.java.JavaOSGiTest; /** * Test adding, retrieving and updating rules from the RuleEngineImpl diff --git a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleRegistryTest.java b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleRegistryTest.java index 6cbd651cc..646a9704b 100644 --- a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleRegistryTest.java +++ b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/RuleRegistryTest.java @@ -20,12 +20,12 @@ import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openhab.core.automation.Rule; import org.openhab.core.automation.RuleRegistry; +import org.openhab.core.test.java.JavaOSGiTest; /** * Testing the {@link Predicate}s for {@link RuleImpl}s. diff --git a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/TestModuleTypeProvider.java b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/TestModuleTypeProvider.java index b99128707..d396231fb 100644 --- a/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/TestModuleTypeProvider.java +++ b/itests/org.openhab.core.automation.tests/src/main/java/org/openhab/core/automation/internal/TestModuleTypeProvider.java @@ -26,7 +26,6 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.automation.type.ActionType; import org.openhab.core.automation.type.ConditionType; import org.openhab.core.automation.type.Input; @@ -34,6 +33,7 @@ import org.openhab.core.automation.type.ModuleType; import org.openhab.core.automation.type.ModuleTypeProvider; import org.openhab.core.automation.type.Output; import org.openhab.core.automation.type.TriggerType; +import org.openhab.core.common.registry.ProviderChangeListener; /** * ModuleTypeManagerMockup is a ModuleTypeManager which returns mockup module types for the following predefined module diff --git a/itests/org.openhab.core.binding.xml.tests/pom.xml b/itests/org.openhab.core.binding.xml.tests/pom.xml index b7ab43e62..d92353140 100644 --- a/itests/org.openhab.core.binding.xml.tests/pom.xml +++ b/itests/org.openhab.core.binding.xml.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoI18nTest.java b/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoI18nTest.java index eaf1d3631..8bb30c32c 100644 --- a/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoI18nTest.java +++ b/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoI18nTest.java @@ -20,12 +20,12 @@ import java.util.Hashtable; import java.util.Locale; import java.util.Set; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.binding.BindingInfo; import org.openhab.core.binding.BindingInfoRegistry; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoTest.java b/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoTest.java index a7f3d15b5..604217da6 100644 --- a/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoTest.java +++ b/itests/org.openhab.core.binding.xml.tests/src/main/java/org/openhab/core/binding/xml/test/BindingInfoTest.java @@ -20,14 +20,14 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.binding.BindingInfo; +import org.openhab.core.binding.BindingInfoRegistry; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.binding.BindingInfo; -import org.openhab.core.binding.BindingInfoRegistry; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Alex Tugarev - Initial contribution diff --git a/itests/org.openhab.core.binding.xml.tests/src/main/resources/test-bundle-pool/yahooweather.bundle/ESH-INF/binding/binding.xml b/itests/org.openhab.core.binding.xml.tests/src/main/resources/test-bundle-pool/yahooweather.bundle/ESH-INF/binding/binding.xml index 0f994ecb8..6aef12423 100644 --- a/itests/org.openhab.core.binding.xml.tests/src/main/resources/test-bundle-pool/yahooweather.bundle/ESH-INF/binding/binding.xml +++ b/itests/org.openhab.core.binding.xml.tests/src/main/resources/test-bundle-pool/yahooweather.bundle/ESH-INF/binding/binding.xml @@ -4,7 +4,8 @@ xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd"> YahooWeather Binding - The Yahoo Weather Binding requests the Yahoo Weather Service to show the current temperature, humidity and pressure. + The Yahoo Weather Binding requests the Yahoo Weather Service to show the current temperature, humidity and + pressure. Kai Kreuzer diff --git a/itests/org.openhab.core.config.core.tests/pom.xml b/itests/org.openhab.core.config.core.tests/pom.xml index 3cede515e..0963cfa9d 100644 --- a/itests/org.openhab.core.config.core.tests/pom.xml +++ b/itests/org.openhab.core.config.core.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.config.core.tests/src/main/java/org/openhab/core/config/core/ConfigOptionRegistryOSGiTest.java b/itests/org.openhab.core.config.core.tests/src/main/java/org/openhab/core/config/core/ConfigOptionRegistryOSGiTest.java index b4730d8b3..a6cf9a25c 100644 --- a/itests/org.openhab.core.config.core.tests/src/main/java/org/openhab/core/config/core/ConfigOptionRegistryOSGiTest.java +++ b/itests/org.openhab.core.config.core.tests/src/main/java/org/openhab/core/config/core/ConfigOptionRegistryOSGiTest.java @@ -22,9 +22,9 @@ import java.net.URI; import java.util.ArrayList; import java.util.List; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Before; import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; /** * Test the ConfigOptionRegistry diff --git a/itests/org.openhab.core.config.discovery.mdns.tests/pom.xml b/itests/org.openhab.core.config.discovery.mdns.tests/pom.xml index 91337400b..21ccea785 100644 --- a/itests/org.openhab.core.config.discovery.mdns.tests/pom.xml +++ b/itests/org.openhab.core.config.discovery.mdns.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.config.discovery.mdns.tests/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryServiceOSGiTest.java b/itests/org.openhab.core.config.discovery.mdns.tests/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryServiceOSGiTest.java index 2d4d885dd..2ded920af 100644 --- a/itests/org.openhab.core.config.discovery.mdns.tests/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryServiceOSGiTest.java +++ b/itests/org.openhab.core.config.discovery.mdns.tests/src/main/java/org/openhab/core/config/discovery/mdns/internal/MDNSDiscoveryServiceOSGiTest.java @@ -12,17 +12,17 @@ */ package org.openhab.core.config.discovery.mdns.internal; -import static org.openhab.core.config.discovery.DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.config.discovery.DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY; import java.io.IOException; import java.util.Hashtable; -import org.openhab.core.config.discovery.DiscoveryService; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.discovery.DiscoveryService; +import org.openhab.core.test.java.JavaOSGiTest; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.config.discovery.tests/pom.xml b/itests/org.openhab.core.config.discovery.tests/pom.xml index 6e9da1863..ada3adc97 100644 --- a/itests/org.openhab.core.config.discovery.tests/pom.xml +++ b/itests/org.openhab.core.config.discovery.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 org.openhab.core.itests diff --git a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/DiscoveryServiceRegistryOSGiTest.java b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/DiscoveryServiceRegistryOSGiTest.java index dbc37d128..c6ee983b7 100644 --- a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/DiscoveryServiceRegistryOSGiTest.java +++ b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/DiscoveryServiceRegistryOSGiTest.java @@ -21,15 +21,15 @@ import static org.mockito.MockitoAnnotations.initMocks; import java.util.ArrayList; import java.util.List; -import org.openhab.core.config.discovery.inbox.Inbox; -import org.openhab.core.thing.ThingRegistry; -import org.openhab.core.thing.ThingTypeUID; -import org.openhab.core.thing.ThingUID; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.config.discovery.inbox.Inbox; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.thing.ThingRegistry; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.thing.ThingUID; import org.osgi.framework.ServiceRegistration; /** diff --git a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/inbox/DynamicThingUpdateOSGiTest.java b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/inbox/DynamicThingUpdateOSGiTest.java index 3ef6df30e..564238dc6 100644 --- a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/inbox/DynamicThingUpdateOSGiTest.java +++ b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/inbox/DynamicThingUpdateOSGiTest.java @@ -20,9 +20,13 @@ import java.util.Collections; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.DiscoveryService; import org.openhab.core.config.discovery.internal.DiscoveryResultImpl; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingStatus; @@ -37,10 +41,6 @@ import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; /** * The {@link DynamicThingUpdateOSGiTest} checks if a {@link Thing} configuration is updated diff --git a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/internal/InboxOSGiTest.java b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/internal/InboxOSGiTest.java index 5aa680b66..4481ddf51 100644 --- a/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/internal/InboxOSGiTest.java +++ b/itests/org.openhab.core.config.discovery.tests/src/main/java/org/openhab/core/config/discovery/internal/InboxOSGiTest.java @@ -36,6 +36,9 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; @@ -55,6 +58,8 @@ import org.openhab.core.config.discovery.inbox.events.InboxUpdatedEvent; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; +import org.openhab.core.test.AsyncResultWrapper; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; @@ -68,11 +73,6 @@ import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; -import org.openhab.core.test.AsyncResultWrapper; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/pom.xml b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/pom.xml index 001554b8f..2011772cc 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/pom.xml +++ b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 org.openhab.core.itests diff --git a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/DeltaUsbSerialScannerTest.java b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/DeltaUsbSerialScannerTest.java index 4e5b07a1f..b30c24729 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/DeltaUsbSerialScannerTest.java +++ b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/DeltaUsbSerialScannerTest.java @@ -24,11 +24,11 @@ import static org.mockito.Mockito.*; import java.io.IOException; import java.util.HashSet; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; import org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.DeltaUsbSerialScanner.Delta; import org.openhab.core.config.discovery.usbserial.linuxsysfs.testutil.UsbSerialDeviceInformationGenerator; -import org.junit.Before; -import org.junit.Test; /** * Unit tests for the {@link DeltaUsbSerialScanner}. diff --git a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScannerTest.java b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScannerTest.java index 8da24795f..eb77f9611 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScannerTest.java +++ b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/PollingUsbSerialScannerTest.java @@ -13,20 +13,20 @@ package org.openhab.core.config.discovery.usbserial.linuxsysfs.internal; import static java.util.Arrays.asList; -import static org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.PollingUsbSerialScanner.PAUSE_BETWEEN_SCANS_IN_SECONDS_ATTRIBUTE; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; +import static org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.PollingUsbSerialScanner.PAUSE_BETWEEN_SCANS_IN_SECONDS_ATTRIBUTE; import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryListener; import org.openhab.core.config.discovery.usbserial.linuxsysfs.testutil.UsbSerialDeviceInformationGenerator; -import org.junit.Before; -import org.junit.Test; /** * Unit tests for the {@link PollingUsbSerialScanner}. diff --git a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/SysFsUsbSerialScannerTest.java b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/SysFsUsbSerialScannerTest.java index 276c65c66..afe514455 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/SysFsUsbSerialScannerTest.java +++ b/itests/org.openhab.core.config.discovery.usbserial.linuxsysfs.tests/src/main/java/org/openhab/core/config/discovery/usbserial/linuxsysfs/internal/SysFsUsbSerialScannerTest.java @@ -16,12 +16,12 @@ import static java.lang.Integer.toHexString; import static java.nio.file.Files.*; import static java.nio.file.attribute.PosixFilePermission.*; import static java.util.Arrays.asList; -import static org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.SysfsUsbSerialScanner.*; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeTrue; +import static org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.SysfsUsbSerialScanner.*; import java.io.IOException; import java.nio.file.Path; @@ -30,12 +30,12 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; -import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; import org.hamcrest.Matcher; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; /** * Unit tests for the {@link SysfsUsbSerialScanner}. diff --git a/itests/org.openhab.core.config.discovery.usbserial.tests/pom.xml b/itests/org.openhab.core.config.discovery.usbserial.tests/pom.xml index 6745f6e35..2cae8788d 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.tests/pom.xml +++ b/itests/org.openhab.core.config.discovery.usbserial.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.config.discovery.usbserial.tests/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryServiceTest.java b/itests/org.openhab.core.config.discovery.usbserial.tests/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryServiceTest.java index 421ae9383..f9e67d7fa 100644 --- a/itests/org.openhab.core.config.discovery.usbserial.tests/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryServiceTest.java +++ b/itests/org.openhab.core.config.discovery.usbserial.tests/src/main/java/org/openhab/core/config/discovery/usbserial/internal/UsbSerialDiscoveryServiceTest.java @@ -13,13 +13,13 @@ package org.openhab.core.config.discovery.usbserial.internal; import static java.util.Arrays.asList; -import static org.openhab.core.config.discovery.DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; +import static org.openhab.core.config.discovery.DiscoveryService.CONFIG_PROPERTY_BACKGROUND_DISCOVERY; import java.io.IOException; import java.util.HashMap; @@ -27,18 +27,18 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; import org.openhab.core.config.discovery.DiscoveryListener; import org.openhab.core.config.discovery.DiscoveryResult; import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation; import org.openhab.core.config.discovery.usbserial.UsbSerialDiscovery; import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryParticipant; import org.openhab.core.config.discovery.usbserial.testutil.UsbSerialDeviceInformationGenerator; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.config.dispatch.tests/pom.xml b/itests/org.openhab.core.config.dispatch.tests/pom.xml index 1033d8bcc..4333077fd 100644 --- a/itests/org.openhab.core.config.dispatch.tests/pom.xml +++ b/itests/org.openhab.core.config.dispatch.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java b/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java index b7fc92b34..4b4f1fe62 100644 --- a/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java +++ b/itests/org.openhab.core.config.dispatch.tests/src/main/java/org/openhab/core/config/dispatch/internal/ConfigDispatcherOSGiTest.java @@ -27,8 +27,6 @@ import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -38,6 +36,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runners.MethodSorters; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.test.java.JavaOSGiTest; import org.osgi.framework.InvalidSyntaxException; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.config.xml.tests/pom.xml b/itests/org.openhab.core.config.xml.tests/pom.xml index ce46a4a3f..1ddd97481 100644 --- a/itests/org.openhab.core.config.xml.tests/pom.xml +++ b/itests/org.openhab.core.config.xml.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.config.xml.tests/src/main/java/org/openhab/core/config/xml/test/ConfigDescriptionsTest.java b/itests/org.openhab.core.config.xml.tests/src/main/java/org/openhab/core/config/xml/test/ConfigDescriptionsTest.java index df1531b48..8296d12a1 100644 --- a/itests/org.openhab.core.config.xml.tests/src/main/java/org/openhab/core/config/xml/test/ConfigDescriptionsTest.java +++ b/itests/org.openhab.core.config.xml.tests/src/main/java/org/openhab/core/config/xml/test/ConfigDescriptionsTest.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Locale; import java.util.stream.Collectors; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; @@ -32,8 +34,6 @@ import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.test.BundleCloseable; import org.openhab.core.test.SyntheticBundleInstaller; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * The ConfigDescriptionsTest is a test for loading of configuration description from XML documents. diff --git a/itests/org.openhab.core.ephemeris.tests/pom.xml b/itests/org.openhab.core.ephemeris.tests/pom.xml index 93e59b904..44483d2f5 100644 --- a/itests/org.openhab.core.ephemeris.tests/pom.xml +++ b/itests/org.openhab.core.ephemeris.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.ephemeris.tests/src/main/java/org/openhab/core/ephemeris/internal/EphemerisManagerImplOSGiTest.java b/itests/org.openhab.core.ephemeris.tests/src/main/java/org/openhab/core/ephemeris/internal/EphemerisManagerImplOSGiTest.java index 83156de5c..416f96537 100644 --- a/itests/org.openhab.core.ephemeris.tests/src/main/java/org/openhab/core/ephemeris/internal/EphemerisManagerImplOSGiTest.java +++ b/itests/org.openhab.core.ephemeris.tests/src/main/java/org/openhab/core/ephemeris/internal/EphemerisManagerImplOSGiTest.java @@ -12,8 +12,8 @@ */ package org.openhab.core.ephemeris.internal; -import static org.openhab.core.ephemeris.internal.EphemerisManagerImpl.*; import static org.junit.Assert.*; +import static org.openhab.core.ephemeris.internal.EphemerisManagerImpl.*; import java.net.URI; import java.net.URL; @@ -31,13 +31,13 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.core.config.core.ParameterOption; -import org.openhab.core.ephemeris.EphemerisManager; -import org.openhab.core.test.java.JavaOSGiTest; import org.hamcrest.CoreMatchers; import org.junit.Assume; import org.junit.Before; import org.junit.Test; +import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.ephemeris.EphemerisManager; +import org.openhab.core.test.java.JavaOSGiTest; /** * Test class for {@link EphemerisManagerImpl}. diff --git a/itests/org.openhab.core.io.rest.core.tests/pom.xml b/itests/org.openhab.core.io.rest.core.tests/pom.xml index 649fef263..b90bfd63b 100644 --- a/itests/org.openhab.core.io.rest.core.tests/pom.xml +++ b/itests/org.openhab.core.io.rest.core.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResourceOSGITest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResourceOSGITest.java index b54958ebd..b582a7b67 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResourceOSGITest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/discovery/InboxResourceOSGITest.java @@ -19,15 +19,15 @@ import static org.mockito.Mockito.*; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.discovery.inbox.Inbox; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Christoph Knauf - Initial contribution diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResourceOSGiTest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResourceOSGiTest.java index e6b0fb757..fd2d01c2c 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResourceOSGiTest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/item/ItemResourceOSGiTest.java @@ -31,6 +31,10 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.apache.commons.io.IOUtils; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.openhab.core.io.rest.RESTResource; import org.openhab.core.items.GenericItem; import org.openhab.core.items.ItemProvider; import org.openhab.core.items.ManagedItemProvider; @@ -42,11 +46,7 @@ import org.openhab.core.items.dto.MetadataDTO; import org.openhab.core.library.items.DimmerItem; import org.openhab.core.library.items.StringItem; import org.openhab.core.library.items.SwitchItem; -import org.openhab.core.io.rest.RESTResource; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; import com.google.gson.JsonElement; import com.google.gson.JsonParser; diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResourceTest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResourceTest.java index ad71b6111..f9d4d66e5 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResourceTest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResourceTest.java @@ -21,6 +21,8 @@ import java.util.Date; import java.util.List; import java.util.TimeZone; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.i18n.TimeZoneProvider; import org.openhab.core.library.types.OnOffType; import org.openhab.core.persistence.HistoricItem; @@ -29,8 +31,6 @@ import org.openhab.core.persistence.QueryablePersistenceService; import org.openhab.core.persistence.dto.ItemHistoryDTO; import org.openhab.core.persistence.dto.ItemHistoryDTO.HistoryDataBean; import org.openhab.core.types.State; -import org.junit.Before; -import org.junit.Test; /** * Tests for PersistenceItem Restresource diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResourceTest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResourceTest.java index 8a666e062..98a68d15d 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResourceTest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/profile/ProfileTypeResourceTest.java @@ -22,6 +22,9 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaTest; import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileTypeBuilder; import org.openhab.core.thing.profiles.ProfileTypeRegistry; @@ -31,9 +34,6 @@ import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeBuilder; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.test.java.JavaTest; -import org.junit.Before; -import org.junit.Test; /** * Tests for the ProfileTypeResource diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResourceOSGiTest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResourceOSGiTest.java index 2399ab6e2..381974119 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResourceOSGiTest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/internal/service/ConfigurableServiceResourceOSGiTest.java @@ -26,11 +26,11 @@ import java.util.Map; import javax.ws.rs.core.Response; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.io.rest.core.service.ConfigurableServiceDTO; import org.openhab.core.test.AsyncResultWrapper; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperWithTransformOSGiTest.java b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperWithTransformOSGiTest.java index 1bb8844ed..f5a04c4ae 100644 --- a/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperWithTransformOSGiTest.java +++ b/itests/org.openhab.core.io.rest.core.tests/src/main/java/org/openhab/core/io/rest/core/item/EnrichedItemDTOMapperWithTransformOSGiTest.java @@ -20,15 +20,15 @@ import static org.mockito.MockitoAnnotations.initMocks; import java.math.BigDecimal; import java.util.Collections; -import org.openhab.core.library.items.NumberItem; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.service.StateDescriptionService; -import org.openhab.core.types.StateDescription; -import org.openhab.core.types.StateOption; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.library.items.NumberItem; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.service.StateDescriptionService; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.types.StateDescription; +import org.openhab.core.types.StateOption; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.model.core.tests/pom.xml b/itests/org.openhab.core.model.core.tests/pom.xml index e87914bf2..dc15be34d 100644 --- a/itests/org.openhab.core.model.core.tests/pom.xml +++ b/itests/org.openhab.core.model.core.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java b/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java index 0b20b1287..9c161b633 100644 --- a/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java +++ b/itests/org.openhab.core.model.core.tests/src/main/java/org/openhab/core/model/core/internal/folder/FolderObserverTest.java @@ -32,16 +32,16 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.SystemUtils; import org.eclipse.emf.ecore.EObject; -import org.openhab.core.config.core.ConfigConstants; -import org.openhab.core.service.AbstractWatchService; -import org.openhab.core.model.core.ModelParser; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.core.ModelRepositoryChangeListener; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.openhab.core.config.core.ConfigConstants; +import org.openhab.core.model.core.ModelParser; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.core.ModelRepositoryChangeListener; +import org.openhab.core.service.AbstractWatchService; +import org.openhab.core.test.java.JavaOSGiTest; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.model.item.tests/pom.xml b/itests/org.openhab.core.model.item.tests/pom.xml index 61178e124..e1a4ef9fa 100644 --- a/itests/org.openhab.core.model.item.tests/pom.xml +++ b/itests/org.openhab.core.model.item.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericItemProviderTest.java b/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericItemProviderTest.java index 7db6c9c64..9730c93f4 100644 --- a/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericItemProviderTest.java +++ b/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericItemProviderTest.java @@ -31,6 +31,9 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; @@ -51,15 +54,12 @@ import org.openhab.core.library.items.NumberItem; import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.ArithmeticGroupFunction; import org.openhab.core.library.types.OnOffType; -import org.openhab.core.types.StateDescription; -import org.openhab.core.types.UnDefType; import org.openhab.core.model.core.EventType; import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.core.ModelRepositoryChangeListener; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.openhab.core.types.StateDescription; +import org.openhab.core.types.UnDefType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericMetadataProviderTest.java b/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericMetadataProviderTest.java index 961eb0086..062f8fcd4 100644 --- a/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericMetadataProviderTest.java +++ b/itests/org.openhab.core.model.item.tests/src/main/java/org/openhab/core/model/item/internal/GenericMetadataProviderTest.java @@ -16,8 +16,8 @@ import static org.junit.Assert.*; import java.util.Collection; -import org.openhab.core.items.Metadata; import org.junit.Test; +import org.openhab.core.items.Metadata; /** * @author Simon Kaufmann - Initial contribution diff --git a/itests/org.openhab.core.model.persistence.tests/pom.xml b/itests/org.openhab.core.model.persistence.tests/pom.xml index 81a171dee..8c36c5dc1 100644 --- a/itests/org.openhab.core.model.persistence.tests/pom.xml +++ b/itests/org.openhab.core.model.persistence.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.persistence.tests/src/main/java/org/openhab/core/model/persistence/extensions/PersistenceExtensionsTest.java b/itests/org.openhab.core.model.persistence.tests/src/main/java/org/openhab/core/model/persistence/extensions/PersistenceExtensionsTest.java index 0c637f76c..3857b5f38 100644 --- a/itests/org.openhab.core.model.persistence.tests/src/main/java/org/openhab/core/model/persistence/extensions/PersistenceExtensionsTest.java +++ b/itests/org.openhab.core.model.persistence.tests/src/main/java/org/openhab/core/model/persistence/extensions/PersistenceExtensionsTest.java @@ -18,19 +18,19 @@ import java.util.Collections; import java.util.List; import java.util.Set; -import org.openhab.core.items.GenericItem; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.persistence.HistoricItem; -import org.openhab.core.persistence.PersistenceService; -import org.openhab.core.persistence.PersistenceServiceRegistry; -import org.openhab.core.types.Command; -import org.openhab.core.types.State; -import org.openhab.core.model.persistence.tests.TestPersistenceService; import org.joda.time.DateMidnight; import org.joda.time.DateTime; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.openhab.core.items.GenericItem; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.model.persistence.tests.TestPersistenceService; +import org.openhab.core.persistence.HistoricItem; +import org.openhab.core.persistence.PersistenceService; +import org.openhab.core.persistence.PersistenceServiceRegistry; +import org.openhab.core.types.Command; +import org.openhab.core.types.State; /** * @author Kai Kreuzer - Initial contribution diff --git a/itests/org.openhab.core.model.rule.tests/pom.xml b/itests/org.openhab.core.model.rule.tests/pom.xml index bd00b881e..3be4fadca 100644 --- a/itests/org.openhab.core.model.rule.tests/pom.xml +++ b/itests/org.openhab.core.model.rule.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleExecutionTest.java b/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleExecutionTest.java index 01d36f089..ed113b573 100644 --- a/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleExecutionTest.java +++ b/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleExecutionTest.java @@ -21,6 +21,8 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; @@ -37,8 +39,6 @@ import org.openhab.core.model.rule.rules.Rule; import org.openhab.core.model.rule.runtime.RuleEngine; import org.openhab.core.model.rule.runtime.internal.engine.RuleTriggerManager.TriggerTypes; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Kai Kreuzer - Initial contribution diff --git a/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleTriggerTest.java b/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleTriggerTest.java index 76e476ebf..3380860d5 100644 --- a/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleTriggerTest.java +++ b/itests/org.openhab.core.model.rule.tests/src/main/java/org/openhab/core/model/rule/runtime/internal/engine/RuleTriggerTest.java @@ -18,6 +18,8 @@ import java.io.ByteArrayInputStream; import java.util.Iterator; import java.util.function.Function; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.model.core.ModelRepository; import org.openhab.core.model.rule.rules.ChangedEventTrigger; import org.openhab.core.model.rule.rules.CommandEventTrigger; @@ -27,8 +29,6 @@ import org.openhab.core.model.rule.rules.Rule; import org.openhab.core.model.rule.runtime.RuleEngine; import org.openhab.core.model.rule.runtime.internal.engine.RuleTriggerManager.TriggerTypes; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Simon Kaufmann - Initial contribution diff --git a/itests/org.openhab.core.model.script.tests/pom.xml b/itests/org.openhab.core.model.script.tests/pom.xml index 03e2bfb48..461369d2a 100644 --- a/itests/org.openhab.core.model.script.tests/pom.xml +++ b/itests/org.openhab.core.model.script.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/actions/ScriptExecutionTest.java b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/actions/ScriptExecutionTest.java index c6c55e365..0300df8e6 100644 --- a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/actions/ScriptExecutionTest.java +++ b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/actions/ScriptExecutionTest.java @@ -16,11 +16,11 @@ import static org.hamcrest.CoreMatchers.*; import static org.joda.time.Instant.now; import static org.junit.Assert.assertThat; +import org.junit.BeforeClass; +import org.junit.Test; import org.openhab.core.model.script.scheduler.test.MockClosure.MockClosure0; import org.openhab.core.model.script.scheduler.test.MockClosure.MockClosure1; import org.openhab.core.model.script.scheduler.test.MockScheduler; -import org.junit.BeforeClass; -import org.junit.Test; import org.quartz.SchedulerException; import org.quartz.impl.SchedulerRepository; import org.quartz.impl.StdSchedulerFactory; diff --git a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/engine/ScriptEngineOSGiTest.java b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/engine/ScriptEngineOSGiTest.java index 841573d77..a74fc5b73 100644 --- a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/engine/ScriptEngineOSGiTest.java +++ b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/engine/ScriptEngineOSGiTest.java @@ -21,6 +21,9 @@ import java.util.Collection; import javax.measure.quantity.Length; import javax.measure.quantity.Temperature; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.common.registry.ProviderChangeListener; import org.openhab.core.events.EventPublisher; import org.openhab.core.items.Item; @@ -34,12 +37,9 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.SIUnits; import org.openhab.core.library.unit.SmartHomeUnits; -import org.openhab.core.types.State; import org.openhab.core.model.script.ScriptServiceUtil; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.openhab.core.types.State; /** * @@ -227,8 +227,7 @@ public class ScriptEngineOSGiTest extends JavaOSGiTest { @Test public void testAssignAndCompareQuantityType() throws ScriptParsingException, ScriptExecutionException { - assertFalse( - runScript("NumberA.state = 20.0|°C as org.openhab.core.types.State; NumberA.state < 20|°F")); + assertFalse(runScript("NumberA.state = 20.0|°C as org.openhab.core.types.State; NumberA.state < 20|°F")); } @Test diff --git a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/lib/NumberExtensionsTest.java b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/lib/NumberExtensionsTest.java index 140b7f7eb..8d0003850 100644 --- a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/lib/NumberExtensionsTest.java +++ b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/lib/NumberExtensionsTest.java @@ -21,11 +21,11 @@ import javax.measure.quantity.Dimensionless; import javax.measure.quantity.Length; import javax.measure.quantity.Temperature; +import org.junit.Test; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.unit.SmartHomeUnits; import org.openhab.core.types.Type; -import org.junit.Test; /** * diff --git a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/scheduler/test/MockClosure.java b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/scheduler/test/MockClosure.java index f5a432fe8..a0fd1edb4 100644 --- a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/scheduler/test/MockClosure.java +++ b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/scheduler/test/MockClosure.java @@ -16,9 +16,9 @@ import static org.hamcrest.CoreMatchers.*; import static org.joda.time.Instant.now; import static org.junit.Assert.assertThat; -import org.openhab.core.model.script.actions.Timer; import org.eclipse.xtext.xbase.lib.Procedures.Procedure0; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; +import org.openhab.core.model.script.actions.Timer; /** * Mock implementations of Procedure0 and Procedure1 diff --git a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/tests/lib/NumberExtensionsTest.java b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/tests/lib/NumberExtensionsTest.java index 2fe512e22..097342e69 100644 --- a/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/tests/lib/NumberExtensionsTest.java +++ b/itests/org.openhab.core.model.script.tests/src/main/java/org/openhab/core/model/script/tests/lib/NumberExtensionsTest.java @@ -17,11 +17,11 @@ package org.openhab.core.model.script.tests.lib; import java.math.BigDecimal; import java.math.RoundingMode; -import org.openhab.core.library.types.DecimalType; -import org.openhab.core.types.Type; -import org.openhab.core.model.script.lib.NumberExtensions; import org.junit.Assert; import org.junit.Test; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.model.script.lib.NumberExtensions; +import org.openhab.core.types.Type; /** * Test case for {@link NumberExtensions} library class diff --git a/itests/org.openhab.core.model.thing.tests/pom.xml b/itests/org.openhab.core.model.thing.tests/pom.xml index 7a3c2ba8f..9d122043e 100644 --- a/itests/org.openhab.core.model.thing.tests/pom.xml +++ b/itests/org.openhab.core.model.thing.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/GenericItemChannelLinkProviderJavaTest.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/GenericItemChannelLinkProviderJavaTest.java index f48748be3..580bd3216 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/GenericItemChannelLinkProviderJavaTest.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/GenericItemChannelLinkProviderJavaTest.java @@ -22,22 +22,22 @@ import java.io.ByteArrayInputStream; import java.math.BigDecimal; import java.util.Collection; -import org.openhab.core.config.core.Configuration; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; import org.openhab.core.items.ItemRegistry; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.thing.internal.GenericItemChannelLinkProvider; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; import org.openhab.core.thing.link.ItemChannelLink; import org.openhab.core.thing.link.ItemChannelLinkProvider; import org.openhab.core.thing.link.ItemChannelLinkRegistry; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.thing.internal.GenericItemChannelLinkProvider; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericItemChannelLinkProviderTest.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericItemChannelLinkProviderTest.java index a57b70c48..00d14a1a4 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericItemChannelLinkProviderTest.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericItemChannelLinkProviderTest.java @@ -20,18 +20,18 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.Item; import org.openhab.core.items.ItemRegistry; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; import org.openhab.core.thing.link.ItemChannelLink; import org.openhab.core.thing.link.ItemChannelLinkProvider; import org.openhab.core.thing.link.ItemChannelLinkRegistry; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest.java index 832368623..fcd5b489b 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest.java @@ -26,9 +26,14 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Channel; import org.openhab.core.thing.Thing; @@ -39,11 +44,6 @@ import org.openhab.core.thing.events.ThingRemovedEvent; import org.openhab.core.thing.events.ThingUpdatedEvent; import org.openhab.core.thing.type.ChannelKind; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest2.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest2.java index 539d8b03e..8641d6bd3 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest2.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest2.java @@ -19,15 +19,15 @@ import static org.mockito.Mockito.*; import java.io.ByteArrayInputStream; import java.util.Collection; -import org.openhab.core.thing.Thing; -import org.openhab.core.thing.ThingRegistry; -import org.openhab.core.thing.binding.ThingHandlerFactory; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.thing.testsupport.hue.TestHueThingHandlerFactoryX; -import org.openhab.core.test.java.JavaOSGiTest; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.thing.testsupport.hue.TestHueThingHandlerFactoryX; +import org.openhab.core.test.java.JavaOSGiTest; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingRegistry; +import org.openhab.core.thing.binding.ThingHandlerFactory; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest3.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest3.java index 65df31180..0237da343 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest3.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest3.java @@ -25,10 +25,16 @@ import java.util.Collection; import java.util.Locale; import java.util.stream.Stream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ConfigDescriptionProvider; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.thing.testsupport.hue.DumbThingHandlerFactory; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; import org.openhab.core.thing.binding.ThingHandlerFactory; @@ -36,12 +42,6 @@ import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeBuilder; import org.openhab.core.thing.type.ChannelTypeProvider; import org.openhab.core.thing.type.ChannelTypeUID; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.thing.testsupport.hue.DumbThingHandlerFactory; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest4.java b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest4.java index e2cc3f258..31bbfba2d 100644 --- a/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest4.java +++ b/itests/org.openhab.core.model.thing.tests/src/main/java/org/openhab/core/model/thing/test/hue/GenericThingProviderTest4.java @@ -18,8 +18,18 @@ import static org.mockito.Mockito.*; import java.io.ByteArrayInputStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; +import org.openhab.core.model.core.ModelRepository; +import org.openhab.core.model.thing.testsupport.hue.TestHueThingHandlerFactoryX; +import org.openhab.core.model.thing.testsupport.hue.TestHueThingTypeProvider; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; @@ -31,16 +41,6 @@ import org.openhab.core.thing.binding.BaseThingHandler; import org.openhab.core.thing.binding.ThingHandler; import org.openhab.core.thing.binding.ThingHandlerFactory; import org.openhab.core.types.Command; -import org.openhab.core.model.core.ModelRepository; -import org.openhab.core.model.thing.testsupport.hue.TestHueThingHandlerFactoryX; -import org.openhab.core.model.thing.testsupport.hue.TestHueThingTypeProvider; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; import org.osgi.service.component.ComponentContext; diff --git a/itests/org.openhab.core.model.thing.testsupport/pom.xml b/itests/org.openhab.core.model.thing.testsupport/pom.xml index d0ad08351..cb8ba7034 100644 --- a/itests/org.openhab.core.model.thing.testsupport/pom.xml +++ b/itests/org.openhab.core.model.thing.testsupport/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.storage.json.tests/pom.xml b/itests/org.openhab.core.storage.json.tests/pom.xml index c106f19e0..c2818ce78 100644 --- a/itests/org.openhab.core.storage.json.tests/pom.xml +++ b/itests/org.openhab.core.storage.json.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.storage.json.tests/src/main/java/org/openhab/core/storage/json/internal/JsonStorageServiceOSGiTest.java b/itests/org.openhab.core.storage.json.tests/src/main/java/org/openhab/core/storage/json/internal/JsonStorageServiceOSGiTest.java index aaaf75445..c062bbb2e 100644 --- a/itests/org.openhab.core.storage.json.tests/src/main/java/org/openhab/core/storage/json/internal/JsonStorageServiceOSGiTest.java +++ b/itests/org.openhab.core.storage.json.tests/src/main/java/org/openhab/core/storage/json/internal/JsonStorageServiceOSGiTest.java @@ -24,16 +24,16 @@ import java.util.List; import java.util.UUID; import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigConstants; import org.openhab.core.config.core.Configuration; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; /** * @author Simon Kaufmann - Initial contribution diff --git a/itests/org.openhab.core.tests/pom.xml b/itests/org.openhab.core.tests/pom.xml index f7a1b50b8..ef5284901 100644 --- a/itests/org.openhab.core.tests/pom.xml +++ b/itests/org.openhab.core.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/cache/ExpiringCacheAsyncTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/cache/ExpiringCacheAsyncTest.java index 7b75a68a9..9ca783062 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/cache/ExpiringCacheAsyncTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/cache/ExpiringCacheAsyncTest.java @@ -19,8 +19,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.function.Supplier; -import org.openhab.core.test.java.JavaTest; import org.junit.Test; +import org.openhab.core.test.java.JavaTest; /** * Tests cases for {@link ExpiringAsyncCache}. diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/common/SafeCallerImplTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/common/SafeCallerImplTest.java index c4cb2d5a7..6c63414fa 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/common/SafeCallerImplTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/common/SafeCallerImplTest.java @@ -36,14 +36,14 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; import java.util.function.Function; -import org.openhab.core.common.QueueingThreadPoolExecutor; -import org.openhab.core.test.java.JavaTest; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; import org.mockito.Mock; +import org.openhab.core.common.QueueingThreadPoolExecutor; +import org.openhab.core.test.java.JavaTest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/events/OSGiEventManagerOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/events/OSGiEventManagerOSGiTest.java index 1811fa7ff..b7ce667f4 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/events/OSGiEventManagerOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/events/OSGiEventManagerOSGiTest.java @@ -23,17 +23,17 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; import org.openhab.core.events.Event; import org.openhab.core.events.EventFactory; import org.openhab.core.events.EventPublisher; import org.openhab.core.events.EventSubscriber; import org.openhab.core.events.TopicEventFilter; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; import org.osgi.framework.ServiceRegistration; /** diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/i18n/TranslationProviderOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/i18n/TranslationProviderOSGiTest.java index cb27d5418..0ca3dae9c 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/i18n/TranslationProviderOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/i18n/TranslationProviderOSGiTest.java @@ -19,11 +19,11 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.TranslationProvider; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; import org.osgi.framework.Bundle; /** diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/items/ItemUpdaterOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/items/ItemUpdaterOSGiTest.java index 1dc47a3e3..180e8e232 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/items/ItemUpdaterOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/internal/items/ItemUpdaterOSGiTest.java @@ -20,6 +20,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; @@ -31,8 +33,6 @@ import org.openhab.core.items.events.ItemStateChangedEvent; import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.OnOffType; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * The {@link ItemUpdaterOSGiTest} runs inside an OSGi container and tests the {@link ItemRegistry}. diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/GroupItemOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/GroupItemOSGiTest.java index db5123b3f..ad68d4e5e 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/GroupItemOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/GroupItemOSGiTest.java @@ -30,6 +30,10 @@ import javax.measure.quantity.Dimensionless; import javax.measure.quantity.Pressure; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; @@ -55,14 +59,10 @@ import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.types.RawType; import org.openhab.core.library.types.StringType; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.types.RefreshType; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; import tec.uom.se.unit.Units; diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ItemRegistryImplTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ItemRegistryImplTest.java index 48fe5541a..f022b2e23 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ItemRegistryImplTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ItemRegistryImplTest.java @@ -25,6 +25,11 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InOrder; +import org.mockito.Mock; import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.UnitProvider; @@ -40,11 +45,6 @@ import org.openhab.core.service.CommandDescriptionService; import org.openhab.core.service.StateDescriptionService; import org.openhab.core.test.java.JavaTest; import org.openhab.core.test.storage.VolatileStorageService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InOrder; -import org.mockito.Mock; /** * The {@link ItemRegistryImplTest} runs inside an OSGi container and tests the {@link ItemRegistry}. diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ManagedItemProviderOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ManagedItemProviderOSGiTest.java index e11a9f872..4203ad001 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ManagedItemProviderOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/ManagedItemProviderOSGiTest.java @@ -19,6 +19,9 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.items.ManagedItemProvider.PersistedItem; import org.openhab.core.library.CoreItemFactory; import org.openhab.core.library.items.NumberItem; @@ -30,12 +33,9 @@ import org.openhab.core.library.types.ArithmeticGroupFunction.Sum; import org.openhab.core.library.types.OnOffType; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.types.Command; import org.openhab.core.types.State; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * The {@link ManagedItemProviderOSGiTest} runs inside an diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/events/AbstractItemEventSubscriberOSGiTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/events/AbstractItemEventSubscriberOSGiTest.java index b8ff6f2bc..7a5fca7a2 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/events/AbstractItemEventSubscriberOSGiTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/items/events/AbstractItemEventSubscriberOSGiTest.java @@ -19,6 +19,9 @@ import static org.mockito.MockitoAnnotations.initMocks; import java.util.Collections; import java.util.Set; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.events.Event; import org.openhab.core.events.EventFactory; import org.openhab.core.events.EventPublisher; @@ -30,9 +33,6 @@ import org.openhab.core.items.MetadataProvider; import org.openhab.core.library.items.SwitchItem; import org.openhab.core.library.types.OnOffType; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * The {@link AbstractItemEventSubscriberOSGiTest} runs inside an OSGi container and tests the diff --git a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java index 56264739c..39edd077b 100644 --- a/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java +++ b/itests/org.openhab.core.tests/src/main/java/org/openhab/core/service/AbstractWatchServiceTest.java @@ -28,11 +28,11 @@ import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.SystemUtils; -import org.openhab.core.test.java.JavaTest; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.openhab.core.test.java.JavaTest; /** * Test for {@link AbstractWatchService}. diff --git a/itests/org.openhab.core.thing.tests/pom.xml b/itests/org.openhab.core.thing.tests/pom.xml index e3ab93973..bc66ab6e7 100644 --- a/itests/org.openhab.core.thing.tests/pom.xml +++ b/itests/org.openhab.core.thing.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/SystemWideChannelTypesTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/SystemWideChannelTypesTest.java index b65073cf6..0133d2cf1 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/SystemWideChannelTypesTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/SystemWideChannelTypesTest.java @@ -12,20 +12,20 @@ */ package org.openhab.core.thing; -import static org.openhab.core.thing.DefaultSystemChannelTypeProvider.BINDING_ID; import static org.junit.Assert.*; +import static org.openhab.core.thing.DefaultSystemChannelTypeProvider.BINDING_ID; import java.util.Collection; import java.util.List; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeProvider; import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.types.StateOption; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * Test cases for the {@link DefaultSystemChannelTypeProvider} class. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/ThingPropertiesTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/ThingPropertiesTest.java index ea1e88067..cc4504537 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/ThingPropertiesTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/ThingPropertiesTest.java @@ -17,13 +17,13 @@ import static org.junit.Assert.assertEquals; import java.util.HashMap; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.Configuration; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.binding.ThingFactory; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * Testing thing properties. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/BindingBaseClassesOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/BindingBaseClassesOSGiTest.java index 64f8f2c99..cedf90a4d 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/BindingBaseClassesOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/BindingBaseClassesOSGiTest.java @@ -30,6 +30,19 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.hamcrest.CoreMatchers; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; +import org.mockito.stubbing.Answer; +import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; @@ -39,11 +52,11 @@ import org.openhab.core.config.core.status.ConfigStatusMessage; import org.openhab.core.config.core.status.ConfigStatusProvider; import org.openhab.core.config.core.status.ConfigStatusService; import org.openhab.core.config.core.validation.ConfigValidationException; -import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; import org.openhab.core.i18n.TranslationProvider; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; @@ -63,19 +76,6 @@ import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.hamcrest.CoreMatchers; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.mockito.stubbing.Answer; import org.osgi.framework.Bundle; import org.osgi.service.component.ComponentContext; diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ChangeThingTypeOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ChangeThingTypeOSGiTest.java index 07808b1b0..1dec656b4 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ChangeThingTypeOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ChangeThingTypeOSGiTest.java @@ -27,6 +27,8 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; @@ -37,6 +39,7 @@ import org.openhab.core.items.ManagedItemProvider; import org.openhab.core.library.items.StringItem; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; @@ -57,9 +60,6 @@ import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; import org.openhab.core.types.Command; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ThingFactoryTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ThingFactoryTest.java index 80e14394a..2bd2a371d 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ThingFactoryTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/ThingFactoryTest.java @@ -31,11 +31,15 @@ import java.util.Map; import java.util.stream.Stream; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ConfigDescriptionRegistry; import org.openhab.core.config.core.Configuration; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Channel; import org.openhab.core.thing.Thing; @@ -55,10 +59,6 @@ import org.openhab.core.thing.type.ChannelTypeProvider; import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; /** * ThingFactoryTest is a test for the ThingFactory class. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareTest.java index 9098f39ff..943d8a7b0 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/binding/firmware/FirmwareTest.java @@ -23,11 +23,11 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Test; /** * Testing the {@link Firmware} domain object. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/events/ThingEventFactoryTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/events/ThingEventFactoryTest.java index dfa959e4b..1a5bbbd83 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/events/ThingEventFactoryTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/events/ThingEventFactoryTest.java @@ -15,7 +15,9 @@ package org.openhab.core.thing.events; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; +import org.junit.Test; import org.openhab.core.events.Event; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.CommonTriggerEvents; import org.openhab.core.thing.Thing; @@ -28,8 +30,6 @@ import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder; import org.openhab.core.thing.dto.ThingDTOMapper; import org.openhab.core.thing.events.ThingEventFactory.TriggerEventPayloadBean; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Test; import com.google.gson.Gson; diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/factory/ManagedThingProviderOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/factory/ManagedThingProviderOSGiTest.java index f508bfe4a..d0ba09fe9 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/factory/ManagedThingProviderOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/factory/ManagedThingProviderOSGiTest.java @@ -17,17 +17,17 @@ import static org.junit.Assert.*; import java.util.Collection; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.common.registry.Provider; import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.test.AsyncResultWrapper; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.openhab.core.test.AsyncResultWrapper; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * Tests for {@link ManagedThingProvider}. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServiceFirmwareRestrictionTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServiceFirmwareRestrictionTest.java index 945230a67..353c19a01 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServiceFirmwareRestrictionTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServiceFirmwareRestrictionTest.java @@ -25,6 +25,10 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; @@ -32,10 +36,6 @@ import org.openhab.core.thing.binding.firmware.Firmware; import org.openhab.core.thing.binding.firmware.FirmwareBuilder; import org.openhab.core.thing.binding.firmware.FirmwareRestriction; import org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; /** * Tests that the firmware restriction of the {@link Firmware} is respected by the {@link FirmwareUpdateService} diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServicePrerequisiteVersionTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServicePrerequisiteVersionTest.java index 8ceeb4612..d8c2aaffe 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServicePrerequisiteVersionTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/FirmwareUpdateServicePrerequisiteVersionTest.java @@ -24,15 +24,15 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.firmware.Firmware; import org.openhab.core.thing.binding.firmware.FirmwareBuilder; import org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * Tests that the {@link FirmwareUpdateService} honors the prerequisite version of {@link Firmware}s. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/ModelRestrictedFirmwareUpdateServiceOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/ModelRestrictedFirmwareUpdateServiceOSGiTest.java index 8909a22e0..efd464630 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/ModelRestrictedFirmwareUpdateServiceOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/firmware/ModelRestrictedFirmwareUpdateServiceOSGiTest.java @@ -12,10 +12,10 @@ */ package org.openhab.core.thing.firmware; -import static org.openhab.core.thing.Thing.*; -import static org.openhab.core.thing.firmware.FirmwareStatus.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.thing.Thing.*; +import static org.openhab.core.thing.firmware.FirmwareStatus.*; import java.util.Arrays; import java.util.Collections; @@ -23,6 +23,9 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingRegistry; @@ -35,9 +38,6 @@ import org.openhab.core.thing.binding.firmware.FirmwareUpdateHandler; import org.openhab.core.thing.binding.firmware.ProgressCallback; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * OSGi integration tests for the {@link FirmwareUpdateService}, focusing on firmware updates with firmwares that are diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/i18n/ThingStatusInfoI18nLocalizationServiceOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/i18n/ThingStatusInfoI18nLocalizationServiceOSGiTest.java index db4a4b065..c17473094 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/i18n/ThingStatusInfoI18nLocalizationServiceOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/i18n/ThingStatusInfoI18nLocalizationServiceOSGiTest.java @@ -19,7 +19,12 @@ import static org.mockito.Mockito.*; import java.io.IOException; import java.util.Locale; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.i18n.LocaleProvider; +import org.openhab.core.test.SyntheticBundleInstaller; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; @@ -36,11 +41,6 @@ import org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder; import org.openhab.core.thing.testutil.i18n.DefaultLocaleSetter; import org.openhab.core.types.Command; import org.openhab.core.util.BundleResolver; -import org.openhab.core.test.SyntheticBundleInstaller; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; import org.osgi.framework.FrameworkUtil; diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/CommunicationManagerOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/CommunicationManagerOSGiTest.java index d67f02f99..2c811e92e 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/CommunicationManagerOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/CommunicationManagerOSGiTest.java @@ -24,6 +24,10 @@ import java.util.stream.Stream; import javax.measure.quantity.Temperature; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; import org.openhab.core.common.SafeCaller; import org.openhab.core.common.registry.Provider; import org.openhab.core.common.registry.ProviderChangeListener; @@ -43,6 +47,7 @@ import org.openhab.core.library.types.PercentType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.unit.SIUnits; import org.openhab.core.service.StateDescriptionService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; @@ -72,11 +77,6 @@ import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.types.Command; import org.openhab.core.types.State; import org.openhab.core.types.StateDescriptionFragmentBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; /** * diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingLinkManagerOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingLinkManagerOSGiTest.java index d976e4ca4..91444af03 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingLinkManagerOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingLinkManagerOSGiTest.java @@ -27,8 +27,14 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.openhab.core.config.core.Configuration; import org.openhab.core.items.ItemRegistry; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; @@ -53,12 +59,6 @@ import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.types.Command; import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateOption; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiJavaTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiJavaTest.java index 37a7f8201..4368fedeb 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiJavaTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiJavaTest.java @@ -31,18 +31,23 @@ import java.util.function.Function; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.openhab.core.common.SafeCaller; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ConfigDescriptionProvider; import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.SafeCaller; import org.openhab.core.items.ItemRegistry; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyService; import org.openhab.core.storage.Storage; import org.openhab.core.storage.StorageService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; @@ -82,11 +87,6 @@ import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.types.Command; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentMatchers; import org.osgi.framework.InvalidSyntaxException; import org.osgi.service.cm.ConfigurationAdmin; import org.osgi.service.component.ComponentContext; diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiTest.java index dd14f3073..35d36a479 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingManagerOSGiTest.java @@ -32,12 +32,17 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameterBuilder; import org.openhab.core.config.core.ConfigDescriptionProvider; import org.openhab.core.config.core.Configuration; -import org.openhab.core.common.registry.RegistryChangeListener; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventPublisher; @@ -54,6 +59,7 @@ import org.openhab.core.library.types.StringType; import org.openhab.core.service.ReadyMarker; import org.openhab.core.service.ReadyMarkerUtils; import org.openhab.core.service.ReadyService; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Bridge; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; @@ -94,12 +100,6 @@ import org.openhab.core.thing.type.ThingTypeBuilder; import org.openhab.core.thing.type.ThingTypeRegistry; import org.openhab.core.types.Command; import org.openhab.core.util.BundleResolver; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.osgi.framework.Bundle; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.InvalidSyntaxException; diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingRegistryOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingRegistryOSGiTest.java index ff5103e3e..e4a9ace0c 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingRegistryOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/ThingRegistryOSGiTest.java @@ -25,11 +25,15 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; @@ -46,10 +50,6 @@ import org.openhab.core.thing.events.ThingAddedEvent; import org.openhab.core.thing.events.ThingRemovedEvent; import org.openhab.core.thing.events.ThingUpdatedEvent; import org.openhab.core.types.Command; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.framework.ServiceRegistration; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareRegistryOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareRegistryOSGiTest.java index 4b201c4a8..18628871c 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareRegistryOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareRegistryOSGiTest.java @@ -12,9 +12,9 @@ */ package org.openhab.core.thing.internal.firmware; -import static org.openhab.core.thing.firmware.Constants.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; +import static org.openhab.core.thing.firmware.Constants.*; import java.io.IOException; import java.util.ArrayList; @@ -28,7 +28,11 @@ import java.util.stream.Stream; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.i18n.LocaleProvider; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.binding.builder.ThingBuilder; import org.openhab.core.thing.binding.firmware.Firmware; @@ -36,10 +40,6 @@ import org.openhab.core.thing.firmware.Constants; import org.openhab.core.thing.firmware.FirmwareProvider; import org.openhab.core.thing.firmware.FirmwareRegistry; import org.openhab.core.thing.testutil.i18n.DefaultLocaleSetter; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.cm.ConfigurationAdmin; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceTest.java index 28d380b4a..6019bab5c 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/firmware/FirmwareUpdateServiceTest.java @@ -12,14 +12,14 @@ */ package org.openhab.core.thing.internal.firmware; -import static org.openhab.core.thing.firmware.Constants.*; -import static org.openhab.core.thing.firmware.FirmwareStatusInfo.*; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import static org.mockito.MockitoAnnotations.initMocks; +import static org.openhab.core.thing.firmware.Constants.*; +import static org.openhab.core.thing.firmware.FirmwareStatusInfo.*; import java.io.IOException; import java.util.ArrayList; @@ -38,12 +38,21 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.openhab.core.config.core.validation.ConfigDescriptionValidator; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.stubbing.Answer; import org.openhab.core.common.SafeCaller; +import org.openhab.core.config.core.validation.ConfigDescriptionValidator; import org.openhab.core.events.Event; import org.openhab.core.events.EventPublisher; import org.openhab.core.i18n.LocaleProvider; import org.openhab.core.i18n.TranslationProvider; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.builder.ThingBuilder; @@ -60,15 +69,6 @@ import org.openhab.core.thing.firmware.FirmwareUpdateResult; import org.openhab.core.thing.firmware.FirmwareUpdateResultInfoEvent; import org.openhab.core.thing.firmware.FirmwareUpdateService; import org.openhab.core.util.BundleResolver; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.stubbing.Answer; import org.osgi.framework.Bundle; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactoryOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactoryOSGiTest.java index 24adc74c7..c5fc05612 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactoryOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/internal/profiles/SystemProfileFactoryOSGiTest.java @@ -21,8 +21,12 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.openhab.core.config.core.Configuration; import org.openhab.core.library.CoreItemFactory; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; @@ -33,10 +37,6 @@ import org.openhab.core.thing.profiles.ProfileTypeProvider; import org.openhab.core.thing.profiles.ProfileTypeUID; import org.openhab.core.thing.profiles.SystemProfiles; import org.openhab.core.thing.type.ChannelType; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; /** * Test cases for the {@link SystemProfileFactory} class. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/ItemChannelLinkOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/ItemChannelLinkOSGiTest.java index 3cd3c6d1e..b2557823d 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/ItemChannelLinkOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/ItemChannelLinkOSGiTest.java @@ -18,6 +18,10 @@ import static org.mockito.Mockito.*; import java.util.Hashtable; import java.util.Set; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.Thing; @@ -25,10 +29,6 @@ import org.openhab.core.thing.ThingTypeUID; import org.openhab.core.thing.ThingUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; import org.openhab.core.thing.binding.builder.ThingBuilder; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.component.ComponentContext; /** diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/LinkEventOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/LinkEventOSGiTest.java index 1573deb4f..9e81a5a5d 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/LinkEventOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/link/LinkEventOSGiTest.java @@ -20,15 +20,15 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.events.Event; import org.openhab.core.events.EventFilter; import org.openhab.core.events.EventSubscriber; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.link.events.ItemChannelLinkAddedEvent; import org.openhab.core.thing.link.events.ItemChannelLinkRemovedEvent; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * Event Tests for {@link ItemChannelLinkRegistry}. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/profiles/i18n/SystemProfileI18nOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/profiles/i18n/SystemProfileI18nOSGiTest.java index cc9b8d3fc..cd8917490 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/profiles/i18n/SystemProfileI18nOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/profiles/i18n/SystemProfileI18nOSGiTest.java @@ -12,19 +12,19 @@ */ package org.openhab.core.thing.profiles.i18n; -import static org.openhab.core.thing.profiles.SystemProfiles.*; import static org.junit.Assert.*; +import static org.openhab.core.thing.profiles.SystemProfiles.*; import java.util.Collection; import java.util.Locale; import java.util.Optional; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.internal.profiles.SystemProfileFactory; import org.openhab.core.thing.profiles.ProfileType; import org.openhab.core.thing.profiles.ProfileTypeProvider; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * Test cases for i18n of the {@link SystemProfileFactory} class. diff --git a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/type/ChannelStateDescriptionProviderOSGiTest.java b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/type/ChannelStateDescriptionProviderOSGiTest.java index 6214ddfd7..86bd35986 100644 --- a/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/type/ChannelStateDescriptionProviderOSGiTest.java +++ b/itests/org.openhab.core.thing.tests/src/main/java/org/openhab/core/thing/type/ChannelStateDescriptionProviderOSGiTest.java @@ -26,8 +26,13 @@ import java.util.Locale; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.openhab.core.config.core.Configuration; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; import org.openhab.core.common.registry.ProviderChangeListener; +import org.openhab.core.config.core.Configuration; import org.openhab.core.items.Item; import org.openhab.core.items.ItemNotFoundException; import org.openhab.core.items.ItemProvider; @@ -37,6 +42,8 @@ import org.openhab.core.library.items.DimmerItem; import org.openhab.core.library.items.NumberItem; import org.openhab.core.library.items.StringItem; import org.openhab.core.library.items.SwitchItem; +import org.openhab.core.test.SyntheticBundleInstaller; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.ManagedThingProvider; @@ -60,13 +67,6 @@ import org.openhab.core.types.StateDescription; import org.openhab.core.types.StateDescriptionFragmentBuilder; import org.openhab.core.types.StateOption; import org.openhab.core.util.BundleResolver; -import org.openhab.core.test.SyntheticBundleInstaller; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; import org.osgi.framework.FrameworkUtil; diff --git a/itests/org.openhab.core.thing.xml.tests/pom.xml b/itests/org.openhab.core.thing.xml.tests/pom.xml index 39848d337..07e23045a 100644 --- a/itests/org.openhab.core.thing.xml.tests/pom.xml +++ b/itests/org.openhab.core.thing.xml.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesI18nTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesI18nTest.java index cb3a9d4eb..4e0307f0d 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesI18nTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesI18nTest.java @@ -18,6 +18,12 @@ import static org.junit.Assert.*; import java.util.Collection; import java.util.Optional; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.BundleCloseable; +import org.openhab.core.test.SyntheticBundleInstaller; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.ChannelDefinition; import org.openhab.core.thing.type.ChannelGroupType; @@ -25,12 +31,6 @@ import org.openhab.core.thing.type.ChannelGroupTypeProvider; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeProvider; import org.openhab.core.thing.type.ThingType; -import org.openhab.core.test.BundleCloseable; -import org.openhab.core.test.SyntheticBundleInstaller; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; /*** * diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesTest.java index 41af783c0..c9cd5f5d2 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ChannelTypesTest.java @@ -17,15 +17,15 @@ import static org.junit.Assert.assertThat; import java.util.Collection; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.BundleCloseable; +import org.openhab.core.test.SyntheticBundleInstaller; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.type.ChannelGroupType; import org.openhab.core.thing.type.ChannelGroupTypeProvider; import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeProvider; -import org.openhab.core.test.BundleCloseable; -import org.openhab.core.test.SyntheticBundleInstaller; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /*** * diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ConfigDescriptionsTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ConfigDescriptionsTest.java index ae86beecf..b21ed408d 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ConfigDescriptionsTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ConfigDescriptionsTest.java @@ -18,15 +18,15 @@ import static org.junit.Assert.assertThat; import java.net.URI; import java.util.Collection; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.config.core.ConfigDescription; import org.openhab.core.config.core.ConfigDescriptionParameter; import org.openhab.core.config.core.ConfigDescriptionParameter.Type; import org.openhab.core.config.core.ConfigDescriptionParameterGroup; import org.openhab.core.config.core.ConfigDescriptionRegistry; -import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; +import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/LoadedTestBundle.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/LoadedTestBundle.java index 582911fd7..21a58c51a 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/LoadedTestBundle.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/LoadedTestBundle.java @@ -17,11 +17,11 @@ import static org.junit.Assert.assertThat; import org.eclipse.jdt.annotation.Nullable; import org.openhab.core.config.core.ConfigDescriptionRegistry; +import org.openhab.core.test.SyntheticBundleInstaller; +import org.openhab.core.test.java.JavaTest; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.ChannelGroupTypeRegistry; import org.openhab.core.thing.type.ChannelTypeRegistry; -import org.openhab.core.test.SyntheticBundleInstaller; -import org.openhab.core.test.java.JavaTest; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemChannelsInChannelGroupsTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemChannelsInChannelGroupsTest.java index 523f2dec6..aeb5d8568 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemChannelsInChannelGroupsTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemChannelsInChannelGroupsTest.java @@ -18,6 +18,9 @@ import static org.junit.Assert.assertThat; import java.util.List; import java.util.stream.Collectors; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.ChannelDefinition; import org.openhab.core.thing.type.ChannelGroupType; @@ -26,9 +29,6 @@ import org.openhab.core.thing.type.ChannelGroupTypeUID; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Simon Kaufmann - Initial contribution and API diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemWideChannelTypesTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemWideChannelTypesTest.java index 0a77657dd..e63ba1566 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemWideChannelTypesTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/SystemWideChannelTypesTest.java @@ -19,6 +19,9 @@ import java.util.Collection; import java.util.List; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.DefaultSystemChannelTypeProvider; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.ChannelDefinition; @@ -27,9 +30,6 @@ import org.openhab.core.thing.type.ChannelTypeProvider; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Ivan Iliev - Initial contribution diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypeI18nTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypeI18nTest.java index 57dfde6a2..ebf2a50ab 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypeI18nTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypeI18nTest.java @@ -18,6 +18,9 @@ import static org.junit.Assert.*; import java.util.Collection; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.ChannelDefinition; import org.openhab.core.thing.type.ChannelGroupDefinition; @@ -27,9 +30,6 @@ import org.openhab.core.thing.type.ChannelType; import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypesTest.java b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypesTest.java index c09371cb1..065baef7f 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypesTest.java +++ b/itests/org.openhab.core.thing.xml.tests/src/main/java/org/openhab/core/thing/xml/test/ThingTypesTest.java @@ -21,6 +21,9 @@ import java.util.Collection; import java.util.List; import java.util.Set; +import org.junit.Before; +import org.junit.Test; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.thing.binding.ThingTypeProvider; import org.openhab.core.thing.type.BridgeType; import org.openhab.core.thing.type.ChannelDefinition; @@ -32,9 +35,6 @@ import org.openhab.core.thing.type.ChannelTypeRegistry; import org.openhab.core.thing.type.ThingType; import org.openhab.core.thing.xml.test.LoadedTestBundle.StuffAddition; import org.openhab.core.types.StateDescription; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Test; /** * @author Henning Treu - Initial contribution diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannels.bundle/ESH-INF/binding/binding.xml b/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannels.bundle/ESH-INF/binding/binding.xml index 85f5683e3..e86e8f1eb 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannels.bundle/ESH-INF/binding/binding.xml +++ b/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannels.bundle/ESH-INF/binding/binding.xml @@ -1,7 +1,8 @@ + xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd" + id="SystemChannels"> SystemChannels Test Binding Used to test System Wide Channels. Provides definitions of system channels. diff --git a/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannelsInChannelGroups.bundle/ESH-INF/binding/binding.xml b/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannelsInChannelGroups.bundle/ESH-INF/binding/binding.xml index 1df5fc5b4..8f3db2ebc 100644 --- a/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannelsInChannelGroups.bundle/ESH-INF/binding/binding.xml +++ b/itests/org.openhab.core.thing.xml.tests/src/main/resources/test-bundle-pool/SystemChannelsInChannelGroups.bundle/ESH-INF/binding/binding.xml @@ -1,7 +1,8 @@ + xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd" + id="SystemChannels"> SystemChannelsInChannelGroups Test Binding Used to test System Wide Channels which are used within Channel Groups. Provides definitions of system diff --git a/itests/org.openhab.core.voice.tests/pom.xml b/itests/org.openhab.core.voice.tests/pom.xml index 9a7a5a12f..037756225 100644 --- a/itests/org.openhab.core.voice.tests/pom.xml +++ b/itests/org.openhab.core.voice.tests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/javavoicemanager/VoiceManagerTest.java b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/javavoicemanager/VoiceManagerTest.java index 7dc9418d2..548ef2449 100644 --- a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/javavoicemanager/VoiceManagerTest.java +++ b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/javavoicemanager/VoiceManagerTest.java @@ -23,8 +23,13 @@ import java.util.Dictionary; import java.util.Hashtable; import java.util.Locale; -import org.openhab.core.config.core.ParameterOption; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; import org.openhab.core.audio.AudioManager; +import org.openhab.core.config.core.ParameterOption; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.voice.VoiceManager; import org.openhab.core.voice.internal.AudioManagerStub; import org.openhab.core.voice.internal.AudioSourceStub; @@ -37,11 +42,6 @@ import org.openhab.core.voice.internal.TTSServiceStub; import org.openhab.core.voice.internal.VoiceManagerImpl; import org.openhab.core.voice.internal.VoiceStub; import org.openhab.core.voice.text.InterpretationException; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; import org.osgi.framework.BundleContext; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/InterpretCommandTest.java b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/InterpretCommandTest.java index 966bec6ac..aba14cb2c 100644 --- a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/InterpretCommandTest.java +++ b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/InterpretCommandTest.java @@ -19,11 +19,11 @@ import java.io.IOException; import java.util.Dictionary; import java.util.Hashtable; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.voice.internal.HumanLanguageInterpreterStub; import org.openhab.core.voice.internal.TTSServiceStub; import org.openhab.core.voice.internal.VoiceStub; -import org.junit.Before; -import org.junit.Test; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/SayCommandTest.java b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/SayCommandTest.java index cc4dc1b4c..291a3a9e9 100644 --- a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/SayCommandTest.java +++ b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/SayCommandTest.java @@ -21,21 +21,21 @@ import java.util.Collection; import java.util.Dictionary; import java.util.Hashtable; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; import org.openhab.core.items.Item; import org.openhab.core.items.ItemRegistry; import org.openhab.core.library.items.StringItem; +import org.openhab.core.test.storage.VolatileStorageService; import org.openhab.core.thing.ManagedThingProvider; import org.openhab.core.thing.ThingProvider; import org.openhab.core.voice.TTSService; import org.openhab.core.voice.internal.SinkStub; import org.openhab.core.voice.internal.TTSServiceStub; import org.openhab.core.voice.internal.VoiceStub; -import org.openhab.core.test.storage.VolatileStorageService; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; import org.osgi.framework.BundleContext; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; diff --git a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoiceConsoleCommandExtensionTest.java b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoiceConsoleCommandExtensionTest.java index 23f83c892..568faa742 100644 --- a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoiceConsoleCommandExtensionTest.java +++ b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoiceConsoleCommandExtensionTest.java @@ -14,7 +14,10 @@ package org.openhab.core.voice.voiceconsolecommandextension; import static org.junit.Assert.assertNotNull; +import org.junit.Before; import org.openhab.core.audio.AudioManager; +import org.openhab.core.io.console.extensions.ConsoleCommandExtension; +import org.openhab.core.test.java.JavaOSGiTest; import org.openhab.core.voice.VoiceManager; import org.openhab.core.voice.internal.AudioManagerStub; import org.openhab.core.voice.internal.AudioSourceStub; @@ -22,9 +25,6 @@ import org.openhab.core.voice.internal.ConsoleStub; import org.openhab.core.voice.internal.SinkStub; import org.openhab.core.voice.internal.VoiceConsoleCommandExtension; import org.openhab.core.voice.internal.VoiceManagerImpl; -import org.openhab.core.io.console.extensions.ConsoleCommandExtension; -import org.openhab.core.test.java.JavaOSGiTest; -import org.junit.Before; /** * A base class for the classes testing the different commands of the {@link VoiceConsoleCommandExtension}. diff --git a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoicesCommandTest.java b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoicesCommandTest.java index c216f4b9c..7bf0b244c 100644 --- a/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoicesCommandTest.java +++ b/itests/org.openhab.core.voice.tests/src/main/java/org/openhab/core/voice/voiceconsolecommandextension/VoicesCommandTest.java @@ -17,11 +17,11 @@ import static org.junit.Assert.assertThat; import java.util.Locale; +import org.junit.Before; +import org.junit.Test; import org.openhab.core.voice.internal.SinkStub; import org.openhab.core.voice.internal.TTSServiceStub; import org.openhab.core.voice.internal.VoiceStub; -import org.junit.Before; -import org.junit.Test; import org.osgi.framework.BundleContext; /** diff --git a/itests/pom.xml b/itests/pom.xml index c76563cf7..0eaeb786f 100644 --- a/itests/pom.xml +++ b/itests/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/pom.xml b/pom.xml index 42cabcef1..12fcf5fa6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 @@ -194,7 +196,7 @@ Import-Package: \\ ${bnd.version} false - + @@ -490,7 +492,7 @@ Import-Package: \\ - + @@ -503,7 +505,7 @@ Import-Package: \\ - + @@ -517,7 +519,7 @@ Import-Package: \\ - + @@ -530,7 +532,7 @@ Import-Package: \\ - + @@ -593,11 +595,11 @@ Import-Package: \\ openhab_codestyle.xml 4.11.0 - + openhab.importorder - + @@ -615,8 +617,8 @@ Import-Package: \\ 4.12.0 - - + + @@ -630,8 +632,8 @@ Import-Package: \\ 4.12.0 - - + + diff --git a/tools/archetype/binding/pom.xml b/tools/archetype/binding/pom.xml index 6c0d17492..668f61ce6 100644 --- a/tools/archetype/binding/pom.xml +++ b/tools/archetype/binding/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/tools/archetype/binding/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/archetype/binding/src/main/resources/META-INF/maven/archetype-metadata.xml index 89163230d..a98f7ec36 100644 --- a/tools/archetype/binding/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/tools/archetype/binding/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -1,4 +1,5 @@ - @@ -12,8 +13,8 @@ - - + + diff --git a/tools/archetype/binding/src/main/resources/archetype-resources/src/main/feature/feature.xml b/tools/archetype/binding/src/main/resources/archetype-resources/src/main/feature/feature.xml index cba4b5e19..6ca672ec7 100644 --- a/tools/archetype/binding/src/main/resources/archetype-resources/src/main/feature/feature.xml +++ b/tools/archetype/binding/src/main/resources/archetype-resources/src/main/feature/feature.xml @@ -1,9 +1,24 @@ - - mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features + + + mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features + + + openhab-runtime-base + mvn:org.openhab.addons.bundles/${rootArtifactId}/${project.version} + diff --git a/tools/archetype/binding/src/main/resources/archetype-resources/src/main/resources/ESH-INF/binding/binding.xml b/tools/archetype/binding/src/main/resources/archetype-resources/src/main/resources/ESH-INF/binding/binding.xml index 6c156887a..21f1a3eb6 100644 --- a/tools/archetype/binding/src/main/resources/archetype-resources/src/main/resources/ESH-INF/binding/binding.xml +++ b/tools/archetype/binding/src/main/resources/archetype-resources/src/main/resources/ESH-INF/binding/binding.xml @@ -1,10 +1,10 @@ - - - - ${bindingIdCamelCase} Binding - This is the binding for ${bindingIdCamelCase}. - ${author} - - + + + + ${bindingIdCamelCase} Binding + This is the binding for ${bindingIdCamelCase}. + ${author} + + diff --git a/tools/archetype/pom.xml b/tools/archetype/pom.xml index c6dce1805..add0bfd95 100644 --- a/tools/archetype/pom.xml +++ b/tools/archetype/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0 diff --git a/tools/pom.xml b/tools/pom.xml index d3e337242..2da5ece48 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -1,4 +1,6 @@ - + + 4.0.0