diff options
author | 2019-01-30 14:04:35 +0000 | |
---|---|---|
committer | 2019-01-30 15:48:22 +0000 | |
commit | 0c40bcde9facc109ceb8dabb91156df2b4fb4129 (patch) | |
tree | af3b32aa18092c7ea6bb60005a6d503448a92297 /src/test/java/org/onap/crud | |
parent | df7904cca9c67ed7ce99e1d1d1c3a2c961a61445 (diff) |
Remove Multiplicity feature
The multiplicty feature is not working properly around relantionships
and demands more investigation in order to identify the issues.
In the future we might add this back.
For reference multiplicity was added under AAI-1197
Basically reversing the commit: d10a218c76633374f083f7a2802c198e93a6abae
Issue-ID: AAI-2124
Change-Id: I5d27b950841da08b00fbb422fb13136d43f0e3bd
Signed-off-by: Sanchez, Gabriel (gs882h) <gabriel.sanchez@amdocs.com>
Diffstat (limited to 'src/test/java/org/onap/crud')
5 files changed, 2 insertions, 134 deletions
diff --git a/src/test/java/org/onap/crud/parser/util/EdgePayloadUtilTest.java b/src/test/java/org/onap/crud/parser/util/EdgePayloadUtilTest.java deleted file mode 100644 index f5baae8..0000000 --- a/src/test/java/org/onap/crud/parser/util/EdgePayloadUtilTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.crud.parser.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.onap.crud.entity.Edge;
-import org.onap.crud.entity.Vertex;
-import org.onap.crud.exception.CrudException;
-
-public class EdgePayloadUtilTest {
-
- @Test
- public void testGetVertexNodeType() throws CrudException {
- Assert.assertEquals("vserver", EdgePayloadUtil
- .getVertexNodeType("services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811"));
- }
-
- @Test
- public void testGetVertexNodeId() throws CrudException {
- Assert.assertEquals("50bdab41-ad1c-4d00-952c-a0aa5d827811",
- EdgePayloadUtil.getVertexNodeId("services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811"));
- }
-
- @Test
- public void testGenerateEdgeKey() throws CrudException {
- Assert.assertEquals("vserver:pserver:tosca.relationships.HostedOn",
- EdgePayloadUtil.generateEdgeKey("services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811",
- "services/inventory/v12/pserver/1d326bc7-b985-492b-9604-0d5d1f06f908",
- "tosca.relationships.HostedOn"));
- }
-
- @Test
- public void testKeyGenerationEnforcesSourceAndTargetOrder() throws Exception {
- String generateEdgeKey1 = EdgePayloadUtil.generateEdgeKey(
- "services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811",
- "services/inventory/v12/pserver/1d326bc7-b985-492b-9604-0d5d1f06f908", "tosca.relationships.HostedOn");
-
- String generateEdgeKey2 = EdgePayloadUtil.generateEdgeKey(
- "services/inventory/v12/pserver/1d326bc7-b985-492b-9604-0d5d1f06f908",
- "services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811", "tosca.relationships.HostedOn");
-
- Assert.assertNotEquals(generateEdgeKey1, generateEdgeKey2);
- }
-
-
- @Test
- public void testGetBuilderFromEdgePayload() throws CrudException {
- Edge.Builder builder = EdgePayloadUtil.getBuilderFromEdgePayload(
- "services/inventory/v12/vserver/50bdab41-ad1c-4d00-952c-a0aa5d827811",
- "services/inventory/v12/pserver/1d326bc7-b985-492b-9604-0d5d1f06f908", "tosca.relationships.HostedOn");
-
- Edge edge = builder.build();
- Assert.assertEquals("tosca.relationships.HostedOn", edge.getType());
- Assert.assertEquals("vserver", edge.getSource().getType());
- Assert.assertEquals("50bdab41-ad1c-4d00-952c-a0aa5d827811", edge.getSource().getId().get());
- Assert.assertEquals("pserver", edge.getTarget().getType());
- Assert.assertEquals("1d326bc7-b985-492b-9604-0d5d1f06f908", edge.getTarget().getId().get());
- }
-
- @Test
- public void tesGetBuilderFromEdge() throws CrudException {
- Edge edge = createEdge("vserver", "pserver");
-
- Assert.assertNotNull(edge);
- Assert.assertNotNull(EdgePayloadUtil.getBuilderFromEdge(edge));
- }
-
- @Test
- public void testFilterEdgesByRelatedVertexAndType() throws CrudException {
- List<Edge> edges = new ArrayList<>();
- edges.add(createEdge("vserver", "pserver"));
- edges.add(createEdge("vce", "pserver"));
- edges.add(createEdge("snapshot", "pserver"));
- edges.add(createEdge("vserver", "pserver"));
-
- List<Edge> filteredEdges =
- EdgePayloadUtil.filterEdgesByRelatedVertexAndType("vserver", "tosca.relationships.HostedOn", edges);
-
- Assert.assertNotNull(filteredEdges);
- Assert.assertEquals(2, filteredEdges.size());
- }
-
- private Edge createEdge(String sourceVertexType, String targetVertexType) {
- return new Edge.Builder("tosca.relationships.HostedOn").id("test")
- .source(new Vertex.Builder(sourceVertexType).id("50bdab41-ad1c-4d00-952c-a0aa5d827811").build())
- .target(new Vertex.Builder(targetVertexType).id("1d326bc7-b985-492b-9604-0d5d1f06f908").build())
- .build();
- }
-}
diff --git a/src/test/java/org/onap/crud/service/BulkPayloadTest.java b/src/test/java/org/onap/crud/service/BulkPayloadTest.java index 7a409ec..938e668 100644 --- a/src/test/java/org/onap/crud/service/BulkPayloadTest.java +++ b/src/test/java/org/onap/crud/service/BulkPayloadTest.java @@ -29,7 +29,7 @@ import java.util.Set; import javax.ws.rs.core.Response.Status; import org.junit.Test; import org.onap.crud.exception.CrudException; -import org.onap.crud.parser.BulkPayload; + import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/src/test/java/org/onap/crud/service/CrudRestServiceTest.java b/src/test/java/org/onap/crud/service/CrudRestServiceTest.java index c2106ed..04340a6 100644 --- a/src/test/java/org/onap/crud/service/CrudRestServiceTest.java +++ b/src/test/java/org/onap/crud/service/CrudRestServiceTest.java @@ -160,27 +160,6 @@ public class CrudRestServiceTest extends OXMModelLoaderSetup{ } @Test - public void testAddEdgeMultiplicityRules() throws CrudException { - Response response; - - response = mockService.addEdge(postEdgePayload, "v10", "services/inventory/v10", - new TestHeaders(), null, new TestRequest()); - Assert.assertEquals("MANY2ONE multiplicity rule broken for Edge:vserver:pserver:tosca.relationships.HostedOn", - response.getEntity().toString()); - Assert.assertEquals(400, response.getStatus()); - - response = mockService.addEdge(postEdgePayload, "v9", "tosca.relationships.HostedOn", "services/inventory/v9", - new TestHeaders(), null, new TestRequest()); - Assert.assertEquals(201, response.getStatus()); - - response = mockService.addEdge(postEdgePayload, "v8", "tosca.relationships.HostedOn", "services/inventory/v8", - new TestHeaders(), null, new TestRequest()); - Assert.assertEquals("ONE2MANY multiplicity rule broken for Edge:vserver:pserver:tosca.relationships.HostedOn", - response.getEntity().toString()); - Assert.assertEquals(400, response.getStatus()); - } - - @Test public void testUpdateVertex() throws CrudException { Response response; diff --git a/src/test/java/org/onap/crud/service/VertexPayloadTest.java b/src/test/java/org/onap/crud/service/VertexPayloadTest.java index df0656f..ba67213 100644 --- a/src/test/java/org/onap/crud/service/VertexPayloadTest.java +++ b/src/test/java/org/onap/crud/service/VertexPayloadTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertThat; import javax.ws.rs.core.Response.Status; import org.junit.Test; import org.onap.crud.exception.CrudException; -import org.onap.crud.parser.VertexPayload; public class VertexPayloadTest { diff --git a/src/test/java/org/onap/crud/util/CrudServiceUtilTest.java b/src/test/java/org/onap/crud/util/CrudServiceUtilTest.java index 37cdeec..872586e 100644 --- a/src/test/java/org/onap/crud/util/CrudServiceUtilTest.java +++ b/src/test/java/org/onap/crud/util/CrudServiceUtilTest.java @@ -22,7 +22,7 @@ package org.onap.crud.util; import org.junit.Assert; import org.junit.Test; -import org.onap.crud.parser.VertexPayload; +import org.onap.crud.service.VertexPayload; import org.onap.crud.service.util.TestHeaders; import com.google.gson.JsonElement; |