/*-
* ============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.
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;
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;
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();
//
// No need to do more than this
//
- params.setName("policyApiParameters");
+ params.setClientName("policyApiParameters");
//
// Load an example policy
//
// 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
//
// Now create the directory
//
Files.createDirectory(nonExistentPath);
- manager = new XacmlPdpApplicationManager(nonExistentPath, params);
+ manager = new XacmlPdpApplicationManager(xacmlApplicationParameters, params);
//
// Now it should have initialized the apps
//
@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);