예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListExpectedFilesCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldListExpectedFilesCorrectly()
        {
            // given (setup) required runtime subject dependencies
            NeoStoreDataSource  neoStoreDataSource  = GetNeoStoreDataSource(_graphDb);
            SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider);

            // when
            PrepareStoreCopyResponse prepareStoreCopyResponse = simpleCatchupClient.RequestListOfFilesFromServer();

            simpleCatchupClient.Close();

            // then
            ListOfDownloadedFilesMatchesServer(neoStoreDataSource, prepareStoreCopyResponse.Files);

            // and downloaded files are identical to source
            IList <File> expectedCountStoreFiles = ListServerExpectedNonReplayableFiles(neoStoreDataSource);

            foreach (File storeFileSnapshot in expectedCountStoreFiles)
            {
                FileContentEquals(DatabaseFileToClientFile(storeFileSnapshot), storeFileSnapshot);
            }

            // and
            AssertTransactionIdMatches(prepareStoreCopyResponse.LastTransactionId());

            //and
            assertTrue("Expected an empty set of ids. Found size " + prepareStoreCopyResponse.IndexIds.size(), prepareStoreCopyResponse.IndexIds.Empty);
        }
예제 #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());
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCommunicateErrorIfStoreIdDoesNotMatchRequest() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCommunicateErrorIfStoreIdDoesNotMatchRequest()
        {
            // given (setup) required runtime subject dependencies
            AddData(_graphDb);
            SimpleCatchupClient simpleCatchupClient = new SimpleCatchupClient(_graphDb, _fsa, _catchupClient, _catchupServer, _temporaryDirectory, _logProvider);

            // when the list of files are requested from the server with the wrong storeId
            PrepareStoreCopyResponse prepareStoreCopyResponse = simpleCatchupClient.RequestListOfFilesFromServer(_wrongStoreId);

            simpleCatchupClient.Close();

            // then the response is not a list of files but an error
            assertEquals(PrepareStoreCopyResponse.Status.EStoreIdMismatch, prepareStoreCopyResponse.Status());

            // and the list of files is empty because the request should have failed
            File[] remoteFiles = prepareStoreCopyResponse.Files;
            assertArrayEquals(new File[] {}, remoteFiles);
        }
예제 #4
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);
        }
예제 #5
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);
        }