Skip to content

Commit

Permalink
Removes profile for jdk 17 & 21 (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianszczepanik authored Apr 6, 2024
1 parent b12319a commit e64398f
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
strategy:
matrix:
java: [ '11' ]
java: [ '11', '17', '21' ]
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]

runs-on: ${{ matrix.os }}
Expand Down
46 changes: 19 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.75</version>
<relativePath />
<relativePath/>
</parent>

<groupId>pl.damianszczepanik</groupId>
Expand Down Expand Up @@ -49,8 +50,6 @@
<jenkins.version>2.387.3</jenkins.version>

<asm.version>9.4</asm.version>
<powermock.version>2.0.9</powermock.version>
<!-- releases newer than this do not have Deencapsulation class-->

<test.integration.pattern>**/*IT.java</test.integration.pattern>

Expand Down Expand Up @@ -165,7 +164,7 @@
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<!-- Jenkins test InjectedTest renamed to InjectedIT,
so it is executed only during integration tests -->
so it is executed only during integration tests -->
<injectedTestName>InjectionIT</injectedTestName>
</configuration>
</plugin>
Expand All @@ -189,45 +188,39 @@
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.11.2</version>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<artifactId>powermock-reflect</artifactId>
<version>2.0.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-reflect</artifactId>
<version>${powermock.version}</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -245,7 +238,6 @@
<artifactId>workflow-job</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public boolean matches(Run<?, ?> run, RuleConfiguration configuration) {
try {
File workspace = run.getRootDir();
String evaluatedMacro = TokenMacro.expandAll(run, new FilePath(workspace), null, template);
LOG.warning(String.format("Evaluated macro '%s' to '%s'", template, evaluatedMacro));
LOG.info(String.format("Evaluated macro '%s' to '%s'", template, evaluatedMacro));
return StringUtils.defaultString(value).equals(evaluatedMacro);

} catch (InterruptedException | IOException | MacroEvaluationException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package pl.damianszczepanik.jenkins.buildhistorymanager;

import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import hudson.model.AbstractItem;
import hudson.model.Job;
import hudson.model.Run;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.ConditionBuilder.NegativeCondition;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.Rule;
Expand All @@ -27,12 +22,6 @@
/**
* @author Damian Szczepanik (damianszczepanik@github)
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({
Run.class, // isKeepLog()
AbstractItem.class // getFullName()
})
@PowerMockIgnore("com.thoughtworks.xstream.converters.extended.DurationConverter")
public class BuildHistoryManagerTest {

private List<Rule> sampleRules;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pl.damianszczepanik.jenkins.buildhistorymanager.model;

import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.mockito.Mockito.mock;
import static pl.damianszczepanik.jenkins.buildhistorymanager.model.ConditionBuilder.buildSampleConditions;
import static pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.ActionBuilder.buildSampleActions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,22 @@
import java.util.Collections;
import java.util.List;

import hudson.model.AbstractItem;
import hudson.model.Job;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.jvnet.hudson.test.JenkinsRule;
import pl.damianszczepanik.jenkins.buildhistorymanager.BuildHistoryManager;
import pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions.DeleteBuildActionDescriptor;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.Rule;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.DescriptorMocker;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.JobBuilder;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.RunStub;

/**
* @author Damian Szczepanik (damianszczepanik@github)
* @see <a href="https://github.com/jenkinsci/build-history-manager-plugin/wiki/Delete-artifacts-action">documentation</a>
*/
@PrepareForTest({
Jenkins.class,
AbstractItem.class // getFullName()
})
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.xml.*")
public class DeleteBuildActionIT {

@Before
public void setUp() {
new DescriptorMocker(new DeleteBuildActionDescriptor());
}
@org.junit.Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void testDeletesArtifactsAction() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,23 @@
import java.util.Calendar;
import java.util.List;

import hudson.model.AbstractItem;
import hudson.model.Job;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.jvnet.hudson.test.JenkinsRule;
import pl.damianszczepanik.jenkins.buildhistorymanager.BuildHistoryManager;
import pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions.DeleteBuildActionDescriptor;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.Rule;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.DeleteArtifactsAction;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.DescriptorMocker;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.JobBuilder;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.RunStub;

/**
* @author Damian Szczepanik (damianszczepanik@github)
* @see <a href="https://github.com/jenkinsci/build-history-manager-plugin/wiki/Build-age-range-condition">documentation</a>
*/
@PrepareForTest({
Jenkins.class,
AbstractItem.class // getFullName()
})
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.xml.*")
public class BuildAgeRangeConditionIT {

@Before
public void setUp() {
new DescriptorMocker(new DeleteBuildActionDescriptor());
}
@org.junit.Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void testBuildNumberRangeCondition() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,24 @@
import java.util.Arrays;
import java.util.List;

import hudson.model.AbstractItem;
import hudson.model.Job;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.jvnet.hudson.test.JenkinsRule;
import pl.damianszczepanik.jenkins.buildhistorymanager.BuildHistoryManager;
import pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions.DeleteBuildActionDescriptor;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.Rule;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.DeleteBuildAction;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.DescriptorMocker;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.JobBuilder;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.RunStub;

/**
* @author Damian Szczepanik (damianszczepanik@github)
* @see <a href="https://github.com/jenkinsci/build-history-manager-plugin/wiki/Build-number-range-condition">documentation</a>
*/
@PrepareForTest({
Jenkins.class,
AbstractItem.class // getFullName()
})
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.xml.*")
public class BuildNumberRangeConditionIT {

@Before
public void setUp() {
new DescriptorMocker(new DeleteBuildActionDescriptor());
}

@org.junit.Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void testBuildNumberRangeCondition() throws IOException, InterruptedException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package pl.damianszczepanik.jenkins.buildhistorymanager.model.conditions;

import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import hudson.model.Run;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,24 @@
import java.util.Collections;
import java.util.List;

import hudson.model.AbstractItem;
import hudson.model.Job;
import hudson.model.Result;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.jvnet.hudson.test.JenkinsRule;
import pl.damianszczepanik.jenkins.buildhistorymanager.BuildHistoryManager;
import pl.damianszczepanik.jenkins.buildhistorymanager.descriptors.actions.DeleteBuildActionDescriptor;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.Rule;
import pl.damianszczepanik.jenkins.buildhistorymanager.model.actions.DeleteBuildAction;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.DescriptorMocker;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.JobBuilder;
import pl.damianszczepanik.jenkins.buildhistorymanager.utils.RunStub;

/**
* @author Damian Szczepanik (damianszczepanik@github)
* @see <a href="https://github.com/jenkinsci/build-history-manager-plugin/wiki/Build-result-condition">documentation</a>
*/
@PrepareForTest({
Jenkins.class,
AbstractItem.class // getFullName()
})
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.xml.*")
public class BuildResultConditionIT {

@Before
public void setUp() {
new DescriptorMocker(new DeleteBuildActionDescriptor());
}

@org.junit.Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void testBuildResultCondition() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
package pl.damianszczepanik.jenkins.buildhistorymanager.model.conditions;

import static org.assertj.core.api.Assertions.assertThat;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.File;

import hudson.model.Run;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.modules.junit4.PowerMockRunner;

/**
* @author Damian Szczepanik (damianszczepanik@github)
*/
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("com.thoughtworks.xstream.converters.extended.DurationConverter")
public class TokenMacroConditionTest {

@Test
Expand Down Expand Up @@ -103,6 +98,7 @@ private static Run mockRun() {
File workspace = mock(File.class);
when(workspace.getPath()).thenReturn("somePath");
when(run.getRootDir()).thenReturn(workspace);
when(run.getNumber()).thenReturn(13);
return run;
}
}
Loading

0 comments on commit e64398f

Please sign in to comment.