コード例 #1
0
  @Test
  public void shouldListRemovedLabels() throws Exception {
    // Given
    state.nodeDoRemoveLabel(2, 1l);
    when(ops.labelGetName(2)).thenReturn("theLabel");

    // When
    Iterable<LabelEntry> labelEntries = snapshot().removedLabels();

    // Then
    LabelEntry entry = single(labelEntries);
    assertThat(entry.label().name(), equalTo("theLabel"));
    assertThat(entry.node().getId(), equalTo(1l));
  }
コード例 #2
0
  @Test
  public void shouldListAddedLabels() throws Exception {
    // Given
    state.nodeDoAddLabel(2, 1l);
    when(ops.labelGetName(2)).thenReturn("theLabel");
    when(ops.nodeGetLabels(1l)).thenReturn(PrimitiveIntCollections.emptyIterator());

    // When
    Iterable<LabelEntry> labelEntries = snapshot().assignedLabels();

    // Then
    LabelEntry entry = single(labelEntries);
    assertThat(entry.label().name(), equalTo("theLabel"));
    assertThat(entry.node().getId(), equalTo(1l));
  }
コード例 #3
0
  @Test
  public void showsDeletedNodes() throws Exception {
    // Given
    state.nodeDoDelete(1l);
    state.nodeDoDelete(2l);
    when(ops.nodeGetAllProperties(1l)).thenReturn(IteratorUtil.<DefinedProperty>emptyIterator());
    when(ops.nodeGetAllProperties(2l))
        .thenReturn(asList(Property.stringProperty(1, "p")).iterator());
    when(ops.nodeGetLabels(1l)).thenReturn(PrimitiveIntCollections.emptyIterator());
    when(ops.nodeGetLabels(2l)).thenReturn(PrimitiveIntCollections.iterator(15));
    when(ops.propertyKeyGetName(1)).thenReturn("key");
    when(ops.labelGetName(15)).thenReturn("label");

    // When & Then
    TxStateTransactionDataSnapshot snapshot = snapshot();
    assertThat(idList(snapshot.deletedNodes()), equalTo(asList(1l, 2l)));
    assertThat(single(snapshot.removedLabels()).label().name(), equalTo("label"));
    assertThat(single(snapshot.removedNodeProperties()).key(), equalTo("key"));
  }
コード例 #4
0
 @Override
 public String labelGetName(Statement state, int labelId) throws LabelNotFoundKernelException {
   return storeLayer.labelGetName(labelId);
 }