Intent manager unit test enhancements

- add test to be sure that all flows are removed when intents
  are withdrawn
- add test to be sure that all flows are removed when an intent
  installation fails. Currently disabled, intent cleanup is
  not implemented
- enable installation time out test

Change-Id: I8c7a75292a97404ef89856647c67ef2f70ffcf6f
diff --git a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
index e94a7f7..8fe8a11 100644
--- a/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
+++ b/core/store/trivial/src/main/java/org/onosproject/store/trivial/impl/SimpleIntentStore.java
@@ -99,19 +99,19 @@
             IntentData pendingData = pending.get(newData.key());
 
             if (IntentData.isUpdateAcceptable(currentData, newData)) {
-                if (pendingData.state() == PURGE_REQ) {
-                    current.remove(newData.key(), newData);
-                } else {
-                    current.put(newData.key(), new IntentData(newData));
-                }
+                if (pendingData != null) {
+                    if (pendingData.state() == PURGE_REQ) {
+                        current.remove(newData.key(), newData);
+                    } else {
+                        current.put(newData.key(), new IntentData(newData));
+                    }
 
-                if (pendingData != null
+                    if (pendingData.version().compareTo(newData.version()) <= 0) {
                         // pendingData version is less than or equal to newData's
                         // Note: a new update for this key could be pending (it's version will be greater)
-                        && pendingData.version().compareTo(newData.version()) <= 0) {
-                    pending.remove(newData.key());
+                        pending.remove(newData.key());
+                    }
                 }
-
                 notifyDelegateIfNotNull(IntentEvent.getEvent(newData));
             }
         }