![JAR search and dependency download from the Maven repository](/logo.png)
io.guixer.maven.ResponseParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of guixer-maven-plugin Show documentation
Show all versions of guixer-maven-plugin Show documentation
Maven plugin to handle logs emitted by tests run over guixer-tools.
package io.guixer.maven;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
abstract class ResponseParser {
public static MyUpload toUpload(
final File jsonFile
) throws IOException, ParseException {
final String json = FileUtils.readFileToString(jsonFile, UTF_8);
return toUpload(json);
}
public static MyUpload toUpload(
final String json
) throws ParseException {
final JSONObject o = (JSONObject) new JSONParser().parse(json);
final String uploadId = (String) o.get("id");
return new MyUpload() {
@Override
public String getId() {
return uploadId;
}
};
}
public interface MyUpload {
String getId();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy