コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindServerPoliciesPlugin() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindServerPoliciesPlugin()
        {
            // given
            Config config = Config.builder().withSetting(CausalClusteringSettings.load_balancing_plugin, ServerPoliciesPlugin.PLUGIN_NAME).withSetting(CausalClusteringSettings.load_balancing_shuffle, "false").build();

            // when
            LoadBalancingProcessor plugin = LoadBalancingPluginLoader.Load(mock(typeof(TopologyService)), mock(typeof(LeaderLocator)), NullLogProvider.Instance, config);

            // then
            assertTrue(plugin is ServerPoliciesPlugin);
            assertEquals(ServerPoliciesPlugin.PLUGIN_NAME, (( ServerPoliciesPlugin )plugin).pluginName());
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEnableShufflingOfDelegate() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldEnableShufflingOfDelegate()
        {
            // given
            Config config = Config.builder().withSetting(CausalClusteringSettings.load_balancing_plugin, DUMMY_PLUGIN_NAME).withSetting(CausalClusteringSettings.load_balancing_shuffle, "true").build();

            // when
            LoadBalancingProcessor plugin = LoadBalancingPluginLoader.Load(mock(typeof(TopologyService)), mock(typeof(LeaderLocator)), NullLogProvider.Instance, config);

            // then
            assertTrue(plugin is ServerShufflingProcessor);
            assertTrue((( ServerShufflingProcessor )plugin).@delegate() is DummyLoadBalancingPlugin);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnSelectedPlugin() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnSelectedPlugin()
        {
            // given
            Config config = Config.builder().withSetting(CausalClusteringSettings.load_balancing_plugin, DUMMY_PLUGIN_NAME).withSetting(CausalClusteringSettings.load_balancing_shuffle, "false").build();

            // when
            LoadBalancingProcessor plugin = LoadBalancingPluginLoader.Load(mock(typeof(TopologyService)), mock(typeof(LeaderLocator)), NullLogProvider.Instance, config);

            // then
            assertTrue(plugin is DummyLoadBalancingPlugin);
            assertEquals(DUMMY_PLUGIN_NAME, (( DummyLoadBalancingPlugin )plugin).PluginName());
            assertTrue((( DummyLoadBalancingPlugin )plugin).WasInitialized);
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAcceptInvalidSetting()
        public virtual void ShouldNotAcceptInvalidSetting()
        {
            // given
            Config config = Config.builder().withSetting(SettingFor(DUMMY_PLUGIN_NAME, DummyLoadBalancingPlugin.DO_NOT_USE_THIS_CONFIG), "true").withSetting(CausalClusteringSettings.load_balancing_plugin, DUMMY_PLUGIN_NAME).build();

            try
            {
                // when
                LoadBalancingPluginLoader.Validate(config, mock(typeof(Log)));
                fail();
            }
            catch (InvalidSettingException)
            {
                // then
            }
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowOnInvalidPlugin()
        public virtual void ShouldThrowOnInvalidPlugin()
        {
            // given
            Config config = Config.defaults(CausalClusteringSettings.load_balancing_plugin, DOES_NOT_EXIST);

            try
            {
                // when
                LoadBalancingPluginLoader.Validate(config, mock(typeof(Log)));
                fail();
            }
            catch (InvalidSettingException)
            {
                // then
            }
        }