aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java12
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java24
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java8
6 files changed, 14 insertions, 86 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 06e0f0174..baf92b880 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -8,16 +8,17 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.aai.model.AaiGetAicZone.AicZones;
import org.onap.vid.aai.model.*;
import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.*;
import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
import org.onap.vid.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;
-import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.Relationship;
import org.onap.vid.aai.model.RelationshipData;
import org.onap.vid.aai.model.RelationshipList;
+import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.util.AAIRestInterface;
import org.onap.vid.aai.util.VidObjectMapperType;
import org.onap.vid.exceptions.GenericUncheckedException;
@@ -26,7 +27,6 @@ import org.onap.vid.model.probes.ErrorMetadata;
import org.onap.vid.model.probes.ExternalComponentStatus;
import org.onap.vid.model.probes.HttpRequestMetadata;
import org.onap.vid.utils.Logging;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.web.util.UriUtils;
import javax.inject.Inject;
@@ -37,7 +37,10 @@ import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.UUID;
import static java.util.Collections.emptyList;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
@@ -297,6 +300,10 @@ public class AaiClient implements AaiClientInterface {
@Override
public Response getVersionByInvariantId(List<String> modelInvariantId) {
+ if (modelInvariantId.isEmpty()) {
+ throw new GenericUncheckedException("Zero invariant-ids provided to getVersionByInvariantId; request is rejected as this will cause full models listing");
+ }
+
StringBuilder sb = new StringBuilder();
for (String id : modelInvariantId){
sb.append(MODEL_INVARIANT_ID);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java
deleted file mode 100644
index 381f9bc25..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.onap.vid.aai.model;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class ServiceInstance {
-
- @JsonProperty("service-instance-id")
- public String serviceInstanceId;
-
- @JsonProperty("service-instance-name")
- public String serviceInstanceName;
-
- @JsonProperty("persona-model-id")
- public String personaModelId;
-
- @JsonProperty("persona-model-version")
- public String personaModelVersion;
-
- @JsonProperty("resource-version")
- public String resourceVersion;
-
- @JsonProperty("orchestration-status")
- public String orchestrationStatus;
-
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java
deleted file mode 100644
index 0fced4c57..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.onap.vid.aai.model;
-
-import java.util.List;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class ServiceInstances {
-
- @JsonProperty("service-instance")
- public List<ServiceInstance> serviceInstance;
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java
deleted file mode 100644
index 91582e816..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.onap.vid.aai.model;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class ServiceSubscription {
-
- @JsonProperty("service-type")
- public String serviceType;
-
- @JsonProperty("resource-version")
- public String resourceVersion;
-
- @JsonProperty("service-instances")
- public ServiceInstances serviceInstances;
-
-
-}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java
deleted file mode 100644
index 3ba4b22d0..000000000
--- a/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.onap.vid.aai.model;
-
-import java.util.List;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-public class Services {
- @JsonProperty("global-customer-id")
- public String globalCustomerId;
-
- @JsonProperty("subscriber-name")
- public String subscriberName;
-
- @JsonProperty("subscriber-type")
- public String subscriberType;
-
- @JsonProperty("resource-version")
- public String resourceVersion;
-
- @JsonProperty("service-subscriptions")
- public List<ServiceSubscription> serviceSubscriptions;
-
-
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index 70a454a75..efa12f2c0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -21,10 +21,8 @@
package org.onap.vid.services;
+import com.google.common.collect.ImmutableList;
import io.joshworks.restclient.http.HttpResponse;
-import java.util.Collection;
-import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.onap.vid.aai.AaiResponse;
@@ -35,6 +33,8 @@ import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.model.SubscriberList;
import org.onap.vid.roles.RoleValidator;
+import java.util.List;
+
public class AaiServiceImplTest {
private AaiServiceImpl createTestSubject() {
@@ -166,7 +166,7 @@ public class AaiServiceImplTest {
@Test
public void testGetVersionByInvariantId() throws Exception {
AaiServiceImpl testSubject;
- List<String> modelInvariantId = null;
+ List<String> modelInvariantId = ImmutableList.of("some invariant id");
// default test
try {