本文整理汇总了Java中org.hsqldb.lib.tar.TarMalformatException类的典型用法代码示例。如果您正苦于以下问题:Java TarMalformatException类的具体用法?Java TarMalformatException怎么用?Java TarMalformatException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TarMalformatException类属于org.hsqldb.lib.tar包,在下文中一共展示了TarMalformatException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testMainAlreadyOpen
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void testMainAlreadyOpen()
throws SQLException, IOException, TarMalformatException {
try {
setupConn("db1");
try {
DbBackupMain.main(new String[] {
"--save", baseDir.getAbsolutePath() + "/mainOpen.tar",
baseDir.getAbsolutePath() + "/db1/dbfile"
});
} catch (IllegalStateException ioe) {
return;
}
} finally {
shutdownAndCloseConn();
}
fail("Backup from main() did not throw even though DB is open");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:21,代码来源:TestDbBackup.java
示例2: restoreDatabase
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
/**
* Performs database restoration.
* No need of transaction here: DBmain is called before starting datasource.
*
* @param properties properties containing arguments to execute the restoration.
*/
private static void restoreDatabase (Properties properties) throws
IOException, TarMalformatException
{
String backup = properties.getProperty ("dhus.db.backup");
String location = properties.getProperty ("dhus.db.location");
if (backup == null || location == null)
{
throw new UnsupportedOperationException ();
}
FileUtils.deleteDirectory (new File(location));
String[] args = {"--extract", backup, location};
DbBackupMain.main (args);
LOGGER.info("Database restored.");
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:23,代码来源:SystemService.java
示例3: testMainAlreadyOpen
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void testMainAlreadyOpen()
throws SQLException, IOException, TarMalformatException {
try {
setupConn("db1");
try {
DbBackup.main(new String[] {
"--save", baseDir.getAbsolutePath() + "/mainOpen.tar",
baseDir.getAbsolutePath() + "/db1/dbfile"
});
} catch (IllegalStateException ioe) {
return;
}
} finally {
shutdownAndCloseConn();
}
fail("Backup from main() did not throw even though DB is open");
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:21,代码来源:TestDbBackup.java
示例4: testOnlineBackup
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
/**
* Test all forms of online backups with explicit filenames.
*/
public void testOnlineBackup()
throws SQLException, IOException, TarMalformatException {
onlineBackupAndRestore("online.tar", true, false, "db11");
onlineBackupAndRestore("online.tar.gz", false, true, "db12");
onlineBackupAndRestore("online.tgz", false, true, "db13");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:11,代码来源:TestDbBackup.java
示例5: mainBackupAndRestore
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void mainBackupAndRestore(String baseTarName)
throws SQLException, IOException, TarMalformatException {
DbBackupMain.main(new String[] {
"--save", baseDir.getAbsolutePath() + '/' + baseTarName,
baseDir.getAbsolutePath() + "/db1/dbfile"
});
File destDir = new File(baseDir, "mainrestored");
if (!destDir.mkdir()) {
throw new IOException("Failed to make new dir. to restore to: "
+ destDir.getAbsolutePath());
}
DbBackupMain.main(new String[] {
"--extract", baseDir.getAbsolutePath() + '/' + baseTarName,
destDir.getAbsolutePath()
});
try {
setupConn("mainrestored");
ResultSet rs =
conn.createStatement().executeQuery("SELECT * FROM t;");
rs.next();
assertEquals("Wrong table 't' contents", 34, rs.getInt("i"));
} finally {
shutdownAndCloseConn();
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:33,代码来源:TestDbBackup.java
示例6: testOnlineBackup
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
/**
* Test all forms of online backups with explicit filenames.
*/
public void testOnlineBackup()
throws SQLException, IOException, TarMalformatException {
onlineBackupAndRestore("online.tar", true, false, "db11");
onlineBackupAndRestore("online.tar.gz", false, true, "db12");
onlineBackupAndRestore("online.tgz", false, true, "db13");
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:10,代码来源:TestDbBackup.java
示例7: mainBackupAndRestore
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void mainBackupAndRestore(String baseTarName)
throws SQLException, IOException, TarMalformatException {
DbBackup.main(new String[] {
"--save", baseDir.getAbsolutePath() + '/' + baseTarName,
baseDir.getAbsolutePath() + "/db1/dbfile"
});
File destDir = new File(baseDir, "mainrestored");
if (!destDir.mkdir()) {
throw new IOException("Failed to make new dir. to restore to: "
+ destDir.getAbsolutePath());
}
DbBackup.main(new String[] {
"--extract", baseDir.getAbsolutePath() + '/' + baseTarName,
destDir.getAbsolutePath()
});
try {
setupConn("mainrestored");
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM t;");
rs.next();
assertEquals("Wrong table 't' contents", 34, rs.getInt("i"));
} finally {
shutdownAndCloseConn();
}
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:32,代码来源:TestDbBackup.java
示例8: testBasicBackup
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void testBasicBackup()
throws SQLException, IOException, TarMalformatException {
mainBackupAndRestore("basic.tar");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:5,代码来源:TestDbBackup.java
示例9: testGzip
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void testGzip()
throws SQLException, IOException, TarMalformatException {
mainBackupAndRestore("compressed.tar.gz");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:5,代码来源:TestDbBackup.java
示例10: onlineBackupAndRestore
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void onlineBackupAndRestore(String baseTarName, boolean populate,
boolean compress,
String restoreDest)
throws SQLException, IOException,
TarMalformatException {
try {
setupConn("db1");
conn.createStatement().executeUpdate("DELETE FROM t");
// For this case, we wipe the data that we so carefully set up,
// so that we can call this method repeatedly without worrying
// about left-over data from a previous run.
conn.commit();
conn.createStatement().executeUpdate("INSERT INTO t VALUES(1)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(3)");
conn.commit();
conn.createStatement().executeUpdate("INSERT INTO t VALUES(4)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(5)");
conn.createStatement().executeUpdate("BACKUP DATABASE TO '"
+ baseDir.getAbsolutePath()
+ '/' + baseTarName
+ "' BLOCKING"
+ (compress ? ""
: " NOT COMPRESSED"));
conn.createStatement().executeUpdate("INSERT INTO t VALUES(6)");
conn.commit();
conn.createStatement().executeUpdate("SHUTDOWN");
alreadyShut = true;
if (verbose) {
System.err.println("Shut down 'db1'");
}
} finally {
shutdownAndCloseConn();
}
File destDir = new File(baseDir, restoreDest);
if (!destDir.mkdir()) {
throw new IOException("Failed to make new dir. to restore to: "
+ destDir.getAbsolutePath());
}
DbBackupMain.main(new String[] {
"--extract", baseDir.getAbsolutePath() + '/' + baseTarName,
destDir.getAbsolutePath()
});
try {
setupConn(restoreDest);
conn.createStatement().executeUpdate("ROLLBACK");
ResultSet rs = conn.createStatement().executeQuery(
"SELECT count(*) c FROM t;");
rs.next();
// 3 committed, 5 uncommited before saving:
assertEquals("Wrong table 't' contents", 5, rs.getInt("c"));
} finally {
shutdownAndCloseConn();
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:67,代码来源:TestDbBackup.java
示例11: onlineBackupAndRestore
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
public void onlineBackupAndRestore(String baseTarName,
boolean populate, boolean compress, String restoreDest)
throws SQLException, IOException, TarMalformatException {
try {
setupConn("db1");
conn.createStatement().executeUpdate("DELETE FROM t");
// For this case, we wipe the data that we so carefully set up,
// so that we can call this method repeatedly without worrying
// about left-over data from a previous run.
conn.commit();
conn.createStatement().executeUpdate("INSERT INTO t VALUES(1)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(3)");
conn.commit();
conn.createStatement().executeUpdate("INSERT INTO t VALUES(4)");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(5)");
conn.createStatement().executeUpdate("BACKUP DATABASE TO '"
+ baseDir.getAbsolutePath()
+ '/' + baseTarName
+ "' BLOCKING"
+ (compress ? "" : " NOT COMPRESSED"));
conn.createStatement().executeUpdate(
"INSERT INTO t VALUES(6)");
conn.commit();
conn.createStatement().executeUpdate("SHUTDOWN");
alreadyShut = true;
if (verbose) {
System.err.println("Shut down 'db1'");
}
} finally {
shutdownAndCloseConn();
}
File destDir = new File(baseDir, restoreDest);
if (!destDir.mkdir()) {
throw new IOException("Failed to make new dir. to restore to: "
+ destDir.getAbsolutePath());
}
DbBackup.main(new String[] {
"--extract", baseDir.getAbsolutePath() + '/' + baseTarName,
destDir.getAbsolutePath()
});
try {
setupConn(restoreDest);
conn.createStatement().executeUpdate("ROLLBACK");
ResultSet rs =
conn.createStatement().executeQuery("SELECT count(*) c FROM t;");
rs.next();
// 3 committed, 5 uncommited before saving:
assertEquals("Wrong table 't' contents", 5, rs.getInt("c"));
} finally {
shutdownAndCloseConn();
}
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:61,代码来源:TestDbBackup.java
示例12: testAutoNaming
import org.hsqldb.lib.tar.TarMalformatException; //导入依赖的package包/类
/**
* Test that correct DB names are generated when user supplies just a
* directory.
*
* N.b. This test may not work right if tests are run at midnight.
* This limitation will be removed once we can update the FilenameFilters
* with Java 4's java.util.regex.
*/
public void testAutoNaming()
throws SQLException, IOException, TarMalformatException {
boolean caught;
int fileCount;
try {
setupConn("db1");
conn.createStatement().executeUpdate("INSERT INTO t VALUES(2)");
conn.commit();
fileCount = baseDir.listFiles(autoTarFilenameFilter).length;
if (fileCount != 0)
throw new IllegalStateException(Integer.toString(fileCount)
+ " auto-tar files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' before starting testAutoNaming");
fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length;
if (fileCount != 0)
throw new IllegalStateException(Integer.toString(fileCount)
+ " auto-tar.gz files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' before starting testAutoNaming");
conn.createStatement().executeUpdate("BACKUP DATABASE TO '"
+ baseDir.getAbsolutePath()
+ "/' BLOCKING NOT COMPRESSED");
fileCount = baseDir.listFiles(autoTarFilenameFilter).length;
if (fileCount != 1)
fail(Integer.toString(fileCount)
+ " auto-tar files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' after writing a non-compressed backup");
fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length;
if (fileCount != 0)
fail(Integer.toString(fileCount)
+ " auto-tar.gz files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' after writing a non-compressed backup");
conn.createStatement().executeUpdate("BACKUP DATABASE TO '"
+ baseDir.getAbsolutePath()
+ "/' BLOCKING COMPRESSED");
fileCount = baseDir.listFiles(autoTarFilenameFilter).length;
if (fileCount != 1)
fail(Integer.toString(fileCount)
+ " auto-tar files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' after writing both backups");
fileCount = baseDir.listFiles(autoTarGzFilenameFilter).length;
if (fileCount != 1)
fail(Integer.toString(fileCount)
+ " auto-tar.gz files exist in baseDir '"
+ baseDir.getAbsolutePath()
+ "' after writing a compressed backup");
} finally {
shutdownAndCloseConn();
}
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:66,代码来源:TestDbBackup.java
注:本文中的org.hsqldb.lib.tar.TarMalformatException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论