Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 a9d9ab5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -24,4 +24,8 @@

.idea/
target/
*.iml
*.iml
/target
.settings/
.classpath
.project
45 changes: 42 additions & 3 deletions pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.