Skip to content
Open
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
<version>2.12.6</version>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.6</version>
<groupId>org.xmlunit</groupId>
Comment thread
ChopinLi-cp marked this conversation as resolved.
Outdated
<artifactId>xmlunit-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>edu.illinois.cs</groupId>
Expand All @@ -98,6 +98,16 @@
<artifactId>junit-platform-launcher</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.5.0-SNAPSHOT</version>
Comment thread
ChopinLi-cp marked this conversation as resolved.
Outdated
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.11.2</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
2 changes: 2 additions & 0 deletions testrunner-running/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0
Premain-Class: edu.illinois.cs.statecapture.agent.MainAgent
26 changes: 24 additions & 2 deletions testrunner-running/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,21 @@
<artifactId>scala-library</artifactId>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -118,6 +126,20 @@
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
<argLine>-Xmx4096m</argLine>
Comment thread
ChopinLi-cp marked this conversation as resolved.
Outdated
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<!--<manifest>
Comment thread
ChopinLi-cp marked this conversation as resolved.
Outdated
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>-->
<manifestFile>MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package edu.illinois.cs.statecapture;

import com.thoughtworks.xstream.converters.collections.MapConverter;
import com.thoughtworks.xstream.converters.MarshallingContext;
import com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriterHelper;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.mapper.Mapper;

import java.util.Iterator;
import java.util.Map;

public class CustomMapConverter extends MapConverter {

public CustomMapConverter(Mapper mapper) {
super(mapper);
}

// Logic mostly copied from writeItem
protected void writeItemWithName(String name, Object item, MarshallingContext context, HierarchicalStreamWriter writer) {
if (item == null) {
writeNullItem(context, writer);
} else {
String clazz = mapper().serializedClass(item.getClass());
ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass());
writer.addAttribute("class", clazz); // Map the class as an attribute to the node
writeBareItem(item, context, writer);
writer.endNode();
}
}

@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
Map map = (Map) source;
String entryName = mapper().serializedClass(Map.Entry.class);
for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
ExtendedHierarchicalStreamWriterHelper.startNode(writer, entryName, entry.getClass());

// Give consistent name to elements (their types will be encoded as attribute)
writeItemWithName("key", entry.getKey(), context, writer);
writeItemWithName("value", entry.getValue(), context, writer);

writer.endNode();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package edu.illinois.cs.statecapture;

public interface IStateCapture {

public void runCapture();
Comment thread
ChopinLi-cp marked this conversation as resolved.
Outdated
}
Loading