diff options
Diffstat (limited to 'aai-core/src')
-rw-r--r-- | aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json | 59 | ||||
-rw-r--r-- | aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java (renamed from aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java) | 3 | ||||
-rw-r--r-- | aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java (renamed from aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java) | 2 | ||||
-rw-r--r-- | aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java | 82 |
4 files changed, 142 insertions, 4 deletions
diff --git a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json index 8653420f..d98c6a0b 100644 --- a/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json +++ b/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json @@ -1,6 +1,50 @@ { "rules": [ { + "from": "configuration", + "to": "logical-link", + "label": "has", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "configuration", + "to": "metadatum", + "label": "owns", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "${direction}", + "delete-other-v": "NONE", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "configuration", + "to": "allotted-resource", + "label": "uses", + "direction": "OUT", + "multiplicity": "One2One", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { + "from": "service-instance", + "to": "configuration", + "label": "has", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { "from": "availability-zone", "to": "complex", "label": "groupsResourcesIn", @@ -1026,7 +1070,7 @@ { "from": "platform", "to": "generic-vnf", - "label": "Uses", + "label": "uses", "direction": "OUT", "multiplicity": "Many2Many", "contains-other-v": "NONE", @@ -1661,7 +1705,18 @@ "SVC-INFRA": "NONE", "prevent-delete": "NONE" }, - { + { + "from": "generic-vnf", + "to": "configuration", + "label": "uses", + "direction": "OUT", + "multiplicity": "One2Many", + "contains-other-v": "NONE", + "delete-other-v": "${direction}", + "SVC-INFRA": "NONE", + "prevent-delete": "NONE" + }, + { "from": "vf-module", "to": "volume-group", "label": "uses", diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java index f5b67233..b4705030 100644 --- a/aai-core/src/test/java/org/openecomp/aai/util/CNNameTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/logging/CNNameTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.aai.util; +package org.openecomp.aai.logging; import ch.qos.logback.access.spi.IAccessEvent; import org.junit.Before; @@ -26,6 +26,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.openecomp.aai.logging.CNName; import org.openecomp.aai.serialization.queryformats.QueryFormatTestHelper; +import org.openecomp.aai.util.AAIConstants; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.agent.PowerMockAgent; diff --git a/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java index 31a7b5e4..3e79646b 100644 --- a/aai-core/src/test/java/org/openecomp/aai/util/CustomLogPatternLayoutTest.java +++ b/aai-core/src/test/java/org/openecomp/aai/logging/CustomLogPatternLayoutTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.aai.util; +package org.openecomp.aai.logging; import org.junit.Test; import org.openecomp.aai.logging.CNName; diff --git a/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java b/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java new file mode 100644 index 00000000..b20f1328 --- /dev/null +++ b/aai-core/src/test/java/org/openecomp/aai/logging/DME2RestFlagTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * org.openecomp.aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.aai.logging; +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; +import ch.qos.logback.access.spi.IAccessEvent; +import org.junit.*; + + +public class DME2RestFlagTest { + + IAccessEvent mockAccEvent; + DME2RestFlag _DME2RestFlag; + + String[] temp = new String[4]; + + + @Before + public void setUp() throws Exception { + + mockAccEvent = mock(IAccessEvent.class); + _DME2RestFlag= spy(DME2RestFlag.class); + + } + private DME2RestFlag getTestObj(final boolean instanceStarted){ + return new DME2RestFlag(){ + @Override + public + boolean isStarted(){ + return instanceStarted; + } + }; + } + + @Test + public void convertTestAllValid(){ + temp[0]= "temp1"; + temp[1] = "-"; + when(mockAccEvent.getRequestParameter("envContext")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("routeOffer")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("version")).thenReturn(temp); + _DME2RestFlag = getTestObj(true); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"DME2"); + } + + @Test + public void convertMissingRouteTest(){ + temp[0]= ""; + temp[1] = "-"; + when(mockAccEvent.getRequestParameter("envContext")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("routeOffer")).thenReturn(temp); + when(mockAccEvent.getRequestParameter("version")).thenReturn(temp); + _DME2RestFlag = getTestObj(true); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"REST"); + } + + @Test + public void convertIsStartedFalseTest(){ + _DME2RestFlag = getTestObj(false); + assertEquals(_DME2RestFlag.convert(mockAccEvent),"INACTIVE_HEADER_CONV"); + } + + +} |