Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDropIndexOnRecovery() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDropIndexOnRecovery()
        {
            // given a transaction stream ending in an INDEX DROP command.
            CommittedTransactionRepresentation dropTransaction = PrepareDropTransaction();
            File storeDir           = Directory.databaseDir();
            GraphDatabaseService db = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(storeDir);

            CreateIndex(db);
            Db.shutdown();
            AppendDropTransactionToTransactionLog(Directory.databaseDir(), dropTransaction);

            // when recovering this (the drop transaction with the index file intact)
            Monitors monitors = new Monitors();
            AssertRecoveryIsPerformed recoveryMonitor = new AssertRecoveryIsPerformed();

            monitors.AddMonitorListener(recoveryMonitor);
            db = (new TestGraphDatabaseFactory()).setMonitors(monitors).newEmbeddedDatabase(storeDir);
            try
            {
                assertTrue(recoveryMonitor.RecoveryWasPerformed);

                // then
                using (Transaction tx = Db.beginTx())
                {
                    assertEquals(0, count(Db.schema().Indexes));
                    tx.Success();
                }
            }
            finally
            {
                // and the ability to shut down w/o failing on still open files
                Db.shutdown();
            }
        }
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 shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldConvertListsAndMapsWhenPassingFromScalaToJava()
        {
            GraphDatabaseQueryService graph    = new GraphDatabaseCypherService(this.Database.GraphDatabaseAPI);
            DependencyResolver        resolver = graph.DependencyResolver;
            Monitors monitors = resolver.ResolveDependency(typeof(Monitors));

            NullLogProvider nullLogProvider = NullLogProvider.Instance;

            Config config = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration cypherConfig = CypherConfiguration.fromConfig(config);

            CommunityCompilerFactory compilerFactory = new CommunityCompilerFactory(graph, monitors, nullLogProvider, cypherConfig.toCypherPlannerConfiguration(config), cypherConfig.toCypherRuntimeConfiguration());
            ExecutionEngine          executionEngine = new ExecutionEngine(graph, nullLogProvider, compilerFactory);

            Result result;

            using (InternalTransaction tx = graph.BeginTransaction(KernelTransaction.Type.@implicit, LoginContext.AUTH_DISABLED))
            {
                string query            = "RETURN { key : 'Value' , collectionKey: [{ inner: 'Map1' }, { inner: 'Map2' }]}";
                TransactionalContext tc = CreateTransactionContext(graph, tx, query);
                result = executionEngine.ExecuteQuery(query, _noParams, tc);

                VerifyResult(result);

                result.Close();
                tx.Success();
            }
        }
Esempio n. 3
0
        public ClusteringModule(DiscoveryServiceFactory discoveryServiceFactory, MemberId myself, PlatformModule platformModule, File clusterStateDirectory, DatabaseLayout databaseLayout)
        {
            LifeSupport           life                  = platformModule.Life;
            Config                config                = platformModule.Config;
            LogProvider           logProvider           = platformModule.Logging.InternalLogProvider;
            LogProvider           userLogProvider       = platformModule.Logging.UserLogProvider;
            Dependencies          dependencies          = platformModule.Dependencies;
            Monitors              monitors              = platformModule.Monitors;
            FileSystemAbstraction fileSystem            = platformModule.FileSystem;
            RemoteMembersResolver remoteMembersResolver = chooseResolver(config, platformModule.Logging);

            _topologyService = discoveryServiceFactory.CoreTopologyService(config, myself, platformModule.JobScheduler, logProvider, userLogProvider, remoteMembersResolver, ResolveStrategy(config, logProvider), monitors);

            life.Add(_topologyService);

            dependencies.SatisfyDependency(_topologyService);                 // for tests

            CoreBootstrapper coreBootstrapper = new CoreBootstrapper(databaseLayout, platformModule.PageCache, fileSystem, config, logProvider, platformModule.Monitors);

            SimpleStorage <ClusterId> clusterIdStorage = new SimpleFileStorage <ClusterId>(fileSystem, clusterStateDirectory, CLUSTER_ID_NAME, new ClusterId.Marshal(), logProvider);

            SimpleStorage <DatabaseName> dbNameStorage = new SimpleFileStorage <DatabaseName>(fileSystem, clusterStateDirectory, DB_NAME, new DatabaseName.Marshal(), logProvider);

            string dbName           = config.Get(CausalClusteringSettings.database);
            int    minimumCoreHosts = config.Get(CausalClusteringSettings.minimum_core_cluster_size_at_formation);

            Duration clusterBindingTimeout = config.Get(CausalClusteringSettings.cluster_binding_timeout);

            _clusterBinder = new ClusterBinder(clusterIdStorage, dbNameStorage, _topologyService, Clocks.systemClock(), () => sleep(100), clusterBindingTimeout, coreBootstrapper, dbName, minimumCoreHosts, platformModule.Monitors);
        }
Esempio n. 4
0
 public RecoveryRequiredChecker(FileSystemAbstraction fs, PageCache pageCache, Config config, Monitors monitors)
 {
     this._fs        = fs;
     this._pageCache = pageCache;
     this._config    = config;
     this._monitors  = monitors;
 }
Esempio n. 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()
        {
            TestHighlyAvailableGraphDatabaseFactory factory = new TestHighlyAvailableGraphDatabaseFactory();
            Monitors monitors = new Monitors();

            monitors.AddMonitorListener(_monitor);
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            factory.RemoveKernelExtensions(extension => extension.GetType().FullName.Contains("LabelScan"));
            ClusterManager clusterManager = (new ClusterManager.Builder(TestDirectory.directory("root"))).withDbFactory(factory).withMonitors(monitors).withStoreDirInitializer((serverId, storeDir) =>
            {
                if (serverId == 1)
                {
                    GraphDatabaseService db = (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(storeDir).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newGraphDatabase();
                    try
                    {
                        CreateSomeLabeledNodes(db, new Label[] { Labels.First }, new Label[] { Labels.First, Labels.Second }, new Label[] { Labels.Second });
                    }
                    finally
                    {
                        Db.shutdown();
                    }
                }
            }).build();

            _life.add(clusterManager);
            _life.start();
            _cluster = clusterManager.Cluster;
            _cluster.await(allSeesAllAsAvailable());
            _cluster.await(allAvailabilityGuardsReleased());
        }
Esempio n. 6
0
 public DefaultSlaveFactory(LogProvider logProvider, Monitors monitors, int chunkSize, System.Func <LogEntryReader <ReadableClosablePositionAwareChannel> > logEntryReader)
 {
     this._logProvider = logProvider;
     this._monitors    = monitors;
     this._chunkSize   = chunkSize;
     this._entryReader = logEntryReader;
 }
Esempio n. 7
0
		 private static BinaryLatch InjectWarmupLatch( ClusterMember member, AtomicLong pagesLoadedInWarmup )
		 {
			  BinaryLatch warmupLatch = new BinaryLatch();
			  Monitors monitors = member.monitors();
			  monitors.AddMonitorListener( new PageCacheWarmerMonitorAdapterAnonymousInnerClass( pagesLoadedInWarmup, warmupLatch ) );
			  return warmupLatch;
		 }
Esempio n. 8
0
 public LifecycleAdapterAnonymousInnerClass(QueryLoggerKernelExtension outerInstance, FileSystemAbstraction fileSystem, Config config, Monitors monitoring, LogService logService, JobScheduler jobScheduler)
 {
     this.outerInstance = outerInstance;
     this._fileSystem   = fileSystem;
     this._config       = config;
     this._monitoring   = monitoring;
     this._logService   = logService;
     this._jobScheduler = jobScheduler;
 }
 public PhysicalLogicalTransactionStore(LogFiles logFiles, TransactionMetadataCache transactionMetadataCache, LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader, Monitors monitors, bool failOnCorruptedLogFiles)
 {
     this._logFiles = logFiles;
     this._logFile  = logFiles.LogFile;
     this._transactionMetadataCache = transactionMetadataCache;
     this._logEntryReader           = logEntryReader;
     this._monitors = monitors;
     this._failOnCorruptedLogFiles = failOnCorruptedLogFiles;
 }
 public DefaultBoltConnectionFactory(BoltSchedulerProvider schedulerProvider, TransportThrottleGroup throttleGroup, Config config, LogService logService, Clock clock, Monitors monitors)
 {
     this._schedulerProvider = schedulerProvider;
     this._throttleGroup     = throttleGroup;
     this._config            = config;
     this._logService        = logService;
     this._clock             = clock;
     this._monitors          = monitors;
     this._metricsMonitor    = monitors.NewMonitor(typeof(BoltConnectionMetricsMonitor));
 }
Esempio n. 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override public org.neo4j.kernel.lifecycle.Lifecycle newInstance(@SuppressWarnings("unused") org.neo4j.kernel.impl.spi.KernelContext context, final Dependencies dependencies)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies)
        {
            FileSystemAbstraction fileSystem = dependencies.FileSystem();
            Config       config       = dependencies.Config();
            Monitors     monitoring   = dependencies.Monitoring();
            LogService   logService   = dependencies.Logger();
            JobScheduler jobScheduler = dependencies.JobScheduler();

            return(new LifecycleAdapterAnonymousInnerClass(this, fileSystem, config, monitoring, logService, jobScheduler));
        }
Esempio n. 12
0
 public CoreStateDownloaderService(JobScheduler jobScheduler, CoreStateDownloader downloader, CommandApplicationProcess applicationProcess, LogProvider logProvider, Org.Neo4j.causalclustering.helper.TimeoutStrategy_Timeout downloaderPauseStrategy, System.Func <DatabaseHealth> dbHealth, Monitors monitors)
 {
     this._jobScheduler       = jobScheduler;
     this._downloader         = downloader;
     this._applicationProcess = applicationProcess;
     this._log = logProvider.getLog(this.GetType());
     this._downloaderPauseStrategy = downloaderPauseStrategy;
     this._dbHealth = dbHealth;
     this._monitors = monitors;
 }
Esempio n. 13
0
 public BoltMetrics(MetricRegistry registry, Monitors monitors)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._registry = registry;
     this._monitors = monitors;
 }
Esempio n. 14
0
 /// <summary>
 /// Dependencies that can be resolved immediately after launching the backup tool
 /// </summary>
 /// <param name="outsideWorld"> filesystem and output streams that the tool interacts with </param>
 /// <param name="logProvider"> made available to subsequent dependency resolution classes </param>
 /// <param name="monitors"> will become shared across all resolved dependencies </param>
 internal BackupModule(OutsideWorld outsideWorld, LogProvider logProvider, Monitors monitors)
 {
     this._outsideWorld = outsideWorld;
     this._logProvider  = logProvider;
     this._monitors     = monitors;
     this._clock        = Clock.systemDefaultZone();
     this._transactionLogCatchUpFactory = new TransactionLogCatchUpFactory();
     this._fileSystemAbstraction        = outsideWorld.FileSystem();
     this._jobScheduler = createInitialisedScheduler();
 }
Esempio n. 15
0
        /// <summary>
        /// Creates an execution engine around the give graph database </summary>
        /// <param name="queryService"> The database to wrap </param>
        /// <param name="logProvider"> A <seealso cref="LogProvider"/> for cypher-statements </param>
        public ExecutionEngine(GraphDatabaseQueryService queryService, LogProvider logProvider, CompilerFactory compilerFactory)
        {
            DependencyResolver  resolver            = queryService.DependencyResolver;
            Monitors            monitors            = resolver.ResolveDependency(typeof(Monitors));
            CacheTracer         cacheTracer         = new MonitoringCacheTracer(monitors.NewMonitor(typeof(StringCacheMonitor)));
            Config              config              = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration cypherConfiguration = CypherConfiguration.fromConfig(config);
            CompilationTracer   tracer              = new TimingCompilationTracer(monitors.NewMonitor(typeof(TimingCompilationTracer.EventListener)));

            _inner = new [email protected](queryService, monitors, tracer, cacheTracer, cypherConfiguration, compilerFactory, logProvider, Clock.systemUTC());
        }
Esempio n. 16
0
        internal static long WaitForCacheProfile(Monitors monitors)
        {
            AtomicLong             pageCount    = new AtomicLong();
            BinaryLatch            profileLatch = new BinaryLatch();
            PageCacheWarmerMonitor listener     = new AwaitProfileMonitor(pageCount, profileLatch);

            monitors.AddMonitorListener(listener);
            profileLatch.Await();
            monitors.RemoveMonitorListener(listener);
            return(pageCount.get());
        }
Esempio n. 17
0
 public RegularCatchupServerHandler(Monitors monitors, LogProvider logProvider, System.Func <StoreId> storeIdSupplier, System.Func <NeoStoreDataSource> dataSourceSupplier, System.Func <bool> dataSourceAvailabilitySupplier, FileSystemAbstraction fs, CoreSnapshotService snapshotService, CheckPointerService checkPointerService)
 {
     this._monitors                       = monitors;
     this._logProvider                    = logProvider;
     this._storeIdSupplier                = storeIdSupplier;
     this._dataSourceSupplier             = dataSourceSupplier;
     this._dataSourceAvailabilitySupplier = dataSourceAvailabilitySupplier;
     this._fs = fs;
     this._snapshotService     = snapshotService;
     this._checkPointerService = checkPointerService;
 }
Esempio n. 18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @Nonnull public org.neo4j.commandline.admin.AdminCommand create(java.nio.file.Path homeDir, java.nio.file.Path configDir, org.neo4j.commandline.admin.OutsideWorld outsideWorld)
        public override AdminCommand Create(Path homeDir, Path configDir, OutsideWorld outsideWorld)
        {
            bool        debug       = System.getenv().get("NEO4J_DEBUG") != null;
            LogProvider logProvider = FormattedLogProvider.withDefaultLogLevel(debug ? Level.DEBUG : Level.NONE).toOutputStream(outsideWorld.OutStream());
            Monitors    monitors    = new Monitors();

            OnlineBackupContextFactory contextBuilder = new OnlineBackupContextFactory(homeDir, configDir);
            BackupModule backupModule = new BackupModule(outsideWorld, logProvider, monitors);

            BackupSupportingClassesFactoryProvider classesFactoryProvider   = ProvidersByPriority.findFirst().orElseThrow(NoProviderException());
            BackupSupportingClassesFactory         supportingClassesFactory = classesFactoryProvider.GetFactory(backupModule);
            BackupStrategyCoordinatorFactory       coordinatorFactory       = new BackupStrategyCoordinatorFactory(backupModule);

            return(new OnlineBackupCommand(outsideWorld, contextBuilder, supportingClassesFactory, coordinatorFactory));
        }
Esempio n. 19
0
 public PullerFactory(RequestContextFactory requestContextFactory, Master master, LastUpdateTime lastUpdateTime, LogProvider logging, InstanceId serverId, InvalidEpochExceptionHandler invalidEpochHandler, long pullInterval, JobScheduler jobScheduler, DependencyResolver dependencyResolver, AvailabilityGuard availabilityGuard, HighAvailabilityMemberStateMachine memberStateMachine, Monitors monitors, Config config)
 {
     this._requestContextFactory = requestContextFactory;
     this._master              = master;
     this._lastUpdateTime      = lastUpdateTime;
     this._logging             = logging;
     this._serverId            = serverId;
     this._invalidEpochHandler = invalidEpochHandler;
     this._pullInterval        = pullInterval;
     this._jobScheduler        = jobScheduler;
     this._dependencyResolver  = dependencyResolver;
     this._availabilityGuard   = availabilityGuard;
     this._memberStateMachine  = memberStateMachine;
     this._monitors            = monitors;
     this._activeDatabaseName  = config.Get(GraphDatabaseSettings.active_database);
 }
Esempio n. 20
0
 internal DataCollector(Kernel kernel, JobScheduler jobScheduler, Monitors monitors, Org.Neo4j.Values.ValueMapper_JavaMapper valueMapper, Config config)
 {
     this.Kernel         = kernel;
     this.JobScheduler   = jobScheduler;
     this.ValueMapper    = valueMapper;
     this.QueryCollector = new QueryCollector(jobScheduler, config.Get(GraphDatabaseSettings.data_collector_max_recent_query_count), config.Get(GraphDatabaseSettings.data_collector_max_query_text_size));
     try
     {
         this.QueryCollector.collect(Collections.emptyMap());
     }
     catch (InvalidArgumentsException e)
     {
         throw new System.InvalidOperationException("An empty config cannot be invalid", e);
     }
     monitors.AddMonitorListener(QueryCollector);
 }
Esempio n. 21
0
        public DefaultMasterImplSPI(GraphDatabaseAPI graphDb, FileSystemAbstraction fileSystemAbstraction, Monitors monitors, TokenHolders tokenHolders, IdGeneratorFactory idGeneratorFactory, TransactionCommitProcess transactionCommitProcess, CheckPointer checkPointer, TransactionIdStore transactionIdStore, LogicalTransactionStore logicalTransactionStore, NeoStoreDataSource neoStoreDataSource, LogProvider logProvider)
        {
            this._graphDb                  = graphDb;
            this._fileSystem               = fileSystemAbstraction;
            this._tokenHolders             = tokenHolders;
            this._idGeneratorFactory       = idGeneratorFactory;
            this._transactionCommitProcess = transactionCommitProcess;
            this._checkPointer             = checkPointer;
            this._neoStoreDataSource       = neoStoreDataSource;
            this._databaseDirectory        = graphDb.DatabaseLayout().databaseDirectory();
            this._txChecksumLookup         = new TransactionChecksumLookup(transactionIdStore, logicalTransactionStore);
            this._responsePacker           = new ResponsePacker(logicalTransactionStore, transactionIdStore, graphDb.storeId);
            this._monitors                 = monitors;
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            monitors.AddMonitorListener(new LoggingStoreCopyServerMonitor(logProvider.GetLog(typeof(StoreCopyServer))), typeof(StoreCopyServer).FullName);
        }
Esempio n. 22
0
        public override IndexProvider NewInstance(KernelContext context, DEPENDENCIES dependencies)
        {
            PageCache             pageCache   = dependencies.PageCache();
            File                  databaseDir = context.Directory();
            FileSystemAbstraction fs          = dependencies.FileSystem();
            Log      log      = dependencies.LogService.InternalLogProvider.getLog(LoggingClass());
            Monitors monitors = dependencies.Monitors();

            monitors.AddMonitorListener(new LoggingMonitor(log), DescriptorString());
            IndexProvider.Monitor monitor   = monitors.NewMonitor(typeof(IndexProvider.Monitor), DescriptorString());
            Config          config          = dependencies.Config;
            OperationalMode operationalMode = context.DatabaseInfo().OperationalMode;
            RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = dependencies.RecoveryCleanupWorkCollector();

            return(InternalCreate(pageCache, databaseDir, fs, monitor, config, operationalMode, recoveryCleanupWorkCollector));
        }
Esempio n. 23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMonitorTerm() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMonitorTerm()
        {
            // given
            Monitors            monitors        = new Monitors();
            StubRaftTermMonitor raftTermMonitor = new StubRaftTermMonitor();

            monitors.AddMonitorListener(raftTermMonitor);
            TermState state = new TermState();
            MonitoredTermStateStorage monitoredTermStateStorage = new MonitoredTermStateStorage(new InMemoryStateStorage <TermState>(new TermState()), monitors);

            // when
            state.Update(7);
            monitoredTermStateStorage.PersistStoreData(state);

            // then
            assertEquals(7, raftTermMonitor.Term());
        }
Esempio n. 24
0
        public override Lifecycle NewInstance(KernelContext context, Dependencies deps)
        {
            JobScheduler scheduler = deps.JobScheduler();
            DatabaseAvailabilityGuard databaseAvailabilityGuard = deps.AvailabilityGuard();
            PageCache             pageCache         = deps.PageCache();
            FileSystemAbstraction fs                = deps.FileSystemAbstraction();
            LogService            logService        = deps.LogService();
            NeoStoreDataSource    dataSourceManager = deps.DataSource;
            Log      log      = logService.GetInternalLog(typeof(PageCacheWarmer));
            Monitors monitors = deps.Monitors();
            PageCacheWarmerMonitor monitor = monitors.NewMonitor(typeof(PageCacheWarmerMonitor));

            monitors.AddMonitorListener(new PageCacheWarmerLoggingMonitor(log));
            Config config = deps.Config();

            return(new PageCacheWarmerKernelExtension(scheduler, databaseAvailabilityGuard, pageCache, fs, dataSourceManager, log, monitor, config));
        }
Esempio n. 25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldKeepIndexInPopulatingStateBetweenRestarts() throws InterruptedException, java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldKeepIndexInPopulatingStateBetweenRestarts()
        {
            // given
            Monitors monitors = Db.DependencyResolver.resolveDependency(typeof(Monitors));

            Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control();
            monitors.AddMonitorListener(PopulationCompletionBlocker(barrier));

            // when
            CreateRelevantNode();
            CreateIndex();
            barrier.Await();
            // This call will eventually make a call to populationCancelled on the monitor below
            Db.restartDatabase();

            // then
            assertEquals(Schema_IndexState.Online, AwaitAndGetIndexState());
        }
Esempio n. 26
0
        protected internal override QueryExecutionEngine CreateEngine(Dependencies deps, GraphDatabaseAPI graphAPI)
        {
            GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);

            deps.SatisfyDependency(queryService);

            DependencyResolver         resolver        = graphAPI.DependencyResolver;
            LogService                 logService      = resolver.ResolveDependency(typeof(LogService));
            Monitors                   monitors        = resolver.ResolveDependency(typeof(Monitors));
            Config                     config          = resolver.ResolveDependency(typeof(Config));
            CypherConfiguration        cypherConfig    = CypherConfiguration.fromConfig(config);
            CypherPlannerConfiguration plannerConfig   = cypherConfig.toCypherPlannerConfiguration(config);
            CypherRuntimeConfiguration runtimeConfig   = cypherConfig.toCypherRuntimeConfiguration();
            LogProvider                logProvider     = logService.InternalLogProvider;
            CommunityCompilerFactory   compilerFactory = new CommunityCompilerFactory(queryService, monitors, logProvider, plannerConfig, runtimeConfig);

            deps.SatisfyDependencies(compilerFactory);
            return(CreateEngine(queryService, config, logProvider, compilerFactory));
        }
Esempio n. 27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotDuplicateToAnyLog()
        public virtual void ShouldNotDuplicateToAnyLog()
        {
            AssertableLogProvider userLogProvider  = new AssertableLogProvider();
            AssertableLogProvider debugLogProvider = new AssertableLogProvider();

            SimpleLogService logService = new SimpleLogService(userLogProvider, debugLogProvider);

            Monitors monitors = new Monitors();

            CoreMonitor.Register(logService.InternalLogProvider, logService.UserLogProvider, monitors);

            ClusterBinder.Monitor monitor = monitors.NewMonitor(typeof(ClusterBinder.Monitor));

            ClusterId clusterId = new ClusterId(System.Guid.randomUUID());

            monitor.BoundToCluster(clusterId);

            userLogProvider.RawMessageMatcher().assertContainsSingle(Matchers.allOf(Matchers.containsString("Bound to cluster with id " + clusterId.Uuid())));

            debugLogProvider.RawMessageMatcher().assertContainsSingle(Matchers.allOf(Matchers.containsString("Bound to cluster with id " + clusterId.Uuid())));
        }
Esempio n. 28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLetPageCacheHandleRecordStoresAndNativeLabelScanStoreFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLetPageCacheHandleRecordStoresAndNativeLabelScanStoreFiles()
        {
            // GIVEN
            Monitors             monitors       = new Monitors();
            StreamToDiskProvider writerProvider = new StreamToDiskProvider(_directory.databaseDir(), _fs, monitors);

            // WHEN
            foreach (StoreType type in StoreType.values())
            {
                if (type.RecordStore)
                {
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
                    File[] files = _directory.databaseLayout().file(type.DatabaseFile).toArray(File[] ::new);
                    foreach (File file in files)
                    {
                        WriteAndVerify(writerProvider, file);
                    }
                }
            }
            WriteAndVerify(writerProvider, _directory.databaseLayout().labelScanStore());
        }
Esempio n. 29
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void communityBackupSupportingFactory()
        public virtual void CommunityBackupSupportingFactory()
        {
            AssertableLogProvider logProvider = new AssertableLogProvider();

            //OutsideWorld outsideWorld = mock( OutsideWorld.class );

            RealOutsideWorld      outsideWorld   = new RealOutsideWorld();
            FileSystemAbstraction fileSystemMock = mock(typeof(FileSystemAbstraction));

            //outsideWorld.fileSystemAbstraction = fileSystemMock;
            Monitors monitors = mock(typeof(Monitors));

            BackupModule backupModule = new BackupModule(outsideWorld, logProvider, monitors);

            // when( backupModule.getOutsideWorld() ).thenReturn( outsideWorld );

            BackupSupportingClassesFactoryProvider provider = ProvidersByPriority.findFirst().get();

            BackupSupportingClassesFactory factory = provider.GetFactory(backupModule);

            /*
             * SecurePipelineWrapperFactory pipelineWrapperFactory = new SecurePipelineWrapperFactory();
             * SslPolicyLoader sslPolicyLoader;
             * // and
             * Config config = Config.defaults();
             * config.augment( CausalClusteringSettings.ssl_policy, "default" );
             *
             * // We want to create dependencies the same way factory.createPipelineWrapper does so.s
             * Dependencies dependencies = new Dependencies(  );
             * dependencies.satisfyDependencies(new Object[]{SslPolicyLoader.create(config, logProvider)});
             *
             * assertEquals( pipelineWrapperFactory.forClient(config, dependencies, logProvider, CausalClusteringSettings.ssl_policy),
             *      factory.createPipelineWrapper( Config.defaults() ) );
             */

            assertEquals(typeof(SecureClientPipelineWrapper), factory.CreatePipelineWrapper(Config.defaults()).GetType());
        }
Esempio n. 30
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMonitorAppendIndexAndCommitIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMonitorAppendIndexAndCommitIndex()
        {
            // Given
            Monitors monitors = new Monitors();
            StubRaftLogAppendIndexMonitor appendMonitor = new StubRaftLogAppendIndexMonitor();

            monitors.AddMonitorListener(appendMonitor);

            StubRaftLogCommitIndexMonitor commitMonitor = new StubRaftLogCommitIndexMonitor();

            monitors.AddMonitorListener(commitMonitor);

            MonitoredRaftLog log = new MonitoredRaftLog(new InMemoryRaftLog(), monitors);

            // When
            log.Append(new RaftLogEntry(0, ReplicatedInteger.valueOf(1)));
            log.Append(new RaftLogEntry(0, ReplicatedInteger.valueOf(1)));

            assertEquals(1, appendMonitor.AppendIndex());
            assertEquals(0, commitMonitor.CommitIndex());

            log.Truncate(1);
            assertEquals(0, appendMonitor.AppendIndex());
        }