post-merge fix-ups

This commit is contained in:
Jonathan Shook
2021-06-22 11:10:42 -05:00
339 changed files with 1331 additions and 1251 deletions

View File

@@ -1,19 +1,21 @@
- e8379cc9 (HEAD -> main) Merge branch 'main' of https://github.com/nosqlbench/nosqlbench into main - 663e3010 (HEAD -> main) correct test for current functional APIs
- e0838ff3 (origin/main) Merge pull request #322 from szimmer1/cockroachdb-driver-postgres-workload - e981f808 (origin/main) General improvements and bug-fixes. Thanks to @XN137
- 2c5624d2 add premade bindings example - 5b4a695f update ANTLR to 4.2.9 in all places
- 2cba9709 additional premade binding functions - 3b74ae20 General improvements and bug-fixes. Thanks to @XN137
- 78b23f0e add free and attributed zipcode data - 7c7ea039 post-merge fixups
- 0cd100d4 simplify CSV sampling usage - 9403f51f improve ToDate semantics and docs
- 4f2482ec localize flexmark to API module - 0edbfb1f fix test for TagFilter
- 2bcf47ca remove summary output until it is fixed - 365ad619 remove extraneous var in ActivityExecutor
- 0a3fc4fa remove non-release repo from pom - 34855a39 Merge pull request #336 from XN137/fix-errorprone-errors
- 581fbf74 fix broken version link - 60ff1d9c Merge pull request #335 from XN137/avoid-threadsafety-warnings
- d2fc94b8 avoid NPE in ElemProbD - c5caf51a Merge pull request #334 from XN137/remove-junit4-dependency
- e4cf4c49 Adds postgres-basic workload and scenarios as the cockroachdb driver is compatible with postgres - a02df22d Merge pull request #333 from XN137/jdk-string-join
- ba5d6025 Merge branch 'main' of https://github.com/nosqlbench/nosqlbench into main - 950b31fb fix errors found by errorprone
- 5497e20f Merge pull request #321 from dougwettlaufer/update-gql-schema-first - b98451ab upgrade antlr4-maven-plugin to v4.9.2 avoid threadsafety warnings
- eaddc4f0 Update schema-first workloads to reflect latest api - 5e8e6bf1 use assertj v3.19.0
- 3607b804 Merge branch 'main' of https://github.com/nosqlbench/nosqlbench into main - 8dcac028 use junit5 v5.7.2 with proper scoping
- afdfc715 Merge pull request #320 from EricBorczuk/add-jsonapi-workload - 2cd393ae use junit5 apis to remove junit4 dependency
- 91578c52 Add JSON API keyvalue workload - 0e68abf1 prefer jdk over lib internals for String join
- 2efc5469 Merge branch 'main' of https://github.com/nosqlbench/nosqlbench into main - dc1c6c5e Merge pull request #332 from XN137/fix-virtdata-api-test-folder
- 6232edff move virtdata-api tests to correct folder
- re-run of github actions due to storage error

View File

@@ -9,7 +9,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId> <artifactId>nb-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -36,7 +36,7 @@
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId> <artifactId>jetty-servlets</artifactId>
<version>11.0.1</version> <version>11.0.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
@@ -114,7 +114,7 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId> <artifactId>virtdata-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -180,12 +180,6 @@ public class DocsysMarkdownEndpoint implements WebServiceObject {
} }
private void enable(Set<String> enabled) { private void enable(Set<String> enabled) {
Set<String> toEnable = new HashSet<>();
if (this.enables !=null) {
toEnable.addAll(this.enables);
}
for (DocsNameSpace nsinfo : docsinfo) { for (DocsNameSpace nsinfo : docsinfo) {
// add namespaces which are neither enabled nor disabled to the default group // add namespaces which are neither enabled nor disabled to the default group
if (nsinfo.isEnabledByDefault()) { if (nsinfo.isEnabledByDefault()) {
@@ -204,6 +198,4 @@ public class DocsysMarkdownEndpoint implements WebServiceObject {
this.enabled = disabled.remove(enabled); this.enabled = disabled.remove(enabled);
} }
} }
} }

View File

@@ -1,7 +1,7 @@
package io.nosqlbench.docsys.core; package io.nosqlbench.docsys.core;
import io.nosqlbench.docsys.endpoints.DocsysMarkdownEndpoint; import io.nosqlbench.docsys.endpoints.DocsysMarkdownEndpoint;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class DocsysMarkdownLoaderEndpointTest { public class DocsysMarkdownLoaderEndpointTest {

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -21,7 +21,7 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-jdbc</artifactId> <artifactId>driver-jdbc</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>

View File

@@ -2,14 +2,14 @@ package io.nosqlbench.activitytype.cockroachdb;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap; import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState; import org.postgresql.util.PSQLState;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.sql.SQLException; import java.sql.SQLException;
import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertEquals;
public class CockroachActivityTest { public class CockroachActivityTest {
@Test @Test

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -23,13 +23,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -70,7 +70,7 @@
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId> <artifactId>antlr4-runtime</artifactId>
<version>4.8</version> <version>4.9.2</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -142,7 +142,6 @@
<plugin> <plugin>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId> <artifactId>antlr4-maven-plugin</artifactId>
<version>4.8</version>
<configuration> <configuration>
<sourceDirectory>src/main/grammars/cql3 <sourceDirectory>src/main/grammars/cql3
</sourceDirectory> </sourceDirectory>

View File

@@ -75,13 +75,12 @@ public class DateRangeFunc implements LongFunction<DateRange> {
this.upper = upper; this.upper = upper;
} }
@Override @Override
public DateRange apply(long value) { public DateRange apply(long value) {
Date lowerDate = new Date(lower.applyAsLong(value)); Date lowerDate = new Date(lower.applyAsLong(value));
DateRange.DateRangeBound lower = DateRange.DateRangeBound.lowerBound(lowerDate,precision); DateRange.DateRangeBound lower = DateRange.DateRangeBound.lowerBound(lowerDate,precision);
Date upperDate = new Date(upper.applyAsLong(value)); Date upperDate = new Date(upper.applyAsLong(value));
DateRange.DateRangeBound upper = DateRange.DateRangeBound.upperBound(lowerDate,precision); DateRange.DateRangeBound upper = DateRange.DateRangeBound.upperBound(upperDate,precision);
DateRange dateRange = new DateRange(lower, upper); DateRange dateRange = new DateRange(lower, upper);
return dateRange; return dateRange;
} }

View File

@@ -30,8 +30,6 @@ public class AvailableCQLStatements {
} }
public List<CQLStatementDefParser> getMatching(String tagSpec) { public List<CQLStatementDefParser> getMatching(String tagSpec) {
List<CQLStatementDefParser> defs = new ArrayList<>();
TagFilter ts = new TagFilter(tagSpec); TagFilter ts = new TagFilter(tagSpec);
List<CQLStatementDefParser> CQLStatementDefParsers = List<CQLStatementDefParser> CQLStatementDefParsers =
availableDefs.stream() availableDefs.stream()

View File

@@ -21,17 +21,24 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOError;
import java.io.IOException; import java.io.IOException;
import java.net.Inet6Address; import java.net.Inet6Address;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.*;
import org.apache.commons.codec.digest.DigestUtils;
public class CQLSessionCache implements Shutdownable { public class CQLSessionCache implements Shutdownable {
private final static Logger logger = LogManager.getLogger(CQLSessionCache.class); private final static Logger logger = LogManager.getLogger(CQLSessionCache.class);
@@ -79,8 +86,8 @@ public class CQLSessionCache implements Shutdownable {
Optional<String> scb = activityDef.getParams() Optional<String> scb = activityDef.getParams()
.getOptionalString("secureconnectbundle"); .getOptionalString("secureconnectbundle");
scb.map(File::new)
.ifPresent(builder::withCloudSecureConnectBundle); scb.map(this::maybeConvertUrlToFile).ifPresent(builder::withCloudSecureConnectBundle);
activityDef.getParams() activityDef.getParams()
.getOptionalString("insights").map(Boolean::parseBoolean) .getOptionalString("insights").map(Boolean::parseBoolean)
@@ -313,7 +320,7 @@ public class CQLSessionCache implements Shutdownable {
Cluster cl = builder.build(); Cluster cl = builder.build();
// Apply default idempotence, if set // Apply default idempotence, if set
activityDef.getParams().getOptionalBoolean("defaultidempotence").map( activityDef.getParams().getOptionalBoolean("defaultidempotence").ifPresent(
b -> cl.getConfiguration().getQueryOptions().setDefaultIdempotence(b) b -> cl.getConfiguration().getQueryOptions().setDefaultIdempotence(b)
); );
@@ -340,4 +347,35 @@ public class CQLSessionCache implements Shutdownable {
cluster.close(); cluster.close();
} }
} }
File maybeConvertUrlToFile(String b) {
try {
URL url = new URL(b);
if (url.getProtocol().startsWith("http")) {
File tmp = Paths.get(System.getProperty("java.io.tmpdir"), "scb-" + DigestUtils.sha1Hex(b) + ".zip").toFile();
if (tmp.exists())
return tmp;
try (BufferedInputStream inputStream = new BufferedInputStream(url.openStream());
FileOutputStream fileOS = new FileOutputStream(tmp)) {
byte[] data = new byte[1024];
int byteContent;
while ((byteContent = inputStream.read(data, 0, 1024)) != -1) {
fileOS.write(data, 0, byteContent);
}
}
catch (IOException ex) {
tmp.delete();
throw new IOError(ex);
}
logger.info("Downloaded {} to {}", b, tmp.getAbsoluteFile());
return tmp;
}
}
catch (MalformedURLException e) {
//Not a url
}
return new File(b);
}
} }

View File

@@ -12,30 +12,18 @@ public class CQLStatementDefParser {
private final static Logger logger = LogManager.getLogger(CQLStatementDefParser.class); private final static Logger logger = LogManager.getLogger(CQLStatementDefParser.class);
// private final static Pattern templateToken = Pattern.compile("<<(\\w+(:(.+?))?)>>"); // private final static Pattern templateToken = Pattern.compile("<<(\\w+(:(.+?))?)>>");
private final static Pattern stmtToken = Pattern.compile("\\?(\\w+[-_\\d\\w]*)|\\{(\\w+[-_\\d\\w.]*)}"); private final static Pattern stmtToken = Pattern.compile("\\?(\\w+[-_\\d\\w]*)|\\{(\\w+[-_\\d\\w.]*)}");
private final static String UNSET_VALUE = "UNSET-VALUE";
private final String stmt; private final String stmt;
private final String name; private final String name;
private CQLStatementDef deprecatedDef; // deprecated, to be removed
public void setBindings(Map<String, String> bindings) { public void setBindings(Map<String, String> bindings) {
this.bindings = bindings; this.bindings = bindings;
} }
private Map<String, String> bindings; private Map<String, String> bindings;
public CQLStatementDef getDeprecatedDef() {
return deprecatedDef;
}
public void setDeprecatedDef(CQLStatementDef deprecatedDef) {
this.deprecatedDef = deprecatedDef;
}
public CQLStatementDefParser(String name, String stmt) { public CQLStatementDefParser(String name, String stmt) {
this.stmt = stmt; this.stmt = stmt;
this.name = name; this.name = name;
this.bindings = bindings;
} }
public Map<String,String> getBindings() { public Map<String,String> getBindings() {
@@ -64,7 +52,7 @@ public class CQLStatementDefParser {
public String getParsedStatementOrError(Set<String> namedBindings) { public String getParsedStatementOrError(Set<String> namedBindings) {
ParseResult result = getParseResult(namedBindings); ParseResult result = getParseResult(namedBindings);
if (result.hasError()) { if (result.hasError()) {
throw new RuntimeException("Statement template has errors:\n" + result.toString()); throw new RuntimeException("Statement template has errors:\n" + result);
} }
return result.getStatement(); return result.getStatement();
} }
@@ -115,13 +103,14 @@ public class CQLStatementDefParser {
private final Set<String> missingGenerators; private final Set<String> missingGenerators;
private final Set<String> missingAnchors; private final Set<String> missingAnchors;
private final String statement; private final String statement;
private Map<String,String> bindings; private final Map<String,String> bindings;
private final String name; private final String name;
public ParseResult(String stmt, String name, Map<String,String> bindings, Set<String> missingGenerators, Set<String> missingAnchors) { public ParseResult(String stmt, String name, Map<String,String> bindings, Set<String> missingGenerators, Set<String> missingAnchors) {
this.missingGenerators = missingGenerators; this.missingGenerators = missingGenerators;
this.missingAnchors = missingAnchors; this.missingAnchors = missingAnchors;
this.statement = stmt; this.statement = stmt;
this.bindings = bindings;
this.name = name; this.name = name;
} }

View File

@@ -23,7 +23,7 @@ public enum DiffType {
/// the actual data. /// the actual data.
all(0x1|0x1<<1|0x1<<2); all(0x1|0x1<<1|0x1<<2);
public int bitmask; public final int bitmask;
DiffType(int bit) { DiffType(int bit) {
this.bitmask = bit; this.bitmask = bit;

View File

@@ -3,13 +3,13 @@ package com.datastax.ebdrivers.cql;
import io.nosqlbench.activitytype.cql.core.CqlAction; import io.nosqlbench.activitytype.cql.core.CqlAction;
import io.nosqlbench.activitytype.cql.core.CqlActivity; import io.nosqlbench.activitytype.cql.core.CqlActivity;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class CqlActionTest { public class CqlActionTest {
@Test @Test
@Ignore @Disabled
public void testCqlAction() { public void testCqlAction() {
ActivityDef ad = ActivityDef.parseActivityDef("driver=ebdrivers;alias=foo;yaml=write-telemetry.yaml;"); ActivityDef ad = ActivityDef.parseActivityDef("driver=ebdrivers;alias=foo;yaml=write-telemetry.yaml;");
CqlActivity cac = new CqlActivity(ad); CqlActivity cac = new CqlActivity(ad);

View File

@@ -1,7 +1,7 @@
package com.datastax.ebdrivers.cql.statements; package com.datastax.ebdrivers.cql.statements;
import io.nosqlbench.activitytype.cql.statements.core.CQLStatementDefParser; import io.nosqlbench.activitytype.cql.statements.core.CQLStatementDefParser;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

View File

@@ -8,7 +8,7 @@ import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.datastax.driver.core.policies.RetryPolicy; import com.datastax.driver.core.policies.RetryPolicy;
import com.datastax.driver.core.policies.SpeculativeExecutionPolicy; import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
import io.nosqlbench.activitytype.cql.core.CQLOptions; import io.nosqlbench.activitytype.cql.core.CQLOptions;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.activitytype.cql.core; package io.nosqlbench.activitytype.cql.core;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -3,7 +3,7 @@ package io.nosqlbench.activitytype.cql.datamappers.functions.double_to_cqldurati
import com.datastax.driver.core.Duration; import com.datastax.driver.core.Duration;
import io.nosqlbench.activitytype.cql.datamappers.functions.long_to_cqlduration.CqlDurationFunctions; import io.nosqlbench.activitytype.cql.datamappers.functions.long_to_cqlduration.CqlDurationFunctions;
import io.nosqlbench.activitytype.cql.datamappers.functions.long_to_cqlduration.ToCqlDurationNanos; import io.nosqlbench.activitytype.cql.datamappers.functions.long_to_cqlduration.ToCqlDurationNanos;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.function.LongToIntFunction; import java.util.function.LongToIntFunction;
import java.util.function.LongUnaryOperator; import java.util.function.LongUnaryOperator;

View File

@@ -1,7 +1,7 @@
package io.nosqlbench.activitytype.cql.datamappers.functions.long_localdate; package io.nosqlbench.activitytype.cql.datamappers.functions.long_localdate;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.activitytype.cql.datamappers.functions.to_daterange; package io.nosqlbench.activitytype.cql.datamappers.functions.to_daterange;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.LongFunction; import java.util.function.LongFunction;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.generators.cql.lang; package io.nosqlbench.generators.cql.lang;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@@ -9,6 +9,7 @@ import java.nio.file.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
public class ParserForCqlTest { public class ParserForCqlTest {
@@ -37,15 +38,14 @@ public class ParserForCqlTest {
URL url = resources.nextElement(); URL url = resources.nextElement();
System.out.println("url=" + url.toExternalForm()); System.out.println("url=" + url.toExternalForm());
Path path = Paths.get(url.toURI()); Path path = Paths.get(url.toURI());
Files.walk(path, FileVisitOption.FOLLOW_LINKS) try (Stream<Path> fileStream = Files.walk(path, FileVisitOption.FOLLOW_LINKS)) {
.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS)) fileStream.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS))
.forEach(subpaths::add); .forEach(subpaths::add);
}
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return subpaths; return subpaths;
} }
} }

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -24,13 +24,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -66,7 +66,7 @@
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId> <artifactId>antlr4-runtime</artifactId>
<version>4.8</version> <version>4.9.2</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -138,7 +138,6 @@
<plugin> <plugin>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId> <artifactId>antlr4-maven-plugin</artifactId>
<version>4.8</version>
<configuration> <configuration>
<sourceDirectory>src/main/grammars/cql3 <sourceDirectory>src/main/grammars/cql3
</sourceDirectory> </sourceDirectory>

View File

@@ -30,8 +30,6 @@ public class AvailableCQLStatements {
} }
public List<CQLStatementDefParser> getMatching(String tagSpec) { public List<CQLStatementDefParser> getMatching(String tagSpec) {
List<CQLStatementDefParser> defs = new ArrayList<>();
TagFilter ts = new TagFilter(tagSpec); TagFilter ts = new TagFilter(tagSpec);
List<CQLStatementDefParser> CQLStatementDefParsers = List<CQLStatementDefParser> CQLStatementDefParsers =
availableDefs.stream() availableDefs.stream()

View File

@@ -304,7 +304,7 @@ public class CQLSessionCache implements Shutdownable {
Cluster cl = builder.build(); Cluster cl = builder.build();
// Apply default idempotence, if set // Apply default idempotence, if set
activityDef.getParams().getOptionalBoolean("defaultidempotence").map( activityDef.getParams().getOptionalBoolean("defaultidempotence").ifPresent(
b -> cl.getConfiguration().getQueryOptions().setDefaultIdempotence(b) b -> cl.getConfiguration().getQueryOptions().setDefaultIdempotence(b)
); );

View File

@@ -12,30 +12,18 @@ public class CQLStatementDefParser {
private final static Logger logger = LogManager.getLogger(CQLStatementDefParser.class); private final static Logger logger = LogManager.getLogger(CQLStatementDefParser.class);
// private final static Pattern templateToken = Pattern.compile("<<(\\w+(:(.+?))?)>>"); // private final static Pattern templateToken = Pattern.compile("<<(\\w+(:(.+?))?)>>");
private final static Pattern stmtToken = Pattern.compile("\\?(\\w+[-_\\d\\w]*)|\\{(\\w+[-_\\d\\w.]*)}"); private final static Pattern stmtToken = Pattern.compile("\\?(\\w+[-_\\d\\w]*)|\\{(\\w+[-_\\d\\w.]*)}");
private final static String UNSET_VALUE = "UNSET-VALUE";
private final String stmt; private final String stmt;
private final String name; private final String name;
private CQLStatementDef deprecatedDef; // deprecated, to be removed
public void setBindings(Map<String, String> bindings) { public void setBindings(Map<String, String> bindings) {
this.bindings = bindings; this.bindings = bindings;
} }
private Map<String, String> bindings; private Map<String, String> bindings;
public CQLStatementDef getDeprecatedDef() {
return deprecatedDef;
}
public void setDeprecatedDef(CQLStatementDef deprecatedDef) {
this.deprecatedDef = deprecatedDef;
}
public CQLStatementDefParser(String name, String stmt) { public CQLStatementDefParser(String name, String stmt) {
this.stmt = stmt; this.stmt = stmt;
this.name = name; this.name = name;
this.bindings = bindings;
} }
public Map<String,String> getBindings() { public Map<String,String> getBindings() {
@@ -64,7 +52,7 @@ public class CQLStatementDefParser {
public String getParsedStatementOrError(Set<String> namedBindings) { public String getParsedStatementOrError(Set<String> namedBindings) {
ParseResult result = getParseResult(namedBindings); ParseResult result = getParseResult(namedBindings);
if (result.hasError()) { if (result.hasError()) {
throw new RuntimeException("Statement template has errors:\n" + result.toString()); throw new RuntimeException("Statement template has errors:\n" + result);
} }
return result.getStatement(); return result.getStatement();
} }

View File

@@ -23,7 +23,7 @@ public enum DiffType {
/// the actual data. /// the actual data.
all(0x1|0x1<<1|0x1<<2); all(0x1|0x1<<1|0x1<<2);
public int bitmask; public final int bitmask;
DiffType(int bit) { DiffType(int bit) {
this.bitmask = bit; this.bitmask = bit;

View File

@@ -3,13 +3,13 @@ package com.datastax.ebdrivers.cql;
import io.nosqlbench.activitytype.cql.core.CqlAction; import io.nosqlbench.activitytype.cql.core.CqlAction;
import io.nosqlbench.activitytype.cql.core.CqlActivity; import io.nosqlbench.activitytype.cql.core.CqlActivity;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class CqlActionTest { public class CqlActionTest {
@Test @Test
@Ignore @Disabled
public void testCqlAction() { public void testCqlAction() {
ActivityDef ad = ActivityDef.parseActivityDef("driver=ebdrivers;alias=foo;yaml=write-telemetry.yaml;"); ActivityDef ad = ActivityDef.parseActivityDef("driver=ebdrivers;alias=foo;yaml=write-telemetry.yaml;");
CqlActivity cac = new CqlActivity(ad); CqlActivity cac = new CqlActivity(ad);

View File

@@ -1,7 +1,7 @@
package com.datastax.ebdrivers.cql.statements; package com.datastax.ebdrivers.cql.statements;
import io.nosqlbench.activitytype.cql.statements.core.CQLStatementDefParser; import io.nosqlbench.activitytype.cql.statements.core.CQLStatementDefParser;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

View File

@@ -8,7 +8,7 @@ import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.datastax.driver.core.policies.RetryPolicy; import com.datastax.driver.core.policies.RetryPolicy;
import com.datastax.driver.core.policies.SpeculativeExecutionPolicy; import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
import io.nosqlbench.activitytype.cql.core.CQLOptions; import io.nosqlbench.activitytype.cql.core.CQLOptions;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.activitytype.cql.core; package io.nosqlbench.activitytype.cql.core;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.generators.cql.lang; package io.nosqlbench.generators.cql.lang;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@@ -9,6 +9,7 @@ import java.nio.file.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
public class ParserForCqlTest { public class ParserForCqlTest {
@@ -37,15 +38,14 @@ public class ParserForCqlTest {
URL url = resources.nextElement(); URL url = resources.nextElement();
System.out.println("url=" + url.toExternalForm()); System.out.println("url=" + url.toExternalForm());
Path path = Paths.get(url.toURI()); Path path = Paths.get(url.toURI());
Files.walk(path, FileVisitOption.FOLLOW_LINKS) try (Stream<Path> fileStream = Files.walk(path, FileVisitOption.FOLLOW_LINKS)) {
.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS)) fileStream.filter(p -> !Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS))
.forEach(subpaths::add); .forEach(subpaths::add);
}
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return subpaths; return subpaths;
} }
} }

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -23,19 +23,19 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId> <artifactId>virtdata-lib-basics</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -24,13 +24,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-cql-shaded</artifactId> <artifactId>driver-cql-shaded</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -3,6 +3,7 @@ package io.nosqlbench.activitytype.cqlverify;
import io.nosqlbench.activitytype.cql.core.CqlActivity; import io.nosqlbench.activitytype.cql.core.CqlActivity;
import io.nosqlbench.activitytype.cql.statements.rsoperators.AssertSingleRowResultSet; import io.nosqlbench.activitytype.cql.statements.rsoperators.AssertSingleRowResultSet;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@@ -22,27 +23,26 @@ public class CqlVerifyActivity extends CqlActivity {
@Override @Override
public synchronized void initActivity() { public synchronized void initActivity() {
if (!super.getActivityDef().getParams().contains("verify") && ParameterMap activityParams = super.getActivityDef().getParams();
!super.getActivityDef().getParams().contains("verify-fields")) { if (!activityParams.containsKey("verify") &&
!activityParams.containsKey("verify-fields")) {
logger.info("Pre-configuring activity param 'verify=*' since none was provided."); logger.info("Pre-configuring activity param 'verify=*' since none was provided.");
logger.info("To control this on a per-statement basis, use the verify param."); logger.info("To control this on a per-statement basis, use the verify param.");
super.getActivityDef().getParams().put("verify", "*"); activityParams.put("verify", "*");
} }
if (!super.getActivityDef().getParams().contains("compare")) { if (!activityParams.containsKey("compare")) {
super.getActivityDef().getParams().put("compare", "all"); activityParams.put("compare", "all");
logger.info("Pre-configuring activity param 'compare=all' since none was provided."); logger.info("Pre-configuring activity param 'compare=all' since none was provided.");
logger.info("To control this on a per-statement basis, use the compare param."); logger.info("To control this on a per-statement basis, use the compare param.");
} }
super.initActivity(); super.initActivity();
} }
@Override @Override
public void onActivityDefUpdate(ActivityDef activityDef) { public void onActivityDefUpdate(ActivityDef activityDef) {
super.onActivityDefUpdate(activityDef); super.onActivityDefUpdate(activityDef);
addResultSetCycleOperator(new AssertSingleRowResultSet()); addResultSetCycleOperator(new AssertSingleRowResultSet());
} }
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -20,13 +20,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -4,7 +4,7 @@ import io.nosqlbench.engine.api.activityapi.core.Action;
import io.nosqlbench.engine.api.activityapi.core.ActionDispenser; import io.nosqlbench.engine.api.activityapi.core.ActionDispenser;
import io.nosqlbench.engine.api.activityapi.core.SyncAction; import io.nosqlbench.engine.api.activityapi.core.SyncAction;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Test; import org.junit.jupiter.api.Test;
/* /*
* Copyright 2016 jshook * Copyright 2016 jshook

View File

@@ -17,7 +17,7 @@
package io.nosqlbench.activitytype.diag; package io.nosqlbench.activitytype.diag;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.io.PrintStream; import java.io.PrintStream;
@@ -39,7 +39,7 @@ public class SequenceBlockerTest {
private final static class Printer implements Runnable { private final static class Printer implements Runnable {
private PrintStream printStream; private final PrintStream printStream;
private final String out; private final String out;
public Printer(PrintStream printStream, String out) { public Printer(PrintStream printStream, String out) {
@@ -54,4 +54,4 @@ public class SequenceBlockerTest {
} }
} }

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -21,12 +21,12 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -23,13 +23,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -70,7 +70,7 @@
<dependency> <dependency>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId> <artifactId>antlr4-runtime</artifactId>
<version>4.8</version> <version>4.9.2</version>
</dependency> </dependency>
<!-- <dependency>--> <!-- <dependency>-->
@@ -174,7 +174,6 @@
<plugin> <plugin>
<groupId>org.antlr</groupId> <groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId> <artifactId>antlr4-maven-plugin</artifactId>
<version>4.8</version>
<configuration> <configuration>
<sourceDirectory>src/main/grammars/cql3 <sourceDirectory>src/main/grammars/cql3
</sourceDirectory> </sourceDirectory>

View File

@@ -212,7 +212,7 @@ public class GraphActivity extends SimpleActivity implements ActivityDefObserver
logger.error("Error while instantiating cluster from builder: " + e, e); logger.error("Error while instantiating cluster from builder: " + e, e);
throw e; throw e;
} }
activityDef.getParams().getOptionalBoolean("defaultidempotence").map( activityDef.getParams().getOptionalBoolean("defaultidempotence").ifPresent(
b -> cluster.getConfiguration().getQueryOptions().setDefaultIdempotence(b) b -> cluster.getConfiguration().getQueryOptions().setDefaultIdempotence(b)
); );

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults/pom.xml</relativePath> <relativePath>../mvn-defaults/pom.xml</relativePath>
</parent> </parent>
@@ -21,13 +21,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -22,13 +22,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -1,7 +1,7 @@
package io.nosqlbench.activitytype.cmds; package io.nosqlbench.activitytype.cmds;
import io.nosqlbench.nb.api.errors.BasicError; import io.nosqlbench.nb.api.errors.BasicError;
import io.nosqlbench.virtdata.core.templates.ParsedTemplate; import io.nosqlbench.virtdata.core.templates.BindPointParser;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@@ -90,7 +90,7 @@ public class HttpFormatParser {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String input = template; String input = template;
Matcher matcher = ParsedTemplate.STANDARD_ANCHOR.matcher(input); Matcher matcher = BindPointParser.BINDPOINT_ANCHOR.matcher(input);
int idx = 0; int idx = 0;
while (matcher.find()) { while (matcher.find()) {
String pre = input.substring(idx, matcher.start()); String pre = input.substring(idx, matcher.start());

View File

@@ -108,7 +108,6 @@ public class HttpConsoleFormats {
} }
long mod = 1L; long mod = 1L;
Set<String> incl = new HashSet<>();
long mask = 0L; long mask = 0L;
for (String include : filterSet) { for (String include : filterSet) {

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.activitytype.cmds; package io.nosqlbench.activitytype.cmds;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.Map; import java.util.Map;

View File

@@ -3,7 +3,7 @@ package io.nosqlbench.activitytype.cmds;
import io.nosqlbench.engine.api.activityconfig.StatementsLoader; import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate; import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList; import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.util.Map; import java.util.Map;

View File

@@ -3,7 +3,7 @@ package io.nosqlbench.activitytype.http;
import io.nosqlbench.engine.api.activityapi.core.Action; import io.nosqlbench.engine.api.activityapi.core.Action;
import io.nosqlbench.engine.api.activityapi.core.ActionDispenser; import io.nosqlbench.engine.api.activityapi.core.ActionDispenser;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class HttpActivityTypeTest { public class HttpActivityTypeTest {
@Test @Test

View File

@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>nosqlbench</artifactId> <artifactId>nosqlbench</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -12,7 +12,7 @@ public class ReadyJDBCOp implements OpDispenser<String> {
public ReadyJDBCOp(OpTemplate stmtDef) { public ReadyJDBCOp(OpTemplate stmtDef) {
ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings()); ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings());
BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getCheckedBindPoints()); BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getBindPoints());
StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings); StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings);
bindings = template.resolve(); bindings = template.resolve();

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -40,13 +40,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-stdout</artifactId> <artifactId>driver-stdout</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 --> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->

View File

@@ -116,13 +116,16 @@ public class JmsActivity extends SimpleActivity {
); );
} }
private static String buildCacheKey(String... keyParts) {
return String.join("::", keyParts);
}
/** /**
* If the JMS destination that corresponds to a topic exists, reuse it; Otherwise, create it * If the JMS destination that corresponds to a topic exists, reuse it; Otherwise, create it
*/ */
public Destination getOrCreateJmsDestination(String jmsDestinationType, String destName) { public Destination getOrCreateJmsDestination(String jmsDestinationType, String destName) {
String encodedTopicStr = String destinationCacheKey = buildCacheKey(jmsDestinationType, destName);
JmsUtil.encode(jmsDestinationType, destName); Destination destination = jmsDestinations.get(destinationCacheKey);
Destination destination = jmsDestinations.get(encodedTopicStr);
if ( destination == null ) { if ( destination == null ) {
// TODO: should we match Persistent/Non-peristent JMS Delivery mode with // TODO: should we match Persistent/Non-peristent JMS Delivery mode with
@@ -133,7 +136,7 @@ public class JmsActivity extends SimpleActivity {
destination = jmsContext.createTopic(destName); destination = jmsContext.createTopic(destName);
} }
jmsDestinations.put(encodedTopicStr, destination); jmsDestinations.put(destinationCacheKey, destination);
} }
return destination; return destination;

View File

@@ -108,11 +108,10 @@ public class JmsMsgSendOp extends JmsTimeTrackOp {
@Override @Override
public void run() { public void run() {
int messageSize;
try { try {
byte[] msgBytes = msgBody.getBytes(StandardCharsets.UTF_8); byte[] msgBytes = msgBody.getBytes(StandardCharsets.UTF_8);
messageSize = msgBytes.length; int messageSize = msgBytes.length;
jmsProducer.send(jmsDestination, msgBody.getBytes(StandardCharsets.UTF_8)); jmsProducer.send(jmsDestination, msgBytes);
messagesizeHistogram.update(messageSize); messagesizeHistogram.update(messageSize);
bytesCounter.inc(messageSize); bytesCounter.inc(messageSize);

View File

@@ -1,11 +1,9 @@
package io.nosqlbench.driver.jms.util; package io.nosqlbench.driver.jms.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
public class JmsUtil { public class JmsUtil {
@@ -102,18 +100,5 @@ public class JmsUtil {
public static boolean isValidJmsDestinationType(String type) { public static boolean isValidJmsDestinationType(String type) {
return Arrays.stream(JMS_DESTINATION_TYPES.values()).anyMatch(t -> t.label.equals(type)); return Arrays.stream(JMS_DESTINATION_TYPES.values()).anyMatch(t -> t.label.equals(type));
} }
public static String encode(String... strings) {
StringBuilder stringBuilder = new StringBuilder();
for (String str : strings) {
if (!StringUtils.isBlank(str))
stringBuilder.append(str).append("::");
}
String concatenatedStr =
StringUtils.substringBeforeLast(stringBuilder.toString(), "::");
return Base64.getEncoder().encodeToString(concatenatedStr.getBytes());
}
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -22,13 +22,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.driver.jmx; package io.nosqlbench.driver.jmx;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -44,13 +44,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-stdout</artifactId> <artifactId>driver-stdout</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<!-- <dependency>--> <!-- <dependency>-->

View File

@@ -33,7 +33,7 @@ public class KafkaStatement {
public KafkaStatement(OpTemplate stmtDef, String servers, String clientId, String schemaRegistryUrl) { public KafkaStatement(OpTemplate stmtDef, String servers, String clientId, String schemaRegistryUrl) {
ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings()); ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings());
BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getCheckedBindPoints()); BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getBindPoints());
StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings); StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings);
this.bindings = template.resolve(); this.bindings = template.resolve();

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -21,13 +21,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -16,7 +16,7 @@ public class ReadyMongoStatement {
public ReadyMongoStatement(OpTemplate stmtDef) { public ReadyMongoStatement(OpTemplate stmtDef) {
ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings()); ParsedTemplate paramTemplate = new ParsedTemplate(stmtDef.getStmt(), stmtDef.getBindings());
BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getCheckedBindPoints()); BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getBindPoints());
StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings); StringBindingsTemplate template = new StringBindingsTemplate(stmtDef.getStmt(), paramBindings);
this.bindings = template.resolve(); this.bindings = template.resolve();

View File

@@ -1,7 +1,7 @@
package io.nosqlbench.driver.mongodb; package io.nosqlbench.driver.mongodb;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import io.nosqlbench.engine.api.activityapi.planning.OpSequence; import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
@@ -12,7 +12,7 @@ public class MongoActivityTest {
private ActivityDef activityDef; private ActivityDef activityDef;
@Before @BeforeEach
public void setup() { public void setup() {
String[] params = { String[] params = {
"yaml=activities/mongodb-basic.yaml", "yaml=activities/mongodb-basic.yaml",

View File

@@ -10,8 +10,8 @@ import io.nosqlbench.virtdata.core.templates.BindPoint;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.bson.conversions.Bson; import org.bson.conversions.Bson;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -25,7 +25,7 @@ public class ReadyMongoStatementTest {
private ActivityDef activityDef; private ActivityDef activityDef;
private StmtsDocList stmtsDocList; private StmtsDocList stmtsDocList;
@Before @BeforeEach
public void setup() { public void setup() {
String[] params = { String[] params = {
"yaml=activities/mongodb-basic.yaml", "yaml=activities/mongodb-basic.yaml",

View File

@@ -4,7 +4,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -40,13 +40,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-stdout</artifactId> <artifactId>driver-stdout</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils --> <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->

View File

@@ -197,6 +197,6 @@ public class PulsarActivity extends SimpleActivity implements ActivityDefObserve
} }
public void asyncOperationFailed(Throwable ex) { public void asyncOperationFailed(Throwable ex) {
this.asyncOperationFailure = asyncOperationFailure; this.asyncOperationFailure = ex;
} }
} }

View File

@@ -216,7 +216,7 @@ public class PulsarSpace {
public Supplier<Transaction> getTransactionSupplier() { public Supplier<Transaction> getTransactionSupplier() {
PulsarClient pulsarClient = getPulsarClient(); PulsarClient pulsarClient = getPulsarClient();
return () -> { return () -> {
try (Timer.Context time = createTransactionTimer.time(); ){ try (Timer.Context time = createTransactionTimer.time()){
return pulsarClient return pulsarClient
.newTransaction() .newTransaction()
.build() .build()
@@ -233,6 +233,9 @@ public class PulsarSpace {
}; };
} }
private static String buildCacheKey(String... keyParts) {
return String.join("::", keyParts);
}
public Producer<?> getProducer(String cycleTopicName, String cycleProducerName) { public Producer<?> getProducer(String cycleTopicName, String cycleProducerName) {
String topicName = getEffectiveProducerTopicName(cycleTopicName); String topicName = getEffectiveProducerTopicName(cycleTopicName);
@@ -242,8 +245,8 @@ public class PulsarSpace {
throw new RuntimeException("Producer:: must specify a topic name either at the global level or the cycle level"); throw new RuntimeException("Producer:: must specify a topic name either at the global level or the cycle level");
} }
String encodedStr = PulsarActivityUtil.encode(producerName, topicName); String producerCacheKey = buildCacheKey(producerName, topicName);
Producer<?> producer = producers.get(encodedStr); Producer<?> producer = producers.get(producerCacheKey);
if (producer == null) { if (producer == null) {
PulsarClient pulsarClient = getPulsarClient(); PulsarClient pulsarClient = getPulsarClient();
@@ -273,7 +276,7 @@ public class PulsarSpace {
ProducerBuilder producerBuilder = pulsarClient.newProducer(pulsarSchema); ProducerBuilder producerBuilder = pulsarClient.newProducer(pulsarSchema);
producerBuilder.loadConf(producerConf); producerBuilder.loadConf(producerConf);
producer = producerBuilder.create(); producer = producerBuilder.create();
producers.put(encodedStr, producer); producers.put(producerCacheKey, producer);
ActivityMetrics.gauge(activityDef, producerMetricsPrefix + "totalbytessent", safeExtractMetric(producer, (s -> s.getTotalBytesSent() + s.getNumBytesSent()))); ActivityMetrics.gauge(activityDef, producerMetricsPrefix + "totalbytessent", safeExtractMetric(producer, (s -> s.getTotalBytesSent() + s.getNumBytesSent())));
ActivityMetrics.gauge(activityDef, producerMetricsPrefix + "totalmsgssent", safeExtractMetric(producer, (s -> s.getTotalMsgsSent() + s.getNumMsgsSent()))); ActivityMetrics.gauge(activityDef, producerMetricsPrefix + "totalmsgssent", safeExtractMetric(producer, (s -> s.getTotalMsgsSent() + s.getNumMsgsSent())));
@@ -449,29 +452,29 @@ public class PulsarSpace {
throw new RuntimeException("Consumer:: \"topic_uri\", \"topic_names\" and \"topics_pattern\" parameters can't be all empty/invalid!"); throw new RuntimeException("Consumer:: \"topic_uri\", \"topic_names\" and \"topics_pattern\" parameters can't be all empty/invalid!");
} }
String encodedStr; String consumerCacheKey;
// precedence sequence: // precedence sequence:
// topic_names (consumer statement param) > // topic_names (consumer statement param) >
// topics_pattern (consumer statement param) > // topics_pattern (consumer statement param) >
// topic_uri (document level param) // topic_uri (document level param)
if (!topicNames.isEmpty()) { if (!topicNames.isEmpty()) {
encodedStr = PulsarActivityUtil.encode( consumerCacheKey = buildCacheKey(
consumerName, consumerName,
subscriptionName, subscriptionName,
StringUtils.join(topicNames, "|")); String.join("|", topicNames));
} else if (topicsPattern != null) { } else if (topicsPattern != null) {
encodedStr = PulsarActivityUtil.encode( consumerCacheKey = buildCacheKey(
consumerName, consumerName,
subscriptionName, subscriptionName,
topicsPatternStr); topicsPatternStr);
} else { } else {
encodedStr = PulsarActivityUtil.encode( consumerCacheKey = buildCacheKey(
consumerName, consumerName,
subscriptionName, subscriptionName,
cycleTopicUri); cycleTopicUri);
} }
Consumer<?> consumer = consumers.get(encodedStr); Consumer<?> consumer = consumers.get(consumerCacheKey);
if (consumer == null) { if (consumer == null) {
PulsarClient pulsarClient = getPulsarClient(); PulsarClient pulsarClient = getPulsarClient();
@@ -508,7 +511,7 @@ public class PulsarSpace {
throw new RuntimeException("Unable to create a Pulsar consumer!"); throw new RuntimeException("Unable to create a Pulsar consumer!");
} }
consumers.put(encodedStr, consumer); consumers.put(consumerCacheKey, consumer);
} }
return consumer; return consumer;
@@ -576,8 +579,8 @@ public class PulsarSpace {
throw new RuntimeException("Reader:: Invalid value for Reader start message position!"); throw new RuntimeException("Reader:: Invalid value for Reader start message position!");
} }
String encodedStr = PulsarActivityUtil.encode(topicName, readerName, startMsgPosStr); String readerCacheKey = buildCacheKey(topicName, readerName, startMsgPosStr);
Reader<?> reader = readers.get(encodedStr); Reader<?> reader = readers.get(readerCacheKey);
if (reader == null) { if (reader == null) {
PulsarClient pulsarClient = getPulsarClient(); PulsarClient pulsarClient = getPulsarClient();
@@ -614,7 +617,7 @@ public class PulsarSpace {
throw new RuntimeException("Unable to create a Pulsar reader!"); throw new RuntimeException("Unable to create a Pulsar reader!");
} }
readers.put(encodedStr, reader); readers.put(readerCacheKey, reader);
} }
return reader; return reader;

View File

@@ -15,7 +15,6 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -364,10 +363,7 @@ public class PulsarActivityUtil {
/////// ///////
// Complex strut type: Avro or Json // Complex strut type: Avro or Json
public static boolean isAvroSchemaTypeStr(String typeStr) { public static boolean isAvroSchemaTypeStr(String typeStr) {
boolean isAvroType = false; boolean isAvroType = typeStr.equalsIgnoreCase("AVRO");
if (typeStr.equalsIgnoreCase("AVRO")) {
isAvroType = true;
}
return isAvroType; return isAvroType;
} }
public static Schema<?> getAvroSchema(String typeStr, String definitionStr) { public static Schema<?> getAvroSchema(String typeStr, String definitionStr) {
@@ -403,18 +399,5 @@ public class PulsarActivityUtil {
return schema; return schema;
} }
public static String encode(String... strings) {
StringBuilder stringBuilder = new StringBuilder();
for (String str : strings) {
if (!StringUtils.isBlank(str))
stringBuilder.append(str).append("::");
}
String concatenatedStr =
StringUtils.substringBeforeLast(stringBuilder.toString(), "::");
return Base64.getEncoder().encodeToString(concatenatedStr.getBytes());
}
} }

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -22,13 +22,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -17,7 +17,7 @@
package io.nosqlbench.activitytype.stdout; package io.nosqlbench.activitytype.stdout;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.Arrays; import java.util.Arrays;

View File

@@ -20,7 +20,7 @@ package io.nosqlbench.activitytype.stdout;
import io.nosqlbench.engine.api.activityapi.core.Action; import io.nosqlbench.engine.api.activityapi.core.Action;
import io.nosqlbench.engine.api.activityapi.core.ActionDispenser; import io.nosqlbench.engine.api.activityapi.core.ActionDispenser;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Test; import org.junit.jupiter.api.Test;
/** /**
* Created by sebastianestevez on 5/5/17. * Created by sebastianestevez on 5/5/17.

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -24,19 +24,19 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>driver-stdout</artifactId> <artifactId>driver-stdout</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -22,13 +22,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId> <artifactId>engine-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -70,7 +70,7 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.12</version> <version>4.5.13</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -1,8 +1,8 @@
package io.nosqlbench.driver.webdriver; package io.nosqlbench.driver.webdriver;
import io.nosqlbench.nb.api.testutils.Perf; import io.nosqlbench.nb.api.testutils.Perf;
import org.junit.Ignore; import org.junit.jupiter.api.Disabled;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver;
@@ -18,7 +18,7 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class ExampleWebScript { public class ExampleWebScript {
@Test @Test
@Ignore @Disabled
public void getDocsSiteChromeDriver() { public void getDocsSiteChromeDriver() {
System.setProperty("webdriver.http.factory", "okhttp"); System.setProperty("webdriver.http.factory", "okhttp");
WebDriver driver = new ChromeDriver(); WebDriver driver = new ChromeDriver();
@@ -33,13 +33,13 @@ public class ExampleWebScript {
} }
System.out.println("!"); System.out.println("!");
System.out.println(perf.toString()); System.out.println(perf);
// driver.get("http://docs.nosqlbench.io/"); // driver.get("http://docs.nosqlbench.io/");
driver.close(); driver.close();
} }
@Test @Test
@Ignore @Disabled
public void getDocSiteWebHtml() { public void getDocSiteWebHtml() {
// System.setProperty("webdriver.http.factory", "okhttp"); // System.setProperty("webdriver.http.factory", "okhttp");
WebDriver driver = new HtmlUnitDriver(false); WebDriver driver = new HtmlUnitDriver(false);
@@ -54,7 +54,7 @@ public class ExampleWebScript {
} }
System.out.println("!"); System.out.println("!");
System.out.println(perf.toString()); System.out.println(perf);
// driver.get("http://docs.nosqlbench.io/"); // driver.get("http://docs.nosqlbench.io/");
driver.close(); driver.close();
} }

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -23,13 +23,13 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId> <artifactId>nb-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>virtdata-userlibs</artifactId> <artifactId>virtdata-userlibs</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mvn-defaults</artifactId> <artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath> <relativePath>../mvn-defaults</relativePath>
</parent> </parent>
@@ -23,25 +23,25 @@
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId> <artifactId>nb-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>drivers-api</artifactId> <artifactId>drivers-api</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>nb-annotations</artifactId> <artifactId>nb-annotations</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.nosqlbench</groupId> <groupId>io.nosqlbench</groupId>
<artifactId>virtdata-userlibs</artifactId> <artifactId>virtdata-userlibs</artifactId>
<version>4.15.48-SNAPSHOT</version> <version>4.15.51-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -33,7 +33,7 @@ public enum RunState {
// The thread has stopped. This should only be set by the controlled thread // The thread has stopped. This should only be set by the controlled thread
Stopped("_\u23F9"); Stopped("_\u23F9");
private String runcode; private final String runcode;
RunState(String runcode) { RunState(String runcode) {
this.runcode = runcode; this.runcode = runcode;

View File

@@ -83,7 +83,7 @@ public class CycleResultsRLEBufferReadable implements CycleResultSegmentsReadabl
private class ResultSpanIterator implements Iterator<CycleResultsSegment> { private class ResultSpanIterator implements Iterator<CycleResultsSegment> {
private final ByteBuffer iterbuf; private final ByteBuffer iterbuf;
private Predicate<ResultReadable> filter; private final Predicate<ResultReadable> filter;
private CycleResultsSegment next; private CycleResultsSegment next;
public ResultSpanIterator(ByteBuffer buf, Predicate<ResultReadable> filter) { public ResultSpanIterator(ByteBuffer buf, Predicate<ResultReadable> filter) {
@@ -104,11 +104,8 @@ public class CycleResultsRLEBufferReadable implements CycleResultSegmentsReadabl
@Override @Override
public CycleResultsSegment next() { public CycleResultsSegment next() {
if (next==null) { if (next == null && !hasNext()) {
hasNext(); throw new RuntimeException("Call to next() but there was no remaining unfiltered data.");
if (next==null) {
throw new RuntimeException("Possible call to next() without calling hasNext(). There was no remaining unfiltered data.");
}
} }
CycleResultsSegment wasNext = this.next; CycleResultsSegment wasNext = this.next;
next=null; next=null;

View File

@@ -67,9 +67,6 @@ import java.util.function.ToLongFunction;
*/ */
public class IntervalSequencer<T> implements ElementSequencer<T> { public class IntervalSequencer<T> implements ElementSequencer<T> {
private List<T> elems;
private ToLongFunction<T> ratioFunc;
@Override @Override
public int[] seqIndexByRatioFunc(List<T> elements, ToLongFunction<T> ratioFunc) { public int[] seqIndexByRatioFunc(List<T> elements, ToLongFunction<T> ratioFunc) {
@@ -101,9 +98,9 @@ public class IntervalSequencer<T> implements ElementSequencer<T> {
private final static class OpSlot<T> { private final static class OpSlot<T> {
private T elem; private final T elem;
private double position; private final double position;
private int rank; private final int rank;
public OpSlot(T elem, double position, int rank) { public OpSlot(T elem, double position, int rank) {
this.elem = elem; this.elem = elem;

View File

@@ -27,7 +27,7 @@ import java.util.function.ToLongFunction;
public class SequencePlanner<T> { public class SequencePlanner<T> {
private final static Logger logger = LogManager.getLogger(SequencePlanner.class); private final static Logger logger = LogManager.getLogger(SequencePlanner.class);
private final SequencerType sequencerType; private final SequencerType sequencerType;
private List<T> elements = new ArrayList<>(); private final List<T> elements = new ArrayList<>();
private final List<Long> ratios = new ArrayList<>(); private final List<Long> ratios = new ArrayList<>();
private int[] elementIndex; private int[] elementIndex;
@@ -59,7 +59,6 @@ public class SequencePlanner<T> {
logger.trace("sequencing elements by concatenation"); logger.trace("sequencing elements by concatenation");
this.elementIndex = new ConcatSequencer<T>().seqIndexesByRatios(elements, ratios); this.elementIndex = new ConcatSequencer<T>().seqIndexesByRatios(elements, ratios);
} }
this.elements = elements;
return new Sequence<>(sequencerType, elements, elementIndex); return new Sequence<>(sequencerType, elements, elementIndex);
} }

View File

@@ -178,8 +178,6 @@ public class RateSpec {
} }
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder();
double ratePortion = Math.abs(opsPerSec - ((long) opsPerSec)); double ratePortion = Math.abs(opsPerSec - ((long) opsPerSec));
String ratefmt = (ratePortion > 0.001D) ? String.format("%,.3f", opsPerSec) : String.format("%,d", (long) opsPerSec); String ratefmt = (ratePortion > 0.001D) ? String.format("%,.3f", opsPerSec) : String.format("%,d", (long) opsPerSec);

View File

@@ -131,14 +131,6 @@ public class ParsedStmt {
return opDef.getBindings(); return opDef.getBindings();
} }
/**
* @return the params from the enclosed {@link OpDef}
* @deprecated You should use {@link #getParamReader()} instead.
*/
public Map<String, Object> getParams() {
return opDef.getParams();
}
/** /**
* @return a params reader from the enclosed {@link OpDef} params map * @return a params reader from the enclosed {@link OpDef} params map
*/ */
@@ -147,7 +139,7 @@ public class ParsedStmt {
} }
public List<BindPoint> getBindPoints() { public List<BindPoint> getBindPoints() {
return parsed.getCheckedBindPoints(); return parsed.getBindPoints();
} }
} }

View File

@@ -27,8 +27,6 @@ import java.util.*;
public class StmtsBlock implements Tagged, Iterable<OpTemplate> { public class StmtsBlock implements Tagged, Iterable<OpTemplate> {
private final static String NameToken = "name";
private final static String StmtToken = "stmt";
private final RawStmtsBlock rawStmtsBlock; private final RawStmtsBlock rawStmtsBlock;
private final StmtsDoc rawStmtsDoc; private final StmtsDoc rawStmtsDoc;
private final int blockIdx; private final int blockIdx;

View File

@@ -198,7 +198,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
@Override @Override
public void clear() { public void clear() {
logger.debug("parameter map cleared:" + toString()); logger.debug("parameter map cleared:" + this);
super.clear(); super.clear();
markMutation(); markMutation();
@@ -206,7 +206,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
@Override @Override
public Set<Entry<String, Object>> entrySet() { public Set<Entry<String, Object>> entrySet() {
logger.debug("getting entry set for " + toString()); logger.debug("getting entry set for " + this);
return super.entrySet() return super.entrySet()
.stream() .stream()
.map(e -> new AbstractMap.SimpleEntry<String,Object>(e.getKey(), e.getValue()) {}) .map(e -> new AbstractMap.SimpleEntry<String,Object>(e.getKey(), e.getValue()) {})
@@ -377,7 +377,6 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
} }
public static String toJSON(Map<?,?> map) { public static String toJSON(Map<?,?> map) {
StringBuilder sb = new StringBuilder();
List<String> l = new ArrayList<>(); List<String> l = new ArrayList<>();
map.forEach((k,v) -> l.add("'" + k + "': '" + v + "'")); map.forEach((k,v) -> l.add("'" + k + "': '" + v + "'"));
return "params={"+String.join(",\n ",l)+"};\n"; return "params={"+String.join(",\n ",l)+"};\n";

View File

@@ -254,7 +254,7 @@ public class SimpleActivity implements Activity, ProgressCapable {
@Override @Override
public void setPhaseLimiter(RateLimiter rateLimiter) { public void setPhaseLimiter(RateLimiter rateLimiter) {
this.phaseLimiter = phaseLimiter; this.phaseLimiter = rateLimiter;
} }
@Override @Override

View File

@@ -41,7 +41,6 @@ public class HistoStatsCSVWriter {
private PrintStream initFile(File logfile) { private PrintStream initFile(File logfile) {
try { try {
FileOutputStream fileOutputStream = new FileOutputStream(logfile);
PrintStream writer = new PrintStream(logfile); PrintStream writer = new PrintStream(logfile);
return writer; return writer;
} catch (IOException e) { } catch (IOException e) {
@@ -66,7 +65,7 @@ public class HistoStatsCSVWriter {
Locale.US, Locale.US,
"#[StartTime: %.3f (seconds since epoch), %s]\n", "#[StartTime: %.3f (seconds since epoch), %s]\n",
startTime / 1000.0, startTime / 1000.0,
new Date(startTime).toString() new Date(startTime)
); );
writer.flush(); writer.flush();
} }
@@ -104,7 +103,7 @@ public class HistoStatsCSVWriter {
csvLine.append(",").append(h.getValueAtPercentile(0.999D)); csvLine.append(",").append(h.getValueAtPercentile(0.999D));
csvLine.append(",").append(h.getValueAtPercentile(0.9999D)); csvLine.append(",").append(h.getValueAtPercentile(0.9999D));
csvLine.append(",").append(h.getMaxValue()); csvLine.append(",").append(h.getMaxValue());
writer.println(csvLine.toString()); writer.println(csvLine);
} }
} }

View File

@@ -84,9 +84,7 @@ public class HistoStatsLogger extends CapabilityHook<HdrDeltaHistogramAttachment
} }
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "HistoLogger:" + this.pattern + ":" + this.logfile.getPath() + ":" + this.intervalLength;
sb.append("HistoLogger:" + this.pattern + ":" + this.logfile.getPath() + ":" + this.intervalLength);
return sb.toString();
} }
public long getInterval() { public long getInterval() {

View File

@@ -26,9 +26,8 @@ import java.util.concurrent.TimeUnit;
public class NicerTimer extends Timer implements DeltaSnapshotter, HdrDeltaHistogramAttachment, TimerAttachment { public class NicerTimer extends Timer implements DeltaSnapshotter, HdrDeltaHistogramAttachment, TimerAttachment {
private final String metricName; private final String metricName;
private DeltaHdrHistogramReservoir deltaHdrHistogramReservoir; private final DeltaHdrHistogramReservoir deltaHdrHistogramReservoir;
private long cacheExpiry = 0L; private long cacheExpiry = 0L;
private ConvenientSnapshot lastSnapshot;
private List<Timer> mirrors; private List<Timer> mirrors;
public NicerTimer(String metricName, DeltaHdrHistogramReservoir deltaHdrHistogramReservoir) { public NicerTimer(String metricName, DeltaHdrHistogramReservoir deltaHdrHistogramReservoir) {

View File

@@ -143,8 +143,8 @@ public class CommandTemplate {
cmd.forEach((param, value) -> { cmd.forEach((param, value) -> {
ParsedTemplate paramTemplate = new ParsedTemplate(value, bindings); ParsedTemplate paramTemplate = new ParsedTemplate(value, bindings);
if (paramTemplate.getCheckedBindPoints().size() > 0) { if (paramTemplate.getBindPoints().size() > 0) {
BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getCheckedBindPoints()); BindingsTemplate paramBindings = new BindingsTemplate(paramTemplate.getBindPoints());
StringBindings paramStringBindings = new StringBindingsTemplate(value, paramBindings).resolve(); StringBindings paramStringBindings = new StringBindingsTemplate(value, paramBindings).resolve();
dynamics.put(param, paramStringBindings); dynamics.put(param, paramStringBindings);
} else { } else {

View File

@@ -89,11 +89,11 @@ public class ParsedCommand {
cmd.forEach((k,v) -> { cmd.forEach((k,v) -> {
if (v instanceof CharSequence) { if (v instanceof CharSequence) {
ParsedTemplate parsed = new ParsedTemplate(v.toString(), bindings); ParsedTemplate parsed = new ParsedTemplate(v.toString(), bindings);
switch (parsed.getForm()) { switch (parsed.getType()) {
case literal: case literal:
break; break;
case rawbind: case bindref:
case template: case concat:
this.dynamics.put(k,v.toString()); this.dynamics.put(k,v.toString());
break; break;
} }

View File

@@ -239,13 +239,13 @@ public class Unit {
public static Count valueOfSuffix(String suffix) { public static Count valueOfSuffix(String suffix) {
for (Count count : Count.values()) { for (Count count : Count.values()) {
if (count.toString().toLowerCase().equals(suffix.toLowerCase())) { if (count.toString().equalsIgnoreCase(suffix)) {
return count; return count;
} }
if (count.label.toLowerCase().equals(suffix.toLowerCase())) { if (count.label.equalsIgnoreCase(suffix)) {
return count; return count;
} }
if (count.name.toLowerCase().equals(suffix.toLowerCase())) { if (count.name.equalsIgnoreCase(suffix)) {
return count; return count;
} }
} }
@@ -265,17 +265,13 @@ public class Unit {
TB("TB", "terabyte", bytesPerGB * 1000), TB("TB", "terabyte", bytesPerGB * 1000),
PB("PB", "petabyte", bytesPerGB * 1000000), PB("PB", "petabyte", bytesPerGB * 1000000),
EB("EB", "exabyte", bytesPerGB * bytesPerGB), EB("EB", "exabyte", bytesPerGB * bytesPerGB),
ZB("ZB", "zettabyte", bytesPerGB * bytesPerGB * 1000),
YB("YB", "yottabyte", bytesPerGB * bytesPerGB * 1000000),
KIB("KiB", "kibibyte", 1024), KIB("KiB", "kibibyte", 1024),
MIB("MiB", "mebibyte", 1024 * 1024), MIB("MiB", "mebibyte", 1024 * 1024),
GIB("GiB", "gibibyte", BytesPerGiB), GIB("GiB", "gibibyte", BytesPerGiB),
TIB("TiB", "tebibyte", BytesPerGiB * 1024), TIB("TiB", "tebibyte", BytesPerGiB * 1024),
PIB("PIB", "pebibyte", BytesPerGiB * 1024 * 1024), PIB("PIB", "pebibyte", BytesPerGiB * 1024 * 1024),
EIB("EiB", "exbibyte", BytesPerGiB * BytesPerGiB), EIB("EiB", "exbibyte", BytesPerGiB * BytesPerGiB);
ZIB("ZiB", "zebibyte", BytesPerGiB * BytesPerGiB * 1024),
YIB("YiB", "yobibyte", BytesPerGiB * BytesPerGiB * 1024 * 1024);
private final String name; private final String name;
private final long bytes; private final long bytes;
@@ -289,16 +285,16 @@ public class Unit {
public static Bytes valueOfSuffix(String unitpart) { public static Bytes valueOfSuffix(String unitpart) {
for (Bytes byteUnit : Bytes.values()) { for (Bytes byteUnit : Bytes.values()) {
if (byteUnit.label.toLowerCase().equals(unitpart.toLowerCase())) { if (byteUnit.label.equalsIgnoreCase(unitpart)) {
return byteUnit; return byteUnit;
} }
if (byteUnit.name.toLowerCase().equals(unitpart.toLowerCase())) { if (byteUnit.name.equalsIgnoreCase(unitpart)) {
return byteUnit; return byteUnit;
} }
if ((byteUnit.name.toLowerCase() + "s").equals(unitpart.toLowerCase())) { if ((byteUnit.name.toLowerCase() + "s").equals(unitpart.toLowerCase())) {
return byteUnit; return byteUnit;
} }
if (byteUnit.toString().toLowerCase().equals(unitpart.toLowerCase())) { if (byteUnit.toString().equalsIgnoreCase(unitpart)) {
return byteUnit; return byteUnit;
} }
} }
@@ -334,13 +330,13 @@ public class Unit {
public static Duration valueOfSuffix(String spec) { public static Duration valueOfSuffix(String spec) {
for (Duration duration : Duration.values()) { for (Duration duration : Duration.values()) {
if (duration.label.toLowerCase().equals(spec.toLowerCase())) { if (duration.label.equalsIgnoreCase(spec)) {
return duration; return duration;
} }
if (duration.toString().toLowerCase().equals(spec.toLowerCase())) { if (duration.toString().equalsIgnoreCase(spec)) {
return duration; return duration;
} }
if (duration.name.toLowerCase().equals(spec.toLowerCase())) { if (duration.name.equalsIgnoreCase(spec)) {
return duration; return duration;
} }
} }

View File

@@ -19,11 +19,12 @@
package io.nosqlbench.engine.api.activityapi; package io.nosqlbench.engine.api.activityapi;
import io.nosqlbench.engine.api.activityimpl.ParameterMap; import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.Optional; import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class ParameterMapTest { public class ParameterMapTest {
@@ -85,11 +86,12 @@ public class ParameterMapTest {
assertThat(multiNames.get().getOptionalString("delta","gamma").orElse("missing")).isEqualTo("blue"); assertThat(multiNames.get().getOptionalString("delta","gamma").orElse("missing")).isEqualTo("blue");
} }
@Test(expected = RuntimeException.class) @Test
public void testAmbiguousMultiValueThrowsException() { public void testAmbiguousMultiValueThrowsException() {
Optional<ParameterMap> multiNames = ParameterMap.parseParams("alpha=blue;beta=red;delta=blue"); Optional<ParameterMap> multiNames = ParameterMap.parseParams("alpha=blue;beta=red;delta=blue");
assertThat(multiNames).isPresent(); assertThat(multiNames).isPresent();
assertThat(multiNames.get().getOptionalString("alpha","delta").orElse("missing")).isEqualTo("blue"); assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> multiNames.get().getOptionalString("alpha","delta"));
} }
@Test @Test

View File

@@ -6,7 +6,7 @@ import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.SucceededOp
import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.EventedOpImpl; import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.EventedOpImpl;
import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.StartedOp; import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.StartedOp;
import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.TrackedOp; import io.nosqlbench.engine.api.activityapi.core.ops.fluent.opfacets.TrackedOp;
import org.junit.Test; import org.junit.jupiter.api.Test;
public class OpTrackerImplTest { public class OpTrackerImplTest {

View File

@@ -20,7 +20,7 @@ package io.nosqlbench.engine.api.activityapi.cyclelog;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResult; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResult;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultsSegment; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultsSegment;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultSegmentBuffer; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultSegmentBuffer;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;

View File

@@ -21,7 +21,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResult
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultsSegment; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResultsSegment;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferReadable; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferReadable;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferTarget; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferTarget;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -20,7 +20,7 @@ package io.nosqlbench.engine.api.activityapi.cyclelog.buffers;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResult; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleResult;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferReadable; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferReadable;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferTarget; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results_rle.CycleResultsRLEBufferTarget;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;

View File

@@ -17,7 +17,7 @@
package io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results; package io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.stream.StreamSupport; import java.util.stream.StreamSupport;

View File

@@ -18,7 +18,7 @@
package io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate; package io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.ResultReadable; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.ResultReadable;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@@ -48,7 +48,7 @@ public class EnumReadableMappingFilterTest {
} }
} }
private static enum TestEnum implements ResultReadable { private enum TestEnum implements ResultReadable {
Alpha(1), Alpha(1),
Beta(2), Beta(2),

View File

@@ -19,8 +19,8 @@ package io.nosqlbench.engine.api.activityapi.cyclelog.inputs.cyclelog;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleSegment; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.CycleSegment;
import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogOutput; import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogOutput;
import org.junit.BeforeClass; import org.junit.jupiter.api.BeforeAll;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.io.File; import java.io.File;
@@ -31,7 +31,7 @@ public class CycleLogInputTest {
private final static String filepath="cycle-log-reader-test"; private final static String filepath="cycle-log-reader-test";
private static File cyclefile; private static File cyclefile;
@BeforeClass @BeforeAll
public static void createTempFile() { public static void createTempFile() {
try { try {
cyclefile = File.createTempFile(filepath, "cyclelog"); cyclefile = File.createTempFile(filepath, "cyclelog");

View File

@@ -22,7 +22,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.filters.CoreResultValueFilt
import io.nosqlbench.engine.api.activityapi.cyclelog.filters.ResultFilterDispenser; import io.nosqlbench.engine.api.activityapi.cyclelog.filters.ResultFilterDispenser;
import io.nosqlbench.engine.api.activityapi.cyclelog.filters.ResultValueFilterType; import io.nosqlbench.engine.api.activityapi.cyclelog.filters.ResultValueFilterType;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.MutableCycleResult; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.MutableCycleResult;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.function.Predicate; import java.util.function.Predicate;

View File

@@ -22,7 +22,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.ResultReada
import io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate.ResultFilteringSieve; import io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate.ResultFilteringSieve;
import io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate.TristateFilter; import io.nosqlbench.engine.api.activityapi.cyclelog.filters.tristate.TristateFilter;
import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.MutableCycleResult; import io.nosqlbench.engine.api.activityapi.cyclelog.buffers.results.MutableCycleResult;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@@ -17,8 +17,8 @@
package io.nosqlbench.engine.api.activityapi.errorhandling; package io.nosqlbench.engine.api.activityapi.errorhandling;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
import java.util.ArrayList; import java.util.ArrayList;
@@ -26,19 +26,22 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class HashedErrorHandlerTest { public class HashedErrorHandlerTest {
HashedErrorHandler<Throwable, Boolean> handler; HashedErrorHandler<Throwable, Boolean> handler;
@Before @BeforeEach
public void beforeTest() { public void beforeTest() {
handler = new HashedErrorHandler<Throwable,Boolean>(); handler = new HashedErrorHandler<Throwable,Boolean>();
} }
@Test(expected= RuntimeException.class) @Test
public void testDefaultHandlerThrowsException() { public void testDefaultHandlerThrowsException() {
handler.handleError(1L, new InvalidParameterException("this is an invalid exception, actually")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> {
handler.handleError(1L, new InvalidParameterException("this is an invalid exception, actually"));
});
} }
@Test @Test
@@ -91,7 +94,7 @@ public class HashedErrorHandlerTest {
assertThat(result).isFalse(); assertThat(result).isFalse();
} }
@Test(expected = RuntimeException.class) @Test
public void testNamedGroup() { public void testNamedGroup() {
handler.setGroup("test1",IndexOutOfBoundsException.class,ArrayIndexOutOfBoundsException.class); handler.setGroup("test1",IndexOutOfBoundsException.class,ArrayIndexOutOfBoundsException.class);
handler.setGroup("types",InvalidParameterException.class); handler.setGroup("types",InvalidParameterException.class);
@@ -99,36 +102,41 @@ public class HashedErrorHandlerTest {
assertThat(handler.getGroupNames()).hasSize(2); assertThat(handler.getGroupNames()).hasSize(2);
assertThat(handler.getGroupNames()).contains("test1"); assertThat(handler.getGroupNames()).contains("test1");
assertThat(handler.getGroupNames()).contains("types"); assertThat(handler.getGroupNames()).contains("types");
handler.handleError(5L,new InvalidParameterException("this is an error")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
handler.handleError(5L,new InvalidParameterException("this is an error")));
} }
@Test(expected = RuntimeException.class) @Test
public void testFindVagueSingleSubmatchException() { public void testFindVagueSingleSubmatchException() {
handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class); handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class);
handler.setHandlerForPattern("Index", CycleErrorHandlers.rethrow("12345 678910 11 12")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
handler.setHandlerForPattern("Index", CycleErrorHandlers.rethrow("12345 678910 11 12")));
} }
@Test(expected = RuntimeException.class) @Test
public void testFindMultipleRegex() { public void testFindMultipleRegex() {
handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class); handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class);
handler.setHandlerForPattern(".*Index.*", CycleErrorHandlers.rethrow("Journey through the klein bottle.")); handler.setHandlerForPattern(".*Index.*", CycleErrorHandlers.rethrow("Journey through the klein bottle."));
Boolean result = handler.handleError(9L, new IndexOutOfBoundsException("9L was out of bounds")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
handler.handleError(9L, new IndexOutOfBoundsException("9L was out of bounds")));
} }
@Test(expected = RuntimeException.class) @Test
public void testNonMatchingSubstringException() { public void testNonMatchingSubstringException() {
handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class); handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class);
Set<Class<? extends Throwable>> groups = handler.getGroup("index"); Set<Class<? extends Throwable>> groups = handler.getGroup("index");
assertThat(groups).isNotNull(); assertThat(groups).isNotNull();
assertThat(groups).hasSize(2); assertThat(groups).hasSize(2);
assertThat(groups.contains(IndexOutOfBoundsException.class)).isTrue(); assertThat(groups.contains(IndexOutOfBoundsException.class)).isTrue();
handler.setHandlerForPattern("Dyahwemo", CycleErrorHandlers.rethrow("Journey through the klein bottle.")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
handler.setHandlerForPattern("Dyahwemo", CycleErrorHandlers.rethrow("Journey through the klein bottle.")));
} }
@Test(expected=RuntimeException.class) @Test
public void testSetHandlerForMissingGroupException() { public void testSetHandlerForMissingGroupException() {
handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class); handler.setGroup("index", IndexOutOfBoundsException.class, ArrayIndexOutOfBoundsException.class);
handler.setHandlerForGroup("outdex", CycleErrorHandlers.rethrow("Journey through the klein bottle.")); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
handler.setHandlerForGroup("outdex", CycleErrorHandlers.rethrow("Journey through the klein bottle.")));
} }
@Test @Test

View File

@@ -6,22 +6,23 @@ import com.codahale.metrics.Meter;
import com.codahale.metrics.Timer; import com.codahale.metrics.Timer;
import io.nosqlbench.engine.api.activityapi.errorhandling.ErrorMetrics; import io.nosqlbench.engine.api.activityapi.errorhandling.ErrorMetrics;
import io.nosqlbench.engine.api.activityimpl.ActivityDef; import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class NBErrorHandlerTest { public class NBErrorHandlerTest {
private final RuntimeException runtimeException = new RuntimeException("test exception"); private final RuntimeException runtimeException = new RuntimeException("test exception");
@Test
@Test(expected = RuntimeException.class)
public void testNullConfig() { public void testNullConfig() {
ErrorMetrics errorMetrics = new ErrorMetrics(ActivityDef.parseActivityDef("alias=testalias_stop")); ErrorMetrics errorMetrics = new ErrorMetrics(ActivityDef.parseActivityDef("alias=testalias_stop"));
NBErrorHandler errhandler = new NBErrorHandler(() -> "stop", () -> errorMetrics); NBErrorHandler errhandler = new NBErrorHandler(() -> "stop", () -> errorMetrics);
ErrorDetail detail = errhandler.handleError(runtimeException, 1, 2); assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> errhandler.handleError(runtimeException, 1, 2));
} }
@Test @Test
@@ -90,6 +91,4 @@ public class NBErrorHandlerTest {
assertThat(detail.isRetryable()).isFalse(); assertThat(detail.isRetryable()).isFalse();
assertThat(detail.resultCode).isEqualTo(42); assertThat(detail.resultCode).isEqualTo(42);
} }
} }

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.engine.api.activityapi.planning; package io.nosqlbench.engine.api.activityapi.planning;
import org.junit.Test; import org.junit.jupiter.api.Test;
import java.util.List; import java.util.List;

Some files were not shown because too many files have changed in this diff Show More