Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private boolean successfulRequest(StoreCopyFinishedResponse response, org.neo4j.causalclustering.messaging.CatchUpRequest request) throws StoreCopyFailedException
        private bool SuccessfulRequest(StoreCopyFinishedResponse response, CatchUpRequest request)
        {
            StoreCopyFinishedResponse.Status responseStatus = response.Status();
            if (responseStatus == StoreCopyFinishedResponse.Status.Success)
            {
                _log.info(format("Request was successful '%s'", request));
                return(true);
            }
            else if (StoreCopyFinishedResponse.Status.ETooFarBehind == responseStatus || StoreCopyFinishedResponse.Status.EUnknown == responseStatus || StoreCopyFinishedResponse.Status.EStoreIdMismatch == responseStatus)
            {
                _log.warn(format("Request failed '%s'. With response: %s", request, response.Status()));
                return(false);
            }
            else
            {
                throw new StoreCopyFailedException(format("Request responded with an unknown response type: %s. '%s'", responseStatus, request));
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void individualFileCopyFailsIfStoreIdMismatch() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndividualFileCopyFailsIfStoreIdMismatch()
        {
            // given a file exists on the server
            AddData(_graphDb);
            File expectedExistingFile = _graphDb.databaseLayout().file(EXISTING_FILE_NAME);

            // and
            SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider);

            // when we copy that file using a different storeId
            StoreCopyFinishedResponse storeCopyFinishedResponse = simpleCatchupClient.RequestIndividualFile(expectedExistingFile, _wrongStoreId);

            simpleCatchupClient.Close();

            // then the response from the server should be an error message that describes a store ID mismatch
            assertEquals(StoreCopyFinishedResponse.Status.EStoreIdMismatch, storeCopyFinishedResponse.Status());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void individualFileCopyWorks() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndividualFileCopyWorks()
        {
            // given a file exists on the server
            AddData(_graphDb);
            File existingFile = new File(_temporaryDirectory, EXISTING_FILE_NAME);

            // and
            SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider);

            // when we copy that file
            _pageCache.flushAndForce();
            StoreCopyFinishedResponse storeCopyFinishedResponse = simpleCatchupClient.RequestIndividualFile(existingFile);

            simpleCatchupClient.Close();

            // then the response is successful
            assertEquals(StoreCopyFinishedResponse.Status.Success, storeCopyFinishedResponse.Status());

            // then the contents matches
            FileContentEquals(ClientFileToDatabaseFile(existingFile), existingFile);
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void individualIndexSnapshotCopyWorks() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndividualIndexSnapshotCopyWorks()
        {
            // given
            NeoStoreDataSource neoStoreDataSource = GetNeoStoreDataSource(_graphDb);
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IList <File>        expectingFiles      = neoStoreDataSource.NeoStoreFileListing.builder().excludeAll().includeSchemaIndexStoreFiles().build().Select(StoreFileMetadata::file).ToList();
            SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider);

            // and
            LongIterator indexIds = GetExpectedIndexIds(neoStoreDataSource).longIterator();

            // when
            while (indexIds.hasNext())
            {
                long indexId = indexIds.next();
                StoreCopyFinishedResponse response = simpleCatchupClient.RequestIndexSnapshot(indexId);
                simpleCatchupClient.Close();
                assertEquals(StoreCopyFinishedResponse.Status.Success, response.Status());
            }

            // then
            FileContentEquals(expectingFiles);
        }