示例#1
0
        public UdcTimerTask(HostnamePort hostAddress, UdcInformationCollector collector)
        {
            this._storeId = collector.StoreId;

            SuccessCounts[_storeId] = 0;
            FailureCounts[_storeId] = 0;

            _pinger = new Pinger(hostAddress, collector);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void normalPingSequenceShouldBeOneThenTwoThenThreeEtc() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void NormalPingSequenceShouldBeOneThenTwoThenThreeEtc()
        {
            int[] expectedSequence = new int[] { 1, 2, 3, 4 };
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.helpers.HostnamePort hostURL = new org.neo4j.helpers.HostnamePort(hostname, server.getLocalPort());
            HostnamePort hostURL = new HostnamePort(_hostname, server.LocalPort);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<String,String> udcFields = new java.util.HashMap<>();
            IDictionary <string, string> udcFields = new Dictionary <string, string>();

            Pinger p = new Pinger(hostURL, new TestUdcCollector(udcFields));

            foreach (int s in expectedSequence)
            {
                p.Ping();
                int count = int.Parse(Handler.QueryMap[UdcConstants.PING]);
                assertEquals(s, count);
            }
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPingServer() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPingServer()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.helpers.HostnamePort hostURL = new org.neo4j.helpers.HostnamePort(hostname, server.getLocalPort());
            HostnamePort hostURL = new HostnamePort(_hostname, server.LocalPort);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<String,String> udcFields = new java.util.HashMap<>();
            IDictionary <string, string> udcFields = new Dictionary <string, string>();

            udcFields[ID] = _expectedStoreId;
            udcFields[UdcConstants.VERSION] = _expectedKernelVersion;

            Pinger p = new Pinger(hostURL, new TestUdcCollector(udcFields));

            p.Ping();

            IDictionary <string, string> actualQueryMap = Handler.QueryMap;

            assertThat(actualQueryMap, notNullValue());
            assertThat(actualQueryMap[ID], @is(_expectedStoreId));
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludePingCountInURI() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldIncludePingCountInURI()
        {
            const int expectedPingCount = 16;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.helpers.HostnamePort hostURL = new org.neo4j.helpers.HostnamePort(hostname, server.getLocalPort());
            HostnamePort hostURL = new HostnamePort(_hostname, server.LocalPort);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<String,String> udcFields = new java.util.HashMap<>();
            IDictionary <string, string> udcFields = new Dictionary <string, string>();

            Pinger p = new Pinger(hostURL, new TestUdcCollector(udcFields));

            for (int i = 0; i < expectedPingCount; i++)
            {
                p.Ping();
            }

            assertThat(p.PingCount, @is(equalTo(expectedPingCount)));

            IDictionary <string, string> actualQueryMap = Handler.QueryMap;

            assertThat(actualQueryMap[UdcConstants.PING], @is(Convert.ToString(expectedPingCount)));
        }