internal virtual void InitRelationship(long relationshipReference, long reference, Read read, AssertOpen assertOpen) { Debug.Assert(relationshipReference != NO_ID); Init(reference, read, assertOpen); // Transaction state if (read.HasTxStateWithChanges()) { this._propertiesState = read.TxState().getRelationshipState(relationshipReference); this._txStateChangedProperties = this._propertiesState.addedAndChangedProperties(); } }
internal virtual void InitGraph(long reference, Read read, AssertOpen assertOpen) { Init(reference, read, assertOpen); // Transaction state if (read.HasTxStateWithChanges()) { this._propertiesState = read.TxState().GraphState; if (this._propertiesState != null) { this._txStateChangedProperties = this._propertiesState.addedAndChangedProperties(); } } }
private Read TxState(params Rel[] rels) { Read read = mock(typeof(Read)); if (rels.Length > 0) { TxState txState = new TxState(); foreach (Rel rel in rels) { txState.RelationshipDoCreate(rel.RelId, rel.Type, rel.SourceId, rel.TargetId); } when(read.HasTxStateWithChanges()).thenReturn(true); when(read.TxState()).thenReturn(txState); } return(read); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Setup() { _txState = mock(typeof(TransactionState)); Dictionary <int, Value> map = new Dictionary <int, Value>(); map[PROP_ID1] = Values.of("hi1"); map[PROP_ID2] = Values.of("hi2"); map[PROP_ID3] = Values.of("hi3"); _node = (new StubNodeCursor()).withNode(0, new long[] { LABEL_ID1, LABEL_ID2 }, map); _node.next(); _propertyCursor = new StubPropertyCursor(); Read readOps = mock(typeof(Read)); when(readOps.TxState()).thenReturn(_txState); IndexingService indexingService = mock(typeof(IndexingService)); IndexProxy indexProxy = mock(typeof(IndexProxy)); when(indexingService.getIndexProxy(any(typeof(SchemaDescriptor)))).thenReturn(indexProxy); when(indexingService.getRelatedIndexes(any(), anyInt(), any())).thenAnswer(invocationOnMock => { long[] labels = invocationOnMock.getArgument(0); int propertyKeyId = invocationOnMock.getArgument(1); ISet <SchemaDescriptor> descriptors = new HashSet <SchemaDescriptor>(); foreach (IndexDescriptor index in _indexes) { if (contains(labels, index.schema().keyId()) && contains(index.schema().PropertyIds, propertyKeyId)) { descriptors.add(index.schema()); } } return(descriptors); }); when(indexingService.getRelatedIndexes(any(), any(typeof(int[])), any())).thenAnswer(invocationOnMock => { long[] labels = invocationOnMock.getArgument(0); int[] propertyKeyIds = invocationOnMock.getArgument(1); ISet <SchemaDescriptor> descriptors = new HashSet <SchemaDescriptor>(); foreach (IndexDescriptor index in _indexes) { if (contains(labels, index.schema().keyId())) { bool containsAll = true; foreach (int propertyId in index.schema().PropertyIds) { containsAll &= contains(propertyKeyIds, propertyId); } if (containsAll) { descriptors.add(index.schema()); } } } return(descriptors); }); _indexTxUpdater = new IndexTxStateUpdater(readOps, indexingService); }