use of com.fasterxml.jackson.dataformat.yaml.YAMLFactory in project elasticsearch by elastic.
the class YamlXContentTests method testBigInteger.
public void testBigInteger() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
JsonGenerator generator = new YAMLFactory().createGenerator(os);
doTestBigInteger(generator, os);
}
use of com.fasterxml.jackson.dataformat.yaml.YAMLFactory in project KaiZen-OpenAPI-Editor by RepreZen.
the class Model method parse.
public static Model parse(CompositeSchema schema, JsonNode document) {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
String text = null;
try {
text = mapper.writeValueAsString(document);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return parseYaml(schema, text);
}
use of com.fasterxml.jackson.dataformat.yaml.YAMLFactory in project trex-stateless-gui by cisco-system-traffic-generator.
the class TrafficProfile method getTrafficProfile.
/**
* @param yamlFile File containing the Traffic Profile Yaml.
* @return parsed Yaml file
* @throws java.io.IOException
*/
public Profile[] getTrafficProfile(File yamlFile) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
Profile[] trafficProfileArray = mapper.readValue(yamlFile, Profile[].class);
int i = 0;
for (Profile profile : trafficProfileArray) {
Map<String, Object> streamAdditionalProperties = profile.getStream().getAdditionalProperties();
if (streamAdditionalProperties.containsKey("vm")) {
profile.getStream().setVmRaw(streamAdditionalProperties.get("vm").toString());
}
if (streamAdditionalProperties.containsKey("rx_stats")) {
profile.getStream().setRxStatsRaw(streamAdditionalProperties.get("rx_stats").toString());
}
// Check the Binary is in the Yaml File
if (profile.getStream().getPacket().getBinary() == null) {
String absolutePath = yamlFile.getAbsolutePath();
String filePath = absolutePath.substring(0, absolutePath.lastIndexOf(File.separator));
String pacpFile = profile.getStream().getPacket().getPcap();
String encodedPcap = encodePcapFile(filePath + File.separator + pacpFile);
profile.getStream().getPacket().setBinary(encodedPcap);
}
profile.getStream().getPacket().setPcap(null);
if (profile.getName() == null) {
profile.setName("Stream" + i++);
}
}
return trafficProfileArray;
}
use of com.fasterxml.jackson.dataformat.yaml.YAMLFactory in project jvm-serializers by eishay.
the class JacksonYAMLDatabind method register.
public static void register(TestGroups groups) {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
groups.media.add(JavaBuiltIn.mediaTransformer, new StdJacksonDataBind<MediaContent>("yaml/jackson/databind", MediaContent.class, mapper), new SerFeatures(SerFormat.JSON, SerGraph.FULL_GRAPH, SerClass.ZERO_KNOWLEDGE, ""));
}
use of com.fasterxml.jackson.dataformat.yaml.YAMLFactory in project PatchLib by mariotaku.
the class PatchLibApplication method startProcess.
private boolean startProcess(File inFile, File outFile, CommandLine cmdLine) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final ProcessingRules conf = new ProcessingRules();
conf.setRules(new HashMap<String, PatchClassInfo>());
for (File rulesFile : getFiles(cmdLine.getOptionValue("rules"))) {
final Map<String, PatchClassInfo> rulesMap = mapper.readValue(rulesFile, new TypeReference<Map<String, PatchClassInfo>>() {
});
conf.addRules(rulesMap);
}
try (InputStream is = new FileInputStream(inFile);
OutputStream os = new FileOutputStream(outFile)) {
final LibraryProcessor.CommandLineOptions options = getOptions(cmdLine);
options.setSourceFilePath(inFile.getAbsolutePath());
final LibraryProcessor processor = LibraryProcessor.get(is, os, inFile.getName(), conf, options);
if (processor == null) {
throw new UnsupportedOperationException("Unsupported library " + inFile);
}
return processor.process();
}
}
Aggregations