You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2017/12/21 05:01:33 UTC
[karaf-cave] branch master updated: Use a generic extract approach
in the deployer service
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git
The following commit(s) were added to refs/heads/master by this push:
new 6e89213 Use a generic extract approach in the deployer service
6e89213 is described below
commit 6e892135d2b69b00189668cd0bb1ee3b591758fa
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Thu Dec 21 06:01:16 2017 +0100
Use a generic extract approach in the deployer service
---
.../cave/deployer/service/impl/DeployerImpl.java | 19 ++++---------------
.../cave/deployer/service/impl/DeployerImplTest.java | 5 +++++
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java b/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
index c9504fc..23002e8 100644
--- a/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
+++ b/deployer/service/src/main/java/org/apache/karaf/cave/deployer/service/impl/DeployerImpl.java
@@ -188,29 +188,18 @@ public class DeployerImpl implements Deployer {
InputStream is = null;
JarInputStream zipIs = null;
- File repoDir = new File(baseDir, "repository");
- File resourceDir = new File(baseDir, "resource");
-
try {
is = new URI(url).toURL().openStream();
- repoDir.mkdirs();
+ baseDir.mkdirs();
zipIs = new JarInputStream(is);
boolean scanForRepos = true;
ZipEntry entry = zipIs.getNextEntry();
while (entry != null) {
- if (entry.getName().startsWith("repository")) {
- String path = entry.getName().substring("repository/".length());
- File destFile = new File(repoDir, path);
- extract(zipIs, entry, destFile);
- }
-
- if (entry.getName().startsWith("resource")) {
- String path = entry.getName().substring("resource/".length());
- File destFile = new File(resourceDir, path);
- extract(zipIs, entry, destFile);
- }
+ String path = entry.getName();
+ File destFile = new File(baseDir, path);
+ extract(zipIs, entry, destFile);
entry = zipIs.getNextEntry();
}
} finally {
diff --git a/deployer/service/src/test/java/org/apache/karaf/cave/deployer/service/impl/DeployerImplTest.java b/deployer/service/src/test/java/org/apache/karaf/cave/deployer/service/impl/DeployerImplTest.java
index dfc279c..52380e6 100644
--- a/deployer/service/src/test/java/org/apache/karaf/cave/deployer/service/impl/DeployerImplTest.java
+++ b/deployer/service/src/test/java/org/apache/karaf/cave/deployer/service/impl/DeployerImplTest.java
@@ -43,6 +43,11 @@ public class DeployerImplTest {
}
@Test
+ public void extractTest() throws Exception {
+ deployer.extract("mvn:org.apache.karaf/apache-karaf-minimal/4.1.3/zip", "target/test/karaf");
+ }
+
+ @Test
public void explodeKarTest() throws Exception {
deployer.explode("mvn:org.apache.karaf.features/framework/4.1.3/kar", "file:target/test/repository/kar");
}
--
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <co...@karaf.apache.org>'].