public void IgnoreExceptionOnDispatcherWhenRemoving() { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); ISync canContinue = new Semaphore(0); ISync started = new Semaphore(0); AddApplication(); AddApplication(sampleDir2); IDeployEventDispatcher dispatcher = new ExceptionDispatcher(started, canContinue); location = new FileSystemDeployLocation(dispatcher, factory, deployPath, true); Assert.AreEqual(2, location.Applications.Count); Directory.Delete(sampleDir, true); started.Acquire(); canContinue.Release(); Assert.AreEqual(1, location.Applications.Count); Directory.Delete(sampleDir2, true); started.Acquire(); canContinue.Release(); Assert.AreEqual(0, location.Applications.Count); }
public void ANewWatcherGetsCreatedAndAssociatedToAnyExistingApplication() { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); AddApplication(); location = new FileSystemDeployLocation(new ForwardingDeployEventDispatcher(), factory, deployPath, true); }
public void ListExistingDirectoriesAsApplications() { log.Debug("start ListExistingDirectoriesAsApplications"); AddApplication(); location = new FileSystemDeployLocation(deployPath); Assert.AreEqual(1, location.Applications.Count); log.Debug("end ListExistingDirectoriesAsApplications"); }
public void CanBeDisposedMoreThanOnce() { IDeployLocation location = new FileSystemDeployLocation(dispatcher, DefaultApplicationWatcherFactory.Instance, deployPath, true); location.Dispose(); location.Dispose(); }
public void CanBeStartedExplicitlyStartedButIsImplicitlyStoppedWhenDisposed() { FileSystemDeployLocation location = new FileSystemDeployLocation(deployPath); location.StartWatching(); location.Dispose(); location.StartWatching(); }
public void LockFileIsDeletedOnDisposeOrStop() { FileSystemDeployLocation location = new FileSystemDeployLocation(dispatcher, deployPath); location.StartWatching(); location.Dispose(); Assert.IsFalse(File.Exists(location.LockFileName)); }
public void SetUp() { springAssembliesDeployer = new SpringAssembliesDeployer("."); location = new FileSystemDeployLocation(deployPath); location.StartWatching(); sync = new Latch(); defaultDeployer = new SyncedDeployer(sync); deployManager = new DeployManager(springAssembliesDeployer, location, defaultDeployer); deployManager.Start(); }
public void DisposeDispatcherOnDispose() { DynamicMock mock = new DynamicMock(typeof(IDeployEventDispatcher)); IDeployEventDispatcher dispatcher = (IDeployEventDispatcher)mock.Object; mock.Expect("Dispose"); IDeployLocation location = new FileSystemDeployLocation(dispatcher, deployPath); location.Dispose(); mock.Verify(); }
public void OnlyApplicationsWithAManagerSuccesfullyStartedAreListed() { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.ExpectAndThrow("StartWatching", new Exception()); AddApplication(); dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent); location = new FileSystemDeployLocation(dispatcher, factory, deployPath, true); triggeredLatch.Acquire(); Assert.AreEqual(0, location.Applications.Count); Assert.IsFalse(deployEventDispatched, "add dispatched in case of error on application watcher"); }
public void TheAssociatedWatcherIsStoppedAndDisposedOnDispose() { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); AddApplication(); location = new FileSystemDeployLocation(new ForwardingDeployEventDispatcher(), factory, deployPath, true); triggeredLatch.Acquire(); location.Dispose(); }
[Test] // Bug fix public void NotInfiniteLoopRemovingAnApplicationWithAManagerThatThrowsExceptionWhenStopped() { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.ExpectAndThrow("StopWatching", new Exception()); AddApplication(); ForwardingDeployEventDispatcher dispatcher = new ForwardingDeployEventDispatcher(); dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent); location = new FileSystemDeployLocation(dispatcher, factory, deployPath, true); Directory.Delete(sampleDir, true); forwardDispatcherSync.Acquire(); Assert.IsTrue(deployEventDispatched, "removal not dispatched in case of error on application watcher"); }
public void AnInvalidApplicationIsNotUpdatedNorRemovedButItWillNotBeListed() { Semaphore sync = new Semaphore(0); AddApplication(); InitHandlerAndStartLocation(sync); File.Delete(serviceXml); Assert.IsFalse(sync.Attempt(1000), "some events propagated, expecting no one"); Assert.IsFalse(handler.applicationUpdated, "application wrongly updated"); Assert.IsFalse(handler.applicationRemoved, "application wrongly removed"); Assert.AreEqual(0, location.Applications.Count, "application listed"); location.Dispose(); location = new FileSystemDeployLocation(deployPath); Assert.AreEqual(0, location.Applications.Count, "invalid application listed"); }
public void IgnoresExceptionAddingExistingApplication () { factoryMock.ExpectAndThrow("CreateApplicationWatcherMonitor", new Exception("exception generated to test behaviour adding application")); AddApplication(); location = new FileSystemDeployLocation (new ForwardingDeployEventDispatcher(), factory, deployPath, true); }
public void IgnoresExceptionAddingExistingApplication() { factoryMock.ExpectAndThrow("CreateApplicationWatcherMonitor", new Exception("exception generated to test behaviour adding application")); AddApplication(); location = new FileSystemDeployLocation(new ForwardingDeployEventDispatcher(), factory, deployPath, true); }
public void OnlyApplicationsWithAManagerSuccesfullyStartedAreListed () { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.ExpectAndThrow("StartWatching", new Exception()); AddApplication(); dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent); location = new FileSystemDeployLocation (dispatcher, factory, deployPath, true); triggeredLatch.Acquire(); Assert.AreEqual(0, location.Applications.Count); Assert.IsFalse(deployEventDispatched, "add dispatched in case of error on application watcher"); }
public void DisposeDispatcherOnDispose () { DynamicMock mock = new DynamicMock (typeof (IDeployEventDispatcher)); IDeployEventDispatcher dispatcher = (IDeployEventDispatcher) mock.Object; mock.Expect ("Dispose"); IDeployLocation location = new FileSystemDeployLocation (dispatcher, deployPath); location.Dispose (); mock.Verify (); }
public void SetUp () { springAssembliesDeployer = new SpringAssembliesDeployer("."); location = new FileSystemDeployLocation(deployPath); location.StartWatching(); sync = new Latch(); defaultDeployer = new SyncedDeployer(sync); deployManager = new DeployManager(springAssembliesDeployer, location, defaultDeployer); deployManager.Start(); }
public void CanBeStartedExplicitlyStartedButIsImplicitlyStoppedWhenDisposed () { FileSystemDeployLocation location = new FileSystemDeployLocation(deployPath); location.StartWatching(); location.Dispose(); location.StartWatching(); }
public void CanBeDisposedMoreThanOnce () { IDeployLocation location = new FileSystemDeployLocation(dispatcher, DefaultApplicationWatcherFactory.Instance, deployPath, true); location.Dispose(); location.Dispose(); }
public void LockFileIsDeletedOnDisposeOrStop () { FileSystemDeployLocation location = new FileSystemDeployLocation (dispatcher, deployPath); location.StartWatching (); location.Dispose(); Assert.IsFalse (File.Exists (location.LockFileName)); }
public void ListExistingDirectoriesAsApplications () { log.Debug ("start ListExistingDirectoriesAsApplications"); AddApplication (); location = new FileSystemDeployLocation (deployPath); Assert.AreEqual (1, location.Applications.Count); log.Debug ("end ListExistingDirectoriesAsApplications"); }
public void TheAssociatedWatcherIsStoppedAndDisposedOnDispose () { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); AddApplication(); location = new FileSystemDeployLocation (new ForwardingDeployEventDispatcher(), factory, deployPath, true); triggeredLatch.Acquire(); location.Dispose(); }
public void ANewWatcherGetsCreatedAndAssociatedToAnyExistingApplication () { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); AddApplication (); location = new FileSystemDeployLocation (new ForwardingDeployEventDispatcher(), factory, deployPath, true); }
[Test] // Bug fix public void NotInfiniteLoopRemovingAnApplicationWithAManagerThatThrowsExceptionWhenDisposed () { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.ExpectAndThrow("Dispose", new Exception()); AddApplication(); ForwardingDeployEventDispatcher dispatcher = new ForwardingDeployEventDispatcher(); dispatcher.DeployEvent += new DeployEventHandler(dispatcher_DeployEvent); location = new FileSystemDeployLocation (dispatcher, factory, deployPath, true); Directory.Delete(sampleDir, true); forwardDispatcherSync.Acquire(); Assert.IsTrue(deployEventDispatched, "removal not dispatched in case of error on application watcher"); }
public void AnInvalidApplicationIsNotUpdatedNorRemovedButItWillNotBeListed () { Semaphore sync = new Semaphore (0); AddApplication(); InitHandlerAndStartLocation (sync); File.Delete(serviceXml); Assert.IsFalse(sync.Attempt(1000), "some events propagated, expecting no one"); Assert.IsFalse (handler.applicationUpdated, "application wrongly updated"); Assert.IsFalse(handler.applicationRemoved, "application wrongly removed"); Assert.AreEqual (0, location.Applications.Count, "application listed"); location.Dispose(); location = new FileSystemDeployLocation (deployPath); Assert.AreEqual (0, location.Applications.Count, "invalid application listed"); }
public void IgnoreExceptionOnDispatcherWhenRemoving () { factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); factoryMock.ExpectAndReturn("CreateApplicationWatcherMonitor", watcher); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); watcherMock.Expect("StartWatching"); watcherMock.Expect("StopWatching"); watcherMock.Expect("Dispose"); ISync canContinue = new Semaphore(0); ISync started = new Semaphore(0); AddApplication(); AddApplication(sampleDir2); IDeployEventDispatcher dispatcher = new ExceptionDispatcher(started, canContinue); location = new FileSystemDeployLocation (dispatcher, factory, deployPath, true); Assert.AreEqual(2, location.Applications.Count); Directory.Delete(sampleDir, true); started.Acquire(); canContinue.Release(); Assert.AreEqual(1, location.Applications.Count); Directory.Delete(sampleDir2, true); started.Acquire(); canContinue.Release(); Assert.AreEqual(0, location.Applications.Count); }
protected void InitHandler(ISync sync) { location = new FileSystemDeployLocation(dispatcher, deployPath); handler = NewHandler(sync); }
protected void InitHandler (ISync sync) { location = new FileSystemDeployLocation (dispatcher, deployPath); handler = NewHandler (sync); }