public RaftOutbound(CoreTopologyService coreTopologyService, Outbound <AdvertisedSocketAddress, Message> outbound, System.Func <Optional <ClusterId> > clusterIdentity, LogProvider logProvider, long logThresholdMillis) { this._coreTopologyService = coreTopologyService; this._outbound = outbound; this._clusterIdentity = clusterIdentity; this._log = logProvider.getLog(this.GetType()); this._unknownAddressMonitor = new UnknownAddressMonitor(_log, Clocks.systemClock(), logThresholdMillis); }
//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() { _master = mock( typeof( Master ), new LockedOnMasterAnswer() ); _lockManager = new ForsetiLockManager( Config.defaults(), Clocks.systemClock(), ResourceTypes.values() ); _requestContextFactory = mock( typeof( RequestContextFactory ) ); _databaseAvailabilityGuard = new DatabaseAvailabilityGuard( GraphDatabaseSettings.DEFAULT_DATABASE_NAME, Clocks.systemClock(), mock(typeof(Log)) ); when( _requestContextFactory.newRequestContext( Mockito.anyInt() ) ).thenReturn(RequestContext.anonymous(1)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createDifferentCommunityLockManagers() internal virtual void CreateDifferentCommunityLockManagers() { CommunityLocksFactory factory = new CommunityLocksFactory(); Locks locks1 = factory.NewInstance(Config.defaults(), Clocks.systemClock(), ResourceTypes.values()); Locks locks2 = factory.NewInstance(Config.defaults(), Clocks.systemClock(), ResourceTypes.values()); assertNotSame(locks1, locks2); assertThat(locks1, instanceOf(typeof(CommunityLockManger))); assertThat(locks2, instanceOf(typeof(CommunityLockManger))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createLocksForAllResourceTypes() internal virtual void CreateLocksForAllResourceTypes() { LocksFactory lockFactory = mock(typeof(LocksFactory)); Config config = Config.defaults(); Clock clock = Clocks.systemClock(); createLockManager(lockFactory, config, clock); verify(lockFactory).newInstance(eq(config), eq(clock), eq(ResourceTypes.values())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testLogPruneThresholdsByType() public virtual void TestLogPruneThresholdsByType() { FileSystemAbstraction fsa = Mockito.mock(typeof(FileSystemAbstraction)); Clock clock = Clocks.systemClock(); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("files", 25), ""), instanceOf(typeof(FileCountThreshold))); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("size", 16000), ""), instanceOf(typeof(FileSizeThreshold))); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("txs", 4000), ""), instanceOf(typeof(EntryCountThreshold))); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("entries", 4000), ""), instanceOf(typeof(EntryCountThreshold))); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("hours", 100), ""), instanceOf(typeof(EntryTimespanThreshold))); assertThat(getThresholdByType(fsa, clock, new ThresholdConfigValue("days", 100_000), ""), instanceOf(typeof(EntryTimespanThreshold))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static Authentication createAuthentication(int maxFailedAttempts) throws Exception private static Authentication CreateAuthentication(int maxFailedAttempts) { UserRepository users = new InMemoryUserRepository(); PasswordPolicy policy = mock(typeof(PasswordPolicy)); Config config = Config.defaults(GraphDatabaseSettings.auth_max_failed_attempts, maxFailedAttempts.ToString()); BasicAuthManager manager = new BasicAuthManager(users, policy, Clocks.systemClock(), users, config); Authentication authentication = new BasicAuthentication(manager, manager); manager.NewUser("bob", UTF8.encode("secret"), true); manager.NewUser("mike", UTF8.encode("secret2"), false); return(authentication); }
/// <summary> /// Executes a number of stages simultaneously, letting the given {@code monitor} get insight into the /// execution. /// </summary> /// <param name="monitor"> <seealso cref="ExecutionMonitor"/> to get insight into the execution. </param> /// <param name="stage"> <seealso cref="Stage stages"/> to execute. </param> public static void SuperviseExecution(ExecutionMonitor monitor, Stage stage) { ExecutionSupervisor supervisor = new ExecutionSupervisor(Clocks.systemClock(), monitor); StageExecution execution = null; try { execution = stage.Execute(); supervisor.Supervise(execution); } finally { stage.Close(); if (execution != null) { execution.AssertHealthy(); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void setup(Dependencies dependencies) throws org.neo4j.internal.kernel.api.exceptions.KernelException public override void Setup(Dependencies dependencies) { Config config = dependencies.Config(); Procedures procedures = dependencies.Procedures(); LogProvider logProvider = dependencies.LogService().UserLogProvider; FileSystemAbstraction fileSystem = dependencies.FileSystem(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final UserRepository userRepository = getUserRepository(config, logProvider, fileSystem); UserRepository userRepository = GetUserRepository(config, logProvider, fileSystem); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final UserRepository initialUserRepository = getInitialUserRepository(config, logProvider, fileSystem); UserRepository initialUserRepository = GetInitialUserRepository(config, logProvider, fileSystem); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.api.security.PasswordPolicy passwordPolicy = new BasicPasswordPolicy(); PasswordPolicy passwordPolicy = new BasicPasswordPolicy(); _authManager = new BasicAuthManager(userRepository, passwordPolicy, Clocks.systemClock(), initialUserRepository, config); Life.add(dependencies.DependencySatisfier().satisfyDependency(_authManager)); procedures.RegisterComponent(typeof(UserManager), ctx => _authManager, false); procedures.RegisterProcedure(typeof(AuthProcedures)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldExplainBlockersOnCheckAvailable() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldExplainBlockersOnCheckAvailable() { // GIVEN DatabaseAvailabilityGuard databaseAvailabilityGuard = GetDatabaseAvailabilityGuard(Clocks.systemClock(), Instance); // At this point it should be available databaseAvailabilityGuard.CheckAvailable(); // WHEN databaseAvailabilityGuard.Require(_requirement_1); // THEN try { databaseAvailabilityGuard.CheckAvailable(); fail("Should not be available"); } catch (UnavailableException e) { assertThat(e.Message, containsString(_requirement_1())); } }
public MaximumTotalTime(long time, TimeUnit timeUnit) : this(time, timeUnit, Clocks.systemClock()) { }
public MasterServer(Master requestTarget, LogProvider logProvider, Configuration config, TxChecksumVerifier txVerifier, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor, ConversationManager conversationManager, LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) : base(requestTarget, config, logProvider, FrameLength, CURRENT, txVerifier, Clocks.systemClock(), byteCounterMonitor, requestMonitor) { this._conversationManager = conversationManager; this._requestTypes = new HaRequestType210(entryReader, MasterClient320.LOCK_RESULT_OBJECT_SERIALIZER); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Setup() { _manager = new BasicAuthManager(new InMemoryUserRepository(), new BasicPasswordPolicy(), Clocks.systemClock(), new InMemoryUserRepository(), Config.defaults()); _manager.init(); _manager.start(); _manager.newUser("johan", password("bar"), false); _context = _manager.login(authToken("johan", "bar")).authorize(s => - 1, GraphDatabaseSettings.DEFAULT_DATABASE_NAME); }
public SlaveServer(Slave requestTarget, Configuration config, LogProvider logProvider, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor) : base(requestTarget, config, logProvider, DEFAULT_FRAME_LENGTH, SlaveProtocolVersion, ALWAYS_MATCH, Clocks.systemClock(), byteCounterMonitor, requestMonitor) { }
public ExecutionSupervisor(ExecutionMonitor monitor) : this(Clocks.systemClock(), monitor) { }
internal MockedLockLockManager(LockManagerImplTest outerInstance, RagManager ragManager, RWLock @lock) : base(ragManager, Config.defaults(), Clocks.systemClock()) { this._outerInstance = outerInstance; this.Lock = @lock; }
private LockManagerImpl CreateLockManager() { return(new LockManagerImpl(new RagManager(), Config.defaults(), Clocks.systemClock())); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: public BackupServer(org.neo4j.backup.TheBackupInterface requestTarget, final org.neo4j.helpers.HostnamePort server, org.neo4j.logging.LogProvider logProvider, org.neo4j.kernel.monitoring.ByteCounterMonitor byteCounterMonitor, org.neo4j.com.monitor.RequestMonitor requestMonitor) public BackupServer(TheBackupInterface requestTarget, HostnamePort server, LogProvider logProvider, ByteCounterMonitor byteCounterMonitor, RequestMonitor requestMonitor) : base(requestTarget, NewBackupConfig(FrameLength, server), logProvider, FrameLength, BackupProtocolVersion, ALWAYS_MATCH, Clocks.systemClock(), byteCounterMonitor, requestMonitor) { }
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); }
public MultiExecutionMonitor(params ExecutionMonitor[] monitors) : this(Clocks.systemClock(), monitors) { }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected org.neo4j.causalclustering.core.consensus.log.RaftLog createRaftLog() throws Throwable protected internal override RaftLog CreateRaftLog() { FileSystemAbstraction fsa = FsRule.get(); File directory = new File(RAFT_LOG_DIRECTORY_NAME); fsa.Mkdir(directory); long rotateAtSizeBytes = 128; int readerPoolSize = 8; LogProvider logProvider = Instance; CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory(raft_log_pruning_strategy.DefaultValue, logProvider)).newInstance(); SegmentedRaftLog newRaftLog = new SegmentedRaftLog(fsa, directory, rotateAtSizeBytes, new DummyRaftableContentSerializer(), logProvider, readerPoolSize, Clocks.systemClock(), new OnDemandJobScheduler(), pruningStrategy); newRaftLog.Init(); newRaftLog.Start(); return(newRaftLog); }
private SegmentedRaftLog CreateRaftLog(long rotateAtSize, string pruneStrategy) { if (_fileSystem == null) { _fileSystem = new EphemeralFileSystemAbstraction(); } File directory = new File(RAFT_LOG_DIRECTORY_NAME); _fileSystem.mkdir(directory); LogProvider logProvider = Instance; CoreLogPruningStrategy pruningStrategy = (new CoreLogPruningStrategyFactory(pruneStrategy, logProvider)).NewInstance(); SegmentedRaftLog newRaftLog = new SegmentedRaftLog(_fileSystem, directory, rotateAtSize, new DummyRaftableContentSerializer(), logProvider, 8, Clocks.systemClock(), new OnDemandJobScheduler(), pruningStrategy); _life.add(newRaftLog); _life.init(); _life.start(); return(newRaftLog); }