diff --git a/pom.xml b/pom.xml index cfe3a7d..7feb65a 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,12 @@ test + + org.slf4j + jul-to-slf4j + 1.7.36 + runtime + diff --git a/src/test/java/com/hurence/opc/da/OpcDaTemplateTest.java b/src/test/java/com/hurence/opc/da/OpcDaTemplateTest.java index 97695b2..aeede05 100644 --- a/src/test/java/com/hurence/opc/da/OpcDaTemplateTest.java +++ b/src/test/java/com/hurence/opc/da/OpcDaTemplateTest.java @@ -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; @@ -51,6 +52,10 @@ */ @Ignore public class OpcDaTemplateTest { + static { + SLF4JBridgeHandler.removeHandlersForRootLogger(); + SLF4JBridgeHandler.install(); + } private final Logger logger = LoggerFactory.getLogger(OpcDaTemplateTest.class); @@ -132,12 +137,12 @@ public void testSampling_Poll() throws Exception { .withRefreshInterval(Duration.ofMillis(300)); List> 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) @@ -285,8 +290,8 @@ public void listenToAll() throws Exception { try (OpcDaSession session = opcDaOperations.createSession(sessionProfile).blockingGet()) { List 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()) @@ -419,7 +424,6 @@ public void testAutoReconnect() throws Exception { subscriber.assertComplete(); subscriber.assertValueCount(50); subscriber.dispose(); - } diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml new file mode 100644 index 0000000..fbbe210 --- /dev/null +++ b/src/test/resources/logback-test.xml @@ -0,0 +1,16 @@ + + + + + %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n + + + + + + + + + + +