summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java29
-rw-r--r--packages/docker/src/main/docker/Dockerfile31
2 files changed, 51 insertions, 9 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java
index e99debd1e..d16264909 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/MicroServicePolicyTest.java
@@ -19,15 +19,25 @@
*/
package org.onap.policy.pap.xacml.rest.components;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.when;
+import static org.mockito.Matchers.any;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
-import com.att.research.xacml.api.pap.PAPException;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(MicroServiceConfigPolicy.class)
public class MicroServicePolicyTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -47,10 +57,13 @@ public class MicroServicePolicyTest {
assertNull(policy.getCorrectPolicyDataObject());
}
- @Ignore
@Test
- public void testPrepareToSave() throws PAPException {
- thrown.expect(NullPointerException.class);
+ public void testPrepareToSave() throws Exception {
+ // Need to mock internal dictionary retrieval
+ CommonClassDaoImpl impl = Mockito.mock(CommonClassDaoImpl.class);
+ PowerMockito.whenNew(CommonClassDaoImpl.class).withNoArguments().thenReturn(impl);
+ when(impl.getDataById(any(), anyString(), anyString())).thenReturn(null);
+
PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
MicroServiceConfigPolicy policy = new MicroServiceConfigPolicy(policyAdapter);
policyAdapter.setHighestVersion(1);
@@ -59,6 +72,6 @@ public class MicroServicePolicyTest {
policyAdapter.setJsonBody("{ \"version\": \"1.0\"}");
policyAdapter.setServiceType("foo");
policy.prepareToSave();
- fail("Expected an exception");
+ assertEquals(policy.isPreparedToSave(), true);
}
} \ No newline at end of file
diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile
index fe568082d..b0e8205a6 100644
--- a/packages/docker/src/main/docker/Dockerfile
+++ b/packages/docker/src/main/docker/Dockerfile
@@ -1,4 +1,33 @@
-FROM onap/policy/policy-base
+FROM ubuntu:14.04
+
+ARG HTTP_PROXY=${HTTP_PROXY}
+ARG HTTPS_PROXY=${HTTPS_PROXY}
+
+ENV http_proxy $HTTP_PROXY
+ENV https_proxy $HTTPS_PROXY
+
+RUN \
+ apt-get clean && \
+ apt-get update && \
+ apt-get install -y zip unzip curl wget ssh telnet maven && \
+ apt-get install -y software-properties-common && \
+ apt-get install -y jq httpie && \
+ apt-get install -y python-pip && \
+ add-apt-repository ppa:openjdk-r/ppa && \
+ apt-get clean && \
+ apt-get update && \
+ apt-get install -y openjdk-8-jdk
+
+RUN useradd --create-home --shell /bin/bash policy
+
+# install MariaDB client
+RUN \
+ apt-get install -y apt-transport-https && \
+ apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db && \
+ add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main' && \
+ apt-get clean && \
+ apt-get update && \
+ apt-get install -y mariadb-client
RUN mkdir -p /opt/app/policy /tmp/policy-install && chown policy /opt/app/policy /tmp/policy-install