Committed by
Brian O'Connor
Fixes for ObjectiveTrackerTest and IntentServiceTest
Change-Id: I10acda2220c2012e0aa07493c2dc91b1a6a81109
Showing
3 changed files
with
15 additions
and
18 deletions
... | @@ -31,9 +31,9 @@ import java.util.concurrent.Executors; | ... | @@ -31,9 +31,9 @@ import java.util.concurrent.Executors; |
31 | */ | 31 | */ |
32 | public class FakeIntentManager implements TestableIntentService { | 32 | public class FakeIntentManager implements TestableIntentService { |
33 | 33 | ||
34 | - private final Map<IntentId, Intent> intents = new HashMap<>(); | 34 | + private final Map<Key, Intent> intents = new HashMap<>(); |
35 | - private final Map<IntentId, IntentState> intentStates = new HashMap<>(); | 35 | + private final Map<Key, IntentState> intentStates = new HashMap<>(); |
36 | - private final Map<IntentId, List<Intent>> installables = new HashMap<>(); | 36 | + private final Map<Key, List<Intent>> installables = new HashMap<>(); |
37 | private final Set<IntentListener> listeners = new HashSet<>(); | 37 | private final Set<IntentListener> listeners = new HashSet<>(); |
38 | 38 | ||
39 | private final Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> compilers = new HashMap<>(); | 39 | private final Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> compilers = new HashMap<>(); |
... | @@ -69,7 +69,7 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -69,7 +69,7 @@ public class FakeIntentManager implements TestableIntentService { |
69 | @Override | 69 | @Override |
70 | public void run() { | 70 | public void run() { |
71 | try { | 71 | try { |
72 | - List<Intent> installable = getInstallable(intent.id()); | 72 | + List<Intent> installable = getInstallable(intent.key()); |
73 | executeWithdrawingPhase(intent, installable); | 73 | executeWithdrawingPhase(intent, installable); |
74 | } catch (IntentException e) { | 74 | } catch (IntentException e) { |
75 | exceptions.add(e); | 75 | exceptions.add(e); |
... | @@ -123,7 +123,7 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -123,7 +123,7 @@ public class FakeIntentManager implements TestableIntentService { |
123 | getInstaller(ii).install(ii); | 123 | getInstaller(ii).install(ii); |
124 | } | 124 | } |
125 | setState(intent, IntentState.INSTALLED); | 125 | setState(intent, IntentState.INSTALLED); |
126 | - putInstallable(intent.id(), installable); | 126 | + putInstallable(intent.key(), installable); |
127 | dispatch(new IntentEvent(IntentEvent.Type.INSTALLED, intent)); | 127 | dispatch(new IntentEvent(IntentEvent.Type.INSTALLED, intent)); |
128 | 128 | ||
129 | } catch (IntentException e) { | 129 | } catch (IntentException e) { |
... | @@ -139,7 +139,7 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -139,7 +139,7 @@ public class FakeIntentManager implements TestableIntentService { |
139 | for (Intent ii : installable) { | 139 | for (Intent ii : installable) { |
140 | getInstaller(ii).uninstall(ii); | 140 | getInstaller(ii).uninstall(ii); |
141 | } | 141 | } |
142 | - removeInstallable(intent.id()); | 142 | + removeInstallable(intent.key()); |
143 | setState(intent, IntentState.WITHDRAWN); | 143 | setState(intent, IntentState.WITHDRAWN); |
144 | dispatch(new IntentEvent(IntentEvent.Type.WITHDRAWN, intent)); | 144 | dispatch(new IntentEvent(IntentEvent.Type.WITHDRAWN, intent)); |
145 | } catch (IntentException e) { | 145 | } catch (IntentException e) { |
... | @@ -151,19 +151,19 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -151,19 +151,19 @@ public class FakeIntentManager implements TestableIntentService { |
151 | 151 | ||
152 | // Sets the internal state for the given intent and dispatches an event | 152 | // Sets the internal state for the given intent and dispatches an event |
153 | private void setState(Intent intent, IntentState state) { | 153 | private void setState(Intent intent, IntentState state) { |
154 | - intentStates.put(intent.id(), state); | 154 | + intentStates.put(intent.key(), state); |
155 | } | 155 | } |
156 | 156 | ||
157 | - private void putInstallable(IntentId id, List<Intent> installable) { | 157 | + private void putInstallable(Key key, List<Intent> installable) { |
158 | - installables.put(id, installable); | 158 | + installables.put(key, installable); |
159 | } | 159 | } |
160 | 160 | ||
161 | - private void removeInstallable(IntentId id) { | 161 | + private void removeInstallable(Key key) { |
162 | - installables.remove(id); | 162 | + installables.remove(key); |
163 | } | 163 | } |
164 | 164 | ||
165 | - private List<Intent> getInstallable(IntentId id) { | 165 | + private List<Intent> getInstallable(Key key) { |
166 | - List<Intent> installable = installables.get(id); | 166 | + List<Intent> installable = installables.get(key); |
167 | if (installable != null) { | 167 | if (installable != null) { |
168 | return installable; | 168 | return installable; |
169 | } else { | 169 | } else { |
... | @@ -173,7 +173,7 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -173,7 +173,7 @@ public class FakeIntentManager implements TestableIntentService { |
173 | 173 | ||
174 | @Override | 174 | @Override |
175 | public void submit(Intent intent) { | 175 | public void submit(Intent intent) { |
176 | - intents.put(intent.id(), intent); | 176 | + intents.put(intent.key(), intent); |
177 | setState(intent, IntentState.INSTALL_REQ); | 177 | setState(intent, IntentState.INSTALL_REQ); |
178 | dispatch(new IntentEvent(IntentEvent.Type.INSTALL_REQ, intent)); | 178 | dispatch(new IntentEvent(IntentEvent.Type.INSTALL_REQ, intent)); |
179 | executeSubmit(intent); | 179 | executeSubmit(intent); |
... | @@ -181,7 +181,7 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -181,7 +181,7 @@ public class FakeIntentManager implements TestableIntentService { |
181 | 181 | ||
182 | @Override | 182 | @Override |
183 | public void withdraw(Intent intent) { | 183 | public void withdraw(Intent intent) { |
184 | - intents.remove(intent.id()); | 184 | + intents.remove(intent.key()); |
185 | executeWithdraw(intent); | 185 | executeWithdraw(intent); |
186 | } | 186 | } |
187 | 187 | ... | ... |
... | @@ -33,7 +33,6 @@ import java.util.Set; | ... | @@ -33,7 +33,6 @@ import java.util.Set; |
33 | 33 | ||
34 | import org.junit.After; | 34 | import org.junit.After; |
35 | import org.junit.Before; | 35 | import org.junit.Before; |
36 | -import org.junit.Ignore; | ||
37 | import org.junit.Test; | 36 | import org.junit.Test; |
38 | import org.onosproject.core.IdGenerator; | 37 | import org.onosproject.core.IdGenerator; |
39 | import org.onosproject.net.flow.FlowRuleBatchOperation; | 38 | import org.onosproject.net.flow.FlowRuleBatchOperation; |
... | @@ -42,7 +41,6 @@ import org.onosproject.net.resource.LinkResourceAllocations; | ... | @@ -42,7 +41,6 @@ import org.onosproject.net.resource.LinkResourceAllocations; |
42 | /** | 41 | /** |
43 | * Suite of tests for the intent service contract. | 42 | * Suite of tests for the intent service contract. |
44 | */ | 43 | */ |
45 | -@Ignore | ||
46 | public class IntentServiceTest { | 44 | public class IntentServiceTest { |
47 | 45 | ||
48 | public static final int IID = 123; | 46 | public static final int IID = 123; | ... | ... |
... | @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; | ... | @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; |
24 | 24 | ||
25 | import org.junit.After; | 25 | import org.junit.After; |
26 | import org.junit.Before; | 26 | import org.junit.Before; |
27 | -import org.junit.Ignore; | ||
28 | import org.junit.Test; | 27 | import org.junit.Test; |
29 | import org.onlab.junit.TestUtils; | 28 | import org.onlab.junit.TestUtils; |
30 | import org.onlab.junit.TestUtils.TestUtilsException; | 29 | import org.onlab.junit.TestUtils.TestUtilsException; | ... | ... |
-
Please register or login to post a comment