mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
change tests System.out calls to use logger directly
This commit is contained in:
parent
4f4b4982c8
commit
6c8782842d
@ -19,7 +19,7 @@ package io.nosqlbench.engine.api.activityimpl.uniform.flowtypes;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* <H2>ChainingOp<I,O>: f(I) -> O</I,O></H2>
|
||||
* <H2>ChainingOp<I,O>: f(I) -> O<I,O></H2>
|
||||
* <P>
|
||||
* Run a function on the current cached result in the current thread and replace it
|
||||
* with the result of the function. ChainingOps are one way of invoking
|
||||
|
@ -18,12 +18,15 @@ package io.nosqlbench.engine.api.activityimpl.tracking;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTracker;
|
||||
import io.nosqlbench.engine.api.activityimpl.marker.longheap.LongTreeTrackerAtomic;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class LongTreeTrackerTest2 {
|
||||
private final static Logger logger = LogManager.getLogger(LongTreeTrackerTest2.class);
|
||||
|
||||
// @Test
|
||||
// public void testCoMask() {
|
||||
@ -96,21 +99,21 @@ public class LongTreeTrackerTest2 {
|
||||
public void testApply() {
|
||||
LongTreeTracker t = new LongTreeTracker(0L);
|
||||
t.setCompleted(0);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(1);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(2);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(5);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(6);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(3);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(4);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
t.setCompleted(7);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -119,7 +122,7 @@ public class LongTreeTrackerTest2 {
|
||||
for (int i = 0; i < 32 ; i++) {
|
||||
t.setCompleted(i);
|
||||
}
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
assertThat(t.getImage()).isEqualTo(-2L);
|
||||
}
|
||||
|
||||
@ -141,7 +144,7 @@ public class LongTreeTrackerTest2 {
|
||||
@Test
|
||||
public void testBitString() {
|
||||
LongTreeTracker t = new LongTreeTracker(2L);
|
||||
System.out.println(t);
|
||||
logger.debug(t);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,8 @@ import com.google.gson.GsonBuilder;
|
||||
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Map;
|
||||
@ -28,6 +30,7 @@ import java.util.Map;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class CommandTemplateTest {
|
||||
private final static Logger logger = LogManager.getLogger(CommandTemplateTest.class);
|
||||
|
||||
@Test
|
||||
public void testCommandTemplate() {
|
||||
@ -53,7 +56,7 @@ public class CommandTemplateTest {
|
||||
OpTemplate optpl = stmtsDocs.getStmts().get(0);
|
||||
CommandTemplate ct = new CommandTemplate(optpl);
|
||||
String format = gson.toJson(ct);
|
||||
System.out.println(format);
|
||||
logger.debug(format);
|
||||
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ package io.nosqlbench.nb;
|
||||
|
||||
import org.HdrHistogram.DoubleHistogram;
|
||||
import org.HdrHistogram.DoubleRecorder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.DoubleSummaryStatistics;
|
||||
@ -31,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* a proof, so we can get on with testing!
|
||||
*/
|
||||
public class AggregateTests {
|
||||
private final static Logger logger = LogManager.getLogger(AggregateTests.class);
|
||||
double[][] data = new double[][]{
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 91},
|
||||
{15, 15, 15, 15, 15, 5, 5, 5, 5, 5},
|
||||
@ -62,8 +65,8 @@ public class AggregateTests {
|
||||
aggstats.accept(series.getAverage());
|
||||
}
|
||||
|
||||
System.out.println("aggstats avg:" + aggstats.getAverage());
|
||||
System.out.println("allstats avg:" + allstats.getAverage());
|
||||
logger.debug("aggstats avg:" + aggstats.getAverage());
|
||||
logger.debug("allstats avg:" + allstats.getAverage());
|
||||
|
||||
assertThat(aggstats.getAverage()).isNotEqualTo(allstats.getAverage());
|
||||
}
|
||||
@ -92,21 +95,21 @@ public class AggregateTests {
|
||||
all.recordValue(v);
|
||||
}
|
||||
snapshots[i]=recorder.getIntervalHistogram();
|
||||
System.out.println(snapshot(snapshots[i],"ary[" + i + "]"));
|
||||
logger.debug(snapshot(snapshots[i],"ary[" + i + "]"));
|
||||
}
|
||||
|
||||
DoubleHistogram histoall = all.getIntervalHistogram();
|
||||
System.out.println(snapshot(histoall, "all"));
|
||||
logger.debug(snapshot(histoall, "all"));
|
||||
|
||||
for (double pctile : new double[]{10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 99, 99.9, 99.99}) {
|
||||
DoubleSummaryStatistics avgOfInputs = new DoubleSummaryStatistics();
|
||||
for (DoubleHistogram snapshot : snapshots) {
|
||||
avgOfInputs.accept(snapshot.getValueAtPercentile(pctile));
|
||||
}
|
||||
System.out.println("avg of " + pctile + " => " + String.format("%.3f",avgOfInputs.getAverage()) + " (min,max)=("+String.format("%.3f",avgOfInputs.getMin()) + "," +
|
||||
logger.debug("avg of " + pctile + " => " + String.format("%.3f",avgOfInputs.getAverage()) + " (min,max)=("+String.format("%.3f",avgOfInputs.getMin()) + "," +
|
||||
String.format("%.3f",avgOfInputs.getMax())+ ")");
|
||||
System.out.println("direct " + pctile + " => " + String.format("%.3f",histoall.getValueAtPercentile(pctile)));
|
||||
System.out.println();
|
||||
logger.debug("direct " + pctile + " => " + String.format("%.3f",histoall.getValueAtPercentile(pctile)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -128,11 +131,10 @@ public class AggregateTests {
|
||||
prototype[j]=r.nextDouble()*100;
|
||||
}
|
||||
|
||||
System.out.print("proto[" + i + "] = ");
|
||||
logger.debug("proto[" + i + "] = ");
|
||||
for (double v : prototype) {
|
||||
System.out.print(String.format("% 3.0f ",v));
|
||||
logger.trace(String.format("% 3.0f ",v));
|
||||
}
|
||||
System.out.println();
|
||||
series[i]=resampleCurve(prototype,100);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@ import org.apache.commons.math3.optim.*;
|
||||
import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
|
||||
import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
|
||||
import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -52,6 +54,7 @@ import java.util.Random;
|
||||
*/
|
||||
public class TestOptimoExperiments {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(TestOptimoExperiments.class);
|
||||
@Test
|
||||
public void testNewAlgo() {
|
||||
|
||||
@ -81,7 +84,7 @@ public class TestOptimoExperiments {
|
||||
);
|
||||
PointValuePair result = mo.optimize(od.toArray(new OptimizationData[0]));
|
||||
|
||||
System.out.println(
|
||||
logger.debug(
|
||||
"point:" + Arrays.toString(result.getPoint()) +
|
||||
" value=" + m.value(result.getPoint())
|
||||
);
|
||||
|
@ -27,6 +27,8 @@ import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.Paths;
|
||||
import io.swagger.v3.parser.core.models.ParseOptions;
|
||||
import io.swagger.v3.parser.core.models.SwaggerParseResult;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.introspector.BeanAccess;
|
||||
@ -39,6 +41,7 @@ import java.util.stream.Collectors;
|
||||
* .md#securityRequirementObject">OpenApi Spec 3.1.0</A>
|
||||
*/
|
||||
public class OpenApiLoader {
|
||||
private final static Logger logger = LogManager.getLogger(OpenApiLoader.class);
|
||||
|
||||
private static final OpenAPIParser parser = new OpenAPIParser();
|
||||
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
@ -91,7 +94,7 @@ public class OpenApiLoader {
|
||||
yaml.setBeanAccess(BeanAccess.DEFAULT);
|
||||
|
||||
for (PathOp activeOp : activeOps) {
|
||||
System.out.println("yaml for op:" + yaml.dump(activeOp));
|
||||
logger.debug("yaml for op:" + yaml.dump(activeOp));
|
||||
pathops.put(activeOp.getCall(), activeOp);
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,12 @@
|
||||
|
||||
package io.nosqlbench.engine.rest.services.openapi;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class OpenApiLoaderTest {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(OpenApiLoaderTest.class);
|
||||
@Test
|
||||
public void testYamlGenerator() {
|
||||
String openidpath = "stargate.yaml";
|
||||
@ -28,7 +30,7 @@ public class OpenApiLoaderTest {
|
||||
"}\n";
|
||||
|
||||
String result = OpenApiLoader.generateWorkloadFromFilepath(openidpath, filterJson);
|
||||
System.out.println(result);
|
||||
logger.debug(result);
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class TriangularStepTest {
|
||||
public void testStepExample1() {
|
||||
TriangularStep e1 = new TriangularStep(100, 20);
|
||||
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
||||
System.out.println(Arrays.toString(runLengths));
|
||||
// System.out.println(Arrays.toString(runLengths));
|
||||
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(80L);
|
||||
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(120L);
|
||||
}
|
||||
@ -43,7 +43,7 @@ public class TriangularStepTest {
|
||||
public void testStepExample2() {
|
||||
TriangularStep e1 = new TriangularStep(80, 10);
|
||||
int[] runLengths = this.rleStatsFor(e1, 0, 10000);
|
||||
System.out.println(Arrays.toString(runLengths));
|
||||
// System.out.println(Arrays.toString(runLengths));
|
||||
assertThat(IntStream.of(runLengths).min().orElseThrow()).isEqualTo(70L);
|
||||
assertThat(IntStream.of(runLengths).max().orElseThrow()).isEqualTo(90L);
|
||||
}
|
||||
@ -101,7 +101,7 @@ public class TriangularStepTest {
|
||||
}
|
||||
|
||||
for (int count : counts) {
|
||||
System.out.println(count);
|
||||
// System.out.println(count);
|
||||
histo[count-minval][FREQUENCY]++;
|
||||
}
|
||||
return histo;
|
||||
|
@ -17,11 +17,14 @@
|
||||
package io.nosqlbench.virtdata.library.basics.tests.long_long;
|
||||
|
||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.SignedHash;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class SignedHashTest {
|
||||
private final static Logger logger = LogManager.getLogger(SignedHashTest.class);
|
||||
|
||||
@Test
|
||||
public void testFunctionalResult() {
|
||||
@ -44,12 +47,13 @@ public class SignedHashTest {
|
||||
SignedHash hash = new SignedHash();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
long l = hash.applyAsLong(i) % 50L;
|
||||
System.out.println("i=" + i + " result=" + l);
|
||||
logger.debug("i=" + i + " result=" + l);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
long l = hash.applyAsLong(i+1000000L) % 50L;
|
||||
System.out.println("i=" + i + " result=" + l);
|
||||
logger.debug("i=" + i + " result=" + l);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,12 +17,15 @@
|
||||
package io.nosqlbench.virtdata.library.basics.tests.long_string;
|
||||
|
||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Combinations;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
public class CombinationsTest {
|
||||
private final static Logger logger = LogManager.getLogger(CombinationsTest.class);
|
||||
|
||||
@Test
|
||||
public void testSimplePrimes() {
|
||||
@ -38,7 +41,7 @@ public class CombinationsTest {
|
||||
Combinations binaryByte = new Combinations("0-1;0-1;0-1;0-1;0-1;0-1;0-1;0-1;");
|
||||
assertThat(binaryByte.apply(37)).isEqualTo("00100101");
|
||||
for (int i = 0; i < 512; i++) {
|
||||
System.out.println("i:" + i + " = b:" + binaryByte.apply(i));
|
||||
logger.debug("i:" + i + " = b:" + binaryByte.apply(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ package io.nosqlbench.virtdata.library.curves4.continuous;
|
||||
|
||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -30,6 +32,7 @@ import java.util.concurrent.Future;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class RealDistributionsConcurrencyTests {
|
||||
private final static Logger logger = LogManager.getLogger(RealDistributionsConcurrencyTests.class);
|
||||
|
||||
@Test
|
||||
public void testConcurrentBinomialHashValues() {
|
||||
@ -73,8 +76,7 @@ public class RealDistributionsConcurrencyTests {
|
||||
for (int i = 0; i < futures.size(); i++) {
|
||||
try {
|
||||
results.add(futures.get(i).get());
|
||||
// System.out.println(description + ": got results for thread " + i);
|
||||
// System.out.flush();
|
||||
logger.trace(description + ": got results for thread " + i);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -83,7 +85,7 @@ public class RealDistributionsConcurrencyTests {
|
||||
|
||||
for (int vthread = 0; vthread < threads; vthread++) {
|
||||
assertThat(results.get(vthread)).isEqualTo(values);
|
||||
System.out.println(description + ": verified values for thread " + vthread);
|
||||
logger.debug(description + ": verified values for thread " + vthread);
|
||||
}
|
||||
|
||||
|
||||
@ -107,8 +109,7 @@ public class RealDistributionsConcurrencyTests {
|
||||
public double[] call() throws Exception {
|
||||
double[] output = new double[size];
|
||||
DataMapper<Double> mapper = VirtData.getMapper(mapperSpec, double.class);
|
||||
// System.out.println("resolved:" + mapper);
|
||||
// System.out.flush();
|
||||
logger.trace("resolved:" + mapper);
|
||||
|
||||
synchronized (signal) {
|
||||
signal.wait(10000);
|
||||
@ -116,9 +117,9 @@ public class RealDistributionsConcurrencyTests {
|
||||
|
||||
for (int i = 0; i < output.length; i++) {
|
||||
output[i] = mapper.get(i);
|
||||
// if ((i % 100) == 0) {
|
||||
// System.out.println("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||
// }
|
||||
if ((i % 100) == 0) {
|
||||
logger.trace("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.continuous;
|
||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Normal;
|
||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
||||
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@ -29,12 +31,13 @@ import java.util.function.LongToDoubleFunction;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class RealDistributionsValuesTest {
|
||||
private final static Logger logger = LogManager.getLogger(RealDistributionsValuesTest.class);
|
||||
|
||||
|
||||
@Test
|
||||
public void testComputedNormal() {
|
||||
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"compute"), 1000000,1);
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
assertThat(runData.getFractionalPercentile(0.5D))
|
||||
.isCloseTo(10.0D, Offset.offset(0.01D));
|
||||
assertThat(runData.getFractionalPercentile(0.4D))
|
||||
@ -46,7 +49,7 @@ public class RealDistributionsValuesTest {
|
||||
@Test
|
||||
public void testInterpolatedNormal() {
|
||||
RunData runData = iterateMapperDouble(new Normal(10.0,2.0,"interpolate"), 1000000,1);
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
assertThat(runData.getFractionalPercentile(0.5D))
|
||||
.isCloseTo(10.0D, Offset.offset(0.01D));
|
||||
assertThat(runData.getFractionalPercentile(0.4D))
|
||||
@ -64,7 +67,7 @@ public class RealDistributionsValuesTest {
|
||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||
assertThat(runData.getFractionalPercentile(0.78D))
|
||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -76,7 +79,7 @@ public class RealDistributionsValuesTest {
|
||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||
assertThat(runData.getFractionalPercentile(0.78D))
|
||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -92,7 +95,7 @@ public class RealDistributionsValuesTest {
|
||||
|
||||
assertThat(mapper.applyAsDouble(Long.MAX_VALUE)).isCloseTo(100.0D, Offset.offset(1.0D));
|
||||
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
}
|
||||
|
||||
private RunData iterateMapperDouble(LongToDoubleFunction mapper, int iterations, long funcstep) {
|
||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.discrete;
|
||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||
import org.apache.commons.statistics.distribution.BinomialDistribution;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@ -33,6 +35,7 @@ import java.util.concurrent.Future;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class IntegerDistributionsConcurrencyTest {
|
||||
private final static Logger logger = LogManager.getLogger(IntegerDistributionsConcurrencyTest.class);
|
||||
|
||||
@Test
|
||||
public void testBinomialICDR() {
|
||||
@ -109,7 +112,6 @@ public class IntegerDistributionsConcurrencyTest {
|
||||
try {
|
||||
results[i] = futures.get(i).get();
|
||||
System.out.println(description + ": got results for thread " + i);
|
||||
System.out.flush();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -125,15 +127,14 @@ public class IntegerDistributionsConcurrencyTest {
|
||||
for (int ithread = 0; ithread < threads; ithread++) {
|
||||
System.out.print(results[ithread][i] + ",");
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
boolean equal = Arrays.equals(results[vthread],values);
|
||||
if (!equal) {
|
||||
System.out.println("not equal!");
|
||||
logger.debug("not equal!");
|
||||
}
|
||||
assertThat(results[vthread]).isEqualTo(values);
|
||||
System.out.println(description + ": verified values for thread " + vthread);
|
||||
logger.debug(description + ": verified values for thread " + vthread);
|
||||
}
|
||||
|
||||
|
||||
@ -157,8 +158,7 @@ public class IntegerDistributionsConcurrencyTest {
|
||||
public long[] call() throws Exception {
|
||||
long[] output = new long[size];
|
||||
DataMapper<Long> mapper = VirtData.getMapper(mapperSpec, long.class);
|
||||
// System.out.println("resolved:" + mapper);
|
||||
// System.out.flush();
|
||||
// logger.debug("resolved:" + mapper);
|
||||
|
||||
synchronized (signal) {
|
||||
signal.wait(10000);
|
||||
@ -167,7 +167,7 @@ public class IntegerDistributionsConcurrencyTest {
|
||||
for (int i = 0; i < output.length; i++) {
|
||||
output[i] = mapper.get(i);
|
||||
// if ((i % 100) == 0) {
|
||||
// System.out.println("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||
// logger.debug("wrote t:" + slot + ", iter:" + i + ", val:" + output[i]);
|
||||
// }
|
||||
}
|
||||
return output;
|
||||
|
@ -19,6 +19,8 @@ package io.nosqlbench.virtdata.library.curves4.discrete;
|
||||
import io.nosqlbench.virtdata.library.curves4.continuous.long_double.Uniform;
|
||||
import io.nosqlbench.virtdata.library.curves4.discrete.long_long.Zipf;
|
||||
import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -31,13 +33,14 @@ import java.util.function.LongUnaryOperator;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class IntegerDistributionsValuesTest {
|
||||
private final static Logger logger = LogManager.getLogger(IntegerDistributionsValuesTest.class);
|
||||
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testComputedZipf() {
|
||||
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
assertThat(runData.getFractionalPercentile(0.6D))
|
||||
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
||||
assertThat(runData.getFractionalPercentile(0.7D))
|
||||
@ -51,7 +54,7 @@ public class IntegerDistributionsValuesTest {
|
||||
@Test
|
||||
public void testInterpolatedZipf() {
|
||||
RunData runData = iterateMapperLong(new Zipf(10000,2.0), 10000);
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
assertThat(runData.getFractionalPercentile(0.6D))
|
||||
.isCloseTo(1.0D, Offset.offset(0.0001D));
|
||||
assertThat(runData.getFractionalPercentile(0.7D))
|
||||
@ -72,7 +75,7 @@ public class IntegerDistributionsValuesTest {
|
||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||
assertThat(runData.getFractionalPercentile(0.78D))
|
||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -84,7 +87,7 @@ public class IntegerDistributionsValuesTest {
|
||||
.isCloseTo(50.0D, Offset.offset(1.0D));
|
||||
assertThat(runData.getFractionalPercentile(0.78D))
|
||||
.isCloseTo(78.0D, Offset.offset(1.0D));
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -127,7 +130,7 @@ public class IntegerDistributionsValuesTest {
|
||||
int readout = iterations/10;
|
||||
for (int i = 0; i < iterations; i++) {
|
||||
if ((i%readout)==0) {
|
||||
System.out.println("i="+i+"/"+iterations);
|
||||
logger.debug("i="+i+"/"+iterations);
|
||||
}
|
||||
samples[i] = mapper.applyAsDouble(i);
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ import io.nosqlbench.virtdata.library.basics.shared.from_long.to_long.Identity;
|
||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.NumberNameToString;
|
||||
import io.nosqlbench.virtdata.library.basics.shared.from_long.to_string.Template;
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -33,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
public class IntegratedComposerLogicTest {
|
||||
private final static Logger logger = LogManager.getLogger(IntegratedComposerLogicTest.class);
|
||||
|
||||
@Test
|
||||
public void testPreferredReturnType() {
|
||||
|
@ -19,6 +19,8 @@ package io.virtdata;
|
||||
import io.nosqlbench.virtdata.core.bindings.DataMapper;
|
||||
import io.nosqlbench.virtdata.core.bindings.VirtData;
|
||||
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.assertj.core.data.Offset;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@ -27,15 +29,14 @@ import java.util.Locale;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
//import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
|
||||
|
||||
public class IntegratedCurvesTest {
|
||||
private final static Logger logger = LogManager.getLogger(IntegratedComposerLogicTest.class);
|
||||
|
||||
@Test
|
||||
public void testZipf() {
|
||||
DataMapper<Long> mapper = VirtData.getMapper("Zipf(1000,2) -> long", long.class);
|
||||
RunData runData = iterateMapperLong(mapper, 10000);
|
||||
System.out.println(runData);
|
||||
logger.debug(runData);
|
||||
|
||||
assertThat(runData.getStats().getPercentile(0.1d)).isCloseTo(1.0, Offset.offset(0.01d));
|
||||
assertThat(runData.getStats().getPercentile(1.0d)).isCloseTo(1.0, Offset.offset(0.01d));
|
||||
|
Loading…
Reference in New Issue
Block a user