Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.36</version>
<scope>runtime</scope>
</dependency>

</dependencies>
<build>
Expand Down
20 changes: 12 additions & 8 deletions src/test/java/com/hurence/opc/da/OpcDaTemplateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.junit.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.bridge.SLF4JBridgeHandler;

import java.net.URI;
import java.time.Duration;
Expand All @@ -51,6 +52,10 @@
*/
@Ignore
public class OpcDaTemplateTest {
static {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
}

private final Logger logger = LoggerFactory.getLogger(OpcDaTemplateTest.class);

Expand Down Expand Up @@ -132,12 +137,12 @@ public void testSampling_Poll() throws Exception {
.withRefreshInterval(Duration.ofMillis(300));

List<Timed<OpcData>> received = Flowable.combineLatest(
Flowable.interval(10, TimeUnit.MILLISECONDS),
opcDaOperations.createSession(sessionProfile).toFlowable()
.flatMap(session -> session.stream("Square Waves.Real8", Duration.ofMillis(10))
.doFinally(session::close)
Flowable.interval(10, TimeUnit.MILLISECONDS),
opcDaOperations.createSession(sessionProfile).toFlowable()
.flatMap(session -> session.stream("Square Waves.Real8", Duration.ofMillis(10))
.doFinally(session::close)

), (a, b) -> b)
), (a, b) -> b)
.sample(10, TimeUnit.MILLISECONDS)
.timeInterval()
.limit(100)
Expand Down Expand Up @@ -285,8 +290,8 @@ public void listenToAll() throws Exception {
try (OpcDaSession session = opcDaOperations.createSession(sessionProfile).blockingGet()) {
List<OpcTagInfo> tagList = opcDaOperations.browseTags().toList().blockingGet();
Flowable.merge(Flowable.fromArray(tagList.toArray(new OpcTagInfo[tagList.size()]))
.map(tagInfo -> session.stream(tagInfo.getId(), Duration.ofMillis(100)))
)
.map(tagInfo -> session.stream(tagInfo.getId(), Duration.ofMillis(100)))
)
.doOnNext(data -> logger.info("{}", data))
.limit(1000)
.subscribeOn(Schedulers.io())
Expand Down Expand Up @@ -419,7 +424,6 @@ public void testAutoReconnect() throws Exception {
subscriber.assertComplete();
subscriber.assertValueCount(50);
subscriber.dispose();

}


Expand Down
16 changes: 16 additions & 0 deletions src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>

<logger name="rpc" level="warn" />

<root level="info">
<appender-ref ref="CONSOLE"/>
</root>

</configuration>