@@ -0,0 +1,3617 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.sling.launchpad.webapp.integrationtest.util;%0A%0Aimport java.io.StringReader;%0Aimport java.io.StringWriter;%0Aimport java.util.AbstractMap;%0Aimport java.util.Map.Entry;%0Aimport java.util.function.Function;%0Aimport java.util.stream.Collectors;%0A%0Aimport javax.json.Json;%0Aimport javax.json.JsonArray;%0Aimport javax.json.JsonArrayBuilder;%0Aimport javax.json.JsonException;%0Aimport javax.json.JsonNumber;%0Aimport javax.json.JsonObject;%0Aimport javax.json.JsonObjectBuilder;%0Aimport javax.json.JsonString;%0Aimport javax.json.JsonStructure;%0Aimport javax.json.JsonValue;%0Aimport javax.json.JsonValue.ValueType;%0A%0Apublic class JsonUtil %7B%0A    public static JsonStructure parse(String input) throws JsonException %7B%0A        return Json.createReader(new StringReader(input)).read();%0A    %7D%0A%0A    public static JsonObject parseObject(String input) throws JsonException%7B%0A        return (JsonObject) parse(input);%0A    %7D%0A%0A    public static JsonArray parseArray(String input) throws JsonException %7B%0A        return (JsonArray) parse(input);%0A    %7D%0A%0A    public static Object unbox(JsonValue value, Function%3CJsonStructure, Object%3E convert) throws JsonException %7B%0A        switch (value.getValueType()) %7B%0A            case ARRAY:%0A            case OBJECT:%0A                return convert.apply((JsonStructure) value);%0A            case FALSE:%0A                return Boolean.FALSE;%0A            case TRUE:%0A                return Boolean.TRUE;%0A            case NULL:%0A                return null;%0A            case NUMBER:%0A                JsonNumber number = (JsonNumber) value;%0A                return number.isIntegral() ? number.longValue() : number.doubleValue();%0A            case STRING:%0A                return ((JsonString) value).getString();%0A            default:%0A                throw new JsonException(%22Unknow value type%22);%0A        %7D%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    public static %3CT%3E T unbox(JsonValue value) %7B%0A        return (T) unbox(value, json -%3E json.getValueType() == ValueType.ARRAY ? %0A                ((JsonArray) json).stream()%0A                    .map(JsonUtil::unbox)%0A                    .collect(Collectors.toList())%0A                :%0A                ((JsonObject) json).entrySet().stream()%0A                    .map(entry -%3E new AbstractMap.SimpleEntry%3C%3E(entry.getKey(),unbox(entry.getValue())))%0A                    .collect(Collectors.toMap(Entry::getKey, Entry::getValue)));%0A    %7D%0A%0A    public static String toString(JsonValue value) %7B%0A        StringWriter writer = new StringWriter();%0A        Json.createGenerator(writer).write(value).close();%0A        return writer.toString();%0A    %7D%0A%0A    public static String toString(JsonArrayBuilder builder) %7B%0A        return toString(builder.build());%0A    %7D%0A    %0A    public static String toString(JsonObjectBuilder builder) %7B%0A        return toString(builder.build());%0A    %7D%0A%7D%0A

Remove commons.json from launchpad integrationtests - add missing JsonUtil