コード例 #1
0
 private int createNewPropertyKeyId(String stringKey) {
   PropertyKeyTokenStore idxStore = getPropertyKeyTokenStore();
   int keyId = (int) idxStore.nextId();
   PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(keyId);
   record.setInUse(true);
   record.setCreated();
   Collection<DynamicRecord> keyRecords = idxStore.allocateNameRecords(encodeString(stringKey));
   record.setNameId((int) first(keyRecords).getId());
   record.addNameRecords(keyRecords);
   idxStore.updateRecord(record);
   propertyKeyTokens.addToken(stringKey, keyId);
   return keyId;
 }
コード例 #2
0
  @Test
  public void shouldReportEmptyName() throws Exception {
    // given
    PropertyKeyTokenRecord key = inUse(new PropertyKeyTokenRecord(42));
    DynamicRecord name = addKeyName(inUse(new DynamicRecord(6)));
    key.setNameId((int) name.getId());

    // when
    ConsistencyReport.PropertyKeyTokenConsistencyReport report = check(key);

    // then
    verify(report).emptyName(name);
    verifyNoMoreInteractions(report);
  }
コード例 #3
0
  @Test
  public void shouldNotReportAnythingForConsistentlyChangedRecord() throws Exception {
    // given
    PropertyKeyTokenRecord oldRecord = notInUse(new PropertyKeyTokenRecord(42));
    PropertyKeyTokenRecord newRecord = inUse(new PropertyKeyTokenRecord(42));
    DynamicRecord name = addKeyName(inUse(new DynamicRecord(6)));
    name.setData(new byte[1]);
    newRecord.setNameId((int) name.getId());

    // when
    ConsistencyReport.PropertyKeyTokenConsistencyReport report = checkChange(oldRecord, newRecord);

    // then
    verifyNoMoreInteractions(report);
  }
コード例 #4
0
  @Test
  public void shouldReportProblemsWithTheNewStateWhenCheckingChanges() throws Exception {
    // given
    PropertyKeyTokenRecord oldRecord = notInUse(new PropertyKeyTokenRecord(42));
    PropertyKeyTokenRecord newRecord = inUse(new PropertyKeyTokenRecord(42));
    DynamicRecord name = addKeyName(notInUse(new DynamicRecord(6)));
    newRecord.setNameId((int) name.getId());

    // when
    ConsistencyReport.PropertyKeyTokenConsistencyReport report = checkChange(oldRecord, newRecord);

    // then
    verify(report).nameBlockNotInUse(name);
    verifyNoMoreInteractions(report);
  }
コード例 #5
0
 PropertyKey(PropertyKeyTokenRecord record) {
   this.id = record.getId();
 }
コード例 #6
0
ファイル: Command.java プロジェクト: naimdjon/neo4j
 @Override
 public String toString() {
   return record.toString();
 }
コード例 #7
0
ファイル: Command.java プロジェクト: naimdjon/neo4j
 public PropertyKeyTokenCommand init(PropertyKeyTokenRecord record) {
   setup(record.getId(), Mode.fromRecordState(record));
   this.record = record;
   return this;
 }