aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-07-05 09:28:36 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-07-05 09:28:36 +0200
commit51be94a457a972d7f4036213e022c34771c51ea9 (patch)
tree7e41cbacbe148cfeb442ffb039b586084a6ce491 /src/main
parent7233b362b6b79adde656c6f7fe79eaf9c0ad4c63 (diff)
serviceSpecInputSchema
- remove call to tosca file - add new field in serviceCharacteristics - change test Change-Id: Iad840360cff2920e8995e9d6dc73ded84ca86146 Issue-ID: EXTAPI-108 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java7
-rw-r--r--src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java19
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java10
-rw-r--r--src/main/resources/jolt/getServiceCatalog.json17
4 files changed, 22 insertions, 31 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
index e8ef9e3..d4a53a4 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationResource.java
@@ -43,12 +43,7 @@ public class ServiceSpecificationResource extends ResourceManagement {
@RequestParam MultiValueMap<String, String> params) {
Map response = serviceSpecificationService.get(serviceSpecId);
JsonRepresentation filter = new JsonRepresentation(params);
- if (response.get("serviceSpecCharacteristic") != null) {
- return this.getResponse(response, filter);
- } else {
- return this.getPartialResponse(response, filter);
-
- }
+ return this.getResponse(response, filter);
}
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
index bec7575..3094f7b 100644
--- a/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
+++ b/src/main/java/org/onap/nbi/apis/servicecatalog/ServiceSpecificationService.java
@@ -22,8 +22,7 @@ import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.onap.nbi.apis.servicecatalog.jolt.FindServiceSpecJsonTransformer;
import org.onap.nbi.apis.servicecatalog.jolt.GetServiceSpecJsonTransformer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.nbi.apis.serviceorder.ServiceCatalogUrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
@@ -43,20 +42,16 @@ public class ServiceSpecificationService {
@Autowired
ToscaInfosProcessor toscaInfosProcessor;
- private static final Logger LOGGER = LoggerFactory.getLogger(ServiceSpecificationService.class);
+ @Autowired
+ private ServiceCatalogUrl serviceCatalogUrl;
+
+ private static final String SERVICE_SPEC_INPUT_SCHEMA = "serviceSpecInputSchema";
public Map get(String serviceSpecId) {
Map sdcResponse = sdcClient.callGet(serviceSpecId);
- LinkedHashMap serviceCatalogResponse = (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
- Map toscaInfosTopologyTemplate = toscaInfosProcessor.getToscaInfos(serviceCatalogResponse);
- if (toscaInfosTopologyTemplate != null) {
- LOGGER.debug("tosca file found, retrieving informations");
- toscaInfosProcessor.buildResponseWithToscaInfos(toscaInfosTopologyTemplate, serviceCatalogResponse);
- } else {
- LOGGER.debug("no tosca file found, partial response");
- }
- return serviceCatalogResponse;
+ sdcResponse.put(SERVICE_SPEC_INPUT_SCHEMA,serviceCatalogUrl.getServiceCatalogUrl()+serviceSpecId+"/"+SERVICE_SPEC_INPUT_SCHEMA);
+ return (LinkedHashMap) getServiceSpecJsonTransformer.transform(sdcResponse);
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java
index 74ee6a6..7ea2fd4 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/MultiCriteriaRequestBuilder.java
@@ -15,8 +15,10 @@
*/
package org.onap.nbi.apis.serviceorder;
-import java.util.Locale;
-import java.util.TimeZone;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
import org.onap.nbi.apis.serviceorder.model.StateType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,10 +29,6 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
@Service
public class MultiCriteriaRequestBuilder {
diff --git a/src/main/resources/jolt/getServiceCatalog.json b/src/main/resources/jolt/getServiceCatalog.json
index f0b3787..6b260b6 100644
--- a/src/main/resources/jolt/getServiceCatalog.json
+++ b/src/main/resources/jolt/getServiceCatalog.json
@@ -8,7 +8,6 @@
"invariantUUID": "invariantUUID",
"toscaModelURL": "toscaModelURL",
"toscaResourceName": "toscaResourceName",
- "resourceInstanceName" : "modelCustomizationName",
"category ": "category",
"subcategory": "subcategory",
"distributionStatus": "distributionStatus",
@@ -37,15 +36,14 @@
"resourceUUID": "resourceSpecification[&1].id",
"resourceVersion": "resourceSpecification[&1].version",
"resourceName": "resourceSpecification[&1].name",
- "resourceInstanceName": "resourceSpecification[&1].instanceName",
+ "resourceInstanceName": ["resourceSpecification[&1].resourceInstanceName","resourceSpecification[&1].modelCustomizationName"],
"resourceInvariantUUID": "resourceSpecification[&1].resourceInvariantUUID",
- "resourceType": "resourceSpecification[&1].resourceType"
- }
-
- }
-
+ "resoucreType": "resourceSpecification[&1].resourceType"
+ }
+ },
+ "serviceSpecInputSchema" : "serviceSpecCharacteristic.serviceSpecInputSchema"
}
},
{
@@ -72,6 +70,11 @@
"@type": "ONAPresource"
}
+ },
+ "serviceSpecCharacteristic" : {
+ "valueType": "complex",
+ "@type": "serviceSpecInputSchema"
+
}
}
}