2424import com .arangodb .entity .EdgeDefinition ;
2525import com .arangodb .entity .GraphEntity ;
2626import com .arangodb .model .GraphCreateOptions ;
27+ import com .arangodb .model .VertexCollectionCreateOptions ;
2728import org .junit .BeforeClass ;
2829import org .junit .Test ;
2930import org .junit .runner .RunWith ;
@@ -185,6 +186,26 @@ public void addVertexCollection() {
185186 graph .vertexCollection (VERTEX_COL_4 ).drop ();
186187 }
187188
189+ @ Test
190+ public void addSatelliteVertexCollection () {
191+ assumeTrue (isCluster ());
192+ assumeTrue (isEnterprise ());
193+ assumeTrue (isAtLeastVersion (3 , 9 ));
194+
195+ String v1Name = "vertex-" + rnd ();
196+
197+ ArangoGraph g = db .graph (GRAPH_NAME + rnd ());
198+ g .create (Collections .emptyList (), new GraphCreateOptions ().isSmart (true ).smartGraphAttribute ("test" ));
199+ g .addVertexCollection (v1Name , new VertexCollectionCreateOptions ().satellites (v1Name ));
200+
201+ Collection <String > vertexCollections = g .getVertexCollections ();
202+ assertThat (vertexCollections , hasItems (v1Name ));
203+ assertThat (db .collection (v1Name ).getProperties ().getSatellite (), is (true ));
204+
205+ // revert
206+ g .drop ();
207+ }
208+
188209 @ Test
189210 public void getEdgeCollections () {
190211 final Collection <String > edgeCollections = graph .getEdgeDefinitions ();
@@ -223,6 +244,35 @@ public void addEdgeDefinition() {
223244 graph .removeEdgeDefinition (EDGE_COL_3 );
224245 }
225246
247+ @ Test
248+ public void addSatelliteEdgeDefinition () {
249+ assumeTrue (isCluster ());
250+ assumeTrue (isEnterprise ());
251+ assumeTrue (isAtLeastVersion (3 , 9 ));
252+
253+ String eName = "edge-" + rnd ();
254+ String v1Name = "vertex-" + rnd ();
255+ String v2Name = "vertex-" + rnd ();
256+ EdgeDefinition ed = new EdgeDefinition ().collection (eName ).from (v1Name ).to (v2Name ).satellites (v1Name );
257+
258+ ArangoGraph g = db .graph (GRAPH_NAME + rnd ());
259+ g .create (Collections .emptyList (), new GraphCreateOptions ().isSmart (true ).smartGraphAttribute ("test" ));
260+ g .addEdgeDefinition (ed );
261+ final GraphEntity ge = g .getInfo ();
262+ assertThat (ge , is (notNullValue ()));
263+ final Collection <EdgeDefinition > edgeDefinitions = ge .getEdgeDefinitions ();
264+ assertThat (edgeDefinitions .size (), is (1 ));
265+ EdgeDefinition e = edgeDefinitions .iterator ().next ();
266+ assertThat (e .getCollection (), is (eName ));
267+ assertThat (e .getFrom (), hasItem (v1Name ));
268+ assertThat (e .getTo (), hasItem (v2Name ));
269+
270+ assertThat (db .collection (v1Name ).getProperties ().getSatellite (), is (true ));
271+
272+ // revert
273+ g .drop ();
274+ }
275+
226276 @ Test
227277 public void replaceEdgeDefinition () {
228278 final GraphEntity g = graph
@@ -277,6 +327,33 @@ public void smartGraph() {
277327 assertThat (g .getNumberOfShards (), is (2 ));
278328 }
279329
330+ @ Test
331+ public void hybridSmartGraph () {
332+ assumeTrue (isEnterprise ());
333+ assumeTrue (isCluster ());
334+ assumeTrue ((isAtLeastVersion (3 , 9 )));
335+
336+ final Collection <EdgeDefinition > edgeDefinitions = new ArrayList <>();
337+ String eName = "hybridSmartGraph-edge-" + rnd ();
338+ String v1Name = "hybridSmartGraph-vertex-" + rnd ();
339+ String v2Name = "hybridSmartGraph-vertex-" + rnd ();
340+ edgeDefinitions .add (new EdgeDefinition ().collection (eName ).from (v1Name ).to (v2Name ));
341+
342+ String graphId = GRAPH_NAME + rnd ();
343+ final GraphEntity g = db .createGraph (graphId , edgeDefinitions , new GraphCreateOptions ()
344+ .satellites (eName , v1Name )
345+ .isSmart (true ).smartGraphAttribute ("test" ).replicationFactor (2 ).numberOfShards (2 ));
346+
347+ assertThat (g , is (notNullValue ()));
348+ assertThat (g .getIsSmart (), is (true ));
349+ assertThat (g .getSmartGraphAttribute (), is ("test" ));
350+ assertThat (g .getNumberOfShards (), is (2 ));
351+
352+ assertThat (db .collection (eName ).getProperties ().getSatellite (), is (true ));
353+ assertThat (db .collection (v1Name ).getProperties ().getSatellite (), is (true ));
354+ assertThat (db .collection (v2Name ).getProperties ().getReplicationFactor (), is (2 ));
355+ }
356+
280357 @ Test
281358 public void disjointSmartGraph () {
282359 assumeTrue (isEnterprise ());
@@ -297,6 +374,33 @@ public void disjointSmartGraph() {
297374 assertThat (g .getNumberOfShards (), is (2 ));
298375 }
299376
377+ @ Test
378+ public void hybridDisjointSmartGraph () {
379+ assumeTrue (isEnterprise ());
380+ assumeTrue (isCluster ());
381+ assumeTrue ((isAtLeastVersion (3 , 9 )));
382+
383+ final Collection <EdgeDefinition > edgeDefinitions = new ArrayList <>();
384+ String eName = "hybridDisjointSmartGraph-edge-" + rnd ();
385+ String v1Name = "hybridDisjointSmartGraph-vertex-" + rnd ();
386+ String v2Name = "hybridDisjointSmartGraph-vertex-" + rnd ();
387+ edgeDefinitions .add (new EdgeDefinition ().collection (eName ).from (v1Name ).to (v2Name ));
388+
389+ String graphId = GRAPH_NAME + rnd ();
390+ final GraphEntity g = db .createGraph (graphId , edgeDefinitions , new GraphCreateOptions ()
391+ .satellites (v1Name )
392+ .isSmart (true ).isDisjoint (true ).smartGraphAttribute ("test" ).replicationFactor (2 ).numberOfShards (2 ));
393+
394+ assertThat (g , is (notNullValue ()));
395+ assertThat (g .getIsSmart (), is (true ));
396+ assertThat (g .getIsDisjoint (), is (true ));
397+ assertThat (g .getSmartGraphAttribute (), is ("test" ));
398+ assertThat (g .getNumberOfShards (), is (2 ));
399+
400+ assertThat (db .collection (v1Name ).getProperties ().getSatellite (), is (true ));
401+ assertThat (db .collection (v2Name ).getProperties ().getReplicationFactor (), is (2 ));
402+ }
403+
300404 @ Test
301405 public void drop () {
302406 final String edgeCollection = "edge_" + rnd ();
0 commit comments