Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldStartWithMatchingDatabase() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldStartWithMatchingDatabase()
        {
            // given
            when(_remoteStore.getStoreId(any())).thenReturn(_localStoreId);
            when(_localDatabase.Empty).thenReturn(false);

            ReadReplicaStartupProcess readReplicaStartupProcess = new ReadReplicaStartupProcess(_remoteStore, _localDatabase, _txPulling, ChooseFirstMember(), _retryStrategy, NullLogProvider.Instance, NullLogProvider.Instance, _storeCopyProcess, _topologyService);

            // when
            readReplicaStartupProcess.Start();

            // then
            verify(_localDatabase).start();
            verify(_txPulling).start();
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReplaceEmptyStoreWithRemote() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReplaceEmptyStoreWithRemote()
        {
            // given
            when(_localDatabase.Empty).thenReturn(true);
            when(_topologyService.findCatchupAddress(any())).thenReturn(_fromAddress);
            when(_remoteStore.getStoreId(any())).thenReturn(_otherStoreId);

            ReadReplicaStartupProcess readReplicaStartupProcess = new ReadReplicaStartupProcess(_remoteStore, _localDatabase, _txPulling, ChooseFirstMember(), _retryStrategy, NullLogProvider.Instance, NullLogProvider.Instance, _storeCopyProcess, _topologyService);

            // when
            readReplicaStartupProcess.Start();

            // then
            verify(_storeCopyProcess).replaceWithStoreFrom(any(), any());
            verify(_localDatabase).start();
            verify(_txPulling).start();
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotStartWithMismatchedNonEmptyStore() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotStartWithMismatchedNonEmptyStore()
        {
            // given
            when(_localDatabase.Empty).thenReturn(false);
            when(_remoteStore.getStoreId(any())).thenReturn(_otherStoreId);

            ReadReplicaStartupProcess readReplicaStartupProcess = new ReadReplicaStartupProcess(_remoteStore, _localDatabase, _txPulling, ChooseFirstMember(), _retryStrategy, NullLogProvider.Instance, NullLogProvider.Instance, _storeCopyProcess, _topologyService);

            // when
            try
            {
                readReplicaStartupProcess.Start();
                fail("should have thrown");
            }
            catch (Exception ex)
            {
                //expected.
                assertThat(ex.Message, containsString("This read replica cannot join the cluster. The local database is not empty and has a " + "mismatching storeId"));
            }

            // then
            verify(_txPulling, never()).start();
        }