public void Run(Configuration config) { var uriOne = GetType().Name + "_1"; var runtimeOne = EPRuntimeProvider.GetRuntime(uriOne, config); var uriTwo = GetType().Name + "_2"; var runtimeTwo = EPRuntimeProvider.GetRuntime(uriTwo, config); EPAssertionUtil.AssertContains(EPRuntimeProvider.RuntimeURIs, uriOne, uriTwo); Assert.IsNotNull(EPRuntimeProvider.GetExistingRuntime(uriOne)); Assert.IsNotNull(EPRuntimeProvider.GetExistingRuntime(uriTwo)); config.Common.AddEventType(typeof(SupportBean)); EPCompiled compiled; try { compiled = EPCompilerProvider.Compiler.Compile( "select * from SupportBean", new CompilerArguments(config)); } catch (EPCompileException e) { throw new EPException(e); } var adminOne = runtimeOne.DeploymentService; runtimeOne.Destroy(); EPAssertionUtil.AssertNotContains(EPRuntimeProvider.RuntimeURIs, uriOne); EPAssertionUtil.AssertContains(EPRuntimeProvider.RuntimeURIs, uriTwo); Assert.IsNull(EPRuntimeProvider.GetExistingRuntime(uriOne)); Assert.IsTrue(runtimeOne.IsDestroyed); Assert.IsFalse(runtimeTwo.IsDestroyed); var stageTwo = runtimeTwo.StageService; runtimeTwo.Destroy(); EPAssertionUtil.AssertNotContains(EPRuntimeProvider.RuntimeURIs, uriOne, uriTwo); Assert.IsNull(EPRuntimeProvider.GetExistingRuntime(uriTwo)); Assert.IsTrue(runtimeOne.IsDestroyed); Assert.IsTrue(runtimeTwo.IsDestroyed); Assert.That( () => adminOne.Rollout(Collections.SingletonList(new EPDeploymentRolloutCompiled(compiled))), Throws.InstanceOf<EPRuntimeDestroyedException>()); Assert.That( () => adminOne.Deploy(compiled), Throws.InstanceOf<EPRuntimeDestroyedException>()); EPAssertionUtil.AssertNotContains(EPRuntimeProvider.RuntimeURIs, uriTwo); TryAssertDestroyed(() => DoNothing(runtimeTwo.EventService)); TryAssertDestroyed(() => DoNothing(runtimeTwo.DeploymentService)); TryAssertDestroyed(() => DoNothing(runtimeTwo.StageService)); TryAssertDestroyed(() => stageTwo.GetStage("x")); TryAssertDestroyed(() => stageTwo.GetExistingStage("x")); TryAssertDestroyed(() => DoNothing(stageTwo.StageURIs)); }