diff options
author | rb7147 <rb7147@att.com> | 2018-02-16 13:46:06 -0500 |
---|---|---|
committer | rb7147 <rb7147@att.com> | 2018-02-16 13:49:06 -0500 |
commit | 9450c8d0102b9188933b5d26193df754a70a7157 (patch) | |
tree | 45123075abf9f8ccabe0b6d4805b202c3f234d9f /ONAP-REST/src/test | |
parent | 79343205a720ef656837275f973de93f1d26b3e9 (diff) |
Added Junis for Policy ONAP-REST
Cleaned the unused constructors.
Cleaned the unused code.
Added Junits for all JPAS.
Renamed the Junit class names on removing classes.
Issue-ID: POLICY-603
Change-Id: I0709ccecd7a2f3ec49367ff85f5a6d273479493e
Signed-off-by: rb7147 <rb7147@att.com>
Diffstat (limited to 'ONAP-REST/src/test')
14 files changed, 1206 insertions, 68 deletions
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java index 3de436481..419b14daa 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -20,68 +20,60 @@ package org.onap.policy.rest; -/*import java.io.IOException; -import java.io.InputStream; +import static org.junit.Assert.fail; + +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Properties; -import java.util.Random; import javax.servlet.ServletConfig; -import javax.servlet.ServletInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import junit.framework.TestCase; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletConfig; -import com.att.research.xacml.util.XACMLProperties; -import com.mockrunner.mock.web.MockServletInputStream; - -public class XACMLRestTest extends TestCase{ +public class XACMLRestTest extends Mockito{ private static Log logger = LogFactory.getLog(XACMLRestTest.class); - - private List<String> headers = new ArrayList<String>(); - + + private List<String> headers = new ArrayList<>(); + private HttpServletRequest httpServletRequest; private HttpServletResponse httpServletResponse; private ServletOutputStream mockOutput; - private ServletInputStream mockInput; private ServletConfig servletConfig; - - @Before - public void setUp(){ - httpServletRequest = Mockito.mock(HttpServletRequest.class); - Mockito.when(httpServletRequest.getMethod()).thenReturn("POST"); - Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers)); - Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers)); - - mockOutput = Mockito.mock(ServletOutputStream.class); - - httpServletResponse = Mockito.mock(MockHttpServletResponse.class); - - try { + + @Before + public void setUp(){ + httpServletRequest = Mockito.mock(HttpServletRequest.class); + Mockito.when(httpServletRequest.getMethod()).thenReturn("POST"); + Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers)); + Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers)); + + mockOutput = Mockito.mock(ServletOutputStream.class); + + httpServletResponse = Mockito.mock(MockHttpServletResponse.class); + + try { Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput); } catch (IOException e) { fail(); } - servletConfig = Mockito.mock(MockServletConfig.class); - Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); - //pdpServlet = new XACMLPdpServlet(); - - Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties"); - + servletConfig = Mockito.mock(MockServletConfig.class); + Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); + Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties"); + System.setProperty("xacml.properties", "xacml.pdp.properties"); System.setProperty("xacml.rest.pdp.config", "config_testing"); System.setProperty("xacml.rest.pep.idfile", "testclient.properties"); @@ -90,18 +82,19 @@ public class XACMLRestTest extends TestCase{ System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml"); System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml"); System.setProperty("xacml.rest.pdp.register", "false"); - } - - @Test - public void testDummy(){ + } + + @Test + public void testXacmlInit(){ logger.info("XACMLRestTest - testInit"); try { - assertTrue(true); + XACMLRest.xacmlInit(servletConfig); + Logger.getRootLogger().setLevel(Level.DEBUG); + XACMLRest.dumpRequest(httpServletRequest); + XACMLRest.loadXacmlProperties(null, null); } catch (Exception e) { fail(); - } } -} -*/
\ No newline at end of file +}
\ No newline at end of file diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java index af705967c..61f44bdbf 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJPATest.java @@ -30,9 +30,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class ActionDictionaryJPAClasses { +public class ActionDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(ActionDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -246,4 +246,48 @@ public class ActionDictionaryJPAClasses { data.setExpression("Test"); assertTrue("Test".equals(data.getExpression())); } + + @Test + public void testDatatype(){ + Datatype data = new Datatype(); + new Datatype(null); + new Datatype(1, new Datatype()); + data.setArguments(new HashSet<>()); + assertTrue(data.getArguments()!=null); + data.setAttributes(new HashSet<>()); + assertTrue(data.getAttributes()!=null); + data.setFunctions(new HashSet<>()); + assertTrue(data.getFunctions()!=null); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.addArgument(new FunctionArgument()); + data.addAttribute(new Attribute()); + data.addFunction(new FunctionDefinition()); + data.removeArgument(new FunctionArgument()); + data.removeAttribute(new Attribute()); + data.removeAttribute(new FunctionDefinition()); + assertTrue(data.getIdentifer()!=null); + assertTrue(data.getIdentiferByShortName()!=null); + data.setIsStandard(Datatype.STANDARD); + assertTrue(data.isStandard()); + data.setIsStandard(Datatype.CUSTOM); + assertTrue(data.isCustom()); + } + + @Test + public void testPolicyAlgorithms(){ + PolicyAlgorithms data = new PolicyAlgorithms(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setShortName("Test"); + assertTrue("Test".equals(data.getShortName())); + data.setXacmlId("Test"); + assertTrue("Test".equals(data.getXacmlId())); + data.setIsStandard(PolicyAlgorithms.STANDARD); + assertTrue(data.isStandard()); + } } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java index 1f09205fd..72c1b7dcd 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/BRMSDictionaryJPATest.java @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class BRMSDictionaryJPAClasses { +public class BRMSDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(BRMSDictionaryJPATest.class); private UserInfo userInfo; @Before diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java index 4fd1d0cbd..aa93aacd6 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class ClosedLoopPolicyDictionaryJPAClasses { +public class ClosedLoopPolicyDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -45,7 +45,6 @@ public class ClosedLoopPolicyDictionaryJPAClasses { @Test public void testVSCLAction(){ VSCLAction data = new VSCLAction(); - new VSCLAction("Test","Test"); data.preUpdate(); data.prePersist(); data.setId(1); @@ -67,7 +66,6 @@ public class ClosedLoopPolicyDictionaryJPAClasses { @Test public void testVNFType(){ VNFType data = new VNFType(); - new VNFType("Test","Test"); data.preUpdate(); data.prePersist(); data.setId(1); @@ -89,7 +87,6 @@ public class ClosedLoopPolicyDictionaryJPAClasses { @Test public void testPEPOptions(){ PEPOptions data = new PEPOptions(); - new PEPOptions("Test","Test"); data.preUpdate(); data.prePersist(); data.setId(1); @@ -111,7 +108,6 @@ public class ClosedLoopPolicyDictionaryJPAClasses { @Test public void testVarbindDictionary(){ VarbindDictionary data = new VarbindDictionary(); - new VarbindDictionary("Test","Test"); data.preUpdate(); data.prePersist(); data.setId(1); @@ -156,7 +152,6 @@ public class ClosedLoopPolicyDictionaryJPAClasses { @Test public void testClosedLoopSite(){ ClosedLoopSite data = new ClosedLoopSite(); - new ClosedLoopSite("Test","Test"); data.preUpdate(); data.prePersist(); data.setId(1); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java index eded9ed79..afe090503 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJPATest.java @@ -29,9 +29,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class CommonDictionaryJPAClasses { +public class CommonDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(CommonDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -94,7 +94,6 @@ public class CommonDictionaryJPAClasses { OnapName data = new OnapName(); data.preUpdate(); data.prePersist(); - new OnapName("Test", "Test"); data.setId(1); assertTrue(1 == data.getId()); data.setOnapName("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java index 3e7d23d90..0a221b0a2 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class DecisionDictionaryJPAClasses { +public class DecisionDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -49,8 +49,6 @@ public class DecisionDictionaryJPAClasses { assertTrue(1 == data.getId()); data.preUpdate(); data.prePersist(); - new DecisionSettings("Test"); - new DecisionSettings(new DecisionSettings("Test"), "Test"); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); data.setXacmlId("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java index fa4c03872..bec9fe042 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class FWDictionaryJPAClasses { +public class FWDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(FWDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -210,7 +210,6 @@ public class FWDictionaryJPAClasses { TermList data = new TermList(); data.preUpdate(); data.prePersist(); - new TermList("Test", "Test"); data.setId(1); assertTrue(1 == data.getId()); data.setTermName("Test"); diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java index 465d034bd..eba1c4003 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJPATest.java @@ -26,9 +26,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class MicroServiceDictionaryJPAClasses { +public class MicroServiceDictionaryJPATest { - private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class); private UserInfo userInfo; @Before @@ -180,4 +180,29 @@ public class MicroServiceDictionaryJPAClasses { data.setGroupList("Test"); assertTrue("Test".equals(data.getGroupList())); } + + @Test + public void testClosedLoops(){ + ClosedLoops data = new ClosedLoops(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setClosedLoopControlName("Test"); + assertTrue("Test".equals(data.getClosedLoopControlName())); + data.setAlarmConditions("Test"); + assertTrue("Test".equals(data.getAlarmConditions())); + data.setYaml("Test"); + assertTrue("Test".equals(data.getYaml())); + } + + @Test + public void testVMType(){ + VMType data = new VMType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + } + } diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java new file mode 100644 index 000000000..d114a18c1 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java @@ -0,0 +1,183 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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.onap.policy.rest.jpa; + +import static org.junit.Assert.*; + +import java.util.Date; +import java.util.HashSet; +import java.util.Properties; + +import org.junit.Test; + +import com.att.research.xacml.api.pip.PIPException; + +public class PIPJPATest { + + @Test + public void testPIPConfigParam(){ + PIPConfigParam data = new PIPConfigParam(); + new PIPConfigParam("test"); + new PIPConfigParam(new PIPConfigParam()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParamName("Test"); + assertTrue("Test".equals(data.getParamName())); + data.setParamValue("Test"); + assertTrue("Test".equals(data.getParamValue())); + data.setParamDefault("Test"); + assertTrue("Test".equals(data.getParamDefault())); + data.setPipconfiguration(new PIPConfiguration()); + assertTrue(data.getPipconfiguration()!=null); + data.setRequired(true); + assertTrue(data.isRequired()); + data.toString(); + } + + @Test + public void testPIPResolverParam(){ + PIPResolverParam data = new PIPResolverParam(); + new PIPResolverParam("test"); + new PIPResolverParam(new PIPResolverParam()); + data.setId(1); + assertTrue(1 == data.getId()); + data.setParamName("Test"); + assertTrue("Test".equals(data.getParamName())); + data.setParamValue("Test"); + assertTrue("Test".equals(data.getParamValue())); + data.setParamDefault("Test"); + assertTrue("Test".equals(data.getParamDefault())); + data.setPipresolver(new PIPResolver()); + assertTrue(data.getPipresolver()!=null); + data.setRequired(true); + assertTrue(data.isRequired()); + data.toString(); + } + + @Test + public void testPIPType(){ + PIPType data = new PIPType(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setPipconfigurations(new HashSet<>()); + assertTrue(data.getPipconfigurations()!=null); + data.addPipconfiguration(new PIPConfiguration()); + data.removePipconfiguration(new PIPConfiguration()); + data.setType("SQL"); + assertTrue(data.isSQL()); + data.setType("LDAP"); + assertTrue(data.isLDAP()); + data.setType("CSV"); + assertTrue(data.isCSV()); + data.setType("Hyper-CSV"); + assertTrue(data.isHyperCSV()); + data.setType("Custom"); + assertTrue(data.isCustom()); + } + + @Test + public void testPIPResolver(){ + PIPResolver data = new PIPResolver(); + new PIPResolver(new PIPResolver()); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setClassname("Test"); + assertTrue("Test".equals(data.getClassname())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setPipconfiguration(new PIPConfiguration()); + assertTrue(data.getPipconfiguration()!=null); + data.setPipresolverParams(new HashSet<>()); + assertTrue(data.getPipresolverParams()!=null); + data.addPipresolverParam(new PIPResolverParam()); + data.removePipresolverParam(new PIPResolverParam()); + data.clearParams(); + data.getConfiguration("test"); + data.setReadOnly(true); + assertTrue(data.isReadOnly()); + data.toString(); + Properties properties = new Properties(); + data.generateProperties(properties,"test"); + try { + data.readProperties("test", properties); + } catch (PIPException e) { + fail(); + } + } + + @Test + public void testPIPConfiguration(){ + PIPConfiguration data = new PIPConfiguration(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setIssuer("Test"); + assertTrue("Test".equals(data.getIssuer())); + data.setClassname("Test"); + assertTrue("Test".equals(data.getClassname())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + try { + data.readProperties("test", data.generateProperties("test")); + } catch (PIPException e) { + fail(); + } + data.setPiptype(new PIPType()); + assertTrue(data.getPiptype()!=null); + data.setPipresolvers(new HashSet<>()); + assertTrue(data.getPipresolvers()!=null); + data.addPipresolver(new PIPResolver()); + data.removePipresolver(new PIPResolver()); + data.getConfiguration("test"); + data.setReadOnly(true); + assertTrue(data.isReadOnly()); + data.setRequiresResolvers(true); + assertTrue(data.requiresResolvers()); + data.toString(); + } + +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPAClasses.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java index 96f107bfe..25ea391ca 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPAClasses.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java @@ -28,9 +28,9 @@ import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -public class PolicyEntityJPAClasses { +public class PolicyEntityJPATest { - private static Logger logger = FlexLogger.getLogger(PolicyEntityJPAClasses.class); + private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class); private UserInfo userInfo; @Before diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java new file mode 100644 index 000000000..934c27ba6 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java @@ -0,0 +1,190 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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.onap.policy.rest.jpa; + +import static org.junit.Assert.assertTrue; + +import java.util.Date; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.common.logging.flexlogger.FlexLogger; +import org.onap.policy.common.logging.flexlogger.Logger; + +public class PolicyUtilsJPATest { + + private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class); + private UserInfo userInfo; + + @Before + public void setUp() throws Exception { + logger.info("setUp: Entering"); + userInfo = new UserInfo(); + userInfo.setUserLoginId("Test"); + userInfo.setUserName("Test"); + logger.info("setUp: exit"); + } + + @Test + public void testWatchPolicyNotificationTable(){ + WatchPolicyNotificationTable data = new WatchPolicyNotificationTable(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setLoginIds("Test"); + assertTrue("Test".equals(data.getLoginIds())); + data.equals(data); + data.hashCode(); + } + + @Test + public void testPolicyRoles(){ + PolicyRoles data = new PolicyRoles(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScope("Test"); + assertTrue("Test".equals(data.getScope())); + data.setRole("Test"); + assertTrue("Test".equals(data.getRole())); + data.setLoginId(userInfo); + assertTrue("Test".equals(data.getLoginId().getUserLoginId())); + } + + @Test + public void testPolicyVersion(){ + PolicyVersion data = new PolicyVersion(); + new PolicyVersion("Test", "Test"); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setActiveVersion(1); + assertTrue(1 == data.getActiveVersion()); + data.setHigherVersion(1); + assertTrue(1 == data.getHigherVersion()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setCreatedBy("Test"); + assertTrue("Test".equals(data.getCreatedBy())); + data.setModifiedBy("Test"); + assertTrue("Test".equals(data.getModifiedBy())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.equals(data); + data.hashCode(); + } + + @Test + public void testSystemLogDB(){ + SystemLogDB data = new SystemLogDB(); + new SystemLogDB(1, "","","","",""); + data.setId(1); + assertTrue(1 == data.getId()); + data.setDescription("Test"); + assertTrue("Test".equals(data.getDescription())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setSystem("Test"); + assertTrue("Test".equals(data.getSystem())); + data.setRemote("Test"); + assertTrue("Test".equals(data.getRemote())); + data.setLogtype("Test"); + assertTrue("Test".equals(data.getLogtype())); + data.setDate(new Date()); + assertTrue(data.getDate()!=null); + } + + @Test + public void testRemoteCatalogValues(){ + RemoteCatalogValues data = new RemoteCatalogValues(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setValue("Test"); + assertTrue("Test".equals(data.getValue())); + } + + @Test + public void testPolicyScore(){ + PolicyScore data = new PolicyScore(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setPolicyName("Test"); + assertTrue("Test".equals(data.getPolicyName())); + data.setVersionExtension("Test"); + assertTrue("Test".equals(data.getVersionExtension())); + data.setPolicyScore("Test"); + assertTrue("Test".equals(data.getPolicyScore())); + } + + @Test + public void testPolicyEditorScopes(){ + PolicyEditorScopes data = new PolicyEditorScopes(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScopeName("Test"); + assertTrue("Test".equals(data.getScopeName())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testDescriptiveScope(){ + DescriptiveScope data = new DescriptiveScope(); + data.prePersist(); + data.preUpdate(); + data.setId(1); + assertTrue(1 == data.getId()); + data.setScopeName("Test"); + assertTrue("Test".equals(data.getScopeName())); + data.setSearch("Test"); + assertTrue("Test".equals(data.getSearch())); + data.setCreatedDate(new Date()); + assertTrue(data.getCreatedDate()!=null); + data.setModifiedDate(new Date()); + assertTrue(data.getModifiedDate()!=null); + data.setUserCreatedBy(userInfo); + assertTrue(data.getUserCreatedBy()!=null); + data.setUserModifiedBy(userInfo); + assertTrue(data.getUserModifiedBy()!=null); + } + + @Test + public void testGlobalRoleSettings(){ + GlobalRoleSettings data = new GlobalRoleSettings(); + new GlobalRoleSettings(true); + data.setRole("Test"); + assertTrue("Test".equals(data.getRole())); + data.setLockdown(true); + assertTrue(data.isLockdown()); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java new file mode 100644 index 000000000..85a11d4d5 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSAttributeObjectTest.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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.onap.policy.rest.util; + +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; + +import org.junit.Test; + +public class MSAttributeObjectTest { + + @Test + public void testMSAttributeObject(){ + MSAttributeObject data = new MSAttributeObject(); + data.setClassName("Test"); + assertTrue("Test".equals(data.getClassName())); + data.setRefAttribute(new HashMap<>()); + assertTrue(data.getRefAttribute()!=null); + data.setAttribute(new HashMap<>()); + assertTrue(data.getAttribute()!=null); + data.setEnumType(new HashMap<>()); + assertTrue(data.getEnumType()!=null); + data.addAttribute("test", "test"); + data.addRefAttribute("test", "test"); + data.addAllAttribute(new HashMap<>()); + data.addAllRefAttribute(new HashMap<>()); + data.setSubClass(new HashMap<>()); + assertTrue(data.getSubClass()!=null); + data.addAllSubClass(new HashMap<>()); + data.setDependency("Test"); + assertTrue("Test".equals(data.getDependency())); + data.addSingleEnum("test", "test"); + data.setMatchingSet(new HashMap<>()); + assertTrue(data.getMatchingSet()!=null); + data.addMatchingSet("test", "test"); + data.addMatchingSet(new HashMap<>()); + data.setPolicyTempalate(true); + assertTrue(data.isPolicyTempalate()); + } + + @Test + public void testMSAttributeValue(){ + MSAttributeValue data = new MSAttributeValue(); + data.setName("Test"); + assertTrue("Test".equals(data.getName())); + data.setType("Test"); + assertTrue("Test".equals(data.getType())); + data.setRequired(true); + assertTrue(data.getRequired()); + data.setArrayValue(true); + assertTrue(data.getArrayValue()); + data.setDefaultValue("Test"); + assertTrue("Test".equals(data.getDefaultValue())); + } +} diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java new file mode 100644 index 000000000..83a82f9cd --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/util/MSModelUtilsTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP-REST + * ================================================================================ + * Copyright (C) 2018 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.onap.policy.rest.util; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.junit.Test; +import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE; + +public class MSModelUtilsTest { + + @Test + public void testMSModelUtils(){ + HashMap<String, MSAttributeObject> classMap = new HashMap<>(); + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource("DKaTVESPolicy-v1802.xmi").getFile()); + MSModelUtils utils = new MSModelUtils("http://org.onap", "http://org.onap.policy"); + Map<String, MSAttributeObject> tempMap = utils.processEpackage(file.getAbsolutePath().toString(), MODEL_TYPE.XMI); + classMap.putAll(tempMap); + MSAttributeObject mainClass = classMap.get("StandardDeviationThreshold"); + String dependTemp = StringUtils.replaceEach(mainClass.getDependency(), new String[]{"[", "]", " "}, new String[]{"", "", ""}); + List<String> dependency = new ArrayList<String>(Arrays.asList(dependTemp.split(","))); + dependency = utils.getFullDependencyList(dependency, classMap); + String subAttribute = utils.createSubAttributes(dependency, classMap, "StandardDeviationThreshold"); + assertTrue(subAttribute != null); + } +} diff --git a/ONAP-REST/src/test/resources/DKaTVESPolicy-v1802.xmi b/ONAP-REST/src/test/resources/DKaTVESPolicy-v1802.xmi new file mode 100644 index 000000000..ac7e33926 --- /dev/null +++ b/ONAP-REST/src/test/resources/DKaTVESPolicy-v1802.xmi @@ -0,0 +1,587 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="service" nsURI="service.ControllerServiceDcaeDkatService.ControllerServiceDcaeDkatServiceInstance" + nsPrefix=""> + <eAnnotations source="http://org.onap/policy"> + <details key="policyTemplate" value="dcae-microservice"/> + <details key="matching" value="true"/> + <details key="dictionary" value="Dictionary Name"/> + </eAnnotations>ss + <eAnnotations source="http://www.eclipse.org/emf/2011/Xcore"> + <details key="ecomp" value="http://org.onap"/> + <details key="policy" value="http://org.onap/policy"/> + </eAnnotations> + <eClassifiers xsi:type="ecore:EClass" name="ControllerServiceDcaeDkatService"/> + <eClassifiers xsi:type="ecore:EClass" name="ControllerServiceDcaeDkatServiceInstance"/> + <eClassifiers xsi:type="ecore:EClass" name="ControllerServiceDcaeDkatServiceConfiguration"> + <eStructuralFeatures xsi:type="ecore:EReference" name="DkatVESPolicyBodies" eType="#//DkatVESPolicyBody"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="DkatVESPolicyBody"> + <eAnnotations source="http://org.onap/policy"> + <details key="policyTemplate" value="dcae-microservice"/> + </eAnnotations> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="serviceNetwork" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="serviceNetworkDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vnfType" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="vnfTypeDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vnfcType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral=""> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="vnfcTypeDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiClass" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="kpiClassDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiId" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiDescription" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="unitOfMeasure" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="unitOfMeasureDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="rounding" eType="#//roundingList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="filterText" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="pmSchemaName" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="pmSchemaNameDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="pmTableName" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="pmTableNameDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileNamePattern" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="dmdTopic" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileDenominator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="denominator" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileNumerator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiStatus" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="kpiStatusDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiInUse" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="calculateBy" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="calculateByDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="pkString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="hierarchyString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="functionCode" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="elementType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="elementName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="interfaceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="recordSource" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" + defaultValueLiteral="PolicyGUI"> + <eAnnotations source="http://org.onap"> + <details key="type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="StandardDeviationThresholds" + eType="#//StandardDeviationThreshold"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EReference" name="KpiThresholds" eType="#//KpiThreshold"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="numerator" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="displayStatus" eType="#//displayStatusList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiAggregation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="vendor" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="netId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="entityType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="customerId" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="kpiVersion" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="thresholdType" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="thresholdTypeDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="KpiThreshold"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="calculationInterval" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="calculationIntervalDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="direction" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + <eAnnotations source="http://org.onap/policy"> + <details key="dictionary" value="directionDictionary"/> + <details key="matching" value="true"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorWatermark" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalWatermark" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="setSuppressionPeriod" eType="#//setSuppressionPeriodList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="contSuppressionPeriod" + eType="#//contSuppressionPeriodList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="clearSuppressionPeriod" + eType="#//clearSuppressionPeriodList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="productionAlert" eType="#//productionAlertList"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="minNumerator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="minDenominator" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="highEmailNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="lowEmailNotification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="highQNotification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="lowQNotification" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="StandardDeviationThreshold"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdThresholdPlus" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdThresholdMinus" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdThresholdPlus" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdThresholdMinus" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sdNewWindowSize" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="sdInitialWindowSize" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdPlusEmailNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdPlusQNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdMinusEmailNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="criticalSdMinusQNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdPlusEmailNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdPlusQNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdMinusEmailNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="majorSdMinusQNotification" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"> + <eAnnotations source="http://org.onap"> + <details key="^type" value="configuration"/> + </eAnnotations> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="onapNameList"> + <eLiterals name="DCAE"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="policyStatusList"> + <eLiterals name="ACTIVE"/> + <eLiterals name="INACTIVE" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="serviceNetworkList"> + <eLiterals name="L3"/> + <eLiterals name="vUSP" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="vnfTypeList"> + <eLiterals name="JUNIPER-DBE"/> + <eLiterals name="VVIG" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="vnfcTypeList"> + <eLiterals name="dbc"/> + <eLiterals name="dbg" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="kpiClassList"> + <eLiterals name="accessability"/> + <eLiterals name="ect" value="1"/> + <eLiterals name="volume" value="3" literal=""/> + <eLiterals name="retainability" value="2"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="unitOfMeasureList"> + <eLiterals name="%"/> + <eLiterals name="bytes" value="1"/> + <eLiterals name="kbps" value="2"/> + <eLiterals name="ms" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="roundingList"> + <eLiterals name="0"/> + <eLiterals name="1" value="1" literal="1"/> + <eLiterals name="2" value="2" literal="2"/> + <eLiterals name="3" value="3" literal="3"/> + <eLiterals name="4" value="4" literal="4"/> + <eLiterals name="5" value="5" literal="5"/> + <eLiterals name="6" value="6" literal="6"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="pmSchemaNameList"> + <eLiterals name="JUNVDBE"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="pmTableNameList"> + <eLiterals name="ATTTUNNELSTAT"/> + <eLiterals name="CPUMEM_DC" value="1"/> + <eLiterals name="IFTABLE_DC" value="2"/> + <eLiterals name="UVP_DBE_NATPOOLSTATS" value="3"/> + <eLiterals name="UVP_DBE_NATPOOLUTILSTATS" value="4"/> + <eLiterals name="UVP_DBE_PERFSTATS" value="5"/> + <eLiterals name="UVP_DBE_SINGLEPORTSTATS" value="6"/> + <eLiterals name="DNR table (PID: 296120)" value="7"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="kpiStatusList"> + <eLiterals name="IN PROGRESS"/> + <eLiterals name="IN REVIEW" value="1"/> + <eLiterals name="Active" value="3"/> + <eLiterals name="Ready" value="4"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="calculateByList"> + <eLiterals name="Central"/> + <eLiterals name="Edge" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="directionList"> + <eLiterals name="ascending"/> + <eLiterals name="descending" value="1"/> + <eLiterals name="max" value="2"/> + <eLiterals name="min" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="setSuppressionPeriodList"> + <eLiterals name="0"/> + <eLiterals name="1" value="1" literal="1"/> + <eLiterals name="2" value="2" literal="2"/> + <eLiterals name="3" value="3" literal="3"/> + <eLiterals name="4" value="4" literal="4"/> + <eLiterals name="5" value="5" literal="5"/> + <eLiterals name="6" value="6" literal="6"/> + <eLiterals name="7" value="7" literal="7"/> + <eLiterals name="8" value="8" literal="8"/> + <eLiterals name="9" value="9" literal="9"/> + <eLiterals name="10" value="10" literal="10"/> + <eLiterals name="11" value="11" literal="11"/> + <eLiterals name="12" value="12" literal="12"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="contSuppressionPeriodList"> + <eLiterals name="0"/> + <eLiterals name="1" value="1" literal="1"/> + <eLiterals name="2" value="2" literal="2"/> + <eLiterals name="3" value="3" literal="3"/> + <eLiterals name="4" value="4" literal="4"/> + <eLiterals name="5" value="5" literal="5"/> + <eLiterals name="6" value="6" literal="6"/> + <eLiterals name="7" value="7" literal="7"/> + <eLiterals name="8" value="8" literal="8"/> + <eLiterals name="9" value="9" literal="9"/> + <eLiterals name="10" value="10" literal="10"/> + <eLiterals name="11" value="11" literal="11"/> + <eLiterals name="12" value="12" literal="12"/> + <eLiterals name="13" value="13" literal="13"/> + <eLiterals name="14" value="14" literal="14"/> + <eLiterals name="15" value="15" literal="15"/> + <eLiterals name="16" value="16" literal="16"/> + <eLiterals name="17" value="17" literal="17"/> + <eLiterals name="18" value="18" literal="18"/> + <eLiterals name="19" value="19" literal="19"/> + <eLiterals name="20" value="20" literal="20"/> + <eLiterals name="21" value="21" literal="21"/> + <eLiterals name="22" value="22" literal="22"/> + <eLiterals name="23" value="23" literal="23"/> + <eLiterals name="24" value="24" literal="24"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="clearSuppressionPeriodList"> + <eLiterals name="0"/> + <eLiterals name="1" value="1" literal="1"/> + <eLiterals name="2" value="2" literal="2"/> + <eLiterals name="3" value="3" literal="3"/> + <eLiterals name="4" value="4" literal="4"/> + <eLiterals name="5" value="5" literal="5"/> + <eLiterals name="6" value="6" literal="6"/> + <eLiterals name="7" value="7" literal="7"/> + <eLiterals name="8" value="8" literal="8"/> + <eLiterals name="9" value="9" literal="9"/> + <eLiterals name="10" value="10" literal="10"/> + <eLiterals name="11" value="11" literal="11"/> + <eLiterals name="12" value="12" literal="12"/> + <eLiterals name="13" value="13" literal="13"/> + <eLiterals name="14" value="14" literal="14"/> + <eLiterals name="15" value="15" literal="15"/> + <eLiterals name="16" value="16" literal="16"/> + <eLiterals name="17" value="17" literal="17"/> + <eLiterals name="18" value="18" literal="18"/> + <eLiterals name="19" value="19" literal="19"/> + <eLiterals name="20" value="20" literal="20"/> + <eLiterals name="21" value="21" literal="21"/> + <eLiterals name="22" value="22" literal="22"/> + <eLiterals name="23" value="23" literal="23"/> + <eLiterals name="24" value="24" literal="24"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="productionAlertList"> + <eLiterals name="Y"/> + <eLiterals name="N" value="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="displayStatusList"> + <eLiterals name="Y"/> + <eLiterals name="N" value="1"/> + </eClassifiers> +</ecore:EPackage> |