//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testIndexCommandCreationEnforcesLimit() public virtual void TestIndexCommandCreationEnforcesLimit() { // Given IndexDefineCommand idc = new IndexDefineCommand(); int count = IndexDefineCommand.HighestPossibleId; // When for (int i = 0; i < count; i++) { idc.GetOrAssignKeyId("key" + i); idc.GetOrAssignIndexNameId("index" + i); } // Then // it should break on too many try { idc.GetOrAssignKeyId("dropThatOverflows"); fail("IndexDefineCommand should not allow more than " + count + " indexes per transaction"); } catch (System.InvalidOperationException) { // wonderful } try { idc.GetOrAssignIndexNameId("dropThatOverflows"); fail("IndexDefineCommand should not allow more than " + count + " keys per transaction"); } catch (System.InvalidOperationException) { // wonderful } }
private IndexDefineCommand InitIndexDefineCommand(int nbrOfEntries) { IndexDefineCommand command = new IndexDefineCommand(); MutableObjectIntMap <string> indexNames = InitMap(nbrOfEntries); MutableObjectIntMap <string> keys = InitMap(nbrOfEntries); command.Init(indexNames, keys); return(command); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private boolean serialize(org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel, IndexDefineCommand command) throws java.io.IOException private bool Serialize(InMemoryClosableChannel channel, IndexDefineCommand command) { try { command.Serialize(channel); } catch (AssertionError) { return(true); } return(false); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailToWriteIndexDefineCommandIfMapIsLargerThanShort() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFailToWriteIndexDefineCommandIfMapIsLargerThanShort() { // GIVEN InMemoryClosableChannel channel = new InMemoryClosableChannel(1000); IndexDefineCommand command = new IndexDefineCommand(); MutableObjectIntMap <string> largeMap = InitMap(0xFFFF + 1); command.Init(largeMap, largeMap); // WHEN assertTrue(Serialize(channel, command)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteIndexDefineCommandIfMapWithinShortRange() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteIndexDefineCommandIfMapWithinShortRange() { // GIVEN InMemoryClosableChannel channel = new InMemoryClosableChannel(10_000); IndexDefineCommand command = InitIndexDefineCommand(300); // WHEN command.Serialize(channel); // THEN CommandReader commandReader = (new RecordStorageCommandReaderFactory()).byVersion(LogEntryVersion.CURRENT.byteCode()); IndexDefineCommand read = ( IndexDefineCommand )commandReader.Read(channel); assertEquals(command.IndexNameIdRange, read.IndexNameIdRange); assertEquals(command.KeyIdRange, read.KeyIdRange); }
public override bool Equals(object o) { if (this == o) { return(true); } if (o == null || this.GetType() != o.GetType()) { return(false); } if (!base.Equals(o)) { return(false); } IndexDefineCommand that = ( IndexDefineCommand )o; return(_nextIndexNameId.get() == that._nextIndexNameId.get() && _nextKeyId.get() == that._nextKeyId.get() && Objects.Equals(_indexNameIdRange, that._indexNameIdRange) && Objects.Equals(_keyIdRange, that._keyIdRange) && Objects.Equals(_idToIndexName, that._idToIndexName) && Objects.Equals(_idToKey, that._idToKey)); }