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/common/src/test/java/org/onosproject/store/trivial/SimpleIntentStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleIntentStore.java
index 02d7eb2..9d237af 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleIntentStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleIntentStore.java
@@ -117,7 +117,7 @@
                     if (pendingData.state() == PURGE_REQ) {
                         current.remove(newData.key(), newData);
                     } else {
-                        current.put(newData.key(), new IntentData(newData));
+                        current.put(newData.key(), IntentData.copy(newData));
                     }
 
                     if (pendingData.version().compareTo(newData.version()) <= 0) {
@@ -150,7 +150,7 @@
         if (currentData == null) {
             return null;
         }
-        return new IntentData(currentData);
+        return IntentData.copy(currentData);
     }
 
     @Override
@@ -167,7 +167,7 @@
                     existingData.version().compareTo(data.version()) < 0) {
                 pending.put(data.key(), data);
                 checkNotNull(delegate, "Store delegate is not set")
-                        .process(new IntentData(data));
+                        .process(IntentData.copy(data));
                 IntentEvent.getEvent(data).ifPresent(this::notifyDelegate);
             } else {
                 log.debug("IntentData {} is older than existing: {}",