Package org.hivedb.meta.directory

Examples of org.hivedb.meta.directory.Directory


    return Hive.load(getConnectString(H2TestCase.TEST_DB), CachingDataSourceProvider.getInstance());
  }

  @Test
  public void testInsertPrimaryIndexKey() throws Exception {
    Directory d = getDirectory();
    Integer key = new Integer(43);
    Hive hive = getHive();
    Node firstNode = Atom.getFirst(hive.getNodes());
    d.insertPrimaryIndexKey(Atom.getFirst(hive.getNodes()), key);
    for (Integer id : Transform.map(semaphoreToId(), d.getKeySemamphoresOfPrimaryIndexKey(key)))
      assertEquals((Integer) firstNode.getId(), id);
  }
View Full Code Here


      assertEquals((Integer) firstNode.getId(), id);
  }

  @Test
  public void testInsertPrimaryIndexKeyMultipleNodes() throws Exception {
    Directory d = getDirectory();
    Hive hive = getHive();
    Integer key = new Integer(43);
    for (Node node : hive.getNodes())
      d.insertPrimaryIndexKey(node, key);
    Collection<Integer> nodeIds = Transform.map(semaphoreToId(), d.getKeySemamphoresOfPrimaryIndexKey(key));
    AssertUtils.assertUnique(nodeIds);
    assertEquals(hive.getNodes().size(), nodeIds.size());
  }
View Full Code Here

  }

  @Test
  public void testDeletePrimaryIndexKey() throws Exception {
    insertKeys(getHive());
    Directory d = getDirectory();
    for (String key : getPrimaryIndexOrResourceKeys()) {
      d.deletePrimaryIndexKey(key);
      assertEquals(0, d.getKeySemamphoresOfPrimaryIndexKey(key).size());
    }
  }
View Full Code Here

    }
  }

  @Test
  public void testDeletePrimaryIndexKeyMultipleNodes() throws Exception {
    Directory d = getDirectory();
    Hive hive = getHive();
    for (String key : getPrimaryIndexOrResourceKeys())
      for (Node node : hive.getNodes())
        d.insertPrimaryIndexKey(node, key);
    for (String key : getPrimaryIndexOrResourceKeys()) {
      d.deletePrimaryIndexKey(key);
      assertEquals(0, d.getKeySemamphoresOfPrimaryIndexKey(key).size());
    }
  }
View Full Code Here

  }

  @Test
  public void testGetNodeIdsOfPrimaryIndexKey() throws Exception {
    insertKeys(getHive());
    Directory d = getDirectory();
    for (String key : getPrimaryIndexOrResourceKeys())
      assertEquals(1, d.getKeySemamphoresOfPrimaryIndexKey(key).size());
  }
View Full Code Here

  }

  @Test
  public void testGetNodeIdsOfSecondaryIndexKeys() throws Exception {
    insertKeys(getHive());
    Directory d = getDirectory();
    assertTrue(d.getKeySemaphoresOfSecondaryIndexKey(nameIndex, secondaryKeyString).size() >= 1);
  }
View Full Code Here

  }

  @Test
  public void testGetKeySemaphoresOfSecondaryIndexKey() throws Exception {
    insertKeys(getHive());
    Directory d = getDirectory();
    assertEquals(1, d.getKeySemaphoresOfSecondaryIndexKey(nameIndex, secondaryKeyString).size());
  }
View Full Code Here

  }

  @Test
  public void testGetKeySemaphoresOfResourceIds() throws Exception {
    insertKeys(getHive());
    Directory d = getDirectory();
    for (String key : getPrimaryIndexOrResourceKeys())
      assertEquals(1, d.getKeySemaphoresOfResourceId(resource, key).size());
  }
View Full Code Here

    hive.addResource(resource);

    resource = hive.getPartitionDimension().getResource(resource.getName());

    insertKeys(getHive());
    Directory d = getDirectory();
    for (String key : getPrimaryIndexOrResourceKeys())
      assertEquals(1, d.getKeySemaphoresOfResourceId(resource, key).size());
  }
View Full Code Here

      assertEquals(1, d.getKeySemaphoresOfResourceId(resource, key).size());
  }

  @Test
  public void testGetPrimaryIndexKeysOfResourceId() throws Exception {
    Directory d = getDirectory();
    Hive hive = getHive();
    for (String key : getPrimaryIndexOrResourceKeys()) {
      d.insertPrimaryIndexKey(Atom.getFirstOrThrow(hive.getNodes()), key);
      d.insertResourceId(resource, key + 1, key);
      assertEquals(key, d.getPrimaryIndexKeyOfResourceId(resource, key + 1).toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.hivedb.meta.directory.Directory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.