Skip to content
Browse files

Merge branch 'v0.5-bugfix' into v0.7

  • Loading branch information...
2 parents a8dd37c + a48da41 commit 5f59a7b2b561df074f470c1fe4d3f061fc97aa54 @jonnyzzz jonnyzzz committed Apr 11, 2012
View
2 .idea/artifacts/deploy.xml
@@ -1,6 +1,6 @@
<component name="ArtifactManager">
<artifact name="deploy">
- <output-path>$TeamCityDistribution$/Data/plugins</output-path>
+ <output-path>$TeamCityDistribution$/../Data.Trunk/plugins</output-path>
<root id="root">
<element id="artifact" artifact-name="plugin-zip" />
</root>
View
2 .idea/runConfigurations/Tomcat_6_TeamCity.xml
@@ -2,7 +2,7 @@
<configuration default="false" name="Tomcat 6 TeamCity" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="Tomcat 6">
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OPEN_IN_BROWSER_URL" value="http://localhost:8111" />
- <option name="COMMON_VM_ARGUMENTS" value="-ea -Xmx384m -XX:MaxPermSize=200m -Ddebug=true -server -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless -DTC.res.disableAll=true -Dteamcity.development.mode=true -Dteamcity.development.shadowCopyClasses=true -Dteamcity.data.path=$TeamCityDistribution$/Data -Dteamcity_logs=$TeamCityDistribution$/logs -Dlog4j.configuration=file:$TeamCityDistribution$/conf/teamcity-server-log4j.xml" />
+ <option name="COMMON_VM_ARGUMENTS" value="-ea -Xmx384m -XX:MaxPermSize=200m -Ddebug=true -server -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless -DTC.res.disableAll=true -Dteamcity.development.mode=true -Dteamcity.development.shadowCopyClasses=true -Dteamcity.data.path=$TeamCityDistribution$/../Data.Trunk -Dteamcity_logs=$TeamCityDistribution$/logs -Dlog4j.configuration=file:$TeamCityDistribution$/conf/teamcity-server-log4j.xml" />
<option name="UPDATING_POLICY" value="restart-server" />
<deployment>
<file path="$TeamCityDistribution$/webapps/ROOT">
View
6 nuget-server/src/jetbrains/buildServer/nuget/server/toolRegistry/impl/ToolUnpacker.java
@@ -20,11 +20,8 @@
import jetbrains.buildServer.util.FileUtil;
import org.jetbrains.annotations.NotNull;
-import java.io.BufferedInputStream;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.util.zip.ZipInputStream;
/**
* Created by Eugene Petrenko (eugene.petrenko@gmail.com)
@@ -34,8 +31,7 @@
public void extractPackage(@NotNull final File pkg,
@NotNull final File dest) throws IOException {
FileUtil.createDir(dest);
- final ZipInputStream zip = new ZipInputStream(new BufferedInputStream(new FileInputStream(pkg)));
- if (!ArchiveUtil.unpackZip(zip, dest)) {
+ if (!ArchiveUtil.unpackZip(pkg, "", dest)) {
throw new IOException("Failed to unpack package " + pkg + " to " + dest);
}
}
View
61 nuget-tests/src/jetbrains/buildServer/nuget/tests/server/tools/ToolUnpackerTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed 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.
+ */
+
+package jetbrains.buildServer.nuget.tests.server.tools;
+
+import jetbrains.buildServer.BaseTestCase;
+import jetbrains.buildServer.nuget.server.toolRegistry.impl.ToolUnpacker;
+import jetbrains.buildServer.util.TestFor;
+import junit.framework.Assert;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * @author Eugene Petrenko (eugene.petrenko@gmail.com)
+ * Date: 11.04.12 16:08
+ */
+public class ToolUnpackerTest extends BaseTestCase {
+
+ @Test
+ @TestFor(issues = "TW-21050")
+ public void test_unpack_with_directories() throws IOException {
+ final File zip = createTempFile();
+
+ ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zip));
+
+ addZipDir(zos, "/a/b/c/d/");
+ addZipDir(zos, "/a/b/c/");
+ addZipDir(zos, "/a/b/");
+ addZipDir(zos, "/a/");
+ zos.close();
+
+ ToolUnpacker u = new ToolUnpacker();
+ File dest = createTempDir();
+ u.extractPackage(zip, dest);
+ }
+
+ private void addZipDir(ZipOutputStream zos, String path) throws IOException {
+ ZipEntry e = new ZipEntry(path);
+ Assert.assertTrue(e.isDirectory());
+ zos.putNextEntry(e);
+ zos.closeEntry();
+ }
+}
View
1 nuget-tests/src/testng-nuget-fast.xml
@@ -80,6 +80,7 @@
<class name="jetbrains.buildServer.nuget.tests.server.tools.ToolPackerTest"/>
<class name="jetbrains.buildServer.nuget.tests.server.tools.NuGetToolsInstallerTest"/>
+ <class name="jetbrains.buildServer.nuget.tests.server.tools.ToolUnpackerTest"/>
<class name="jetbrains.buildServer.nuget.tests.server.tools.AvailableToolStateTest"/>
<class name="jetbrains.buildServer.nuget.tests.agent.NuGetPackActionFactoryTest"/>

0 comments on commit 5f59a7b

Please sign in to comment.
Something went wrong with that request. Please try again.