diff options
Diffstat (limited to 'ONAP-PDP-REST/src/test')
7 files changed, 476 insertions, 23 deletions
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java index 3e3f584a9..594b51c06 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java @@ -27,6 +27,10 @@ import java.util.List; import java.util.Properties; import java.util.Random; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; import javax.servlet.ServletConfig; import javax.servlet.ServletInputStream; import javax.servlet.ServletOutputStream; @@ -34,16 +38,18 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.junit.Before; -import org.junit.runner.RunWith; +import org.junit.Test; import org.mockito.Mockito; +import org.onap.policy.common.ia.DbDAO; +import org.onap.policy.common.ia.IntegrityAuditProperties; import org.onap.policy.common.im.AdministrativeStateException; import org.onap.policy.common.im.IntegrityMonitor; import org.onap.policy.common.im.StandbyStatusException; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; + +import org.onap.policy.pdp.rest.XACMLPdpServletTest; import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletConfig; @@ -51,8 +57,6 @@ import com.mockrunner.mock.web.MockServletInputStream; import junit.framework.TestCase; -@RunWith(PowerMockRunner.class) -@PrepareForTest(IntegrityMonitor.class) // so PowerMock can mock static method of IntegrityMonitor public class XACMLPdpServletTest extends TestCase{ private static Logger LOGGER = FlexLogger.getLogger(XACMLPdpServletTest.class); @@ -65,16 +69,64 @@ public class XACMLPdpServletTest extends TestCase{ private ServletConfig servletConfig; private XACMLPdpServlet pdpServlet; private IntegrityMonitor im; - + + private DbDAO dbDAO; + private String persistenceUnit; + private Properties properties; + private String resourceName; + private String dbDriver; + private String dbUrl; + private String dbUser; + private String dbPwd; + private String siteName; + private String nodeType; + private static final String DEFAULT_DB_DRIVER = "org.h2.Driver"; + private static final String DEFAULT_DB_USER = "sa"; + private static final String DEFAULT_DB_PWD = ""; @Before public void setUp(){ + + properties = new Properties(); + properties.put(IntegrityAuditProperties.DB_DRIVER, XACMLPdpServletTest.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, "jdbc:h2:file:./sql/xacmlTest"); + properties.put(IntegrityAuditProperties.DB_USER, XACMLPdpServletTest.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, XACMLPdpServletTest.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); + properties.put(IntegrityAuditProperties.NODE_TYPE, "pap"); + //properties.put("com.sun.management.jmxremote.port", "9999"); + dbDriver = XACMLPdpServletTest.DEFAULT_DB_DRIVER; + dbUrl = "jdbc:h2:file:./sql/xacmlTest"; + dbUser = XACMLPdpServletTest.DEFAULT_DB_USER; + dbPwd = XACMLPdpServletTest.DEFAULT_DB_PWD; + siteName = "SiteA"; + nodeType = "pdp"; + persistenceUnit = "testPdpPU"; + resourceName = "siteA.pdp1"; + + System.setProperty("com.sun.management.jmxremote.port", "9999"); + + EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit, properties); + + EntityManager em = emf.createEntityManager(); + // Start a transaction + EntityTransaction et = em.getTransaction(); + + IntegrityMonitor im = null; + try { + im = IntegrityMonitor.getInstance(resourceName, properties); + } catch (Exception e2) { + // TODO Auto-generated catch block + e2.printStackTrace(); + } + //cleanDb(persistenceUnit, properties); + 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)); - + Mockito.when(httpServletRequest.getRequestURI()).thenReturn("/pdp/test"); mockOutput = Mockito.mock(ServletOutputStream.class); @@ -90,15 +142,17 @@ public class XACMLPdpServletTest extends TestCase{ //servletConfig Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); pdpServlet = new XACMLPdpServlet(); + pdpServlet.setIm(im); - Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties"); + Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("src/test/resources/xacml.pdp.properties"); - System.setProperty("xacml.properties", "xacml.pdp.properties"); - System.setProperty("xacml.rest.pdp.config", "config_testing"); - System.setProperty("xacml.rest.pdp.webapps", "/webapps"); - System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml"); + System.setProperty("xacml.properties", "src/test/resources/xacml.pdp.properties"); + System.setProperty("xacml.rest.pdp.config", "src/test/resources/config_testing"); + System.setProperty("xacml.rest.pdp.webapps", "src/test/resources/webapps"); + /*System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml"); 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"); System.setProperty("com.sun.management.jmxremote.port", "9999"); @@ -119,8 +173,9 @@ public class XACMLPdpServletTest extends TestCase{ } Mockito.doNothing().when(im).endTransaction(); } - - public void testInit(){ + + @Test + public void testInit(){ LOGGER.info("XACMLPdpServletTest - testInit"); try { pdpServlet.init(servletConfig); @@ -133,12 +188,14 @@ public class XACMLPdpServletTest extends TestCase{ } + @Test public void testDoGetNoTypeError(){ LOGGER.info("XACMLPdpServletTest - testDoGetNoTypeError"); try{ + pdpServlet.init(servletConfig); pdpServlet.doGet(httpServletRequest, httpServletResponse); - Mockito.verify(httpServletResponse).sendError(HttpServletResponse.SC_BAD_REQUEST, "type not 'config' or 'hb'"); + Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK); assertTrue(true); }catch(Exception e){ System.out.println("Unexpected exception in testDoGetNoTypeError"); @@ -147,6 +204,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoGetConfigType(){ LOGGER.info("XACMLPdpServletTest - testDoGetConfigType"); Mockito.when(httpServletRequest.getParameter("type")).thenReturn("config"); @@ -164,14 +222,14 @@ public class XACMLPdpServletTest extends TestCase{ } - + @Test public void testDoGetTypeHb(){ LOGGER.info("XACMLPdpServletTest - testDoGetTypeHb"); try{ Mockito.when(httpServletRequest.getParameter("type")).thenReturn("hb"); pdpServlet.init(servletConfig); pdpServlet.doGet(httpServletRequest, httpServletResponse); - Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_NO_CONTENT); + Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK); assertTrue(true); }catch(Exception e){ System.out.println("Unexpected exception in testDoGetTypeHb"); @@ -179,6 +237,8 @@ public class XACMLPdpServletTest extends TestCase{ fail(); } } + + @Test public void testDoGetTypeStatus(){ LOGGER.info("XACMLPdpServletTest - testDoGetTypeStatus"); try{ @@ -194,6 +254,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPost(){ LOGGER.info("XACMLPdpServletTest - testDoPost"); try{ @@ -207,6 +268,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPostToLong(){ LOGGER.info("XACMLPdpServletTest - testDoPostToLong"); try{ @@ -223,6 +285,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPostContentLengthNegative(){ LOGGER.info("XACMLPdpServletTest - testDoPostToLong"); try{ @@ -239,6 +302,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPostContentTypeNonValid(){ LOGGER.info("XACMLPdpServletTest - testDoPostToLong"); try{ @@ -255,6 +319,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPostContentTypeConfigurationError(){ LOGGER.info("XACMLPdpServletTest - testDoPostToLong"); try{ @@ -271,6 +336,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPutCacheEmpty(){ LOGGER.info("XACMLPdpServletTest - testDoPutCacheEmpty"); mockInput = Mockito.mock(ServletInputStream.class); @@ -290,6 +356,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPutConfigPolicies(){ LOGGER.info("XACMLPdpServletTest - testDoPutConfigPolicies"); byte[] b = new byte[20]; @@ -330,6 +397,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDoPutInvalidContentType(){ LOGGER.info("XACMLPdpServletTest - testDoPutToLong"); try{ @@ -349,6 +417,7 @@ public class XACMLPdpServletTest extends TestCase{ } } + @Test public void testDestroy(){ LOGGER.info("XACMLPdpServletTest - testDestroy"); diff --git a/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl b/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl new file mode 100644 index 000000000..f7138ad52 --- /dev/null +++ b/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS ConfigurationDataEntity +DROP TABLE IF EXISTS PolicyEntity +DROP TABLE IF EXISTS PolicyDBDaoEntity +DROP TABLE IF EXISTS ActionBodyEntity +DROP SEQUENCE IF EXISTS seqPolicy +DROP SEQUENCE IF EXISTS seqConfig +DROP SEQUENCE IF EXISTS seqActBody diff --git a/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml new file mode 100644 index 000000000..b44841c9d --- /dev/null +++ b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP-PAP-REST + ================================================================================ + 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========================================================= + --> +<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> + <persistence-unit name="XACML-PAP-REST"> + <class>org.onap.policy.rest.jpa.PolicyEntity</class> + <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class> + <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class> + <class>org.onap.policy.rest.jpa.GroupEntity</class> + <class>org.onap.policy.rest.jpa.PdpEntity</class> + <class>org.onap.policy.rest.jpa.ActionBodyEntity</class> + <class>org.onap.policy.rest.jpa.DatabaseLockEntity</class> + <class>org.onap.policy.rest.jpa.PolicyVersion</class> + <class>org.onap.policy.rest.jpa.PolicyScore</class> + <class>org.onap.policy.rest.jpa.FunctionDefinition</class> + <class>org.onap.policy.rest.jpa.Attribute</class> + <class>org.onap.policy.rest.jpa.Category</class> + <class>org.onap.policy.rest.jpa.ConstraintType</class> + <class>org.onap.policy.rest.jpa.ConstraintValue</class> + <class>org.onap.policy.rest.jpa.Datatype</class> + <class>org.onap.policy.rest.jpa.FunctionArgument</class> + <class>org.onap.policy.rest.jpa.UserInfo</class> + <class>org.onap.policy.rest.jpa.ActionPolicyDict</class> + <class>org.onap.policy.rest.jpa.DecisionSettings</class> + <class>org.onap.policy.rest.jpa.MicroServiceModels</class> + <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class> + <class>org.onap.policy.rest.jpa.PolicyEditorScopes</class> + <!-- unique to PolicyEngineUtils - will be audited from PAP --> + <class>org.onap.policy.jpa.BackUpMonitorEntity</class> + <!-- unique to integrity-monitor - will be audited from PAP --> + <class>org.onap.policy.common.im.jpa.StateManagementEntity</class> + <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class> + <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class> + <!-- unique to integrity-audit - will be audited from PAP --> + <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class> + <exclude-unlisted-classes>false</exclude-unlisted-classes> + <shared-cache-mode>NONE</shared-cache-mode> + <properties> + <!-- The properties defined below are the default settings to be used when someone initially + wants to start working with the XACML-PAP-ADMIN web gui. They are not intended for production + use. + + They are setup to drop and create the tables and then load an initial set of data into the database + every time the application is deployed. So if you add anything to the dictionaries or PIP + configuration, they will get lost upon each deployment. It uses an H2 database engine configured + for a local file so you don't have to setup you're own SQL database environment to start. + + Instead of modifying this file directly, please refer to the xacml.admin.properties file for + customizing the application settings. + + --> + <!-- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="javax.persistence.schema-generation.create-source" value="metadata-then-script"/> + <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/views.sql" /> + <property name="javax.persistence.schema-generation.drop-source" value="script"/> + <property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop.sql" /> + <property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql" />--> + + + + <!-- These properties should be set in the xacml.admin.properties file, so they can be re-used by non-JPA + database functionality. --> + <!-- + <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/> + <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:sql/xacml"/> + <property name="javax.persistence.jdbc.user" value="sa"/> + <property name="javax.persistence.jdbc.password" value=""/> + --> + </properties> + </persistence-unit> + +<persistence-unit name="auditPapPU"> + <!-- This is the persistence unit used by IntegrityAudit to determine + which classes to audit. All the PAP classes are also included in + XACML-PAP-ADMIN, so they will be audited there rather than having a + duplicate audit run from the XACL-PAP-REST node --> + <!-- unique to PolicyEngineUtils - will be audited from PAP --> + <class>org.onap.policy.jpa.BackUpMonitorEntity</class> + <!-- unique to integrity-monitor - will be audited from PAP --> + <class>org.onap.policy.common.im.jpa.StateManagementEntity</class> + <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class> + <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class> + <!-- unique to integrity-audit - will be audited from PAP --> + <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class> + <exclude-unlisted-classes>true</exclude-unlisted-classes> + <shared-cache-mode>NONE</shared-cache-mode> + </persistence-unit> + + <persistence-unit name="testPdpPU" transaction-type="RESOURCE_LOCAL"> + <!-- This tests all the classes that will be audited in the XACML-PAP-REST and the XACML-PAP_ADMIN --> + <!-- XACML-PAP-REST --> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + <class>org.onap.policy.rest.jpa.PolicyEntity</class> + <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class> + <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class> + <class>org.onap.policy.rest.jpa.GroupEntity</class> + <class>org.onap.policy.rest.jpa.PdpEntity</class> + <class>org.onap.policy.rest.jpa.ActionBodyEntity</class> + <class>org.onap.policy.rest.jpa.DatabaseLockEntity</class> + <class>org.onap.policy.rest.jpa.PolicyVersion</class> + <class>org.onap.policy.rest.jpa.PolicyScore</class> + <class>org.onap.policy.rest.jpa.FunctionDefinition</class> + <class>org.onap.policy.rest.jpa.Attribute</class> + <class>org.onap.policy.rest.jpa.Category</class> + <class>org.onap.policy.rest.jpa.ConstraintType</class> + <class>org.onap.policy.rest.jpa.ConstraintValue</class> + <class>org.onap.policy.rest.jpa.Datatype</class> + <class>org.onap.policy.rest.jpa.FunctionArgument</class> + <class>org.onap.policy.rest.jpa.UserInfo</class> + <class>org.onap.policy.rest.jpa.ActionPolicyDict</class> + <class>org.onap.policy.rest.jpa.DecisionSettings</class> + <class>org.onap.policy.rest.jpa.MicroServiceModels</class> + <!-- unique to XACML-PAP-ADMIN --> + <class>org.onap.policy.rest.jpa.ActionList</class> + <class>org.onap.policy.rest.jpa.AddressGroup</class> + <class>org.onap.policy.rest.jpa.AttributeAssignment</class> + <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class> + <class>org.onap.policy.rest.jpa.ClosedLoopD2Services</class> + <class>org.onap.policy.rest.jpa.ClosedLoopSite</class> + <class>org.onap.policy.rest.jpa.DCAEUsers</class> + <class>org.onap.policy.rest.jpa.DCAEuuid</class> + <class>org.onap.policy.rest.jpa.DescriptiveScope</class> + <class>org.onap.policy.rest.jpa.OnapName</class> + <class>org.onap.policy.rest.jpa.EnforcingType</class> + <class>org.onap.policy.rest.jpa.GlobalRoleSettings</class> + <class>org.onap.policy.rest.jpa.GroupPolicyScopeList</class> + <class>org.onap.policy.rest.jpa.GroupServiceList</class> + <class>org.onap.policy.rest.jpa.MicroServiceConfigName</class> + <class>org.onap.policy.rest.jpa.MicroServiceLocation</class> + <class>org.onap.policy.rest.jpa.Obadvice</class> + <class>org.onap.policy.rest.jpa.ObadviceExpression</class> + <class>org.onap.policy.rest.jpa.PEPOptions</class> + <class>org.onap.policy.rest.jpa.PIPConfigParam</class> + <class>org.onap.policy.rest.jpa.PIPConfiguration</class> + <class>org.onap.policy.rest.jpa.PIPResolver</class> + <class>org.onap.policy.rest.jpa.PIPResolverParam</class> + <class>org.onap.policy.rest.jpa.PIPType</class> + <class>org.onap.policy.rest.jpa.PolicyAlgorithms</class> + <class>org.onap.policy.rest.jpa.PolicyManagement</class> + <class>org.onap.policy.rest.jpa.PolicyScopeService</class> + <class>org.onap.policy.rest.jpa.PolicyScopeType</class> + <class>org.onap.policy.rest.jpa.PolicyScopeResource</class> + <class>org.onap.policy.rest.jpa.PolicyScopeClosedLoop</class> + <class>org.onap.policy.rest.jpa.PortList</class> + <class>org.onap.policy.rest.jpa.PREFIXLIST</class> + <class>org.onap.policy.rest.jpa.ProtocolList</class> + <class>org.onap.policy.rest.jpa.RemoteCatalogValues</class> + <class>org.onap.policy.rest.jpa.PolicyRoles</class> + <class>org.onap.policy.rest.jpa.RuleAlgorithms</class> + <class>org.onap.policy.rest.jpa.SecurityZone</class> + <class>org.onap.policy.rest.jpa.ServiceList</class> + <class>org.onap.policy.rest.jpa.SystemLogDB</class> + <class>org.onap.policy.rest.jpa.TermList</class> + <class>org.onap.policy.rest.jpa.VarbindDictionary</class> + <class>org.onap.policy.rest.jpa.VMType</class> + <class>org.onap.policy.rest.jpa.VNFType</class> + <class>org.onap.policy.rest.jpa.VSCLAction</class> + <class>org.onap.policy.rest.jpa.Zone</class> + <!-- unique to PolicyEngineUtils --> + <class>org.onap.policy.jpa.BackUpMonitorEntity</class> + <!-- unique to integrity-monitor --> + <class>org.onap.policy.common.im.jpa.StateManagementEntity</class> + <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class> + <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class> + <!-- unique to integrity-audit --> + <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class> + + <exclude-unlisted-classes>false</exclude-unlisted-classes> + <shared-cache-mode>NONE</shared-cache-mode> + <properties> + <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/> + <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:./sql/xacmlTest"/> <!-- ;MODE=MySQL"/> --> + <property name="javax.persistence.jdbc.user" value="sa"/> + <property name="javax.persistence.jdbc.password" value=""/> + <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/> + <property name="javax.persistence.schema-generation.scripts.create-target" value="./src/test/resources/generatedCreate.ddl"/> + <property name="javax.persistence.schema-generation.scripts.drop-target" value="./src/test/resources/generatedDrop.ddl"/> + <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> + <property name="javax.persistence.schema-generation.create-source" value="metadata-then-script"/> + <property name="javax.persistence.schema-generation.drop-source" value="script"/> + <property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop.ddl" /> + </properties> + </persistence-unit> +</persistence> diff --git a/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties index a16b422bf..fdc7798b4 100644 --- a/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties +++ b/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties @@ -122,8 +122,8 @@ xacml.rest.notification.delay=30 REQUEST_BUFFER_SIZE=15 #properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs -javax.persistence.jdbc.driver=com.mysql.jdbc.Driver -javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml +javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver +javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk javax.persistence.jdbc.user=policy_user javax.persistence.jdbc.password=policy_user diff --git a/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties index 9ca1bba9c..2a3600559 100644 --- a/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties +++ b/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties @@ -122,8 +122,8 @@ xacml.rest.notification.delay=30 REQUEST_BUFFER_SIZE=15 #properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs -javax.persistence.jdbc.driver=com.mysql.jdbc.Driver -javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml +javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver +javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk javax.persistence.jdbc.user=policy_user javax.persistence.jdbc.password=policy_user diff --git a/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties index c9a111012..c3eda591f 100644 --- a/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties +++ b/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties @@ -122,8 +122,8 @@ xacml.rest.notification.delay=30 REQUEST_BUFFER_SIZE=15 #properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs -javax.persistence.jdbc.driver=com.mysql.jdbc.Driver -javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml +javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver +javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk javax.persistence.jdbc.user=policy_user javax.persistence.jdbc.password=policy_user diff --git a/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties new file mode 100644 index 000000000..bb174b9fd --- /dev/null +++ b/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties @@ -0,0 +1,176 @@ +### +# ============LICENSE_START======================================================= +# ONAP-PDP-REST +# ================================================================================ +# 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========================================================= +### + +# Default XACML Properties File for PDP RESTful servlet +# +# Standard API Factories +# +xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory +xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory +xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory +# NOT USED SEE BELOW xacml.pipFinderFactory=org.onap.policy.xacml.std.pip.StdPIPFinderFactory +xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory +# +# AT&T PDP Implementation Factories +# +xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory +xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory +xacml.att.functionDefinitionFactory=org.onap.policy.xacml.custom.OnapFunctionDefinitionFactory +# NOT USED SEE BELOW xacml.att.policyFinderFactory=org.onap.policy.pdp.std.StdPolicyFinderFactory +# creteUpdate Policy Implementation Class details. +createUpdatePolicy.impl.className=org.onap.policy.pdp.rest.api.services.CreateUpdatePolicyServiceImpl +# AAF Implementation class details +aafClient.impl.className=org.onap.policy.utils.AAFPolicyClientImpl +# +# AT&T RESTful PDP Implementation Factories +# +xacml.pipFinderFactory=org.onap.policy.pdp.rest.impl.XACMLPdpPIPFinderFactory +xacml.att.policyFinderFactory=org.onap.policy.pdp.rest.XACMLPdpPolicyFinderFactory +# +# When set to true, this flag tells the StdPolicyFinderFactory to combined all the root policy files into +# into one PolicySet and use the given Policy Algorithm. +# +xacml.att.policyFinderFactory.combineRootPolicies=urn:com:att:xacml:3.0:policy-combining-algorithm:combined-permit-overrides +# +# PDP RESTful API properties +# +# Set this to the address where the XACML-PAP-REST servlet is running +xacml.rest.pap.url=http://localhost:8070/pap/ + +#if multiple paps exist, the xacml.rest.pap.url can be removed and they can be defined like this: +#xacml.rest.pap.urls=http://localhost:9090/pap/,http://localhost:9091/pap/ + +# +# Give the running PDP an ID for the PAP. The url that its running as is a good choice. +# The PAP identifies PDP's using the URL of the PDP. +# +xacml.rest.pdp.id=http://localhost:8082/pdp/ + +# Give the port number used for the PDP + +xacml.jmx.port=0 + + +# Notification Properties +# Notifcation type: websocket, ueb or dmaap... if left blank websocket is the default +NOTIFICATION_TYPE=websocket +NOTIFICATION_SERVERS= +NOTIFICATION_TOPIC= +NOTIFICATION_DELAY= +UEB_API_KEY= +UEB_API_SECRET= +DMAAP_AAF_LOGIN= +DMAAP_AAF_PASSWORD= + +# +# Set the directory where the PDP holds its Policy Cache and PIP Configuration +# +xacml.rest.pdp.config=config + +xacml.rest.pdp.webapps=/home/users/PolicyEngine/webapps/ConfigPAP/ +# +# Initialize register with PAP servlet +# +xacml.rest.pdp.register=true +# +# Sleep period in seconds between register attempts +# +xacml.rest.pdp.register.sleep=15 +# +# number of attempts to register. -1 means keep trying forever. +# +xacml.rest.pdp.register.retries=-1 +# +# max number of bytes in a POST of a XML/JSON request +# old value #32767 +xacml.rest.pdp.maxcontent=99999999 +# +# Set UserID here +xacml.rest.pdp.userid=testpdp +# Set Password here +xacml.rest.pdp.password=alpha456 + +# id PAP +xacml.rest.pap.userid=testpap +#if multiple paps have different logins, they can be defined like this: +#http\://localhost\:9090/pap/.xacml.rest.pap.userid=testpap + +# pass PAP +xacml.rest.pap.password=alpha123 +#http\://localhost\:9090/pap/.xacml.rest.pap.password=alpha123 + +# Delay for Notifications Don't change this. Value in milliSec. +xacml.rest.notification.delay=30 + +# Client interval to ping notification service. +CLIENT_INTERVAL=15000 + +# Buffer Size. +REQUEST_BUFFER_SIZE=15 + +#Properties for db access +#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs +javax.persistence.jdbc.driver=org.h2.Driver +javax.persistence.jdbc.url=jdbc:h2:file:./sql/xacmlTest +javax.persistence.jdbc.user=sa +javax.persistence.jdbc.password= + +#***Properties for IntegrityMonitor integration defined in XACMLRestProperties.java*** + +#The name of the PDP. Must be unique across the system +xacml.rest.pdp.resource.name=site_1.pdp_1 + +#***Properties for IntegrityMonitor integration defined in IntegrityMonitorProperties.java*** + +#Interval between forward progress counter updates in seconds +fp_monitor_interval=30 + +#Number of forward progress counter failures before failover +failed_counter_threshold=3 + +#Interval in seconds between test transactions if there is no other traffic +test_trans_interval=10 + +#Interval in seconds between updates of the forward progress counter in the DB +write_fpc_interval=5 + +#Name of the site +site_name=site_1 + +#Node type +node_type=pdp_xacml + +#Dependency groups are groups of resources upon which a node operational state is dependent upon). +#Each group is a comma-separated list of resource names and groups are separated by a semicolon. +#A group may contain one or more members. Resource names must match the resource names defined +#in the respective servers' properties files +dependency_groups=site_1.pdplp_1;site_1.astragw_1;site_1.brmsgw_1 + +# this can be DEVL, TEST, PROD +ENVIRONMENT=DEVL +xacml.rest.pep.idfile = client.properties + +#AAF Policy Name space +#Not Mandatory for Open Onap +policy.aaf.namespace = +policy.aaf.resource = +# Decision Response settings. +# can be either PERMIT or DENY. +decision.indeterminate.response=PERMIT
\ No newline at end of file |