summaryrefslogtreecommitdiffstats
path: root/test-apis-ci
diff options
context:
space:
mode:
Diffstat (limited to 'test-apis-ci')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java8
2 files changed, 9 insertions, 1 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
index 71735d5a4a..0e0a974885 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ConsumerRestUtils.java
@@ -24,6 +24,7 @@ import static org.testng.AssertJUnit.assertEquals;
import java.util.Map;
+import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.ObjectMapper;
import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
import org.openecomp.sdc.be.model.User;
@@ -123,6 +124,7 @@ public class ConsumerRestUtils extends BaseRestUtils {
String bodyToParse = restResponse.getResponse();
ObjectMapper mapper = new ObjectMapper();
try {
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ConsumerDataDefinition component = mapper.readValue(bodyToParse, ConsumerDataDefinition.class);
return component;
} catch (Exception e) {
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
index 95953838c9..7789231c22 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/rest/ResponseParser.java
@@ -215,6 +215,7 @@ public class ResponseParser {
mapper.registerModule(module);
ComponentInstanceProperty propertyDefinition = null;
try {
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
propertyDefinition = mapper.readValue(response, ComponentInstanceProperty.class);
logger.debug(propertyDefinition.toString());
} catch (IOException e) {
@@ -233,7 +234,7 @@ public class ResponseParser {
ObjectMapper mapper = new ObjectMapper();
ArtifactDefinition artifactDefinition = null;
try {
-
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
artifactDefinition = mapper.readValue(response, ArtifactDefinition.class);
logger.debug(artifactDefinition.toString());
} catch (IOException e) {
@@ -273,6 +274,7 @@ public class ResponseParser {
JsonDeserializer<PropertyConstraint> desrializer = new PropertyConstraintJacksonDeserialiser();
addDeserializer(module, PropertyConstraint.class, desrializer);
mapper.registerModule(module);
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
object = mapper.readValue(json, clazz);
// System.out.println("Class: "+clazz.getSimpleName()+", json:
@@ -311,6 +313,8 @@ public class ResponseParser {
mapper.registerModule(module);
Service service = null;
try {
+// TODO Andrey L. uncomment line below in case to ignore on unknown properties, not recommended, added by Matvey
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
service = mapper.readValue(response, Service.class);
logger.debug(service.toString());
} catch (IOException e) {
@@ -334,6 +338,7 @@ public class ResponseParser {
Product product = null;
try {
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
product = mapper.readValue(response, Product.class);
logger.debug(product.toString());
} catch (IOException e) {
@@ -355,6 +360,7 @@ public class ResponseParser {
mapper.registerModule(module);
ComponentInstance componentInstance = null;
try {
+ mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
componentInstance = mapper.readValue(response, ComponentInstance.class);
logger.debug(componentInstance.toString());
} catch (IOException e) {
ht .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*-
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2017 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=========================================================
 */

var express = require('express');
var properties = require('../mock-data/resource/properties.json');

var router = express.Router();

router.get('/', function (req, res) {
  console.log('query');
  res.send(properties);
});

router.post('/:id', function (req, res) {
  console.log("post /:id", req);
  res.send(properties[0]);
});

router.get('/:id', function (req, res) {
  res.send(properties[0]);
});


router.post('/', function (req, res) {
  console.log("post ", req);
  res.send(properties[0]);
});
module.exports= router;