use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project alien4cloud by alien4cloud.
the class JsonUtil method toList.
public static <T> List<T> toList(String json, Class<T> elementClass, Class<?> elementGenericClass, ObjectMapper mapper) throws IOException {
JavaType elementType = mapper.getTypeFactory().constructParametricType(elementClass, elementGenericClass);
JavaType listType = mapper.getTypeFactory().constructCollectionType(List.class, elementType);
return mapper.readValue(json, listType);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project alien4cloud by alien4cloud.
the class SecretPropertiesStepDefinitions method theTopologyShouldHaveThePropertyDefinedAsASecretWithASecretPath.
@And("^The topology should have the property \"([^\"]*)\" of a node \"([^\"]*)\" defined as a secret with a secret path \"([^\"]*)\"$")
public void theTopologyShouldHaveThePropertyDefinedAsASecretWithASecretPath(String propertyName, String nodeName, String secretPath) throws Throwable {
String response = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
JavaType restResponseType = Context.getJsonMapper().getTypeFactory().constructParametricType(RestResponse.class, TopologyDTO.class);
TopologyDTO topologyDTO = ((RestResponse<TopologyDTO>) Context.getJsonMapper().readValue(response, restResponseType)).getData();
FunctionPropertyValue functionPropertyValue = (FunctionPropertyValue) topologyDTO.getTopology().getNodeTemplates().get(nodeName).getProperties().get(propertyName);
Assert.assertEquals(secretPath, functionPropertyValue.getParameters().get(0));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project alien4cloud by alien4cloud.
the class SecretPropertiesStepDefinitions method theTopologyShouldHaveThePropertyOfCapabilityOfANodeDefinedAsASecretWithASecretPath.
@And("^The topology should have the property \"([^\"]*)\" of capability \"([^\"]*)\" of a node \"([^\"]*)\" defined as a secret with a secret path \"([^\"]*)\"$")
public void theTopologyShouldHaveThePropertyOfCapabilityOfANodeDefinedAsASecretWithASecretPath(String propertyName, String capabilityName, String nodeName, String secretPath) throws Throwable {
String response = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
JavaType restResponseType = Context.getJsonMapper().getTypeFactory().constructParametricType(RestResponse.class, TopologyDTO.class);
TopologyDTO topologyDTO = ((RestResponse<TopologyDTO>) Context.getJsonMapper().readValue(response, restResponseType)).getData();
FunctionPropertyValue functionPropertyValue = (FunctionPropertyValue) topologyDTO.getTopology().getNodeTemplates().get(nodeName).getCapabilities().get(capabilityName).getProperties().get(propertyName);
Assert.assertEquals(secretPath, functionPropertyValue.getParameters().get(0));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project alien4cloud by alien4cloud.
the class SecretPropertiesStepDefinitions method theTopologyShouldHaveThePropertyOfRelationshipFromTheNodeDefinedAsASecretWithASecretPath.
@And("^The topology should have the property \"([^\"]*)\" of relationship \"([^\"]*)\" from the node \"([^\"]*)\" defined as a secret with a secret path \"([^\"]*)\"$")
public void theTopologyShouldHaveThePropertyOfRelationshipFromTheNodeDefinedAsASecretWithASecretPath(String propertyName, String relationshipName, String nodeName, String secretPath) throws Throwable {
String response = Context.getRestClientInstance().get("/rest/v1/topologies/" + Context.getInstance().getTopologyId());
JavaType restResponseType = Context.getJsonMapper().getTypeFactory().constructParametricType(RestResponse.class, TopologyDTO.class);
TopologyDTO topologyDTO = ((RestResponse<TopologyDTO>) Context.getJsonMapper().readValue(response, restResponseType)).getData();
FunctionPropertyValue functionPropertyValue = (FunctionPropertyValue) topologyDTO.getTopology().getNodeTemplates().get(nodeName).getRelationships().get(relationshipName).getProperties().get(propertyName);
Assert.assertEquals(secretPath, functionPropertyValue.getParameters().get(0));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JavaType in project Fast-Android-Networking by amitshekhariitbhu.
the class JacksonParserFactory method requestBodyParser.
@Override
public Parser<?, RequestBody> requestBodyParser(Type type) {
JavaType javaType = mapper.getTypeFactory().constructType(type);
ObjectWriter writer = mapper.writerFor(javaType);
return new JacksonRequestBodyParser<>(writer);
}
Aggregations