Ejemplo n.º 1
0
        public async Task TestPlugins()
        {
            StringBuilder result = new StringBuilder();

            IDictionary <string, ISchedulerPlugin> data = new Dictionary <string, ISchedulerPlugin>();

            data["TestPlugin"] = new TestPlugin(result);

            IThreadPool threadPool = new DedicatedThreadPool
            {
                ThreadCount = 1
            };

            threadPool.Initialize();
            DirectSchedulerFactory.Instance.CreateScheduler(
                "MyScheduler", "Instance1", threadPool,
                new RAMJobStore(), data,
                TimeSpan.Zero);


            IScheduler scheduler = await DirectSchedulerFactory.Instance.GetScheduler("MyScheduler");

            await scheduler.Start();

            await scheduler.Shutdown();

            Assert.AreEqual("TestPlugin|MyScheduler|Start|Shutdown", result.ToString());
        }
Ejemplo n.º 2
0
    void Awake()                       //стартовый метод, запускается самым первым при старте сцены
    {
        m = new byte[4];               //инициализируем массив байтов
        TestPlugin.Init();             //инициализируем джава класс
        sMenu    = menuPanel;          //инициализируем панель меню
        log.text = "0";                //лог инициализируем
        if (PlayerPrefs.HasKey("Mac")) //если есть сохранённое устройство, приделываем его
        {
            if (!string.IsNullOrWhiteSpace(PlayerPrefs.GetString("Mac")))
            {
                recconect.text          = "Переподключение";
                buttonrecconect.enabled = true;
            }
            else
            {
                recconect.text          = "Нет сохранённых устройств";
                buttonrecconect.enabled = false;
            }
        }
        else
        {
            recconect.text          = "Нет сохранённых устройств";
            buttonrecconect.enabled = false;
        }

        TestPlugin.GetStatus(image);//получаем статус подключения устройства
    }
Ejemplo n.º 3
0
        public static void OrthancPluginSetDescription(ref OrthancPluginContext context, string description)
        {
            _OrthancPluginSetPluginProperty pr = new _OrthancPluginSetPluginProperty();

            pr.plugin   = TestPlugin.OrthancPluginGetName();
            pr.property = _OrthancPluginProperty._OrthancPluginProperty_Description;
            pr.value    = description;

            int    size = Marshal.SizeOf(typeof(_OrthancPluginSetPluginProperty));
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.StructureToPtr(pr, ptr, true);

            try
            {
                context.InvokeService(ref context, _OrthancPluginService._OrthancPluginService_SetPluginProperty, ptr);
            }
            catch (Exception ex)
            {
                OrthancPluginLogError(ref context, ex.ToString());
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }
            protected override void Test(IOrganizationService service)
            {
                service = new OrganizationServiceBuilder(service)
                          .Build();

                var plugin = new TestPlugin(null, null);


                var serviceProvider = new ServiceProviderBuilder(
                    service,
                    new PluginExecutionContextBuilder()
                    .WithRegisteredEvent(40, "Create", "new_testentity")
                    .WithPrimaryEntityId(Guid.NewGuid())
                    .Build(),
                    new DebugLogger()).Build();

                for (int i = 0; i < 20; i++)
                {
                    try
                    {
                        plugin.Execute(serviceProvider);
                    }
                    catch (Exception ex)
                    {
                        // Process if it is not the expected exception we are throwing to test telemetry.
                        if (ex.Message != "Unhandled Plugin Exception Throw Unhandled Exception")
                        {
                            throw;
                        }
                    }
                }
            }
            protected override void Test(IOrganizationService service)
            {
                var plugin = new TestPlugin(null, null);

                var serviceProvider = new ServiceProviderBuilder(
                    service,
                    new PluginExecutionContextBuilder()
                    .WithRegisteredEvent(20, "Delete", "account")
                    .WithPrimaryEntityId(Ids.Account)
                    .WithTarget(Ids.Account)
                    .Build(),
                    new DebugLogger()).Build();


                var executionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
                var target           = executionContext.InputParameters["Target"] as EntityReference;


                plugin.Execute(serviceProvider);


                serviceProvider = new ServiceProviderBuilder(
                    service,
                    new PluginExecutionContextBuilder()
                    .WithRegisteredEvent(40, "Delete", "account")
                    .WithPrimaryEntityId(Ids.Account)
                    .WithTarget(Ids.Account)
                    .Build(),
                    new DebugLogger()).Build();

                executionContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

                plugin.Execute(serviceProvider);
            }
Ejemplo n.º 6
0
        public void InstallPlugin_ThenUninstallByType_LeavesNoPlugins([Frozen] TestPlugin plugin)
        {
            _napSetup.InstallPlugin(plugin);
            _napSetup.UninstallPlugin <TestPlugin>();

            Assert.DoesNotContain(plugin, _napSetup.Plugins);
        }
Ejemplo n.º 7
0
        public void CanResolveEntryPoints(Type entryPointType)
        {
            Action action = () => DependencyConfiguration.Resolve(entryPointType, new TestApplicationHost());

            TestPlugin.EnsurePluginStaticSingletonAvailable();

            action.Should().NotThrow();
        }
Ejemplo n.º 8
0
 public void GetFirstInstance()
 {
     TestPlugin plugin1 = new TestPlugin();
     TestPlugin plugin2 = new TestPlugin();
     Assert.AreSame(Plugin.Instances.First(), plugin1);
     plugin1.Dispose();
     plugin2.Dispose();
 }
        public MenuPanelDesignViewModel()
        {
            var test = new TestPlugin(null);

            test.Initialize();

            MenuItems = BuildTreeView(test.NavigationMenuItems);
        }
 public void Should_encrypt_string()
 {
     var secret = "abc123";
     string secretValue = "Myu0uW3E+PbIbaFkSIrLwA==";
     var testPlugin = new TestPlugin { Secret = secret };
     Assert.That(testPlugin.Secret, Is.EqualTo(secret));
     Assert.That(testPlugin.SecretValue, Is.EqualTo(secretValue));
 }
 public void Create_encrypted_string_for_testing()
 {
     var secret = "SomeCs";
     var testPlugin = new TestPlugin { Secret = secret };
     //Console.WriteLine(testPlugin.SecretValue);
     //Assert.That(testPlugin.Secret, Is.EqualTo(secret));
     //Assert.That(testPlugin.SecretValue, Is.EqualTo(secretValue));
 }
Ejemplo n.º 12
0
        public void ConfigurationIsValid()
        {
            DependencyConfiguration.Resolve <IRateLimiters>(new TestApplicationHost());

            TestPlugin.EnsurePluginStaticSingletonAvailable();

            DependencyConfiguration.Container.Verify(VerificationOption.VerifyAndDiagnose);
        }
Ejemplo n.º 13
0
    void Awake()                                 //стартовый метод, запускается самым первым при старте сцены
    {
        m = new byte[2];                         //инициализируем массив байтов
        TestPlugin.Init();                       //инициализируем джава класс
        sMenu = menuPanel;                       //инициализируем панель меню

        TestPlugin.GetStatus(image, red, green); //получаем статус подключения устройства
    }
Ejemplo n.º 14
0
        public void AddPlugin_ShouldAdd()
        {
            var plugin = new TestPlugin <object>();

            ((IFluentEventsPluginOptions)_eventsContextOptions).AddPlugin(plugin);

            Assert.That(((IFluentEventsPluginOptions)_eventsContextOptions).Plugins, Has.One.Items.EqualTo(plugin));
        }
Ejemplo n.º 15
0
 public void UnJump()//соленоид выкл
 {
     //убираем биты с 7 позиции
     m[1] = TestPlugin.unsetbit(m[1], 7);
     m[0] = TestPlugin.unsetbit(m[0], 7);
     TestPlugin.SetMessage(m);
     Debug.Log("Произошла отправка");
 }
Ejemplo n.º 16
0
        public void DoesContain()
        {
            var tp      = new TestPlugin();
            var ap      = new AvailablePlugin(tp, this.AssemblyPath);
            var plugins = new AvailablePluginCollection();

            plugins.Add(ap);
            Assert.True(plugins.Contains(ap));
        }
Ejemplo n.º 17
0
        private static void OnP2Created(object sender, FileSystemEventArgs e)
        {
            var p = new TestPlugin();

            p.ConfigurePlugin("test", "p1Handler", "NotifyCaller", @"C:\Python\Plugin\p2Handler.py");
            string[] parameters = { e.FullPath };
            updateText += p.ExecutePlugin <string>(parameters);
            updateText += "\r\n";
        }
        public void When_the_bus_is_injected_publishes_happen_after_subscribes()
        {
            var plugin = new TestPlugin();
            var bus    = new LoggingBus(new MappingBus());

            plugin.SetupBus(bus);

            plugin.Received.ShouldBe(1);
        }
        public void When_the_bus_is_injected_subscribers_are_registered()
        {
            var plugin = new TestPlugin();
            var bus    = new LoggingBus(new MappingBus());

            plugin.SetupBus(bus);

            bus.Subscribers.ShouldContainKey(typeof(TestMessage));
        }
Ejemplo n.º 20
0
        public void PluginImplementation()
        {
            IPluginLoader pluginLoader = Runtime.Container.Resolve <IPluginLoader>();
            TestPlugin    plugin       = (TestPlugin)(pluginLoader).GetPlugin("TestPlugin");

            Assert.IsTrue(plugin.IsAlive);

            Assert.IsNull(plugin.Configuration); //No config for test plugin
            Assert.IsNull(plugin.Translations);  //No translations for test plugin
        }
Ejemplo n.º 21
0
        public void CanGetFromIndexer()
        {
            var tp      = new TestPlugin();
            var ap      = new AvailablePlugin(tp, this.AssemblyPath);
            var plugins = new AvailablePluginCollection();

            plugins.Add(ap);

            Assert.True(plugins[0].Equals(ap));
        }
Ejemplo n.º 22
0
        public void CanGetIndex()
        {
            var tp      = new TestPlugin();
            var ap      = new AvailablePlugin(tp, this.AssemblyPath);
            var plugins = new AvailablePluginCollection();

            plugins.Add(ap);

            Assert.True(plugins.IndexOf(ap) == 0);
        }
Ejemplo n.º 23
0
        public void CanAdd()
        {
            var tp      = new TestPlugin();
            var ap      = new AvailablePlugin(tp, this.AssemblyPath);
            var plugins = new AvailablePluginCollection();

            Assert.True(plugins.Add(ap) == 0);
            Assert.True(plugins.Count > 0);
            Assert.True(plugins.Add(ap) == -1);
        }
Ejemplo n.º 24
0
 public void Jump()//соленоид вкл
 {
     //задаём на 7 позиции биты
     m[1] = TestPlugin.unsetbit(m[1], 7);
     m[0] = TestPlugin.unsetbit(m[0], 7);
     m[1] = TestPlugin.setbit(m[1], 7);
     m[0] = TestPlugin.setbit(m[0], 7);
     TestPlugin.SetMessage(m);
     Debug.Log("Произошла отправка");
 }
Ejemplo n.º 25
0
        public void A_plugin_with_a_dependency_loads_in_order()
        {
            var plugin     = new TestPlugin("Main", "Dep1");
            var dependency = new TestPlugin("Dep1");

            var graph = new PluginGraph(Substitute.For <IBus>());
            var order = graph.Build(new[] { plugin, dependency });

            order.ShouldBe(new[] { dependency, plugin });
        }
Ejemplo n.º 26
0
 public void Create_encrypted_string_for_testing()
 {
     var secret     = "SomeCs";
     var testPlugin = new TestPlugin {
         Secret = secret
     };
     //Console.WriteLine(testPlugin.SecretValue);
     //Assert.That(testPlugin.Secret, Is.EqualTo(secret));
     //Assert.That(testPlugin.SecretValue, Is.EqualTo(secretValue));
 }
Ejemplo n.º 27
0
        private void Init()
        {
            root                = new Root(this);
            outputBuilder       = new StringBuilder();
            autoCompleteManager = new AutoCompleteManager(this);
            recentCmdManager    = new RecentCmdManager();
            soundPlayer         = new SoundPlayer(Properties.Resources.Keyboard_EnterClick);
            CmdProc             = new CMDProcess();

            FindHandle();
            ClearInput();
            LoadPlugin();
            UpdateResolution();
            RegisterEvent();

            CmdProc.ExecuteUpdateWorkingDirectory();

            void FindHandle()
            {
                Window window = Window.GetWindow(this);
                var    wih    = new WindowInteropHelper(window);

                Handle = wih.Handle;
            }

            void ClearInput()
            {
                InputEditText.Text = "";
                InputEditText.Focus();
            }

            void LoadPlugin()
            {
                //Left = 0d;
                //Top = 0d;
                //Width = 1920d;

                //OutputTextView.Text = "결과 출력 디스플레이\nExecute...\n존-새 밥오.";

                TestPlugin testPlugin = new TestPlugin();

                root.pluginManager.registerPlugin(testPlugin);
            }

            void RegisterEvent()
            {
                InputEditText.KeyDown        += OnKeyDown_InputEditText;
                InputEditText.PreviewKeyDown += OnPreviewKeyDown_InputEditText;
                CmdProc.OnOutputReceived     += OnOutputReceived_CMDProc;
                InputContext.MouseDown       += OnMouseDown_InputContext;
                Closing += OnClosing;

                root.loopEngine.AddLoopAction(OnTick);
            }
        }
Ejemplo n.º 28
0
        public void A_plugin_with_a_missing_dependency_reports_to_bus_and_doesnt_load()
        {
            var plugin = new TestPlugin("Main", "Dep1");
            var bus    = new LoggingBus();

            var graph = new PluginGraph(bus);
            var order = graph.Build(new[] { plugin });

            bus.MessagesPublished.First().ShouldBeOfType <PluginErrorMessage>();
            order.ShouldBeEmpty();
        }
Ejemplo n.º 29
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            this.RootVisual = new SampleTestControl();

            TestPlugin.TestPluginReady += delegate(object dummy, EventArgs args)
            {
                TestLogger.LogDebug("Hello!");
                TestPlugin.CaptureSingleImage("SampleTest.png", 100, 100, 0);
                TestPlugin.SignalShutdown();
            };
        }
Ejemplo n.º 30
0
        public void ConfigurationPageExists()
        {
            var embeddedResourcePath =
                new TestPlugin().GetPages()
                .Single()
                .EmbeddedResourcePath;

            var assembly = typeof(Plugin).Assembly;

            assembly.GetManifestResourceNames().Should().Contain(embeddedResourcePath);
        }
Ejemplo n.º 31
0
        public override void Setup()
        {
            WFAppHost.ConfigureBootstrap(false);
            fBase = new BaseWindowStub(false);

            fLangMan = new FITestLangMan();
            var plugin = new TestPlugin(fLangMan);

            fDialog = new FlowInputDlg(plugin, fBase);
            fDialog.Show();
        }
        public void ShouldNotGiveEventsInstantly()
        {
            using var plugin = new TestPlugin(Mock.Of <ISettingsProvider>());
            TestEventSource.TypedLogEvents
            .Where(e => e.GetType() != typeof(Commander))
            .Take(1000)
            .RandomSubset(50)
            .ForEach(e => plugin.OnNext(e));

            CollectionAssert.IsEmpty(plugin.Flushed);
        }
 public void ShouldFlushEventsAfterTimeout()
 {
     using var plugin = new TestPlugin(Mock.Of <ISettingsProvider>());
     foreach (var @event in TestEventSource.TypedLogEvents.Skip(10).Take(10))
     {
         plugin.OnNext(@event);
     }
     plugin.FlushQueue();
     CollectionAssert.IsNotEmpty(plugin.Flushed);
     Assert.AreEqual(10, plugin.Flushed.Count);
 }
Ejemplo n.º 34
0
    // need an object in the scene to target UnitySendMessage from native code
    public static void Initialize()
    {
        if (_instance != null) {
            Debug.Log("TestPlugin instance was found. Already initialized");
            return;
        }
        Debug.Log("TestPlugin instance not found. Initializing...");

        GameObject owner = new GameObject("TestPlugin_instance");
        _instance = owner.AddComponent<TestPlugin>();
        DontDestroyOnLoad(_instance);
    }
        public void TestPlugins()
        {
            StringBuilder result = new StringBuilder();

            IDictionary<string, ISchedulerPlugin> data = new Dictionary<string, ISchedulerPlugin>();
            data["TestPlugin"] = new TestPlugin(result);

            IThreadPool threadPool = new SimpleThreadPool(1, ThreadPriority.Normal);
            threadPool.Initialize();
            DirectSchedulerFactory.Instance.CreateScheduler(
                "MyScheduler", "Instance1", threadPool,
                new RAMJobStore(), data,
                TimeSpan.Zero);

            IScheduler scheduler = DirectSchedulerFactory.Instance.GetScheduler("MyScheduler");
            scheduler.Start();
            scheduler.Shutdown();

            Assert.AreEqual("TestPlugin|MyScheduler|Start|Shutdown", result.ToString());
        }
Ejemplo n.º 36
0
        public void TestMethodTemplate()
        {
            _env.DataManager.LoadProject(TestConstant.Project_Drosophila);

            TestPlugin plugin = new TestPlugin();
            plugin.DataAdd(new List<EcellObject>());
            EcellObject obj = null;
            plugin.DataAdd(obj);
            plugin.DataChanged(null, null, null, null);
            plugin.DataDelete(null, null, null);
            //
            plugin.AddSelect(null, null, null);
            plugin.RemoveSelect(null, null, null);
            plugin.SelectChanged(null, null, null);
            plugin.ResetSelect();

            plugin.AdvancedTime(0);
            plugin.Initialize();
            plugin.ChangeStatus(ProjectStatus.Loaded);
            plugin.Clear();

            plugin.LoggerAdd(null);
            plugin.ParameterAdd(null, null);
            plugin.ParameterDelete(null, null);
            plugin.ParameterSet(null, null);
            plugin.ParameterUpdate(null, null);
            plugin.RemoveMessage(null);

            plugin.SaveModel(null, null);
            plugin.SetPluginStatus(null);
            plugin.SetProgressBarValue(0);
            plugin.SetStatusBarMessage(StatusBarMessageKind.Generic, "");
        }
Ejemplo n.º 37
0
        public void TestNotifier()
        {
            _env.DataManager.LoadProject(TestConstant.Project_Drosophila);
            TestPlugin plugin = new TestPlugin();
            plugin.Environment = _env;

            EcellObject obj1 = _env.DataManager.CreateDefaultObject("Drosophila", "/", "System");
            plugin.NotifyDataAdd(obj1, true);

            EcellObject obj2 = _env.DataManager.CreateDefaultObject("Drosophila", "/", "System");
            List<EcellObject> list = new List<EcellObject>();
            list.Add(obj2);
            plugin.NotifyDataAdd(list, true);
            plugin.NotifyDataChanged(obj1.Key, obj1, true, true);
            plugin.NotifySetPosition(obj1);
            plugin.NotifyLoggerAdd(obj1.ModelID, obj1.Key, obj1.Type, obj1.FullID + ":Size");

            plugin.NotifyAddSelect(obj1.ModelID, obj1.Key, obj1.Type);
            plugin.NotifySelectChanged(obj1.ModelID, obj1.Key, obj1.Type);
            plugin.NotifyRemoveSelect(obj1.ModelID, obj1.Key, obj1.Type);
            plugin.NotifyResetSelect();
            plugin.NotifyDataMerge(obj1.ModelID, obj1.Key);
            plugin.NotifyDataMerge(obj1.ModelID, obj1.Key);

            plugin.NotifyDataDelete(obj2.ModelID, obj2.Key, obj2.Type, true);
        }
Ejemplo n.º 38
0
 static void Main(string[] args)
 {
     File.Delete("TestPlugin.ini");
       var t = new TestPlugin();
       t.Awake();
 }
Ejemplo n.º 39
0
 public void GetInstance()
 {
     TestPlugin plugin = new TestPlugin();
     Assert.AreSame(Plugin.Instances[0], plugin);
     plugin.Dispose();
 }
Ejemplo n.º 40
0
 public void RemoveAfterDispose()
 {
     TestPlugin plugin = new TestPlugin();
     plugin.Dispose();
     Assert.Throws<InvalidOperationException>(() => Plugin.Instances.First());
 }
Ejemplo n.º 41
0
        public void TestConstructor()
        {
            _env.DataManager.LoadProject(TestConstant.Project_Drosophila);

            TestPlugin plugin = new TestPlugin();
            Assert.IsNotNull(plugin, "Constructor of type, object failed to create instance.");
            // env
            plugin.Environment = _env;
            Assert.AreEqual(_env, plugin.Environment, "Environment is unexpected value.");
            Assert.AreEqual(_env.DataManager, plugin.DataManager, "DataManager is unexpected value.");
            Assert.AreEqual(_env.PluginManager, plugin.PluginManager, "PluginManager is unexpected value.");
            Assert.AreEqual(_env.LogManager, plugin.MessageManager, "MessageManager is unexpected value.");
            // Getter
            Assert.AreEqual("TestPlugin", plugin.GetPluginName(), "GetPluginName method returned unexpected value.");
            Assert.IsNotNull(plugin.GetVersionString(), "GetVersionString method returned unexpected value.");

            Assert.IsNotNull(plugin.GetData(null), "GetData method returned unexpected value.");
            Assert.IsNotNull(plugin.GetEcellObject("Drosophila", "/", "System"), "GetEcellObject method returned unexpected value.");
            Assert.IsNotNull(plugin.GetEcellObject(plugin.GetEcellObject("Drosophila", "/", "System")), "GetEcellObject method returned unexpected value.");
            Assert.IsNotNull(plugin.GetTemporaryID("Drosophila", "System", "/"), "GetEcellObject method returned unexpected value.");
            Assert.IsNull(plugin.GetPluginStatus(), "GetPluginStatus method returned unexpected value.");
            Assert.IsNull(plugin.GetPropertySettings(), "GetPropertySettings method returned unexpected value.");
            Assert.IsNull(plugin.GetMenuStripItems(), "GetMenuStripItems method returned unexpected value.");
            Assert.IsNull(plugin.GetToolBarMenuStrip(), "GetToolBarMenuStrip method returned unexpected value.");
            Assert.IsNull(plugin.GetWindowsForms(), "GetWindowsForms method returned unexpected value.");
            Assert.IsNull(plugin.GetPublicDelegate(), "GetPublicDelegate method returned unexpected value.");
        }