-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for additional plugin manifest entries (#467)
- Loading branch information
Showing
7 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
invoker.goals=-ntp clean package -DskipTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?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"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jenkins-ci.tools.hpi.its.git-metadata</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>plugin1</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>My First Plugin</name> | ||
<packaging>hpi</packaging> | ||
<url>https://plugins.jenkins.io/plugin1/</url> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?jelly escape-by-default='true'?> | ||
<div>plugin1</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?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"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jenkins-ci.tools.hpi.its.git-metadata</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>multimodule-it-plugin2</artifactId> <!-- intentionally not the same as the containing directory --> | ||
<packaging>hpi</packaging> | ||
|
||
<url>https://plugins.jenkins.io/multimodule-it-plugin2/</url> | ||
|
||
<developers> | ||
<developer> | ||
<id>bob</id> | ||
<email>[email protected]</email> | ||
<name>Robert McBobface</name> | ||
</developer> | ||
<developer> | ||
<id>jane</id> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>plugin1</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?jelly escape-by-default='true'?> | ||
<div>multimodule-it-plugin2</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>4.54</version> | ||
<relativePath/> | ||
</parent> | ||
|
||
<groupId>org.jenkins-ci.tools.hpi.its.git-metadata</groupId> | ||
<artifactId>it-parent</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<jenkins.version>2.361.4</jenkins.version> | ||
<hpi-plugin.version>@project.version@</hpi-plugin.version> | ||
<gitHubRepo>jenkinsci/maven-hpi-plugin</gitHubRepo> | ||
</properties> | ||
|
||
<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false"> | ||
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection> | ||
<developerConnection>scm:git:[email protected]:${gitHubRepo}.git</developerConnection> | ||
<tag>HEAD</tag> | ||
<url>https://github.com/${gitHubRepo}</url> | ||
</scm> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>https://opensource.org/licenses/MIT</url> | ||
</license> | ||
</licenses> | ||
|
||
<modules> | ||
<module>plugin1</module> | ||
<module>plugin2</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import java.io.File | ||
import java.util.jar.Attributes | ||
import java.util.jar.JarFile | ||
import java.util.jar.Manifest | ||
|
||
assert new File(basedir, 'plugin1/target/plugin1.hpi').exists() | ||
File p1 = new File(basedir, 'plugin1/target/plugin1.hpi') | ||
|
||
assert p1.exists() | ||
try (JarFile j1 = new JarFile(p1)) { | ||
Manifest mf = j1.getManifest() | ||
Attributes attributes = mf.getMainAttributes() | ||
// there may be other attribute like 'Created-By' that we do not care about we are not checking everything | ||
assert attributes.getValue('Manifest-Version').equals('1.0') // if this changes then Jenkins may not be able to parse it. | ||
|
||
assert attributes.getValue('Hudson-Version').equals('2.361.4') | ||
assert attributes.getValue('Jenkins-Version').equals('2.361.4') | ||
|
||
assert attributes.getValue('Group-Id').equals('org.jenkins-ci.tools.hpi.its.git-metadata') | ||
assert attributes.getValue('Artifact-Id').equals('plugin1') | ||
|
||
assert attributes.getValue('Short-Name').equals('plugin1') // artifactId | ||
assert attributes.getValue('Implementation-Version').equals('1.0-SNAPSHOT') // version | ||
|
||
// using project.name | ||
assert attributes.getValue('Implementation-Title').equals('My First Plugin') | ||
assert attributes.getValue('Specification-Title').equals('My First Plugin') | ||
assert attributes.getValue('Long-Name').equals('My First Plugin') | ||
|
||
assert attributes.getValue('Plugin-Developers').isEmpty() | ||
assert attributes.getValue('Plugin-License-Name').equals('MIT License') | ||
assert attributes.getValue('Plugin-License-Url').equals('https://opensource.org/licenses/MIT') | ||
assert attributes.getValue('Plugin-ScmUrl').equals('https://github.com/jenkinsci/maven-hpi-plugin') | ||
assert attributes.getValue('Plugin-Version').startsWith('1.0-SNAPSHOT') | ||
assert attributes.getValue('Url').equals('https://plugins.jenkins.io/plugin1/') | ||
assert attributes.getValue('Plugin-ScmConnection').equals('scm:git:https://github.com/jenkinsci/maven-hpi-plugin.git') | ||
assert attributes.getValue('Plugin-GitHash').length() == 40 | ||
assert attributes.getValue('Plugin-Module').equals('plugin1') | ||
} | ||
|
||
|
||
assert new File(basedir, 'plugin2/target/multimodule-it-plugin2.hpi').exists(); | ||
File p2 = new File(basedir, 'plugin2/target/multimodule-it-plugin2.hpi') | ||
|
||
try (JarFile j2 = new JarFile(p2)) { | ||
Manifest mf = j2.getManifest() | ||
Attributes attributes = mf.getMainAttributes() | ||
assert attributes.getValue('Manifest-Version').equals('1.0') // if this changes then Jenkins may not be able to parse it. | ||
|
||
assert attributes.getValue('Hudson-Version').equals('2.361.4') | ||
assert attributes.getValue('Jenkins-Version').equals('2.361.4') | ||
|
||
assert attributes.getValue('Group-Id').equals('org.jenkins-ci.tools.hpi.its.git-metadata') | ||
assert attributes.getValue('Artifact-Id').equals('multimodule-it-plugin2') | ||
assert attributes.getValue('Short-Name').equals('multimodule-it-plugin2') // artifactId | ||
assert attributes.getValue('Implementation-Version').equals('1.0-SNAPSHOT') // version | ||
|
||
// project.name not set so should fallback to project.artifactId | ||
assert attributes.getValue('Implementation-Title').equals('multimodule-it-plugin2') | ||
assert attributes.getValue('Specification-Title').equals('multimodule-it-plugin2') | ||
assert attributes.getValue('Long-Name').equals('multimodule-it-plugin2') | ||
|
||
assert attributes.getValue('Plugin-Developers').equals('Robert McBobface:bob:[email protected],:jane:[email protected]') | ||
assert attributes.getValue('Plugin-License-Name').equals('MIT License') | ||
assert attributes.getValue('Plugin-License-Url').equals('https://opensource.org/licenses/MIT') | ||
assert attributes.getValue('Plugin-ScmUrl').equals('https://github.com/jenkinsci/maven-hpi-plugin') | ||
assert attributes.getValue('Plugin-Version').startsWith('1.0-SNAPSHOT') | ||
assert attributes.getValue('Url').equals('https://plugins.jenkins.io/multimodule-it-plugin2/') | ||
assert attributes.getValue('Plugin-ScmConnection').equals('scm:git:https://github.com/jenkinsci/maven-hpi-plugin.git') | ||
assert attributes.getValue('Plugin-GitHash').length() == 40 | ||
assert attributes.getValue('Plugin-Module').equals('plugin2') | ||
|
||
} | ||
|
||
return true; |