aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java')
-rw-r--r--plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
new file mode 100644
index 00000000..1ce5786c
--- /dev/null
+++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/handling/decoding/pdpx/TestPolicyDecoderCsarPdpx.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.decoding.pdpx;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.onap.policy.distribution.model.Csar;
+
+/**
+ * Class to perform unit test of {@link PolicyDecoderCsarPdpx}.
+ *
+ */
+public class TestPolicyDecoderCsarPdpx {
+
+ @Test
+ public void testHpaPolicy2Vnf() throws IOException {
+ Csar csar = new Csar("src/test/resources/service-TestNs8-csar.csar");
+
+ PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
+ try {
+ Collection<PdpxPolicy> ret = policyDecoderCsarPdpx.decode(csar);
+ assertEquals(2, ret.size());
+ } catch (Exception e) {
+ fail("test should not thrown an exception here: " + e.getMessage());
+ }
+ }
+
+ @Test
+ public void testHpaPolicyFeature() throws IOException {
+ Csar csar = new Csar("src/test/resources/hpaPolicySRIOV.csar");
+
+ PolicyDecoderCsarPdpx policyDecoderCsarPdpx = new PolicyDecoderCsarPdpx();
+ try {
+ Collection<PdpxPolicy> ret = policyDecoderCsarPdpx.decode(csar);
+ assertEquals(2, ret.size());
+ } catch (Exception e) {
+ fail("test should not thrown an exception here: " + e.getMessage());
+ }
+ }
+}