예제 #1
0
        private IDictionary <string, object> ToMap(DiscoverableURIs uris)
        {
            IDictionary <string, object> @out = new Dictionary <string, object>();

            uris.ForEach((k, v) => @out.put(k, v.toASCIIString()));
            return(@out);
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConvertSchemeHostPortIntoURI() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldConvertSchemeHostPortIntoURI()
        {
            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).Add("a", "bolt", "www.example.com", 8888, NORMAL).build();

            empty.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("bolt://www.example.com:8888"));
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConvertStringIntoURI() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldConvertStringIntoURI()
        {
            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).add("a", "bolt://localhost:7687", NORMAL).Build();

            empty.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("bolt://localhost:7687"));
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotInvokeConsumerWhenEmpty()
        public virtual void ShouldNotInvokeConsumerWhenEmpty()
        {
            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).Build();

            empty.ForEach(_consumer);

            verify(_consumer, never()).accept(anyString(), any());
        }
예제 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeConsumerForEachKeyWithHighestPrecedenceOnce() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeConsumerForEachKeyWithHighestPrecedenceOnce()
        {
            DiscoverableURIs discoverables = (new DiscoverableURIs.Builder()).add("a", "/test1", LOWEST).add("a", "/test2", LOW).add("a", "/data3", NORMAL).add("a", "/test4", HIGH).add("a", "/test5", HIGHEST).Build();

            discoverables.ForEach(_consumer);

            verify(_consumer, only()).accept("a", new URI("/test5"));
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOverrideLowestForAbsolute() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOverrideLowestForAbsolute()
        {
            URI @override          = new URI("http://www.example.com:9999");
            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).add("a", "bolt://localhost:8989", LOWEST).OverrideAbsolutesFromRequest(@override).build();

            empty.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("bolt://www.example.com:8989"));
        }
예제 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeConsumerForEachKeyWithHighestPrecedence() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeConsumerForEachKeyWithHighestPrecedence()
        {
            DiscoverableURIs discoverables = (new DiscoverableURIs.Builder()).add("c", "bolt://localhost:7687", HIGHEST).add("a", "/test", NORMAL).add("b", "/data", NORMAL).add("b", "/data2", LOWEST).add("a", "/test2", HIGHEST).add("c", "bolt://localhost:7688", LOW).Build();

            discoverables.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("/test2"));
            verify(_consumer, times(1)).accept("b", new URI("/data"));
            verify(_consumer, times(1)).accept("c", new URI("bolt://localhost:7687"));
        }
예제 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInvokeConsumerForEachKey() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInvokeConsumerForEachKey()
        {
            DiscoverableURIs discoverables = (new DiscoverableURIs.Builder()).add("a", "/test", NORMAL).add("b", "/data", NORMAL).add("c", "http://www.example.com", LOW).Build();

            discoverables.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("/test"));
            verify(_consumer, times(1)).accept("b", new URI("/data"));
            verify(_consumer, times(1)).accept("c", new URI("http://www.example.com"));
        }
예제 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUsePassedURI() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUsePassedURI()
        {
            URI uri = new URI("bolt://www.example.com:9999");

            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).add("a", uri, NORMAL).Build();

            empty.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", uri);
        }
예제 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLookupBoltPortInRegisterIfConfiguredTo0() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLookupBoltPortInRegisterIfConfiguredTo0()
        {
            BoltConnector         bolt     = new BoltConnector("honestJakesBoltConnector");
            ConnectorPortRegister register = new ConnectorPortRegister();

            register.Register(bolt.Key(), new InetSocketAddress(1337));

            DiscoverableURIs uris = communityDiscoverableURIs(Config.builder().withSetting(bolt.AdvertisedAddress, "apple.com:0").withSetting(bolt.Enabled, "true").withSetting(bolt.Type, BoltConnector.ConnectorType.BOLT.name()).build(), register);

            assertEquals("bolt://apple.com:1337", ToMap(uris)["bolt"]);
        }
예제 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotOverrideOtherThanLowestForAbsolute() throws java.net.URISyntaxException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotOverrideOtherThanLowestForAbsolute()
        {
            URI @override          = new URI("http://www.example.com:9999");
            DiscoverableURIs empty = (new DiscoverableURIs.Builder()).add("a", "bolt://localhost:8989", LOW).add("b", "bolt://localhost:8990", NORMAL).add("c", "bolt://localhost:8991", HIGH).add("d", "bolt://localhost:8992", HIGHEST).OverrideAbsolutesFromRequest(@override).build();

            empty.ForEach(_consumer);

            verify(_consumer, times(1)).accept("a", new URI("bolt://localhost:8989"));
            verify(_consumer, times(1)).accept("b", new URI("bolt://localhost:8990"));
            verify(_consumer, times(1)).accept("c", new URI("bolt://localhost:8991"));
            verify(_consumer, times(1)).accept("d", new URI("bolt://localhost:8992"));
        }
예제 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowWhenAddingTwoEntriesWithSamePrecedence()
        public virtual void ShouldThrowWhenAddingTwoEntriesWithSamePrecedence()
        {
            try
            {
                DiscoverableURIs discoverables = (new DiscoverableURIs.Builder()).add("a", "/test", NORMAL).add("a", "/data", NORMAL).Build();

                fail("exception expected");
            }
            catch (Exception t)
            {
                assertThat(t, @is(instanceOf(typeof(InvalidSettingException))));
                assertThat(t.Message, startsWith("Unable to add two entries with the same precedence using key "));
            }
        }
예제 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAdvertiseDataAndManagementURIs() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAdvertiseDataAndManagementURIs()
        {
            DiscoverableURIs uris = communityDiscoverableURIs(Config.defaults(), null);

            assertEquals(map("data", "/db/data/", "management", "/db/manage/"), ToMap(uris));
        }
예제 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOmitBoltIfNoConnectorConfigured() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOmitBoltIfNoConnectorConfigured()
        {
            DiscoverableURIs uris = communityDiscoverableURIs(Config.builder().build(), null);

            assertFalse(ToMap(uris).ContainsKey("bolt"));
        }
예제 #15
0
 public Builder(DiscoverableURIs copy)
 {
     Entries = new List <URIEntry>(copy.entries);
 }
예제 #16
0
        // Your IDE might tell you to make this less visible than public. Don't. JAX-RS demands is to be public.
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public DiscoveryService(@Context Config config, @Context OutputFormat outputFormat, @Context DiscoverableURIs uris)
        public DiscoveryService(Config config, OutputFormat outputFormat, DiscoverableURIs uris)
        {
            this._config       = config;
            this._outputFormat = outputFormat;
            this._uris         = uris;
        }
예제 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAdvertiseBoltIfExplicitlyConfigured() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAdvertiseBoltIfExplicitlyConfigured()
        {
            DiscoverableURIs uris = communityDiscoverableURIs(Config.defaults(ServerSettings.bolt_discoverable_address, "bolt://banana.com:1234"), null);

            assertEquals("bolt://banana.com:1234", ToMap(uris)["bolt"]);
        }