pax_global_header 0000666 0000000 0000000 00000000064 14512577051 0014521 g ustar 00root root 0000000 0000000 52 comment=f33756c37f1e41041d84018047b14cb394742761
jacoco-0.8.11/ 0000775 0000000 0000000 00000000000 14512577051 0013046 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/.appveyor.yml 0000664 0000000 0000000 00000001157 14512577051 0015520 0 ustar 00root root 0000000 0000000 cache:
- C:\Users\appveyor\.m2 -> **\pom.xml
install:
- mkdir .jdk
- curl -L "https://api.azul.com/zulu/download/community/v1.0/bundles/latest/binary/?jdk_version=17&ext=zip&os=windows&arch=x86&hw_bitness=64&javafx=false&bundle_type=jdk" -o .jdk/jdk.zip
- unzip -d .jdk .jdk/jdk.zip
- mv .jdk/*/* .jdk
- .jdk\bin\java -version
- SET JAVA_HOME=%CD%\.jdk
build_script:
# generation of Javadocs requires Java <= 6 (https://github.com/jacoco/jacoco/issues/110)
- mvn -V -B -e verify -Djdk.version=6 -Dbytecode.version=5 --toolchains=.travis\appveyor-toolchains.xml
artifacts:
- path: jacoco\target\*.zip
jacoco-0.8.11/.azure-pipelines/ 0000775 0000000 0000000 00000000000 14512577051 0016240 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/.azure-pipelines/azure-pipelines.yml 0000664 0000000 0000000 00000005727 14512577051 0022112 0 ustar 00root root 0000000 0000000 jobs:
- job:
strategy:
matrix:
JDK 5:
JDK_VERSION: 5
JDK 6:
JDK_VERSION: 6
JDK 7:
JDK_VERSION: 7
JDK 8:
JDK_VERSION: 8
JDK 9:
JDK_VERSION: 9
JDK 10:
JDK_VERSION: 10
JDK 11:
JDK_VERSION: 11
JDK 11 with ECJ:
JDK_VERSION: 11
ECJ: true
JDK 12:
JDK_VERSION: 12
JDK 13:
JDK_VERSION: 13
JDK 14:
JDK_VERSION: 14
JDK 15:
JDK_VERSION: 15
JDK 16:
JDK_VERSION: 16
JDK 17:
JDK_VERSION: 17
JDK 17 with ECJ:
JDK_VERSION: 17
ECJ: true
JDK 18:
JDK_VERSION: 18
JDK 19:
JDK_VERSION: 19
JDK 20:
JDK_VERSION: 20
JDK 20 with ECJ:
JDK_VERSION: 20
ECJ: true
JDK 21:
JDK_VERSION: 21
JDK 22:
JDK_VERSION: 22
pool:
vmImage: 'ubuntu-20.04'
steps:
- bash: |
set -e
url_var=JDK${JDK_VERSION}_URL
JDK_URL=${!url_var}
mkdir .jdk
curl -L $JDK_URL -o .jdk/jdk.tar.gz
tar -xzf .jdk/jdk.tar.gz -C .jdk --strip-components 1
.jdk/bin/java -version
echo "
jdk$JDK_VERSION$JDK_VERSION$PWD/.jdk
" > toolchains.xml
displayName: Setup JDK
- bash: |
set -e
mkdir .maven
curl -L "https://archive.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz" -o .maven/maven.tar.gz
tar -xzf .maven/maven.tar.gz -C .maven --strip-components 1
displayName: Setup Maven
- bash: |
if [[ "$JDK_VERSION" -ge "17" ]]; then
export JAVA_HOME=$PWD/.jdk
else
export JAVA_HOME=$JAVA_HOME_17_X64
fi
if [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "5" ]]; then
.maven/bin/mvn -V -B -e -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
deploy:deploy -DdeployAtEnd \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
elif [[ "$BUILD_SOURCEBRANCH" == "refs/heads/master" && "$JDK_VERSION" == "11" ]]; then
.maven/bin/mvn -V -B -e -f org.jacoco.build \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION \
sonar:sonar \
--toolchains=toolchains.xml --settings=.azure-pipelines/maven-settings.xml
else
.maven/bin/mvn -V -B -e \
verify -Djdk.version=$JDK_VERSION -Dbytecode.version=$JDK_VERSION -Decj=${ECJ:-} \
--toolchains=toolchains.xml
fi
displayName: Build
env:
SONARQUBE_TOKEN: $(SONARQUBE_TOKEN)
SONATYPE_USERNAME: $(SONATYPE_USERNAME)
SONATYPE_PASSWORD: $(SONATYPE_PASSWORD)
jacoco-0.8.11/.azure-pipelines/maven-settings.xml 0000664 0000000 0000000 00000001456 14512577051 0021734 0 ustar 00root root 0000000 0000000 sonatype-nexus-snapshots${env.SONATYPE_USERNAME}${env.SONATYPE_PASSWORD}SonarCloudhttps://sonarcloud.io/default${env.SONARQUBE_TOKEN}SonarCloud
jacoco-0.8.11/.gitattributes 0000664 0000000 0000000 00000000230 14512577051 0015734 0 ustar 00root root 0000000 0000000 *.java text eol=lf
*.properties text eol=lf
*.html text eol=lf
*.css text eol=lf
*.js text eol=lf
*.xml text eol=lf
*.xsl text eol=lf
*.dtd text eol=lf
jacoco-0.8.11/.github/ 0000775 0000000 0000000 00000000000 14512577051 0014406 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000136 14512577051 0017113 0 ustar 00root root 0000000 0000000 PLEASE USE ONE OF THE FOLLOWING TEMPLATES
https://github.com/jacoco/jacoco/issues/new/choose
jacoco-0.8.11/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14512577051 0016571 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/.github/ISSUE_TEMPLATE/1_question.yml 0000664 0000000 0000000 00000001735 14512577051 0021411 0 ustar 00root root 0000000 0000000 name: Question
description: Please ask questions at our user forum
title: "PLEASE DO NOT USE GITHUB FOR QUESTIONS - CHECK FAQ OR USE FORUM"
labels: ["declined: question :x:"]
body:
- type: markdown
attributes:
value: |
Please understand that we do **not** use the issue tracker for questions. The issue will be closed as invalid.
Many questions are already answered in our [FAQ](https://www.jacoco.org/jacoco/trunk/doc/faq.html).
Please have a look at our [forum](https://groups.google.com/forum/?fromgroups=#!forum/jacoco) where more questions have been discussed before or ask a new question at the [forum](https://groups.google.com/forum/?fromgroups=#!forum/jacoco).
Thank you for keeping our issue tracker clean!
- type: checkboxes
id: terms
attributes:
label: No questions answered here
options:
- label: I understand that no quesions will be answered on this issue tracker
required: true
jacoco-0.8.11/.github/ISSUE_TEMPLATE/2_bug_report.md 0000664 0000000 0000000 00000001504 14512577051 0021504 0 ustar 00root root 0000000 0000000 ---
name: 'Bug report'
about: 'Report a bug in JaCoCo'
title:
labels: 'type: bug :bug:'
assignes:
---
THIS IS A BUG TRACKER ONLY. FOR QUESTIONS PLEASE CHECK FAQ OR USE FORUM:
http://www.jacoco.org/jacoco/trunk/doc/faq.html
https://groups.google.com/forum/?fromgroups=#!forum/jacoco
Please understand that
ISSUES WITHOUT FOLLOWING INFORMATION WILL BE CLOSED WITHOUT COMMENTS!
Thank you for filing a useful bug report!
### Steps to reproduce
* JaCoCo version: (from right bottom corner of JaCoCo report)
* Operating system:
* Tool integration: Maven / Ant / CLI / API (for others please report to respective project)
* Complete executable reproducer: (e.g. GitHub Repo)
* Steps: (what exactly are you doing with the above reproducer?)
### Expected behaviour
### Actual behaviour
(In case of exceptions provide FULL STACKTRACE)
jacoco-0.8.11/.github/ISSUE_TEMPLATE/3_feature_request.md 0000664 0000000 0000000 00000001427 14512577051 0022544 0 ustar 00root root 0000000 0000000 ---
name: 'Feature request'
about: 'Suggest a feature for JaCoCo'
title:
labels: 'type: enhancement'
assignes:
---
THIS IS A BUG TRACKER ONLY. FOR QUESTIONS PLEASE CHECK FAQ OR USE FORUM:
http://www.jacoco.org/jacoco/trunk/doc/faq.html
https://groups.google.com/forum/?fromgroups=#!forum/jacoco
Please understand that
ISSUES WITHOUT FOLLOWING INFORMATION WILL BE CLOSED WITHOUT COMMENTS!
Thank you for filling feature request!
### Scenario
* JaCoCo version: (from right bottom corner of JaCoCo report)
* Operating system:
* Tool integration: Maven / Ant / CLI / API (for others please report to respective project)
* Description of your use case: (detailed description or executable reproducer, e.g. GitHub repo)
### Current Behaviour
### Wanted Behaviour
### Possible Workarounds
jacoco-0.8.11/.gitignore 0000664 0000000 0000000 00000000201 14512577051 0015027 0 ustar 00root root 0000000 0000000 target/
.settings/
!org.jacoco.core/.settings/
!org.jacoco.core.test/.settings/
org.jacoco.agent/src/jacocoagent.jar
.idea
*.iml
jacoco-0.8.11/.travis/ 0000775 0000000 0000000 00000000000 14512577051 0014434 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/.travis/appveyor-toolchains.xml 0000664 0000000 0000000 00000001034 14512577051 0021162 0 ustar 00root root 0000000 0000000
jdkjava166oracleC:\Program Files\Java\jdk1.6.0
jacoco-0.8.11/LICENSE.md 0000664 0000000 0000000 00000001241 14512577051 0014450 0 ustar 00root root 0000000 0000000 License
=======
Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
The JaCoCo Java Code Coverage Library and all included documentation is made
available by Mountainminds GmbH & Co. KG, Munich. Except indicated below, the
Content is provided to you under the terms and conditions of the Eclipse Public
License Version 2.0 ("EPL"). A copy of the EPL is available at
[https://www.eclipse.org/legal/epl-2.0/](https://www.eclipse.org/legal/epl-2.0/).
Please visit
[http://www.jacoco.org/jacoco/trunk/doc/license.html](http://www.jacoco.org/jacoco/trunk/doc/license.html)
for the complete license information including third party licenses and trademarks.
jacoco-0.8.11/README.md 0000664 0000000 0000000 00000002312 14512577051 0014323 0 ustar 00root root 0000000 0000000 JaCoCo Java Code Coverage Library
=================================
[](https://dev.azure.com/jacoco-org/JaCoCo/_build/latest?definitionId=1&branchName=master)
[](https://ci.appveyor.com/project/JaCoCo/jacoco/branch/master)
[](http://search.maven.org/#search|ga|1|g%3Aorg.jacoco)
JaCoCo is a free Java code coverage library distributed under the Eclipse Public
License. Check the [project homepage](http://www.jacoco.org/jacoco)
for downloads, documentation and feedback.
Please use our [mailing list](https://groups.google.com/forum/?fromgroups=#!forum/jacoco)
for questions regarding JaCoCo which are not already covered by the
[extensive documentation](http://www.jacoco.org/jacoco/trunk/doc/).
Note: We do not answer general questions in the project's issue tracker. Please use our [mailing list](https://groups.google.com/forum/?fromgroups=#!forum/jacoco) for this.
-------------------------------------------------------------------------
jacoco-0.8.11/jacoco-maven-plugin.test/ 0000775 0000000 0000000 00000000000 14512577051 0017662 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/.project 0000664 0000000 0000000 00000001073 14512577051 0021332 0 ustar 00root root 0000000 0000000
jacoco-maven-plugin.testorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Nature.settings2PARENT-1-PROJECT_LOC/org.jacoco.core.test/.settings
jacoco-0.8.11/jacoco-maven-plugin.test/it/ 0000775 0000000 0000000 00000000000 14512577051 0020276 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/ 0000775 0000000 0000000 00000000000 14512577051 0024007 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/invoker.properties 0000664 0000000 0000000 00000000034 14512577051 0027577 0 ustar 00root root 0000000 0000000 invoker.buildResult=failure
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/pom.xml 0000664 0000000 0000000 00000003635 14512577051 0025333 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-check-fails-halt@project.groupId@jacoco-maven-pluginprepare-agentcheckcheckCLASSExampleMETHODMISSEDCOUNT0
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/ 0000775 0000000 0000000 00000000000 14512577051 0024576 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0025522 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0026443 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/main/java/Example.java 0000664 0000000 0000000 00000001244 14512577051 0030702 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0025555 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0026476 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001257 14512577051 0031601 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-halt/verify.bsh 0000664 0000000 0000000 00000002032 14512577051 0026006 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Coverage checks have not been met." ) < 0 ) {
throw new RuntimeException( "Coverage checks should not have been met." );
}
if ( buildLog.indexOf( "methods missed count is 1, but expected maximum is 0" ) < 0 ) {
throw new RuntimeException( "Should have displayed insufficient code coverage messages." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/ 0000775 0000000 0000000 00000000000 14512577051 0024421 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/pom.xml 0000664 0000000 0000000 00000003552 14512577051 0025743 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-check-fails-no-hault@project.groupId@jacoco-maven-pluginprepare-agentcheckcheckfalseBUNDLEMETHODMISSEDCOUNT0
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/ 0000775 0000000 0000000 00000000000 14512577051 0025210 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026134 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027055 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/main/java/Example.java 0000664 0000000 0000000 00000001244 14512577051 0031314 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026167 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027110 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001257 14512577051 0032213 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-fails-no-halt/verify.bsh 0000664 0000000 0000000 00000002031 14512577051 0026417 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Coverage checks have not been met." ) < 0 ) {
throw new RuntimeException( "Coverage checks should not have been met." );
}
if ( buildLog.indexOf( "methods missed count is 1, but expected maximum is 0" ) < 0 ) {
throw new RuntimeException( "Should have displayed insufficient code coverage messages." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/ 0000775 0000000 0000000 00000000000 14512577051 0023261 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/pom.xml 0000664 0000000 0000000 00000003775 14512577051 0024612 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-check-passes@project.groupId@jacoco-maven-pluginprepare-agentcheckcheckBUNDLEINSTRUCTIONCOVEREDRATIO0.90CLASSMISSEDCOUNT0
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/ 0000775 0000000 0000000 00000000000 14512577051 0024050 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0024774 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0025715 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/main/java/Example.java 0000664 0000000 0000000 00000001244 14512577051 0030154 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0025027 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0025750 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001272 14512577051 0031050 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-check-passes/verify.bsh 0000664 0000000 0000000 00000001522 14512577051 0025263 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "All coverage checks have been met." ) < 0 ) {
throw new RuntimeException( "Coverage checks were not met." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/ 0000775 0000000 0000000 00000000000 14512577051 0024026 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/pom.xml 0000664 0000000 0000000 00000005053 14512577051 0025346 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-customize-agentcoverageAgent${project.build.directory}/coverage.execfalsesun.reflect.DelegatingClassLoader:MyClassLoadertruetruesessiontruefilelocalhost9999${project.build.directory}/classdumpstrue${jacoco.destFile}@project.groupId@jacoco-maven-pluginprepare-agentreport*java.*sun.*org.apache.maven.pluginsmaven-surefire-plugin${coverageAgent}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/ 0000775 0000000 0000000 00000000000 14512577051 0024615 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0025541 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0026462 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/main/java/Example.java 0000664 0000000 0000000 00000001164 14512577051 0030722 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0025574 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0026515 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0031607 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-customize-agent/verify.bsh 0000664 0000000 0000000 00000003351 14512577051 0026032 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String agentOptions = "destfile=" + basedir + File.separator + "target" + File.separator + "coverage.exec"
+ ",append=false"
+ ",includes=*"
+ ",excludes=java.*:sun.*"
+ ",exclclassloader=sun.reflect.DelegatingClassLoader:MyClassLoader"
+ ",inclbootstrapclasses=true"
+ ",inclnolocationclasses=true"
+ ",sessionid=session"
+ ",dumponexit=true"
+ ",output=file"
+ ",address=localhost"
+ ",port=9999"
+ ",classdumpdir=" + basedir + File.separator + "target" + File.separator + "classdumps"
+ ",jmx=true";
//backslashes will be escaped
agentOptions = agentOptions.replace("\\","\\\\");
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( agentOptions ) < 0 ) {
throw new RuntimeException( "Property was not configured, expected " + agentOptions );
}
File file = new File( basedir, "target/coverage.exec" );
if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
File reportDir = new File( basedir, "target/site/jacoco" );
if ( !reportDir.isDirectory() )
{
throw new RuntimeException( "Could not find generated report" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/ 0000775 0000000 0000000 00000000000 14512577051 0021655 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/pom.xml 0000664 0000000 0000000 00000006230 14512577051 0023173 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-dump@project.groupId@jacoco-maven-pluginprepare-agentprepare-agentdumpintegration-testdumpcheckcheckBUNDLECLASSCOVEREDCOUNT1org.apache.maven.pluginsmaven-antrun-plugin1.6launch-serverpre-integration-testrunstop-serverpost-integration-testrun
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/src/ 0000775 0000000 0000000 00000000000 14512577051 0022444 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0023370 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0024311 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/src/main/java/Server.java 0000664 0000000 0000000 00000002034 14512577051 0026421 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
import java.io.File;
/**
* Simple server which runs as long a termination file is created.
*/
public class Server {
public static void main(String[] args) throws Exception {
System.out.println("Test server started");
// Wait for termination file to turn up
// This option puts the target in a pseudo 'server' mode
if (args.length == 1) {
final File termFile = new File(args[0]);
while (!termFile.exists()) {
Thread.sleep(100);
}
}
System.out.println("Test server stopped");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-dump/verify.bsh 0000664 0000000 0000000 00000001522 14512577051 0023657 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "All coverage checks have been met." ) < 0 ) {
throw new RuntimeException( "Coverage checks were not met." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/ 0000775 0000000 0000000 00000000000 14512577051 0024330 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/pom.xml 0000664 0000000 0000000 00000003041 14512577051 0025643 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-includes-excludes@project.groupId@jacoco-maven-plugin**/FileUtil***/TestUtil*prepare-agentprepare-agentreportreport
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/ 0000775 0000000 0000000 00000000000 14512577051 0025117 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026043 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0026764 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/org/ 0000775 0000000 0000000 00000000000 14512577051 0027553 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/org/project/ 0000775 0000000 0000000 00000000000 14512577051 0031221 5 ustar 00root root 0000000 0000000 DatabaseUtil.java 0000664 0000000 0000000 00000001226 14512577051 0034350 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/org/project /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.project;
public class DatabaseUtil {
public void doStuff() {
System.out.println("Do DatabaseUtil Stuff");
}
}
FileUtil.java 0000664 0000000 0000000 00000001216 14512577051 0033522 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/org/project /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.project;
public class FileUtil {
public void doStuff() {
System.out.println("Do FileUtil Stuff");
}
}
TestUtil.java 0000664 0000000 0000000 00000001216 14512577051 0033562 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/main/java/org/project /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.project;
public class TestUtil {
public void doStuff() {
System.out.println("Do TestUtil Stuff");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026076 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027017 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/test/java/org/ 0000775 0000000 0000000 00000000000 14512577051 0027606 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/test/java/org/project/ 0000775 0000000 0000000 00000000000 14512577051 0031254 5 ustar 00root root 0000000 0000000 TestDatabaseUtil.java 0000664 0000000 0000000 00000001256 14512577051 0035246 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/src/test/java/org/project /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.project;
import org.junit.Test;
public class TestDatabaseUtil {
@Test
public void testDoStuff() {
new DatabaseUtil().doStuff();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-includes-excludes/verify.bsh 0000664 0000000 0000000 00000002457 14512577051 0026342 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String agentOptions = "excludes=**/FileUtil*:**/TestUtil*";
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( agentOptions ) < 0 ) {
throw new RuntimeException("Include/Exclude was not configured correct" );
}
File databaseUtilReportFile = new File( basedir, "target/site/jacoco/org.project/DatabaseUtil.html" );
if ( !databaseUtilReportFile.isFile() )
{
throw new FileNotFoundException( "DatabaseUtil should NOT be excluded: " + databaseUtilReportFile );
}
File testUtilReportFile = new File( basedir, "target/site/jacoco/org.project/TestUtil.html" );
if ( testUtilReportFile.isFile() )
{
throw new RuntimeException( "TestUtil SHOULD be excluded: " + testUtilReportFile );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/ 0000775 0000000 0000000 00000000000 14512577051 0026603 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/invoker.properties 0000664 0000000 0000000 00000000034 14512577051 0032373 0 ustar 00root root 0000000 0000000 invoker.java.version = 1.9+
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/pom.xml 0000664 0000000 0000000 00000005053 14512577051 0030123 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-java9-offline-instrumentation@project.groupId@org.jacoco.agentruntime@project.version@testorg.apache.maven.pluginsmaven-compiler-plugin99@project.groupId@jacoco-maven-plugininstrument-classesinstrumentrestore-instrumented-classesrestore-instrumented-classesreportreport${project.build.directory}/coverage.execorg.apache.maven.pluginsmaven-surefire-plugin${project.build.directory}/coverage.exec
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/ 0000775 0000000 0000000 00000000000 14512577051 0027372 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0030316 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0031237 5 ustar 00root root 0000000 0000000 module-info.java 0000664 0000000 0000000 00000001056 14512577051 0034243 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
module org.example {
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/java/org/ 0000775 0000000 0000000 00000000000 14512577051 0032026 5 ustar 00root root 0000000 0000000 example/ 0000775 0000000 0000000 00000000000 14512577051 0033402 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/java/org Example.java 0000664 0000000 0000000 00000001212 14512577051 0035634 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/main/java/org/example /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.example;
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0030351 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0031272 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/test/java/org/ 0000775 0000000 0000000 00000000000 14512577051 0032061 5 ustar 00root root 0000000 0000000 example/ 0000775 0000000 0000000 00000000000 14512577051 0033435 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/test/java/org ExampleTest.java 0000664 0000000 0000000 00000001240 14512577051 0036530 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9-offline-instrumentation/src/test/java/org/example /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.example;
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/ 0000775 0000000 0000000 00000000000 14512577051 0021722 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/invoker.properties 0000664 0000000 0000000 00000000034 14512577051 0025512 0 ustar 00root root 0000000 0000000 invoker.java.version = 1.9+
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/pom.xml 0000664 0000000 0000000 00000004106 14512577051 0023240 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOT../setup-parentit-java9org.apache.maven.pluginsmaven-compiler-plugin99@project.groupId@jacoco-maven-pluginprepare-agentreportcheckcheckINSTRUCTIONCOVEREDCOUNT88
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/ 0000775 0000000 0000000 00000000000 14512577051 0022511 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0023435 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0024356 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/main/java/Example.java 0000664 0000000 0000000 00000001250 14512577051 0026612 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello(String name) {
// http://openjdk.java.net/jeps/280
System.out.println("Hello, " + name);
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0023470 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0024411 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-java9/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001220 14512577051 0027502 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello("test");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/ 0000775 0000000 0000000 00000000000 14512577051 0023303 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-merge/ 0000775 0000000 0000000 00000000000 14512577051 0027405 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-merge/pom.xml 0000664 0000000 0000000 00000003143 14512577051 0030723 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-merge-passes1.0-SNAPSHOTit-merge-passes-merge@project.groupId@jacoco-maven-pluginmergemerge${project.parent.build.directory}*.exec
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/ 0000775 0000000 0000000 00000000000 14512577051 0030035 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/pom.xml 0000664 0000000 0000000 00000001542 14512577051 0031354 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-merge-passes1.0-SNAPSHOTit-merge-passes-project1
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/ 0000775 0000000 0000000 00000000000 14512577051 0030624 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0031550 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0032471 5 ustar 00root root 0000000 0000000 Example.java 0000664 0000000 0000000 00000001166 14512577051 0034654 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/main/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0031603 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0032524 5 ustar 00root root 0000000 0000000 ExampleTest.java 0000664 0000000 0000000 00000001214 14512577051 0035541 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project1/src/test/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/ 0000775 0000000 0000000 00000000000 14512577051 0030036 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/pom.xml 0000664 0000000 0000000 00000001542 14512577051 0031355 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-merge-passes1.0-SNAPSHOTit-merge-passes-project2
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/ 0000775 0000000 0000000 00000000000 14512577051 0030625 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0031551 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0032472 5 ustar 00root root 0000000 0000000 Example.java 0000664 0000000 0000000 00000001166 14512577051 0034655 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/main/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0031604 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0032525 5 ustar 00root root 0000000 0000000 ExampleTest.java 0000664 0000000 0000000 00000001214 14512577051 0035542 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/it-merge-passes-project2/src/test/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/pom.xml 0000664 0000000 0000000 00000003421 14512577051 0024620 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-merge-passespomit-merge-passes-project1it-merge-passes-project2it-merge-passes-merge@project.groupId@jacoco-maven-pluginprepare-agentprepare-agent${project.parent.build.directory}/${project.artifactId}.execorg.apache.maven.pluginsmaven-surefire-plugin${argLine}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-merge-passes/verify.bsh 0000664 0000000 0000000 00000001674 14512577051 0025315 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Loading execution data file" ) < 0 ) {
throw new RuntimeException( "Could not load execution data file" );
}
if ( buildLog.indexOf( "Writing merged execution data to" ) < 0 ) {
throw new RuntimeException( "Could not write merged execution data" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/ 0000775 0000000 0000000 00000000000 14512577051 0023325 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child-jar-without-sources/ 0000775 0000000 0000000 00000000000 14512577051 0030344 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child-jar-without-sources/pom.xml 0000664 0000000 0000000 00000001610 14512577051 0031657 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-multi-module1.0-SNAPSHOTchild-jar-without-sources
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/ 0000775 0000000 0000000 00000000000 14512577051 0024410 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/pom.xml 0000664 0000000 0000000 00000001514 14512577051 0025726 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-multi-module1.0-SNAPSHOTchild
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/ 0000775 0000000 0000000 00000000000 14512577051 0025177 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026123 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027044 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/main/java/Example.java 0000664 0000000 0000000 00000001164 14512577051 0031304 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/main/java/somepackage/ 0000775 0000000 0000000 00000000000 14512577051 0031323 5 ustar 00root root 0000000 0000000 Example.java 0000664 0000000 0000000 00000001212 14512577051 0033476 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/main/java/somepackage /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package somepackage;
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026156 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027077 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/child/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0032171 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/pom.xml 0000664 0000000 0000000 00000003360 14512577051 0024644 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-multi-modulepomchildchild-jar-without-sourcesskip-child@project.groupId@jacoco-maven-pluginprepare-agentprepare-agentreportreportorg.apache.maven.pluginsmaven-surefire-plugin-ea ${argLine}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/skip-child/ 0000775 0000000 0000000 00000000000 14512577051 0025354 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/skip-child/pom.xml 0000664 0000000 0000000 00000001625 14512577051 0026675 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-multi-module1.0-SNAPSHOTskip-childtrue
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/skip-child/src/ 0000775 0000000 0000000 00000000000 14512577051 0026143 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/skip-child/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0027122 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/skip-child/src/test/ExampleTest.java 0000664 0000000 0000000 00000001156 14512577051 0032223 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multi-module/verify.bsh 0000664 0000000 0000000 00000003671 14512577051 0025336 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) {
throw new RuntimeException( "Execution should be skipped when target/classes does not exist." );
}
File dump2 = new File( basedir, "skip-child/target/jacoco.exec" );
if ( dump2.isFile() ) {
throw new RuntimeException( "Should not be executed for module 'skip-child', but dump found : " + dump2 );
}
if ( !buildLog.contains( "argLine set to empty" ) ) {
throw new RuntimeException( "Property not set to empty when skipping." );
}
File file = new File( basedir, "child/target/jacoco.exec" );
if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
File xmlReport = new File( basedir, "child/target/site/jacoco/jacoco.xml" );
if ( !xmlReport.isFile() )
{
throw new FileNotFoundException( "Could not find generated XML report: " + xmlReport );
}
File csvReport = new File( basedir, "child/target/site/jacoco/jacoco.csv" );
if ( !csvReport.isFile() )
{
throw new FileNotFoundException( "Could not find generated CSV report: " + csvReport );
}
File htmlReport = new File( basedir, "child/target/site/jacoco/index.html" );
if ( !htmlReport.isFile() )
{
throw new FileNotFoundException( "Could not find generated HTML report: " + htmlReport );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/ 0000775 0000000 0000000 00000000000 14512577051 0024727 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/pom.xml 0000664 0000000 0000000 00000004110 14512577051 0026240 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-multiple-executions"-Da=\"1\"" -Db=2@project.groupId@jacoco-maven-pluginfirstprepare-agent${project.build.directory}/nospace.execsecondprepare-agent${project.build.directory}/with space.exec"my" sessionthirdprepare-agent${project.build.directory}/third.exec
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/ 0000775 0000000 0000000 00000000000 14512577051 0025516 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026442 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027363 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/main/java/Example.java 0000664 0000000 0000000 00000001164 14512577051 0031623 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026475 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027416 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0032510 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-multiple-executions/verify.bsh 0000664 0000000 0000000 00000002406 14512577051 0026733 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
File file = new File( basedir, "target/nospace.exec" );
if ( file.isFile() )
{
throw new FileNotFoundException( "Found unwanted dump: " + file );
}
File file = new File( basedir, "target/with space.exec" );
if ( file.isFile() )
{
throw new FileNotFoundException( "Found unwanted dump: " + file );
}
file = new File( basedir, "target/third.exec" );
if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
String argLine = "\"-Da=\\\"1\\\"\" -Db=2";
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( argLine ) < 0 ) {
throw new RuntimeException( "Original argLine was overwritten" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/ 0000775 0000000 0000000 00000000000 14512577051 0025573 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/ 0000775 0000000 0000000 00000000000 14512577051 0032734 5 ustar 00root root 0000000 0000000 pom.xml 0000664 0000000 0000000 00000001555 14512577051 0034200 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes
4.0.0jacocoit-offline-instrumentation1.0-SNAPSHOTchild-without-main-classes
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/0000775 0000000 0000000 00000000000 14512577051 0033523 5 ustar 00root root 0000000 0000000 test/ 0000775 0000000 0000000 00000000000 14512577051 0034423 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src java/ 0000775 0000000 0000000 00000000000 14512577051 0035344 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test ExampleTest.java 0000664 0000000 0000000 00000001156 14512577051 0040445 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child-without-main-classes/src/test/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/ 0000775 0000000 0000000 00000000000 14512577051 0026656 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/pom.xml 0000664 0000000 0000000 00000001530 14512577051 0030172 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-offline-instrumentation1.0-SNAPSHOTchild
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/ 0000775 0000000 0000000 00000000000 14512577051 0027445 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0030371 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0031312 5 ustar 00root root 0000000 0000000 DoNotInstrument.java 0000664 0000000 0000000 00000001174 14512577051 0035215 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class DoNotInstrument {
public void sayHello() {
System.out.println("Hello world");
}
}
Example.java 0000664 0000000 0000000 00000001164 14512577051 0033473 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/main/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0030424 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0031345 5 ustar 00root root 0000000 0000000 ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0034360 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/child/src/test/java /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/pom.xml 0000664 0000000 0000000 00000005132 14512577051 0027111 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-offline-instrumentationpomchildchild-without-main-classes@project.groupId@org.jacoco.agentruntime@project.version@test@project.groupId@jacoco-maven-plugininstrument-classesinstrument**/DoNotInstrument.classrestore-instrumented-classesrestore-instrumented-classesreportreport${project.build.directory}/coverage.execorg.apache.maven.pluginsmaven-surefire-plugin${project.build.directory}/coverage.exec
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-offline-instrumentation/verify.bsh 0000664 0000000 0000000 00000002212 14512577051 0027572 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
File file = new File( basedir, "child/target/generated-classes/jacoco/Example.class" );
if ( !file.isFile() ) {
throw new RuntimeException( "Could not find backup of instrumented class: " + file );
}
file = new File( basedir, "child/target/generated-classes/jacoco/DoNotInstrument.class" );
if ( file.isFile() ) {
throw new RuntimeException( "Excluded file should not be instrumented: " + file );
}
file = new File( basedir, "child/target/coverage.exec" );
if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/ 0000775 0000000 0000000 00000000000 14512577051 0025173 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/pom.xml 0000664 0000000 0000000 00000002520 14512577051 0026507 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-prepend-property-skip-Dfoo@project.groupId@jacoco-maven-pluginprepare-agenttrue
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/src/ 0000775 0000000 0000000 00000000000 14512577051 0025762 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026741 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027662 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property-skip/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001311 14512577051 0032754 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
import static org.junit.Assert.assertNotNull;
public class ExampleTest {
@Test
public void test() {
assertNotNull(System.getProperty("foo"));
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property/ 0000775 0000000 0000000 00000000000 14512577051 0024227 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property/pom.xml 0000664 0000000 0000000 00000002360 14512577051 0025545 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-prepend-property-ea@project.groupId@jacoco-maven-pluginprepare-agent
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-prepend-property/verify.bsh 0000664 0000000 0000000 00000001724 14512577051 0026235 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String agentOptions = "jacoco.exec -ea";
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( agentOptions ) < 0 ) {
throw new RuntimeException( "Property was not configured" );
}
File file = new File( basedir, "target/jacoco.exec" );
if ( !file.isFile() )
{
throw new FileNotFoundException( "Could not find generated dump: " + file );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/ 0000775 0000000 0000000 00000000000 14512577051 0027055 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/ 0000775 0000000 0000000 00000000000 14512577051 0030221 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/pom.xml 0000664 0000000 0000000 00000001746 14512577051 0031546 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate-customization1.0-SNAPSHOTchild1jartarget/child1.coverage
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/ 0000775 0000000 0000000 00000000000 14512577051 0031010 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0031734 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0032655 5 ustar 00root root 0000000 0000000 package1/ 0000775 0000000 0000000 00000000000 14512577051 0034252 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/main/java Example1.java 0000664 0000000 0000000 00000001147 14512577051 0036574 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/main/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
public class Example1 {
public void a() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0031767 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0032710 5 ustar 00root root 0000000 0000000 package1/ 0000775 0000000 0000000 00000000000 14512577051 0034305 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/test/java Example1Test.java 0000664 0000000 0000000 00000001243 14512577051 0037464 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child1/src/test/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
import org.junit.Test;
public class Example1Test {
@Test
public void test() {
new Example1().a();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/ 0000775 0000000 0000000 00000000000 14512577051 0030222 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/pom.xml 0000664 0000000 0000000 00000001746 14512577051 0031547 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate-customization1.0-SNAPSHOTchild2jartarget/child2.coverage
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/ 0000775 0000000 0000000 00000000000 14512577051 0031011 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0031735 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0032656 5 ustar 00root root 0000000 0000000 package2/ 0000775 0000000 0000000 00000000000 14512577051 0034254 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/main/java Example2.java 0000664 0000000 0000000 00000001147 14512577051 0036577 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/main/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
public class Example2 {
public void a() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0031770 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0032711 5 ustar 00root root 0000000 0000000 package2/ 0000775 0000000 0000000 00000000000 14512577051 0034307 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/test/java Example2Test.java 0000664 0000000 0000000 00000001243 14512577051 0037467 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/child2/src/test/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
import org.junit.Test;
public class Example2Test {
@Test
public void test() {
new Example2().a();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/pom.xml 0000664 0000000 0000000 00000002573 14512577051 0030401 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-aggregate-customizationpomchild1child2report@project.groupId@jacoco-maven-pluginprepare-agentprepare-agent
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/report/ 0000775 0000000 0000000 00000000000 14512577051 0030370 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/report/pom.xml 0000664 0000000 0000000 00000004201 14512577051 0031702 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate-customization1.0-SNAPSHOTreportAggregate Report${project.groupId}child1${project.version}${project.groupId}child2${project.version}@project.groupId@jacoco-maven-pluginreport-aggregateverifyreport-aggregatetarget/*.coveragetarget/child2.coveragetarget/jacoco-aggregate-customizationtrue
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate-customization/verify.bsh 0000664 0000000 0000000 00000003476 14512577051 0031071 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
import org.codehaus.plexus.util.*;
import java.util.regex.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
// Test customization of dataFileIncludes and dataFileExcludes
if ( !Pattern.compile( "Loading execution data file \\S*child1.target.child1.coverage").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child1 was not loaded." );
}
if ( Pattern.compile( "Loading execution data file \\S*child2").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child2 was loaded." );
}
// Test customization of outputDirectory
File reportChild1 = new File( basedir, "report/target/jacoco-aggregate-customization/child1/index.html" );
if ( !reportChild1.isFile() ) {
throw new RuntimeException( "Report for child1 was not created." );
}
File reportChild2 = new File( basedir, "report/target/jacoco-aggregate-customization/child2/index.html" );
if ( !reportChild2.isFile() ) {
throw new RuntimeException( "Report for child2 was not created." );
}
// Test customization of includeCurrentProject
File reportReport = new File( basedir, "report/target/jacoco-aggregate-customization/report/index.html" );
if ( !reportReport.isFile() ) {
throw new RuntimeException( "Report for report was not created." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/ 0000775 0000000 0000000 00000000000 14512577051 0024147 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/ 0000775 0000000 0000000 00000000000 14512577051 0026270 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/pom.xml 0000664 0000000 0000000 00000002070 14512577051 0027604 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate1.0-SNAPSHOTchild1-testjarjacocochild1${project.version}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/ 0000775 0000000 0000000 00000000000 14512577051 0027057 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0030036 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0030757 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/package1/ 0000775 0000000 0000000 00000000000 14512577051 0032433 5 ustar 00root root 0000000 0000000 Example1bTest.java 0000664 0000000 0000000 00000001245 14512577051 0035677 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1-test/src/test/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
import org.junit.Test;
public class Example1bTest {
@Test
public void test() {
new Example1b().b();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/ 0000775 0000000 0000000 00000000000 14512577051 0025313 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/pom.xml 0000664 0000000 0000000 00000001572 14512577051 0026635 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate1.0-SNAPSHOTchild1jar
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/ 0000775 0000000 0000000 00000000000 14512577051 0026102 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0027026 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027747 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1/ 0000775 0000000 0000000 00000000000 14512577051 0031423 5 ustar 00root root 0000000 0000000 Example1a.java 0000664 0000000 0000000 00000001150 14512577051 0034021 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
public class Example1a {
public void a() {
}
}
Example1b.java 0000664 0000000 0000000 00000001150 14512577051 0034022 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/main/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
public class Example1b {
public void b() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0027061 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0030002 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/package1/ 0000775 0000000 0000000 00000000000 14512577051 0031456 5 ustar 00root root 0000000 0000000 Example1aTest.java 0000664 0000000 0000000 00000001245 14512577051 0034721 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child1/src/test/java/package1 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package1;
import org.junit.Test;
public class Example1aTest {
@Test
public void test() {
new Example1a().a();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/ 0000775 0000000 0000000 00000000000 14512577051 0025314 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/pom.xml 0000664 0000000 0000000 00000001572 14512577051 0026636 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate1.0-SNAPSHOTchild2jar
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/ 0000775 0000000 0000000 00000000000 14512577051 0026103 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0027027 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027750 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/package2/ 0000775 0000000 0000000 00000000000 14512577051 0031425 5 ustar 00root root 0000000 0000000 Example2.java 0000664 0000000 0000000 00000001147 14512577051 0033671 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/main/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
public class Example2 {
public void a() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0027062 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0030003 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/package2/ 0000775 0000000 0000000 00000000000 14512577051 0031460 5 ustar 00root root 0000000 0000000 Example2Test.java 0000664 0000000 0000000 00000001243 14512577051 0034561 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2/src/test/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
import org.junit.Test;
public class Example2Test {
@Test
public void test() {
new Example2().a();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/ 0000775 0000000 0000000 00000000000 14512577051 0025564 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/pom.xml 0000664 0000000 0000000 00000001577 14512577051 0027113 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate1.0-SNAPSHOTchild22.0-SNAPSHOT
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/ 0000775 0000000 0000000 00000000000 14512577051 0026353 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0027277 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0030220 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/main/java/package2/ 0000775 0000000 0000000 00000000000 14512577051 0031675 5 ustar 00root root 0000000 0000000 Example2.java 0000664 0000000 0000000 00000001147 14512577051 0034141 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/main/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
public class Example2 {
public void a() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0027332 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0030253 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/test/java/package2/ 0000775 0000000 0000000 00000000000 14512577051 0031730 5 ustar 00root root 0000000 0000000 Example2Test.java 0000664 0000000 0000000 00000001243 14512577051 0035031 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/child2v2/src/test/java/package2 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package package2;
import org.junit.Test;
public class Example2Test {
@Test
public void test() {
new Example2().a();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/pom.xml 0000664 0000000 0000000 00000002654 14512577051 0025473 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-aggregatepomchild1child1-testchild2child2v2report@project.groupId@jacoco-maven-pluginprepare-agentprepare-agent
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/ 0000775 0000000 0000000 00000000000 14512577051 0025462 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/pom.xml 0000664 0000000 0000000 00000003535 14512577051 0027005 0 ustar 00root root 0000000 0000000
4.0.0jacocoit-report-aggregate1.0-SNAPSHOTreportAggregate Reportjacocochild1${project.version}compilejacocochild1-test${project.version}testjacocochild2[2-SNAPSHOT,)runtime@project.groupId@jacoco-maven-pluginreport-aggregateverifyreport-aggregate
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/src/ 0000775 0000000 0000000 00000000000 14512577051 0026251 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0027230 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0030151 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/src/test/java/packagereport/ 0000775 0000000 0000000 00000000000 14512577051 0033000 5 ustar 00root root 0000000 0000000 ReportTest.java 0000664 0000000 0000000 00000001205 14512577051 0035675 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/report/src/test/java/packagereport /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package packagereport;
import org.junit.Test;
public class ReportTest {
@Test
public void test() {
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-aggregate/verify.bsh 0000664 0000000 0000000 00000004666 14512577051 0026165 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
import org.codehaus.plexus.util.*;
import java.util.regex.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( !Pattern.compile( "Loading execution data file \\S*child1.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child1 was not loaded." );
}
if ( !Pattern.compile( "Loading execution data file \\S*child1-test.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child1-test was not loaded." );
}
if ( !new File( basedir, "child2/target/jacoco.exec" ).isFile()) {
throw new RuntimeException( "No execution data in child2." );
}
if ( Pattern.compile( "Loading execution data file \\S*child2.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child2 was loaded, whereas range should exclude it." );
}
if ( !Pattern.compile( "Loading execution data file \\S*child2v2.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from child2v2 was not loaded." );
}
if ( !Pattern.compile( "Loading execution data file \\S*report.target.jacoco.exec").matcher( buildLog ).find() ) {
throw new RuntimeException( "Execution data from report was not loaded." );
}
File reportChild1 = new File( basedir, "report/target/site/jacoco-aggregate/child1/index.html" );
if ( !reportChild1.isFile() ) {
throw new RuntimeException( "Report for child1 was not created." );
}
File reportChild1test = new File( basedir, "report/target/site/jacoco-aggregate/child1-test/index.html" );
if ( reportChild1test.isFile() ) {
throw new RuntimeException( "Report for child1-test should not be created." );
}
File reportChild2 = new File( basedir, "report/target/site/jacoco-aggregate/child2/index.html" );
if ( !reportChild2.isFile() ) {
throw new RuntimeException( "Report for child2 was not created." );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/ 0000775 0000000 0000000 00000000000 14512577051 0023652 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/nomatch.exec 0000664 0000000 0000000 00000000030 14512577051 0026142 0 ustar 00root root 0000000 0000000 ÀÀ Example jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/pom.xml 0000664 0000000 0000000 00000002461 14512577051 0025172 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-nomatch@project.groupId@jacoco-maven-pluginreportreportnomatch.exec
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/src/ 0000775 0000000 0000000 00000000000 14512577051 0024441 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0025365 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0026306 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/src/main/java/Example.java 0000664 0000000 0000000 00000001061 14512577051 0030542 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
public class Example {
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-nomatch/verify.bsh 0000664 0000000 0000000 00000002215 14512577051 0025654 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Classes in bundle " ) < 0 || buildLog.indexOf(" do not match with execution data." ) < 0 ) {
throw new RuntimeException( "Warning 1 was not printed" );
}
if ( buildLog.indexOf( "For report generation the same class files must be used as at runtime." ) < 0 ) {
throw new RuntimeException( "Warning 2 was not printed" );
}
if ( buildLog.indexOf( "Execution data for class Example does not match." ) < 0 ) {
throw new RuntimeException( "Warning 3 was not printed" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/ 0000775 0000000 0000000 00000000000 14512577051 0025151 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/pom.xml 0000664 0000000 0000000 00000003002 14512577051 0026461 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-select-formats@project.groupId@jacoco-maven-pluginprepare-agentreportreportXMLCSV
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/ 0000775 0000000 0000000 00000000000 14512577051 0025740 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026664 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027605 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/main/java/Example.java 0000664 0000000 0000000 00000001061 14512577051 0032041 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
public class Example {
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026717 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027640 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001177 14512577051 0032744 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-select-formats/verify.bsh 0000664 0000000 0000000 00000002077 14512577051 0027161 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
import java.io.*;
File htmlReportFile = new File( basedir, "target/site/jacoco/index.html" );
if ( htmlReportFile.isFile() ) {
throw new RuntimeException( "Unexpected HTML report was created" );
}
File xmlReportFile = new File( basedir, "target/site/jacoco/jacoco.xml" );
if ( !xmlReportFile.isFile() ) {
throw new RuntimeException( "XML report was not created" );
}
File csvReportFile = new File( basedir, "target/site/jacoco/jacoco.csv" );
if ( !csvReportFile.isFile() ) {
throw new RuntimeException( "CSV report was not created" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/ 0000775 0000000 0000000 00000000000 14512577051 0025266 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/data.txt 0000664 0000000 0000000 00000000015 14512577051 0026734 0 ustar 00root root 0000000 0000000 Invalid data
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/invoker.properties 0000664 0000000 0000000 00000000036 14512577051 0031060 0 ustar 00root root 0000000 0000000 invoker.buildResult = failure
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/pom.xml 0000664 0000000 0000000 00000002465 14512577051 0026612 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-unreadable-dump@project.groupId@jacoco-maven-pluginreportreportdata.txt
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/ 0000775 0000000 0000000 00000000000 14512577051 0026055 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0027001 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/resources/ 0000775 0000000 0000000 00000000000 14512577051 0031013 5 ustar 00root root 0000000 0000000 empty-file.txt 0000664 0000000 0000000 00000000000 14512577051 0033536 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/src/main/resources jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-unreadable-dump/verify.bsh 0000664 0000000 0000000 00000001424 14512577051 0027271 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Invalid execution data file." ) < 0 ) {
throw new RuntimeException( "Error was not printed" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/ 0000775 0000000 0000000 00000000000 14512577051 0025010 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/pom.xml 0000664 0000000 0000000 00000003161 14512577051 0026326 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-without-debug@project.groupId@jacoco-maven-pluginprepare-agentprepare-agentreportreportorg.apache.maven.pluginsmaven-compiler-plugintruenone
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/ 0000775 0000000 0000000 00000000000 14512577051 0025577 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0026523 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0027444 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/main/java/Example.java 0000664 0000000 0000000 00000001164 14512577051 0031704 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0026556 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0027477 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0032571 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-debug/verify.bsh 0000664 0000000 0000000 00000001433 14512577051 0027013 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "with debug information" ) < 0 ) {
throw new RuntimeException( "No warning about debug information" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-dump/ 0000775 0000000 0000000 00000000000 14512577051 0024667 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-dump/pom.xml 0000664 0000000 0000000 00000002315 14512577051 0026205 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-report-without-dump@project.groupId@jacoco-maven-pluginreportreport
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-report-without-dump/verify.bsh 0000664 0000000 0000000 00000001470 14512577051 0026673 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) );
if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing execution data file" ) < 0 ) {
throw new RuntimeException( "Execution was not skipped" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/ 0000775 0000000 0000000 00000000000 14512577051 0023424 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/invoker.properties 0000664 0000000 0000000 00000000173 14512577051 0027220 0 ustar 00root root 0000000 0000000 invoker.goals = clean verify site
# maven-site-plugin 3.3 works with at least Maven 2.2.1+
invoker.maven.version = 2.2.1+
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/pom.xml 0000664 0000000 0000000 00000005633 14512577051 0024750 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-site-failsafeorg.apache.maven.pluginsmaven-failsafe-plugin2.14.1org.apache.maven.pluginsmaven-surefire-plugin2.14.1@project.groupId@jacoco-maven-plugindefault-prepare-agentprepare-agentdefault-prepare-agent-integrationprepare-agent-integrationdefault-report-integrationreport-integrationorg.apache.maven.pluginsmaven-failsafe-plugindefault-integration-testintegration-testorg.apache.maven.pluginsmaven-site-plugin3.3true@project.groupId@jacoco-maven-plugin@project.version@
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/ 0000775 0000000 0000000 00000000000 14512577051 0024213 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0025137 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0026060 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/main/java/Example.java 0000664 0000000 0000000 00000001271 14512577051 0030317 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
public void sayHelloIT() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0025172 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0026113 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleIT.java 0000664 0000000 0000000 00000001212 14512577051 0030602 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleIT {
@Test
public void test() {
new Example().sayHelloIT();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0031205 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site-failsafe/verify.bsh 0000664 0000000 0000000 00000004145 14512577051 0025432 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String projectReportsPage = FileUtils.fileRead( new File( basedir, "target/site/project-reports.html" ) );
if ( projectReportsPage.indexOf( "JaCoCo Coverage Report." ) < 0 ) {
throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" );
}
File htmlReportFile = new File( basedir, "target/site/jacoco/index.html" );
if ( !htmlReportFile.isFile() ) {
throw new RuntimeException( "HTML report was not created" );
}
File xmlReportFile = new File( basedir, "target/site/jacoco/jacoco.xml" );
if ( !xmlReportFile.isFile() ) {
throw new RuntimeException( "XML report was not created" );
}
File csvReportFile = new File( basedir, "target/site/jacoco/jacoco.csv" );
if ( !csvReportFile.isFile() ) {
throw new RuntimeException( "CSV report was not created" );
}
if ( projectReportsPage.indexOf( "JaCoCo IT Coverage Report." ) < 0 ) {
throw new RuntimeException( "project-reports.html does not contain link to JaCoCo Integration report" );
}
File htmlReportFile = new File( basedir, "target/site/jacoco-it/index.html" );
if ( !htmlReportFile.isFile() ) {
throw new RuntimeException( "Integration HTML report was not created" );
}
File xmlReportFile = new File( basedir, "target/site/jacoco-it/jacoco.xml" );
if ( !xmlReportFile.isFile() ) {
throw new RuntimeException( "Integration XML report was not created" );
}
File csvReportFile = new File( basedir, "target/site/jacoco-it/jacoco.csv" );
if ( !csvReportFile.isFile() ) {
throw new RuntimeException( "Integration CSV report was not created" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/ 0000775 0000000 0000000 00000000000 14512577051 0021654 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/invoker.properties 0000664 0000000 0000000 00000000166 14512577051 0025452 0 ustar 00root root 0000000 0000000 invoker.goals = clean test site
# maven-site-plugin 3.0 requires at least Maven 2.2.0
invoker.maven.version = 2.2.0+
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/pom.xml 0000664 0000000 0000000 00000003143 14512577051 0023172 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTit-site@project.groupId@jacoco-maven-pluginprepare-agentorg.apache.maven.pluginsmaven-site-plugin3.3true@project.groupId@jacoco-maven-plugin@project.version@
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/ 0000775 0000000 0000000 00000000000 14512577051 0022443 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/main/ 0000775 0000000 0000000 00000000000 14512577051 0023367 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/main/java/ 0000775 0000000 0000000 00000000000 14512577051 0024310 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/main/java/Example.java 0000664 0000000 0000000 00000001164 14512577051 0026550 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
public class Example {
public void sayHello() {
System.out.println("Hello world");
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/test/ 0000775 0000000 0000000 00000000000 14512577051 0023422 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/test/java/ 0000775 0000000 0000000 00000000000 14512577051 0024343 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/src/test/java/ExampleTest.java 0000664 0000000 0000000 00000001212 14512577051 0027435 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import org.junit.Test;
public class ExampleTest {
@Test
public void test() {
new Example().sayHello();
}
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/it-site/verify.bsh 0000664 0000000 0000000 00000002560 14512577051 0023661 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
import java.io.*;
import org.codehaus.plexus.util.*;
String projectReportsPage = FileUtils.fileRead( new File( basedir, "target/site/project-reports.html" ) );
if ( projectReportsPage.indexOf( "JaCoCo Coverage Report." ) < 0 ) {
throw new RuntimeException( "project-reports.html does not contain link to JaCoCo report" );
}
File htmlReportFile = new File( basedir, "target/site/jacoco/index.html" );
if ( !htmlReportFile.isFile() ) {
throw new RuntimeException( "HTML report was not created" );
}
File xmlReportFile = new File( basedir, "target/site/jacoco/jacoco.xml" );
if ( !xmlReportFile.isFile() ) {
throw new RuntimeException( "XML report was not created" );
}
File csvReportFile = new File( basedir, "target/site/jacoco/jacoco.csv" );
if ( !csvReportFile.isFile() ) {
throw new RuntimeException( "CSV report was not created" );
}
jacoco-0.8.11/jacoco-maven-plugin.test/it/settings.xml 0000664 0000000 0000000 00000002364 14512577051 0022665 0 ustar 00root root 0000000 0000000
it-repotruelocal.central@localRepositoryUrl@truetruelocal.central@localRepositoryUrl@truetrue
jacoco-0.8.11/jacoco-maven-plugin.test/it/setup-parent/ 0000775 0000000 0000000 00000000000 14512577051 0022725 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin.test/it/setup-parent/invoker.properties 0000664 0000000 0000000 00000000117 14512577051 0026517 0 ustar 00root root 0000000 0000000 invoker.goals = org.jacoco:jacoco-maven-plugin:${project.version}:help install
jacoco-0.8.11/jacoco-maven-plugin.test/it/setup-parent/pom.xml 0000664 0000000 0000000 00000003453 14512577051 0024247 0 ustar 00root root 0000000 0000000
4.0.0jacocosetup-parent1.0-SNAPSHOTpomjunitjunit@junit.version@test@project.groupId@jacoco-maven-plugin@project.version@org.apache.maven.pluginsmaven-compiler-plugin2.3.2org.apache.maven.pluginsmaven-surefire-plugin2.9org.apache.maven.pluginsmaven-jar-plugin2.3.1
jacoco-0.8.11/jacoco-maven-plugin.test/pom.xml 0000664 0000000 0000000 00000005447 14512577051 0021211 0 ustar 00root root 0000000 0000000
4.0.0org.jacocoorg.jacoco.tests0.8.11../org.jacoco.testsjacoco-maven-plugin.testjarJaCoCo :: Test :: Maven Plugininvoker.mavenOptsorg.jacoco.maven.*org.apache.maven.pluginsmaven-invoker-plugin${skipTests}it${project.build.directory}/it*/pom.xmlverify${project.build.directory}/local-repocleaninstallit/settings.xmlorg.jacoco:org.jacoco.agent:${project.version}:jar:runtime88installrun
jacoco-0.8.11/jacoco-maven-plugin/ 0000775 0000000 0000000 00000000000 14512577051 0016704 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/.classpath 0000664 0000000 0000000 00000001417 14512577051 0020672 0 ustar 00root root 0000000 0000000
jacoco-0.8.11/jacoco-maven-plugin/.project 0000664 0000000 0000000 00000001327 14512577051 0020356 0 ustar 00root root 0000000 0000000
jacoco-maven-pluginorg.eclipse.jdt.core.javabuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.jdt.core.javanature.settings2PARENT-1-PROJECT_LOC/org.jacoco.core/.settings
jacoco-0.8.11/jacoco-maven-plugin/META-INF/ 0000775 0000000 0000000 00000000000 14512577051 0020044 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/META-INF/m2e/ 0000775 0000000 0000000 00000000000 14512577051 0020527 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/META-INF/m2e/lifecycle-mapping-metadata.xml 0000664 0000000 0000000 00000002007 14512577051 0026416 0 ustar 00root root 0000000 0000000
prepare-agentprepare-agent-integrationmergereportreport-integrationreport-aggregatecheckdumpinstrumentrestore-instrumented-classes
jacoco-0.8.11/jacoco-maven-plugin/pom.xml 0000664 0000000 0000000 00000010206 14512577051 0020220 0 ustar 00root root 0000000 0000000
4.0.0org.jacocoorg.jacoco.build0.8.11../org.jacoco.buildjacoco-maven-pluginmaven-pluginhttps://www.jacoco.org/jacoco/trunk/doc/maven.htmlJaCoCo :: Maven PluginThe JaCoCo Maven Plugin provides the JaCoCo runtime agent to your tests and allows basic report creation.3.0888org.apache.mavenmaven-plugin-api${project.prerequisites.maven}providedorg.apache.mavenmaven-core${project.prerequisites.maven}providedorg.codehaus.plexusplexus-utils3.0.24org.apache.maven.sharedfile-management3.1.0org.apache.maven.reportingmaven-reporting-api${project.prerequisites.maven}${project.groupId}org.jacoco.agentruntime${project.groupId}org.jacoco.core${project.groupId}org.jacoco.reportorg.apache.maven.plugin-toolsmaven-plugin-annotations3.4providedsrcMETA-INFMETA-INForg.apache.maven.pluginsmaven-toolchains-pluginorg.apache.maven.pluginsmaven-plugin-plugindefault-descriptorprocess-classeshelp-goalhelpmojoreportpackagereport
jacoco-0.8.11/jacoco-maven-plugin/src/ 0000775 0000000 0000000 00000000000 14512577051 0017473 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/src/org/ 0000775 0000000 0000000 00000000000 14512577051 0020262 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/ 0000775 0000000 0000000 00000000000 14512577051 0021520 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ 0000775 0000000 0000000 00000000000 14512577051 0022626 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/AbstractAgentMojo.java 0000664 0000000 0000000 00000020571 14512577051 0027045 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.util.StringUtils;
import org.jacoco.core.runtime.AgentOptions;
/**
* Base class for preparing a property pointing to the JaCoCo runtime agent that
* can be passed as a VM argument to the application under test.
*/
public abstract class AbstractAgentMojo extends AbstractJacocoMojo {
/**
* Name of the JaCoCo Agent artifact.
*/
static final String AGENT_ARTIFACT_NAME = "org.jacoco:org.jacoco.agent";
/**
* Name of the property used in maven-osgi-test-plugin.
*/
static final String TYCHO_ARG_LINE = "tycho.testArgLine";
/**
* Name of the property used in maven-surefire-plugin.
*/
static final String SUREFIRE_ARG_LINE = "argLine";
/**
* Map of plugin artifacts.
*/
@Parameter(property = "plugin.artifactMap", required = true, readonly = true)
Map pluginArtifactMap;
/**
* Allows to specify property which will contains settings for JaCoCo Agent.
* If not specified, then "argLine" would be used for "jar" packaging and
* "tycho.testArgLine" for "eclipse-test-plugin".
*/
@Parameter(property = "jacoco.propertyName")
String propertyName;
/**
* If set to true and the execution data file already exists, coverage data
* is appended to the existing file. If set to false, an existing execution
* data file will be replaced.
*/
@Parameter(property = "jacoco.append")
Boolean append;
/**
* A list of class names to include in instrumentation. May use wildcard
* characters (* and ?). When not specified everything will be included.
*/
@Parameter
private List includes;
/**
* A list of class names to exclude from instrumentation. May use wildcard
* characters (* and ?). When not specified nothing will be excluded. Except
* for performance optimization or technical corner cases this option is
* normally not required. If you want to exclude classes from the report
* please configure the report goal accordingly.
*/
@Parameter
private List excludes;
/**
* A list of class loader names, that should be excluded from execution
* analysis. The list entries are separated by a colon (:) and may use
* wildcard characters (* and ?). This option might be required in case of
* special frameworks that conflict with JaCoCo code instrumentation, in
* particular class loaders that do not have access to the Java runtime
* classes.
*/
@Parameter(property = "jacoco.exclClassLoaders")
String exclClassLoaders;
/**
* Specifies whether also classes from the bootstrap classloader should be
* instrumented. Use this feature with caution, it needs heavy
* includes/excludes tuning.
*/
@Parameter(property = "jacoco.inclBootstrapClasses")
Boolean inclBootstrapClasses;
/**
* Specifies whether classes without source location should be instrumented.
*/
@Parameter(property = "jacoco.inclNoLocationClasses")
Boolean inclNoLocationClasses;
/**
* A session identifier that is written with the execution data. Without
* this parameter a random identifier is created by the agent.
*/
@Parameter(property = "jacoco.sessionId")
String sessionId;
/**
* If set to true coverage data will be written on VM shutdown.
*/
@Parameter(property = "jacoco.dumpOnExit")
Boolean dumpOnExit;
/**
* Output method to use for writing coverage data. Valid options are:
*
*
file: At VM termination execution data is written to a file.
*
tcpserver: The agent listens for incoming connections on the TCP port
* specified by the {@link #address} and {@link #port}. Execution data is
* written to this TCP connection.
*
tcpclient: At startup the agent connects to the TCP port specified by
* the {@link #address} and {@link #port}. Execution data is written to this
* TCP connection.
*
none: Do not produce any output.
*
*/
@Parameter(property = "jacoco.output")
String output;
/**
* IP address or hostname to bind to when the output method is tcpserver or
* connect to when the output method is tcpclient. In tcpserver mode the
* value "*" causes the agent to accept connections on any local address.
*/
@Parameter(property = "jacoco.address")
String address;
/**
* Port to bind to when the output method is tcpserver or connect to when
* the output method is tcpclient. In tcpserver mode the port must be
* available, which means that if multiple JaCoCo agents should run on the
* same machine, different ports have to be specified.
*/
@Parameter(property = "jacoco.port")
Integer port;
/**
* If a directory is specified for this parameter the JaCoCo agent dumps all
* class files it processes to the given location. This can be useful for
* debugging purposes or in case of dynamically created classes for example
* when scripting engines are used.
*/
@Parameter(property = "jacoco.classDumpDir")
File classDumpDir;
/**
* If set to true the agent exposes functionality via JMX.
*/
@Parameter(property = "jacoco.jmx")
Boolean jmx;
@Override
public void executeMojo() {
final String name = getEffectivePropertyName();
final Properties projectProperties = getProject().getProperties();
final String oldValue = projectProperties.getProperty(name);
final String newValue = createAgentOptions()
.prependVMArguments(oldValue, getAgentJarFile());
getLog().info(name + " set to " + newValue);
projectProperties.setProperty(name, newValue);
}
@Override
protected void skipMojo() {
final String name = getEffectivePropertyName();
final Properties projectProperties = getProject().getProperties();
final String oldValue = projectProperties.getProperty(name);
if (oldValue == null) {
getLog().info(name + " set to empty");
projectProperties.setProperty(name, "");
}
}
File getAgentJarFile() {
final Artifact jacocoAgentArtifact = pluginArtifactMap
.get(AGENT_ARTIFACT_NAME);
return jacocoAgentArtifact.getFile();
}
AgentOptions createAgentOptions() {
final AgentOptions agentOptions = new AgentOptions();
agentOptions.setDestfile(getDestFile().getAbsolutePath());
if (append != null) {
agentOptions.setAppend(append.booleanValue());
}
if (includes != null && !includes.isEmpty()) {
agentOptions
.setIncludes(StringUtils.join(includes.iterator(), ":"));
}
if (excludes != null && !excludes.isEmpty()) {
agentOptions
.setExcludes(StringUtils.join(excludes.iterator(), ":"));
}
if (exclClassLoaders != null) {
agentOptions.setExclClassloader(exclClassLoaders);
}
if (inclBootstrapClasses != null) {
agentOptions.setInclBootstrapClasses(
inclBootstrapClasses.booleanValue());
}
if (inclNoLocationClasses != null) {
agentOptions.setInclNoLocationClasses(
inclNoLocationClasses.booleanValue());
}
if (sessionId != null) {
agentOptions.setSessionId(sessionId);
}
if (dumpOnExit != null) {
agentOptions.setDumpOnExit(dumpOnExit.booleanValue());
}
if (output != null) {
agentOptions.setOutput(output);
}
if (address != null) {
agentOptions.setAddress(address);
}
if (port != null) {
agentOptions.setPort(port.intValue());
}
if (classDumpDir != null) {
agentOptions.setClassDumpDir(classDumpDir.getAbsolutePath());
}
if (jmx != null) {
agentOptions.setJmx(jmx.booleanValue());
}
return agentOptions;
}
String getEffectivePropertyName() {
if (isPropertyNameSpecified()) {
return propertyName;
}
if (isEclipseTestPluginPackaging()) {
return TYCHO_ARG_LINE;
}
return SUREFIRE_ARG_LINE;
}
boolean isPropertyNameSpecified() {
return propertyName != null && !"".equals(propertyName);
}
boolean isEclipseTestPluginPackaging() {
return "eclipse-test-plugin".equals(getProject().getPackaging());
}
/**
* @return the destFile
*/
abstract File getDestFile();
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/AbstractJacocoMojo.java 0000664 0000000 0000000 00000004053 14512577051 0027202 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
/**
* Base class for JaCoCo Mojos.
*/
public abstract class AbstractJacocoMojo extends AbstractMojo {
/**
* Maven project.
*/
@Parameter(property = "project", readonly = true)
private MavenProject project;
/**
* Flag used to suppress execution.
*/
@Parameter(property = "jacoco.skip", defaultValue = "false")
private boolean skip;
public final void execute()
throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info(
"Skipping JaCoCo execution because property jacoco.skip is set.");
skipMojo();
return;
}
executeMojo();
}
/**
* Executes Mojo.
*
* @throws MojoExecutionException
* if an unexpected problem occurs. Throwing this exception
* causes a "BUILD ERROR" message to be displayed.
* @throws MojoFailureException
* if an expected problem (such as a compilation failure)
* occurs. Throwing this exception causes a "BUILD FAILURE"
* message to be displayed.
*/
protected abstract void executeMojo()
throws MojoExecutionException, MojoFailureException;
/**
* Skips Mojo.
*/
protected void skipMojo() {
}
/**
* @return Maven project
*/
protected final MavenProject getProject() {
return project;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/AbstractReportMojo.java 0000664 0000000 0000000 00000013323 14512577051 0027257 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* troosan - add support for format selection
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import org.apache.maven.doxia.sink.SinkFactory;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.reporting.MavenMultiPageReport;
import org.apache.maven.reporting.MavenReportException;
import org.jacoco.report.IReportGroupVisitor;
import org.jacoco.report.IReportVisitor;
/**
* Base class for creating a code coverage report for tests of a single project
* in multiple formats (HTML, XML, and CSV).
*/
public abstract class AbstractReportMojo extends AbstractMojo
implements MavenMultiPageReport {
/**
* Encoding of the generated reports.
*/
@Parameter(property = "project.reporting.outputEncoding", defaultValue = "UTF-8")
String outputEncoding;
/**
* A list of report formats to generate. Supported formats are HTML, XML and
* CSV. Defaults to all formats if no values are given.
*
* @since 0.8.7
*/
@Parameter(defaultValue = "HTML,XML,CSV")
List formats;
/**
* Name of the root node HTML report pages.
*
* @since 0.7.7
*/
@Parameter(defaultValue = "${project.name}")
String title;
/**
* Footer text used in HTML report pages.
*
* @since 0.7.7
*/
@Parameter
String footer;
/**
* Encoding of the source files.
*/
@Parameter(property = "project.build.sourceEncoding", defaultValue = "UTF-8")
String sourceEncoding;
/**
* A list of class files to include in the report. May use wildcard
* characters (* and ?). When not specified everything will be included.
*/
@Parameter
List includes;
/**
* A list of class files to exclude from the report. May use wildcard
* characters (* and ?). When not specified nothing will be excluded.
*/
@Parameter
List excludes;
/**
* Flag used to suppress execution.
*/
@Parameter(property = "jacoco.skip", defaultValue = "false")
boolean skip;
/**
* Maven project.
*/
@Parameter(property = "project", readonly = true)
MavenProject project;
public String getDescription(final Locale locale) {
return getName(locale) + " Coverage Report.";
}
public boolean isExternalReport() {
return true;
}
public String getCategoryName() {
return CATEGORY_PROJECT_REPORTS;
}
/**
* Returns the list of class files to include in the report.
*
* @return class files to include, may contain wildcard characters
*/
List getIncludes() {
return includes;
}
/**
* Returns the list of class files to exclude from the report.
*
* @return class files to exclude, may contain wildcard characters
*/
List getExcludes() {
return excludes;
}
public boolean canGenerateReport() {
if (skip) {
getLog().info(
"Skipping JaCoCo execution because property jacoco.skip is set.");
return false;
}
if (!canGenerateReportRegardingDataFiles()) {
getLog().info(
"Skipping JaCoCo execution due to missing execution data file.");
return false;
}
if (!canGenerateReportRegardingClassesDirectory()) {
getLog().info(
"Skipping JaCoCo execution due to missing classes directory.");
return false;
}
return true;
}
abstract boolean canGenerateReportRegardingDataFiles();
abstract boolean canGenerateReportRegardingClassesDirectory();
abstract File getOutputDirectory();
public void generate(
@SuppressWarnings("deprecation") final org.codehaus.doxia.sink.Sink sink,
final Locale locale) throws MavenReportException {
generate(sink, null, locale);
}
public void generate(final org.apache.maven.doxia.sink.Sink sink,
final SinkFactory sinkFactory, final Locale locale)
throws MavenReportException {
if (!canGenerateReport()) {
return;
}
executeReport(locale);
}
/**
* This method is called when the report generation is invoked directly as a
* standalone Mojo.
*/
public void execute() throws MojoExecutionException {
if (!canGenerateReport()) {
return;
}
try {
executeReport(Locale.getDefault());
} catch (final MavenReportException e) {
throw new MojoExecutionException("An error has occurred in "
+ getName(Locale.ENGLISH) + " report generation.", e);
}
}
private void executeReport(final Locale locale)
throws MavenReportException {
try {
final ReportSupport support = new ReportSupport(getLog());
loadExecutionData(support);
addFormatters(support, locale);
final IReportVisitor visitor = support.initRootVisitor();
createReport(visitor, support);
visitor.visitEnd();
} catch (final IOException e) {
throw new MavenReportException(
"Error while creating report: " + e.getMessage(), e);
}
}
private void addFormatters(final ReportSupport support, final Locale locale)
throws IOException {
getOutputDirectory().mkdirs();
for (final ReportFormat f : formats) {
support.addVisitor(f.createVisitor(this, locale));
}
}
abstract void loadExecutionData(final ReportSupport support)
throws IOException;
abstract void createReport(final IReportGroupVisitor visitor,
final ReportSupport support) throws IOException;
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/AgentITMojo.java 0000664 0000000 0000000 00000003113 14512577051 0025607 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
/**
* Same as prepare-agent, but provides default values suitable for
* integration-tests:
*
*
bound to pre-integration-test phase
*
different destFile
*
*
* @since 0.6.4
*/
@Mojo(name = "prepare-agent-integration", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
public class AgentITMojo extends AbstractAgentMojo {
/**
* Path to the output file for execution data.
*/
@Parameter(property = "jacoco.destFile", defaultValue = "${project.build.directory}/jacoco-it.exec")
private File destFile;
/**
* @return the destFile
*/
@Override
File getDestFile() {
return destFile;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/AgentMojo.java 0000664 0000000 0000000 00000006363 14512577051 0025364 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
/**
*
* Prepares a property pointing to the JaCoCo runtime agent that can be passed
* as a VM argument to the application under test. Depending on the project
* packaging type by default a property with the following name is set:
*
*
*
*
tycho.testArgLine for packaging type eclipse-test-plugin and
*
argLine otherwise.
*
*
*
* If your project already defines VM arguments for test execution, be sure that
* they will include property defined by JaCoCo.
*
*
*
* One of the ways to do this in case of maven-surefire-plugin - is to use
* syntax for late
* property evaluation:
*
* You can define empty property to avoid JVM startup error
* Could not find or load main class @{argLine} when using late
* property evaluation and jacoco-maven-plugin not executed.
*
*
*
* Another way is to define "argLine" as a Maven property rather than as part of
* the configuration of maven-surefire-plugin:
*
* Resulting coverage information is collected during execution and by default
* written to a file when the process terminates.
*
*
* @since 0.5.3
*/
@Mojo(name = "prepare-agent", defaultPhase = LifecyclePhase.INITIALIZE, requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
public class AgentMojo extends AbstractAgentMojo {
/**
* Path to the output file for execution data.
*/
@Parameter(property = "jacoco.destFile", defaultValue = "${project.build.directory}/jacoco.exec")
private File destFile;
/**
* @return the destFile
*/
@Override
File getDestFile() {
return destFile;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/CheckMojo.java 0000664 0000000 0000000 00000013733 14512577051 0025342 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
* Marc Hoffmann - redesign using report APIs
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.jacoco.core.analysis.ICoverageNode;
import org.jacoco.report.IReportVisitor;
import org.jacoco.report.check.IViolationsOutput;
import org.jacoco.report.check.Limit;
import org.jacoco.report.check.Rule;
/**
* Checks that the code coverage metrics are being met.
*
* @since 0.6.1
*/
@Mojo(name = "check", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
public class CheckMojo extends AbstractJacocoMojo implements IViolationsOutput {
private static final String MSG_SKIPPING = "Skipping JaCoCo execution due to missing execution data file:";
private static final String CHECK_SUCCESS = "All coverage checks have been met.";
private static final String CHECK_FAILED = "Coverage checks have not been met. See log for details.";
/**
*
* Check configuration used to specify rules on element types (BUNDLE,
* PACKAGE, CLASS, SOURCEFILE or METHOD) with a list of limits. Each limit
* applies to a certain counter (INSTRUCTION, LINE, BRANCH, COMPLEXITY,
* METHOD, CLASS) and defines a minimum or maximum for the corresponding
* value (TOTALCOUNT, COVEREDCOUNT, MISSEDCOUNT, COVEREDRATIO, MISSEDRATIO).
* If a limit refers to a ratio it must be in the range from 0.0 to 1.0
* where the number of decimal places will also determine the precision in
* error messages. A limit ratio may optionally be declared as a percentage
* where 0.80 and 80% represent the same value.
*
*
*
* If not specified the following defaults are assumed:
*
*
*
*
rule element: BUNDLE
*
limit counter: INSTRUCTION
*
limit value: COVEREDRATIO
*
*
*
* This example requires an overall instruction coverage of 80% and no class
* must be missed:
*
*/
@Parameter(required = true)
private List rules;
/**
* Halt the build if any of the checks fail.
*/
@Parameter(property = "jacoco.haltOnFailure", defaultValue = "true", required = true)
private boolean haltOnFailure;
/**
* File with execution data.
*/
@Parameter(defaultValue = "${project.build.directory}/jacoco.exec")
private File dataFile;
/**
* A list of class files to include into analysis. May use wildcard
* characters (* and ?). When not specified everything will be included.
*/
@Parameter
private List includes;
/**
* A list of class files to exclude from analysis. May use wildcard
* characters (* and ?). When not specified nothing will be excluded.
*/
@Parameter
private List excludes;
private boolean violations;
private boolean canCheckCoverage() {
if (!dataFile.exists()) {
getLog().info(MSG_SKIPPING + dataFile);
return false;
}
final File classesDirectory = new File(
getProject().getBuild().getOutputDirectory());
if (!classesDirectory.exists()) {
getLog().info(
"Skipping JaCoCo execution due to missing classes directory:"
+ classesDirectory);
return false;
}
return true;
}
@Override
public void executeMojo() throws MojoExecutionException {
if (!canCheckCoverage()) {
return;
}
executeCheck();
}
private void executeCheck() throws MojoExecutionException {
violations = false;
final ReportSupport support = new ReportSupport(getLog());
final List checkerrules = new ArrayList();
for (final RuleConfiguration r : rules) {
checkerrules.add(r.rule);
}
support.addRulesChecker(checkerrules, this);
try {
final IReportVisitor visitor = support.initRootVisitor();
support.loadExecutionData(dataFile);
support.processProject(visitor, getProject(), includes, excludes);
visitor.visitEnd();
} catch (final IOException e) {
throw new MojoExecutionException(
"Error while checking code coverage: " + e.getMessage(), e);
}
if (violations) {
if (this.haltOnFailure) {
throw new MojoExecutionException(CHECK_FAILED);
} else {
this.getLog().warn(CHECK_FAILED);
}
} else {
this.getLog().info(CHECK_SUCCESS);
}
}
public void onViolation(final ICoverageNode node, final Rule rule,
final Limit limit, final String message) {
this.getLog().warn(message);
violations = true;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/DumpMojo.java 0000664 0000000 0000000 00000007276 14512577051 0025237 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Chas Honton, Marc R. Hoffmann - initial implementation
*
*******************************************************************************/
package org.jacoco.maven;
import static java.lang.String.format;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.jacoco.core.tools.ExecDumpClient;
import org.jacoco.core.tools.ExecFileLoader;
/**
*
* Request a dump over TCP/IP from a JaCoCo agent running in
* tcpserver mode.
*
*
*
* Note concerning parallel builds: While the dump goal as such is thread safe,
* it has to be considered that TCP/IP server ports of the agents are a shared
* resource.
*
*
* @since 0.6.4
*/
@Mojo(name = "dump", defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST, threadSafe = true)
public class DumpMojo extends AbstractJacocoMojo {
/**
* Path to the output file for execution data.
*/
@Parameter(property = "jacoco.destFile", defaultValue = "${project.build.directory}/jacoco.exec")
private File destFile;
/**
* If set to true and the execution data file already exists, coverage data
* is appended to the existing file. If set to false, an existing execution
* data file will be replaced.
*/
@Parameter(property = "jacoco.append", defaultValue = "true")
private boolean append;
/**
* Sets whether execution data should be downloaded from the remote host.
*/
@Parameter(property = "jacoco.dump", defaultValue = "true")
private boolean dump;
/**
* Sets whether a reset command should be sent after the execution data has
* been dumped.
*/
@Parameter(property = "jacoco.reset", defaultValue = "false")
private boolean reset;
/**
* IP address or hostname to connect to.
*/
@Parameter(property = "jacoco.address")
private String address;
/**
* Port number to connect to. If multiple JaCoCo agents should run on the
* same machine, different ports have to be specified for the agents.
*/
@Parameter(property = "jacoco.port", defaultValue = "6300")
private int port;
/**
* Number of retries which the goal will attempt to establish a connection.
* This can be used to wait until the target JVM is successfully launched.
*/
@Parameter(property = "jacoco.retryCount", defaultValue = "10")
private int retryCount;
@Override
public void executeMojo() throws MojoExecutionException {
final ExecDumpClient client = new ExecDumpClient() {
@Override
protected void onConnecting(final InetAddress address,
final int port) {
getLog().info(format("Connecting to %s:%s", address,
Integer.valueOf(port)));
}
@Override
protected void onConnectionFailure(final IOException exception) {
getLog().info(exception.getMessage());
}
};
client.setDump(dump);
client.setReset(reset);
client.setRetryCount(retryCount);
try {
final ExecFileLoader loader = client.dump(address, port);
if (dump) {
getLog().info(format("Dumping execution data to %s",
destFile.getAbsolutePath()));
loader.save(destFile, append);
}
} catch (final IOException e) {
throw new MojoExecutionException("Unable to dump coverage data", e);
}
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/FileFilter.java 0000664 0000000 0000000 00000005127 14512577051 0025523 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
/**
* A file filter using includes/excludes patterns.
*/
public class FileFilter {
private static final String DEFAULT_INCLUDES = "**";
private static final String DEFAULT_EXCLUDES = "";
private final List includes;
private final List excludes;
/**
* Construct a new FileFilter
*
* @param includes
* list of includes patterns
* @param excludes
* list of excludes patterns
*/
public FileFilter(final List includes,
final List excludes) {
this.includes = includes;
this.excludes = excludes;
}
/**
* Returns a list of file names.
*
* @param directory
* the directory to scan
* @return a list of files
* @throws IOException
* if file system access fails
*/
public List getFileNames(final File directory) throws IOException {
return FileUtils.getFileNames(directory, getIncludes(), getExcludes(),
false);
}
/**
* Returns a list of files.
*
* @param directory
* the directory to scan
* @return a list of files
* @throws IOException
* if file system access fails
*/
public List getFiles(final File directory) throws IOException {
return FileUtils.getFiles(directory, getIncludes(), getExcludes());
}
/**
* Get the includes pattern
*
* @return the pattern
*/
public String getIncludes() {
return this.buildPattern(this.includes, DEFAULT_INCLUDES);
}
/**
* Get the excludes pattern
*
* @return the pattern
*/
public String getExcludes() {
return this.buildPattern(this.excludes, DEFAULT_EXCLUDES);
}
private String buildPattern(final List patterns,
final String defaultPattern) {
String pattern = defaultPattern;
if (patterns != null && !patterns.isEmpty()) {
pattern = StringUtils.join(patterns.iterator(), ",");
}
return pattern;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/InstrumentMojo.java 0000664 0000000 0000000 00000007762 14512577051 0026502 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.jacoco.core.instr.Instrumenter;
import org.jacoco.core.runtime.OfflineInstrumentationAccessGenerator;
/**
* Performs offline instrumentation. Note that after execution of test you must
* restore original classes with help of "restore-instrumented-classes" goal.
*
* Warning: The preferred way for code coverage analysis with
* JaCoCo is on-the-fly instrumentation. Offline instrumentation has several
* drawbacks and should only be used if a specific scenario explicitly requires
* this mode. Please consult documentation about
* offline instrumentation before using this mode.
*
*
* @since 0.6.2
*/
@Mojo(name = "instrument", defaultPhase = LifecyclePhase.PROCESS_CLASSES, threadSafe = true)
public class InstrumentMojo extends AbstractJacocoMojo {
/**
* A list of class files to include in instrumentation. May use wildcard
* characters (* and ?). When not specified everything will be included.
*/
@Parameter
private List includes;
/**
* A list of class files to exclude from instrumentation. May use wildcard
* characters (* and ?). When not specified nothing will be excluded. Except
* for performance optimization or technical corner cases this option is
* normally not required. If you want to exclude classes from the report
* please configure the report goal accordingly.
*/
@Parameter
private List excludes;
@Override
public void executeMojo()
throws MojoExecutionException, MojoFailureException {
final File originalClassesDir = new File(
getProject().getBuild().getDirectory(),
"generated-classes/jacoco");
originalClassesDir.mkdirs();
final File classesDir = new File(
getProject().getBuild().getOutputDirectory());
if (!classesDir.exists()) {
getLog().info(
"Skipping JaCoCo execution due to missing classes directory:"
+ classesDir);
return;
}
final List fileNames;
try {
fileNames = new FileFilter(includes, excludes)
.getFileNames(classesDir);
} catch (final IOException e1) {
throw new MojoExecutionException(
"Unable to get list of files to instrument.", e1);
}
final Instrumenter instrumenter = new Instrumenter(
new OfflineInstrumentationAccessGenerator());
for (final String fileName : fileNames) {
if (fileName.endsWith(".class")) {
final File source = new File(classesDir, fileName);
final File backup = new File(originalClassesDir, fileName);
InputStream input = null;
OutputStream output = null;
try {
FileUtils.copyFile(source, backup);
input = new FileInputStream(backup);
output = new FileOutputStream(source);
instrumenter.instrument(input, output, source.getPath());
} catch (final IOException e2) {
throw new MojoExecutionException(
"Unable to instrument file.", e2);
} finally {
IOUtil.close(input);
IOUtil.close(output);
}
}
}
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/MergeMojo.java 0000664 0000000 0000000 00000007202 14512577051 0025356 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mads Mohr Christensen - implementation of MergeMojo
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.jacoco.core.tools.ExecFileLoader;
/**
* Mojo for merging a set of execution data files (*.exec) into a single file
*
* @since 0.6.4
*/
@Mojo(name = "merge", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
public class MergeMojo extends AbstractJacocoMojo {
private static final String MSG_SKIPPING = "Skipping JaCoCo merge execution due to missing execution data files";
/**
* Path to the output file for execution data.
*/
@Parameter(property = "jacoco.destFile", defaultValue = "${project.build.directory}/jacoco.exec")
private File destFile;
/**
* This mojo accepts any number of execution data file sets.
*
*
*/
@Parameter(required = true)
private List fileSets;
@Override
protected void executeMojo()
throws MojoExecutionException, MojoFailureException {
if (!canMergeReports()) {
return;
}
executeMerge();
}
private boolean canMergeReports() {
if (fileSets == null || fileSets.isEmpty()) {
getLog().info(MSG_SKIPPING);
return false;
}
return true;
}
private void executeMerge() throws MojoExecutionException {
final ExecFileLoader loader = new ExecFileLoader();
load(loader);
save(loader);
}
private void load(final ExecFileLoader loader)
throws MojoExecutionException {
final FileSetManager fileSetManager = new FileSetManager();
for (final FileSet fileSet : fileSets) {
for (final String includedFilename : fileSetManager
.getIncludedFiles(fileSet)) {
final File inputFile = new File(fileSet.getDirectory(),
includedFilename);
if (inputFile.isDirectory()) {
continue;
}
try {
getLog().info("Loading execution data file "
+ inputFile.getAbsolutePath());
loader.load(inputFile);
} catch (final IOException e) {
throw new MojoExecutionException(
"Unable to read " + inputFile.getAbsolutePath(), e);
}
}
}
}
private void save(final ExecFileLoader loader)
throws MojoExecutionException {
if (loader.getExecutionDataStore().getContents().isEmpty()) {
getLog().info(MSG_SKIPPING);
return;
}
getLog().info("Writing merged execution data to "
+ destFile.getAbsolutePath());
try {
loader.save(destFile, false);
} catch (final IOException e) {
throw new MojoExecutionException(
"Unable to write merged file " + destFile.getAbsolutePath(),
e);
}
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ReportAggregateMojo.java 0000664 0000000 0000000 00000016527 14512577051 0027413 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* John Oliver, Marc R. Hoffmann, Jan Wloka - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.jacoco.report.IReportGroupVisitor;
/**
*
* Creates a structured code coverage report (HTML, XML, and CSV) from multiple
* projects within reactor. The report is created from all modules this project
* depends on, and optionally this project itself. From those projects class and
* source files as well as JaCoCo execution data files will be collected. In
* addition execution data is collected from the project itself. This also
* allows to create coverage reports when tests are in separate projects than
* the code under test, for example in case of integration tests.
*
*
*
* Using the dependency scope allows to distinguish projects which contribute
* execution data but should not become part of the report:
*
*
*
*
compile, runtime, provided:
* Project source and execution data is included in the report.
*
test: Only execution data is considered for the report.
*
*
* @since 0.7.7
*/
@Mojo(name = "report-aggregate", threadSafe = true)
public class ReportAggregateMojo extends AbstractReportMojo {
/**
* A list of execution data files to include in the report from each
* project. May use wildcard characters (* and ?). When not specified all
* *.exec files from the target folder will be included.
*/
@Parameter
List dataFileIncludes;
/**
* A list of execution data files to exclude from the report. May use
* wildcard characters (* and ?). When not specified nothing will be
* excluded.
*/
@Parameter
List dataFileExcludes;
/**
* Output directory for the reports. Note that this parameter is only
* relevant if the goal is run from the command line or from the default
* build lifecycle. If the goal is run indirectly as part of a site
* generation, the output directory configured in the Maven Site Plugin is
* used instead.
*/
@Parameter(defaultValue = "${project.reporting.outputDirectory}/jacoco-aggregate")
private File outputDirectory;
/**
* Include this project in the report. If true then this projects class and
* source files as well as JaCoCo execution data files will be collected.
*
* @since 0.8.9
*/
@Parameter(defaultValue = "false")
private boolean includeCurrentProject;
/**
* The projects in the reactor.
*/
@Parameter(property = "reactorProjects", readonly = true)
private List reactorProjects;
@Override
boolean canGenerateReportRegardingDataFiles() {
return true;
}
@Override
boolean canGenerateReportRegardingClassesDirectory() {
return true;
}
@Override
void loadExecutionData(final ReportSupport support) throws IOException {
// https://issues.apache.org/jira/browse/MNG-5440
if (dataFileIncludes == null) {
dataFileIncludes = Arrays.asList("target/*.exec");
}
final FileFilter filter = new FileFilter(dataFileIncludes,
dataFileExcludes);
loadExecutionData(support, filter, project.getBasedir());
for (final MavenProject dependency : findDependencies(
Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME,
Artifact.SCOPE_PROVIDED, Artifact.SCOPE_TEST)) {
loadExecutionData(support, filter, dependency.getBasedir());
}
}
private void loadExecutionData(final ReportSupport support,
final FileFilter filter, final File basedir) throws IOException {
for (final File execFile : filter.getFiles(basedir)) {
support.loadExecutionData(execFile);
}
}
@Override
File getOutputDirectory() {
return outputDirectory;
}
@Override
void createReport(final IReportGroupVisitor visitor,
final ReportSupport support) throws IOException {
final IReportGroupVisitor group = visitor.visitGroup(title);
if (includeCurrentProject) {
processProject(support, group, project);
}
for (final MavenProject dependency : findDependencies(
Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME,
Artifact.SCOPE_PROVIDED)) {
processProject(support, group, dependency);
}
}
private void processProject(final ReportSupport support,
final IReportGroupVisitor group, final MavenProject project)
throws IOException {
support.processProject(group, project.getArtifactId(), project,
getIncludes(), getExcludes(), sourceEncoding);
}
public File getReportOutputDirectory() {
return outputDirectory;
}
public void setReportOutputDirectory(final File reportOutputDirectory) {
if (reportOutputDirectory != null && !reportOutputDirectory
.getAbsolutePath().endsWith("jacoco-aggregate")) {
outputDirectory = new File(reportOutputDirectory,
"jacoco-aggregate");
} else {
outputDirectory = reportOutputDirectory;
}
}
public String getOutputName() {
return "jacoco-aggregate/index";
}
public String getName(final Locale locale) {
return "JaCoCo Aggregate";
}
private List findDependencies(final String... scopes) {
final List result = new ArrayList();
final List scopeList = Arrays.asList(scopes);
for (final Object dependencyObject : project.getDependencies()) {
final Dependency dependency = (Dependency) dependencyObject;
if (scopeList.contains(dependency.getScope())) {
final MavenProject project = findProjectFromReactor(dependency);
if (project != null) {
result.add(project);
}
}
}
return result;
}
/**
* Note that if dependency specified using version range and reactor
* contains multiple modules with same artifactId and groupId but of
* different versions, then first dependency which matches range will be
* selected. For example in case of range [0,2] if version 1 is
* before version 2 in reactor, then version 1 will be selected.
*/
private MavenProject findProjectFromReactor(final Dependency d) {
final VersionRange depVersionAsRange;
try {
depVersionAsRange = VersionRange
.createFromVersionSpec(d.getVersion());
} catch (final InvalidVersionSpecificationException e) {
throw new AssertionError(e);
}
for (final MavenProject p : reactorProjects) {
final DefaultArtifactVersion pv = new DefaultArtifactVersion(
p.getVersion());
if (p.getGroupId().equals(d.getGroupId())
&& p.getArtifactId().equals(d.getArtifactId())
&& depVersionAsRange.containsVersion(pv)) {
return p;
}
}
return null;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ReportFormat.java 0000664 0000000 0000000 00000004467 14512577051 0026130 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Locale;
import org.jacoco.report.FileMultiReportOutput;
import org.jacoco.report.IReportVisitor;
import org.jacoco.report.csv.CSVFormatter;
import org.jacoco.report.html.HTMLFormatter;
import org.jacoco.report.xml.XMLFormatter;
/**
* Configurable output formats for the report goals.
*/
public enum ReportFormat {
/**
* Multi-page html report.
*/
HTML() {
@Override
IReportVisitor createVisitor(final AbstractReportMojo mojo,
final Locale locale) throws IOException {
final HTMLFormatter htmlFormatter = new HTMLFormatter();
htmlFormatter.setOutputEncoding(mojo.outputEncoding);
htmlFormatter.setLocale(locale);
if (mojo.footer != null) {
htmlFormatter.setFooterText(mojo.footer);
}
return htmlFormatter.createVisitor(
new FileMultiReportOutput(mojo.getOutputDirectory()));
}
},
/**
* Single-file XML report.
*/
XML() {
@Override
IReportVisitor createVisitor(final AbstractReportMojo mojo,
final Locale locale) throws IOException {
final XMLFormatter xml = new XMLFormatter();
xml.setOutputEncoding(mojo.outputEncoding);
return xml.createVisitor(new FileOutputStream(
new File(mojo.getOutputDirectory(), "jacoco.xml")));
}
},
/**
* Single-file CSV report.
*/
CSV() {
@Override
IReportVisitor createVisitor(final AbstractReportMojo mojo,
final Locale locale) throws IOException {
final CSVFormatter csv = new CSVFormatter();
csv.setOutputEncoding(mojo.outputEncoding);
return csv.createVisitor(new FileOutputStream(
new File(mojo.getOutputDirectory(), "jacoco.csv")));
}
};
abstract IReportVisitor createVisitor(AbstractReportMojo mojo,
final Locale locale) throws IOException;
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ReportITMojo.java 0000664 0000000 0000000 00000005724 14512577051 0026036 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.jacoco.report.IReportGroupVisitor;
/**
* Same as report, but provides default values suitable for
* integration-tests:
*
*
bound to report-integration phase
*
different dataFile
*
*
* @since 0.6.4
*/
@Mojo(name = "report-integration", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
public class ReportITMojo extends AbstractReportMojo {
/**
* Output directory for the reports. Note that this parameter is only
* relevant if the goal is run from the command line or from the default
* build lifecycle. If the goal is run indirectly as part of a site
* generation, the output directory configured in the Maven Site Plugin is
* used instead.
*/
@Parameter(defaultValue = "${project.reporting.outputDirectory}/jacoco-it")
private File outputDirectory;
/**
* File with execution data.
*/
@Parameter(defaultValue = "${project.build.directory}/jacoco-it.exec")
private File dataFile;
@Override
boolean canGenerateReportRegardingDataFiles() {
return dataFile.exists();
}
@Override
boolean canGenerateReportRegardingClassesDirectory() {
return new File(project.getBuild().getOutputDirectory()).exists();
}
@Override
void loadExecutionData(final ReportSupport support) throws IOException {
support.loadExecutionData(dataFile);
}
@Override
File getOutputDirectory() {
return outputDirectory;
}
@Override
void createReport(final IReportGroupVisitor visitor,
final ReportSupport support) throws IOException {
support.processProject(visitor, title, project, getIncludes(),
getExcludes(), sourceEncoding);
}
public File getReportOutputDirectory() {
return outputDirectory;
}
public void setReportOutputDirectory(final File reportOutputDirectory) {
if (reportOutputDirectory != null && !reportOutputDirectory
.getAbsolutePath().endsWith("jacoco-it")) {
outputDirectory = new File(reportOutputDirectory, "jacoco-it");
} else {
outputDirectory = reportOutputDirectory;
}
}
public String getOutputName() {
return "jacoco-it/index";
}
public String getName(final Locale locale) {
return "JaCoCo IT";
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ReportMojo.java 0000664 0000000 0000000 00000005470 14512577051 0025577 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.jacoco.report.IReportGroupVisitor;
/**
* Creates a code coverage report for tests of a single project in multiple
* formats (HTML, XML, and CSV).
*
* @since 0.5.3
*/
@Mojo(name = "report", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
public class ReportMojo extends AbstractReportMojo {
/**
* Output directory for the reports. Note that this parameter is only
* relevant if the goal is run from the command line or from the default
* build lifecycle. If the goal is run indirectly as part of a site
* generation, the output directory configured in the Maven Site Plugin is
* used instead.
*/
@Parameter(defaultValue = "${project.reporting.outputDirectory}/jacoco")
private File outputDirectory;
/**
* File with execution data.
*/
@Parameter(property = "jacoco.dataFile", defaultValue = "${project.build.directory}/jacoco.exec")
private File dataFile;
@Override
boolean canGenerateReportRegardingDataFiles() {
return dataFile.exists();
}
@Override
boolean canGenerateReportRegardingClassesDirectory() {
return new File(project.getBuild().getOutputDirectory()).exists();
}
@Override
void loadExecutionData(final ReportSupport support) throws IOException {
support.loadExecutionData(dataFile);
}
@Override
File getOutputDirectory() {
return outputDirectory;
}
@Override
void createReport(final IReportGroupVisitor visitor,
final ReportSupport support) throws IOException {
support.processProject(visitor, title, project, getIncludes(),
getExcludes(), sourceEncoding);
}
public File getReportOutputDirectory() {
return outputDirectory;
}
public void setReportOutputDirectory(final File reportOutputDirectory) {
if (reportOutputDirectory != null && !reportOutputDirectory
.getAbsolutePath().endsWith("jacoco")) {
outputDirectory = new File(reportOutputDirectory, "jacoco");
} else {
outputDirectory = reportOutputDirectory;
}
}
public String getOutputName() {
return "jacoco/index";
}
public String getName(final Locale locale) {
return "JaCoCo";
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/ReportSupport.java 0000664 0000000 0000000 00000020037 14512577051 0026343 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
*
*******************************************************************************/
package org.jacoco.maven;
import static java.lang.String.format;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.jacoco.core.analysis.Analyzer;
import org.jacoco.core.analysis.CoverageBuilder;
import org.jacoco.core.analysis.IBundleCoverage;
import org.jacoco.core.analysis.IClassCoverage;
import org.jacoco.core.tools.ExecFileLoader;
import org.jacoco.report.IReportGroupVisitor;
import org.jacoco.report.IReportVisitor;
import org.jacoco.report.ISourceFileLocator;
import org.jacoco.report.MultiReportVisitor;
import org.jacoco.report.check.IViolationsOutput;
import org.jacoco.report.check.Rule;
import org.jacoco.report.check.RulesChecker;
/**
* Encapsulates the tasks to create reports for Maven projects. Instances are
* supposed to be used in the following sequence:
*
*
*
Create an instance
*
Load one or multiple exec files with
* loadExecutionData()
*
Add one or multiple formatters with addXXX() methods
*
Create the root visitor with initRootVisitor()
*
Process one or multiple projects with processProject()
*
*/
final class ReportSupport {
private final Log log;
private final ExecFileLoader loader;
private final List formatters;
/**
* Construct a new instance with the given log output.
*
* @param log
* for log output
*/
public ReportSupport(final Log log) {
this.log = log;
this.loader = new ExecFileLoader();
this.formatters = new ArrayList();
}
/**
* Loads the given execution data file.
*
* @param execFile
* execution data file to load
* @throws IOException
* if the file can't be loaded
*/
public void loadExecutionData(final File execFile) throws IOException {
log.info("Loading execution data file " + execFile);
loader.load(execFile);
}
public void addVisitor(final IReportVisitor visitor) {
formatters.add(visitor);
}
public void addRulesChecker(final List rules,
final IViolationsOutput output) {
final RulesChecker checker = new RulesChecker();
checker.setRules(rules);
formatters.add(checker.createVisitor(output));
}
public IReportVisitor initRootVisitor() throws IOException {
final IReportVisitor visitor = new MultiReportVisitor(formatters);
visitor.visitInfo(loader.getSessionInfoStore().getInfos(),
loader.getExecutionDataStore().getContents());
return visitor;
}
/**
* Calculates coverage for the given project and emits it to the report
* group without source references
*
* @param visitor
* group visitor to emit the project's coverage to
* @param project
* the MavenProject
* @param includes
* list of includes patterns
* @param excludes
* list of excludes patterns
* @throws IOException
* if class files can't be read
*/
public void processProject(final IReportGroupVisitor visitor,
final MavenProject project, final List includes,
final List excludes) throws IOException {
processProject(visitor, project.getArtifactId(), project, includes,
excludes, new NoSourceLocator());
}
/**
* Calculates coverage for the given project and emits it to the report
* group including source references
*
* @param visitor
* group visitor to emit the project's coverage to
* @param bundleName
* name for this project in the report
* @param project
* the MavenProject
* @param includes
* list of includes patterns
* @param excludes
* list of excludes patterns
* @param srcEncoding
* encoding of the source files within this project
* @throws IOException
* if class files can't be read
*/
public void processProject(final IReportGroupVisitor visitor,
final String bundleName, final MavenProject project,
final List includes, final List excludes,
final String srcEncoding) throws IOException {
processProject(visitor, bundleName, project, includes, excludes,
new SourceFileCollection(project, srcEncoding));
}
private void processProject(final IReportGroupVisitor visitor,
final String bundleName, final MavenProject project,
final List includes, final List excludes,
final ISourceFileLocator locator) throws IOException {
final CoverageBuilder builder = new CoverageBuilder();
final File classesDir = new File(
project.getBuild().getOutputDirectory());
if (classesDir.isDirectory()) {
final Analyzer analyzer = new Analyzer(
loader.getExecutionDataStore(), builder);
final FileFilter filter = new FileFilter(includes, excludes);
for (final File file : filter.getFiles(classesDir)) {
analyzer.analyzeAll(file);
}
}
final IBundleCoverage bundle = builder.getBundle(bundleName);
logBundleInfo(bundle, builder.getNoMatchClasses());
visitor.visitBundle(bundle, locator);
}
private void logBundleInfo(final IBundleCoverage bundle,
final Collection nomatch) {
log.info(format("Analyzed bundle '%s' with %s classes",
bundle.getName(),
Integer.valueOf(bundle.getClassCounter().getTotalCount())));
if (!nomatch.isEmpty()) {
log.warn(format(
"Classes in bundle '%s' do not match with execution data. "
+ "For report generation the same class files must be used as at runtime.",
bundle.getName()));
for (final IClassCoverage c : nomatch) {
log.warn(format("Execution data for class %s does not match.",
c.getName()));
}
}
if (bundle.containsCode()
&& bundle.getLineCounter().getTotalCount() == 0) {
log.warn(
"To enable source code annotation class files have to be compiled with debug information.");
}
}
private class NoSourceLocator implements ISourceFileLocator {
public Reader getSourceFile(final String packageName,
final String fileName) {
return null;
}
public int getTabWidth() {
return 0;
}
}
private class SourceFileCollection implements ISourceFileLocator {
private final List sourceRoots;
private final String encoding;
public SourceFileCollection(final MavenProject project,
final String encoding) {
this.sourceRoots = getCompileSourceRoots(project);
this.encoding = encoding;
}
public Reader getSourceFile(final String packageName,
final String fileName) throws IOException {
final String r;
if (packageName.length() > 0) {
r = packageName + '/' + fileName;
} else {
r = fileName;
}
for (final File sourceRoot : sourceRoots) {
final File file = new File(sourceRoot, r);
if (file.exists() && file.isFile()) {
return new InputStreamReader(new FileInputStream(file),
encoding);
}
}
return null;
}
public int getTabWidth() {
return 4;
}
}
private static List getCompileSourceRoots(
final MavenProject project) {
final List result = new ArrayList();
for (final Object path : project.getCompileSourceRoots()) {
result.add(resolvePath(project, (String) path));
}
return result;
}
private static File resolvePath(final MavenProject project,
final String path) {
File file = new File(path);
if (!file.isAbsolute()) {
file = new File(project.getBasedir(), path);
}
return file;
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/RestoreMojo.java 0000664 0000000 0000000 00000003144 14512577051 0025743 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.maven;
import java.io.File;
import java.io.IOException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.plexus.util.FileUtils;
/**
* Restores original classes as they were before offline instrumentation.
*
* @since 0.6.2
*/
@Mojo(name = "restore-instrumented-classes", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, threadSafe = true)
public class RestoreMojo extends AbstractJacocoMojo {
@Override
protected void executeMojo()
throws MojoExecutionException, MojoFailureException {
final File originalClassesDir = new File(
getProject().getBuild().getDirectory(),
"generated-classes/jacoco");
final File classesDir = new File(
getProject().getBuild().getOutputDirectory());
try {
FileUtils.copyDirectoryStructure(originalClassesDir, classesDir);
} catch (final IOException e) {
throw new MojoFailureException("Unable to restore classes.", e);
}
}
}
jacoco-0.8.11/jacoco-maven-plugin/src/org/jacoco/maven/RuleConfiguration.java 0000664 0000000 0000000 00000003575 14512577051 0027142 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Kyle Lieber - implementation of CheckMojo
* Marc Hoffmann - redesign using report APIs
*
*******************************************************************************/
package org.jacoco.maven;
import java.util.List;
import org.codehaus.plexus.util.StringUtils;
import org.jacoco.core.analysis.ICoverageNode.ElementType;
import org.jacoco.report.check.Limit;
import org.jacoco.report.check.Rule;
/**
* Wrapper for {@link Rule} objects to allow Maven style includes/excludes lists
*
*/
public class RuleConfiguration {
final Rule rule;
/**
* Create a new configuration instance.
*/
public RuleConfiguration() {
rule = new Rule();
}
/**
* @param element
* element type this rule applies to TODO: use ElementType
* directly once Maven 3 is required.
*/
public void setElement(final String element) {
rule.setElement(ElementType.valueOf(element));
}
/**
* @param includes
* includes patterns
*/
public void setIncludes(final List includes) {
rule.setIncludes(StringUtils.join(includes.iterator(), ":"));
}
/**
*
* @param excludes
* excludes patterns
*/
public void setExcludes(final List excludes) {
rule.setExcludes(StringUtils.join(excludes.iterator(), ":"));
}
/**
* @param limits
* list of {@link Limit}s configured for this rule
*/
public void setLimits(final List limits) {
rule.setLimits(limits);
}
}
jacoco-0.8.11/jacoco/ 0000775 0000000 0000000 00000000000 14512577051 0014304 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/jacoco/.project 0000664 0000000 0000000 00000000561 14512577051 0015755 0 ustar 00root root 0000000 0000000
jacocoorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Nature
jacoco-0.8.11/jacoco/assembly.xml 0000664 0000000 0000000 00000010145 14512577051 0016646 0 ustar 00root root 0000000 0000000
distributionzipfalse${basedir}/../org.jacoco.doc/docroot/true**/*.html${basedir}/../org.jacoco.doc/target/generated-resources/xml/xslt/docfalse*.html${basedir}/../org.jacoco.doc/docroot/**/*.html${basedir}/../org.jacoco.doc/target/site/jacoco-aggregate/coverage${basedir}/../org.jacoco.doc/target/junit/test${basedir}/../org.jacoco.report/src/org/jacoco/report/xml/report.dtd/coveragelibjacocoant.jarfalse${project.groupId}:org.jacoco.ant:jar:nodepslibjacococli.jarfalse${project.groupId}:org.jacoco.cli:jar:nodepslibjacocoagent.jarfalse${project.groupId}:org.jacoco.agent:*:runtimelib${artifact.artifactId}-${qualified.bundle.version}.${artifact.extension}false${project.groupId}:org.jacoco.core${project.groupId}:org.jacoco.report${project.groupId}:org.jacoco.agent${project.groupId}:org.jacoco.ant${project.groupId}:org.jacoco.agent:*:runtime${project.groupId}:org.jacoco.ant:*:nodeps/doctruefalse${project.groupId}:org.jacoco.examples:zip/doc/apitruefalseMETA-INF/${project.groupId}:org.jacoco.doc:*:javadoc
jacoco-0.8.11/jacoco/pom.xml 0000664 0000000 0000000 00000007743 14512577051 0015634 0 ustar 00root root 0000000 0000000
4.0.0org.jacocoorg.jacoco.build0.8.11../org.jacoco.buildjacocopomJaCoCo :: DistributionJaCoCo Standalone Distribution${project.groupId}org.jacoco.core${project.groupId}org.jacoco.report${project.groupId}org.jacoco.agent${project.groupId}org.jacoco.agent${project.version}runtime${project.groupId}org.jacoco.ant${project.groupId}org.jacoco.antnodeps${project.groupId}org.jacoco.cli${project.version}nodeps${project.groupId}org.jacoco.examples${project.version}zip${project.groupId}org.jacoco.doc${project.version}javadocsrcorg.apache.maven.pluginsmaven-assembly-pluginpackagesinglejacoco-${qualified.bundle.version}falseassembly.xmlorg.apache.maven.pluginsmaven-enforcer-pluginenforce-distribution-sizeenforceverify46000004000000${project.build.directory}/jacoco-${qualified.bundle.version}.zip
jacoco-0.8.11/org.jacoco.agent.rt.test/ 0000775 0000000 0000000 00000000000 14512577051 0017571 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/.classpath 0000664 0000000 0000000 00000001415 14512577051 0021555 0 ustar 00root root 0000000 0000000
jacoco-0.8.11/org.jacoco.agent.rt.test/.project 0000664 0000000 0000000 00000001377 14512577051 0021250 0 ustar 00root root 0000000 0000000
org.jacoco.agent.rt.testorg.eclipse.jdt.core.javabuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.jdt.core.javanature.settings2PARENT-1-PROJECT_LOC/org.jacoco.core.test/.settings
jacoco-0.8.11/org.jacoco.agent.rt.test/pom.xml 0000664 0000000 0000000 00000002637 14512577051 0021116 0 ustar 00root root 0000000 0000000
4.0.0org.jacocoorg.jacoco.tests0.8.11../org.jacoco.testsorg.jacoco.agent.rt.testJaCoCo :: Test :: Agent RTorg.jacoco.agent.rt.*${project.groupId}org.jacoco.agent.rt${project.groupId}org.jacoco.core.testjunitjunit
jacoco-0.8.11/org.jacoco.agent.rt.test/src/ 0000775 0000000 0000000 00000000000 14512577051 0020360 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/ 0000775 0000000 0000000 00000000000 14512577051 0021147 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/ 0000775 0000000 0000000 00000000000 14512577051 0022405 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/ 0000775 0000000 0000000 00000000000 14512577051 0023503 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/ 0000775 0000000 0000000 00000000000 14512577051 0024130 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/ 0000775 0000000 0000000 00000000000 14512577051 0025744 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/AgentModuleTest.java 0000664 0000000 0000000 00000004314 14512577051 0031655 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import org.jacoco.core.test.validation.JavaVersion;
import org.junit.Test;
/**
* Unit tests for {@link AgentModule}.
*/
public class AgentModuleTest {
@Test
public void isSupported_should_return_false_before_Java9() {
Boolean expected = Boolean
.valueOf(!JavaVersion.current().isBefore("9"));
Boolean supported = Boolean.valueOf(AgentModule.isSupported());
assertEquals(expected, supported);
}
@Test
public void should_only_load_classes_in_scope() throws Exception {
AgentModule am = new AgentModule();
Class extends Target> targetclass = am
.loadClassInModule(TargetImpl.class);
Target t = targetclass.getDeclaredConstructor().newInstance();
assertNotSame(this.getClass().getClassLoader(),
t.getClass().getClassLoader());
assertSame(AgentModule.class.getProtectionDomain(),
t.getClass().getProtectionDomain());
assertSame(t.getClass().getClassLoader(),
t.getInnerClassInstance().getClass().getClassLoader());
assertNotSame(this.getClass().getClassLoader(),
t.getInnerClassInstance().getClass().getClassLoader());
assertSame(this.getClass().getClassLoader(),
t.getOtherClassInstance().getClass().getClassLoader());
}
public interface Target {
Object getInnerClassInstance();
Object getOtherClassInstance();
}
public static class TargetImpl implements Target {
static class Inner {
}
public Object getInnerClassInstance() {
return new Inner();
}
public Object getOtherClassInstance() {
return new Other();
}
}
public static class Other {
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/AgentTest.java 0000664 0000000 0000000 00000022206 14512577051 0030507 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.lang.management.ManagementFactory;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.jacoco.agent.rt.internal.output.FileOutput;
import org.jacoco.agent.rt.internal.output.IAgentOutput;
import org.jacoco.agent.rt.internal.output.NoneOutput;
import org.jacoco.agent.rt.internal.output.TcpClientOutput;
import org.jacoco.agent.rt.internal.output.TcpServerOutput;
import org.jacoco.core.JaCoCo;
import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.AgentOptions.OutputMode;
import org.jacoco.core.runtime.RuntimeData;
import org.jacoco.core.tools.ExecFileLoader;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link Agent}.
*/
public class AgentTest implements IExceptionLogger, IAgentOutput {
private AgentOptions options;
private Boolean writeExecutionDataReset;
private Exception loggedException;
@Before
public void setup() {
options = new AgentOptions();
options.setOutput(OutputMode.file);
// avoid network access (DNS lookup for id generation):
options.setSessionId("test");
}
@Test
public void createController_should_create_defined_controller_type() {
Agent agent = new Agent(options, this);
options.setOutput(OutputMode.file);
assertEquals(FileOutput.class, agent.createAgentOutput().getClass());
options.setOutput(OutputMode.tcpserver);
assertEquals(TcpServerOutput.class,
agent.createAgentOutput().getClass());
options.setOutput(OutputMode.tcpclient);
assertEquals(TcpClientOutput.class,
agent.createAgentOutput().getClass());
options.setOutput(OutputMode.none);
assertEquals(NoneOutput.class, agent.createAgentOutput().getClass());
}
@Test
public void startup_should_set_defined_session_id() throws Exception {
Agent agent = createAgent();
agent.startup();
assertEquals("test", agent.getData().getSessionId());
assertNull(loggedException);
}
@Test
public void startup_should_create_random_session_id_when_undefined()
throws Exception {
options.setSessionId(null);
Agent agent = createAgent();
agent.startup();
final String id1 = agent.getData().getSessionId();
agent = createAgent();
agent.startup();
final String id2 = agent.getData().getSessionId();
assertFalse(id1.equals(id2));
assertNull(loggedException);
}
@Test
public void startup_should_log_and_rethrow_exception() throws Exception {
final Exception expected = new Exception();
Agent agent = new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return new IAgentOutput() {
public void startup(AgentOptions options, RuntimeData data)
throws Exception {
throw expected;
}
public void shutdown() {
}
public void writeExecutionData(boolean reset) {
}
};
}
};
try {
agent.startup();
fail("Exception expected");
} catch (Exception actual) {
assertSame(expected, actual);
assertSame(expected, loggedException);
}
}
@Test
public void startup_should_register_mbean_when_enabled() throws Exception {
options.setJmx(true);
Agent agent = createAgent();
agent.startup();
ObjectName objectName = new ObjectName("org.jacoco:type=Runtime");
final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
assertEquals(JaCoCo.VERSION,
server.getAttribute(objectName, "Version"));
// cleanup as MBean is registered globally
agent.shutdown();
}
@Test
public void startup_should_not_register_mbean_when_disabled()
throws Exception {
Agent agent = createAgent();
agent.startup();
ObjectName objectName = new ObjectName("org.jacoco:type=Runtime");
try {
ManagementFactory.getPlatformMBeanServer().getMBeanInfo(objectName);
fail("InstanceNotFoundException expected");
} catch (InstanceNotFoundException e) {
}
}
@Test
public void shutdown_should_write_execution_data_when_enabled()
throws Exception {
Agent agent = createAgent();
agent.startup();
agent.shutdown();
assertEquals(Boolean.FALSE, writeExecutionDataReset);
assertNull(loggedException);
}
@Test
public void shutdown_should_not_write_execution_data_when_disabled()
throws Exception {
options.setDumpOnExit(false);
Agent agent = createAgent();
agent.startup();
agent.shutdown();
assertNull(writeExecutionDataReset);
assertNull(loggedException);
}
@Test
public void shutdown_should_log_exception() throws Exception {
final Exception expected = new Exception();
Agent agent = new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return new IAgentOutput() {
public void startup(AgentOptions options,
RuntimeData data) {
}
public void shutdown() throws Exception {
throw expected;
}
public void writeExecutionData(boolean reset) {
}
};
}
};
agent.startup();
agent.shutdown();
assertSame(expected, loggedException);
}
@Test
public void shutdown_should_deregister_mbean_when_enabled()
throws Exception {
options.setJmx(true);
Agent agent = createAgent();
agent.startup();
agent.shutdown();
ObjectName objectName = new ObjectName("org.jacoco:type=Runtime");
try {
ManagementFactory.getPlatformMBeanServer().getMBeanInfo(objectName);
fail("InstanceNotFoundException expected");
} catch (InstanceNotFoundException e) {
}
}
@Test
public void getVersion_should_return_current_version() {
Agent agent = createAgent();
assertEquals(JaCoCo.VERSION, agent.getVersion());
}
@Test
public void getSessionId_should_return_session_id() throws Exception {
Agent agent = createAgent();
agent.startup();
assertEquals("test", agent.getSessionId());
}
@Test
public void setSessionId_should_modify_session_id() throws Exception {
Agent agent = createAgent();
agent.startup();
agent.setSessionId("new_id");
assertEquals("new_id", agent.getSessionId());
}
@Test
public void reset_should_reset_probes() {
Agent agent = createAgent();
boolean[] probes = agent.getData()
.getExecutionData(Long.valueOf(0x12345678), "Foo", 1)
.getProbes();
probes[0] = true;
agent.reset();
assertFalse(probes[0]);
}
@Test
public void getExecutionData_should_return_probes_and_session_id()
throws Exception {
Agent agent = createAgent();
agent.startup();
agent.getData().getExecutionData(Long.valueOf(0x12345678), "Foo", 1)
.getProbes()[0] = true;
byte[] data = agent.getExecutionData(true);
ExecFileLoader loader = new ExecFileLoader();
loader.load(new ByteArrayInputStream(data));
assertEquals("Foo",
loader.getExecutionDataStore().get(0x12345678).getName());
assertEquals("test",
loader.getSessionInfoStore().getInfos().get(0).getId());
}
@Test
public void getExecutionData_should_reset_probes_when_enabled()
throws Exception {
Agent agent = createAgent();
agent.startup();
final boolean[] probes = agent.getData()
.getExecutionData(Long.valueOf(0x12345678), "Foo", 1)
.getProbes();
probes[0] = true;
agent.getExecutionData(true);
assertFalse(probes[0]);
}
@Test
public void getExecutionData_should_not_reset_probes_when_disabled()
throws Exception {
Agent agent = createAgent();
agent.startup();
final boolean[] probes = agent.getData()
.getExecutionData(Long.valueOf(0x12345678), "Foo", 1)
.getProbes();
probes[0] = true;
agent.getExecutionData(false);
assertTrue(probes[0]);
}
@Test
public void dump_should_trigger_writeExecutionData_with_reset()
throws Exception {
Agent agent = createAgent();
agent.startup();
agent.dump(true);
assertEquals(Boolean.TRUE, writeExecutionDataReset);
assertNull(loggedException);
}
@Test
public void dump_should_trigger_writeExecutionData_without_reset()
throws Exception {
Agent agent = createAgent();
agent.startup();
agent.dump(false);
assertEquals(Boolean.FALSE, writeExecutionDataReset);
assertNull(loggedException);
}
private Agent createAgent() {
return new Agent(options, this) {
@Override
IAgentOutput createAgentOutput() {
return AgentTest.this;
}
};
}
// === IExceptionLogger ===
public void logExeption(Exception ex) {
loggedException = ex;
}
// === IAgentOutput ===
public void startup(AgentOptions options, RuntimeData data) {
}
public void shutdown() {
}
public void writeExecutionData(boolean reset) {
writeExecutionDataReset = Boolean.valueOf(reset);
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/ClassFileDumperTest.java 0000664 0000000 0000000 00000004444 14512577051 0032477 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertArrayEquals;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
* Unit tests for {@link ClassFileDumper}.
*/
public class ClassFileDumperTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
private byte[] contents;
@Before
public void setup() throws IOException {
contents = "just some bytes".getBytes("UTF-8");
}
@Test
public void testDumpClassWithPackage() throws IOException {
final File location = new File(folder.getRoot(), "classes");
final ClassFileDumper dumper = new ClassFileDumper(location.toString());
dumper.dump("org/jacoco/examples/Foo$Inner", contents);
assertContents(location,
"org/jacoco/examples/Foo$Inner.aff06045a340cd62.class");
}
@Test
public void testDumpClassInDefaultPackage() throws IOException {
final File location = new File(folder.getRoot(), "classes");
final ClassFileDumper dumper = new ClassFileDumper(location.toString());
dumper.dump("Main", contents);
assertContents(location, "Main.aff06045a340cd62.class");
}
@Test
public void testNoDumps() throws IOException {
final ClassFileDumper dumper = new ClassFileDumper(null);
dumper.dump("Main", contents);
}
private void assertContents(File location, String filename)
throws IOException {
InputStream in = new FileInputStream(new File(location, filename));
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int b;
while ((b = in.read()) != -1) {
buffer.write(b);
}
in.close();
assertArrayEquals(contents, buffer.toByteArray());
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/ConfigLoaderTest.java 0000664 0000000 0000000 00000004467 14512577051 0032016 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
import org.junit.Test;
/**
* Unit tests for {@link ConfigLoader}.
*/
public class ConfigLoaderTest {
@Test
public void testResource() {
Properties system = new Properties();
Properties config = ConfigLoader.load(
"/org/jacoco/agent/rt/internal/agent-test.properties", system);
assertEquals("tcpclient", config.get("output"));
}
@Test
public void testNoResource() {
Properties system = new Properties();
Properties config = ConfigLoader.load("does-not-exist.properties",
system);
assertTrue(config.isEmpty());
}
@Test
public void testSystemProperties() {
Properties system = new Properties();
system.setProperty("jacoco-agent.output", "mbean");
system.setProperty("output", "tcpserver"); // no prefix
system.setProperty("jacoco-agent.sessionid", "testid");
Properties config = ConfigLoader.load(
"/org/jacoco/agent/rt/internal/agent-test.properties", system);
assertEquals("mbean", config.get("output"));
assertEquals("3333", config.get("port"));
assertEquals("testid", config.get("sessionid"));
}
@Test
public void testSubstituteProperties() {
Properties system = new Properties();
system.setProperty("user.home", "/home/jacoco");
system.setProperty("java.version", "1.5.0");
Properties config = ConfigLoader.load(
"/org/jacoco/agent/rt/internal/agent-subst-test.properties",
system);
assertEquals("no$replace}", config.get("key0"));
assertEquals("/home/jacoco/coverage/jacoco-1.5.0.exec",
config.get("key1"));
assertEquals("$/home/jacoco", config.get("key2"));
assertEquals("/home/jacoco}}", config.get("key3"));
assertEquals("${does.not.exist}", config.get("key4"));
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/CoverageTransformerTest.java0000664 0000000 0000000 00000020165 14512577051 0033431 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.instrument.IllegalClassFormatException;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import org.jacoco.core.JaCoCo;
import org.jacoco.core.runtime.AbstractRuntime;
import org.jacoco.core.runtime.AgentOptions;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.objectweb.asm.MethodVisitor;
/**
* Unit tests for {@link CoverageTransformer}.
*/
public class CoverageTransformerTest {
private ExceptionRecorder recorder;
private AgentOptions options;
private ClassLoader classLoader;
private ProtectionDomain protectionDomain;
private StubRuntime runtime;
@Before
public void setup() {
recorder = new ExceptionRecorder();
options = new AgentOptions();
classLoader = getClass().getClassLoader();
protectionDomain = getClass().getProtectionDomain();
runtime = new StubRuntime();
}
@After
public void teardown() {
recorder.assertNoException();
}
@Test
public void testFilterAgentClass() {
CoverageTransformer t = createTransformer();
assertFalse(t.filter(classLoader,
"org/jacoco/agent/rt/internal/somepkg/SomeClass",
protectionDomain));
}
@Test
public void testFilterInclBootstrapClassesPositive() {
options.setInclBootstrapClasses(true);
CoverageTransformer t = createTransformer();
assertTrue(t.filter(null, "java/util/TreeSet", protectionDomain));
}
@Test
public void testFilterInclBootstrapClassesNegative() {
options.setInclBootstrapClasses(false);
CoverageTransformer t = createTransformer();
assertFalse(t.filter(null, "java/util/TreeSet", protectionDomain));
}
@Test
public void testFilterClassLoaderPositive1() {
options.setInclBootstrapClasses(false);
options.setExclClassloader("org.jacoco.agent.SomeWhere$*");
CoverageTransformer t = createTransformer();
assertTrue(t.filter(classLoader, "org/example/Foo", protectionDomain));
}
@Test
public void testFilterClassLoaderPositive2() {
options.setInclBootstrapClasses(true);
options.setExclClassloader("org.jacoco.agent.SomeWhere$*");
CoverageTransformer t = createTransformer();
assertTrue(t.filter(classLoader, "org/example/Foo", protectionDomain));
}
@Test
public void testFilterClassLoaderNegative1() {
options.setInclBootstrapClasses(false);
options.setExclClassloader(
"org.jacoco.agent.rt.internal.CoverageTransformerTest$*");
CoverageTransformer t = createTransformer();
ClassLoader myClassLoader = new ClassLoader(null) {
};
assertFalse(
t.filter(myClassLoader, "org/example/Foo", protectionDomain));
}
@Test
public void testFilterClassLoaderNegative2() {
options.setInclBootstrapClasses(true);
options.setExclClassloader(
"org.jacoco.agent.rt.internal.CoverageTransformerTest$*");
CoverageTransformer t = createTransformer();
ClassLoader myClassLoader = new ClassLoader(null) {
};
assertFalse(
t.filter(myClassLoader, "org/example/Foo", protectionDomain));
}
@Test
public void testFilterIncludedClassPositive() {
options.setIncludes("org.jacoco.core.*:org.jacoco.agent.rt.*");
CoverageTransformer t = createTransformer();
assertTrue(
t.filter(classLoader, "org/jacoco/core/Foo", protectionDomain));
}
@Test
public void testFilterIncludedClassNegative() {
options.setIncludes("org.jacoco.core.*:org.jacoco.agent.rt.*");
CoverageTransformer t = createTransformer();
assertFalse(t.filter(classLoader, "org/jacoco/report/Foo",
protectionDomain));
}
@Test
public void testFilterExcludedClassPositive() {
options.setExcludes("*Test");
CoverageTransformer t = createTransformer();
assertFalse(t.filter(classLoader, "org/jacoco/core/FooTest",
protectionDomain));
}
@Test
public void testFilterExcludedClassPositiveInner() {
options.setExcludes("org.jacoco.example.Foo$Inner");
CoverageTransformer t = createTransformer();
assertFalse(t.filter(classLoader, "org/jacoco/example/Foo$Inner",
protectionDomain));
}
@Test
public void testFilterExcludedClassNegative() {
options.setExcludes("*Test");
CoverageTransformer t = createTransformer();
assertTrue(
t.filter(classLoader, "org/jacoco/core/Foo", protectionDomain));
}
@Test
public void testFilterSourceLocationPositive1() {
CoverageTransformer t = createTransformer();
assertFalse(t.filter(classLoader, "org/jacoco/core/Foo", null));
}
@Test
public void testFilterSourceLocationPositive2() {
CoverageTransformer t = createTransformer();
ProtectionDomain pd = new ProtectionDomain(null, null);
assertFalse(t.filter(classLoader, "org/jacoco/core/Foo", pd));
}
@Test
public void testFilterSourceLocationPositive3() {
CoverageTransformer t = createTransformer();
CodeSource cs = new CodeSource(null, new Certificate[0]);
ProtectionDomain pd = new ProtectionDomain(cs, null);
assertFalse(t.filter(classLoader, "org/jacoco/core/Foo", pd));
}
@Test
public void testFilterSourceLocationNegative() {
options.setInclNoLocationClasses(true);
CoverageTransformer t = createTransformer();
assertTrue(t.filter(classLoader, "org/jacoco/core/Foo", null));
}
@Test
public void testTransformFiltered1() throws IllegalClassFormatException {
CoverageTransformer t = createTransformer();
assertNull(t.transform(classLoader, "org.jacoco.Sample", null, null,
new byte[0]));
}
@Test
public void testTransformFiltered2() throws IllegalClassFormatException {
CoverageTransformer t = createTransformer();
assertNull(t.transform((ClassLoader) null, "org.jacoco.Sample", null,
protectionDomain, new byte[0]));
}
@Test
public void testTransformFailure() {
CoverageTransformer t = createTransformer();
try {
t.transform(classLoader, "org.jacoco.Sample", null,
protectionDomain, null);
fail("IllegalClassFormatException expected.");
} catch (IllegalClassFormatException e) {
assertEquals(String.format(
"Error while instrumenting %s with JaCoCo %s/%s.",
"org.jacoco.Sample", JaCoCo.VERSION, JaCoCo.COMMITID_SHORT),
e.getMessage());
}
recorder.assertException(IllegalClassFormatException.class,
String.format("Error while instrumenting %s with JaCoCo %s/%s.",
"org.jacoco.Sample", JaCoCo.VERSION,
JaCoCo.COMMITID_SHORT),
IOException.class);
recorder.clear();
}
@Test
public void testRedefinedClass() throws Exception {
CoverageTransformer t = createTransformer();
// Just pick any non-system class outside our namespace
final Class> target = JaCoCo.class;
assertNull(t.transform(classLoader, target.getName(), target,
protectionDomain, getClassData(target)));
}
private CoverageTransformer createTransformer() {
return new CoverageTransformer(runtime, options, recorder);
}
private static byte[] getClassData(Class> clazz) throws IOException {
final String resource = "/" + clazz.getName().replace('.', '/')
+ ".class";
final InputStream in = clazz.getResourceAsStream(resource);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buffer = new byte[0x100];
int len;
while ((len = in.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
in.close();
return out.toByteArray();
}
private static class StubRuntime extends AbstractRuntime {
public StubRuntime() {
}
public int generateDataAccessor(long classid, String classname,
int probecount, MethodVisitor mv) {
return 0;
}
public void shutdown() {
}
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/ExceptionRecorder.java 0000664 0000000 0000000 00000003335 14512577051 0032237 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/**
* {@link IExceptionLogger} implementation for testing purposes.
*/
public class ExceptionRecorder implements IExceptionLogger {
private Class> exceptionType;
private String message;
private Class> causeType;
public void logExeption(Exception ex) {
assertNull("multiple exeptions", exceptionType);
exceptionType = ex.getClass();
message = ex.getMessage();
causeType = ex.getCause() == null ? null : ex.getCause().getClass();
}
public void clear() {
exceptionType = null;
message = null;
causeType = null;
}
public void assertNoException() {
assertNull(exceptionType);
}
public void assertException(final Class extends Throwable> exceptionType,
final String message) {
assertEquals(exceptionType, this.exceptionType);
assertEquals(message, this.message);
}
public void assertException(final Class extends Throwable> exceptionType,
final String message, final Class extends Throwable> causeType) {
assertEquals(exceptionType, this.exceptionType);
assertEquals(message, this.message);
assertEquals(causeType, this.causeType);
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/agent-subst-test.properties 0000664 0000000 0000000 00000000206 14512577051 0033271 0 ustar 00root root 0000000 0000000 key0=no$replace}
key1=${user.home}/coverage/jacoco-${java.version}.exec
key2=$${user.home}
key3=${user.home}}}
key4=${does.not.exist}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/agent-test.properties 0000664 0000000 0000000 00000000033 14512577051 0032131 0 ustar 00root root 0000000 0000000 output=tcpclient
port=3333
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output/ 0000775 0000000 0000000 00000000000 14512577051 0027304 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output/ExecutorTestBase.java0000664 0000000 0000000 00000003103 14512577051 0033375 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.fail;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.junit.After;
import org.junit.Before;
/**
* Unit tests base for tests that need an {@link Executor} for multithreaded
* test scenarios.
*/
public abstract class ExecutorTestBase {
protected ExecutorService executor;
@Before
public void setup() throws Exception {
executor = Executors.newSingleThreadExecutor();
}
@After
public void teardown() throws Exception {
executor.shutdown();
}
/**
* Asserts that the given future blocks.
*
* @param future
* future to test
* @throws Exception
*/
protected void assertBlocks(final Future> future) throws Exception {
try {
future.get(10, TimeUnit.MILLISECONDS);
fail("Operation should block");
} catch (TimeoutException e) {
}
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output/FileOutputTest.java 0000664 0000000 0000000 00000010322 14512577051 0033105 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Brock Janiczak - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.nio.channels.OverlappingFileLockException;
import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.RuntimeData;
import org.jacoco.core.test.validation.JavaVersion;
import org.junit.AssumptionViolatedException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
* Unit tests for {@link FileOutput}.
*/
public class FileOutputTest {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Test
public void startup_should_create_empty_execfile() throws Exception {
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutput controller = new FileOutput();
controller.startup(options, new RuntimeData());
assertTrue("Execution data file should be created", destFile.exists());
assertEquals("Execution data file should be empty", 0,
destFile.length());
}
@Test
public void writeExecutionData_should_write_execdata() throws Exception {
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutput controller = new FileOutput();
controller.startup(options, new RuntimeData());
controller.writeExecutionData(false);
controller.shutdown();
assertTrue("Execution data file should be created", destFile.exists());
assertTrue("Execution data file should have contents",
destFile.length() > 0);
}
@Test
public void startup_should_throw_IOException_when_execfile_cannot_be_created()
throws Exception {
AgentOptions options = new AgentOptions();
options.setDestfile(folder.newFolder("folder").getAbsolutePath());
FileOutput controller = new FileOutput();
try {
controller.startup(options, new RuntimeData());
fail("IOException expected");
} catch (IOException e) {
// expected
}
}
@Test
public void startup_should_throw_OverlappingFileLockException_when_execfile_is_permanently_locked()
throws Exception {
if (JavaVersion.current().isBefore("1.6")) {
throw new AssumptionViolatedException(
"OverlappingFileLockException only thrown since Java 1.6");
}
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutputStream out = new FileOutputStream(destFile);
out.getChannel().lock();
FileOutput controller = new FileOutput();
try {
controller.startup(options, new RuntimeData());
fail("OverlappingFileLockException expected");
} catch (OverlappingFileLockException e) {
// expected
} finally {
out.close();
}
}
public void startup_should_throw_InterruptedIOException_when_execfile_is_locked_and_thread_is_interrupted()
throws Exception {
if (JavaVersion.current().isBefore("1.6")) {
throw new AssumptionViolatedException(
"OverlappingFileLockException only thrown since Java 1.6");
}
File destFile = folder.newFile("jacoco.exec");
AgentOptions options = new AgentOptions();
options.setDestfile(destFile.getAbsolutePath());
FileOutputStream out = new FileOutputStream(destFile);
out.getChannel().lock();
FileOutput controller = new FileOutput();
Thread.currentThread().interrupt();
try {
controller.startup(options, new RuntimeData());
fail("InterruptedIOException expected");
} catch (InterruptedIOException e) {
// expected
} finally {
out.close();
}
}
}
jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output/MockServerSocket.java0000664 0000000 0000000 00000010026 14512577051 0033377 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.channels.ServerSocketChannel;
/**
* Emulation of a {@link ServerSocket} for testing purposes without any physical
* tcp/ip connections.
*/
public class MockServerSocket extends ServerSocket {
private final Object lock = new Object();
private boolean closed;
private Socket connection;
private boolean inAccept;
public MockServerSocket() throws IOException {
super();
closed = false;
inAccept = false;
}
/**
* Establishes a new mock connection. This method blocks until the other end
* of the connection has been accepted.
*
* @return remote end of the mock connection
*/
public Socket connect() throws Exception {
synchronized (lock) {
final MockSocketConnection c = new MockSocketConnection();
connection = c.getSocketA();
lock.notifyAll();
while (connection != null) {
lock.wait();
}
return c.getSocketB();
}
}
/**
* Blocks until another thread calls the {@link #accept()} method.
*/
public void waitForAccept() throws Exception {
synchronized (lock) {
while (!inAccept) {
lock.wait();
}
}
}
@Override
public void close() throws IOException {
synchronized (lock) {
closed = true;
lock.notifyAll();
}
}
@Override
public boolean isClosed() {
return closed;
}
@Override
public Socket accept() throws IOException {
synchronized (lock) {
inAccept = true;
lock.notifyAll();
try {
while (connection == null) {
if (closed) {
throw new SocketException("socket closed");
}
lock.wait();
}
return connection;
} catch (InterruptedException e) {
throw new InterruptedIOException();
} finally {
connection = null;
inAccept = false;
lock.notifyAll();
}
}
}
// unsupported server socket methods:
@Override
public void bind(SocketAddress endpoint, int backlog) throws IOException {
throw new AssertionError();
}
@Override
public void bind(SocketAddress endpoint) throws IOException {
throw new AssertionError();
}
@Override
public ServerSocketChannel getChannel() {
throw new AssertionError();
}
@Override
public InetAddress getInetAddress() {
throw new AssertionError();
}
@Override
public int getLocalPort() {
throw new AssertionError();
}
@Override
public SocketAddress getLocalSocketAddress() {
throw new AssertionError();
}
@Override
public synchronized int getReceiveBufferSize() throws SocketException {
throw new AssertionError();
}
@Override
public boolean getReuseAddress() throws SocketException {
throw new AssertionError();
}
@Override
public synchronized int getSoTimeout() throws IOException {
throw new AssertionError();
}
@Override
public boolean isBound() {
throw new AssertionError();
}
@Override
public void setPerformancePreferences(int connectionTime, int latency,
int bandwidth) {
throw new AssertionError();
}
@Override
public synchronized void setReceiveBufferSize(int size)
throws SocketException {
throw new AssertionError();
}
@Override
public void setReuseAddress(boolean on) throws SocketException {
throw new AssertionError();
}
@Override
public synchronized void setSoTimeout(int timeout) throws SocketException {
throw new AssertionError();
}
@Override
public String toString() {
throw new AssertionError();
}
}
MockServerSocketTest.java 0000664 0000000 0000000 00000007671 14512577051 0034174 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link MockServerSocket}.
*/
public class MockServerSocketTest extends ExecutorTestBase {
private ServerSocket serverSocket;
/**
* To verify that the tests reflect the behavior of real TCP sockets this
* flag can be set to true.
*/
private static final boolean REAL_SOCKETS = Boolean
.getBoolean("MockServerSocketTest.realSockets");
@Before
@Override
public void setup() throws Exception {
super.setup();
if (REAL_SOCKETS) {
System.err.println("Using Real Sockets!");
final InetAddress addr = InetAddress.getByName("localhost");
serverSocket = new ServerSocket(16300, 1, addr);
} else {
serverSocket = new MockServerSocket();
}
}
@After
@Override
public void teardown() throws Exception {
serverSocket.close();
super.teardown();
}
private Socket connect() throws Exception {
if (REAL_SOCKETS) {
final InetAddress addr = InetAddress.getByName("localhost");
return new Socket(addr, 16300);
} else {
return ((MockServerSocket) serverSocket).connect();
}
}
@Test
public void testClose() throws Exception {
assertFalse(serverSocket.isClosed());
serverSocket.close();
assertTrue(serverSocket.isClosed());
}
@Test(expected = SocketException.class)
public void testCloseWhileAccept() throws Throwable {
final Future f = executor.submit(new Callable() {
public Socket call() throws Exception {
return serverSocket.accept();
}
});
assertBlocks(f);
serverSocket.close();
try {
f.get();
} catch (ExecutionException e) {
throw e.getCause();
}
}
@Test
public void testAccept() throws Exception {
final Future f = executor.submit(new Callable() {
public Socket call() throws Exception {
return serverSocket.accept();
}
});
assertBlocks(f);
connect().getOutputStream().write(123);
final Socket socket = f.get();
assertNotNull(socket);
assertEquals(123, socket.getInputStream().read());
}
@Test(expected = SocketException.class)
public void testAcceptOnClosedServerSocket() throws Exception {
serverSocket.close();
serverSocket.accept();
}
@Test
public void testConnect() throws Exception {
if (!REAL_SOCKETS) {
final Future f = executor.submit(new Callable() {
public Socket call() throws Exception {
return ((MockServerSocket) serverSocket).connect();
}
});
assertBlocks(f);
serverSocket.accept().getOutputStream().write(42);
final Socket socket = f.get();
assertNotNull(socket);
assertEquals(42, socket.getInputStream().read());
}
}
@Test
public void testWaitForAccept() throws Exception {
if (!REAL_SOCKETS) {
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
((MockServerSocket) serverSocket).waitForAccept();
connect();
return null;
}
});
assertBlocks(f);
serverSocket.accept();
f.get();
}
}
}
MockSocketConnection.java 0000664 0000000 0000000 00000016744 14512577051 0034166 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketImpl;
import java.nio.channels.SocketChannel;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* Simulates two connected {@link Socket} objects. No physical connection is
* established for this. The behavior includes the (inconsistent) exception
* messages have been derived from Sun JDK 1.5.0_18-b02.
*/
public class MockSocketConnection {
private final MockSocket socketA;
private final MockSocket socketB;
public MockSocketConnection() throws SocketException {
socketA = new MockSocket();
socketB = new MockSocket();
socketA.connect(socketB);
}
public MockSocket getSocketA() {
return socketA;
}
public MockSocket getSocketB() {
return socketB;
}
class MockSocket extends Socket {
private MockSocket other;
private boolean closed;
private final Queue buffer = new ConcurrentLinkedQueue();
private final OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOException {
if (closed) {
throw new SocketException("Socket closed");
}
synchronized (other.buffer) {
other.buffer.add(Byte.valueOf((byte) b));
other.buffer.notifyAll();
}
}
};
private final InputStream in = new InputStream() {
@Override
public int read() throws IOException {
synchronized (buffer) {
try {
while (true) {
if (closed) {
throw new SocketException("socket closed");
}
if (other.closed) {
return -1;
}
final Byte b = buffer.poll();
buffer.notifyAll();
if (b != null) {
return 0xff & b.intValue();
}
buffer.wait();
}
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
}
}
@Override
public int available() throws IOException {
synchronized (buffer) {
return buffer.size();
}
}
};
private MockSocket() throws SocketException {
super((SocketImpl) null);
closed = false;
}
private void connect(MockSocket other) {
this.other = other;
other.other = this;
}
public void waitUntilInputBufferIsEmpty() throws InterruptedException {
synchronized (buffer) {
while (!closed && !buffer.isEmpty()) {
buffer.wait();
}
}
}
// socket methods with mocking behavior:
@Override
public OutputStream getOutputStream() throws IOException {
if (isClosed()) {
throw new SocketException("Socket is closed");
}
return out;
}
@Override
public InputStream getInputStream() throws IOException {
if (isClosed()) {
throw new SocketException("Socket is closed");
}
return in;
}
@Override
public void close() throws IOException {
synchronized (buffer) {
closed = true;
buffer.notifyAll();
}
synchronized (other.buffer) {
other.buffer.notifyAll();
}
}
@Override
public boolean isClosed() {
synchronized (buffer) {
return closed;
}
}
// unsupported socket methods:
@Override
public void bind(SocketAddress bindpoint) throws IOException {
throw new AssertionError();
}
@Override
public void connect(SocketAddress endpoint, int timeout)
throws IOException {
throw new AssertionError();
}
@Override
public void connect(SocketAddress endpoint) throws IOException {
throw new AssertionError();
}
@Override
public SocketChannel getChannel() {
throw new AssertionError();
}
@Override
public InetAddress getInetAddress() {
throw new AssertionError();
}
@Override
public boolean getKeepAlive() throws SocketException {
throw new AssertionError();
}
@Override
public InetAddress getLocalAddress() {
throw new AssertionError();
}
@Override
public int getLocalPort() {
throw new AssertionError();
}
@Override
public SocketAddress getLocalSocketAddress() {
throw new AssertionError();
}
@Override
public boolean getOOBInline() throws SocketException {
throw new AssertionError();
}
@Override
public int getPort() {
throw new AssertionError();
}
@Override
public synchronized int getReceiveBufferSize() throws SocketException {
throw new AssertionError();
}
@Override
public SocketAddress getRemoteSocketAddress() {
throw new AssertionError();
}
@Override
public boolean getReuseAddress() throws SocketException {
throw new AssertionError();
}
@Override
public synchronized int getSendBufferSize() throws SocketException {
throw new AssertionError();
}
@Override
public int getSoLinger() throws SocketException {
throw new AssertionError();
}
@Override
public synchronized int getSoTimeout() throws SocketException {
throw new AssertionError();
}
@Override
public boolean getTcpNoDelay() throws SocketException {
throw new AssertionError();
}
@Override
public int getTrafficClass() throws SocketException {
throw new AssertionError();
}
@Override
public boolean isBound() {
throw new AssertionError();
}
@Override
public boolean isConnected() {
throw new AssertionError();
}
@Override
public boolean isInputShutdown() {
throw new AssertionError();
}
@Override
public boolean isOutputShutdown() {
throw new AssertionError();
}
@Override
public void sendUrgentData(int data) throws IOException {
throw new AssertionError();
}
@Override
public void setKeepAlive(boolean on) throws SocketException {
throw new AssertionError();
}
@Override
public void setOOBInline(boolean on) throws SocketException {
throw new AssertionError();
}
@Override
public void setPerformancePreferences(int connectionTime, int latency,
int bandwidth) {
throw new AssertionError();
}
@Override
public synchronized void setReceiveBufferSize(int size)
throws SocketException {
throw new AssertionError();
}
@Override
public void setReuseAddress(boolean on) throws SocketException {
throw new AssertionError();
}
@Override
public synchronized void setSendBufferSize(int size)
throws SocketException {
throw new AssertionError();
}
@Override
public void setSoLinger(boolean on, int linger) throws SocketException {
throw new AssertionError();
}
@Override
public synchronized void setSoTimeout(int timeout)
throws SocketException {
throw new AssertionError();
}
@Override
public void setTcpNoDelay(boolean on) throws SocketException {
throw new AssertionError();
}
@Override
public void setTrafficClass(int tc) throws SocketException {
throw new AssertionError();
}
@Override
public void shutdownInput() throws IOException {
throw new AssertionError();
}
@Override
public void shutdownOutput() throws IOException {
throw new AssertionError();
}
}
}
MockSocketConnectionTest.java 0000664 0000000 0000000 00000011075 14512577051 0035016 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link MockSocketConnection}.
*/
public class MockSocketConnectionTest extends ExecutorTestBase {
/**
* To verify that the tests reflect the behavior of real TCP sockets this
* flag can be set to true.
*/
private static final boolean REAL_SOCKETS = Boolean
.getBoolean("MockSocketConnectionTest.realSockets");
private Socket a;
private Socket b;
@Before
@Override
public void setup() throws Exception {
super.setup();
if (REAL_SOCKETS) {
createRealSockets();
} else {
createMockSockets();
}
}
private void createMockSockets() throws Exception {
final MockSocketConnection con = new MockSocketConnection();
a = con.getSocketA();
b = con.getSocketB();
}
private void createRealSockets() throws Exception {
System.err.println("Using Real Sockets!");
final InetAddress addr = InetAddress.getByName("localhost");
ServerSocket ssocket = new ServerSocket(16300, 1, addr);
a = new Socket(addr, 16300);
b = ssocket.accept();
ssocket.close();
}
@Test
public void testIsClosed() throws Exception {
assertFalse(a.isClosed());
a.close();
assertTrue(a.isClosed());
}
@Test(expected = SocketException.class)
public void testGetInputStreamOnClosedSocket() throws Exception {
a.close();
a.getInputStream();
}
@Test(expected = SocketException.class)
public void testReadOnClosedSocket() throws Exception {
final InputStream in = a.getInputStream();
a.close();
in.read();
}
@Test(expected = SocketException.class)
public void testReadOnClosedSocketAsync() throws Throwable {
final InputStream in = a.getInputStream();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
in.read();
return null;
}
});
assertBlocks(f);
a.close();
try {
f.get();
} catch (ExecutionException e) {
throw e.getCause();
}
}
@Test(expected = SocketException.class)
public void testGetOutputStreamOnClosedSocket() throws Exception {
a.close();
a.getOutputStream();
}
@Test(expected = SocketException.class)
public void testWriteOnClosedSocket() throws Exception {
final OutputStream out = a.getOutputStream();
a.close();
out.write(123);
}
@Test
public void testContents() throws Exception {
final InputStream in = a.getInputStream();
final OutputStream out = b.getOutputStream();
assertEquals(0, in.available());
out.write(0);
out.write(1);
out.write(2);
out.write(255);
if (!REAL_SOCKETS) {
// Real sockets will have a delay
assertEquals(4, in.available());
}
assertEquals(0, in.read());
assertEquals(1, in.read());
assertEquals(2, in.read());
assertEquals(255, in.read());
}
@Test
public void testWaitForContents() throws Exception {
final InputStream in = a.getInputStream();
final OutputStream out = b.getOutputStream();
final Future f = executor.submit(new Callable() {
public Byte call() throws Exception {
return Byte.valueOf((byte) in.read());
}
});
assertBlocks(f);
out.write(123);
assertEquals(123, f.get().byteValue());
}
@Test
public void testCloseOtherSocket() throws Exception {
b.close();
final InputStream in = a.getInputStream();
assertEquals(-1, in.read());
}
@Test
public void testCloseOtherSocketAsync() throws Exception {
final InputStream in = a.getInputStream();
final Future f = executor.submit(new Callable() {
public Byte call() throws Exception {
return Byte.valueOf((byte) in.read());
}
});
assertBlocks(f);
b.close();
assertEquals(-1, f.get().byteValue());
}
}
TcpClientOutputTest.java 0000664 0000000 0000000 00000007071 14512577051 0034043 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Brock Janiczak - initial API and implementation
* Marc R. Hoffmann - migration to mock socket
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.io.IOException;
import java.net.Socket;
import java.util.List;
import org.jacoco.agent.rt.internal.ExceptionRecorder;
import org.jacoco.agent.rt.internal.output.MockSocketConnection.MockSocket;
import org.jacoco.core.data.ExecutionDataStore;
import org.jacoco.core.data.SessionInfo;
import org.jacoco.core.data.SessionInfoStore;
import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.RemoteControlReader;
import org.jacoco.core.runtime.RemoteControlWriter;
import org.jacoco.core.runtime.RuntimeData;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link TcpClientOutput}.
*/
public class TcpClientOutputTest {
private ExceptionRecorder logger;
private IAgentOutput controller;
private MockSocket localSocket;
private MockSocket remoteSocket;
private RemoteControlWriter remoteWriter;
private RemoteControlReader remoteReader;
private RuntimeData data;
@Before
public void setup() throws Exception {
logger = new ExceptionRecorder();
final MockSocketConnection con = new MockSocketConnection();
localSocket = con.getSocketA();
remoteSocket = con.getSocketB();
remoteWriter = new RemoteControlWriter(remoteSocket.getOutputStream());
controller = new TcpClientOutput(logger) {
@Override
protected Socket createSocket(AgentOptions options)
throws IOException {
return localSocket;
}
};
data = new RuntimeData();
controller.startup(new AgentOptions(), data);
remoteReader = new RemoteControlReader(remoteSocket.getInputStream());
}
@Test
public void testShutdown() throws Exception {
controller.shutdown();
assertFalse(remoteReader.read());
logger.assertNoException();
}
@Test
public void testRemoteClose() throws Exception {
localSocket.waitUntilInputBufferIsEmpty();
remoteSocket.close();
controller.shutdown();
logger.assertNoException();
}
@Test
public void testInvalidCommand() throws Exception {
// send invalid command to agent
remoteWriter.visitSessionInfo(new SessionInfo("info", 1, 2));
localSocket.waitUntilInputBufferIsEmpty();
controller.shutdown();
logger.assertException(IOException.class, "No session info visitor.");
}
@Test
public void testWriteExecutionData() throws Exception {
data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42)
.getProbes()[0] = true;
data.setSessionId("stubid");
controller.writeExecutionData(false);
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
remoteReader.read();
assertEquals("Foo", execStore.get(0x12345678).getName());
final List infos = infoStore.getInfos();
assertEquals(1, infos.size());
assertEquals("stubid", infos.get(0).getId());
logger.assertNoException();
controller.shutdown();
}
}
TcpConnectionTest.java 0000664 0000000 0000000 00000015460 14512577051 0033504 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import org.jacoco.core.data.ExecutionDataStore;
import org.jacoco.core.data.ExecutionDataWriter;
import org.jacoco.core.data.SessionInfo;
import org.jacoco.core.data.SessionInfoStore;
import org.jacoco.core.runtime.RemoteControlReader;
import org.jacoco.core.runtime.RemoteControlWriter;
import org.jacoco.core.runtime.RuntimeData;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link TcpConnection}.
*/
public class TcpConnectionTest extends ExecutorTestBase {
private MockSocketConnection mockConnection;
private RuntimeData data;
@Before
@Override
public void setup() throws Exception {
super.setup();
mockConnection = new MockSocketConnection();
data = new RuntimeData();
}
@Test(expected = IOException.class)
public void testInvalidHeader() throws Exception {
final OutputStream remoteOut = mockConnection.getSocketB()
.getOutputStream();
remoteOut.write(0x01);
remoteOut.write(0xC0);
remoteOut.write(0xCA);
final TcpConnection connection = new TcpConnection(
mockConnection.getSocketA(), data);
connection.init();
connection.run();
}
@Test(expected = IOException.class)
public void testInvalidContent() throws Exception {
final OutputStream remoteOut = mockConnection.getSocketB()
.getOutputStream();
new ExecutionDataWriter(remoteOut);
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
remoteOut.write(123);
con.run();
}
/**
* Remote endpoint is closed after a valid header has been send.
*/
@Test
public void testRemoteClose() throws Exception {
final OutputStream remoteOut = mockConnection.getSocketB()
.getOutputStream();
new ExecutionDataWriter(remoteOut);
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
mockConnection.getSocketA().waitUntilInputBufferIsEmpty();
mockConnection.getSocketB().close();
f.get();
}
/**
* Local socket is closed while waiting for commands.
*
* @throws Exception
*/
@Test
public void testLocalClose() throws Exception {
final OutputStream remoteOut = mockConnection.getSocketB()
.getOutputStream();
new ExecutionDataWriter(remoteOut);
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
con.close();
f.get();
}
@Test
public void testRemoteDump() throws Exception {
data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42)
.getProbes()[0] = true;
data.setSessionId("stubid");
final RemoteControlWriter remoteWriter = new RemoteControlWriter(
mockConnection.getSocketB().getOutputStream());
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
remoteWriter.visitDumpCommand(true, false);
readAndAssertData();
con.close();
f.get();
}
@Test
public void testLocalDump() throws Exception {
data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42)
.getProbes()[0] = true;
data.setSessionId("stubid");
new RemoteControlWriter(mockConnection.getSocketB().getOutputStream());
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
con.writeExecutionData(false);
readAndAssertData();
con.close();
f.get();
}
@Test
public void testLocalDumpWithoutInit() throws Exception {
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
// Must not write any data as we're not initialized:
con.writeExecutionData(false);
assertEquals(0,
mockConnection.getSocketB().getInputStream().available());
}
private void readAndAssertData() throws IOException {
final RemoteControlReader remoteReader = new RemoteControlReader(
mockConnection.getSocketB().getInputStream());
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
assertTrue(remoteReader.read());
final List infos = infoStore.getInfos();
assertEquals(1, infos.size());
assertEquals("stubid", infos.get(0).getId());
assertEquals("Foo", execStore.get(0x12345678).getName());
}
@Test
public void testRemoteReset() throws Exception {
data.getExecutionData(Long.valueOf(123), "Foo", 1)
.getProbes()[0] = true;
final RemoteControlWriter remoteWriter = new RemoteControlWriter(
mockConnection.getSocketB().getOutputStream());
final TcpConnection con = new TcpConnection(mockConnection.getSocketA(),
data);
con.init();
final Future f = executor.submit(new Callable() {
public Void call() throws Exception {
con.run();
return null;
}
});
assertBlocks(f);
remoteWriter.visitDumpCommand(false, true);
final RemoteControlReader remoteReader = new RemoteControlReader(
mockConnection.getSocketB().getInputStream());
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
assertTrue(remoteReader.read());
assertTrue(infoStore.getInfos().isEmpty());
assertTrue(execStore.getContents().isEmpty());
assertFalse(data.getExecutionData(Long.valueOf(123), "Foo", 1)
.getProbes()[0]);
con.close();
f.get();
}
}
TcpServerOutputTest.java 0000664 0000000 0000000 00000010443 14512577051 0034070 0 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt.test/src/org/jacoco/agent/rt/internal/output /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Brock Janiczak - initial API and implementation
* Marc R. Hoffmann - migration to mock socket
*
*******************************************************************************/
package org.jacoco.agent.rt.internal.output;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.List;
import org.jacoco.agent.rt.internal.ExceptionRecorder;
import org.jacoco.core.data.ExecutionDataStore;
import org.jacoco.core.data.ExecutionDataWriter;
import org.jacoco.core.data.SessionInfo;
import org.jacoco.core.data.SessionInfoStore;
import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.RemoteControlReader;
import org.jacoco.core.runtime.RemoteControlWriter;
import org.jacoco.core.runtime.RuntimeData;
import org.junit.Before;
import org.junit.Test;
/**
* Unit tests for {@link TcpServerOutput}.
*/
public class TcpServerOutputTest {
private ExceptionRecorder logger;
private AgentOptions options;
private MockServerSocket serverSocket;
private TcpServerOutput controller;
private RuntimeData data;
@Before
public void setup() throws Exception {
options = new AgentOptions();
logger = new ExceptionRecorder();
serverSocket = new MockServerSocket();
controller = new TcpServerOutput(logger) {
@Override
protected ServerSocket createServerSocket(AgentOptions options)
throws IOException {
return serverSocket;
}
};
data = new RuntimeData();
controller.startup(options, data);
}
@Test
public void testShutdownWithoutConnection() throws Exception {
serverSocket.waitForAccept();
controller.shutdown();
logger.assertNoException();
}
@Test
public void testShutdownWithConnection() throws Exception {
serverSocket.waitForAccept();
new ExecutionDataWriter(serverSocket.connect().getOutputStream());
controller.shutdown();
logger.assertNoException();
}
@Test
public void testWriteExecutionData() throws Exception {
data.getExecutionData(Long.valueOf(0x12345678), "Foo", 42)
.getProbes()[0] = true;
data.setSessionId("stubid");
final Socket socket = serverSocket.connect();
final RemoteControlWriter remoteWriter = new RemoteControlWriter(
socket.getOutputStream());
final RemoteControlReader remoteReader = new RemoteControlReader(
socket.getInputStream());
// First process a NOP command to ensure the connection is initialized:
remoteWriter.visitDumpCommand(false, false);
remoteReader.read();
// Now the actual test starts:
controller.writeExecutionData(false);
final ExecutionDataStore execStore = new ExecutionDataStore();
remoteReader.setExecutionDataVisitor(execStore);
final SessionInfoStore infoStore = new SessionInfoStore();
remoteReader.setSessionInfoVisitor(infoStore);
remoteReader.read();
assertEquals("Foo", execStore.get(0x12345678).getName());
final List infos = infoStore.getInfos();
assertEquals(1, infos.size());
assertEquals("stubid", infos.get(0).getId());
logger.assertNoException();
controller.shutdown();
}
@Test
public void testInvalidHeader() throws Exception {
final Socket socket = serverSocket.connect();
final OutputStream out = socket.getOutputStream();
out.write(0xca);
out.write(0xfe);
out.write(0xba);
out.write(0xbe);
serverSocket.waitForAccept();
logger.assertException(IOException.class,
"Invalid execution data file.");
controller.shutdown();
}
@Test
public void testGetInetAddressLoopback() throws UnknownHostException {
final InetAddress addr = controller.getInetAddress(null);
assertTrue(addr.isLoopbackAddress());
}
@Test
public void testGetInetAddressAny() throws UnknownHostException {
final InetAddress addr = controller.getInetAddress("*");
assertNull(addr);
}
}
jacoco-0.8.11/org.jacoco.agent.rt/ 0000775 0000000 0000000 00000000000 14512577051 0016613 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/.classpath 0000664 0000000 0000000 00000001415 14512577051 0020577 0 ustar 00root root 0000000 0000000
jacoco-0.8.11/org.jacoco.agent.rt/.project 0000664 0000000 0000000 00000001365 14512577051 0020267 0 ustar 00root root 0000000 0000000
org.jacoco.agent.rtorg.eclipse.jdt.core.javabuilderorg.eclipse.m2e.core.maven2Builderorg.eclipse.m2e.core.maven2Natureorg.eclipse.jdt.core.javanature.settings2PARENT-1-PROJECT_LOC/org.jacoco.core/.settings
jacoco-0.8.11/org.jacoco.agent.rt/about.html 0000664 0000000 0000000 00000001722 14512577051 0020615 0 ustar 00root root 0000000 0000000
About
About This Content
${build.date}
License
All Content in this distribution is made available by Mountainminds GmbH & Co.
KG, Munich. Unless otherwise indicated below, the Content is provided to you
under the terms and conditions of the Eclipse Public License Version 2.0
("EPL"). A copy of the EPL is available at
https://www.eclipse.org/legal/epl-2.0/.
For purposes of the EPL, "Program" will mean the Content.
Third Party Content
The Content includes items that have been sourced from third parties as set
out below.
${asm.license}
jacoco-0.8.11/org.jacoco.agent.rt/pom.xml 0000664 0000000 0000000 00000007152 14512577051 0020135 0 ustar 00root root 0000000 0000000
4.0.0org.jacocoorg.jacoco.build0.8.11../org.jacoco.buildorg.jacoco.agent.rtJaCoCo :: Agent RTJaCoCo Java Agenttruetrue${project.groupId}org.jacoco.coresrcorg.apache.maven.pluginsmaven-shade-pluginpackageshadetruealltrueorg.jacoco.agent.rt.internal${jacoco.runtime.package.name}org.jacoco.core${jacoco.runtime.package.name}.coreorg.objectweb.asm${jacoco.runtime.package.name}.asmorg.ow2.asm:*module-info.class${jacoco.runtime.package.name}.PreMain${project.artifactId}${project.description}${project.organization.name}${project.version}
jacoco-0.8.11/org.jacoco.agent.rt/src/ 0000775 0000000 0000000 00000000000 14512577051 0017402 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/com/ 0000775 0000000 0000000 00000000000 14512577051 0020160 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/com/vladium/ 0000775 0000000 0000000 00000000000 14512577051 0021621 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/com/vladium/emma/ 0000775 0000000 0000000 00000000000 14512577051 0022540 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/com/vladium/emma/rt/ 0000775 0000000 0000000 00000000000 14512577051 0023165 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java 0000664 0000000 0000000 00000004434 14512577051 0024362 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package com.vladium.emma.rt;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* Compatibility layer for the EMMA runtime which allows to trigger dumps
* through EMMA APIs. Note that even this class emulates an EMMA API the files
* written are in JaCoCo execution data format.
*
* @deprecated Use {@link org.jacoco.agent.rt.IAgent} instead.
*/
@Deprecated
public final class RT {
private RT() {
}
/**
* Writes the current execution data to the given file in JaCoCo execution
* data format.
*
* @param outFile
* file to write execution data to
* @param merge
* if true, execution data is appended to an
* existing file
* @param stopDataCollection
* ignored
* @throws IOException
* in case of problems with the file output
*/
@SuppressWarnings("unused")
public static void dumpCoverageData(final File outFile, final boolean merge,
final boolean stopDataCollection) throws IOException {
final OutputStream out = new FileOutputStream(outFile, merge);
try {
out.write(
org.jacoco.agent.rt.RT.getAgent().getExecutionData(false));
} finally {
out.close();
}
}
/**
* Writes the current execution data to the given file in JaCoCo execution
* data format. If the file already exists new data is appended.
*
* @param outFile
* file to write execution data to
* @param stopDataCollection
* ignored
* @throws IOException
* in case of problems with the file output
*/
public static synchronized void dumpCoverageData(final File outFile,
final boolean stopDataCollection) throws IOException {
dumpCoverageData(outFile, true, stopDataCollection);
}
}
jacoco-0.8.11/org.jacoco.agent.rt/src/com/vladium/emma/rt/package-info.java 0000664 0000000 0000000 00000001144 14512577051 0026354 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
/**
* Compatibility API for EMMA runtime.
*/
package com.vladium.emma.rt;
jacoco-0.8.11/org.jacoco.agent.rt/src/org/ 0000775 0000000 0000000 00000000000 14512577051 0020171 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/ 0000775 0000000 0000000 00000000000 14512577051 0021427 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/ 0000775 0000000 0000000 00000000000 14512577051 0022525 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/ 0000775 0000000 0000000 00000000000 14512577051 0023152 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/IAgent.java 0000664 0000000 0000000 00000003247 14512577051 0025172 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt;
import java.io.IOException;
/**
* Runtime API and MBean agent interface.
*/
public interface IAgent {
/**
* Returns version of JaCoCo.
*
* @return version of JaCoCo
*/
String getVersion();
/**
* Returns current a session identifier.
*
* @return current session identifier
*/
String getSessionId();
/**
* Sets a session identifier.
*
* @param id
* new session identifier
*/
void setSessionId(String id);
/**
* Resets all coverage information.
*/
void reset();
/**
* Returns current execution data.
*
* @param reset
* if true the current execution data is cleared
* afterwards
* @return dump of current execution data in JaCoCo binary format
*/
byte[] getExecutionData(boolean reset);
/**
* Triggers a dump of the current execution data through the configured
* output.
*
* @param reset
* if true the current execution data is cleared
* afterwards
* @throws IOException
* if the output can't write execution data
*/
void dump(boolean reset) throws IOException;
}
jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/RT.java 0000664 0000000 0000000 00000001753 14512577051 0024350 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt;
import org.jacoco.agent.rt.internal.Agent;
/**
* Entry point to access the JaCoCo agent runtime.
*/
public final class RT {
private RT() {
}
/**
* Returns the agent instance of the JaCoCo runtime in this JVM.
*
* @return agent instance
* @throws IllegalStateException
* if no Agent has been started yet
*/
public static IAgent getAgent() throws IllegalStateException {
return Agent.getInstance();
}
}
jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/ 0000775 0000000 0000000 00000000000 14512577051 0024766 5 ustar 00root root 0000000 0000000 jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/Agent.java 0000664 0000000 0000000 00000013213 14512577051 0026667 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.util.concurrent.Callable;
import org.jacoco.agent.rt.IAgent;
import org.jacoco.agent.rt.internal.output.FileOutput;
import org.jacoco.agent.rt.internal.output.IAgentOutput;
import org.jacoco.agent.rt.internal.output.NoneOutput;
import org.jacoco.agent.rt.internal.output.TcpClientOutput;
import org.jacoco.agent.rt.internal.output.TcpServerOutput;
import org.jacoco.core.JaCoCo;
import org.jacoco.core.data.ExecutionDataWriter;
import org.jacoco.core.runtime.AbstractRuntime;
import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.AgentOptions.OutputMode;
import org.jacoco.core.runtime.RuntimeData;
/**
* The agent manages the life cycle of JaCoCo runtime.
*/
public class Agent implements IAgent {
private static Agent singleton;
/**
* Returns a global instance which is already started. If the method is
* called the first time the instance is created with the given options.
*
* @param options
* options to configure the instance
* @return global instance
* @throws Exception
* in case something cannot be initialized
*/
public static synchronized Agent getInstance(final AgentOptions options)
throws Exception {
if (singleton == null) {
final Agent agent = new Agent(options, IExceptionLogger.SYSTEM_ERR);
agent.startup();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
agent.shutdown();
}
});
singleton = agent;
}
return singleton;
}
/**
* Returns a global instance which is already started. If a agent has not
* been initialized before this method will fail.
*
* @return global instance
* @throws IllegalStateException
* if no Agent has been started yet
*/
public static synchronized Agent getInstance()
throws IllegalStateException {
if (singleton == null) {
throw new IllegalStateException("JaCoCo agent not started.");
}
return singleton;
}
private final AgentOptions options;
private final IExceptionLogger logger;
private final RuntimeData data;
private IAgentOutput output;
private Callable jmxRegistration;
/**
* Creates a new agent with the given agent options.
*
* @param options
* agent options
* @param logger
* logger used by this agent
*/
Agent(final AgentOptions options, final IExceptionLogger logger) {
this.options = options;
this.logger = logger;
this.data = new RuntimeData();
}
/**
* Returns the runtime data object created by this agent
*
* @return runtime data for this agent instance
*/
public RuntimeData getData() {
return data;
}
/**
* Initializes this agent.
*
* @throws Exception
* in case something cannot be initialized
*/
public void startup() throws Exception {
try {
String sessionId = options.getSessionId();
if (sessionId == null) {
sessionId = createSessionId();
}
data.setSessionId(sessionId);
output = createAgentOutput();
output.startup(options, data);
if (options.getJmx()) {
jmxRegistration = new JmxRegistration(this);
}
} catch (final Exception e) {
logger.logExeption(e);
throw e;
}
}
/**
* Shutdown the agent again.
*/
public void shutdown() {
try {
if (options.getDumpOnExit()) {
output.writeExecutionData(false);
}
output.shutdown();
if (jmxRegistration != null) {
jmxRegistration.call();
}
} catch (final Exception e) {
logger.logExeption(e);
}
}
/**
* Create output implementation as given by the agent options.
*
* @return configured controller implementation
*/
IAgentOutput createAgentOutput() {
final OutputMode controllerType = options.getOutput();
switch (controllerType) {
case file:
return new FileOutput();
case tcpserver:
return new TcpServerOutput(logger);
case tcpclient:
return new TcpClientOutput(logger);
case none:
return new NoneOutput();
default:
throw new AssertionError(controllerType);
}
}
private String createSessionId() {
String host;
try {
host = InetAddress.getLocalHost().getHostName();
} catch (final Exception e) {
// Also catch platform specific exceptions (like on Android) to
// avoid bailing out here
host = "unknownhost";
}
return host + "-" + AbstractRuntime.createRandomId();
}
// === IAgent Implementation ===
public String getVersion() {
return JaCoCo.VERSION;
}
public String getSessionId() {
return data.getSessionId();
}
public void setSessionId(final String id) {
data.setSessionId(id);
}
public void reset() {
data.reset();
}
public byte[] getExecutionData(final boolean reset) {
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try {
final ExecutionDataWriter writer = new ExecutionDataWriter(buffer);
data.collect(writer, writer, reset);
} catch (final IOException e) {
// Must not happen with ByteArrayOutputStream
throw new AssertionError(e);
}
return buffer.toByteArray();
}
public void dump(final boolean reset) throws IOException {
output.writeExecutionData(reset);
}
}
jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/AgentModule.java 0000664 0000000 0000000 00000011451 14512577051 0030037 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
* Marc R. Hoffmann - move to separate class
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import java.io.IOException;
import java.io.InputStream;
import java.lang.instrument.Instrumentation;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.jacoco.core.internal.InputStreams;
/**
* An isolated class loader and distinct module to encapsulate JaCoCo runtime
* classes. This isolated environment allows to specifically open JDK packages
* to the agent runtime without changing package accessibility for the
* application under test.
*
* The implementation uses the property that the
* unnamed module is distinct from all run-time modules (including unnamed
* modules) bound to other class loaders.
*/
public class AgentModule {
/**
* Checks whether Java modules are supported by the current Java runtime.
*
* @return true is modules are supported
*/
public static boolean isSupported() {
try {
getModuleClass();
} catch (final ClassNotFoundException e) {
return false;
}
return true;
}
private final Set scope = new HashSet();
private final ClassLoader classLoader;
/**
* Creates a new isolated module.
*
* @throws Exception
* if it cannot be created
*/
public AgentModule() throws Exception {
classLoader = new ClassLoader() {
@Override
protected Class> loadClass(final String name,
final boolean resolve) throws ClassNotFoundException {
if (!scope.contains(name)) {
return super.loadClass(name, resolve);
}
final InputStream resourceAsStream = getResourceAsStream(
name.replace('.', '/') + ".class");
final byte[] bytes;
try {
bytes = InputStreams.readFully(resourceAsStream);
} catch (final IOException e) {
throw new RuntimeException(e);
}
return defineClass(name, bytes, 0, bytes.length,
AgentModule.class.getProtectionDomain());
}
};
}
/**
* Opens the package of the provided class to the module created in this
* {@link #AgentModule()} instance.
*
* @param instrumentation
* service provided to the agent by the Java runtime
* @param classInPackage
* example class of the package to open
* @throws Exception
* if package cannot be opened
*/
public void openPackage(final Instrumentation instrumentation,
final Class> classInPackage) throws Exception {
// module of the package to open
final Object module = Class.class.getMethod("getModule")
.invoke(classInPackage);
// unnamed module of our classloader
final Object unnamedModule = ClassLoader.class
.getMethod("getUnnamedModule").invoke(classLoader);
// Open package java.lang to the unnamed module of our class loader
Instrumentation.class.getMethod("redefineModule", //
getModuleClass(), //
Set.class, //
Map.class, //
Map.class, //
Set.class, //
Map.class //
).invoke(instrumentation, // instance
module, // module
Collections.emptySet(), // extraReads
Collections.emptyMap(), // extraExports
Collections.singletonMap(classInPackage.getPackage().getName(),
Collections.singleton(unnamedModule)), // extraOpens
Collections.emptySet(), // extraUses
Collections.emptyMap() // extraProvides
);
}
/**
* Loads a copy of the given class in the isolated classloader. Also any
* inner classes are loader from the isolated classloader.
*
* @param
* type of the class to load
* @param original
* original class definition which is used as source
* @return class object from the isolated class loader
* @throws Exception
* if the class cannot be loaded
*/
@SuppressWarnings("unchecked")
public Class loadClassInModule(final Class original)
throws Exception {
addToScopeWithInnerClasses(original);
return (Class) classLoader.loadClass(original.getName());
}
private void addToScopeWithInnerClasses(final Class> c) {
scope.add(c.getName());
for (final Class> i : c.getDeclaredClasses()) {
addToScopeWithInnerClasses(i);
}
}
private static Class> getModuleClass() throws ClassNotFoundException {
return Class.forName("java.lang.Module");
}
}
jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/ClassFileDumper.java 0000664 0000000 0000000 00000004205 14512577051 0030654 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.jacoco.core.internal.data.CRC64;
/**
* Internal dumper for class files.
*/
class ClassFileDumper {
private final File location;
/**
* Create a new dumper for the given location.
*
* @param location
* relative path to dump directory. null if no dumps
* should be written
*/
ClassFileDumper(final String location) {
if (location == null) {
this.location = null;
} else {
this.location = new File(location);
}
}
/**
* Dumps the given binary content under the given name if a non-
* null location has been specified.
*
* @param name
* qualified class name in VM notation
* @param contents
* binary contents
* @throws IOException
* in case of problems while dumping the file
*/
void dump(final String name, final byte[] contents) throws IOException {
if (location != null) {
final File outputdir;
final String localname;
final int pkgpos = name.lastIndexOf('/');
if (pkgpos != -1) {
outputdir = new File(location, name.substring(0, pkgpos));
localname = name.substring(pkgpos + 1);
} else {
outputdir = location;
localname = name;
}
outputdir.mkdirs();
final Long id = Long.valueOf(CRC64.classId(contents));
final File file = new File(outputdir,
String.format("%s.%016x.class", localname, id));
final OutputStream out = new FileOutputStream(file);
out.write(contents);
out.close();
}
}
}
jacoco-0.8.11/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/ConfigLoader.java 0000664 0000000 0000000 00000005314 14512577051 0030170 0 ustar 00root root 0000000 0000000 /*******************************************************************************
* Copyright (c) 2009, 2023 Mountainminds GmbH & Co. KG and Contributors
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
*******************************************************************************/
package org.jacoco.agent.rt.internal;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Internal utility to load runtime configuration from a classpath resource and
* from system properties. System property keys are prefixed with
* jacoco.. If the same property is defined twice the system
* property takes precedence.
*/
final class ConfigLoader {
private static final String SYS_PREFIX = "jacoco-agent.";
private static final Pattern SUBST_PATTERN = Pattern
.compile("\\$\\{([^\\}]+)\\}");
static Properties load(final String resource, final Properties system) {
final Properties result = new Properties();
loadResource(resource, result);
loadSystemProperties(system, result);
substSystemProperties(result, system);
return result;
}
private static void loadResource(final String resource,
final Properties result) {
final InputStream file = Offline.class.getResourceAsStream(resource);
if (file != null) {
try {
result.load(file);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
}
private static void loadSystemProperties(final Properties system,
final Properties result) {
for (final Map.Entry