minor stdout cleanups

This commit is contained in:
Jonathan Shook 2022-06-21 20:13:00 -05:00
parent ee8cafe356
commit ecabd71048
7 changed files with 165 additions and 15 deletions

55
adapter-stdout/pom.xml Normal file
View File

@ -0,0 +1,55 @@
<!--
~ 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">
<modelVersion>4.0.0</modelVersion>
<artifactId>adapter-stdout</artifactId>
<packaging>jar</packaging>
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>4.17.15-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
<name>${project.artifactId}</name>
<description>
An nosqlbench ActivityType (AT) driver module;
Provides basic formatting and output to stdout or files.
</description>
<dependencies>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-annotations</artifactId>
<version>4.17.15-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>adapters-api</artifactId>
<version>4.17.15-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,42 @@
/*
* 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.
*/
package io.nosqlbench.adapter.stdout;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.BaseDriverAdapter;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
@Service(value= DriverAdapter.class, selector = "stdout")
public class StdoutDriverAdapter extends BaseDriverAdapter<Op, Map<String,Object>> {
@Override
public OpMapper<Op> getOpMapper() {
return new StdoutOpMapper();
}
@Override
public Function<String, ? extends Map<String, Object>> getSpaceInitializer(NBConfiguration cfg) {
return name -> new ConcurrentHashMap<>(cfg.getMap());
}
}

View File

@ -0,0 +1,27 @@
/*
* 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.
*/
package io.nosqlbench.adapter.stdout;
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.RunnableOp;
public class StdoutOp implements RunnableOp {
@Override
public void run() {
}
}

View File

@ -14,22 +14,20 @@
* limitations under the License.
*/
package io.nosqlbench.engine.api.activityconfig.rawyaml;
package io.nosqlbench.adapter.stdout;
import java.util.ArrayList;
import java.util.Arrays;
import io.nosqlbench.engine.api.activityimpl.BaseOpDispenser;
import io.nosqlbench.engine.api.templating.ParsedOp;
public class TestBlock extends ArrayList<TestSet> {
public TestBlock(TestSet... testsets) {
this.addAll(Arrays.asList(testsets));
}
public class StdoutOpDispenser extends BaseOpDispenser <StdoutOp> {
public void addTestSet(TestSet set) {
this.add(set);
public StdoutOpDispenser(ParsedOp op) {
super(op);
}
@Override
public String toString() {
return (size()>0 ? get(0).toString() : "NONE");
public StdoutOp apply(long value) {
return null;
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.
*/
package io.nosqlbench.adapter.stdout;
import io.nosqlbench.engine.api.activityimpl.OpDispenser;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
import io.nosqlbench.engine.api.templating.ParsedOp;
public class StdoutOpMapper implements OpMapper<Op> {
@Override
public OpDispenser<? extends Op> apply(ParsedOp cmd) {
return new StdoutOpDispenser(cmd);
}
}

View File

@ -24,7 +24,7 @@ import io.nosqlbench.nb.annotations.Service;
import java.util.Optional;
@Service(value= ActivityType.class, selector="stdout")
@Service(value= ActivityType.class, selector="stdout-nb4")
public class StdoutActivityType implements ActivityType<StdoutActivity> {
@Override

View File

@ -19,10 +19,8 @@ package io.nosqlbench.adapters.stdout;
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
import io.nosqlbench.engine.api.activityimpl.OpMapper;
import io.nosqlbench.engine.api.activityimpl.uniform.BaseDriverAdapter;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
import io.nosqlbench.engine.api.activityimpl.uniform.DriverSpaceCache;
import io.nosqlbench.engine.api.templating.OpTemplateSupplier;
import io.nosqlbench.nb.annotations.Service;
import io.nosqlbench.nb.api.config.standard.ConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfigModel;
import io.nosqlbench.nb.api.config.standard.NBConfiguration;
@ -31,7 +29,6 @@ import java.util.List;
import java.util.Optional;
import java.util.function.Function;
@Service(value = DriverAdapter.class, selector = "stdoutadapter")
public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace> implements OpTemplateSupplier {
@Override