Ejemplo n.º 1
0
//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);
        }
Ejemplo n.º 2
0
 private void InitializeInstanceFields()
 {
     Dir   = TestDirectory.testDirectory(FsRule.get());
     Chain = RuleChain.outerRule(FsRule).around(Dir);
 }
Ejemplo n.º 3
0
 private void InitializeInstanceFields()
 {
     _fileNames  = new FileNames(_baseDir);
     _readerPool = spy(new ReaderPool(0, _logProvider, _fileNames, FsRule.get(), Clocks.fakeClock()));
 }
Ejemplo n.º 4
0
//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()
        {
            Config = Config.defaults();
            Users  = CommunitySecurityModule.GetUserRepository(Config, NullLogProvider.Instance, FsRule.get());
            UserRepository initUserRepository = CommunitySecurityModule.GetInitialUserRepository(Config, NullLogProvider.Instance, FsRule.get());

            _manager = new BasicAuthManager(Users, mock(typeof(PasswordPolicy)), _authStrategy, initUserRepository);
            _manager.init();
        }
Ejemplo n.º 5
0
 private void InitializeInstanceFields()
 {
     _fs           = FsRule.get();
     TestDirectory = TestDirectory.testDirectory(_fs);
 }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailIfNoRolesFileButManyUsersAndNonExistingDefaultAdmin() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailIfNoRolesFileButManyUsersAndNonExistingDefaultAdmin()
        {
            // Given
            UserRepository defaultAdminRepository = EnterpriseSecurityModule.GetDefaultAdminRepository(Config, NullLogProvider.Instance, FsRule.get());

            defaultAdminRepository.Start();
            defaultAdminRepository.Create((new User.Builder("foo", LegacyCredential.INACCESSIBLE)).withRequiredPasswordChange(false).build());
            defaultAdminRepository.Shutdown();

            Users.create(NewUser("jake", "abc123", false));
            Users.create(NewUser("jane", "123abc", false));

            Expect.expect(typeof(InvalidArgumentsException));
            Expect.expectMessage("No roles defined, and default admin user 'foo' does not exist. " + "Please use `neo4j-admin " + SetDefaultAdminCommand.COMMAND_NAME + "` to select a valid admin.");

            _manager.start();
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private MultiRealmAuthManager createAuthManager(boolean logSuccessfulAuthentications) throws Throwable
        private MultiRealmAuthManager CreateAuthManager(bool logSuccessfulAuthentications)
        {
            Log log = _logProvider.getLog(this.GetType());

            InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(Users, new InMemoryRoleRepository(), mock(typeof(PasswordPolicy)), _authStrategy, mock(typeof(JobScheduler)), CommunitySecurityModule.getInitialUserRepository(Config, NullLogProvider.Instance, FsRule.get()), EnterpriseSecurityModule.GetDefaultAdminRepository(Config, NullLogProvider.Instance, FsRule.get()));

            _manager = new MultiRealmAuthManager(internalFlatFileRealm, Collections.singleton(internalFlatFileRealm), new MemoryConstrainedCacheManager(), new SecurityLog(log), logSuccessfulAuthentications, false, Collections.emptyMap());

            _manager.init();
            return(_manager);
        }
Ejemplo n.º 8
0
//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()
        {
            Config        = Config.defaults();
            Users         = CommunitySecurityModule.getUserRepository(Config, NullLogProvider.Instance, FsRule.get());
            _authStrategy = mock(typeof(AuthenticationStrategy));
            _logProvider  = new AssertableLogProvider();

            _manager     = CreateAuthManager(true);
            _userManager = _manager.UserManager;
        }