mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-16 17:34:52 -06:00
test classpath and loader fixes
This commit is contained in:
parent
a2077e8a98
commit
540abeee00
@ -104,12 +104,14 @@
|
||||
<artifactId>antlr4-maven-plugin</artifactId>
|
||||
<version>4.10.1</version>
|
||||
<configuration>
|
||||
<sourceDirectory>src/main/java/io/nosqlbench/converters/cql/grammars</sourceDirectory>
|
||||
<sourceDirectory>src/main/java/io/nosqlbench/converters/cql/grammars
|
||||
</sourceDirectory>
|
||||
<arguments>
|
||||
<argument>-package</argument>
|
||||
<argument>io.nosqlbench.converters.cql.generated</argument>
|
||||
</arguments>
|
||||
<outputDirectory>src/main/java/io/nosqlbench/converters/cql/generated</outputDirectory>
|
||||
<outputDirectory>src/main/java/io/nosqlbench/converters/cql/generated
|
||||
</outputDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
@ -128,7 +130,8 @@
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>src/main/java/io/nosqlbench/converters/cql/generated</directory>
|
||||
<directory>src/main/java/io/nosqlbench/converters/cql/generated
|
||||
</directory>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
<include>**/*.interp</include>
|
||||
@ -140,5 +143,23 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.md</include>
|
||||
<include>**/*.yaml</include>
|
||||
<include>**/*.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
</project>
|
||||
|
@ -22,6 +22,7 @@ import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -44,7 +45,8 @@ public class DefaultCqlBindings implements BindingsLibrary {
|
||||
|
||||
private Optional<String> loadLocal(String path) {
|
||||
try {
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream(path);
|
||||
String resourceName = getClass().getPackageName().replaceAll("\\.", File.separator)+File.separator+path;
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream(resourceName);
|
||||
byte[] bytes = stream.readAllBytes();
|
||||
return Optional.of(new String(bytes));
|
||||
} catch (Exception e) {
|
||||
|
@ -23,6 +23,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
public class CqlParserHarnessTest {
|
||||
|
||||
private final static String ksddl = """
|
||||
@ -51,8 +53,7 @@ public class CqlParserHarnessTest {
|
||||
@Test
|
||||
public void testGenBasicWorkload() {
|
||||
CqlWorkloadExporter exporter = new CqlWorkloadExporter(ddl);
|
||||
var workloadData = exporter.getWorkloadAsYaml();
|
||||
System.out.println("# generated workload:\n"+workloadData);
|
||||
assertThatThrownBy(() -> exporter.getWorkloadAsYaml()).isInstanceOf(RuntimeException.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -64,7 +65,7 @@ public class CqlParserHarnessTest {
|
||||
@Test
|
||||
public void testCqlParserHarnessKeyspace() {
|
||||
CqlModelParser harness = new CqlModelParser();
|
||||
harness.parse("""
|
||||
CqlModelParser.parse("""
|
||||
CREATE KEYSPACE cycling
|
||||
WITH REPLICATION = {\s
|
||||
'class' : 'SimpleStrategy',\s
|
||||
@ -77,7 +78,7 @@ public class CqlParserHarnessTest {
|
||||
@Disabled
|
||||
public void testCqlParserHarnessTable() {
|
||||
CqlModelParser harness = new CqlModelParser();
|
||||
harness.parse("""
|
||||
CqlModelParser.parse("""
|
||||
CREATE TABLE cycling.race_winners (
|
||||
race_name text,\s
|
||||
race_position int,\s
|
||||
|
Loading…
Reference in New Issue
Block a user