Beispiel #1
0
            public override NeoStoreDataSource NeoStoreDataSource()
            {
                NeoStoreDataSource neoStoreDataSource = mock(typeof(NeoStoreDataSource));

                when(neoStoreDataSource.DatabaseName).thenReturn(DatabaseName);
                return(neoStoreDataSource);
            }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void channelRead0(io.netty.channel.ChannelHandlerContext channelHandlerContext, PrepareStoreCopyRequest prepareStoreCopyRequest) throws java.io.IOException
        protected internal override void ChannelRead0(ChannelHandlerContext channelHandlerContext, PrepareStoreCopyRequest prepareStoreCopyRequest)
        {
            CloseablesListener       closeablesListener = new CloseablesListener();
            PrepareStoreCopyResponse response           = PrepareStoreCopyResponse.Error(PrepareStoreCopyResponse.Status.EListingStore);

            try
            {
                NeoStoreDataSource neoStoreDataSource = _dataSourceSupplier.get();
                if (!hasSameStoreId(prepareStoreCopyRequest.StoreId, neoStoreDataSource))
                {
                    channelHandlerContext.write(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
                    response = PrepareStoreCopyResponse.Error(PrepareStoreCopyResponse.Status.EStoreIdMismatch);
                }
                else
                {
                    CheckPointer checkPointer = neoStoreDataSource.DependencyResolver.resolveDependency(typeof(CheckPointer));
                    closeablesListener.Add(TryCheckpointAndAcquireMutex(checkPointer));
                    PrepareStoreCopyFiles prepareStoreCopyFiles = closeablesListener.Add(_prepareStoreCopyFilesProvider.prepareStoreCopyFiles(neoStoreDataSource));

                    StoreResource[] nonReplayable = prepareStoreCopyFiles.AtomicFilesSnapshot;
                    foreach (StoreResource storeResource in nonReplayable)
                    {
                        _streamingProtocol.stream(channelHandlerContext, storeResource);
                    }
                    channelHandlerContext.write(ResponseMessageType.PREPARE_STORE_COPY_RESPONSE);
                    response = CreateSuccessfulResponse(checkPointer, prepareStoreCopyFiles);
                }
            }
            finally
            {
                channelHandlerContext.writeAndFlush(response).addListener(closeablesListener);
                _protocol.expect(CatchupServerProtocol.State.MESSAGE_TYPE);
            }
        }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: org.neo4j.cursor.RawCursor<StoreResource,java.io.IOException> create() throws java.io.IOException
        internal virtual RawCursor <StoreResource, IOException> Create()
        {
            NeoStoreDataSource dataSource = _dataSourceSupplier.get();

            File databaseDirectory = dataSource.DatabaseLayout.databaseDirectory();
            ResourceIterator <StoreFileMetadata> files = dataSource.ListStoreFiles(false);

            return(new RawCursorAnonymousInnerClass(this, databaseDirectory, files));
        }
Beispiel #4
0
        public DataSourceModule(string databaseName, PlatformModule platformModule, AbstractEditionModule editionModule, Procedures procedures, GraphDatabaseFacade graphDatabaseFacade)
        {
            platformModule.DiagnosticsManager.prependProvider(platformModule.Config);
            DatabaseEditionContext         editionContext = editionModule.CreateDatabaseContext(databaseName);
            ModularDatabaseCreationContext context        = new ModularDatabaseCreationContext(databaseName, platformModule, editionContext, procedures, graphDatabaseFacade);

            NeoStoreDataSource = new NeoStoreDataSource(context);

            this.CoreAPIAvailabilityGuardConflict = context.CoreAPIAvailabilityGuard;
            this.StoreId   = NeoStoreDataSource.getStoreId;
            this.KernelAPI = NeoStoreDataSource.getKernel;

            ProcedureGDSFactory gdsFactory = new ProcedureGDSFactory(platformModule, this, CoreAPIAvailabilityGuardConflict, context.TokenHolders, editionModule.ThreadToTransactionBridge);

            procedures.RegisterComponent(typeof(GraphDatabaseService), gdsFactory.apply, true);
        }
Beispiel #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            DataSourceManager  dataSourceManager = new DataSourceManager(Config.defaults());
            NeoStoreDataSource dataSource        = mock(typeof(NeoStoreDataSource));

            when(dataSource.DatabaseLayout).thenReturn(TestDirectory.databaseLayout());
            dataSourceManager.Register(dataSource);
            KernelData kernelData = new KernelData(_fs, mock(typeof(PageCache)), new File("storeDir"), Config.defaults(), dataSourceManager);

            Dependencies dependencies = new Dependencies();

            dependencies.SatisfyDependency(_clusterStateDirectory);
            dependencies.SatisfyDependency(_raftMachine);
            dependencies.SatisfyDependency(DatabaseInfo.CORE);

            when(dataSource.DependencyResolver).thenReturn(dependencies);
            ManagementData data = new ManagementData(new CausalClusteringBean(), kernelData, ManagementSupport.load());

            _ccBean = ( CausalClustering )(new CausalClusteringBean()).CreateMBean(data);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shutdownWhileFinishingTransactionWithIndexUpdates()
        public virtual void ShutdownWhileFinishingTransactionWithIndexUpdates()
        {
            CreateConstraint(Database);
            WaitIndexesOnline(Database);

            using (Transaction transaction = Database.beginTx())
            {
                Node node = Database.createNode(_constraintIndexLabel);
                node.SetProperty(UNIQUE_PROPERTY_NAME, _indexProvider.AndIncrement);

                DependencyResolver       dependencyResolver = Database.DependencyResolver;
                NeoStoreDataSource       dataSource         = dependencyResolver.ResolveDependency(typeof(NeoStoreDataSource));
                LifeSupport              dataSourceLife     = dataSource.Life;
                TransactionCloseListener closeListener      = new TransactionCloseListener(transaction);
                dataSourceLife.AddLifecycleListener(closeListener);
                dataSource.Stop();

                assertTrue("Transaction should be closed and no exception should be thrown.", closeListener.TransactionClosed);
            }
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _dataSource = mock(typeof(NeoStoreDataSource));
            StorageEngine storageEngine = mock(typeof(StorageEngine));
            StorageReader storageReader = mock(typeof(StorageReader));

            when(storageEngine.NewReader()).thenReturn(storageReader);
            _indexingService = mock(typeof(IndexingService));
            TokenHolders tokenHolders = MockedTokenHolders();

            when(tokenHolders.LabelTokens().getIdByName(EXISTING_LABEL)).thenReturn(LABEL_ID);
            when(tokenHolders.PropertyKeyTokens().getIdByName(EXISTING_PROPERTY)).thenReturn(PROPERTY_ID);
            when(tokenHolders.PropertyKeyTokens().getIdByName(NON_EXISTING_PROPERTY)).thenReturn(-1);
            when(tokenHolders.LabelTokens().getIdByName(NON_EXISTING_LABEL)).thenReturn(NO_TOKEN);
            DependencyResolver resolver = mock(typeof(DependencyResolver));

            when(resolver.ResolveDependency(typeof(IndexingService))).thenReturn(_indexingService);
            when(resolver.ResolveDependency(typeof(StorageEngine))).thenReturn(storageEngine);
            when(resolver.ResolveDependency(typeof(TokenHolders))).thenReturn(tokenHolders);
            when(_dataSource.DependencyResolver).thenReturn(resolver);
        }
Beispiel #8
0
 internal static bool HasSameStoreId(StoreId storeId, NeoStoreDataSource dataSource)
 {
     return(storeId.EqualToKernelStoreId(dataSource.StoreId));
 }
Beispiel #9
0
 public override void Unregistered(NeoStoreDataSource dataSource)
 {
     State = null;
 }
Beispiel #10
0
            public override void Registered(NeoStoreDataSource dataSource)
            {
                DependencyResolver dependencyResolver = dataSource.DependencyResolver;

                State = new State(dependencyResolver.ResolveDependency(typeof(StorageEngine)), dependencyResolver.ResolveDependency(typeof(IndexingService)), dependencyResolver.ResolveDependency(typeof(TokenHolders)));
            }
Beispiel #11
0
 internal PrepareStoreCopyFiles(NeoStoreDataSource neoStoreDataSource, FileSystemAbstraction fileSystemAbstraction)
 {
     this._neoStoreDataSource    = neoStoreDataSource;
     this._fileSystemAbstraction = fileSystemAbstraction;
 }
Beispiel #12
0
 internal virtual PrepareStoreCopyFiles PrepareStoreCopyFiles(NeoStoreDataSource neoStoreDataSource)
 {
     return(new PrepareStoreCopyFiles(neoStoreDataSource, _fileSystemAbstraction));
 }