summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/crud/service/BulkPayload.java41
-rw-r--r--src/main/java/org/onap/crud/service/CrudRestService.java7
2 files changed, 7 insertions, 41 deletions
diff --git a/src/main/java/org/onap/crud/service/BulkPayload.java b/src/main/java/org/onap/crud/service/BulkPayload.java
index 9b7b4cf..8dc99c4 100644
--- a/src/main/java/org/onap/crud/service/BulkPayload.java
+++ b/src/main/java/org/onap/crud/service/BulkPayload.java
@@ -22,16 +22,12 @@ package org.onap.crud.service;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
import org.onap.crud.exception.CrudException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import javax.ws.rs.core.Response.Status;
@@ -81,41 +77,4 @@ public class BulkPayload {
return "BulkPayload [objects=" + objects + ", relationships=" + relationships + "]";
}
- public static void main(String[] args) throws Exception {
- BulkPayload p = new BulkPayload();
- JsonObject root = new JsonObject();
- JsonArray vertices = new JsonArray();
- JsonObject v1 = new JsonObject();
- JsonObject v2 = new JsonObject();
- JsonObject prop = new JsonObject();
-
- prop.addProperty("p1", "value1");
- prop.addProperty("p2", "value2");
- v1.add("v1", prop);
- v2.add("v2", prop);
-
- vertices.add(v1);
- vertices.add(v2);
-
- root.add("objects", vertices);
-
- String s = "{\"objects\":[{\"v1\":{\"p1\":\"value1\",\"p2\":\"value2\"}},{\"v2\":{\"p1\":\"value1\",\"p2\":\"value2\"}}]}";
-
- p = BulkPayload.fromJson(s);
-
- List<JsonElement> po = p.getObjects();
- List<String> ids = new ArrayList<String>();
- for (JsonElement e : po) {
- Set<Map.Entry<String, JsonElement>> entries = e.getAsJsonObject().entrySet();
-
- for (Map.Entry<String, JsonElement> entry : entries) {
- ids.add(entry.getKey());
- }
- }
-
- System.out.println("root: " + root.toString());
- System.out.println("payload ids: " + ids.toString());
-
- }
-
} \ No newline at end of file
diff --git a/src/main/java/org/onap/crud/service/CrudRestService.java b/src/main/java/org/onap/crud/service/CrudRestService.java
index dbe9d68..2af205a 100644
--- a/src/main/java/org/onap/crud/service/CrudRestService.java
+++ b/src/main/java/org/onap/crud/service/CrudRestService.java
@@ -72,6 +72,13 @@ public class CrudRestService {
this.graphDataService = graphDataService;
this.auth = new Auth(CrudServiceConstants.CRD_AUTH_FILE);
}
+
+ // For unit testing
+ public CrudRestService(AbstractGraphDataService graphDataService, Auth auth) throws Exception {
+ this.graphDataService = graphDataService;
+ this.auth = auth;
+ }
+
public enum Action {
POST, GET, PUT, DELETE, PATCH