2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.crud.dao.champ;
24 import java.util.List;
28 import org.onap.aai.restclient.client.OperationResult;
29 import org.onap.crud.dao.GraphDao;
30 import org.onap.crud.entity.Edge;
31 import org.onap.crud.entity.Vertex;
32 import org.onap.crud.exception.CrudException;
34 public class ChampDaoTest implements GraphDao {
37 public Vertex getVertex(String id, String version) throws CrudException {
38 // TODO Auto-generated method stub
43 public OperationResult getVertex(String id, String type, String version, Map<String, String> queryParams)
44 throws CrudException {
45 OperationResult res = new OperationResult();
46 Vertex v = new Vertex.Builder("pserver").id("50bdab41-ad1c-4d00-952c-a0aa5d827811").property("hostname", "oldhost").build();
47 res.setResult(200, v.toJson().replace("\"id\"", "\"key\""));
52 public List<Edge> getVertexEdges(String id, Map<String, String> queryParams, String txId) throws CrudException {
53 // TODO Auto-generated method stub
58 public OperationResult getVertices(String type, Map<String, Object> filter, String version) throws CrudException {
59 // TODO Auto-generated method stub
64 public OperationResult getVertices(String type, Map<String, Object> filter, Set<String> properties, String version)
65 throws CrudException {
66 // TODO Auto-generated method stub
71 public OperationResult getEdge(String id, String type, Map<String, String> queryParams) throws CrudException {
72 // TODO Auto-generated method stub
77 public OperationResult getEdges(String type, Map<String, Object> filter) throws CrudException {
78 // TODO Auto-generated method stub
83 public OperationResult addVertex(String type, Map<String, Object> properties, String version) throws CrudException {
84 // TODO Auto-generated method stub
89 public OperationResult updateVertex(String id, String type, Map<String, Object> properties, String version)
90 throws CrudException {
91 // TODO Auto-generated method stub
96 public void deleteVertex(String id, String type) throws CrudException {
97 // TODO Auto-generated method stub
102 public OperationResult addEdge(String type, Vertex source, Vertex target, Map<String, Object> properties,
103 String version) throws CrudException {
104 // TODO Auto-generated method stub
109 public OperationResult updateEdge(Edge edge) throws CrudException {
110 // TODO Auto-generated method stub
115 public void deleteEdge(String id) throws CrudException {
116 // TODO Auto-generated method stub
121 public String openTransaction() {
122 // TODO Auto-generated method stub
127 public void commitTransaction(String id) throws CrudException {
128 // TODO Auto-generated method stub
133 public void rollbackTransaction(String id) throws CrudException {
134 // TODO Auto-generated method stub
139 public boolean transactionExists(String id) throws CrudException {
140 // TODO Auto-generated method stub
145 public Vertex addVertex(String type, Map<String, Object> properties, String version, String txId)
146 throws CrudException {
147 // TODO Auto-generated method stub
152 public Edge addEdge(String type, Vertex source, Vertex target, Map<String, Object> properties, String version,
153 String txId) throws CrudException {
154 // TODO Auto-generated method stub
159 public Vertex updateVertex(String id, String type, Map<String, Object> properties, String version, String txId)
160 throws CrudException {
161 // TODO Auto-generated method stub
166 public Edge updateEdge(Edge edge, String txId) throws CrudException {
167 // TODO Auto-generated method stub
172 public void deleteVertex(String id, String type, String txId) throws CrudException {
173 // TODO Auto-generated method stub
178 public void deleteEdge(String id, String txId) throws CrudException {
179 // TODO Auto-generated method stub
184 public Edge getEdge(String id, String txId) throws CrudException {
185 // TODO Auto-generated method stub
190 public Edge getEdge(String id) throws CrudException {
191 Edge edge = new Edge.Builder("tosca.relationships.HostedOn").id("xxx-yyy-zzz").source(new Vertex.Builder("vserver").id("50bdab41-ad1c-4d00-952c-a0aa5d827811").build())
192 .target(new Vertex.Builder("pserver").id("1d326bc7-b985-492b-9604-0d5d1f06f908").build()).build();
198 public OperationResult bulkOperation(ChampBulkPayload champPayload) throws CrudException {
199 // TODO Auto-generated method stub