summaryrefslogtreecommitdiffstats
path: root/adaptors/base/http/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/base/http/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/base/http/provider/src/test')
-rw-r--r--adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java44
-rw-r--r--adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java20
-rw-r--r--adaptors/base/http/provider/src/test/resources/testprops.properties1
3 files changed, 65 insertions, 0 deletions
diff --git a/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java b/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java
new file mode 100644
index 000000000..d0973d90e
--- /dev/null
+++ b/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/AbstractHttpAdapterTest.java
@@ -0,0 +1,44 @@
+package org.onap.ccsdk.sli.adaptors.base.http;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Properties;
+import java.util.Set;
+
+import javax.ws.rs.client.Client;
+
+import org.junit.Test;
+
+public class AbstractHttpAdapterTest {
+
+ public class TestAdapter extends AbstractHttpAdapter {
+
+ }
+
+ @Test
+ public void checkTimeouts() throws Exception {
+ TestAdapter adapter = new TestAdapter();
+ Client client = adapter.getClientBuilder().build();
+ assertNotNull(client.getConfiguration().getProperty("jersey.config.client.readTimeout"));
+ assertNotNull(client.getConfiguration().getProperty("jersey.config.client.connectTimeout"));
+ }
+
+ @Test
+ public void propertiesTest() throws Exception {
+ System.setProperty(AbstractHttpAdapter.SDNC_CONFIG_DIR, "src/test/resources/");
+ TestAdapter adapter = new TestAdapter();
+ Properties props = adapter.getProperties("testprops.properties");
+ assertNotNull(props);
+ assertEquals("world", props.get("hello"));
+ }
+
+ @Test
+ public void basicAuthFilter() throws Exception {
+ TestAdapter adapter = new TestAdapter();
+ adapter.addBasicAuthCredentials("hello", "world");
+ Set<Object> objs = adapter.getClientBuilder().getConfiguration().getInstances();
+ assertEquals(BasicAuthFilter.class,objs.iterator().next().getClass());
+ }
+
+}
diff --git a/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java b/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java
new file mode 100644
index 000000000..d9d552dac
--- /dev/null
+++ b/adaptors/base/http/provider/src/test/java/org/onap/ccsdk/sli/adaptors/base/http/BasicAuthFilterTest.java
@@ -0,0 +1,20 @@
+package org.onap.ccsdk.sli.adaptors.base.http;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class BasicAuthFilterTest {
+
+ @Test
+ public void notNullParameters() throws Exception {
+ BasicAuthFilter myFilter = new BasicAuthFilter("hello");
+ assertNotNull(myFilter);
+ }
+
+ @Test
+ public void nullParameters() throws Exception {
+ BasicAuthFilter myFilter = new BasicAuthFilter(null);
+ assertNotNull(myFilter);
+ }
+}
diff --git a/adaptors/base/http/provider/src/test/resources/testprops.properties b/adaptors/base/http/provider/src/test/resources/testprops.properties
new file mode 100644
index 000000000..3f602680e
--- /dev/null
+++ b/adaptors/base/http/provider/src/test/resources/testprops.properties
@@ -0,0 +1 @@
+hello = world \ No newline at end of file