public void TestConfigureRecoveryPolicyLoggerUsingDefaultLogger(string location, bool autoCreate) { string testuri = string.Format("activemq:tcp://${{activemqhost}}:61616" + "?nms.RecoveryPolicy.RecoveryLogger.Location={0}" + "&nms.RecoveryPolicy.RecoveryLogger.AutoCreateLocation={1}", location, autoCreate); INetTxConnectionFactory factory = new NetTxConnectionFactory(NMSTestSupport.ReplaceEnvVar(testuri)); using (INetTxConnection connection = factory.CreateNetTxConnection()) { NetTxConnection netTxConnection = connection as NetTxConnection; Assert.IsNotNull(netTxConnection); NetTxRecoveryPolicy policy = netTxConnection.RecoveryPolicy; Assert.AreEqual("file", policy.RecoveryLoggerType); RecoveryFileLogger logger = policy.RecoveryLogger as RecoveryFileLogger; Assert.IsNotNull(logger); Assert.AreEqual(location, logger.Location); Assert.AreEqual(autoCreate, logger.AutoCreateLocation); } }
public void TestSessionCreateFailsWithInvalidLogLocation() { using (INetTxConnection connection = factory.CreateNetTxConnection()) { connection.ExceptionListener += this.OnException; connection.Start(); NetTxConnection con = connection as NetTxConnection; NetTxRecoveryPolicy policy = con.RecoveryPolicy; (policy.RecoveryLogger as RecoveryFileLogger).Location = nonExistantPath; connection.CreateNetTxSession(); } }
public void TestConfigureRecoveryPolicyLoggerType( [Values("tcp://${activemqhost}:61616?nms.RecoveryPolicy.RecoveryLoggerType=file")] string baseConnectionURI) { INetTxConnectionFactory factory = new NetTxConnectionFactory(NMSTestSupport.ReplaceEnvVar(baseConnectionURI)); using (INetTxConnection connection = factory.CreateNetTxConnection()) { NetTxConnection netTxConnection = connection as NetTxConnection; Assert.IsNotNull(netTxConnection); NetTxRecoveryPolicy policy = netTxConnection.RecoveryPolicy; Assert.AreEqual("file", policy.RecoveryLoggerType); RecoveryFileLogger logger = policy.RecoveryLogger as RecoveryFileLogger; Assert.IsNotNull(logger); Assert.AreEqual(Directory.GetCurrentDirectory(), logger.Location); } }