Skip to content

Commit

Permalink
Removed anonymous classes and moved MockSerializable out of the test …
Browse files Browse the repository at this point in the history
…case to allow TinkerGraph to properly serialize the graph on shutdown.
  • Loading branch information
spmallette committed Jul 10, 2012
1 parent 37daa75 commit 2449212
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
Expand Up @@ -2,6 +2,7 @@

import com.tinkerpop.blueprints.impls.GraphTest;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
import com.tinkerpop.blueprints.util.io.MockSerializable;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down Expand Up @@ -214,23 +215,16 @@ public void testDataTypeValidationOnProperties() {
trySetProperty(vertexA, "keyDate", new Date(), graph.getFeatures().supportsSerializableObjectProperty);
trySetProperty(edge, "keyDate", new Date(), graph.getFeatures().supportsSerializableObjectProperty);

trySetProperty(vertexA, "keyListString", new ArrayList() {{
add("try1");
add("try2");
}}, graph.getFeatures().supportsUniformListProperty);
trySetProperty(edge, "keyListString", new ArrayList() {{
add("try1");
add("try2");
}}, graph.getFeatures().supportsUniformListProperty);

trySetProperty(vertexA, "keyListMixed", new ArrayList() {{
add("try1");
add(2);
}}, graph.getFeatures().supportsMixedListProperty);
trySetProperty(edge, "keyListMixed", new ArrayList() {{
add("try1");
add(2);
}}, graph.getFeatures().supportsMixedListProperty);
ArrayList<String> listA = new ArrayList<String>();
listA.add("try1");
listA.add("try2");

trySetProperty(vertexA, "keyListString", listA, graph.getFeatures().supportsUniformListProperty);
trySetProperty(edge, "keyListString", listA, graph.getFeatures().supportsUniformListProperty);

ArrayList listB = new ArrayList();
trySetProperty(vertexA, "keyListMixed", listB, graph.getFeatures().supportsMixedListProperty);
trySetProperty(edge, "keyListMixed", listB, graph.getFeatures().supportsMixedListProperty);

trySetProperty(vertexA, "keyArrayString", new String[]{"try1", "try2"}, graph.getFeatures().supportsPrimitiveArrayProperty);
trySetProperty(edge, "keyArrayString", new String[]{"try1", "try2"}, graph.getFeatures().supportsPrimitiveArrayProperty);
Expand All @@ -250,10 +244,10 @@ public void testDataTypeValidationOnProperties() {
trySetProperty(vertexA, "keyArrayBoolean", new boolean[]{false, true}, graph.getFeatures().supportsPrimitiveArrayProperty);
trySetProperty(edge, "keyArrayBoolean", new boolean[]{false, true}, graph.getFeatures().supportsPrimitiveArrayProperty);

final Map map = new HashMap() {{
put("testString", "try");
put("testInteger", "string");
}};
final Map map = new HashMap();
map.put("testString", "try");
map.put("testInteger", "string");

trySetProperty(vertexA, "keyMap", map, graph.getFeatures().supportsMapProperty);
trySetProperty(edge, "keyMap", map, graph.getFeatures().supportsMapProperty);

Expand All @@ -264,10 +258,6 @@ public void testDataTypeValidationOnProperties() {

}

// TODO: clearing the graph until serialization issues for map with TinkerGraph are sorted.
if (graph instanceof TinkerGraph) {
((TinkerGraph) graph).clear();
}
graph.shutdown();
}

Expand Down Expand Up @@ -697,17 +687,4 @@ public void testGraphDataPersists() {
}
graph.shutdown();
}

protected class MockSerializable implements Serializable {
private String testField;

public String getTestField() {
return this.testField;
}

public void setTestField(String testField) {
this.testField = testField;
}

}
}
@@ -0,0 +1,19 @@
package com.tinkerpop.blueprints.util.io;

import java.io.Serializable;

/**
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class MockSerializable implements Serializable {
private String testField;

public String getTestField() {
return this.testField;
}

public void setTestField(String testField) {
this.testField = testField;
}

}

0 comments on commit 2449212

Please sign in to comment.