Brian O'Connor

Updating SimpleIntentStore

Change-Id: Ide940216f05a69875fcb844d36b073e2e4b9988e
...@@ -51,6 +51,14 @@ ...@@ -51,6 +51,14 @@
51 <scope>test</scope> 51 <scope>test</scope>
52 </dependency> 52 </dependency>
53 53
54 + <!-- FIXME remove when we figure out the trivial store -->
55 + <dependency>
56 + <groupId>org.onosproject</groupId>
57 + <artifactId>onos-core-dist</artifactId>
58 + <version>${project.version}</version>
59 + <scope>test</scope>
60 + </dependency>
61 +
54 <dependency> 62 <dependency>
55 <groupId>org.onosproject</groupId> 63 <groupId>org.onosproject</groupId>
56 <artifactId>onos-core-common</artifactId> 64 <artifactId>onos-core-common</artifactId>
......
...@@ -48,7 +48,7 @@ import org.onosproject.net.intent.IntentState; ...@@ -48,7 +48,7 @@ import org.onosproject.net.intent.IntentState;
48 import org.onosproject.net.intent.IntentTestsMocks; 48 import org.onosproject.net.intent.IntentTestsMocks;
49 import org.onosproject.net.intent.Key; 49 import org.onosproject.net.intent.Key;
50 import org.onosproject.net.resource.LinkResourceAllocations; 50 import org.onosproject.net.resource.LinkResourceAllocations;
51 -import org.onosproject.store.trivial.impl.SimpleIntentStore; 51 +import org.onosproject.store.intent.impl.SimpleIntentStore;
52 52
53 import java.util.Collection; 53 import java.util.Collection;
54 import java.util.Collections; 54 import java.util.Collections;
......
...@@ -170,6 +170,7 @@ public class SimpleIntentStore ...@@ -170,6 +170,7 @@ public class SimpleIntentStore
170 // current version is less than or equal to newData's 170 // current version is less than or equal to newData's
171 // Note: current and newData's versions will be equal for state updates 171 // Note: current and newData's versions will be equal for state updates
172 currentData.version().compareTo(newData.version()) <= 0) { 172 currentData.version().compareTo(newData.version()) <= 0) {
173 + // FIXME need to check that the validity of state transition if ==
173 current.put(newData.key(), newData); 174 current.put(newData.key(), newData);
174 175
175 if (pendingData != null 176 if (pendingData != null
...@@ -204,7 +205,9 @@ public class SimpleIntentStore ...@@ -204,7 +205,9 @@ public class SimpleIntentStore
204 205
205 @Override 206 @Override
206 public void addPending(IntentData data) { 207 public void addPending(IntentData data) {
207 - data.setVersion(new SystemClockTimestamp()); 208 + if (data.version() != null) { // recompiled intents will already have a version
209 + data.setVersion(new SystemClockTimestamp());
210 + }
208 synchronized (this) { 211 synchronized (this) {
209 IntentData existingData = pending.get(data.key()); 212 IntentData existingData = pending.get(data.key());
210 if (existingData == null || 213 if (existingData == null ||
......