summaryrefslogtreecommitdiffstats
path: root/adaptors/mdsal-resource/provider/src/test
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:26:31 -0800
committerJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:27:11 -0800
commit11510b43c277b8e1dd7e58d79785544810118c8e (patch)
treeb88a497c999d24b5f357ea9b26bc93e0990fd5e7 /adaptors/mdsal-resource/provider/src/test
parent5d2eab72fc4442f14108b41800cec88126913823 (diff)
Migrate sli-adaptor files
Migrate sli-adaptor repo files into a new "adaptors" directory. Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'adaptors/mdsal-resource/provider/src/test')
-rw-r--r--adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java43
-rw-r--r--adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java31
-rw-r--r--adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java64
-rw-r--r--adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java31
4 files changed, 169 insertions, 0 deletions
diff --git a/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java
new file mode 100644
index 000000000..f5b0bcf0c
--- /dev/null
+++ b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.adaptors.resource.mdsal;
+
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
+
+import static org.junit.Assert.assertEquals;
+
+public class ConfigResourceTest {
+ ConfigResource configResource = new ConfigResource("http", "local",
+ "10001", "admin",
+ "password");
+
+ @Test
+ public void isAvailableNegativeTest() throws SvcLogicException {
+ SvcLogicContext ctx = new SvcLogicContext();
+ assertEquals(QueryStatus.NOT_FOUND, configResource.isAvailable
+ ("xyz", "key", "prefix", ctx));
+ }
+}
+
diff --git a/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java
new file mode 100644
index 000000000..80563b96b
--- /dev/null
+++ b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestConfigResource.java
@@ -0,0 +1,31 @@
+package org.onap.ccsdk.sli.adaptors.resource.mdsal;
+
+import junit.framework.TestCase;
+
+import static org.mockito.Mockito.mock;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import static org.junit.Assert.assertNotNull;
+
+public class TestConfigResource extends TestCase {
+
+ public void test() throws Exception {
+
+ RestService restService = mock(RestService.class);
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ ConfigResource res = new ConfigResource(restService);
+
+ res.delete("my-resource", null, ctx);
+ res.notify("my-resource", "action", "key", ctx);
+ res.query("my-resource", false, "my-select", "mykey", "pfx", null, ctx);
+ res.release("my-resource", "mykey", ctx);
+ res.reserve("my-resource", "my-select", "mykey", "pfx", ctx);
+ res.exists("my-resource", "mykey", "pfx", ctx);
+ res.isAvailable("my-resource", "mykey", "pfx", ctx);
+ res.save("resource", false, false, null, null, null, ctx);
+ res.update("my-resource", "mykey", null, "pfx", ctx);
+ assertNotNull(res);
+ }
+
+}
diff --git a/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java
new file mode 100644
index 000000000..7f05d1e5f
--- /dev/null
+++ b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestMdsalResourcePropertiesProviderImpl.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2018 Samsung. 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.adaptors.resource.mdsal;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class TestMdsalResourcePropertiesProviderImpl {
+
+ MdsalResourcePropertiesProviderImpl mdsal;
+
+ @Before
+ public void setup() {
+ mdsal = new MdsalResourcePropertiesProviderImpl();
+ }
+
+
+ @Test
+ public void testGetProperties() {
+ Properties prop = mdsal.getProperties();
+
+ System.out.println("All Default Properties : " + prop);
+
+ assertEquals("localhost",prop.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-host"));
+ assertEquals("Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U",prop.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-passwd"));
+ assertEquals("http",prop.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-protocol"));
+ assertEquals("8181",prop.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-port"));
+ assertEquals("admin",prop.getProperty("org.onap.ccsdk.sli.adaptors.resource.mdsal.sdnc-user"));
+ }
+
+
+ @Test
+ public void testGetPropertie() throws IllegalStateException, IllegalArgumentException {
+ MdsalResourcePropertiesProviderImpl test = new MdsalResourcePropertiesProviderImpl();
+
+ mdsal.determinePropertiesFile(test);
+ assertNotNull(test);
+
+ }
+}
diff --git a/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java
new file mode 100644
index 000000000..2e9798df1
--- /dev/null
+++ b/adaptors/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/TestOperationalResource.java
@@ -0,0 +1,31 @@
+package org.onap.ccsdk.sli.adaptors.resource.mdsal;
+
+import static org.mockito.Mockito.mock;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+
+import junit.framework.TestCase;
+import static org.junit.Assert.assertNotNull;
+
+public class TestOperationalResource extends TestCase {
+
+
+ public void test() throws Exception {
+
+ RestService restService = mock(RestService.class);
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ OperationalResource res = new OperationalResource(restService);
+
+ res.delete("my-resource", null, ctx);
+ res.notify("my-resource", "action", "key", ctx);
+ res.query("my-resource", false, "my-select", "mykey", "pfx", null, ctx);
+ res.release("my-resource", "mykey", ctx);
+ res.reserve("my-resource", "my-select", "mykey", "pfx", ctx);
+ res.exists("my-resource", "mykey", "pfx", ctx);
+ res.isAvailable("my-resource", "mykey", "pfx", ctx);
+ res.save("resource", false, false, null, null, null, ctx);
+ res.update("my-resource", "mykey", null, "pfx", ctx);
+ assertNotNull(restService);
+ }
+}