Skip to content

Commit 1681be4

Browse files
committed
More fixes
1 parent 9cb5680 commit 1681be4

File tree

3 files changed

+91
-19
lines changed

3 files changed

+91
-19
lines changed

pom.xml

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<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">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34

45
<parent>
@@ -12,10 +13,16 @@
1213
<packaging>hpi</packaging>
1314

1415
<properties>
15-
<jenkins.version>1.625.3</jenkins.version>
1616
<java.level>8</java.level>
17-
<jenkins-test-harness.version>2.13</jenkins-test-harness.version>
1817
<java.level.test>8</java.level.test>
18+
19+
<!-- Jenkins -->
20+
<jenkins.version>1.625.3</jenkins.version>
21+
<jenkins-test-harness.version>2.36</jenkins-test-harness.version>
22+
23+
<!-- Security -->
24+
<owasp.version>3.1.2</owasp.version>
25+
<findbugs.failOnError>false</findbugs.failOnError>
1926
</properties>
2027

2128
<name>Jenkins Gogs plugin</name>
@@ -76,14 +83,7 @@
7683
<groupId>com.google.guava</groupId>
7784
<artifactId>guava</artifactId>
7885
<version>17.0</version>
79-
<!--<scope>test</scope>-->
8086
</dependency>
81-
<!--<dependency>-->
82-
<!--<groupId>org.apache.httpcomponents</groupId>-->
83-
<!--<artifactId>httpclient</artifactId>-->
84-
<!--<version>4.5.3</version>-->
85-
<!--<scope>test</scope>-->
86-
<!--</dependency>-->
8787
<dependency>
8888
<groupId>org.apache.httpcomponents</groupId>
8989
<artifactId>fluent-hc</artifactId>
@@ -110,6 +110,77 @@
110110
</dependency>
111111
</dependencies>
112112

113+
<build>
114+
<plugins>
115+
<plugin>
116+
<groupId>org.apache.maven.plugins</groupId>
117+
<artifactId>maven-surefire-plugin</artifactId>
118+
<version>2.21.0</version>
119+
<configuration>
120+
<argLine>${jaCoCoArgLine}</argLine>
121+
<excludes>
122+
<exclude>**/IT*.java</exclude>
123+
</excludes>
124+
</configuration>
125+
<executions>
126+
<execution>
127+
<id>default-test</id>
128+
<phase>test</phase>
129+
<goals>
130+
<goal>test</goal>
131+
</goals>
132+
</execution>
133+
</executions>
134+
</plugin>
135+
<plugin>
136+
<groupId>org.jacoco</groupId>
137+
<artifactId>jacoco-maven-plugin</artifactId>
138+
<version>0.8.1</version>
139+
<executions>
140+
<execution>
141+
<id>default-prepare-agent</id>
142+
<goals>
143+
<goal>prepare-agent</goal>
144+
</goals>
145+
<configuration>
146+
<propertyName>jaCoCoArgLine</propertyName>
147+
</configuration>
148+
</execution>
149+
<execution>
150+
<id>default-report</id>
151+
<goals>
152+
<goal>report</goal>
153+
</goals>
154+
</execution>
155+
<execution>
156+
<id>default-check</id>
157+
<goals>
158+
<goal>check</goal>
159+
</goals>
160+
</execution>
161+
</executions>
162+
</plugin>
163+
<plugin>
164+
<groupId>org.eluder.coveralls</groupId>
165+
<artifactId>coveralls-maven-plugin</artifactId>
166+
<version>4.3.0</version>
167+
</plugin>
168+
<plugin>
169+
<groupId>org.owasp</groupId>
170+
<artifactId>dependency-check-maven</artifactId>
171+
<version>${owasp.version}</version>
172+
<executions>
173+
<execution>
174+
<id>default-check</id>
175+
<goals>
176+
<goal>check</goal>
177+
</goals>
178+
</execution>
179+
</executions>
180+
</plugin>
181+
</plugins>
182+
</build>
183+
113184
<profiles>
114185
<profile>
115186
<id>withIntegrationTest</id>

src/main/java/org/jenkinsci/plugins/gogs/GogsPayloadProcessor.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ associated documentation files (the "Software"), to deal in the Software without
2626
import hudson.model.BuildableItem;
2727
import hudson.model.Cause;
2828
import hudson.security.ACL;
29-
import jenkins.model.ParameterizedJobMixIn;
3029
import jenkins.triggers.SCMTriggerItem;
3130
import org.acegisecurity.context.SecurityContext;
3231
import org.acegisecurity.context.SecurityContextHolder;
@@ -39,6 +38,8 @@ associated documentation files (the "Software"), to deal in the Software without
3938
import java.util.concurrent.atomic.AtomicBoolean;
4039
import java.util.logging.Logger;
4140

41+
import static jenkins.model.ParameterizedJobMixIn.ParameterizedJob;
42+
4243
class GogsPayloadProcessor {
4344
private static final Logger LOGGER = Logger.getLogger(GogsPayloadProcessor.class.getName());
4445
private final Map<String, String> payload = new HashMap<>();
@@ -60,8 +61,8 @@ public GogsResults triggerJobs(String jobName, String deliveryID) {
6061
if (project != null) {
6162
Cause cause = new GogsCause(deliveryID);
6263

63-
if (project instanceof ParameterizedJobMixIn.ParameterizedJob) {
64-
ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) project;
64+
if (project instanceof ParameterizedJob) {
65+
ParameterizedJob pJob = (ParameterizedJob) project;
6566
pJob.getTriggers().values().stream()
6667
.filter(trigger1 -> trigger1 instanceof GogsTrigger).findFirst()
6768
.ifPresent((g) -> {

src/test/java/org/jenkinsci/plugins/gogs/GogsWebHookTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void whenWrongHeaderTypeMustReturnError() throws Exception {
104104
StaplerResponse staplerResponse = Mockito.mock(ResponseImpl.class);
105105
when(staplerRequest.getHeader("X-Gogs-Event")).thenReturn("junk");
106106

107-
//perform the testÎ
107+
//perform the test
108108
performDoIndexTest(staplerRequest, staplerResponse, uniqueFile);
109109

110110
//validate that everything was done as planed
@@ -149,7 +149,7 @@ public void whenNoJobInQueryStringMustReturnError() throws Exception {
149149
when(staplerRequest.getHeader("X-Gogs-Event")).thenReturn("push");
150150
when(staplerRequest.getQueryString()).thenReturn("foo=bar&blaah=blaah");
151151

152-
//perform the testÎ
152+
//perform the test
153153
performDoIndexTest(staplerRequest, staplerResponse, uniqueFile);
154154

155155
//validate that everything was done as planed
@@ -171,7 +171,7 @@ public void whenEmptyJobInQueryStringMustReturnError() throws Exception {
171171
when(staplerRequest.getHeader("X-Gogs-Event")).thenReturn("push");
172172
when(staplerRequest.getQueryString()).thenReturn("job&foo=bar");
173173

174-
//perform the testÎ
174+
//perform the test
175175
performDoIndexTest(staplerRequest, staplerResponse, uniqueFile);
176176

177177
//validate that everything was done as planed
@@ -193,7 +193,7 @@ public void whenEmptyJob2InQueryStringMustReturnError() throws Exception {
193193
when(staplerRequest.getHeader("X-Gogs-Event")).thenReturn("push");
194194
when(staplerRequest.getQueryString()).thenReturn("job=&foo=bar");
195195

196-
//perform the testÎ
196+
//perform the test
197197
performDoIndexTest(staplerRequest, staplerResponse, uniqueFile);
198198

199199
//validate that everything was done as planed
@@ -220,7 +220,7 @@ public void whenUriDoesNotContainUrlNameMustReturnError() throws Exception {
220220
when(staplerRequest.getInputStream()).thenReturn(inputStream);
221221
when(staplerRequest.getRequestURI()).thenReturn("/badUri/aaa");
222222

223-
//perform the testÎ
223+
//perform the test
224224
performDoIndexTest(staplerRequest, staplerResponse, uniqueFile);
225225

226226
//validate that everything was done as planed
@@ -284,4 +284,4 @@ public void setReadListener(ReadListener readListener) {
284284

285285
}
286286
}
287-
}
287+
}

0 commit comments

Comments
 (0)