diff --git a/examples/pom.xml b/examples/pom.xml
index fc2fba4faa..606b50502c 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -111,12 +111,6 @@ limitations under the License.
de.learnlib
learnlib-statistics
-
- de.learnlib.testsupport
- learnlib-test-support
- compile
-
-
de.learnlib
learnlib-ttt
@@ -162,6 +156,10 @@ limitations under the License.
automata-serialization-dot
+
+ org.apache.fury
+ fury-core
+
org.checkerframework
checker-qual
diff --git a/examples/src/main/java/de/learnlib/example/resumable/ResumableExample.java b/examples/src/main/java/de/learnlib/example/resumable/ResumableExample.java
index 4b6ac70c58..252d9d6998 100644
--- a/examples/src/main/java/de/learnlib/example/resumable/ResumableExample.java
+++ b/examples/src/main/java/de/learnlib/example/resumable/ResumableExample.java
@@ -27,12 +27,14 @@
import de.learnlib.oracle.equivalence.DFASimulatorEQOracle;
import de.learnlib.oracle.membership.DFASimulatorOracle;
import de.learnlib.query.DefaultQuery;
-import de.learnlib.testsupport.ResumeUtils;
import net.automatalib.alphabet.Alphabet;
import net.automatalib.alphabet.impl.Alphabets;
import net.automatalib.alphabet.impl.GrowingMapAlphabet;
import net.automatalib.automaton.fsa.impl.CompactDFA;
import net.automatalib.util.automaton.random.RandomAutomata;
+import org.apache.fury.Fury;
+import org.apache.fury.logging.LogLevel;
+import org.apache.fury.logging.LoggerFactory;
/**
* An example to demonstrate the {@link Resumable} feature of LearnLib to continue learning setups from previously
@@ -43,13 +45,18 @@ public final class ResumableExample {
private static final CompactDFA TARGET;
private static final Alphabet INITIAL_ALPHABET;
+ private static final Fury FURY;
static {
+ LoggerFactory.useSlf4jLogging(true);
+ LoggerFactory.setLogLevel(LogLevel.ERROR_LEVEL);
+
final int seed = 42;
final int size = 100;
TARGET = RandomAutomata.randomDFA(new Random(seed), size, Alphabets.characters('a', 'd'));
INITIAL_ALPHABET = Alphabets.characters('a', 'b');
+ FURY = Fury.builder().withRefTracking(true).requireClassRegistration(false).build();
}
private ResumableExample() {
@@ -71,8 +78,8 @@ public static void main(String[] args) {
printStats(setup);
// serialize the current state of the learning setup which may be stored somewhere external
- final byte[] learnerData = ResumeUtils.toBytes(setup.learner.suspend());
- final byte[] cacheData = ResumeUtils.toBytes(setup.cache.suspend());
+ final byte[] learnerData = toBytes(setup.learner.suspend());
+ final byte[] cacheData = toBytes(setup.cache.suspend());
// continue exploring the previous snapshot with new input symbol 'c'
continueExploring(learnerData, cacheData, 'c');
@@ -87,10 +94,10 @@ private static void continueExploring(byte[] learnerData, byte[] cacheData, char
final Setup setup = new Setup();
// resume from previous states and add new symbol
- setup.cache.resume(ResumeUtils.fromBytes(cacheData));
+ setup.cache.resume(fromBytes(cacheData));
setup.cache.addAlphabetSymbol(newSymbol);
- setup.learner.resume(ResumeUtils.fromBytes(learnerData));
+ setup.learner.resume(fromBytes(learnerData));
setup.learner.addAlphabetSymbol(newSymbol);
// continue learning-loop
@@ -103,6 +110,15 @@ private static void continueExploring(byte[] learnerData, byte[] cacheData, char
printStats(setup);
}
+ private static byte[] toBytes(Object state) {
+ return FURY.serialize(state);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static T fromBytes(byte[] bytes) {
+ return (T) FURY.deserialize(bytes);
+ }
+
private static void printStats(Setup setup) {
System.out.println("Hypothesis size: " + setup.learner.getHypothesisModel().size());
System.out.println(setup.counter.getStatisticalData().getSummary());
diff --git a/examples/src/main/java/module-info.java b/examples/src/main/java/module-info.java
index 5a64922568..83d5d976c8 100644
--- a/examples/src/main/java/module-info.java
+++ b/examples/src/main/java/module-info.java
@@ -41,7 +41,6 @@
requires de.learnlib.oracle.membership;
requires de.learnlib.oracle.parallelism;
requires de.learnlib.oracle.property;
- requires de.learnlib.testsupport;
requires de.learnlib.testsupport.example;
requires net.automatalib.api;
requires net.automatalib.common.util;
@@ -50,6 +49,11 @@
requires net.automatalib.util;
requires net.automatalib.serialization.dot;
requires net.automatalib.visualization.dot;
+ requires org.apache.fury.core;
+
+ // required by Fury
+ requires jdk.unsupported;
+ requires java.sql;
// make non-static once https://github.com/typetools/checker-framework/issues/4559 is implemented
requires static org.checkerframework.checker.qual;
diff --git a/test-support/test-support/pom.xml b/test-support/test-support/pom.xml
index 32c3bd86c6..de457d8dcc 100644
--- a/test-support/test-support/pom.xml
+++ b/test-support/test-support/pom.xml
@@ -71,7 +71,6 @@
compile
-
org.testng
testng
diff --git a/test-support/test-support/src/main/java/de/learnlib/testsupport/ResumeUtils.java b/test-support/test-support/src/main/java/de/learnlib/testsupport/ResumeUtils.java
index 87bc7156c3..18cf0fe0a5 100644
--- a/test-support/test-support/src/main/java/de/learnlib/testsupport/ResumeUtils.java
+++ b/test-support/test-support/src/main/java/de/learnlib/testsupport/ResumeUtils.java
@@ -35,7 +35,7 @@ private ResumeUtils() {
// prevent instantiation
}
- public static byte[] toBytes(T state) {
+ public static byte[] toBytes(Object state) {
return FURY.serialize(state);
}