Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grinder 5.0.0 Jdk11 and Jython 2.7 #43

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk: openjdk8
jdk: openjdk11

env:
global:
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:8u151-jdk-alpine3.7
FROM openjdk14-jdk-alpine3.10

ENV GRINDER_VERSION 4.0.2-SNAPSHOT
ENV GRINDER_BINARY grinder-${GRINDER_BINARY_VERSION}-binary.zip
Expand Down
16 changes: 8 additions & 8 deletions grinder-console-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>io.github.cossme</groupId>
<artifactId>grinder-parent</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</parent>
<groupId>io.github.cossme</groupId>
<artifactId>grinder-console-service</artifactId>
<packaging>jar</packaging>
<version>4.0.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
<name>grinder-console-service</name>
<description>REST API to The Grinder console.</description>
<url>http://grinder.sourceforge.net</url>
Expand Down Expand Up @@ -61,35 +61,35 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>grinder-core</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>grinder-test-support</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>grinder-core</artifactId>
<type>test-jar</type>
<version>4.0.2-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.0.3.RELEASE</version>
<version>5.2.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.0.3.RELEASE</version>
<version>5.2.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.9.RELEASE</version>
<version>2.3.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

package net.grinder.console.model;

import com.sun.org.apache.regexp.internal.RE;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@

package net.grinder.test.console.model;

import net.grinder.common.GrinderException;
import net.grinder.console.distribution.AgentCacheState;
import net.grinder.console.distribution.FileDistribution;
import net.grinder.console.distribution.FileDistributionHandler;
import net.grinder.console.model.DistributionResult;
import net.grinder.console.model.Files;
import net.grinder.console.service.Bootstrap;
import net.grinder.util.FileContents;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.Whitebox;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.test.util.ReflectionTestUtils;

import java.beans.PropertyChangeListener;
import java.util.*;
import net.grinder.console.distribution.AgentCacheState;
import net.grinder.console.distribution.FileDistribution;
import net.grinder.console.distribution.FileDistributionHandler;
import net.grinder.console.model.DistributionResult;
import net.grinder.console.model.Files;
import net.grinder.util.FileContents;

/**
* Created by solcyr on 29/01/2018.
Expand Down Expand Up @@ -71,7 +73,7 @@ public void testStatus() {
public void setNewFileTime(long time) {}
public void addListener(PropertyChangeListener listener) {}
});
Whitebox.setInternalState(files, "distributionResult", result);
ReflectionTestUtils.setField(files, "distributionResult", result);
Map<String, Object> status = files.status(fileDistribution);
Assert.assertEquals(status.get("stale"),stale);
Assert.assertEquals(status.get("last-distribution"),result);
Expand Down Expand Up @@ -134,8 +136,8 @@ public void assertHistoryEntry(int index, int nextId, String state, Integer pctC
@Test
public void testStartDistribution() throws FileContents.FileContentsException {
DistributionResultHistory history = new DistributionResultHistory();
Whitebox.setInternalState(files, "nextId", 22);
Whitebox.setInternalState(files, "distributionResult", history);
ReflectionTestUtils.setField(files, "nextId", 22);
ReflectionTestUtils.setField(files, "distributionResult", history);

NextFileSimulator nextFileSimulator = new NextFileSimulator();
Mockito.when(fileDistribution.getHandler()).thenReturn(mockHandler);
Expand Down Expand Up @@ -165,8 +167,8 @@ public void testStartDistribution() throws FileContents.FileContentsException {
@Test
public void testStartDistributionBadHandler() throws FileContents.FileContentsException {
DistributionResultHistory history = new DistributionResultHistory();
Whitebox.setInternalState(files, "nextId", 22);
Whitebox.setInternalState(files, "distributionResult", history);
ReflectionTestUtils.setField(files, "nextId", 22);
ReflectionTestUtils.setField(files, "distributionResult", history);

Mockito.when(fileDistribution.getHandler()).thenReturn(mockHandler);
Mockito.when(mockHandler.sendNextFile()).thenThrow(new FileContents.FileContentsException("Distribution failed"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.Whitebox;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.springframework.test.util.ReflectionTestUtils;

import java.io.File;
import java.io.FileWriter;
Expand All @@ -46,7 +46,7 @@ public class TestProcesses {
public void testAgentsStop() {
final Wrapper<Boolean> called = new Wrapper(false);
Processes processes = new Processes();
Whitebox.setInternalState(processes, "pc", pc);
ReflectionTestUtils.setField(processes, "pc", pc);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
Expand Down Expand Up @@ -86,7 +86,7 @@ private void wokersStart(Map<String, String> userProperties,
final Wrapper<GrinderProperties> called = new Wrapper();

Processes processes = new Processes();
Whitebox.setInternalState(processes, "pc", pc);
ReflectionTestUtils.setField(processes, "pc", pc);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
Expand Down Expand Up @@ -137,7 +137,7 @@ private void wokersStartDistributed(Properties selectedProperties,
final Wrapper<GrinderProperties> called = new Wrapper();

Processes processes = new Processes();
Whitebox.setInternalState(processes, "pc", pc);
ReflectionTestUtils.setField(processes, "pc", pc);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
Expand All @@ -162,7 +162,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
public void testWorkersStop() {
final Wrapper<Boolean> called = new Wrapper(false);
Processes processes = new Processes();
Whitebox.setInternalState(processes, "pc", pc);
ReflectionTestUtils.setField(processes, "pc", pc);
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
Expand All @@ -181,7 +181,7 @@ public void testStatusWithNoReports() throws ConsoleException {
final Wrapper<ProcessControl.Listener> listener = new Wrapper();

Processes processes = new Processes();
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
null,
Expand All @@ -207,7 +207,7 @@ public void testStatusWithReports() throws ConsoleException {
final Wrapper<ProcessControl.Listener> listener = new Wrapper();

Processes processes = new Processes();
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
null,
Expand Down Expand Up @@ -337,7 +337,7 @@ public void testStatusInitialisedDifferentPC() throws ConsoleException {
final Wrapper<ProcessControl.Listener> listener = new Wrapper();

Processes processes = new Processes();
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
package net.grinder.test.console.model;

import clojure.lang.Cons;
import net.grinder.common.GrinderProperties;
import net.grinder.console.common.ConsoleException;
import net.grinder.console.common.Resources;
import net.grinder.console.communication.ProcessControl;
import net.grinder.console.distribution.AgentCacheState;
import net.grinder.console.model.*;
import net.grinder.console.service.Bootstrap;
import net.grinder.statistics.StatisticsServicesImplementation;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.internal.util.reflection.Whitebox;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.springframework.test.util.ReflectionTestUtils;

import javax.validation.constraints.AssertTrue;
import java.io.File;
import java.util.*;
import net.grinder.console.common.ConsoleException;
import net.grinder.console.common.Resources;
import net.grinder.console.communication.ProcessControl;
import net.grinder.console.model.ConsoleProperties;
import net.grinder.console.model.Recording;
import net.grinder.console.model.SampleModel;
import net.grinder.console.model.SampleModelImplementation;
import net.grinder.console.model.SampleModelViews;
import net.grinder.console.service.Bootstrap;
import net.grinder.statistics.StatisticsServicesImplementation;

/**
* Created by csolesala on 30/01/2018.
Expand All @@ -47,7 +49,7 @@ private void internalTestStatus(Map<String, String> input) throws ConsoleExcepti
Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
SampleModel model = Mockito.mock(SampleModel.class);
ProcessControl pc = Mockito.mock(ProcessControl.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
null,
Expand All @@ -63,7 +65,7 @@ private void internalTestStatus(Map<String, String> input) throws ConsoleExcepti
public long getSampleCount() { return Long.parseLong(input.get("sample-count")); }
});
Recording recording = new Recording();
Whitebox.setInternalState(recording, "model", model);
ReflectionTestUtils.setField(recording, "model", model);
Map<String, String> result = recording.status();

Assert.assertEquals(input, result);
Expand Down Expand Up @@ -108,9 +110,9 @@ public void testStop () throws ConsoleException {
private void initializeMock(Recording recording, Wrapper<String> called) throws ConsoleException {
Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
SampleModel model = Mockito.mock(SampleModel.class);
Whitebox.setInternalState(recording, "model", model);
ReflectionTestUtils.setField(recording, "model", model);
ProcessControl pc = Mockito.mock(ProcessControl.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
null,
Expand Down Expand Up @@ -158,7 +160,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
@Test
public void testDataUninitialised () {
Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", null);
ReflectionTestUtils.setField(bootstrap, "INSTANCE", null);
Recording recording = new Recording();
try {
recording.data();
Expand Down Expand Up @@ -196,7 +198,7 @@ public void testData () throws ConsoleException {

Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
ProcessControl pc = Mockito.mock(ProcessControl.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
null,
model,
sampleModelView,
Expand Down Expand Up @@ -259,7 +261,7 @@ public String answer(InvocationOnMock invocation) throws Throwable {

Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
ProcessControl pc = Mockito.mock(ProcessControl.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
consoleProperties,
sm,
sampleModelView,
Expand Down Expand Up @@ -328,7 +330,7 @@ public String answer(InvocationOnMock invocation) throws Throwable {

Bootstrap bootstrap = Mockito.mock(Bootstrap.class);
ProcessControl pc = Mockito.mock(ProcessControl.class);
Whitebox.setInternalState(bootstrap, "INSTANCE", new Bootstrap(
ReflectionTestUtils.setField(bootstrap, "INSTANCE", new Bootstrap(
consoleProperties,
sm,
sampleModelView,
Expand Down
Loading