Пример #1
0
 public Plugin(PluginManager manager, Assembly assembly, Type type)
 {
     _manager = manager;
     _assembly = assembly;
     _pluginType = type;
     _status = PluginStatus.Declared;
 }
Пример #2
0
 private void CheckOneErrorMessage(PluginManager pm, string msg) {
     string actual = pm.Tracer.Document.GetDataAt(0);
     if (actual != msg) {
         //しばしば長くなる。Debugに出さないとわかりづらい
         Debug.WriteLine("actual=" + actual);
     }
     Assert.AreEqual(msg, actual);
 }
Пример #3
0
 public InternalPoderosaWorld(PoderosaStartupContext context) {
     _instance = this;
     _startupContext = context;
     _poderosaCulture = new PoderosaCulture();
     _poderosaLog = new PoderosaLog(this);
     _adapterManager = new AdapterManager();
     _stringResource = new StringResource("Poderosa.Plugin.strings", typeof(InternalPoderosaWorld).Assembly);
     _poderosaCulture.AddChangeListener(_stringResource);
     _pluginManager = new PluginManager(this);
     //ルート
     _rootExtension = _pluginManager.CreateExtensionPoint(ExtensionPoint.ROOT, typeof(IRootExtension), null);
 }
Пример #4
0
        public void TestAssemblyNotFound()
        {
            PluginManager pm = Init(CreateManifest("MustNotExist", "TestPlugin"));

            CheckErrorMessage(pm, "PluginManager.Messages.AssemblyLoadError", "MustNotExist");
        }
Пример #5
0
        // Enumerate plugins according to the specified node.
        private IEnumerable<Plugin> EnumeratePlugins(PluginManager manager, Assembly assembly, PluginManifest.AssemblyEntry assemblyEntry, ITracer tracer)
        {
            foreach (string pluginTypeName in assemblyEntry.PluginTypes) {
                Type pluginType;
                try {
                    pluginType = assembly.GetType(pluginTypeName);
                }
                catch (Exception) {
                    tracer.Trace("PluginManager.Messages.TypeLoadError", assembly.CodeBase, pluginTypeName);
                    continue;
                }

                if (pluginType == null) {
                    tracer.Trace("PluginManager.Messages.TypeLoadError", assembly.CodeBase, pluginTypeName);
                    continue;
                }

                Plugin plugin = new Plugin(manager, assembly, pluginType);

                yield return plugin;
            }
        }
Пример #6
0
 // Enumerate plugins from the specified assembly.
 private IEnumerable<Plugin> EnumeratePlugins(PluginManager manager, Assembly assembly, ITracer tracer)
 {
     PluginDeclarationAttribute[] decls = (PluginDeclarationAttribute[])assembly.GetCustomAttributes(typeof(PluginDeclarationAttribute), false);
     foreach (PluginDeclarationAttribute decl in decls) {
         Plugin plugin = new Plugin(manager, assembly, decl.Target);
         yield return plugin;
     }
 }
Пример #7
0
 private void CheckOneErrorMessage(PluginManager pm, string msg)
 {
     string actual = pm.Tracer.Document.GetDataAt(0);
     if (actual != msg) {
         //���΂��Β����Ȃ�BDebug�ɏo���Ȃ��Ƃ킩��Â炢
         Debug.WriteLine("actual=" + actual);
     }
     Assert.AreEqual(msg, actual);
 }
Пример #8
0
 private void CheckErrorMessage(PluginManager pm, string string_id, string param1, string param2)
 {
     CheckOneErrorMessage(pm, String.Format(GetStringResource().GetString(string_id), param1, param2));
 }
Пример #9
0
 //���Ғʂ�̃G���[���b�Z�[�W���o�Ă��邱�Ƃ�m�F
 private void CheckErrorMessage(PluginManager pm, string string_id)
 {
     CheckOneErrorMessage(pm, GetStringResource().GetString(string_id));
 }
Пример #10
0
        public void TestMissingIPlugin()
        {
            PluginManager pm = Init(CreateManifest("MissingIPlugin"));

            CheckErrorMessage(pm, "PluginManager.Messages.IPluginIsNotImplemented", "Poderosa.Plugins.MissingIPlugin");
        }
Пример #11
0
        public void TestTypeNotFound()
        {
            PluginManager pm = Init(CreateManifest("MustNotExist"));

            CheckErrorMessage(pm, "PluginManager.Messages.TypeLoadError", this.GetType().Assembly.CodeBase, "Poderosa.Plugins.MustNotExist");
        }
Пример #12
0
 //期待通りのエラーメッセージが出ていることを確認
 private void CheckErrorMessage(PluginManager pm, string string_id)
 {
     CheckOneErrorMessage(pm, GetStringResource().GetString(string_id));
 }
Пример #13
0
 private void CheckErrorMessage(PluginManager pm, string string_id, string param1, string param2)
 {
     CheckOneErrorMessage(pm, String.Format(GetStringResource().GetString(string_id), param1, param2));
 }
Пример #14
0
        public void TestDependencyLoopError()
        {
            PluginManager pm = Init(CreateManifest2("DepLoop1", "DepLoop2"));

            CheckErrorMessage(pm, "PluginManager.Messages.DependencyLoopError", "org.poderosa.depLoop1;org.poderosa.depLoop2");
        }
Пример #15
0
        public void TestMissingDependency()
        {
            PluginManager pm = Init(CreateManifest("MissingDependency"));

            CheckErrorMessage(pm, "PluginManager.Messages.DependencyNotFound", "Poderosa.Plugins.MissingDependency", "MustNotExist");
        }
Пример #16
0
        public void TestDuplicatedID()
        {
            PluginManager pm = Init(CreateManifest2("TestPlugin1", "DuplicatedPlugin"));

            CheckErrorMessage(pm, "PluginManager.Messages.IDDuplication", "Poderosa.Plugins.DuplicatedPlugin", "org.poderosa.test1");
        }
Пример #17
0
        public void TestMissingPluginID()
        {
            PluginManager pm = Init(CreateManifest("MissingID"));

            CheckErrorMessage(pm, "PluginManager.Messages.IDNotFound", "Poderosa.Plugins.MissingID");
        }
Пример #18
0
        public void TestMissingPluginInfo()
        {
            PluginManager pm = Init(CreateManifest("MissingPluginInfo"));

            CheckErrorMessage(pm, "PluginManager.Messages.PluginInfoAttributeNotFound", "Poderosa.Plugins.MissingPluginInfo");
        }