2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 package org.onap.aai.serialization.queryformats;
24 import org.apache.tinkerpop.gremlin.structure.Graph;
25 import org.apache.tinkerpop.gremlin.structure.Vertex;
26 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
28 import static org.junit.Assert.assertEquals;
30 import com.google.gson.JsonArray;
31 import com.google.gson.JsonObject;
33 public class GraphSONTest {
38 //private JsonObject jsonObj = new JsonParser().parse("{\"id\":0,\"label\":\"vertex\",\"properties\":{\"name\":[{\"id\":1,\"value\":\"Sam\"}]}}").getAsJsonObject();
39 private JsonObject jsonObj = new JsonObject() ;
40 private JsonObject properties = new JsonObject();
41 private JsonArray name = new JsonArray() ;
42 private JsonObject idVal = new JsonObject() ;
47 jsonObj.addProperty("id", 0);
48 jsonObj.addProperty("label", "vertex");
50 idVal.addProperty("id", 1);
51 idVal.addProperty("value", "Sam");
54 properties.add("name",name);
55 jsonObj.add("properties", properties);
57 graph = TinkerGraph.open();
58 v1 = graph.addVertex("name", "Sam");
63 public void classGraphSONTestWithVertex(){
65 GraphSON graphSonObj1 = new GraphSON();
66 JsonObject obj = graphSonObj1.formatObject(v1);
68 assertEquals(jsonObj, obj);
72 public void parallelThresholdCehck(){
74 GraphSON graphSonObj2 = new GraphSON();
75 assertEquals(50, graphSonObj2.parallelThreshold());