Skip to content

Commit

Permalink
Merge pull request #851 from hcoles/master
Browse files Browse the repository at this point in the history
Release 1.6.2
  • Loading branch information
hcoles authored Dec 31, 2020
2 parents 97abb15 + 96d4bf5 commit 40c8526
Show file tree
Hide file tree
Showing 41 changed files with 538 additions and 241 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI
on:
push:
branches:
- 'master'
pull_request:
branches-ignore:
- 'release'
jobs:
supported-jdk:
name: ${{ matrix.title }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- title: "JDK 8"
java: 8
- title: "JDK 11"
java: 11
- title: "JDK 15"
java: 15
runs-on: ubuntu-latest
steps:
- name: 'Checkout from Git'
uses: actions/checkout@v2
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: 'Display JDK version'
run: java -version
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: 'Test'
# install rather than verify to ensure correct version used during integration test
run: mvn -B install
30 changes: 30 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy snapshot
on:
push:
branches:
- master
jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Setup Java JDK
uses: actions/setup-java@v1.4.3
with:
java-version: 8
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish JARs
run: mvn -B deploy -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ target/
dependency-reduced-pom.xml
.flattened-pom.xml
*/bin
.DS_Store

48 changes: 0 additions & 48 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.pitest/pitest/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/org.pitest/pitest)
[![Build Status](https://travis-ci.org/hcoles/pitest.png?branch=master)](https://travis-ci.org/hcoles/pitest)
![Build Statis](https://github.com/hcoles/pitest/workflows/CI/badge.svg?branch=master)
[![Build Status](https://dev.azure.com/henrycoles/pitest/_apis/build/status/hcoles.pitest?branchName=master)](https://dev.azure.com/henrycoles/pitest/_build/latest?definitionId=3&branchName=master)

Pitest (aka PIT) is a state of the art mutation testing system for Java and the JVM.
Expand All @@ -8,6 +8,14 @@ Read all about it at http://pitest.org

## Releases

### 1.6.1

* Automate release to maven central
* #774 Test strength statistic (thanks @alex859)
* #798 Enable jvm args to be passed from command line (thanks @yfrolov)
* #797 Add line coverage to console (thanks @qxo)
* #822 Mitigate NPE on accidental dependency (thanks @szpak)

### 1.5.2

* #749 ANT support for the fullMutationMatrix option (thanks @ayaankazerouni)
Expand Down
2 changes: 0 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ trigger:

strategy:
matrix:
linux:
imageName: 'Ubuntu-16.04'
mac:
imageName: 'macos-10.14'
windows:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName" />
<module name="LambdaParameterName" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />
<module name="MemberName" />
Expand Down
2 changes: 1 addition & 1 deletion pitest-entry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.8</version>
<version>1.4.15</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package org.pitest.mutationtest;

import org.pitest.coverage.CoverageDatabase;
import org.pitest.mutationtest.config.ReportOptions;
import org.pitest.mutationtest.engine.MutationEngine;
import org.pitest.plugin.FeatureSetting;
import org.pitest.util.ResultOutputStrategy;

import java.util.Optional;

/**
* Data passed to the listener MutationResultListener factories for use when
* constructing listeners.
Expand All @@ -16,16 +20,35 @@ public class ListenerArguments {
private final SourceLocator locator;
private final MutationEngine engine;
private final boolean fullMutationMatrix;
private final ReportOptions data;
private final FeatureSetting setting;

public ListenerArguments(ResultOutputStrategy outputStrategy,
CoverageDatabase coverage,
SourceLocator locator,
MutationEngine engine,
long startTime,
boolean fullMutationMatrix,
ReportOptions data) {
this(outputStrategy, coverage, locator, engine, startTime, fullMutationMatrix, data, null);
}

public ListenerArguments(final ResultOutputStrategy outputStrategy,
final CoverageDatabase coverage, final SourceLocator locator,
final MutationEngine engine, final long startTime, final boolean fullMutationMatrix) {
ListenerArguments(ResultOutputStrategy outputStrategy,
CoverageDatabase coverage,
SourceLocator locator,
MutationEngine engine,
long startTime,
boolean fullMutationMatrix,
ReportOptions data,
FeatureSetting setting) {
this.outputStrategy = outputStrategy;
this.coverage = coverage;
this.locator = locator;
this.startTime = startTime;
this.engine = engine;
this.fullMutationMatrix = fullMutationMatrix;
this.data = data;
this.setting = setting;
}

public ResultOutputStrategy getOutputStrategy() {
Expand All @@ -51,4 +74,24 @@ public MutationEngine getEngine() {
public boolean isFullMutationMatrix() {
return fullMutationMatrix;
}

public ReportOptions data() {
return data;
}

public Optional<FeatureSetting> settings() {
return Optional.ofNullable(setting);
}

public ListenerArguments withSetting(FeatureSetting setting) {
return new ListenerArguments(outputStrategy,
coverage,
locator,
engine,
startTime,
fullMutationMatrix,
data,
setting);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@

package org.pitest.mutationtest;

import org.pitest.plugin.Feature;
import org.pitest.plugin.ProvidesFeature;
import org.pitest.plugin.ToolClasspathPlugin;

import java.util.Properties;

import org.pitest.plugin.ToolClasspathPlugin;
public interface MutationResultListenerFactory extends ToolClasspathPlugin, ProvidesFeature {

public interface MutationResultListenerFactory extends ToolClasspathPlugin {
Feature LEGACY_MODE = Feature.named("_internal_activate_by_output_string")
.withOnByDefault(true);

MutationResultListener getListener(Properties props, ListenerArguments args);

String name();

default Feature provides() {
return LEGACY_MODE;
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.pitest.mutationtest.build;

import java.util.Collection;
import java.util.List;
import java.util.function.Function;

import org.pitest.classinfo.ClassByteArraySource;
import org.pitest.functional.FCollection;
import org.pitest.mutationtest.config.ReportOptions;
import org.pitest.plugin.FeatureSelector;
import org.pitest.plugin.FeatureSetting;

import java.util.Collection;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

public class CompoundInterceptorFactory {

private final FeatureSelector<MutationInterceptorFactory> features;
Expand All @@ -22,8 +22,9 @@ public CompoundInterceptorFactory(List<FeatureSetting> features,
public MutationInterceptor createInterceptor(
ReportOptions data,
ClassByteArraySource source) {
final List<MutationInterceptor> interceptors = FCollection.map(this.features.getActiveFeatures(),
toInterceptor(this.features, data, source));
final List<MutationInterceptor> interceptors = this.features.getActiveFeatures().stream()
.map(toInterceptor(this.features, data, source))
.collect(Collectors.toList());
return new CompoundMutationInterceptor(interceptors);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,35 @@
*/
package org.pitest.mutationtest.config;

import java.util.Properties;
import java.util.function.Function;

import org.pitest.functional.FCollection;
import org.pitest.mutationtest.ListenerArguments;
import org.pitest.mutationtest.MutationResultListener;
import org.pitest.mutationtest.MutationResultListenerFactory;
import org.pitest.plugin.Feature;
import org.pitest.plugin.FeatureSelector;
import org.pitest.plugin.FeatureSetting;

import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.function.Function;
import java.util.stream.Collectors;

public class CompoundListenerFactory implements MutationResultListenerFactory {

private final Iterable<MutationResultListenerFactory> children;
private final FeatureSelector<MutationResultListenerFactory> features;

public CompoundListenerFactory(
final Iterable<MutationResultListenerFactory> children) {
this.children = children;
public CompoundListenerFactory(List<FeatureSetting> features, final Collection<MutationResultListenerFactory> children) {
this.features = new FeatureSelector<>(features, children);
}

@Override
public MutationResultListener getListener(final Properties props,
final ListenerArguments args) {
return new CompoundTestListener(FCollection.map(this.children,
factoryToListener(props, args)));
}
final List<MutationResultListener> listeners = this.features.getActiveFeatures().stream()
.map(toListener(props, args))
.collect(Collectors.toList());

private Function<MutationResultListenerFactory, MutationResultListener> factoryToListener(
final Properties props, final ListenerArguments args) {
return a -> a.getListener(props, args);
return new CompoundTestListener(listeners);
}

@Override
Expand All @@ -53,4 +55,13 @@ public String description() {
throw new UnsupportedOperationException();
}

@Override
public Feature provides() {
throw new UnsupportedOperationException();
}

private Function<MutationResultListenerFactory, MutationResultListener> toListener(Properties props,
ListenerArguments args) {
return a -> a.getListener(props, args.withSetting(features.getSettingForFeature(a.provides().name())));
}
}
Loading

0 comments on commit 40c8526

Please sign in to comment.