]> git.basschouten.com Git - openhab-addons.git/commitdiff
Fix namespace issues (#16169)
authorJacob Laursen <jacob-github@vindvejr.dk>
Mon, 1 Jan 2024 15:08:34 +0000 (16:08 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Jan 2024 15:08:34 +0000 (16:08 +0100)
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java [deleted file]
bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/PlexHandlerFactory.java
bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/discovery/PlexDiscoveryService.java [new file with mode: 0644]
bundles/org.openhab.binding.plex/src/test/java/org.openhab.binding.plex/internal/handler/PlexApiConnectorTest.java [deleted file]
bundles/org.openhab.binding.plex/src/test/java/org/openhab/binding/plex/internal/handler/PlexApiConnectorTest.java [new file with mode: 0644]

diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/discovery/PlexDiscoveryService.java
deleted file mode 100644 (file)
index a7b3659..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (c) 2010-2023 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.binding.plex.discovery;
-
-import static org.openhab.binding.plex.internal.PlexBindingConstants.*;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.openhab.binding.plex.internal.handler.PlexServerHandler;
-import org.openhab.core.config.discovery.AbstractDiscoveryService;
-import org.openhab.core.config.discovery.DiscoveryResult;
-import org.openhab.core.config.discovery.DiscoveryResultBuilder;
-import org.openhab.core.thing.ThingTypeUID;
-import org.openhab.core.thing.ThingUID;
-
-/**
- * @author Brian Homeyer - Initial contribution
- * @author Aron Beurskens - Binding development
- */
-@NonNullByDefault
-public class PlexDiscoveryService extends AbstractDiscoveryService {
-    private final PlexServerHandler bridgeHandler;
-
-    public PlexDiscoveryService(PlexServerHandler bridgeHandler) {
-        super(SUPPORTED_THING_TYPES_UIDS, 10, false);
-        this.bridgeHandler = bridgeHandler;
-    }
-
-    @Override
-    protected void startScan() {
-        for (String machineId : bridgeHandler.getAvailablePlayers()) {
-            ThingUID bridgeUID = bridgeHandler.getThing().getUID();
-            ThingTypeUID thingTypeUID = UID_PLAYER;
-            ThingUID playerThingUid = new ThingUID(UID_PLAYER, bridgeUID, machineId);
-
-            Map<String, Object> properties = new HashMap<>();
-            properties.put(CONFIG_PLAYER_ID, machineId);
-
-            DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(playerThingUid).withThingType(thingTypeUID)
-                    .withProperties(properties).withBridge(bridgeUID).withRepresentationProperty(CONFIG_PLAYER_ID)
-                    .withLabel("PLEX Player (" + machineId + ")").build();
-
-            thingDiscovered(discoveryResult);
-        }
-    }
-}
index 8bd642cfc534ca23606fbf416769ee9b1c77354d..4af163ede5aadb85131eefa7efab007bdc3f593d 100644 (file)
@@ -18,7 +18,7 @@ import java.util.Hashtable;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
-import org.openhab.binding.plex.discovery.PlexDiscoveryService;
+import org.openhab.binding.plex.internal.discovery.PlexDiscoveryService;
 import org.openhab.binding.plex.internal.handler.PlexPlayerHandler;
 import org.openhab.binding.plex.internal.handler.PlexServerHandler;
 import org.openhab.core.config.discovery.DiscoveryService;
diff --git a/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/discovery/PlexDiscoveryService.java b/bundles/org.openhab.binding.plex/src/main/java/org/openhab/binding/plex/internal/discovery/PlexDiscoveryService.java
new file mode 100644 (file)
index 0000000..f02c649
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2010-2023 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.binding.plex.internal.discovery;
+
+import static org.openhab.binding.plex.internal.PlexBindingConstants.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.plex.internal.handler.PlexServerHandler;
+import org.openhab.core.config.discovery.AbstractDiscoveryService;
+import org.openhab.core.config.discovery.DiscoveryResult;
+import org.openhab.core.config.discovery.DiscoveryResultBuilder;
+import org.openhab.core.thing.ThingTypeUID;
+import org.openhab.core.thing.ThingUID;
+
+/**
+ * @author Brian Homeyer - Initial contribution
+ * @author Aron Beurskens - Binding development
+ */
+@NonNullByDefault
+public class PlexDiscoveryService extends AbstractDiscoveryService {
+    private final PlexServerHandler bridgeHandler;
+
+    public PlexDiscoveryService(PlexServerHandler bridgeHandler) {
+        super(SUPPORTED_THING_TYPES_UIDS, 10, false);
+        this.bridgeHandler = bridgeHandler;
+    }
+
+    @Override
+    protected void startScan() {
+        for (String machineId : bridgeHandler.getAvailablePlayers()) {
+            ThingUID bridgeUID = bridgeHandler.getThing().getUID();
+            ThingTypeUID thingTypeUID = UID_PLAYER;
+            ThingUID playerThingUid = new ThingUID(UID_PLAYER, bridgeUID, machineId);
+
+            Map<String, Object> properties = new HashMap<>();
+            properties.put(CONFIG_PLAYER_ID, machineId);
+
+            DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(playerThingUid).withThingType(thingTypeUID)
+                    .withProperties(properties).withBridge(bridgeUID).withRepresentationProperty(CONFIG_PLAYER_ID)
+                    .withLabel("PLEX Player (" + machineId + ")").build();
+
+            thingDiscovered(discoveryResult);
+        }
+    }
+}
diff --git a/bundles/org.openhab.binding.plex/src/test/java/org.openhab.binding.plex/internal/handler/PlexApiConnectorTest.java b/bundles/org.openhab.binding.plex/src/test/java/org.openhab.binding.plex/internal/handler/PlexApiConnectorTest.java
deleted file mode 100644 (file)
index f872e35..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (c) 2010-2023 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.binding.plex.internal.handler;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.stream.Stream;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jetty.client.HttpClient;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.Arguments;
-import org.junit.jupiter.params.provider.MethodSource;
-import org.mockito.Mock;
-import org.openhab.binding.plex.internal.config.PlexServerConfiguration;
-
-/**
- * Tests cases for {@link org.openhab.binding.plex.internal.handler.PlexApiConnector}.
- *
- * @author Brian Homeyer - Initial contribution
- * @author Aron Beurskens - Added test
- */
-@NonNullByDefault
-public class PlexApiConnectorTest {
-    private @NonNullByDefault({}) @Mock ScheduledExecutorService scheduler;
-    private @NonNullByDefault({}) @Mock HttpClient httpClient;
-
-    private @NonNullByDefault({}) PlexApiConnector plexApiConnector;
-
-    @BeforeEach
-    public void setUp() {
-        plexApiConnector = new PlexApiConnector(scheduler, httpClient);
-    }
-
-    /**
-     * Test that the .hasToken check return the correct values.
-     */
-    @ParameterizedTest(name = "{index} => token={0}, result={1}")
-    @MethodSource("tokenProvider")
-    public void testHasToken(String token, Boolean result) {
-        PlexServerConfiguration config = new PlexServerConfiguration();
-        config.token = token;
-        plexApiConnector.setParameters(config);
-        assertThat(plexApiConnector.hasToken(), is(result));
-    }
-
-    private static Stream<Arguments> tokenProvider() {
-        return Stream.of(Arguments.of("123", true), Arguments.of("   ", false),
-                Arguments.of("fdsjkghdf-dsjfhs-dsafkshj", true), Arguments.of("", false));
-    }
-}
diff --git a/bundles/org.openhab.binding.plex/src/test/java/org/openhab/binding/plex/internal/handler/PlexApiConnectorTest.java b/bundles/org.openhab.binding.plex/src/test/java/org/openhab/binding/plex/internal/handler/PlexApiConnectorTest.java
new file mode 100644 (file)
index 0000000..f872e35
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2010-2023 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.binding.plex.internal.handler;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.stream.Stream;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.mockito.Mock;
+import org.openhab.binding.plex.internal.config.PlexServerConfiguration;
+
+/**
+ * Tests cases for {@link org.openhab.binding.plex.internal.handler.PlexApiConnector}.
+ *
+ * @author Brian Homeyer - Initial contribution
+ * @author Aron Beurskens - Added test
+ */
+@NonNullByDefault
+public class PlexApiConnectorTest {
+    private @NonNullByDefault({}) @Mock ScheduledExecutorService scheduler;
+    private @NonNullByDefault({}) @Mock HttpClient httpClient;
+
+    private @NonNullByDefault({}) PlexApiConnector plexApiConnector;
+
+    @BeforeEach
+    public void setUp() {
+        plexApiConnector = new PlexApiConnector(scheduler, httpClient);
+    }
+
+    /**
+     * Test that the .hasToken check return the correct values.
+     */
+    @ParameterizedTest(name = "{index} => token={0}, result={1}")
+    @MethodSource("tokenProvider")
+    public void testHasToken(String token, Boolean result) {
+        PlexServerConfiguration config = new PlexServerConfiguration();
+        config.token = token;
+        plexApiConnector.setParameters(config);
+        assertThat(plexApiConnector.hasToken(), is(result));
+    }
+
+    private static Stream<Arguments> tokenProvider() {
+        return Stream.of(Arguments.of("123", true), Arguments.of("   ", false),
+                Arguments.of("fdsjkghdf-dsjfhs-dsafkshj", true), Arguments.of("", false));
+    }
+}