use of org.apache.geronimo.transaction.log.HOWLLog in project aries by apache.
the class LogConversionTest method unknownExistingTransactionLogChangedLogDir.
@Test
@SuppressWarnings("unchecked")
public void unknownExistingTransactionLogChangedLogDir() throws Exception {
File logDir = new File(BASE, "unknownExistingTransactionLogChangedLogDir");
File newLogDir = new File(BASE, "unknownExistingTransactionLogChangedLogDir-new");
FileUtils.deleteDirectory(logDir);
FileUtils.deleteDirectory(newLogDir);
logDir.mkdirs();
Hashtable<String, Object> properties = new Hashtable<String, Object>();
HOWLLog txLog = createLog("unknownExistingTransactionLogChangedLogDir", "transaction", 2, -1, 1, properties);
txLog.doStart();
transaction(txLog, 1, false);
txLog.doStop();
Hashtable<String, Object> newConfig = (Hashtable<String, Object>) properties.clone();
newConfig.put("aries.transaction.howl.logFileDir", newLogDir.getAbsolutePath());
assertFalse(TransactionLogUtils.copyActiveTransactions(null, newConfig));
assertFalse("Transaction log should not exist", new File(newLogDir, "transaction_1.log").exists());
assertTrue("Old transaction log should not be removed", logDir.exists());
assertFalse("New transaction log should not be created (will be created on TX Manager startup)", newLogDir.exists());
}
use of org.apache.geronimo.transaction.log.HOWLLog in project aries by apache.
the class LogConversionTest method changed3ParametersAndLogDir.
@Test
@SuppressWarnings("unchecked")
public void changed3ParametersAndLogDir() throws Exception {
File logDir = new File(BASE, "changed3ParametersAndLogDir");
File newLogDir = new File(BASE, "changed3ParametersAndLogDir-new");
FileUtils.deleteDirectory(logDir);
FileUtils.deleteDirectory(newLogDir);
logDir.mkdirs();
Hashtable<String, Object> properties = new Hashtable<String, Object>();
HOWLLog txLog = createLog("changed3ParametersAndLogDir", "transaction", 3, -1, 1, properties);
txLog.doStart();
transaction(txLog, 1, false);
txLog.doStop();
Hashtable<String, Object> newConfig = (Hashtable<String, Object>) properties.clone();
newConfig.put("aries.transaction.howl.maxLogFiles", "4");
newConfig.put("aries.transaction.howl.maxBlocksPerFile", "4");
newConfig.put("aries.transaction.howl.bufferSize", "4");
newConfig.put("aries.transaction.howl.logFileDir", newLogDir.getAbsolutePath());
long lm = earlierLastModified(new File(logDir, "transaction_1.log"));
assertTrue(TransactionLogUtils.copyActiveTransactions(properties, newConfig));
assertTrue("Old transaction log should exist", new File(logDir, "transaction_1.log").exists());
assertTrue("New transaction log should exist", new File(newLogDir, "transaction_1.log").exists());
assertThat("Old transaction log should be touched (HOWL Log opened)", new File(logDir, "transaction_1.log").lastModified(), not(equalTo(lm)));
}
use of org.apache.geronimo.transaction.log.HOWLLog in project aries by apache.
the class LogConversionTest method changedBlockSize.
@Test
@SuppressWarnings("unchecked")
public void changedBlockSize() throws Exception {
File logDir = new File(BASE, "changedBlockSize");
FileUtils.deleteDirectory(logDir);
logDir.mkdirs();
Hashtable<String, Object> properties = new Hashtable<String, Object>();
HOWLLog txLog = createLog("changedBlockSize", "transaction", 3, -1, 1, properties);
txLog.doStart();
transaction(txLog, 1, false);
txLog.doStop();
Hashtable<String, Object> newConfig = (Hashtable<String, Object>) properties.clone();
newConfig.put("aries.transaction.howl.bufferSize", "32");
long lm = earlierLastModified(new File(logDir, "transaction_1.log"));
assertTrue(TransactionLogUtils.copyActiveTransactions(properties, newConfig));
assertTrue("Transaction log should exist", new File(logDir, "transaction_1.log").exists());
assertThat("Transaction log should be processed", new File(logDir, "transaction_1.log").lastModified(), not(equalTo(lm)));
}
use of org.apache.geronimo.transaction.log.HOWLLog in project aries by apache.
the class LogConversionTest method existingTransactionLogChangedLogFileNameAndLogDir.
@Test
@SuppressWarnings("unchecked")
public void existingTransactionLogChangedLogFileNameAndLogDir() throws Exception {
File logDir = new File(BASE, "existingTransactionLogChangedLogFileNameAndLogDir");
File newLogDir = new File(BASE, "existingTransactionLogChangedLogFileNameAndLogDir-new");
FileUtils.deleteDirectory(logDir);
logDir.mkdirs();
Hashtable<String, Object> properties = new Hashtable<String, Object>();
HOWLLog txLog = createLog("existingTransactionLogChangedLogFileNameAndLogDir", "transaction", 2, -1, 1, properties);
txLog.doStart();
transaction(txLog, 1, false);
txLog.doStop();
earlierLastModified(new File(logDir, "transaction_1.log"));
Hashtable<String, Object> newConfig = (Hashtable<String, Object>) properties.clone();
newConfig.put("aries.transaction.howl.logFileName", "megatransaction");
newConfig.put("aries.transaction.howl.logFileDir", newLogDir.getAbsolutePath());
assertTrue(TransactionLogUtils.copyActiveTransactions(properties, newConfig));
assertFalse("Old transaction log should not exist", new File(logDir, "transaction_1.log").exists());
assertTrue("New transaction log should exist", new File(newLogDir, "megatransaction_1.log").exists());
}
use of org.apache.geronimo.transaction.log.HOWLLog in project aries by apache.
the class LogConversionTest method changedMaxBlocksPerFile.
@Test
@SuppressWarnings("unchecked")
public void changedMaxBlocksPerFile() throws Exception {
File logDir = new File(BASE, "changedMaxBlocksPerFile");
FileUtils.deleteDirectory(logDir);
logDir.mkdirs();
Hashtable<String, Object> properties = new Hashtable<String, Object>();
HOWLLog txLog = createLog("changedMaxBlocksPerFile", "transaction", 3, -1, 1, properties);
txLog.doStart();
transaction(txLog, 1, false);
txLog.doStop();
Hashtable<String, Object> newConfig = (Hashtable<String, Object>) properties.clone();
newConfig.put("aries.transaction.howl.maxBlocksPerFile", "20");
long lm = earlierLastModified(new File(logDir, "transaction_1.log"));
assertTrue(TransactionLogUtils.copyActiveTransactions(properties, newConfig));
assertTrue("Transaction log should exist", new File(logDir, "transaction_1.log").exists());
assertFalse("There should be 3 transaction log files", new File(logDir, "transaction_4.log").exists());
assertThat("Transaction log should be processed", new File(logDir, "transaction_1.log").lastModified(), not(equalTo(lm)));
}
Aggregations