X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=main%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdpx%2Fmain%2Frest%2FXacmlPdpApplicationManagerTest.java;h=4619b2aeda039623e5b841dcf122d867d3e2297c;hb=6803c3b370560217215be30514396f75be780a0f;hp=2a85579c0ec612bb84bca49c830f95eaca71d481;hpb=8529ee83afe9d356b4d0b8d08304fe3d2f9caf2b;p=policy%2Fxacml-pdp.git diff --git a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java index 2a85579c..4619b2ae 100644 --- a/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java +++ b/main/src/test/java/org/onap/policy/pdpx/main/rest/XacmlPdpApplicationManagerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2021 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. @@ -35,7 +35,7 @@ import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -44,6 +44,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException; +import org.onap.policy.pdpx.main.parameters.CommonTestData; +import org.onap.policy.pdpx.main.parameters.XacmlApplicationParameters; import org.onap.policy.xacml.pdp.application.guard.GuardPdpApplication; import org.onap.policy.xacml.pdp.application.nativ.NativePdpApplication; import org.onap.policy.xacml.pdp.application.optimization.OptimizationPdpApplication; @@ -53,9 +55,10 @@ import org.slf4j.LoggerFactory; public class XacmlPdpApplicationManagerTest { private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPdpApplicationManagerTest.class); private static final StandardYamlCoder yamlCoder = new StandardYamlCoder(); - private static final RestServerParameters params = new RestServerParameters(); + private static final BusTopicParams params = new BusTopicParams(); private static Path appsDirectory; private static ToscaServiceTemplate completedJtst; + private static CommonTestData testData = new CommonTestData(); @ClassRule public static final TemporaryFolder appsFolder = new TemporaryFolder(); @@ -70,7 +73,7 @@ public class XacmlPdpApplicationManagerTest { // // No need to do more than this // - params.setName("policyApiParameters"); + params.setClientName("policyApiParameters"); // // Load an example policy // @@ -113,10 +116,13 @@ public class XacmlPdpApplicationManagerTest { // Make up a non existent directory to initialize from // Path nonExistentPath = Paths.get(appsFolder.getRoot().getAbsolutePath(), "nonexistent"); + final XacmlApplicationParameters xacmlApplicationParameters = + testData.toObject(testData.getXacmlapplicationParametersMap(false, + nonExistentPath.toString()), XacmlApplicationParameters.class); // // Create our app manager // - XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(nonExistentPath, params); + XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); // // Still creates the manager, but the apps were not able to initialize // @@ -126,7 +132,7 @@ public class XacmlPdpApplicationManagerTest { // Now create the directory // Files.createDirectory(nonExistentPath); - manager = new XacmlPdpApplicationManager(nonExistentPath, params); + manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); // // Now it should have initialized the apps // @@ -136,16 +142,19 @@ public class XacmlPdpApplicationManagerTest { @Test public void testXacmlPdpApplicationManagerSimple() { - XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(appsDirectory, params); + final XacmlApplicationParameters xacmlApplicationParameters = + testData.toObject(testData.getXacmlapplicationParametersMap(false, + appsDirectory.toString()), XacmlApplicationParameters.class); + XacmlPdpApplicationManager manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params); // // Test the basics from the startup // assertThat(manager).isNotNull(); assertThat(manager.getPolicyCount()).isZero(); - assertThat(manager.getPolicyTypeCount()).isEqualTo(19); + assertThat(manager.getPolicyTypeCount()).isEqualTo(18); assertThat(manager.getToscaPolicies()).isEmpty(); assertThat(manager.getToscaPolicyIdentifiers()).isEmpty(); - assertThat(manager.getToscaPolicyTypeIdents()).hasSize(19); + assertThat(manager.getToscaPolicyTypeIdents()).hasSize(18); assertThat(manager.findNativeApplication()).isInstanceOf(NativePdpApplication.class);