Skip to content
Permalink
Browse files
GEODE-6138: Upgrade to JUnit 5 (#20)
* Upgraded the tests to use JUnit 5.3.2
	* Restructed the gradle files.
  • Loading branch information
nabarunnag committed Dec 11, 2018
1 parent 84eb22d commit f95e4f62fc8d7bfd547bb7a7b408c0a3e6f0f62e
Show file tree
Hide file tree
Showing 30 changed files with 511 additions and 286 deletions.
@@ -34,6 +34,10 @@ apply plugin: 'com.bmuschko.docker-remote-api'

// Import task types
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
// Load all properties in dependency-version.properties as project properties, so all projects can read them
Properties dependencyVersions = new Properties()
dependencyVersions.load(new FileInputStream("${project.projectDir}/gradle/dependency-versions.properties"))
dependencyVersions.keys().each{ k -> project.ext[k] = dependencyVersions[k]}

// Use task types
task buildTestingImage(type: DockerBuildImage) {
@@ -37,9 +37,11 @@ repositories {
}

dependencies {
compile(group: 'junit', name: 'junit', version: '4.12')
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: project.'junit-jupiter-api.version')
testRuntimeOnly(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
compile(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
compile(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
compile(group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25')
compile(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
compile(project(':harness'))
}

@@ -21,7 +21,7 @@
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
@@ -20,7 +20,7 @@
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
@@ -21,7 +21,7 @@
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
@@ -20,7 +20,7 @@
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
@@ -14,19 +14,31 @@
*/
package org.apache.geode.benchmark.tests;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.TempDirectory;

import org.apache.geode.perftest.TestRunners;

@ExtendWith(TempDirectory.class)
public class PartitionedGetBenchmarkTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();

private File folder;

@BeforeEach
void createTemporaryFolder(@TempDirectory.TempDir Path tempFolder) {
folder = tempFolder.toFile();
}

@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
public void benchmarkRunsSuccessfully()
throws Exception {
TestRunners.minimalRunner(folder)
.runTest(new PartitionedGetBenchmark(100));
}
}
@@ -17,20 +17,32 @@

package org.apache.geode.benchmark.tests;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;


import java.io.File;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.TempDirectory;

import org.apache.geode.perftest.TestRunners;

@ExtendWith(TempDirectory.class)
public class PartitionedPutBenchmarkTest {

@Rule
public TemporaryFolder folder = new TemporaryFolder();
private File folder;

@BeforeEach
void createTemporaryFolder(@TempDirectory.TempDir Path tempFolder) {
folder = tempFolder.toFile();
}

@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
public void benchmarkRunsSuccessfully()
throws Exception {
TestRunners.minimalRunner(folder)
.runTest(new PartitionedPutBenchmark(100));
}
}
@@ -14,19 +14,31 @@
*/
package org.apache.geode.benchmark.tests;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.TempDirectory;

import org.apache.geode.perftest.TestRunners;

@ExtendWith(TempDirectory.class)
public class ReplicatedGetBenchmarkTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();

private File folder;

@BeforeEach
void createTemporaryFolder(@TempDirectory.TempDir Path tempFolder) {
folder = tempFolder.toFile();
}

@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
public void benchmarkRunsSuccessfully()
throws Exception {
TestRunners.minimalRunner(folder)
.runTest(new ReplicatedGetBenchmark(100));
}
}
@@ -17,20 +17,30 @@

package org.apache.geode.benchmark.tests;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.TempDirectory;

import org.apache.geode.perftest.TestRunners;

@ExtendWith(TempDirectory.class)
public class ReplicatedPutBenchmarkTest {

@Rule
public TemporaryFolder folder = new TemporaryFolder();
private File folder;

@BeforeEach
void createTemporaryFolder(@TempDirectory.TempDir Path tempFolder) {
folder = tempFolder.toFile();
}

@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
public void benchmarkRunsSuccessfully()
throws Exception {
TestRunners.minimalRunner(folder)
.runTest(new ReplicatedPutBenchmark(100));
}
}
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# The versionNumber follows semantic versioning conventions.
versionNumber = 1.9.0

# The releaseQualifier uses the following conventions:
# .M? - milestone release
# -beta.? - beta release
# <blank> - release
releaseQualifier =
# The releaseType uses the following conventions:
# -SNAPSHOT - development version
# <blank> - release
releaseType = -SNAPSHOT

# Maven also uses the project group as a prefix.
group = org.apache.geode

# 'apply from:' location for gradle scripts, relative to the project root. Specified here so that
# it may be overridden by external projects or custom develop environment configurations
scriptDir = gradle

# Set the buildId to add build metadata that can be viewed from
# gfsh or pulse (`gfsh version --full`). Can be set using
# `gradle -PbuildId=N ...` where N is an artibitrary string.buildId = 0
buildId = 0

productName = Apache Geode
productOrg = Apache Software Foundation (ASF)

minimumGradleVersion = 4.10.1
@@ -0,0 +1,29 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Dependency versions
junit-jupiter-api.version = 5.3.2
junit-jupiter-engine.version = 5.3.2
junit-pioneer.version = 0.3.0
geode-core.version = 1.7.0
slf4j-simple.version = 1.7.25
sshj.version = 0.26.0
commons-io.version = 2.6
yardstick.version = 0.8.3
HdrHistogram.version = 2.1.10
mockito-all.version = 1.10.19
awaitility.version = 3.0.0
sshd-core.version = 2.1.0
assertj-core.version = 3.11.1
@@ -35,14 +35,16 @@ task(analyzeRun, dependsOn: 'classes', type: JavaExec) {
}

dependencies {
testCompile(group: 'junit', name: 'junit', version: '4.12')
compile(group: 'com.hierynomus', name: 'sshj', version: '0.26.0')
compile(group: 'commons-io', name: 'commons-io', version: '2.6')
compile(group: 'org.yardstickframework', name: 'yardstick', version: '0.8.3')
compile(group: 'org.hdrhistogram', name: 'HdrHistogram', version: '2.1.10')
testCompile(group: 'org.mockito', name: 'mockito-all', version: '1.10.19')
testCompile(group: 'org.awaitility', name: 'awaitility', version: '3.0.0')
testCompile(group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25')
testCompile(group: 'org.apache.sshd', name: 'sshd-core', version: '2.1.0')
testCompile(group: 'org.assertj', name: 'assertj-core', version: '3.11.1')
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: project.'junit-jupiter-api.version')
testRuntimeOnly(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
compile(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
compile(group: 'com.hierynomus', name: 'sshj', version: project.'sshj.version')
compile(group: 'commons-io', name: 'commons-io', version: project.'commons-io.version')
compile(group: 'org.yardstickframework', name: 'yardstick', version: project.'yardstick.version')
compile(group: 'org.hdrhistogram', name: 'HdrHistogram', version: project.'HdrHistogram.version')
testCompile(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testCompile(group: 'org.awaitility', name: 'awaitility', version: project.'awaitility.version')
testCompile(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
testCompile(group: 'org.apache.sshd', name: 'sshd-core', version: project.'sshd-core.version')
testCompile(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
}
@@ -17,6 +17,8 @@

package org.apache.geode.perftest.infrastructure.local;

import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -95,7 +97,7 @@ public void copyToNodes(Iterable<File> files, Function<Node, String> destDirFunc
destDir.toFile().mkdirs();

for (File file : files) {
Files.copy(file.toPath(), destDir.resolve(file.getName()));
Files.copy(file.toPath(), destDir.resolve(file.getName()), REPLACE_EXISTING);
}
}
}

0 comments on commit f95e4f6

Please sign in to comment.