forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-32218 More fixes to import from archive. (sakaiproject#4006)
* SAK-32218 Import the expanded zip file. The zip file import was looking in the wrong place for the files it had just expanded and so wasn’t importing the correct files. * SAK-32218 Warn if archive folders don’t exist. Warn at startup if a directory doesn’t exist for the archive and archive-unzip folders doesn’t exist.
- Loading branch information
Showing
5 changed files
with
91 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
common/archive-impl/impl2/src/test/org/sakaiproject/archive/impl/SiteZipperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.sakaiproject.archive.impl; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
|
||
public class SiteZipperTest { | ||
|
||
private SiteZipper siteZipper; | ||
|
||
@Before | ||
public void setUp() { | ||
siteZipper = new SiteZipper(); | ||
} | ||
|
||
@Test | ||
public void testUnzip() throws IOException, URISyntaxException { | ||
String unzipFolder = Files.createTempDirectory("testUnzip").toString(); | ||
URL resource = getClass().getResource("/!admin-20170303050657.zip"); | ||
|
||
String zip = Paths.get(resource.toURI()).toFile().getAbsolutePath(); | ||
String folder = siteZipper.unzipArchive(zip, unzipFolder); | ||
|
||
Assert.assertEquals("!admin-archive/", folder); | ||
} | ||
|
||
@Test | ||
public void testUnzipNoFolder() throws IOException, URISyntaxException { | ||
String unzipFolder = Files.createTempDirectory("testUnzip").toString(); | ||
URL resource = getClass().getResource("/!admin-no-folder.zip"); | ||
|
||
String zip = Paths.get(resource.toURI()).toFile().getAbsolutePath(); | ||
String folder = siteZipper.unzipArchive(zip, unzipFolder); | ||
|
||
Assert.assertEquals(null, folder); | ||
} | ||
} |
Binary file added
BIN
+6.08 KB
common/archive-impl/impl2/src/test/resources/!admin-20170303050657.zip
Binary file not shown.
Binary file not shown.