Skip to content

Commit 803825c

Browse files
committed
fix
1 parent 4cd4299 commit 803825c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

integration-test/src/test/java/org/apache/iotdb/pipe/it/single/IoTDBPipeOPCUAIT.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.iotdb.db.it.utils.TestUtils;
2626
import org.apache.iotdb.db.pipe.sink.protocol.opcua.client.ClientRunner;
2727
import org.apache.iotdb.db.pipe.sink.protocol.opcua.client.IoTDBOpcUaClient;
28+
import org.apache.iotdb.it.env.cluster.EnvUtils;
2829
import org.apache.iotdb.it.framework.IoTDBTestRunner;
2930
import org.apache.iotdb.itbase.category.MultiClusterIT1;
3031
import org.apache.iotdb.pipe.api.exception.PipeException;
@@ -74,6 +75,12 @@ public void testOPCUAServerSink() throws Exception {
7475
sinkAttributes.put("opcua.model", "client-server");
7576
sinkAttributes.put("security-policy", "None");
7677

78+
final int[] ports = EnvUtils.searchAvailablePorts();
79+
final int tcpPort = ports[0];
80+
final int httpsPort = ports[1];
81+
sinkAttributes.put("tcp.port", Integer.toString(tcpPort));
82+
sinkAttributes.put("https.port", Integer.toString(httpsPort));
83+
7784
Assert.assertEquals(
7885
TSStatusCode.SUCCESS_STATUS.getStatusCode(),
7986
client
@@ -84,7 +91,8 @@ public void testOPCUAServerSink() throws Exception {
8491
.getCode());
8592

8693
final OpcUaClient opcUaClient =
87-
getOpcUaClient("opc.tcp://127.0.0.1:12686/iotdb", SecurityPolicy.None, "root", "root");
94+
getOpcUaClient(
95+
"opc.tcp://127.0.0.1:" + tcpPort + "/iotdb", SecurityPolicy.None, "root", "root");
8896
DataValue value =
8997
opcUaClient.readValue(0, TimestampsToReturn.Both, new NodeId(2, "root/db/d1/s1")).get();
9098
Assert.assertEquals(new Variant(1.0), value.getValue());
@@ -164,7 +172,10 @@ public void testOPCUAServerSink() throws Exception {
164172
PipeException.class,
165173
() ->
166174
getOpcUaClient(
167-
"opc.tcp://127.0.0.1:12686/iotdb", SecurityPolicy.None, "root", "root"));
175+
"opc.tcp://127.0.0.1:" + tcpPort + "/iotdb",
176+
SecurityPolicy.None,
177+
"root",
178+
"root"));
168179

169180
// Test conflict
170181
sinkAttributes.put("password", "conflict");
@@ -196,6 +207,12 @@ public void testOPCUASinkInTableModel() throws Exception {
196207
sinkAttributes.put("sink", "opc-ua-sink");
197208
sinkAttributes.put("opcua.model", "client-server");
198209

210+
final int[] ports = EnvUtils.searchAvailablePorts();
211+
final int tcpPort = ports[0];
212+
final int httpsPort = ports[1];
213+
sinkAttributes.put("tcp.port", Integer.toString(tcpPort));
214+
sinkAttributes.put("https.port", Integer.toString(httpsPort));
215+
199216
Assert.assertEquals(
200217
TSStatusCode.SUCCESS_STATUS.getStatusCode(),
201218
client

0 commit comments

Comments
 (0)