.withOptionalArg().ofType(Boolean.class)
.defaultsTo(Boolean.FALSE);
OptionSpec<File> csvFile = parser.accepts("csvFile", "File to write a CSV version of the benchmark data.")
.withOptionalArg().ofType(File.class);
OptionSet options = parser.parse(args);
int cacheSize = cache.value(options);
RepositoryFixture[] allFixtures = new RepositoryFixture[] {
new JackrabbitRepositoryFixture(
base.value(options), cacheSize),
OakRepositoryFixture.getMemory(cacheSize * MB),
OakRepositoryFixture.getDefault(
base.value(options), cacheSize * MB),
OakRepositoryFixture.getMongo(
host.value(options), port.value(options),
dbName.value(options), dropDBAfterTest.value(options),
cacheSize * MB),
OakRepositoryFixture.getMongoNS(
host.value(options), port.value(options),
dbName.value(options), dropDBAfterTest.value(options),
cacheSize * MB),
OakRepositoryFixture.getMongoMK(
host.value(options), port.value(options),
dbName.value(options), dropDBAfterTest.value(options),
cacheSize * MB),
OakRepositoryFixture.getSegment(
host.value(options), port.value(options), cacheSize),
OakRepositoryFixture.getTar(
base.value(options), 256, cacheSize, mmap.value(options))
};
Benchmark[] allBenchmarks = new Benchmark[] {
new LoginTest(),
new LoginLogoutTest(),
new NamespaceTest(),
new NamespaceRegistryTest(),
new ReadPropertyTest(),
GetNodeTest.withAdmin(),
GetNodeTest.withAnonymous(),
new GetDeepNodeTest(),
new SetPropertyTest(),
new SmallFileReadTest(),
new SmallFileWriteTest(),
new ConcurrentReadTest(),
new ConcurrentReadWriteTest(),
new ConcurrentWriteReadTest(),
new ConcurrentWriteTest(),
new SimpleSearchTest(),
new SQL2SearchTest(),
new DescendantSearchTest(),
new SQL2DescendantSearchTest(),
new CreateManyChildNodesTest(),
new CreateManyNodesTest(),
new UpdateManyChildNodesTest(),
new TransientManyChildNodesTest(),
new WikipediaImport(wikipedia.value(options)),
new CreateNodesBenchmark(),
new ManyNodes(),
new ObservationTest(),
new XmlImportTest(),
new FlatTreeWithAceForSamePrincipalTest(),
new ReadDeepTreeTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ConcurrentReadDeepTreeTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ConcurrentReadSinglePolicyTreeTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ConcurrentReadAccessControlledTreeTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ConcurrentReadAccessControlledTreeTest2(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ConcurrentReadRandomNodeAndItsPropertiesTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options)),
new ManyUserReadTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options),
randomUser.value(options)),
new ConcurrentTraversalTest(
runAsAdmin.value(options),
itemsToRead.value(options),
report.value(options),
randomUser.value(options)),
ReadManyTest.linear("LinearReadEmpty", 1, ReadManyTest.EMPTY),
ReadManyTest.linear("LinearReadFiles", 1, ReadManyTest.FILES),
ReadManyTest.linear("LinearReadNodes", 1, ReadManyTest.NODES),
ReadManyTest.uniform("UniformReadEmpty", 1, ReadManyTest.EMPTY),
ReadManyTest.uniform("UniformReadFiles", 1, ReadManyTest.FILES),
ReadManyTest.uniform("UniformReadNodes", 1, ReadManyTest.NODES),
new ConcurrentCreateNodesTest(),
new SequentialCreateNodesTest(),
};
Set<String> argset = Sets.newHashSet(options.nonOptionArguments());
List<RepositoryFixture> fixtures = Lists.newArrayList();
for (RepositoryFixture fixture : allFixtures) {
if (argset.remove(fixture.toString())) {
fixtures.add(fixture);
}
}
List<Benchmark> benchmarks = Lists.newArrayList();
for (Benchmark benchmark : allBenchmarks) {
if (argset.remove(benchmark.toString())) {
benchmarks.add(benchmark);
}
}
if (argset.isEmpty()) {
PrintStream out = null;
if (options.has(csvFile)) {
out = new PrintStream(FileUtils.openOutputStream(csvFile.value(options), true));
}
for (Benchmark benchmark : benchmarks) {
if (benchmark instanceof CSVResultGenerator) {
((CSVResultGenerator) benchmark).setPrintStream(out);
}
benchmark.run(fixtures, options.valuesOf(concurrency));
}
if (out != null) {
out.close();
}
} else {