Search in sources :

Example 1 with MixedContentMapModule

use of org.talend.dataprep.api.preparation.json.MixedContentMapModule in project data-prep by Talend.

the class ActionMetadataTestUtils method parseParameters.

/**
 * Parse the given input stream into a parameter map.
 *
 * @param input the parameters input stream.
 * @return the parsed parameters.
 * @throws IOException if an error occurs.
 */
public static Map<String, String> parseParameters(InputStream input) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new MixedContentMapModule());
    mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
    List<Action> parsedAction = ((Actions) mapper.reader(Actions.class).readValue(input)).getActions();
    return parsedAction.get(0).getParameters();
}
Also used : Action(org.talend.dataprep.api.preparation.Action) MixedContentMapModule(org.talend.dataprep.api.preparation.json.MixedContentMapModule) Actions(org.talend.dataprep.api.preparation.Actions) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Action (org.talend.dataprep.api.preparation.Action)1 Actions (org.talend.dataprep.api.preparation.Actions)1 MixedContentMapModule (org.talend.dataprep.api.preparation.json.MixedContentMapModule)1