This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new fe7a90d1108a chore(components): milo compilation warnings
fe7a90d1108a is described below
commit fe7a90d1108ad57f60d5aa1d1718b6fa03398a21
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Dec 18 10:03:51 2025 +0100
chore(components): milo compilation warnings
---
.../component/milo/browse/MiloBrowseProducer.java | 1 +
.../component/milo/server/MiloServerComponent.java | 5 ++-
.../component/milo/AbstractMiloServerTest.java | 1 -
.../milo/MonitorItemMultiConnectionsCertTest.java | 46 +++++++++++-----------
.../component/milo/call/MockCamelNamespace.java | 5 ---
.../milo/server/ServerSetSecurityPoliciesTest.java | 27 +++++++------
6 files changed, 45 insertions(+), 40 deletions(-)
diff --git
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/browse/MiloBrowseProducer.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/browse/MiloBrowseProducer.java
index ea4c0d8d6c51..00d12668a5cf 100644
---
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/browse/MiloBrowseProducer.java
+++
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/browse/MiloBrowseProducer.java
@@ -103,6 +103,7 @@ public class MiloBrowseProducer extends
DefaultAsyncProducer {
final int depth = endpoint.isRecursive() ? endpoint.getDepth() : -1;
final boolean subTypes = endpoint.isIncludeSubTypes() ||
endpoint.isRecursive();
+ @SuppressWarnings("unused")
final CompletableFuture<?> future = this.connection
.browse(expandedNodeIds, endpoint.getDirection(),
endpoint.getNodeClassMask(), depth, endpoint.getFilter(),
subTypes, endpoint.getMaxNodeIdsPerRequest())
diff --git
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
index 09e457021a57..489535f33b85 100644
---
a/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
+++
b/components/camel-milo/src/main/java/org/apache/camel/component/milo/server/MiloServerComponent.java
@@ -350,7 +350,10 @@ public class MiloServerComponent extends DefaultComponent {
.build();
}
+ // May be useful in the future although unused now.
+ @SuppressWarnings("unused")
private static final class DenyAllCertificateValidator implements
CertificateValidator {
+ @SuppressWarnings("unused")
public static final CertificateValidator INSTANCE = new
DenyAllCertificateValidator();
private DenyAllCertificateValidator() {
@@ -380,7 +383,7 @@ public class MiloServerComponent extends DefaultComponent {
this.runOnStop.add(runnable);
}
- private Map createUserMap() {
+ private Map<String, String> createUserMap() {
Map<String, String> userMap = null;
if (userAuthenticationCredentials != null) {
userMap = new HashMap<>();
diff --git
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/AbstractMiloServerTest.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/AbstractMiloServerTest.java
index 46e9db14739a..fec1ae93d01f 100644
---
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/AbstractMiloServerTest.java
+++
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/AbstractMiloServerTest.java
@@ -47,7 +47,6 @@ public abstract class AbstractMiloServerTest extends
CamelTestSupport {
@Override
protected void doPreSetup() throws Exception {
- super.doPreSetup();
this.serverPort = AvailablePortFinder.getNextAvailable();
}
diff --git
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitorItemMultiConnectionsCertTest.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitorItemMultiConnectionsCertTest.java
index 1e421c564b91..66add5b219a4 100644
---
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitorItemMultiConnectionsCertTest.java
+++
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/MonitorItemMultiConnectionsCertTest.java
@@ -30,6 +30,8 @@ import
org.apache.camel.component.milo.server.MiloServerComponent;
import org.apache.camel.component.mock.MockEndpoint;
import org.eclipse.milo.opcua.stack.core.security.SecurityPolicy;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,6 +41,7 @@ import static
java.nio.file.StandardCopyOption.REPLACE_EXISTING;
/**
* Testing monitoring items over multiple connections
*/
+@Disabled("due to Milo 1.0.5 API migration - certificate-based authentication
needs further investigation")
public class MonitorItemMultiConnectionsCertTest extends
AbstractMiloServerTest {
private static final String DIRECT_START_1 = "direct:start1";
@@ -121,26 +124,25 @@ public class MonitorItemMultiConnectionsCertTest extends
AbstractMiloServerTest
};
}
- // Disabled due to Milo 1.0.5 API migration - certificate-based
authentication needs further investigation
- // @Test
- // public void testMonitorItem1() throws Exception {
- //
- // // item 1 ... only this one receives
- // this.test1Endpoint.setExpectedCount(1);
- // this.test1Endpoint.setSleepForEmptyTest(5_000);
- //
- // // item 2
- // this.test2Endpoint.setExpectedCount(0);
- // this.test2Endpoint.setSleepForEmptyTest(5_000);
- //
- // // item 3
- // this.test3Endpoint.setExpectedCount(0);
- // this.test3Endpoint.setSleepForEmptyTest(5_000);
- //
- // // set server value
- // this.producer1.sendBody("Foo");
- //
- // // assert
- // MockEndpoint.assertIsSatisfied(context);
- // }
+ @Test
+ public void testMonitorItem1() throws Exception {
+
+ // item 1 ... only this one receives
+ this.test1Endpoint.setExpectedCount(1);
+ this.test1Endpoint.setSleepForEmptyTest(5_000);
+
+ // item 2
+ this.test2Endpoint.setExpectedCount(0);
+ this.test2Endpoint.setSleepForEmptyTest(5_000);
+
+ // item 3
+ this.test3Endpoint.setExpectedCount(0);
+ this.test3Endpoint.setSleepForEmptyTest(5_000);
+
+ // set server value
+ this.producer1.sendBody("Foo");
+
+ // assert
+ MockEndpoint.assertIsSatisfied(context);
+ }
}
diff --git
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/call/MockCamelNamespace.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/call/MockCamelNamespace.java
index 1aec6ceb4439..e8c2c763305b 100644
---
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/call/MockCamelNamespace.java
+++
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/call/MockCamelNamespace.java
@@ -16,13 +16,10 @@
*/
package org.apache.camel.component.milo.call;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.function.Function;
import org.apache.camel.component.milo.client.MiloClientConsumer;
-import org.apache.camel.component.milo.server.internal.CamelServerItem;
import org.eclipse.milo.opcua.sdk.core.Reference;
import org.eclipse.milo.opcua.sdk.server.Lifecycle;
import org.eclipse.milo.opcua.sdk.server.ManagedNamespaceWithLifecycle;
@@ -54,8 +51,6 @@ public class MockCamelNamespace extends
ManagedNamespaceWithLifecycle {
private UaFolderNode folder;
- private final Map<String, CamelServerItem> itemMap = new HashMap<>();
-
public MockCamelNamespace(final OpcUaServer server,
Function<UaMethodNode,
AbstractMethodInvocationHandler> callMethodCreator) {
super(server, URI);
diff --git
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/server/ServerSetSecurityPoliciesTest.java
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/server/ServerSetSecurityPoliciesTest.java
index 6238aa193a3c..ed76bf07278d 100644
---
a/components/camel-milo/src/test/java/org/apache/camel/component/milo/server/ServerSetSecurityPoliciesTest.java
+++
b/components/camel-milo/src/test/java/org/apache/camel/component/milo/server/ServerSetSecurityPoliciesTest.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.component.milo.server;
+import java.io.IOException;
+
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -40,23 +42,26 @@ public class ServerSetSecurityPoliciesTest extends
CamelTestSupport {
}
@Test
- public void testSetSecurityPolicies1() {
- final MiloServerComponent component = new MiloServerComponent();
- Assertions.assertDoesNotThrow(() ->
component.setSecurityPoliciesById("None"));
+ public void testSetSecurityPolicies1() throws IOException {
+ try (final MiloServerComponent component = new MiloServerComponent()) {
+ Assertions.assertDoesNotThrow(() ->
component.setSecurityPoliciesById("None"));
+ }
}
@Test
- public void testSetSecurityPolicies2() {
- final MiloServerComponent component = new MiloServerComponent();
- Assertions.assertDoesNotThrow(
- () ->
component.setSecurityPoliciesById("http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"));
+ public void testSetSecurityPolicies2() throws IOException {
+ try (final MiloServerComponent component = new MiloServerComponent()) {
+ Assertions.assertDoesNotThrow(
+ () ->
component.setSecurityPoliciesById("http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"));
+ }
}
@Test
- public void testSetSecurityPolicies3() {
- final MiloServerComponent component = new MiloServerComponent();
- Assertions.assertDoesNotThrow(
- () ->
component.setSecurityPoliciesById("None,http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"));
+ public void testSetSecurityPolicies3() throws IOException {
+ try (final MiloServerComponent component = new MiloServerComponent()) {
+ Assertions.assertDoesNotThrow(
+ () ->
component.setSecurityPoliciesById("None,http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"));
+ }
}
}