Package net.kuujo.copycat.internal.log

Examples of net.kuujo.copycat.internal.log.OperationEntry


    }
    log.delete();
  }

  public void testAppendEntries() throws Exception {
    Entry entry = new OperationEntry(1, "foo", "bar");
    assertEquals(log.appendEntries(entry, entry, entry), Arrays.asList(1L, 2L, 3L));
  }
View Full Code Here


    Entry entry = new OperationEntry(1, "foo", "bar");
    assertEquals(log.appendEntries(entry, entry, entry), Arrays.asList(1L, 2L, 3L));
  }

  public void testAppendEntry() throws Exception {
    assertEquals(log.appendEntry(new OperationEntry(1, "foo", "bar")), 1);
    assertEquals(log.appendEntry(new OperationEntry(1, "foo", "bar")), 2);
    assertEquals(log.appendEntry(new OperationEntry(1, "foo", "bar")), 3);
  }
View Full Code Here

  }

  @Test(expectedExceptions = IllegalStateException.class)
  public void testThrowsIllegalStateExceptionWhenClosed() throws Exception {
    log.close();
    log.appendEntry(new OperationEntry(1, "foo", "bar"));
  }
View Full Code Here

    assertEquals(log.firstIndex(), 3);
    assertEquals(log.lastIndex(), 5);
    SnapshotEntry entry = log.getEntry(3);
    assertEquals(entry.term(), 1);
    assertEquals("Hello world!", new String(entry.data()));
    OperationEntry entry2 = log.getEntry(4);
    assertEquals(entry2.term(), 1);
    assertEquals("bar", entry2.operation());
    OperationEntry entry3 = log.getEntry(5);
    assertEquals(entry3.term(), 1);
    assertEquals("baz", entry3.operation());
  }
View Full Code Here

    assertTrue(log.getEntry(3) instanceof OperationEntry);
  }

  public void testIsEmpty() {
    assertTrue(log.isEmpty());
    assertEquals(log.appendEntry(new OperationEntry(1, "foo", "bar")), 1);
    assertFalse(log.isEmpty());
  }
View Full Code Here

    assertTrue(log.lastEntry() instanceof ConfigurationEntry);
  }

  public void testSize() {
    long size = log.size();
    log.appendEntry(new OperationEntry(1, "foo", "bar"));
    assertNotEquals(size, size = log.size());
    log.appendEntry(new OperationEntry(1, "foo", "bar"));
    assertNotEquals(size, size = log.size());
    log.appendEntry(new OperationEntry(1, "foo", "bar"));
    assertNotEquals(size, size = log.size());
  }
View Full Code Here

      .withLocalMember(new Member("foo"))
      .withRemoteMembers(new Member("bar"), new Member("baz")), new byte[10]));
    log.appendEntry(new ConfigurationEntry(1, new ClusterConfig()
      .withLocalMember(new Member("foo"))
      .withRemoteMembers(new Member("bar"), new Member("baz"))));
    log.appendEntry(new OperationEntry(1, "foo", Arrays.asList("bar", "baz")));
    log.appendEntry(new OperationEntry(1, "bar", Arrays.asList("bar", "baz")));
    log.appendEntry(new OperationEntry(1, "baz", Arrays.asList("bar", "baz")));
  }
View Full Code Here

TOP

Related Classes of net.kuujo.copycat.internal.log.OperationEntry

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.