//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Before()
        {
            CollectionsFactory = Mockito.spy(new TestCollectionsFactory(this));
            when(HeaderInformation.AdditionalHeader).thenReturn(new sbyte[0]);
            when(HeaderInformationFactory.create()).thenReturn(HeaderInformation);
            when(NeoStores.MetaDataStore).thenReturn(MetaDataStore);
            when(StorageEngine.newReader()).thenReturn(ReadLayer);
            doAnswer(invocation => ((ICollection <StorageCommand>)invocation.getArgument(0)).Add(new Command.RelationshipCountsCommand(1, 2, 3, 4L))).when(StorageEngine).createCommands(anyCollection(), any(typeof(ReadableTransactionState)), any(typeof(StorageReader)), any(typeof(ResourceLocker)), anyLong(), any(typeof(Org.Neo4j.Storageengine.Api.txstate.TxStateVisitor_Decorator)));
        }
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 shouldThrowExceptionOnRelationshipDuplicateRuleFound() throws org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException, org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionOnRelationshipDuplicateRuleFound()
        {
            // GIVEN
            TokenNameLookup tokenNameLookup = DefaultTokenNameLookup;

            SchemaStorage schemaStorageSpy = Mockito.spy(_storage);

            Mockito.when(schemaStorageSpy.LoadAllSchemaRules(any(), any(), anyBoolean())).thenReturn(Iterators.iterator(GetRelationshipPropertyExistenceConstraintRule(1L, TYPE1, PROP1), GetRelationshipPropertyExistenceConstraintRule(2L, TYPE1, PROP1)));

            //EXPECT
            ExpectedException.expect(typeof(DuplicateSchemaRuleException));
            ExpectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple relationship property existence constraints found for -[:Type1(prop1)]-."));

            // WHEN
            schemaStorageSpy.ConstraintsGetSingle(ConstraintDescriptorFactory.existsForRelType(TypeId(TYPE1), PropId(PROP1)));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionOnNodeDuplicateRuleFound() throws org.neo4j.kernel.api.exceptions.schema.DuplicateSchemaRuleException, org.neo4j.kernel.api.exceptions.schema.SchemaRuleNotFoundException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionOnNodeDuplicateRuleFound()
        {
            // GIVEN
            TokenNameLookup tokenNameLookup = DefaultTokenNameLookup;

            SchemaStorage schemaStorageSpy = Mockito.spy(_storage);

            Mockito.when(schemaStorageSpy.LoadAllSchemaRules(any(), any(), anyBoolean())).thenReturn(Iterators.iterator(GetUniquePropertyConstraintRule(1L, LABEL1, PROP1), GetUniquePropertyConstraintRule(2L, LABEL1, PROP1)));

            //EXPECT
            ExpectedException.expect(typeof(DuplicateSchemaRuleException));
            ExpectedException.expect(new KernelExceptionUserMessageMatcher(tokenNameLookup, "Multiple uniqueness constraints found for :Label1(prop1)."));

            // WHEN
            schemaStorageSpy.ConstraintsGetSingle(ConstraintDescriptorFactory.uniqueForLabel(LabelId(LABEL1), PropId(PROP1)));
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotRenewTheTimeoutIfInPanicState()
        public virtual void ShouldNotRenewTheTimeoutIfInPanicState()
        {
            // given
            _txPuller.start();
            CatchUpResponseCallback callback = mock(typeof(CatchUpResponseCallback));

            doThrow(new Exception("Panic all the things")).when(callback).onTxPullResponse(any(typeof(CompletableFuture)), any(typeof(TxPullResponse)));
            Timer timer = Mockito.spy(single(_timerService.getTimers(TX_PULLER_TIMER)));

            // when
            _timerService.invoke(TX_PULLER_TIMER);

            // then
            assertEquals(PANIC, _txPuller.state());
            verify(timer, never()).reset();
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void doNotRemoveRelativeTransactionDirectoryAgain() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DoNotRemoveRelativeTransactionDirectoryAgain()
        {
            FileSystemAbstraction fileSystem = Mockito.spy(FileSystemRule.get());
            File fromPath             = Directory.directory("from");
            File databaseFile         = Directory.directory();
            File relativeLogDirectory = Directory.directory("relativeDirectory");

            Config config = Config.defaults(GraphDatabaseSettings.database_path, databaseFile.AbsolutePath);

            config.augment(GraphDatabaseSettings.logical_logs_location, relativeLogDirectory.AbsolutePath);

            CreateDbAt(fromPath, 10);

            (new RestoreDatabaseCommand(fileSystem, fromPath, config, "testDatabase", true)).Execute();

            verify(fileSystem).deleteRecursively(eq(databaseFile));
            verify(fileSystem, never()).deleteRecursively(eq(relativeLogDirectory));
        }