--- /dev/null
+package org.simantics.db.tests.api.story.sessionGarbageCollection;
+
+import org.simantics.db.Resource;
+import org.simantics.db.Session;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.request.WriteResultRequest;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.util.SessionGarbageCollection;
+import org.simantics.db.testing.annotation.Fails;
+import org.simantics.db.testing.base.CommandSequenceTest;
+import org.simantics.db.testing.common.Command;
+import org.simantics.db.testing.common.CommandSequenceEnvironment;
+import org.simantics.db.testing.common.CommandSpec;
+import org.simantics.db.testing.common.Kill;
+import org.simantics.db.testing.common.Reconnect;
+
+/**
+ * @author Antti Villberg
+ */
+@Fails
+public class CollectDuringWriteAndRead extends CommandSequenceTest {
+
+ private final int SEQUENCE_SIZE = 300;
+ private final int LIST_SIZE = 500;
+
+ private Resource root;
+ private int index;
+
+ public Resource getRoot() {
+ return root;
+ }
+
+ public int incrementAndGetIndex() {
+ return index++;
+ }
+
+ public int getListSize() {
+ return LIST_SIZE;
+ }
+
+ @Override
+ protected int getSequenceSize() {
+ return SEQUENCE_SIZE;
+ }
+
+ @Override
+ protected CommandSpec<?>[] getFactories() {
+ return new CommandSpec[] {
+ CommandSpec.make(AddList.class, 1.0),
+ CommandSpec.make(RemoveList.class, 1.0),
+ CommandSpec.make(AppendList.class, 0.5),
+ CommandSpec.make(Read.class, 0.1),
+ CommandSpec.make(AddListAndKill.class, 0.02),
+ CommandSpec.make(Reconnect.class, 0.02),
+ CommandSpec.make(Kill.class, 0.02)
+ };
+ }
+
+ protected Command[] beforeSequence(CommandSequenceEnvironment environment) throws Exception {
+
+ return new Command[] {
+
+ new Command<CommandSequenceEnvironment>() {
+
+ @Override
+ public void run(CommandSequenceEnvironment environment) throws Exception {
+
+ Session s = getSession();
+ root = s.syncRequest(new WriteResultRequest<Resource>() {
+
+ @Override
+ public Resource perform(WriteGraph graph) throws DatabaseException {
+ return graph.newResource();
+ }
+
+ });
+ for(int i=0;i<10;i++) new AddList().run(CollectDuringWriteAndRead.this);
+ SessionGarbageCollection.gc(null, s, true, null, 0, 0);
+
+ }
+
+ }
+
+ };
+
+
+ }
+
+}