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); }
//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")); }
//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")); }
//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()); }
//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")); }
//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")); }
//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")); }
//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")); }
//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); }
//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"]); }
//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")); }
//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 ")); } }
//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)); }
//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")); }
public Builder(DiscoverableURIs copy) { Entries = new List <URIEntry>(copy.entries); }
// 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; }
//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"]); }