Package org.hivedb

Examples of org.hivedb.Hive


  // TODO There is no guarantee that records get assigned to different nodes, causes intermittent failures
  @Test
  public void shouldThrowAnExceptionIfARecordIsStoredOnMoreThanOneNode() throws Exception {
    final Assigner assigner = context.mock(Assigner.class);
    final Hive hive = Hive.load(getHive().getUri(), (HiveDataSourceProvider) getHive().getDataSourceProvider(), assigner);
    context.checking(new Expectations() {
      {
        exactly(2).of(assigner).chooseNode(with(any(Collection.class)), with(anything()));
        will(onConsecutiveCalls(returnValue(hive.getNode(1)), returnValue(hive.getNode(2))));
      }
    });

    String asia = "Asia";
    hive.directory().insertPrimaryIndexKey(asia);
    hive.directory().insertPrimaryIndexKey(asia);

    context.assertIsSatisfied(); //asserts that this is no longer probabalistic

    Session session = null;
    try {
      session = factory.openSession(asia);
      Collection<Integer> nodeIds = hive.directory().getNodeIdsOfPrimaryIndexKey(asia);
      assertEquals(2, nodeIds.size());
      Node node = getNodeForFirstId(hive, nodeIds);
      assertCorrectNode(session, node);
      fail("No exception thrown");
    } catch (IllegalStateException e) {
View Full Code Here

TOP

Related Classes of org.hivedb.Hive

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.