ONOS-6468 Fix for race condition between compilation and installation complete state.

- Fix for a bug where intent compilation complete state,
  can overwrites intent installation complete state,
  if intent installation completes before compilation complete state is written to the store.
  - Introduced internalState version on IntentData,
    which is effectively mutation count, in order to avoid
    batch write of compilation result overwriting installation result

Change-Id: I5d77dfbe496e690ebdf2b4f9643d2b64c4233182
diff --git a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
index 95dd0cc..9c64691 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/intent/impl/GossipIntentStoreTest.java
@@ -21,6 +21,7 @@
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.cfg.ConfigProperty;
 import org.onosproject.cluster.ClusterServiceAdapter;
+import org.onosproject.cluster.NodeId;
 import org.onosproject.net.intent.AbstractIntentTest;
 import org.onosproject.net.intent.HostToHostIntent;
 import org.onosproject.net.intent.Intent;
@@ -49,6 +50,7 @@
     private GossipIntentStore intentStore;
     private HostToHostIntent.Builder builder1;
 
+    @Override
     @Before
     public void setUp() {
         intentStore = new GossipIntentStore();
@@ -65,6 +67,7 @@
         intentStore.activate(null);
     }
 
+    @Override
     @After
     public void tearDown() {
         intentStore.deactivate();
@@ -171,11 +174,11 @@
         );
 
         // now purge the intent that was created
-        IntentData purge = new IntentData(
-                intent,
-                IntentState.PURGE_REQ,
-                new IntentTestsMocks.MockTimestamp(12));
-        intentStore.write(purge);
+        IntentData purgeAssigned =
+                IntentData.assign(IntentData.purge(intent),
+                                  new IntentTestsMocks.MockTimestamp(12),
+                                  new NodeId("node-id"));
+        intentStore.write(purgeAssigned);
 
         // check that no intents are left
         assertThat(intentStore.getIntentCount(), is(0L));