tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject [55/77] [abbrv] tomee git commit: use different files to prevent file locking issues under Windows
Date Tue, 01 Dec 2015 22:04:07 GMT
use different files to prevent file locking issues under Windows


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/7407d5a8
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/7407d5a8
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/7407d5a8

Branch: refs/heads/tomee-7.0.0-M1
Commit: 7407d5a800def9f346cba4da87560f5c5dcfeb68
Parents: fa0d374
Author: Thiago Veronezi <thiago@veronezi.org>
Authored: Mon Nov 23 22:00:27 2015 -0500
Committer: Thiago Veronezi <thiago@veronezi.org>
Committed: Mon Nov 23 22:00:27 2015 -0500

----------------------------------------------------------------------
 .../loader/provisining/MavenResolverTest.java   | 42 ++++++++------------
 1 file changed, 17 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/7407d5a8/container/openejb-loader/src/test/java/org/apache/openejb/loader/provisining/MavenResolverTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/test/java/org/apache/openejb/loader/provisining/MavenResolverTest.java
b/container/openejb-loader/src/test/java/org/apache/openejb/loader/provisining/MavenResolverTest.java
index 821f513..7b7a5b8 100644
--- a/container/openejb-loader/src/test/java/org/apache/openejb/loader/provisining/MavenResolverTest.java
+++ b/container/openejb-loader/src/test/java/org/apache/openejb/loader/provisining/MavenResolverTest.java
@@ -43,39 +43,31 @@ public class MavenResolverTest {
         assertEquals(ProvisioningResolver.LocalInputStream.class.getName(), resolver.resolve("mvn:junit:junit:4.12:jar").getClass().getName());
// use version of the pom to ensure it is local
     }
 
-    @Test
-    public void resolve() throws Exception {
-        final File file = new File("target/test/foo.jar");
-        Files.remove(file);
-        Files.mkdirs(file.getParentFile());
-        final FileOutputStream to = new FileOutputStream(file);
-        IO.copy(resolver.resolve("mvn:junit:junit:4.12:jar"), to);
-        IO.close(to);
-        assertTrue(file.exists());
-        assertTrue(Collections.list(new JarFile(file).entries()).size() > 300 /* 323 */);
// just check it is not an error page
+    private File getAvailableFile() {
+        File file = null;
+        for (int i = 0; i < 100; i++) {
+            file = new File("target/test/foo_" + i + ".jar");
+            if (!file.exists()) {
+                Files.mkdirs(file.getParentFile());
+                break;
+            }
+        }
+        return file;
     }
 
-    @Test
-    public void customRepo() throws Exception {
-        final File file = new File("target/test/foo.jar");
-        Files.remove(file);
-        Files.mkdirs(file.getParentFile());
+    public void resolveCommon(String path) throws Exception {
+        final File file = getAvailableFile();
         final FileOutputStream to = new FileOutputStream(file);
-        IO.copy(resolver.resolve("mvn:http://repo1.maven.org/maven2/!junit:junit:4.12:jar"),
to);
+        IO.copy(resolver.resolve(path), to);
         IO.close(to);
         assertTrue(file.exists());
         assertTrue(Collections.list(new JarFile(file).entries()).size() > 300 /* 323 */);
// just check it is not an error page
     }
 
     @Test
-    public void latest() throws Exception {
-        final File file = new File("target/test/foo.jar");
-        Files.remove(file);
-        Files.mkdirs(file.getParentFile());
-        final FileOutputStream to = new FileOutputStream(file);
-        IO.copy(resolver.resolve("mvn:http://repo1.maven.org/maven2/!junit:junit:LATEST:jar"),
to);
-        IO.close(to);
-        assertTrue(file.exists());
-        assertTrue(Collections.list(new JarFile(file).entries()).size() > 10 /* 323 */);
// just check it is not an error page
+    public void resolve() throws Exception {
+        resolveCommon("mvn:junit:junit:4.12:jar");
+        resolveCommon("mvn:http://repo1.maven.org/maven2/!junit:junit:4.12:jar");
+        resolveCommon("mvn:http://repo1.maven.org/maven2/!junit:junit:LATEST:jar");
     }
 }


Mime
View raw message