diff options
author | Jim Hahn <jrh3@att.com> | 2021-01-07 09:07:05 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-01-08 16:12:22 -0500 |
commit | e926efbc4d5dde8ade1a5521f5be1294079df057 (patch) | |
tree | e00047d50e27dc24a146b9f4fa10486a98dd3c86 /models-provider/src/test/java | |
parent | e6bea18abd1a1b4ddf7203508832e6a3f9380598 (diff) |
Add PDP-Policy deployment table to DB
Added a table to record the PDP policy deployment status, which is
required for making PAP stateless.
Issue-ID: POLICY-2648
Change-Id: Ibe40ce00aca7a600051edcac49e55651c1c0164f
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-provider/src/test/java')
3 files changed, 27 insertions, 3 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java index 3e1767f8e..cace06224 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2021 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,8 @@ package org.onap.policy.models.provider.impl; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -423,6 +425,9 @@ public class DatabasePolicyModelsProviderTest { assertEquals(NAME, databaseProvider.deletePdpStatistics(NAME, null).get(0).getPdpInstanceId()); assertEquals(0, databaseProvider.getPdpStatistics(null, null).size()); + assertThat(databaseProvider.getGroupPolicyStatus(GROUP)).isEmpty(); + assertThatCode(() -> databaseProvider.cudPolicyStatus(null, null, null)).doesNotThrowAnyException(); + databaseProvider.close(); } diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java index 1158307b4..0a3acb019 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,6 +23,7 @@ package org.onap.policy.models.provider.impl; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.List; @@ -33,6 +34,7 @@ import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.pdp.concepts.Pdp; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpGroupFilter; +import org.onap.policy.models.pdp.concepts.PdpPolicyStatus; import org.onap.policy.models.pdp.concepts.PdpStatistics; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.provider.PolicyModelsProvider; @@ -230,6 +232,18 @@ public class DummyBadProviderImpl implements PolicyModelsProvider { } @Override + public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException { + // Not implemented + return null; + } + + @Override + public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs, + Collection<PdpPolicyStatus> deleteObjs) { + // Not implemented + } + + @Override public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException { // TODO Auto-generated method stub return null; diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java index 7fc37afe9..06c95ef64 100644 --- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java +++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,6 +22,8 @@ package org.onap.policy.models.provider.impl; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -111,6 +113,9 @@ public class DummyPolicyModelsProviderTest { assertTrue(dummyProvider.createPdpStatistics(null).isEmpty()); assertTrue(dummyProvider.updatePdpStatistics(null).isEmpty()); assertTrue(dummyProvider.deletePdpStatistics(null, new Date()).isEmpty()); + + assertThat(dummyProvider.getGroupPolicyStatus("name")).isEmpty(); + assertThatCode(() -> dummyProvider.cudPolicyStatus(null, null, null)).doesNotThrowAnyException(); } @Test |