mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
make BundledApps implement primitive interface
This commit is contained in:
parent
b395f14918
commit
a0344d65c9
@ -27,7 +27,7 @@ public class RingAnalyzer implements BundledApp {
|
|||||||
private final static Logger logger = LogManager.getLogger(RingAnalyzer.class);
|
private final static Logger logger = LogManager.getLogger(RingAnalyzer.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
RingAnalyzerConfig cfg = new RingAnalyzerConfig();
|
RingAnalyzerConfig cfg = new RingAnalyzerConfig();
|
||||||
CommandLine cli = new CommandLine(cfg);
|
CommandLine cli = new CommandLine(cfg);
|
||||||
CommandLine.ParseResult cl = cli.parseArgs(args);
|
CommandLine.ParseResult cl = cli.parseArgs(args);
|
||||||
|
@ -86,11 +86,11 @@ public class CGWorkloadExporter implements BundledApp {
|
|||||||
private CGExporterConfig config;
|
private CGExporterConfig config;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new CGWorkloadExporter().appMain(args);
|
new CGWorkloadExporter().applyAsInt(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
this.config = new CGExporterConfig(args);
|
this.config = new CGExporterConfig(args);
|
||||||
|
|
||||||
logger.info("running CQL workload exporter with args:" + Arrays.toString(args));
|
logger.info("running CQL workload exporter with args:" + Arrays.toString(args));
|
||||||
|
@ -44,7 +44,7 @@ public class CqlParserHarnessTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testAllTypes() {
|
public void testAllTypes() {
|
||||||
CGWorkloadExporter exporter = new CGWorkloadExporter();
|
CGWorkloadExporter exporter = new CGWorkloadExporter();
|
||||||
exporter.appMain(new String[]{"src/test/resources/testschemas/cql_alltypes.cql","_alltypes.yaml"});
|
exporter.applyAsInt(new String[]{"src/test/resources/testschemas/cql_alltypes.cql","_alltypes.yaml"});
|
||||||
exporter.setNamingTemplate("[OPTYPE-][COLUMN-][TYPEDEF-][TABLE-]-[KEYSPACE]");
|
exporter.setNamingTemplate("[OPTYPE-][COLUMN-][TYPEDEF-][TABLE-]-[KEYSPACE]");
|
||||||
var data = exporter.getWorkloadAsYaml();
|
var data = exporter.getWorkloadAsYaml();
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class NBWebServerApp implements BundledApp {
|
|||||||
private static final Logger logger = LogManager.getLogger(NBWebServerApp.class);
|
private static final Logger logger = LogManager.getLogger(NBWebServerApp.class);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new NBWebServerApp().appMain(args);
|
new NBWebServerApp().applyAsInt(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean deleteDirectory(File directoryToBeDeleted) {
|
private static boolean deleteDirectory(File directoryToBeDeleted) {
|
||||||
@ -144,7 +144,7 @@ public class NBWebServerApp implements BundledApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
if (args.length > 0 && args[0].contains("help")) {
|
if (args.length > 0 && args[0].contains("help")) {
|
||||||
showHelp();
|
showHelp();
|
||||||
} else if (args.length > 0 && args[0].contains("generate")) {
|
} else if (args.length > 0 && args[0].contains("generate")) {
|
||||||
|
@ -182,7 +182,7 @@ public class NBCLI implements Function<String[], Integer> {
|
|||||||
String[] appargs = Arrays.copyOfRange(args, 1, args.length);
|
String[] appargs = Arrays.copyOfRange(args, 1, args.length);
|
||||||
logger.info("invoking bundled app '" + args[0] + "' (" + app.getClass().getSimpleName() + ").");
|
logger.info("invoking bundled app '" + args[0] + "' (" + app.getClass().getSimpleName() + ").");
|
||||||
globalOptions.setWantsStackTraces(true);
|
globalOptions.setWantsStackTraces(true);
|
||||||
int result = app.appMain(appargs);
|
int result = app.applyAsInt(appargs);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,11 @@ import java.util.List;
|
|||||||
public class BundledMarkdownExporter implements BundledApp {
|
public class BundledMarkdownExporter implements BundledApp {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new BundledMarkdownExporter().appMain(args);
|
new BundledMarkdownExporter().applyAsInt(args);
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
final OptionParser parser = new OptionParser();
|
final OptionParser parser = new OptionParser();
|
||||||
|
|
||||||
OptionSpec<String> zipfileSpec = parser.accepts("zipfile", "zip file to write to")
|
OptionSpec<String> zipfileSpec = parser.accepts("zipfile", "zip file to write to")
|
||||||
|
@ -37,7 +37,7 @@ public class MarkdownExporter implements BundledApp, Runnable {
|
|||||||
private Set<DocScope> scopeSet;
|
private Set<DocScope> scopeSet;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new MarkdownExporter().appMain(args);
|
new MarkdownExporter().applyAsInt(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,7 +48,7 @@ public class MarkdownExporter implements BundledApp, Runnable {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
final OptionParser parser = new OptionParser();
|
final OptionParser parser = new OptionParser();
|
||||||
|
|
||||||
OptionSpec<String> basedir = parser.accepts("basedir", "base directory to write to")
|
OptionSpec<String> basedir = parser.accepts("basedir", "base directory to write to")
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package io.nosqlbench.api.spi;
|
package io.nosqlbench.api.spi;
|
||||||
|
|
||||||
public interface BundledApp {
|
import java.util.function.ToIntFunction;
|
||||||
int appMain(String[] args);
|
|
||||||
|
public interface BundledApp extends ToIntFunction<String[]> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
<!--
|
||||||
|
~ Copyright (c) 2022 nosqlbench
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ public class VirtDataMainApp implements BundledApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
new VirtDataMainApp().appMain(args);
|
new VirtDataMainApp().applyAsInt(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int appMain(String[] args) {
|
public int applyAsInt(String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
System.out.println("Usage: app (" + APP_TESTMAPPER + "|" + APP_GENDOCS + "|" + APP_DIAGNOSE +")");
|
System.out.println("Usage: app (" + APP_TESTMAPPER + "|" + APP_GENDOCS + "|" + APP_DIAGNOSE +")");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.nosqlbench.virtdata.userlibs.apps.valuesapp;
|
package io.nosqlbench.virtdata.userlibs.apps.valuechecker;
|
||||||
|
|
||||||
import io.nosqlbench.virtdata.core.bindings.ResolverDiagnostics;
|
import io.nosqlbench.virtdata.core.bindings.ResolverDiagnostics;
|
||||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||||
@ -59,7 +59,7 @@ public class VirtDataCheckPerfApp {
|
|||||||
runData = checker.call();
|
runData = checker.call();
|
||||||
System.out.println(runData.toString());
|
System.out.println(runData.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Error while checking performance: " + e.toString(), e);
|
throw new RuntimeException("Error while checking performance: " + e, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user