Merge "Add unit test for Instructions class and improve Criteria toString() test"
diff --git a/core/store/dist/pom.xml b/core/store/dist/pom.xml
index 846583f..248e763 100644
--- a/core/store/dist/pom.xml
+++ b/core/store/dist/pom.xml
@@ -43,24 +43,25 @@
             <artifactId>onlab-netty</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+<!--
        <dependency>
             <groupId>net.kuujo.copycat</groupId>
             <artifactId>copycat</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>${copycat.version}</version>
         </dependency>
 
         <dependency>
             <groupId>net.kuujo.copycat</groupId>
             <artifactId>copycat-chronicle</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>${copycat.version}</version>
         </dependency>
 
         <dependency>
             <groupId>net.kuujo.copycat</groupId>
             <artifactId>copycat-tcp</artifactId>
-            <version>0.4.0-SNAPSHOT</version>
+            <version>${copycat.version}</version>
         </dependency>
+-->
 
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
@@ -95,6 +96,12 @@
           <groupId>com.hazelcast</groupId>
           <artifactId>hazelcast</artifactId>
         </dependency>
+
+        <!-- for shaded copycat -->
+        <dependency>
+          <groupId>org.onlab.onos</groupId>
+          <artifactId>onlab-thirdparty</artifactId>
+        </dependency>
     </dependencies>
 
 </project>
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/ClusterMessagingProtocol.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/ClusterMessagingProtocol.java
index 6de66bc..c561221 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/ClusterMessagingProtocol.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/ClusterMessagingProtocol.java
@@ -64,7 +64,8 @@
  */
 @Component(immediate = true)
 @Service
-public class ClusterMessagingProtocol implements Protocol<TcpMember> {
+public class ClusterMessagingProtocol
+    implements DatabaseProtocolService, Protocol<TcpMember> {
 
     private final Logger log = getLogger(getClass());
 
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
index 7db4bc7..183a6db 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
@@ -11,9 +11,8 @@
 import net.kuujo.copycat.cluster.TcpCluster;
 import net.kuujo.copycat.cluster.TcpClusterConfig;
 import net.kuujo.copycat.cluster.TcpMember;
-import net.kuujo.copycat.log.ChronicleLog;
+import net.kuujo.copycat.log.InMemoryLog;
 import net.kuujo.copycat.log.Log;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -52,7 +51,7 @@
     protected ClusterService clusterService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected ClusterMessagingProtocol copycatMessagingProtocol;
+    protected DatabaseProtocolService copycatMessagingProtocol;
 
     public static final String LOG_FILE_PREFIX = "onos-copy-cat-log";
 
@@ -61,6 +60,7 @@
 
     @Activate
     public void activate() {
+        log.info("Starting.");
 
         // TODO: Not every node can be part of the consensus ring.
 
@@ -88,7 +88,9 @@
 
         StateMachine stateMachine = new DatabaseStateMachine();
         ControllerNode thisNode = clusterService.getLocalNode();
-        Log consensusLog = new ChronicleLog(LOG_FILE_PREFIX + "_" + thisNode.id());
+        // FIXME resolve Chronicle + OSGi issue
+        //Log consensusLog = new ChronicleLog(LOG_FILE_PREFIX + "_" + thisNode.id());
+        Log consensusLog = new InMemoryLog();
 
         copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol);
         copycat.start();
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseProtocolService.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseProtocolService.java
new file mode 100644
index 0000000..6d9f129
--- /dev/null
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseProtocolService.java
@@ -0,0 +1,10 @@
+package org.onlab.onos.store.service.impl;
+
+import net.kuujo.copycat.cluster.TcpMember;
+import net.kuujo.copycat.spi.protocol.Protocol;
+
+// interface required for connecting DatabaseManager + ClusterMessagingProtocol
+// TODO: Consider changing ClusterMessagingProtocol to non-Service class
+public interface DatabaseProtocolService extends Protocol<TcpMember> {
+
+}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/package-info.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/package-info.java
index d630870..5f65452 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/service/package-info.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/package-info.java
@@ -1,4 +1,21 @@
+/*
+ * Copyright 2014 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /**
  * Distributed core state management services.
  */
-package org.onlab.onos.store.service;
\ No newline at end of file
+package org.onlab.onos.store.service;
+
diff --git a/features/features.xml b/features/features.xml
index 2e0718f..0e7dfbf 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -56,9 +56,16 @@
         <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.13</bundle>
 
         <bundle>mvn:org.onlab.onos/onlab-thirdparty/1.0.0-SNAPSHOT</bundle>
-
-        <!-- FIXME fix the version before release -->
+<!-- FIXME: resolce Chronicle's dependency issue
+        <bundle>mvn:net.openhft/lang/6.4.6</bundle>
+        <bundle>mvn:net.openhft/affinity/2.1.1</bundle>
+        <bundle>mvn:net.openhft/chronicle/3.2.2</bundle>
+-->
+<!-- things used before shading copycat
         <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat&amp;Bundle-Version=0.4.0.SNAPSHOT</bundle>
+        <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat-tcp/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat-tcp&amp;Bundle-Version=0.4.0.SNAPSHOT</bundle>
+        <bundle>wrap:mvn:http://mavenrepo.onlab.us:8081/nexus/content/groups/public@id=onlab-temp!net.kuujo.copycat/copycat-chronicle/0.4.0-SNAPSHOT$Bundle-SymbolicName=net.kuujo.copycat.copycat-chronicle&amp;Bundle-Version=0.4.0.SNAPSHOT</bundle>
+-->
     </feature>
 
     <feature name="onos-thirdparty-web" version="1.0.0"
diff --git a/openflow/api/pom.xml b/openflow/api/pom.xml
index a6dedd6..9e63684 100644
--- a/openflow/api/pom.xml
+++ b/openflow/api/pom.xml
@@ -36,7 +36,7 @@
             <groupId>org.projectfloodlight</groupId>
             <artifactId>openflowj</artifactId>
             <!-- FIXME once experimenter gets merged to upstream -->
-            <version>0.3.8-optical_experimenter4</version>
+            <version>0.3.8-optical_experimenter5</version>
         </dependency>
         <dependency>
             <groupId>io.netty</groupId>
diff --git a/pom.xml b/pom.xml
index 7a81539..ee2a3bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <netty4.version>4.0.23.Final</netty4.version>
+        <copycat.version>0.4.0-SNAPSHOT</copycat.version>
     </properties>
 
     <repositories>
diff --git a/utils/thirdparty/pom.xml b/utils/thirdparty/pom.xml
index 882b374..164f7c8 100644
--- a/utils/thirdparty/pom.xml
+++ b/utils/thirdparty/pom.xml
@@ -37,6 +37,32 @@
       <artifactId>concurrent-trees</artifactId>
       <version>2.4.0</version>
     </dependency>
+
+        <dependency>
+            <groupId>net.kuujo.copycat</groupId>
+            <artifactId>copycat</artifactId>
+            <version>${copycat.version}</version>
+        </dependency>
+<!-- Commented out due to Chronicle + OSGi issue 
+        <dependency>
+            <groupId>net.kuujo.copycat</groupId>
+            <artifactId>copycat-chronicle</artifactId>
+            <version>${copycat.version}</version>
+        </dependency>
+-->
+        <dependency>
+            <groupId>net.kuujo.copycat</groupId>
+            <artifactId>copycat-tcp</artifactId>
+            <version>${copycat.version}</version>
+        </dependency>
+
+<!-- chronicle transitive dependency
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+-->
   </dependencies>
 
   <build>
@@ -47,19 +73,36 @@
         <version>2.3</version>
         <configuration>
           <filters>
+
             <filter>
               <artifact>com.googlecode.concurrent-trees:concurrent-trees</artifact>
               <includes>
                 <include>com/googlecode/**</include>
               </includes>
-              
             </filter>
+
             <filter>
               <artifact>com.google.guava:guava</artifact>
               <excludes>
                 <exclude>**</exclude>
               </excludes>
             </filter>
+
+            <filter>
+              <artifact>net.kuujo.copycat:*</artifact>
+              <includes>
+                <include>net/kuujo/copycat/**</include>
+              </includes>
+            </filter>
+<!-- chronicle transitive dependency
+
+            <filter>
+              <artifact>net.java.dev.jna:*</artifact>
+              <includes>
+                <include>com/sun/jna/**</include>
+              </includes>
+            </filter>
+-->
           </filters>
         </configuration>
         <executions>
@@ -70,14 +113,14 @@
             </goals>
           </execution>
         </executions>
-      </plugin>            
+      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
             <Export-Package>
-              com.googlecode.concurrenttrees.*
+              com.googlecode.concurrenttrees.*;net.kuujo.copycat.*
             </Export-Package>
           </instructions>
         </configuration>