Skip to content

Commit 7a42bba

Browse files
committed
fix more tests
1 parent 8097a6b commit 7a42bba

File tree

2 files changed

+33
-37
lines changed

2 files changed

+33
-37
lines changed

src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/SpecializedElementsWithOndiskTest.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -433,30 +433,30 @@ public void traversalPerformanceComparison() throws IOException {
433433
// with overflow that number should be tremendously larger, because only the reference wrappers are helt in memory
434434
// it'll be much slower due to the serialization to disk, but should not crash
435435
// important: use all the following vm opts: `-XX:+UseG1GC -Xms256m -Xmx256m -XX:+HeapDumpOnOutOfMemoryError`
436-
public void shouldAllowGraphsLargerThanMemory() throws InterruptedException {
437-
int vertexCount = 300000;
438-
// TinkerGraph graph = newGratefulDeadGraphWithSpecializedElements();
439-
Configuration configuration = TinkerGraph.EMPTY_CONFIGURATION();
440-
// configuration.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_ONDISK_OVERFLOW_ENABLED, false);
441-
configuration.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_ONDISK_OVERFLOW_ENABLED, true);
442-
TinkerGraph graph = TinkerGraph.open(
443-
configuration,
444-
Arrays.asList(Song.factory, Artist.factory),
445-
Arrays.asList(FollowedBy.factory, SungBy.factory, WrittenBy.factory)
446-
);
447-
448-
for (long i = 0; i < vertexCount; i++) {
449-
if (i % 50000 == 0) {
450-
System.out.println(i + " vertices created");
451-
Thread.sleep(1000); // in lieu of other application usage
452-
}
453-
Vertex v = graph.addVertex(Song.label);
454-
// v.property(Song.NAME, UUID.randomUUID().toString());
455-
// v.property(Song.SONG_TYPE, UUID.randomUUID().toString());
456-
v.property(Song.TEST_PROP, new int[200]);
457-
}
458-
graph.close();
459-
}
436+
// public void shouldAllowGraphsLargerThanMemory() throws InterruptedException {
437+
// int vertexCount = 300000;
438+
//// TinkerGraph graph = newGratefulDeadGraphWithSpecializedElements();
439+
// Configuration configuration = TinkerGraph.EMPTY_CONFIGURATION();
440+
//// configuration.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_ONDISK_OVERFLOW_ENABLED, false);
441+
// configuration.setProperty(TinkerGraph.GREMLIN_TINKERGRAPH_ONDISK_OVERFLOW_ENABLED, true);
442+
// TinkerGraph graph = TinkerGraph.open(
443+
// configuration,
444+
// Arrays.asList(Song.factory, Artist.factory),
445+
// Arrays.asList(FollowedBy.factory, SungBy.factory, WrittenBy.factory)
446+
// );
447+
//
448+
// for (long i = 0; i < vertexCount; i++) {
449+
// if (i % 50000 == 0) {
450+
// System.out.println(i + " vertices created");
451+
// Thread.sleep(1000); // in lieu of other application usage
452+
// }
453+
// Vertex v = graph.addVertex(Song.label);
454+
//// v.property(Song.NAME, UUID.randomUUID().toString());
455+
//// v.property(Song.SONG_TYPE, UUID.randomUUID().toString());
456+
// v.property(Song.TEST_PROP, new int[200]);
457+
// }
458+
// graph.close();
459+
// }
460460

461461
private TinkerGraph newGratefulDeadGraphWithSpecializedElements() {
462462
Configuration configuration = TinkerGraph.EMPTY_CONFIGURATION();

src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/specialized/gratefuldead/Song.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ public class Song extends SpecializedTinkerVertex implements Serializable {
3333
public static final String NAME = "name";
3434
public static final String SONG_TYPE = "songType";
3535
public static final String PERFORMANCES = "performances";
36-
public static final String TEST_PROP = "testProperty";
37-
public static final Set<String> SPECIFIC_KEYS = new HashSet<>(Arrays.asList(NAME, SONG_TYPE, PERFORMANCES, TEST_PROP));
36+
public static final Set<String> SPECIFIC_KEYS = new HashSet<>(Arrays.asList(NAME, SONG_TYPE, PERFORMANCES));
3837
public static final Set<String> ALLOWED_IN_EDGE_LABELS = new HashSet<>(Arrays.asList(FollowedBy.label));
3938
public static final Set<String> ALLOWED_OUT_EDGE_LABELS = new HashSet<>(Arrays.asList(FollowedBy.label, SungBy.label, WrittenBy.label));
39+
public static final int NAME_IDX = 0;
40+
public static final int SONG_TYPE_IDX = 1;
41+
public static final int PERFORMANCES_IDX = 2;
4042

4143
// properties
4244
private String name;
4345
private String songType;
4446
private Integer performances;
45-
private int[] testProp;
4647

4748
public Song(Long id, TinkerGraph graph) {
4849
super(id, Song.label, graph);
@@ -76,8 +77,6 @@ public Integer getPerformances() {
7677
return performances;
7778
}
7879

79-
public int[] getTestProp() { return testProp; }
80-
8180
@Override
8281
protected Set<String> specificKeys() {
8382
return SPECIFIC_KEYS;
@@ -103,8 +102,6 @@ protected <V> Iterator<VertexProperty<V>> specificProperties(String key) {
103102
return IteratorUtils.of(new TinkerVertexProperty(this, key, songType));
104103
} else if (key == PERFORMANCES && performances != null) {
105104
return IteratorUtils.of(new TinkerVertexProperty(this, key, performances));
106-
} else if (key == TEST_PROP && testProp != null) {
107-
return IteratorUtils.of(new TinkerVertexProperty(this, key, testProp));
108105
} else {
109106
return Collections.emptyIterator();
110107
}
@@ -116,13 +113,16 @@ public Map<String, Object> valueMap() {
116113
if (name != null) properties.put(NAME, name);
117114
if (songType != null) properties.put(SONG_TYPE, songType);
118115
if (performances != null) properties.put(PERFORMANCES, performances);
119-
if (testProp != null) properties.put(TEST_PROP, testProp);
120116
return properties;
121117
}
122118

123119
@Override
124120
public SortedMap<Integer, Object> propertiesByStorageIdx() {
125-
throw new NotImplementedException("TODO");
121+
SortedMap<Integer, Object> ret = new TreeMap<>();
122+
if (name != null) ret.put(NAME_IDX, name);
123+
if (songType != null) ret.put(SONG_TYPE_IDX, songType);
124+
if (performances != null) ret.put(PERFORMANCES_IDX, performances);
125+
return ret;
126126
}
127127

128128
@Override
@@ -134,8 +134,6 @@ protected <V> VertexProperty<V> updateSpecificProperty(
134134
this.songType = (String) value;
135135
} else if (PERFORMANCES.equals(key)) {
136136
this.performances = ((Integer) value);
137-
} else if (TEST_PROP.equals(key)) {
138-
this.testProp = (int[]) value;
139137
} else {
140138
throw new RuntimeException("property with key=" + key + " not (yet) supported by " + this.getClass().getName());
141139
}
@@ -151,8 +149,6 @@ protected void removeSpecificProperty(String key) {
151149
this.songType = null;
152150
} else if (PERFORMANCES.equals(key)) {
153151
this.performances = null;
154-
} else if (TEST_PROP.equals(key)) {
155-
this.testProp = null;
156152
} else {
157153
throw new RuntimeException("property with key=" + key + " not (yet) supported by " + this.getClass().getName());
158154
}

0 commit comments

Comments
 (0)