Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
<trove4j.version>3.0.3</trove4j.version>
<saxon-he.version>10.6</saxon-he.version>

<echarts-api.version>5.2.2-2</echarts-api.version>
<data-tables-api.version>1.11.3-6</data-tables-api.version>
<forensics-api.version>1.7.0</forensics-api.version>
<echarts-api.version>5.3.0-2</echarts-api.version>
<data-tables-api.version>1.11.4-1</data-tables-api.version>
<forensics-api.version>1.8.0</forensics-api.version>
<pull-request-monitoring.version>1.7.8</pull-request-monitoring.version>
<plugin-util-api.version>2.13.0</plugin-util-api.version>
<fontawesome-api.version>5.15.4-5</fontawesome-api.version>
<bootstrap5-api.version>5.1.3-4</bootstrap5-api.version>
<plugin-util-api.version>2.14.0</plugin-util-api.version>
<fontawesome-api.version>6.0.0-1</fontawesome-api.version>
<bootstrap5-api.version>5.1.3-5</bootstrap5-api.version>
<jquery3-api.version>3.6.0-2</jquery3-api.version>
<json-unit-assertj.version>2.31.0</json-unit-assertj.version>
<codingstyle.config.version>2.14.0</codingstyle.config.version>
<streamex.version>0.8.1</streamex.version>
<gson.version>2.9.0</gson.version>
<prism-api.version>1.25.0-2</prism-api.version>
<prism-api.version>1.26.0-2</prism-api.version>
<docker-fixtures.version>1.11</docker-fixtures.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.cloudbees.plugins.credentials.domains.Domain;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;

import edu.hm.hafner.util.PathUtil;

import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.test.acceptance.docker.DockerContainer;
Expand Down Expand Up @@ -50,6 +52,7 @@ public class CoveragePluginSourceITest extends IntegrationTestWithJenkinsPerSuit
private static final String SOURCE_FILE = "AcuCobolParser.java.txt";
private static final String PACKAGE_PATH = "edu/hm/hafner/analysis/parser/";
private static final String ACU_COBOL_PARSER_COVERAGE_REPORT = "jacoco-acu-cobol-parser.xml";
private static final PathUtil PATH_UTIL = new PathUtil();

/** Docker container for java-maven builds. Contains also git to check out from an SCM. */
@Rule
Expand All @@ -59,20 +62,26 @@ public class CoveragePluginSourceITest extends IntegrationTestWithJenkinsPerSuit

/** Verifies that the plugin reads source code from the workspace root. */
@Test
public void coveragePluginPipelineWithSourceCode() throws IOException {
public void coveragePluginPipelineWithSourceCode() {
Run<?, ?> workspace = runCoverageWithSourceCode("", "");
assertThat(getConsoleLog(workspace)).contains(
String.format("Searching for source code files in root of workspace '%s'",
getWorkspace((TopLevelItem) workspace.getParent()).getRemote()));

assertThat(getConsoleLog(workspace)).contains(createSingleMessage(workspace));
}

private String createSingleMessage(final Run<?, ?> workspace) {
return String.format("Searching for source code files in '%s'", createSingleDirectory(workspace));
}

/** Verifies that the plugin reads source code in subdirectories of the workspace. */
@Test
public void coveragePluginPipelineWithSourceCodeInSubdirectory() throws IOException {
public void coveragePluginPipelineWithSourceCodeInSubdirectory() {
Run<?, ?> workspace = runCoverageWithSourceCode("", "");
assertThat(getConsoleLog(workspace)).contains(
String.format("Searching for source code files in root of workspace '%s'",
getWorkspace((TopLevelItem) workspace.getParent()).getRemote()));
assertThat(getConsoleLog(workspace)).contains(createSingleMessage(workspace));
}

private String createSingleDirectory(final Run<?, ?> workspace) {
return PATH_UTIL.getAbsolutePath(String.format("%s/src/main/java",
getWorkspace((TopLevelItem) workspace.getParent()).getRemote()));
}

/** Verifies that the plugin reads source code in external but approved directories. */
Expand All @@ -83,8 +92,10 @@ public void coveragePluginPipelineWithSourceCodeInPermittedDirectory() throws IO
new PermittedSourceCodeDirectory(directory)));

Run<?, ?> externalDirectory = runCoverageWithSourceCode("ignore", directory);
assertThat(getConsoleLog(externalDirectory)).contains(
String.format("Searching for source code files in '%s'", directory));
assertThat(getConsoleLog(externalDirectory))
.contains("Searching for source code files in:",
"-> " + createSingleDirectory(externalDirectory),
"-> " + directory);
}

/** Verifies that the plugin refuses source code in directories that are not approved in Jenkins' configuration. */
Expand Down