Skip to content

Commit b33f14f

Browse files
committed
disjoint smart graphs
1 parent b007c94 commit b33f14f

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

src/main/java/com/arangodb/entity/GraphEntity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class GraphEntity implements Entity {
3636
private Collection<EdgeDefinition> edgeDefinitions;
3737
private Collection<String> orphanCollections;
3838
private Boolean isSmart;
39+
private Boolean isDisjoint;
3940
private Integer numberOfShards;
4041
private String smartGraphAttribute;
4142
private ReplicationFactor replicationFactor;
@@ -57,6 +58,10 @@ public Boolean getIsSmart() {
5758
return isSmart;
5859
}
5960

61+
public Boolean getIsDisjoint() {
62+
return isDisjoint;
63+
}
64+
6065
public Integer getNumberOfShards() {
6166
return numberOfShards;
6267
}

src/main/java/com/arangodb/model/GraphCreateOptions.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ public GraphCreateOptions isSmart(final Boolean isSmart) {
9494
return this;
9595
}
9696

97+
public Boolean getIsDisjoint() {
98+
return getOptions().getIsDisjoint();
99+
}
100+
101+
public GraphCreateOptions isDisjoint(final Boolean isDisjoint) {
102+
getOptions().setIsDisjoint(isDisjoint);
103+
return this;
104+
}
105+
97106
public Integer getReplicationFactor() {
98107
return getOptions().replicationFactor.getReplicationFactor();
99108
}
@@ -187,6 +196,7 @@ public static class SmartOptions {
187196
private Integer minReplicationFactor;
188197
private Integer numberOfShards;
189198
private String smartGraphAttribute;
199+
private Boolean isDisjoint;
190200

191201
public SmartOptions() {
192202
super();
@@ -233,6 +243,14 @@ public void setSmartGraphAttribute(final String smartGraphAttribute) {
233243
this.smartGraphAttribute = smartGraphAttribute;
234244
}
235245

246+
public Boolean getIsDisjoint() {
247+
return isDisjoint;
248+
}
249+
250+
public void setIsDisjoint(final Boolean isDisjoint) {
251+
this.isDisjoint = isDisjoint;
252+
}
253+
236254
}
237255

238256
}

src/test/java/com/arangodb/ArangoGraphTest.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import com.arangodb.entity.EdgeDefinition;
2525
import com.arangodb.entity.GraphEntity;
2626
import com.arangodb.model.GraphCreateOptions;
27-
import org.junit.*;
27+
import org.junit.BeforeClass;
28+
import org.junit.Test;
2829
import org.junit.runner.RunWith;
2930
import org.junit.runners.Parameterized;
3031

@@ -33,7 +34,6 @@
3334
import static org.hamcrest.CoreMatchers.notNullValue;
3435
import static org.hamcrest.MatcherAssert.assertThat;
3536
import static org.hamcrest.Matchers.*;
36-
3737
import static org.junit.Assume.assumeTrue;
3838

3939
/**
@@ -277,6 +277,26 @@ public void smartGraph() {
277277
assertThat(g.getNumberOfShards(), is(2));
278278
}
279279

280+
@Test
281+
public void disjointSmartGraph() {
282+
assumeTrue(isEnterprise());
283+
assumeTrue(isCluster());
284+
assumeTrue((isAtLeastVersion(3, 7)));
285+
286+
final Collection<EdgeDefinition> edgeDefinitions = new ArrayList<>();
287+
edgeDefinitions.add(new EdgeDefinition().collection("smartGraph-edge-" + rnd()).from("smartGraph-vertex-" + rnd()).to("smartGraph-vertex-" + rnd()));
288+
289+
String graphId = GRAPH_NAME + rnd();
290+
final GraphEntity g = db.createGraph(graphId, edgeDefinitions, new GraphCreateOptions()
291+
.isSmart(true).isDisjoint(true).smartGraphAttribute("test").numberOfShards(2));
292+
293+
assertThat(g, is(notNullValue()));
294+
assertThat(g.getIsSmart(), is(true));
295+
assertThat(g.getIsDisjoint(), is(true));
296+
assertThat(g.getSmartGraphAttribute(), is("test"));
297+
assertThat(g.getNumberOfShards(), is(2));
298+
}
299+
280300
@Test
281301
public void drop() {
282302
final String edgeCollection = "edge_" + rnd();

0 commit comments

Comments
 (0)