summaryrefslogtreecommitdiffstats
path: root/adaptors/base/http/provider/src/test
diff options
context:
space:
mode:
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