Sho SHIMIZU
Committed by Ray Milkey

Remove dependency on PointToPointIntentCompiler

Create an installable intent, not relying on an IntentCompiler.
This change enables IntentCompilers to be moved to a dedicated package.

Reference: ONOS-1066

Change-Id: Ie5bca33720232afaa4d6642d4f9fda933f6d00e3
...@@ -15,31 +15,38 @@ ...@@ -15,31 +15,38 @@
15 */ 15 */
16 package org.onosproject.net.intent.impl; 16 package org.onosproject.net.intent.impl;
17 17
18 +import org.junit.Before;
18 import org.junit.Test; 19 import org.junit.Test;
20 +import org.onosproject.net.ConnectPoint;
21 +import org.onosproject.net.DefaultLink;
22 +import org.onosproject.net.DefaultPath;
23 +import org.onosproject.net.Link;
19 import org.onosproject.net.flow.FlowRuleOperation; 24 import org.onosproject.net.flow.FlowRuleOperation;
20 -import org.onosproject.net.flow.TrafficSelector;
21 -import org.onosproject.net.flow.TrafficTreatment;
22 import org.onosproject.net.intent.AbstractIntentTest; 25 import org.onosproject.net.intent.AbstractIntentTest;
23 import org.onosproject.net.intent.Constraint; 26 import org.onosproject.net.intent.Constraint;
24 -import org.onosproject.net.intent.Intent;
25 import org.onosproject.net.intent.IntentTestsMocks; 27 import org.onosproject.net.intent.IntentTestsMocks;
26 import org.onosproject.net.intent.PathIntent; 28 import org.onosproject.net.intent.PathIntent;
27 -import org.onosproject.net.intent.PointToPointIntent;
28 import org.onosproject.net.intent.constraint.BandwidthConstraint; 29 import org.onosproject.net.intent.constraint.BandwidthConstraint;
29 import org.onosproject.net.intent.constraint.LambdaConstraint; 30 import org.onosproject.net.intent.constraint.LambdaConstraint;
30 import org.onosproject.net.resource.Bandwidth; 31 import org.onosproject.net.resource.Bandwidth;
31 import org.onosproject.net.resource.Lambda; 32 import org.onosproject.net.resource.Lambda;
32 -import org.onosproject.net.resource.LinkResourceService;
33 33
34 +import java.util.Arrays;
34 import java.util.Collection; 35 import java.util.Collection;
35 -import java.util.LinkedList;
36 import java.util.List; 36 import java.util.List;
37 37
38 import static org.hamcrest.MatcherAssert.assertThat; 38 import static org.hamcrest.MatcherAssert.assertThat;
39 -import static org.hamcrest.Matchers.*; 39 +import static org.hamcrest.Matchers.hasSize;
40 +import static org.hamcrest.Matchers.instanceOf;
41 +import static org.hamcrest.Matchers.notNullValue;
40 import static org.junit.Assert.fail; 42 import static org.junit.Assert.fail;
43 +import static org.onosproject.net.DefaultEdgeLink.createEdgeLink;
44 +import static org.onosproject.net.Link.Type.DIRECT;
41 import static org.onosproject.net.NetTestTools.APP_ID; 45 import static org.onosproject.net.NetTestTools.APP_ID;
46 +import static org.onosproject.net.NetTestTools.PID;
42 import static org.onosproject.net.NetTestTools.connectPoint; 47 import static org.onosproject.net.NetTestTools.connectPoint;
48 +import static org.onosproject.net.intent.IntentTestsMocks.MockResourceService.makeBandwidthResourceService;
49 +import static org.onosproject.net.intent.IntentTestsMocks.MockResourceService.makeLambdaResourceService;
43 50
44 /** 51 /**
45 * Unit tests for calculating paths for intents with constraints. 52 * Unit tests for calculating paths for intents with constraints.
...@@ -47,63 +54,26 @@ import static org.onosproject.net.NetTestTools.connectPoint; ...@@ -47,63 +54,26 @@ import static org.onosproject.net.NetTestTools.connectPoint;
47 54
48 public class PathConstraintCalculationTest extends AbstractIntentTest { 55 public class PathConstraintCalculationTest extends AbstractIntentTest {
49 56
50 - /** 57 + private final IntentTestsMocks.MockSelector selector = new IntentTestsMocks.MockSelector();
51 - * Creates a point to point intent compiler for a three switch linear 58 + private final IntentTestsMocks.MockTreatment treatment = new IntentTestsMocks.MockTreatment();
52 - * topology. 59 + private final ConnectPoint d1p1 = connectPoint("s1", 0);
53 - * 60 + private final ConnectPoint d2p0 = connectPoint("s2", 0);
54 - * @param resourceService service to use for resource allocation requests 61 + private final ConnectPoint d2p1 = connectPoint("s2", 1);
55 - * @return point to point compiler 62 + private final ConnectPoint d3p1 = connectPoint("s3", 1);
56 - */ 63 + private final ConnectPoint d3p0 = connectPoint("s3", 10);
57 - private PointToPointIntentCompiler makeCompiler(LinkResourceService resourceService) { 64 + private final ConnectPoint d1p0 = connectPoint("s1", 10);
58 - final String[] hops = {"s1", "s2", "s3"}; 65 +
59 - final PointToPointIntentCompiler compiler = new PointToPointIntentCompiler(); 66 + private PathIntentInstaller sut;
60 - compiler.resourceService = resourceService; 67 +
61 - compiler.pathService = new IntentTestsMocks.MockPathService(hops); 68 + @Before
62 - return compiler; 69 + public void setUpIntentInstaller() {
70 + sut = new PathIntentInstaller();
71 + sut.appId = APP_ID;
63 } 72 }
64 73
65 - /** 74 + private PathIntent createPathIntent(List<Link> links, List<Constraint> constratins) {
66 - * Creates an intent with a given constraint and compiles it. The compiler 75 + int hops = links.size() - 1;
67 - * will throw PathNotFoundException if the allocations cannot be satisfied. 76 + return new PathIntent(APP_ID, selector, treatment, new DefaultPath(PID, links, hops), constratins);
68 - *
69 - * @param constraint constraint to apply to the created intent
70 - * @param resourceService service to use for resource allocation requests
71 - * @return List of compiled intents
72 - */
73 - private List<Intent> compileIntent(Constraint constraint,
74 - LinkResourceService resourceService) {
75 - final List<Constraint> constraints = new LinkedList<>();
76 - constraints.add(constraint);
77 - final TrafficSelector selector = new IntentTestsMocks.MockSelector();
78 - final TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
79 -
80 - final PointToPointIntent intent =
81 - new PointToPointIntent(APP_ID,
82 - selector,
83 - treatment,
84 - connectPoint("s1", 1),
85 - connectPoint("s3", 1),
86 - constraints);
87 - final PointToPointIntentCompiler compiler = makeCompiler(resourceService);
88 -
89 - return compiler.compile(intent, null, null);
90 - }
91 -
92 - /**
93 - * Installs a compiled path intent and returns the flow rules it generates.
94 - *
95 - * @param compiledIntents list of compiled intents
96 - * @param resourceService service to use for resource allocation requests
97 - * @return fow rule entries
98 - */
99 - private List<Collection<FlowRuleOperation>> installIntents(List<Intent> compiledIntents,
100 - LinkResourceService resourceService) {
101 - final PathIntent path = (PathIntent) compiledIntents.get(0);
102 -
103 - final PathIntentInstaller installer = new PathIntentInstaller();
104 - installer.resourceService = resourceService;
105 - installer.appId = APP_ID;
106 - return installer.install(path);
107 } 77 }
108 78
109 /** 79 /**
...@@ -113,16 +83,19 @@ public class PathConstraintCalculationTest extends AbstractIntentTest { ...@@ -113,16 +83,19 @@ public class PathConstraintCalculationTest extends AbstractIntentTest {
113 @Test 83 @Test
114 public void testInstallBandwidthConstrainedIntentSuccess() { 84 public void testInstallBandwidthConstrainedIntentSuccess() {
115 85
116 - final IntentTestsMocks.MockResourceService resourceService =
117 - IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0);
118 final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0)); 86 final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0));
119 87
120 - final List<Intent> compiledIntents = compileIntent(constraint, resourceService); 88 + List<Link> links = Arrays.asList(
121 - assertThat(compiledIntents, notNullValue()); 89 + createEdgeLink(d1p0, true),
122 - assertThat(compiledIntents, hasSize(1)); 90 + new DefaultLink(PID, d1p1, d2p0, DIRECT),
91 + new DefaultLink(PID, d2p1, d3p1, DIRECT),
92 + createEdgeLink(d3p0, false)
93 + );
94 + PathIntent installable = createPathIntent(links, Arrays.asList(constraint));
95 +
96 + sut.resourceService = makeBandwidthResourceService(1000.0);
123 97
124 - final List<Collection<FlowRuleOperation>> flowOperations = 98 + final List<Collection<FlowRuleOperation>> flowOperations = sut.install(installable);
125 - installIntents(compiledIntents, resourceService);
126 99
127 assertThat(flowOperations, notNullValue()); 100 assertThat(flowOperations, notNullValue());
128 assertThat(flowOperations, hasSize(1)); 101 assertThat(flowOperations, hasSize(1));
...@@ -135,19 +108,23 @@ public class PathConstraintCalculationTest extends AbstractIntentTest { ...@@ -135,19 +108,23 @@ public class PathConstraintCalculationTest extends AbstractIntentTest {
135 @Test 108 @Test
136 public void testInstallBandwidthConstrainedIntentFailure() { 109 public void testInstallBandwidthConstrainedIntentFailure() {
137 110
138 - final IntentTestsMocks.MockResourceService resourceService =
139 - IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0);
140 final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0)); 111 final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0));
141 112
142 - final List<Intent> compiledIntents = compileIntent(constraint, resourceService); 113 + List<Link> links = Arrays.asList(
143 - assertThat(compiledIntents, notNullValue()); 114 + createEdgeLink(d1p0, true),
144 - assertThat(compiledIntents, hasSize(1)); 115 + new DefaultLink(PID, d1p1, d2p0, DIRECT),
116 + new DefaultLink(PID, d2p1, d3p1, DIRECT),
117 + createEdgeLink(d3p0, false)
118 + );
119 + PathIntent installable = createPathIntent(links, Arrays.asList(constraint));
145 120
146 // Make it look like the available bandwidth was consumed 121 // Make it look like the available bandwidth was consumed
122 + final IntentTestsMocks.MockResourceService resourceService = makeBandwidthResourceService(1000.0);
147 resourceService.setAvailableBandwidth(1.0); 123 resourceService.setAvailableBandwidth(1.0);
124 + sut.resourceService = resourceService;
148 125
149 try { 126 try {
150 - installIntents(compiledIntents, resourceService); 127 + sut.install(installable);
151 fail("Bandwidth request with no available bandwidth did not fail."); 128 fail("Bandwidth request with no available bandwidth did not fail.");
152 } catch (IntentTestsMocks.MockedAllocationFailure failure) { 129 } catch (IntentTestsMocks.MockedAllocationFailure failure) {
153 assertThat(failure, 130 assertThat(failure,
...@@ -162,16 +139,19 @@ public class PathConstraintCalculationTest extends AbstractIntentTest { ...@@ -162,16 +139,19 @@ public class PathConstraintCalculationTest extends AbstractIntentTest {
162 @Test 139 @Test
163 public void testInstallLambdaConstrainedIntentSuccess() { 140 public void testInstallLambdaConstrainedIntentSuccess() {
164 141
165 - final IntentTestsMocks.MockResourceService resourceService =
166 - IntentTestsMocks.MockResourceService.makeLambdaResourceService(1);
167 final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1)); 142 final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1));
168 143
169 - final List<Intent> compiledIntents = compileIntent(constraint, resourceService); 144 + List<Link> links = Arrays.asList(
170 - assertThat(compiledIntents, notNullValue()); 145 + createEdgeLink(d1p0, true),
171 - assertThat(compiledIntents, hasSize(1)); 146 + new DefaultLink(PID, d1p1, d2p0, DIRECT),
147 + new DefaultLink(PID, d2p1, d3p1, DIRECT),
148 + createEdgeLink(d3p0, false)
149 + );
150 + PathIntent installable = createPathIntent(links, Arrays.asList(constraint));
151 +
152 + sut.resourceService = makeLambdaResourceService(1);
172 153
173 - final List<Collection<FlowRuleOperation>> flowOperations = 154 + final List<Collection<FlowRuleOperation>> flowOperations = sut.install(installable);
174 - installIntents(compiledIntents, resourceService);
175 155
176 assertThat(flowOperations, notNullValue()); 156 assertThat(flowOperations, notNullValue());
177 assertThat(flowOperations, hasSize(1)); 157 assertThat(flowOperations, hasSize(1));
...@@ -184,19 +164,23 @@ public class PathConstraintCalculationTest extends AbstractIntentTest { ...@@ -184,19 +164,23 @@ public class PathConstraintCalculationTest extends AbstractIntentTest {
184 @Test 164 @Test
185 public void testInstallLambdaConstrainedIntentFailure() { 165 public void testInstallLambdaConstrainedIntentFailure() {
186 166
187 - final IntentTestsMocks.MockResourceService resourceService =
188 - IntentTestsMocks.MockResourceService.makeLambdaResourceService(1);
189 final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1)); 167 final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1));
190 168
191 - final List<Intent> compiledIntents = compileIntent(constraint, resourceService); 169 + List<Link> links = Arrays.asList(
192 - assertThat(compiledIntents, notNullValue()); 170 + createEdgeLink(d1p0, true),
193 - assertThat(compiledIntents, hasSize(1)); 171 + new DefaultLink(PID, d1p1, d2p0, DIRECT),
172 + new DefaultLink(PID, d2p1, d3p1, DIRECT),
173 + createEdgeLink(d3p0, false)
174 + );
175 + PathIntent installable = createPathIntent(links, Arrays.asList(constraint));
194 176
195 // Make it look like the available lambda was consumed 177 // Make it look like the available lambda was consumed
178 + final IntentTestsMocks.MockResourceService resourceService = makeLambdaResourceService(1);
196 resourceService.setAvailableLambda(0); 179 resourceService.setAvailableLambda(0);
180 + sut.resourceService = resourceService;
197 181
198 try { 182 try {
199 - installIntents(compiledIntents, resourceService); 183 + sut.install(installable);
200 fail("Lambda request with no available lambda did not fail."); 184 fail("Lambda request with no available lambda did not fail.");
201 } catch (IntentTestsMocks.MockedAllocationFailure failure) { 185 } catch (IntentTestsMocks.MockedAllocationFailure failure) {
202 assertThat(failure, 186 assertThat(failure,
......
...@@ -36,7 +36,7 @@ import org.onosproject.net.resource.Bandwidth; ...@@ -36,7 +36,7 @@ import org.onosproject.net.resource.Bandwidth;
36 import org.onosproject.net.resource.Lambda; 36 import org.onosproject.net.resource.Lambda;
37 import org.onosproject.net.resource.LinkResourceService; 37 import org.onosproject.net.resource.LinkResourceService;
38 38
39 -import java.util.LinkedList; 39 +import java.util.Arrays;
40 import java.util.List; 40 import java.util.List;
41 41
42 import static org.hamcrest.CoreMatchers.instanceOf; 42 import static org.hamcrest.CoreMatchers.instanceOf;
...@@ -77,14 +77,29 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -77,14 +77,29 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
77 } 77 }
78 78
79 /** 79 /**
80 + * Creates a PointToPoint intent based on ingress and egress deviceIds and constraints.
81 + *
82 + * @param ingressIdString string for id of ingress device
83 + * @param egressIdString string for id of egress device
84 + * @param constraints constraints
85 + * @return PointToPointIntent for the two device with constraints
86 + */
87 + private PointToPointIntent makeIntent(String ingressIdString,
88 + String egressIdString, List<Constraint> constraints) {
89 + return new PointToPointIntent(APPID, selector, treatment,
90 + connectPoint(ingressIdString, 1),
91 + connectPoint(egressIdString, 1),
92 + constraints);
93 + }
94 +
95 + /**
80 * Creates a compiler for HostToHost intents. 96 * Creates a compiler for HostToHost intents.
81 * 97 *
82 * @param hops string array describing the path hops to use when compiling 98 * @param hops string array describing the path hops to use when compiling
83 * @return HostToHost intent compiler 99 * @return HostToHost intent compiler
84 */ 100 */
85 private PointToPointIntentCompiler makeCompiler(String[] hops) { 101 private PointToPointIntentCompiler makeCompiler(String[] hops) {
86 - PointToPointIntentCompiler compiler = 102 + PointToPointIntentCompiler compiler = new PointToPointIntentCompiler();
87 - new PointToPointIntentCompiler();
88 compiler.pathService = new IntentTestsMocks.MockPathService(hops); 103 compiler.pathService = new IntentTestsMocks.MockPathService(hops);
89 return compiler; 104 return compiler;
90 } 105 }
...@@ -96,8 +111,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -96,8 +111,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
96 * @param resourceService service to use for resource allocation requests 111 * @param resourceService service to use for resource allocation requests
97 * @return point to point compiler 112 * @return point to point compiler
98 */ 113 */
99 - private PointToPointIntentCompiler makeCompiler(LinkResourceService resourceService) { 114 + private PointToPointIntentCompiler makeCompiler(String[] hops, LinkResourceService resourceService) {
100 - final String[] hops = {"s1", "s2", "s3"};
101 final PointToPointIntentCompiler compiler = new PointToPointIntentCompiler(); 115 final PointToPointIntentCompiler compiler = new PointToPointIntentCompiler();
102 compiler.resourceService = resourceService; 116 compiler.resourceService = resourceService;
103 compiler.pathService = new IntentTestsMocks.MockPathService(hops); 117 compiler.pathService = new IntentTestsMocks.MockPathService(hops);
...@@ -105,33 +119,6 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -105,33 +119,6 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
105 } 119 }
106 120
107 /** 121 /**
108 - * Creates an intent with a given constraint and compiles it. The compiler
109 - * will throw PathNotFoundException if the allocations cannot be satisfied.
110 - *
111 - * @param constraint constraint to apply to the created intent
112 - * @param resourceService service to use for resource allocation requests
113 - * @return List of compiled intents
114 - */
115 - private List<Intent> compileIntent(Constraint constraint,
116 - LinkResourceService resourceService) {
117 - final List<Constraint> constraints = new LinkedList<>();
118 - constraints.add(constraint);
119 - final TrafficSelector selector = new IntentTestsMocks.MockSelector();
120 - final TrafficTreatment treatment = new IntentTestsMocks.MockTreatment();
121 -
122 - final PointToPointIntent intent =
123 - new PointToPointIntent(APP_ID,
124 - selector,
125 - treatment,
126 - connectPoint("s1", 1),
127 - connectPoint("s3", 1),
128 - constraints);
129 - final PointToPointIntentCompiler compiler = makeCompiler(resourceService);
130 -
131 - return compiler.compile(intent, null, null);
132 - }
133 -
134 - /**
135 * Tests a pair of devices in an 8 hop path, forward direction. 122 * Tests a pair of devices in an 8 hop path, forward direction.
136 */ 123 */
137 @Test 124 @Test
...@@ -225,9 +212,15 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -225,9 +212,15 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
225 212
226 final LinkResourceService resourceService = 213 final LinkResourceService resourceService =
227 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0); 214 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(1000.0);
228 - final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0)); 215 + final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0)));
216 +
217 + final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
218 +
219 + String[] hops = {"s1", "s2", "s3"};
220 + final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService);
221 +
222 + final List<Intent> compiledIntents = compiler.compile(intent, null, null);
229 223
230 - final List<Intent> compiledIntents = compileIntent(constraint, resourceService);
231 assertThat(compiledIntents, Matchers.notNullValue()); 224 assertThat(compiledIntents, Matchers.notNullValue());
232 assertThat(compiledIntents, hasSize(1)); 225 assertThat(compiledIntents, hasSize(1));
233 } 226 }
...@@ -240,10 +233,16 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -240,10 +233,16 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
240 233
241 final LinkResourceService resourceService = 234 final LinkResourceService resourceService =
242 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0); 235 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0);
243 - final Constraint constraint = new BandwidthConstraint(Bandwidth.bps(100.0)); 236 + final List<Constraint> constraints = Arrays.asList(new BandwidthConstraint(Bandwidth.bps(100.0)));
244 237
245 try { 238 try {
246 - compileIntent(constraint, resourceService); 239 + final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
240 +
241 + String[] hops = {"s1", "s2", "s3"};
242 + final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService);
243 +
244 + compiler.compile(intent, null, null);
245 +
247 fail("Point to Point compilation with insufficient bandwidth does " 246 fail("Point to Point compilation with insufficient bandwidth does "
248 + "not throw exception."); 247 + "not throw exception.");
249 } catch (PathNotFoundException noPath) { 248 } catch (PathNotFoundException noPath) {
...@@ -257,12 +256,18 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -257,12 +256,18 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
257 @Test 256 @Test
258 public void testLambdaConstrainedIntentSuccess() { 257 public void testLambdaConstrainedIntentSuccess() {
259 258
260 - final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1)); 259 + final List<Constraint> constraints = Arrays.asList(new LambdaConstraint(Lambda.valueOf(1)));
261 final LinkResourceService resourceService = 260 final LinkResourceService resourceService =
262 IntentTestsMocks.MockResourceService.makeLambdaResourceService(1); 261 IntentTestsMocks.MockResourceService.makeLambdaResourceService(1);
263 262
263 + final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
264 +
265 + String[] hops = {"s1", "s2", "s3"};
266 + final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService);
267 +
264 final List<Intent> compiledIntents = 268 final List<Intent> compiledIntents =
265 - compileIntent(constraint, resourceService); 269 + compiler.compile(intent, null, null);
270 +
266 assertThat(compiledIntents, Matchers.notNullValue()); 271 assertThat(compiledIntents, Matchers.notNullValue());
267 assertThat(compiledIntents, hasSize(1)); 272 assertThat(compiledIntents, hasSize(1));
268 } 273 }
...@@ -274,11 +279,17 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest { ...@@ -274,11 +279,17 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
274 @Test 279 @Test
275 public void testLambdaConstrainedIntentFailure() { 280 public void testLambdaConstrainedIntentFailure() {
276 281
277 - final Constraint constraint = new LambdaConstraint(Lambda.valueOf(1)); 282 + final List<Constraint> constraints = Arrays.asList(new LambdaConstraint(Lambda.valueOf(1)));
278 final LinkResourceService resourceService = 283 final LinkResourceService resourceService =
279 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0); 284 IntentTestsMocks.MockResourceService.makeBandwidthResourceService(10.0);
280 try { 285 try {
281 - compileIntent(constraint, resourceService); 286 + final PointToPointIntent intent = makeIntent("s1", "s3", constraints);
287 +
288 + String[] hops = {"s1", "s2", "s3"};
289 + final PointToPointIntentCompiler compiler = makeCompiler(hops, resourceService);
290 +
291 + compiler.compile(intent, null, null);
292 +
282 fail("Point to Point compilation with no available lambda does " 293 fail("Point to Point compilation with no available lambda does "
283 + "not throw exception."); 294 + "not throw exception.");
284 } catch (PathNotFoundException noPath) { 295 } catch (PathNotFoundException noPath) {
......