Ejemplo n.º 1
0
        public void Run(RegressionEnvironment env)
        {
            // Assure destroy order ESPER-489
            Assert.AreEqual(2, SupportPluginLoader.Names.Count);
            Assert.AreEqual(2, SupportPluginLoader.PostInitializes.Count);
            Assert.AreEqual("MyLoader", SupportPluginLoader.Names[0]);
            Assert.AreEqual("MyLoader2", SupportPluginLoader.Names[1]);
            Assert.AreEqual("val", SupportPluginLoader.Props[0].Get("name"));
            Assert.AreEqual("val2", SupportPluginLoader.Props[1].Get("name2"));

            var loader = GetFromEnv(env, "plugin-loader/MyLoader");
            Assert.IsTrue(loader is SupportPluginLoader);
            loader = GetFromEnv(env, "plugin-loader/MyLoader2");
            Assert.IsTrue(loader is SupportPluginLoader);

            SupportPluginLoader.PostInitializes.Clear();
            SupportPluginLoader.Names.Clear();
            env.Runtime.Initialize();
            Assert.AreEqual(2, SupportPluginLoader.PostInitializes.Count);
            Assert.AreEqual(2, SupportPluginLoader.Names.Count);

            env.Runtime.Destroy();
            Assert.AreEqual(2, SupportPluginLoader.Destroys.Count);
            Assert.AreEqual("val2", SupportPluginLoader.Destroys[0].Get("name2"));
            Assert.AreEqual("val", SupportPluginLoader.Destroys[1].Get("name"));

            SupportPluginLoader.Reset();
        }
Ejemplo n.º 2
0
        private void RunAssertionDestroyObtainTwice()
        {
            SupportPluginLoader.Reset();

            Configuration cf = SupportConfigFactory.GetConfiguration();

            cf.AddPluginLoader("AP", typeof(SupportPluginLoader).FullName, null);
            EPServiceProviderManager.GetProvider(SupportContainer.Instance, "ExecClientAdapterLoader", cf);
            EPServiceProvider ep = EPServiceProviderManager.GetProvider("ExecClientAdapterLoader");

            ep.Dispose();
            Assert.AreEqual(1, SupportPluginLoader.Destroys.Count);
        }
Ejemplo n.º 3
0
        private void RunAssertionAdapterLoader()
        {
            SupportPluginLoader.Reset();
            // Assure destroy order ESPER-489

            var props = new Properties();

            props.Put("name", "val");
            Configuration config = SupportConfigFactory.GetConfiguration();

            config.AddPluginLoader("MyLoader", typeof(SupportPluginLoader).FullName, props);

            props = new Properties();
            props.Put("name2", "val2");
            config.AddPluginLoader("MyLoader2", typeof(SupportPluginLoader).FullName, props);

            EPServiceProvider service = EPServiceProviderManager.GetProvider(
                SupportContainer.Instance, "ExecClientAdapterLoader", config);

            Assert.AreEqual(2, SupportPluginLoader.Names.Count);
            Assert.AreEqual(2, SupportPluginLoader.PostInitializes.Count);
            Assert.AreEqual("MyLoader", SupportPluginLoader.Names[0]);
            Assert.AreEqual("MyLoader2", SupportPluginLoader.Names[1]);
            Assert.AreEqual("val", SupportPluginLoader.Props[0].Get("name"));
            Assert.AreEqual("val2", SupportPluginLoader.Props[1].Get("name2"));

            Object loader = service.Directory.Lookup("plugin-loader/MyLoader");

            Assert.IsTrue(loader is SupportPluginLoader);
            loader = service.Directory.Lookup("plugin-loader/MyLoader2");
            Assert.IsTrue(loader is SupportPluginLoader);

            SupportPluginLoader.PostInitializes.Clear();
            SupportPluginLoader.Names.Clear();
            service.Initialize();
            Assert.AreEqual(2, SupportPluginLoader.PostInitializes.Count);
            Assert.AreEqual(2, SupportPluginLoader.Names.Count);

            service.Dispose();
            Assert.AreEqual(2, SupportPluginLoader.Destroys.Count);
            Assert.AreEqual("val2", SupportPluginLoader.Destroys[0].Get("name2"));
            Assert.AreEqual("val", SupportPluginLoader.Destroys[1].Get("name"));
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     SupportPluginLoader.Reset();
 }