Skip to content
Permalink
Browse files

fix for jenkins-bug #JENKINS-17058

modified unit-test for resolving relative paths;
updated pom - integrate plugin-API for Jenkins1.510 and adapt for
Eclipse m2e
  • Loading branch information
afischer211 committed Apr 15, 2013
1 parent cba33ce commit a9d9ab51505ce83b3a6d507465e0b2bb9b72f558
Showing with 51 additions and 8 deletions.
  1. +5 −1 .gitignore
  2. +42 −3 pom.xml
  3. +4 −4 src/test/java/jenkins/plugins/publish_over/BPBuildInfoTest.java
@@ -24,4 +24,8 @@

.idea/
target/
*.iml
*.iml
/target
.settings/
.classpath
.project
45 pom.xml
@@ -27,9 +27,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.388</version>
<version>1.510</version>
</parent>

<groupId>org.jenkins-ci.plugins</groupId>
@@ -164,7 +164,46 @@
</profile>
</profiles>


<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<!-- <version>1.7</version> -->
<executions>
<execution>
<id>add-eclipse-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/groovy-stubs/main</source>
<source>${basedir}/target/generated-sources/localizer</source>
<source>${basedir}/target/generated-sources/taglib-interface</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
@@ -49,15 +49,15 @@ public void setUp() throws Exception {
}

@Test public void testGetRelativePath() throws Exception {
final String relPath = "/some/path/to/dir";
final String relPath = "./some/path/to/dir";
final FilePath path = new FilePath(baseDir, relPath + "/filename.xxx");
assertEquals(relPath, buildInfo.getRelativePathToFile(path, null));
assertEquals(relPath.replace(".", ""), buildInfo.getRelativePathToFile(path, null));
}

@Test public void testGetRelativeDirectory() throws Exception {
final String relDir = "/some/path/to/dir";
final String relDir = "./some/path/to/dir";
final FilePath path = new FilePath(baseDir, relDir);
assertEquals(relDir, buildInfo.getRelativeDir(path, null));
assertEquals(relDir.replace(".", ""), buildInfo.getRelativeDir(path, null));
}

}

1 comment on commit a9d9ab5

@bap2000

This comment has been minimized.

Copy link
Member

@bap2000 bap2000 commented on a9d9ab5 Dec 29, 2013

These tests are to check the method buildInfo.getRelativePathToFile and buildInfo.getRelativeDir which both should return a path relative to the baseDir NOT a test for building up the test filePath using a string with a dot in it.

You should revert this, and if you want to add another test, go ahead, but don't change the semantics of existing tests.

Please sign in to comment.