Example #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);
        }
Example #2
0
        private static IndexDefineCommand Definitions(MutableObjectIntMap <string> names, MutableObjectIntMap <string> keys)
        {
            IndexDefineCommand definitions = new IndexDefineCommand();

            definitions.Init(names, keys);
            return(definitions);
        }