Esempio n. 1
0
  @Test
  public void shouldSearchExistingFlwsAndUpdateFlw() {
    Flw toBeUpdatedFlw =
        flw(
            "5ba9a0928dde95d187544babf6c0ad24",
            "FirstName1",
            flwGroupWithNameAndId("64a9a0928dde95d187544babf6c0ad38", "oldGroupName"));
    Flw notToBeUpdateFlw = flw("5ba9a0928dde95d187544babf6c0ad25", "FirstName2", new FlwGroup());
    template.saveOrUpdateAll(Arrays.asList(toBeUpdatedFlw, notToBeUpdateFlw));

    Flw newFlw =
        flw(
            "5ba9a0928dde95d187544babf6c0ad24",
            "FirstName3",
            flwGroupWithNameAndId("38a9a0928dde95d187544babf6c0ad64", "newGroupName"));
    ArrayList<Flw> flwsToUpdate = new ArrayList<>();
    flwsToUpdate.add(newFlw);

    careService.saveOrUpdateAllByExternalPrimaryKey(Flw.class, flwsToUpdate);

    Flw updatedFlw = template.load(Flw.class, toBeUpdatedFlw.getId());
    assertReflectionEqualsWithIgnore(
        newFlw, updatedFlw, new String[] {"id", "creationTime", "lastModifiedTime"});
    assertDateIgnoringSeconds(new Date(), updatedFlw.getCreationTime());
    assertDateIgnoringSeconds(new Date(), updatedFlw.getLastModifiedTime());

    Flw unchangedFlw = template.load(Flw.class, notToBeUpdateFlw.getId());
    assertEquals("FirstName2", unchangedFlw.getFirstName());
  }
  @Test
  public void testGetSliceFromLarge() throws Throwable {
    // tests slicing against 1000 columns in an sstable
    Table table = Table.open("Keyspace1");
    ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1");
    String key = "row3";
    RowMutation rm = new RowMutation("Keyspace1", key);
    ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard1");
    for (int i = 1000; i < 2000; i++) cf.addColumn(column("col" + i, ("v" + i), 1L));
    rm.add(cf);
    rm.apply();
    cfStore.forceBlockingFlush();

    validateSliceLarge(cfStore);
    // compact so we have a big row with more than the minimum index count
    if (cfStore.getSSTables().size() > 1) {
      CompactionManager.instance.submitMajor(cfStore).get();
    }
    SSTableReader sstable = cfStore.getSSTables().iterator().next();
    DecoratedKey decKey = sstable.getPartitioner().decorateKey(key);
    SSTable.PositionSize info = sstable.getPosition(decKey);
    BufferedRandomAccessFile file = new BufferedRandomAccessFile(sstable.getFilename(), "r");
    file.seek(info.position);
    assert file.readUTF().equals(key);
    file.readInt();
    IndexHelper.skipBloomFilter(file);
    ArrayList<IndexHelper.IndexInfo> indexes = IndexHelper.deserializeIndex(file);
    assert indexes.size() > 2;
    validateSliceLarge(cfStore);
  }
Esempio n. 3
0
 static {
   tmp.add("/sam/test_2.sam");
   filenamesTryIndex = tmp.toArray(new String[tmp.size()]);
 }