Upgrade to Atomix 2.0.0-raft-beta1

Change-Id: I9f3345eb0107ee0079fec8980542678ee9d6f01f
diff --git a/core/store/primitives/pom.xml b/core/store/primitives/pom.xml
index ee89881..1622751 100644
--- a/core/store/primitives/pom.xml
+++ b/core/store/primitives/pom.xml
@@ -70,7 +70,7 @@
         <dependency>
             <groupId>io.atomix</groupId>
             <artifactId>atomix</artifactId>
-            <version>2.0.0-alpha1</version>
+            <version>2.0.0-raft-beta1</version>
         </dependency>
 
         <dependency>
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageNamespaces.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageNamespaces.java
index 2db6aff..e0e3ad7 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageNamespaces.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StorageNamespaces.java
@@ -158,7 +158,6 @@
             .register(MemberId.class)
             .register(SessionId.class)
             .register(RaftMember.Type.class)
-            .register(RaftMember.Status.class)
             .register(Instant.class)
             .register(Configuration.class)
             .register(AtomixAtomicCounterMapOperations.class)
@@ -198,7 +197,6 @@
             .register(DefaultRaftMember.class)
             .register(MemberId.class)
             .register(RaftMember.Type.class)
-            .register(RaftMember.Status.class)
             .register(Instant.class)
             .register(Configuration.class)
             .register(AtomixAtomicCounterMapOperations.class)
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
index c1ea37c..c161c21 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/StoragePartitionServer.java
@@ -40,6 +40,7 @@
     private final Logger log = getLogger(getClass());
 
     private static final int MAX_ENTRIES_PER_LOG_SEGMENT = 32768;
+    private static final int MAX_SEGMENT_SIZE = 1024 * 1024 * 64;
     private final MemberId localMemberId;
     private final StoragePartition partition;
     private final Supplier<RaftServerProtocol> protocol;
@@ -102,6 +103,7 @@
                         .withSerializer(new AtomixSerializerAdapter(Serializer.using(StorageNamespaces.RAFT_STORAGE)))
                         .withDirectory(dataFolder)
                         .withMaxEntriesPerSegment(MAX_ENTRIES_PER_LOG_SEGMENT)
+                        .withMaxSegmentSize(MAX_SEGMENT_SIZE)
                         .build());
         StoragePartition.RAFT_SERVICES.forEach(builder::addService);
         return builder.build();
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorServiceTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorServiceTest.java
index d3b6343..f640a81 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorServiceTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorServiceTest.java
@@ -15,9 +15,11 @@
  */
 package org.onosproject.store.primitives.resources.impl;
 
+import java.util.concurrent.ScheduledExecutorService;
+
 import io.atomix.protocols.raft.ReadConsistency;
 import io.atomix.protocols.raft.cluster.MemberId;
-import io.atomix.protocols.raft.impl.RaftServerContext;
+import io.atomix.protocols.raft.impl.RaftContext;
 import io.atomix.protocols.raft.protocol.RaftServerProtocol;
 import io.atomix.protocols.raft.service.ServiceId;
 import io.atomix.protocols.raft.service.ServiceType;
@@ -64,7 +66,7 @@
         expect(context.serviceId()).andReturn(ServiceId.from(1)).anyTimes();
         expect(context.executor()).andReturn(mock(ThreadContext.class)).anyTimes();
 
-        RaftServerContext server = mock(RaftServerContext.class);
+        RaftContext server = mock(RaftContext.class);
         expect(server.getProtocol()).andReturn(mock(RaftServerProtocol.class));
 
         replay(context, server);
@@ -85,7 +87,8 @@
                         ReadConsistency.LINEARIZABLE,
                         5000,
                         context,
-                        server),
+                        server,
+                        mock(ScheduledExecutorService.class)),
                 System.currentTimeMillis()));
 
         try (SnapshotWriter writer = snapshot.openWriter()) {
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
index 7073bb5..e117ba5 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixTestBase.java
@@ -169,7 +169,6 @@
             .register(MemberId.class)
             .register(SessionId.class)
             .register(RaftMember.Type.class)
-            .register(RaftMember.Status.class)
             .register(Instant.class)
             .register(Configuration.class)
             .register(AtomixAtomicCounterMapOperations.class)
@@ -212,7 +211,6 @@
             .register(DefaultRaftMember.class)
             .register(MemberId.class)
             .register(RaftMember.Type.class)
-            .register(RaftMember.Status.class)
             .register(Instant.class)
             .register(Configuration.class)
             .register(byte[].class)
@@ -457,25 +455,9 @@
         }
 
         @Override
-        public Status getStatus() {
-            return Status.AVAILABLE;
-        }
-
-        @Override
         public Instant getLastUpdated() {
             return Instant.now();
         }
-
-        @Override
-        public void addStatusChangeListener(Consumer<Status> listener) {
-
-        }
-
-        @Override
-        public void removeStatusChangeListener(Consumer<Status> listener) {
-
-        }
-
         @Override
         public CompletableFuture<Void> promote() {
             return null;
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
index 44ebd52..2c46073 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixWorkQueueServiceTest.java
@@ -17,10 +17,11 @@
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.concurrent.ScheduledExecutorService;
 
 import io.atomix.protocols.raft.ReadConsistency;
 import io.atomix.protocols.raft.cluster.MemberId;
-import io.atomix.protocols.raft.impl.RaftServerContext;
+import io.atomix.protocols.raft.impl.RaftContext;
 import io.atomix.protocols.raft.protocol.RaftServerProtocol;
 import io.atomix.protocols.raft.service.ServiceId;
 import io.atomix.protocols.raft.service.ServiceType;
@@ -67,7 +68,7 @@
         expect(context.serviceId()).andReturn(ServiceId.from(1)).anyTimes();
         expect(context.executor()).andReturn(mock(ThreadContext.class)).anyTimes();
 
-        RaftServerContext server = mock(RaftServerContext.class);
+        RaftContext server = mock(RaftContext.class);
         expect(server.getProtocol()).andReturn(mock(RaftServerProtocol.class));
 
         replay(context, server);
@@ -80,7 +81,8 @@
                 ReadConsistency.LINEARIZABLE,
                 5000,
                 context,
-                server);
+                server,
+                mock(ScheduledExecutorService.class));
 
         AtomixWorkQueueService service = new AtomixWorkQueueService();
         service.init(context);
diff --git a/features/features.xml b/features/features.xml
index e4de0c5..be6ef0e 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -59,7 +59,7 @@
         <bundle>mvn:com.typesafe/config/1.2.1</bundle>
         <bundle>mvn:com.googlecode.concurrent-trees/concurrent-trees/2.6.0</bundle>
         <bundle>mvn:commons-io/commons-io/2.4</bundle>
-        <bundle>mvn:io.atomix/atomix/2.0.0-alpha1</bundle>
+        <bundle>mvn:io.atomix/atomix/2.0.0-raft-beta1</bundle>
 
         <bundle>mvn:org.glassfish.jersey.core/jersey-client/2.25.1</bundle>
 
diff --git a/lib/BUCK b/lib/BUCK
index bf389ca..ebb9494 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Wed, 19 Jul 2017 00:36:26 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Thu, 20 Jul 2017 00:11:06 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 pass_thru_pom(
@@ -178,10 +178,10 @@
 
 remote_jar (
   name = 'atomix',
-  out = 'atomix-2.0.0-alpha1.jar',
-  url = 'mvn:io.atomix:atomix:jar:2.0.0-alpha1',
-  sha1 = '8693b1c112a393ed5c57de3fa385e22c1206b672',
-  maven_coords = 'io.atomix:atomix:2.0.0-alpha1',
+  out = 'atomix-2.0.0-raft-beta1.jar',
+  url = 'mvn:io.atomix:atomix:jar:2.0.0-raft-beta1',
+  sha1 = 'ecae1e33896035aff718e0bdf9030a32ab3f81a1',
+  maven_coords = 'io.atomix:atomix:2.0.0-raft-beta1',
   visibility = [ 'PUBLIC' ],
 )
 
diff --git a/lib/deps.json b/lib/deps.json
index 600ac69..b584496 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -112,7 +112,7 @@
     "aopalliance-repackaged": "mvn:org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b32",
     "amqp-client": "mvn:com.rabbitmq:amqp-client:jar:3.6.1",
     "asm": "mvn:org.ow2.asm:asm:5.0.4",
-    "atomix": "mvn:io.atomix:atomix:2.0.0-alpha1",
+    "atomix": "mvn:io.atomix:atomix:2.0.0-raft-beta1",
     "commons-codec": "mvn:commons-codec:commons-codec:1.10",
     "commons-collections": "mvn:commons-collections:commons-collections:3.2.2",
     "commons-configuration": "mvn:commons-configuration:commons-configuration:1.10",