Skip to content

Commit

Permalink
JUnit test separation. Updated EpiLog version v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgm committed Jul 14, 2018
1 parent 61a5682 commit eda5288
Show file tree
Hide file tree
Showing 12 changed files with 578 additions and 369 deletions.
55 changes: 24 additions & 31 deletions src/main/java/org/epilogtool/io/FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,46 +111,41 @@ public static File copyFile(File srcFile, String destDir) {
return fDestDir;
}

private static void unZipIt(String zipFile, File folder) {
private static void unZipIt(String zipFile, File folder) throws IOException {

byte[] buffer = new byte[1024];

try {
if (!folder.exists()) {
folder.mkdir();
}
if (!folder.exists()) {
folder.mkdir();
}

// get the zip file content
ZipInputStream zis = new ZipInputStream(new FileInputStream(new File(zipFile)));
// get the zipped file list entry
ZipEntry ze = zis.getNextEntry();
// get the zip file content
ZipInputStream zis = new ZipInputStream(new FileInputStream(new File(zipFile)));
// get the zipped file list entry
ZipEntry ze = zis.getNextEntry();

while (ze != null) {
while (ze != null) {

String fileName = ze.getName().split("/")[ze.getName().split("/").length - 1];
File newFile = new File(folder + File.separator + fileName);
String fileName = ze.getName().split("/")[ze.getName().split("/").length - 1];
File newFile = new File(folder + File.separator + fileName);

// create all non exists folders
// else you will hit FileNotFoundException for compressed folder
new File(newFile.getParent()).mkdirs();
// create all non exists folders
// else you will hit FileNotFoundException for compressed folder
new File(newFile.getParent()).mkdirs();

FileOutputStream fos = new FileOutputStream(newFile);
FileOutputStream fos = new FileOutputStream(newFile);

int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}

fos.close();
ze = zis.getNextEntry();
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}

zis.closeEntry();
zis.close();

} catch (IOException ex) {
ex.printStackTrace();
fos.close();
ze = zis.getNextEntry();
}

zis.closeEntry();
zis.close();
}

public static LogicalModel loadSBMLModel(File file) throws IOException {
Expand All @@ -176,9 +171,7 @@ public static LogicalModel loadSBMLModel(File file) throws IOException {
* @throws SecurityException
* @throws ClassNotFoundException
*/
public static boolean loadPEPS(String filename)
throws IOException, InstantiationException, IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {
public static boolean loadPEPS(String filename) throws IOException {
File tmpFolder = FileIO.unzipPEPSTmpDir(filename);
boolean load = false;
// Loads all the epithelium from the config.txt configuration file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.io.File;

public class TestHelper {
public class FileUtils {
static File resourceFolder;
static {
resourceFolder = new File("target", "test-classes");
Expand All @@ -11,7 +11,7 @@ public class TestHelper {
}
}

public static File getTestResource(String group, String name) {
public static File getResource(String group, String name) {
File dir = resourceFolder;

if (group != null && group.length() > 0) {
Expand Down
4 changes: 3 additions & 1 deletion src/test/java/org/epilogtool/core/AllCoreTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses( { EpitheliumCellTest.class })
@SuiteClasses({ LoadProjectTest.class, EpitheliumTest.class, IntegrationFunctionsTest.class,
ModelUpdateTest.class, NeighboursTest.class, InitialConditionTest.class,
PerturbationTest.class, EpitheliumCellTest.class, SimulationTest.class })
public class AllCoreTests {

}
Loading

0 comments on commit eda5288

Please sign in to comment.