@@ -0,0 +1,2903 @@
+/*%0A * Copyright 2015 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.kuujo.copycat.atomic;%0A%0Aimport net.jodah.concurrentunit.ConcurrentTestCase;%0Aimport net.kuujo.copycat.Copycat;%0Aimport net.kuujo.copycat.CopycatServer;%0Aimport net.kuujo.copycat.Node;%0Aimport net.kuujo.copycat.cluster.TestCluster;%0Aimport net.kuujo.copycat.cluster.TestMember;%0Aimport net.kuujo.copycat.cluster.TestMemberRegistry;%0Aimport net.kuujo.copycat.raft.log.Log;%0Aimport net.kuujo.copycat.raft.log.StorageLevel;%0Aimport org.testng.annotations.Test;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Async boolean test.%0A *%0A * @author %3Ca href=%22http://github.com/kuujo%22%3EJordan Halterman%3C/a%3E%0A */%0A@Test%0Apublic class AsyncBooleanTest extends ConcurrentTestCase %7B%0A%0A  /**%0A   * Tests setting and getting a value.%0A   */%0A  @SuppressWarnings(%22unchecked%22)%0A  public void testSetGet() throws Throwable %7B%0A    List%3CCopycat%3E copycats = createCopycats(3);%0A%0A    Copycat copycat = copycats.get(0);%0A%0A    Node node = copycat.create(%22/test%22).get();%0A    AsyncBoolean reference = node.create(AsyncBoolean.class).get();%0A%0A    expectResume();%0A    reference.get().thenAccept(result -%3E %7B%0A      threadAssertFalse(result);%0A      resume();%0A    %7D);%0A    await();%0A%0A    expectResume();%0A    reference.set(true).thenRun(this::resume);%0A    await();%0A%0A    expectResume();%0A    reference.get().thenAccept(result -%3E %7B%0A      threadAssertTrue(result);%0A      resume();%0A    %7D);%0A    await();%0A  %7D%0A%0A  /**%0A   * Creates a Copycat instance.%0A   */%0A  private List%3CCopycat%3E createCopycats(int nodes) throws Throwable %7B%0A    TestMemberRegistry registry = new TestMemberRegistry();%0A%0A    List%3CCopycat%3E copycats = new ArrayList%3C%3E();%0A%0A    expectResumes(nodes);%0A%0A    for (int i = 1; i %3C= nodes; i++) %7B%0A      TestCluster.Builder builder = TestCluster.builder()%0A        .withMemberId(i)%0A        .withRegistry(registry);%0A%0A      for (int j = 1; j %3C= nodes; j++) %7B%0A        builder.addMember(TestMember.builder()%0A          .withId(j)%0A          .withAddress(String.format(%22test-%25d%22, j))%0A          .build());%0A      %7D%0A%0A      Copycat copycat = CopycatServer.builder()%0A        .withCluster(builder.build())%0A        .withLog(Log.builder()%0A          .withStorageLevel(StorageLevel.MEMORY)%0A          .build())%0A        .build();%0A%0A      copycat.open().thenRun(this::resume);%0A%0A      copycats.add(copycat);%0A    %7D%0A%0A    await();%0A%0A    return copycats;%0A  %7D%0A%0A%7D%0A

Add basic AtomicBoolean test.