mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
switch over to snakeyaml-engine
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
||||
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
import io.nosqlbench.api.content.Content;
|
||||
import io.nosqlbench.api.content.NBIO;
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.snakeyaml.engine.v2.api.Load;
|
||||
import org.snakeyaml.engine.v2.api.LoadSettings;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -79,8 +80,9 @@ public class RawStmtsLoader {
|
||||
}
|
||||
|
||||
private RawStmtsDocList parseYaml(Logger logger, String data) {
|
||||
Yaml yaml = new Yaml();
|
||||
Iterable<Object> objects = yaml.loadAll(data);
|
||||
LoadSettings loadSettings = LoadSettings.builder().build();
|
||||
Load yaml = new Load(loadSettings);
|
||||
Iterable<Object> objects = yaml.loadAllFromString(data);
|
||||
List<RawStmtsDoc> newDocList = new ArrayList<>();
|
||||
|
||||
for (Object object : objects) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
||||
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
import io.nosqlbench.api.content.Content;
|
||||
import io.nosqlbench.api.content.NBIO;
|
||||
import io.nosqlbench.api.errors.BasicError;
|
||||
import io.nosqlbench.api.errors.OpConfigError;
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.snakeyaml.engine.v2.api.Load;
|
||||
import org.snakeyaml.engine.v2.api.LoadSettings;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -73,8 +74,8 @@ public class RawYamlLoader {
|
||||
}
|
||||
|
||||
private List<Map<String,Object>> parseYaml(Logger logger, String data) {
|
||||
Yaml yaml = new Yaml();
|
||||
Iterable<Object> objects = yaml.loadAll(data);
|
||||
Load yaml = new Load(LoadSettings.builder().build());
|
||||
Iterable<Object> objects = yaml.loadAllFromString(data);
|
||||
List<RawStmtsDoc> newDocList = new ArrayList<>();
|
||||
|
||||
List<Map<String,Object>> maps = new ArrayList<>();
|
||||
|
||||
@@ -41,11 +41,6 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jetty -->
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -93,11 +93,6 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,9 +16,12 @@
|
||||
|
||||
package io.nosqlbench.engine.api.activityapi.sysperf;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.snakeyaml.engine.v2.api.Dump;
|
||||
import org.snakeyaml.engine.v2.api.DumpSettings;
|
||||
import org.snakeyaml.engine.v2.api.Load;
|
||||
import org.snakeyaml.engine.v2.api.LoadSettings;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -111,8 +114,8 @@ public class SysPerf {
|
||||
bytes = Files.readAllBytes(cache.toPath());
|
||||
String perfdata = new String(bytes, CHARSET);
|
||||
|
||||
Yaml yaml = new Yaml();
|
||||
SysPerfData perfinfo = yaml.load(perfdata);
|
||||
Load yaml = new Load(LoadSettings.builder().build());
|
||||
SysPerfData perfinfo = (SysPerfData) yaml.loadFromString(perfdata);
|
||||
cachedData = perfinfo;
|
||||
logger.info("Loaded previously cached system timing data from " + cache.getCanonicalPath());
|
||||
return cachedData;
|
||||
@@ -135,11 +138,11 @@ public class SysPerf {
|
||||
try {
|
||||
if (!cache.exists() || forceSave) {
|
||||
Files.createDirectories(cache.toPath().getParent());
|
||||
Yaml yaml = new Yaml();
|
||||
Dump dump = new Dump(DumpSettings.builder().build());
|
||||
if (cache.exists()) {
|
||||
cache.delete();
|
||||
}
|
||||
String filedata = yaml.dump(cachedData);
|
||||
String filedata = dump.dumpToString(cachedData);
|
||||
Files.write(cache.toPath(), filedata.getBytes(CHARSET), StandardOpenOption.CREATE_NEW);
|
||||
logger.info("Wrote system timing data to cachefile " + cache.getCanonicalPath());
|
||||
}
|
||||
|
||||
@@ -63,6 +63,12 @@
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.snakeyaml</groupId>
|
||||
<artifactId>snakeyaml-engine</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>info.picocli</groupId>
|
||||
<artifactId>picocli</artifactId>
|
||||
@@ -129,11 +135,6 @@
|
||||
<version>1.36</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>1.33</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mitchtalmadge</groupId>
|
||||
<artifactId>ascii-data</artifactId>
|
||||
|
||||
@@ -72,11 +72,6 @@
|
||||
<version>0.64.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sf.jopt-simple</groupId>
|
||||
<artifactId>jopt-simple</artifactId>
|
||||
@@ -150,6 +145,10 @@
|
||||
<artifactId>graal-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.snakeyaml</groupId>
|
||||
<artifactId>snakeyaml-engine</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
* Copyright (c) 2022-2023 nosqlbench
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package io.nosqlbench.api.markdown.aggregator;
|
||||
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.snakeyaml.engine.v2.api.Dump;
|
||||
import org.snakeyaml.engine.v2.api.DumpSettings;
|
||||
import org.snakeyaml.engine.v2.common.FlowStyle;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -57,9 +58,9 @@ public class MutableFrontMatter extends LinkedHashMap<String,List<String>> {
|
||||
}
|
||||
|
||||
public String asYaml() {
|
||||
DumperOptions options = new DumperOptions();
|
||||
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
|
||||
Yaml yaml = new Yaml(options);
|
||||
return yaml.dump(Map.of(TITLE,getTitle(),WEIGHT,getWeight()));
|
||||
DumpSettings settings = DumpSettings.builder().setDefaultFlowStyle(FlowStyle.BLOCK).build();
|
||||
Dump dump = new Dump(settings);
|
||||
return dump.dumpToString(Map.of(TITLE,getTitle(),WEIGHT,getWeight()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user