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 shouldReadNoKeyIdAsMinusOne() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadNoKeyIdAsMinusOne()
        {
            // GIVEN
            InMemoryClosableChannel channel     = new InMemoryClosableChannel();
            IndexDefineCommand      definitions = new IndexDefineCommand();
            int indexNameId = 10;

            definitions.Init(ObjectIntHashMap.newWithKeysValues("myindex", indexNameId), new ObjectIntHashMap <string>());
            definitions.Serialize(channel);
            IndexCommand.RemoveCommand removeCommand = new IndexCommand.RemoveCommand();
            removeCommand.Init(indexNameId, IndexEntityType.Node.id(), 1234, -1, null);
            removeCommand.Serialize(channel);

            // WHEN
            PhysicalLogCommandReaderV2_2_4 reader = new PhysicalLogCommandReaderV2_2_4();

            assertTrue(reader.Read(channel) is IndexDefineCommand);
            IndexCommand.RemoveCommand readRemoveCommand = (IndexCommand.RemoveCommand)reader.Read(channel);

            // THEN
            assertEquals(removeCommand.IndexNameId, readRemoveCommand.IndexNameId);
            assertEquals(removeCommand.EntityType, readRemoveCommand.EntityType);
            assertEquals(removeCommand.EntityId, readRemoveCommand.EntityId);
            assertEquals(removeCommand.KeyId, readRemoveCommand.KeyId);
            assertNull(removeCommand.Value);
        }
Esempio n. 2
0
        private static AddNodeCommand AddNodeToIndex(IndexDefineCommand definitions, string indexName, long nodeId)
        {
            AddNodeCommand command = new AddNodeCommand();

            command.Init(definitions.GetOrAssignIndexNameId(indexName), nodeId, ( sbyte )0, "some value");
            return(command);
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleMultipleIdSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleMultipleIdSpaces()
        {
            // GIVEN
            string           indexName      = "name";
            string           key            = "key";
            DatabaseLayout   databaseLayout = _testDirectory.databaseLayout();
            IndexConfigStore configStore    = new IndexConfigStore(databaseLayout, _fs);

            configStore.Set(typeof(Node), indexName, EXACT_CONFIG);
            using (Lifespan lifespan = new Lifespan())
            {
                Config           dataSourceConfig   = Config.defaults(LuceneDataSource.Configuration.Ephemeral, Settings.TRUE);
                LuceneDataSource originalDataSource = new LuceneDataSource(databaseLayout, dataSourceConfig, configStore, _fs, OperationalMode.single);
                LuceneDataSource dataSource         = lifespan.Add(spy(originalDataSource));

                using (LuceneCommandApplier applier = new LuceneCommandApplier(dataSource, false))
                {
                    // WHEN issuing a command where the index name is mapped to a certain id
                    IndexDefineCommand definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 0), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 0L));
                    // and then later issuing a command for that same index, but in another transaction where
                    // the local index name id is a different one
                    definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 1), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 1L));
                }

                // THEN both those updates should have been directed to the same index
                verify(dataSource, times(1)).getIndexSearcher(any(typeof(IndexIdentifier)));
            }
        }
Esempio n. 4
0
        private static IndexDefineCommand Definitions(MutableObjectIntMap <string> names, MutableObjectIntMap <string> keys)
        {
            IndexDefineCommand definitions = new IndexDefineCommand();

            definitions.Init(names, keys);
            return(definitions);
        }
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 testVisitIndexDefineCommand() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestVisitIndexDefineCommand()
        {
            IndexDefineCommand cmd = mock(typeof(IndexDefineCommand));

            when(cmd.Handle(any(typeof(CommandVisitor)))).thenCallRealMethod();

            // WHEN
            bool result = _facade.visitIndexDefineCommand(cmd);

            // THEN
            InOrder inOrder = inOrder(_txApplier1, _txApplier2, _txApplier3);

            inOrder.verify(_txApplier1).visitIndexDefineCommand(cmd);
            inOrder.verify(_txApplier2).visitIndexDefineCommand(cmd);
            inOrder.verify(_txApplier3).visitIndexDefineCommand(cmd);

            inOrder.verifyNoMoreInteractions();

            assertFalse(result);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean visitIndexDefineCommand(org.neo4j.kernel.impl.index.IndexDefineCommand command) throws java.io.IOException
        public override bool VisitIndexDefineCommand(IndexDefineCommand command)
        {
            return(Visit(command));
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean visitIndexDefineCommand(org.neo4j.kernel.impl.index.IndexDefineCommand command) throws java.io.IOException
        public override bool VisitIndexDefineCommand(IndexDefineCommand command)
        {
            return(Delegate.visitIndexDefineCommand(command));
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public boolean visitIndexDefineCommand(org.neo4j.kernel.impl.index.IndexDefineCommand command) throws java.io.IOException
        public override bool VisitIndexDefineCommand(IndexDefineCommand command)
        {
            return(false);
        }