Beispiel #1
0
            public override void Registered(NeoStoreDataSource ds)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final StoreSizeProvider dataProvider = new StoreSizeProvider(fs, ds);
                StoreSizeProvider dataProvider = new StoreSizeProvider(Fs, ds);

                this.Delegate = newThrottlingBeanSnapshotProxy(typeof(StoreSize), dataProvider, UpdateInterval, Clock);
            }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setUp() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void SetUp()
        {
            _logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_testDirectory.databaseDir(), _fs).build();

            Dependencies       dependencies      = new Dependencies();
            Config             config            = Config.defaults(default_schema_provider, _indexProvider.ProviderDescriptor.name());
            DataSourceManager  dataSourceManager = new DataSourceManager(config);
            GraphDatabaseAPI   db         = mock(typeof(GraphDatabaseAPI));
            NeoStoreDataSource dataSource = mock(typeof(NeoStoreDataSource));

            dependencies.SatisfyDependency(_indexProvider);
            dependencies.SatisfyDependency(_indexProvider2);

            DefaultIndexProviderMap indexProviderMap = new DefaultIndexProviderMap(dependencies, config);

            indexProviderMap.Init();

            // Setup all dependencies
            dependencies.SatisfyDependency(_fs);
            dependencies.SatisfyDependencies(dataSourceManager);
            dependencies.SatisfyDependency(_logFiles);
            dependencies.SatisfyDependency(_explicitIndexProviderLookup);
            dependencies.SatisfyDependency(indexProviderMap);
            dependencies.SatisfyDependency(_labelScanStore);
            when(Db.DependencyResolver).thenReturn(dependencies);
            when(dataSource.DependencyResolver).thenReturn(dependencies);
            when(dataSource.DatabaseLayout).thenReturn(_testDirectory.databaseLayout());

            // Start DataSourceManager
            dataSourceManager.Register(dataSource);
            dataSourceManager.Start();

            // Create bean
            KernelData kernelData = new KernelData(_fs, mock(typeof(PageCache)), _testDirectory.databaseDir(), config, dataSourceManager);

            _managementData = new ManagementData(new StoreSizeBean(), kernelData, ManagementSupport.Load());
            _storeSizeBean  = StoreSizeBean.CreateBean(_managementData, false, 0, mock(typeof(Clock)));

            when(_indexProvider.directoryStructure()).thenReturn(mock(typeof(IndexDirectoryStructure)));
            when(_indexProvider2.directoryStructure()).thenReturn(mock(typeof(IndexDirectoryStructure)));
            when(_labelScanStore.LabelScanStoreFile).thenReturn(_testDirectory.databaseLayout().labelScanStore());
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldCacheValues() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldCacheValues()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.time.Clock clock = mock(java.time.Clock.class);
            Clock clock = mock(typeof(Clock));

            _storeSizeBean = StoreSizeBean.CreateBean(_managementData, false, 100, clock);
            when(clock.millis()).thenReturn(100L);

            CreateFileOfSize(_logFiles.getLogFileForVersion(0), 1);
            CreateFileOfSize(_logFiles.getLogFileForVersion(1), 2);

            Assert.assertEquals(3L, _storeSizeBean.TransactionLogsSize);

            CreateFileOfSize(_logFiles.getLogFileForVersion(2), 3);
            CreateFileOfSize(_logFiles.getLogFileForVersion(3), 4);

            Assert.assertEquals(3L, _storeSizeBean.TransactionLogsSize);

            when(clock.millis()).thenReturn(200L);

            Assert.assertEquals(10L, _storeSizeBean.TransactionLogsSize);
        }
Beispiel #4
0
 public override void Unregistered(NeoStoreDataSource ds)
 {
     this.Delegate = NO_STORE_SIZE;
 }