summaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java59
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java59
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java69
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java63
4 files changed, 244 insertions, 6 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
index 8f4f9aed..08f7fecd 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java
@@ -20,7 +20,62 @@
* ============LICENSE_END=========================================================
*/
-
package org.onap.policy.api.main.rest.provider;
-public class TestLegacyGuardPolicyProvider {}
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.Base64;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.main.parameters.ApiParameterGroup;
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class performs unit test of {@link LegacyGuardPolicyProvider}
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ */
+public class TestLegacyGuardPolicyProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestPolicyProvider.class);
+
+ private LegacyGuardPolicyProvider guardPolicyProvider;
+
+ /**
+ * Initialize parameters.
+ */
+ @Before
+ public void setupParameters() throws PfModelException {
+
+ PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
+ parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
+ parameters.setDatabaseUser("policy");
+ parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
+ parameters.setPersistenceUnit("ToscaConceptTest");
+ ApiParameterGroup paramGroup = new ApiParameterGroup("ApiGroup", null, parameters);
+ ParameterService.register(paramGroup, true);
+ guardPolicyProvider = new LegacyGuardPolicyProvider();
+ }
+
+ @Test
+ public void testFetchGuardPolicy() {
+
+ }
+
+ @Test
+ public void testCreateGuardPolicy() {
+
+ }
+
+ @Test
+ public void testDeleteGuardPolicy() {
+
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
index de12fca0..86124c74 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
@@ -20,7 +20,62 @@
* ============LICENSE_END=========================================================
*/
-
package org.onap.policy.api.main.rest.provider;
-public class TestLegacyOperationalPolicyProvider {}
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.Base64;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.main.parameters.ApiParameterGroup;
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class performs unit test of {@link LegacyOperationalPolicyProvider}
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ */
+public class TestLegacyOperationalPolicyProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestPolicyProvider.class);
+
+ private LegacyOperationalPolicyProvider operationalPolicyProvider;
+
+ /**
+ * Initialize parameters.
+ */
+ @Before
+ public void setupParameters() throws PfModelException {
+
+ PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
+ parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
+ parameters.setDatabaseUser("policy");
+ parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
+ parameters.setPersistenceUnit("ToscaConceptTest");
+ ApiParameterGroup paramGroup = new ApiParameterGroup("ApiGroup", null, parameters);
+ ParameterService.register(paramGroup, true);
+ operationalPolicyProvider = new LegacyOperationalPolicyProvider();
+ }
+
+ @Test
+ public void testFetchOperationalPolicy() {
+
+ }
+
+ @Test
+ public void testCreateOperationalPolicy() {
+
+ }
+
+ @Test
+ public void testDeleteOperationalPolicy() {
+
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
index 11d7e404..eeb4dbae 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java
@@ -22,4 +22,71 @@
package org.onap.policy.api.main.rest.provider;
-public class TestPolicyProvider {}
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.Base64;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.main.parameters.ApiParameterGroup;
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class performs unit test of {@link PolicyProvider}
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ */
+public class TestPolicyProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestPolicyProvider.class);
+
+ private PolicyProvider policyProvider;
+
+ /**
+ * Initialize parameters.
+ */
+ @Before
+ public void setupParameters() throws PfModelException {
+
+ PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
+ parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
+ parameters.setDatabaseUser("policy");
+ parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
+ parameters.setPersistenceUnit("ToscaConceptTest");
+ ApiParameterGroup paramGroup = new ApiParameterGroup("ApiGroup", null, parameters);
+ ParameterService.register(paramGroup, true);
+ policyProvider = new PolicyProvider();
+ System.out.println("xxxx");
+ }
+
+ @Test
+ public void testFetchPolicies() {
+
+ }
+
+ @Test
+ public void testFetchLatestPolicies() {
+
+ }
+
+ @Test
+ public void testFetchDeployedPolicies() {
+
+ }
+
+ @Test
+ public void testCreatePolicy() {
+
+ }
+
+ @Test
+ public void testDeletePolicy() {
+
+ }
+}
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
index d60dc2e5..4c3f23b3 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java
@@ -22,4 +22,65 @@
package org.onap.policy.api.main.rest.provider;
-public class TestPolicyTypeProvider {}
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.Base64;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.api.main.parameters.ApiParameterGroup;
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class performs unit test of {@link PolicyTypeProvider}
+ *
+ * @author Chenfei Gao (cgao@research.att.com)
+ */
+public class TestPolicyTypeProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestPolicyTypeProvider.class);
+
+ private PolicyTypeProvider policyTypeProvider;
+
+ /**
+ * Initialize parameters.
+ */
+ @Before
+ public void setupParameters() throws PfModelException {
+
+ PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
+ parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
+ parameters.setDatabaseUser("policy");
+ parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
+ parameters.setPersistenceUnit("ToscaConceptTest");
+ ApiParameterGroup paramGroup = new ApiParameterGroup("ApiGroup", null, parameters);
+ ParameterService.register(paramGroup, true);
+ policyTypeProvider = new PolicyTypeProvider();
+ }
+
+ @Test
+ public void testFetchPolicyTypes() {
+
+ }
+
+ @Test
+ public void testFetchLatestPolicyTypes() {
+
+ }
+
+ @Test
+ public void testCreatePolicyType() {
+
+ }
+
+ @Test
+ public void testDeletePolicyType() {
+
+ }
+}