Skip to content
Snippets Groups Projects
Commit bf28a879 authored by Jules Paget's avatar Jules Paget
Browse files

CLeaning code of test and service

parent 0aa79c85
No related branches found
No related tags found
1 merge request!275Draft: JPA Siard tool
......@@ -154,88 +154,21 @@ public class SiardService extends Tools implements CommandLineRunner {
throw new RuntimeException("Error when trying to get Primary data from DB.", e);
}
/* Close archive and connection */
// TODO Proper try catch block with exception
try {
archiveSiard.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO Proper try catch block with exception
try {
connect.rollback();
connect.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return fileSiard;
}
// private File exportDatabase() {
// Connection connect = null;
// /* Get good JDBC driver and open connection */
// String connectError = SiardConnection.getSiardConnection().loadDriver(siardConfig.getJdbcUrl());
//
// try {
// connect = DriverManager.getConnection(siardConfig.getJdbcUrl(), siardConfig.getUserDb(),
// siardConfig.getPasswordDb());
// connect.setAutoCommit(false);
// log.info("Connected to " + connect.getMetaData().getURL().toString());
// } catch (SQLException e) {
// throw new RuntimeException("Error when trying to connect to Database.", e);
// }
//
// /* Siard archive where database will be exported => Zip ? */
// Archive archiveSiard = ArchiveImpl.newInstance();
// /* Siard file where database will be exported */
// File fileSiard = siardConfig.getFileSiard();
//
// // Overwrite automatically
// if (fileSiard != null) {
// if (fileSiard.exists()) {
// fileSiard.delete();
// }
// }
//
// try {
// archiveSiard.create(fileSiard);
// } catch (IOException e) {
// throw new RuntimeException("Error when trying to create new SIARD file.", e);
// }
//
// /* Get Metadata from DB */
// MetaDataFromDb metadataDb;
// try {
// metadataDb = MetaDataFromDb.newInstance(connect.getMetaData(), archiveSiard.getMetaData());
// metadataDb.download(false, false, null);
// } catch (SQLException | IOException e) {
// throw new RuntimeException("Error when trying to get Metadata from DB.", e);
// }
//
// /* Get Primary data from DB */
// PrimaryDataFromDb primaryDataDb = PrimaryDataFromDb.newInstance(connect, archiveSiard);
// try {
// primaryDataDb.download(null);
// } catch (SQLException | IOException e) {
// throw new RuntimeException("Error when trying to get Primary data from DB.", e);
// }
//
// /* Close archive and connection */
// try {
// archiveSiard.close();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// try {
// connect.rollback();
// connect.close();
// } catch (SQLException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
//
// return fileSiard;
// }
}
......@@ -62,7 +62,8 @@ public class SiardTest {
ZipTool expectedZipTool = new ZipTool(expectedSiardFile.toURI());
assertTrue(resultZipTool.checkZip());
assertEquals(expectedZipTool.getEntryNumber(), resultZipTool.getEntryNumber());
// assertEquals("database wrongly exported", expectedZipTool, resultZipTool); // TODO find a new way of comparing zip archives
// assertEquals("database wrongly exported", expectedZipTool, resultZipTool);
// TODO find a way oto compare zip archives content
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment