Пример #1
0
  //	@Test
  public void cacheTest()
      throws CollectionNotFoundException, CollectionModificationException,
          InvalidCatalogNameException {
    String owner = "CacheTestOwner";
    CatalogCollection cc =
        catalogService.getRootApplicationCollectionForUser(owner, partitionId, "cacheTest");
    int reads = 10000;
    Long millStart = System.currentTimeMillis();
    for (int i = 0; i <= reads; i++) {
      catalogService.getCollection(owner, partitionId, cc.getUniqueId());
    }
    LOG.info(reads + " reads : " + (System.currentTimeMillis() - millStart) + " ms");

    int writes = 1000;
    millStart = System.currentTimeMillis();
    List<String> uIds = new ArrayList<String>();
    for (int i = 0; i <= writes; i++) {
      uIds.add(
          catalogService
              .addCollection(owner, partitionId, "NewName" + i, cc.getUniqueId(), null, null)
              .getUniqueId());
    }
    LOG.info(writes + " writes : " + (System.currentTimeMillis() - millStart) + " ms");
    millStart = System.currentTimeMillis();
    for (String uuid : uIds) {
      for (int i = 0; i <= 100; i++) {
        catalogService.getCollection(owner, partitionId, uuid);
      }
    }
    LOG.info(
        100
            + " reads of "
            + writes
            + " elements : "
            + (System.currentTimeMillis() - millStart)
            + " ms");
  }
Пример #2
0
 private void readNested(CatalogCollection collection) {
   for (CatalogCollection nc : collection.getNestedCollections()) {
     readNested(nc);
   }
   log.append(collection.getPath() + "\n");
 }