Merge "Exclude httpclient to resolve CLM issue"
authorPamela Dragosh <pdragosh@research.att.com>
Fri, 16 Mar 2018 12:48:18 +0000 (12:48 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 16 Mar 2018 12:48:18 +0000 (12:48 +0000)
POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java
POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java [new file with mode: 0644]
docker_build.sh
docker_merge.sh
docker_verify.sh

index 0835655..c751c47 100644 (file)
@@ -455,63 +455,4 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
                }
                return false;
        }
-
-       public class PDPGroupItem{
-               private final OnapPDPGroup group;
-               
-               public PDPGroupItem(OnapPDPGroup itemId) {
-                       this.group = itemId;
-               }
-
-               public String getId() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getId: " + this.group);
-                       }
-                       return this.group.getId();
-               }
-               
-               public String getName() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getName: " + this.group);
-                       }
-                       return this.group.getName();
-               }
-               
-               public String getDescription() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getDescription: " + this.group);
-                       }
-                       return this.group.getDescription();
-               }
-               
-               public Boolean getDefault() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getDefault: " + this.group);
-                       }
-                       return this.group.isDefaultGroup();
-               }
-               
-        
-        public String  getStatus() {
-                       return this.group.getStatus().getStatus().toString();
-        }
-        
-        public Set<PDP>                getPDPs() {
-               return Collections.unmodifiableSet(this.group.getPdps());
-        }
-        
-        public Set<PDPPolicy> getPolicies() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getPolicies: " + this.group);
-                       }
-                       return this.group.getPolicies();
-        }
-        
-        public Set<PDPPIPConfig> getPipConfigs() {
-                       if (LOGGER.isTraceEnabled()) {
-                               LOGGER.trace("getPIPConfigs: " + this.group);
-                       }
-                       return this.group.getPipConfigs();
-        }
-       }
 }
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java
new file mode 100644 (file)
index 0000000..920cc97
--- /dev/null
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.policy.rest.util.PolicyContainer.ItemSetChangeListener;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.api.pap.OnapPDPGroup;
+import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
+import com.att.research.xacml.api.pap.PAPException;
+
+public class PDPGroupContainerTest {
+       private PAPPolicyEngine engine = Mockito.mock(PAPPolicyEngine.class);
+       private PDPGroupContainer container = new PDPGroupContainer(engine);
+       
+       @Test
+       public void testContainer() throws PAPException {
+               Object itemId = new Object();
+               assertEquals(container.isSupported(itemId), false);
+               
+               container.refreshGroups();
+               assertEquals(container.getGroups().size(), 0);
+               
+               OnapPDPGroup group = Mockito.mock(OnapPDPGroup.class);
+               container.makeDefault(group);
+               OnapPDPGroup newGroup = Mockito.mock(OnapPDPGroup.class);
+               container.removeGroup(group, newGroup);
+               OnapPDP pdp = Mockito.mock(OnapPDP.class);
+               container.updatePDP(pdp);
+               container.updateGroup(group);
+               assertNull(container.getContainerPropertyIds());
+               assertEquals(container.getItemIds().size(), 0);
+               assertEquals(container.getType(itemId), null);
+               assertEquals(container.size(), 0);
+               assertEquals(container.containsId(itemId), false);
+               String name = "testName";
+               String description = "testDescription";
+               container.addNewGroup(name, description);
+               String id = "testID";
+               int jmxport = 0;
+               container.addNewPDP(id, newGroup, name, description, jmxport);
+               container.movePDP(pdp, newGroup);
+               ItemSetChangeListener listener = null;
+               container.addItemSetChangeListener(listener);
+               container.nextItemId(itemId);
+               container.prevItemId(itemId);
+               container.firstItemId();
+               container.lastItemId();
+               container.isFirstId(itemId);
+               container.isLastId(itemId);
+               container.indexOfId(itemId);
+               assertEquals(container.getItemIds().size(), 0);
+               container.removeItem(itemId);
+               container.removePDP(pdp, newGroup);
+       }
+
+       @Test(expected=UnsupportedOperationException.class)
+       public void testAddItem() {
+               container.addItem();            
+       }
+       
+       @Test(expected=UnsupportedOperationException.class)
+       public void testAddContainerProperty() {
+               container.addContainerProperty(null, null, null);
+       }
+
+       @Test(expected=UnsupportedOperationException.class)
+       public void testRemoveContainerProperty() {
+               container.removeContainerProperty(null);
+       }
+
+       @Test(expected=UnsupportedOperationException.class)
+       public void testRemoveAllItems() {
+               container.removeAllItems();
+       }
+
+       @Test(expected=UnsupportedOperationException.class)
+       public void testAddItemAfter() {
+               container.addItemAfter(null);
+       }
+       
+       @Test(expected=IndexOutOfBoundsException.class)
+       public void testGetIdByIndex() {
+               container.getIdByIndex(0);
+       }
+
+       @Test(expected=UnsupportedOperationException.class)
+       public void testAddItemAt() {
+               container.addItemAt(0);
+       }
+
+       @Test(expected=IllegalArgumentException.class)
+       public void testGetItemIds() {
+               container.getItemIds(0, 1);
+       }
+}
index d7794bf..55ee964 100644 (file)
@@ -46,19 +46,19 @@ echo "Building $IMAGE"
 #
 # This is the local latest tagged image. The Dockerfile's need this to build images
 #
-TAGS="--tag onap/policy/${IMAGE}:latest"
+TAGS="--tag onap/${IMAGE}:latest"
 #
 # This is the nexus repo prepended for latest tagged image.
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:latest"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:latest"
 #
 # This has the nexus repo prepended and only major/minor version with latest
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
 #
 # This has the nexus repo prepended and major/minor/patch version with timestamp
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}"
 
 echo $TAGS
 
@@ -75,7 +75,7 @@ docker images
 
 echo "Pushing $IMAGE"
 
-docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:latest
+docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:latest
 
 if [ $? -ne 0 ]
 then
@@ -84,7 +84,7 @@ then
 
 fi
 
-docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest
+docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest
 
 if [ $? -ne 0 ]
 then
@@ -92,7 +92,7 @@ then
     exit 1
 
 fi
-docker push ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}
+docker push ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${TIMESTAMP}
 
 if [ $? -ne 0 ]
 then
index c8bde37..085a1ce 100644 (file)
@@ -46,15 +46,15 @@ echo "Building $IMAGE"
 #
 # This is the local latest tagged image. The Dockerfile's need this to build images
 #
-TAGS="--tag onap/policy/${IMAGE}:latest"
+TAGS="--tag onap/${IMAGE}:latest"
 #
 # This has the nexus repo prepended and only major/minor version with latest
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
 #
 # This has the nexus repo prepended and major/minor/patch version with timestamp
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
 
 echo $TAGS
 
@@ -73,7 +73,7 @@ docker images
 # Push image
 #
 echo "Pushing $IMAGE"
-docker push ${DOCKER_REPOSITORY}/onap/policy/$IMAGE:${MVN_MAJMIN_VERSION}-latest
+docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_MAJMIN_VERSION}-latest
 
 if [ $? -ne 0 ]
 then
@@ -81,7 +81,7 @@ then
     exit 1
 fi
 
-docker push ${DOCKER_REPOSITORY}/onap/policy/$IMAGE:${MVN_VERSION}-${TIMESTAMP}
+docker push ${DOCKER_REPOSITORY}/onap/$IMAGE:${MVN_VERSION}-${TIMESTAMP}
 
 if [ $? -ne 0 ]
 then
index dc40513..b5ac2aa 100644 (file)
@@ -49,15 +49,15 @@ echo "Building $IMAGE"
 #
 # This is the local latest tagged image. The Dockerfile's need this to build images
 #
-TAGS="--tag onap/policy/${IMAGE}:latest"
+TAGS="--tag onap/${IMAGE}:latest"
 #
 # This has the nexus repo prepended and only major/minor version with latest
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_MAJMIN_VERSION}-latest"
 #
 # This has the nexus repo prepended and major/minor/patch version with timestamp
 #
-TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
+TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAMP}"
 
 echo $TAGS