You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2020/05/17 02:44:37 UTC
[maven-shared-utils] branch master updated: Fix issue with copying
file executable test with ASF Jenkins Signed-off-by: olivier lamy
This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
The following commit(s) were added to refs/heads/master by this push:
new 92a5ba3 Fix issue with copying file executable test with ASF Jenkins Signed-off-by: olivier lamy <ol...@apache.org>
new 89c5bef Merge branch 'files-copy-failure-on-jenkins'
92a5ba3 is described below
commit 92a5ba3c431affcabb2cebd11ca17fe02b15748c
Author: olivier lamy <ol...@apache.org>
AuthorDate: Sun May 17 11:03:50 2020 +1000
Fix issue with copying file executable test with ASF Jenkins
Signed-off-by: olivier lamy <ol...@apache.org>
---
pom.xml | 1 +
.../maven/shared/utils/io/FileUtilsTest.java | 14 +++++---
.../maven/shared/utils/io/Java7SupportTest.java | 41 ----------------------
src/test/resources/executable | 1 +
4 files changed, 12 insertions(+), 45 deletions(-)
diff --git a/pom.xml b/pom.xml
index 681089d..fa31444 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,7 @@
<excludes combine.children="append">
<exclude>src/test/resources/directorywalker/**/*</exclude>
<exclude>src/test/resources/symlinks/**/*</exclude>
+ <exclude>src/test/resources/executable</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
index b5f17e6..46b94ff 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
@@ -497,14 +497,20 @@ public class FileUtilsTest
public void copyFileWithPermissions()
throws Exception
{
- File source = new File( "/bin/sh" );
- assumeThat( "Need an executable to copy", source.exists(), is( true ) );
+ File source = new File( "src/test/resources/executable" );
+ source.setExecutable( true );
+ assumeThat( "Need an existing file to copy", source.exists(), is( true ) );
+ assumeThat( "Need an executable file to copy", source.canExecute(), is( true ) );
- File destination = new File( tempFolder.getRoot(), "executable" );
+ File destination = new File( tempFolder.getRoot(), "executable-copy" );
FileUtils.copyFile( source, destination );
- assertThat( "Check executable", destination.canExecute(), is( true ) );
+ assertThat( "destination not exists: " + destination.getAbsolutePath()
+ + ", directory content: " + Arrays.asList( destination.getParentFile().list() ),
+ Files.exists( destination.toPath() ), is( true ) );
+
+ assertThat( "Check copy executable", destination.canExecute(), is( true ) );
}
@Test
diff --git a/src/test/java/org/apache/maven/shared/utils/io/Java7SupportTest.java b/src/test/java/org/apache/maven/shared/utils/io/Java7SupportTest.java
deleted file mode 100644
index 39c3eb1..0000000
--- a/src/test/java/org/apache/maven/shared/utils/io/Java7SupportTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.shared.utils.io;
-
-/*
- * 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.
- */
-
-import java.io.File;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assume.assumeThat;
-import static org.hamcrest.CoreMatchers.not;
-
-public class Java7SupportTest
-{
- @Test
- public void testIsSymLink()
- throws Exception
- {
- File file = new File( "." );
- assertFalse( Java7Support.isSymLink( file ) );
- }
-
-}
diff --git a/src/test/resources/executable b/src/test/resources/executable
new file mode 100755
index 0000000..e804f19
--- /dev/null
+++ b/src/test/resources/executable
@@ -0,0 +1 @@
+noop