Change Intent classes to self contained

Change-Id: I0def86a280646983efb98dbe5937b93b4c9a4885
diff --git a/src/main/java/net/onrc/onos/datagrid/web/IntentResource.java b/src/main/java/net/onrc/onos/datagrid/web/IntentResource.java
index ee1c704..db2c38a 100755
--- a/src/main/java/net/onrc/onos/datagrid/web/IntentResource.java
+++ b/src/main/java/net/onrc/onos/datagrid/web/IntentResource.java
@@ -101,7 +101,7 @@
                 }
                 System.out.println("constructed node " + sb.toString());
                 sb.delete(0, sb.length());
-                intentDesializer = new IntentDeserializer(graph, sb.toString().getBytes());
+                intentDesializer = new IntentDeserializer(sb.toString().getBytes());
                 Intent intent = intentDesializer.getIntent();
                 intents.add(intent);
             }
diff --git a/src/main/java/net/onrc/onos/intent/ConstrainedBFSTree.java b/src/main/java/net/onrc/onos/intent/ConstrainedBFSTree.java
index 2ea27ae..758494f 100644
--- a/src/main/java/net/onrc/onos/intent/ConstrainedBFSTree.java
+++ b/src/main/java/net/onrc/onos/intent/ConstrainedBFSTree.java
@@ -23,7 +23,7 @@
 	HashMap<Switch, Path> paths = new HashMap<Switch, Path>();
 	Switch rootSwitch;
 	PathIntents intents = null;
-	Double bandwidth = null;
+	double bandwidth = 0.0; // 0.0 means no limit for bandwidth (normal BFS tree)
 
 	public ConstrainedBFSTree(Switch rootSwitch) {
 		this.rootSwitch = rootSwitch;
@@ -31,7 +31,7 @@
 		calcTree();
 	}
 
-	public ConstrainedBFSTree(Switch rootSwitch, PathIntents intents, Double bandwidth) {
+	public ConstrainedBFSTree(Switch rootSwitch, PathIntents intents, double bandwidth) {
 		this.rootSwitch = rootSwitch;
 		this.intents = intents;
 		this.bandwidth = bandwidth;
@@ -46,7 +46,7 @@
 			for (Link link: sw.getOutgoingLinks()) {
 				Switch reachedSwitch = link.getDestinationPort().getSwitch();
 				if (switchSearched.contains(reachedSwitch)) continue;
-				if (bandwidth != null && intents.getAvailableBandwidth(link) < bandwidth) continue;
+				if (bandwidth > 0.0 && intents.getAvailableBandwidth(link) < bandwidth) continue;
 				switchQueue.add(reachedSwitch);
 				switchSearched.add(reachedSwitch);
 				upstreamLinks.put(reachedSwitch, link);
diff --git a/src/main/java/net/onrc/onos/intent/ConstrainedShortestPathIntent.java b/src/main/java/net/onrc/onos/intent/ConstrainedShortestPathIntent.java
index 8a2e101..879d92f 100644
--- a/src/main/java/net/onrc/onos/intent/ConstrainedShortestPathIntent.java
+++ b/src/main/java/net/onrc/onos/intent/ConstrainedShortestPathIntent.java
@@ -1,66 +1,27 @@
 package net.onrc.onos.intent;
 
-import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
-import net.onrc.onos.ofcontroller.networkgraph.Port;
-
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
 /**
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ConstrainedShortestPathIntent extends ShortestPathIntent {
-	protected Double bandwidth;
+	protected double bandwidth;
 
-	public ConstrainedShortestPathIntent(String id,
-			Port srcPort, MACAddress srcMac,
-			Port dstPort, MACAddress dstMac,
-			Double bandwidth) {
-		super(id, srcPort, srcMac, dstPort, dstMac);
-		this.bandwidth = bandwidth;
+	/**
+	 * Default constructor for Kryo deserialization
+	 */
+	@Deprecated
+	public ConstrainedShortestPathIntent() {
 	}
-
-	public ConstrainedShortestPathIntent(NetworkGraph graph, String id,
+	
+	public ConstrainedShortestPathIntent(String id,
 			long srcSwitch, long srcPort, long srcMac,
 			long dstSwitch, long dstPort, long dstMac,
-			Double bandwidth) {
-		super(graph, id, srcSwitch, srcPort, srcMac, dstSwitch, dstPort, dstMac);
+			double bandwidth) {
+		super(id, srcSwitch, srcPort, srcMac, dstSwitch, dstPort, dstMac);
 		this.bandwidth = bandwidth;
 	}
 
-	public static ConstrainedShortestPathIntent fromBytes(NetworkGraph graph, byte[] bytes) {
-		Input input = new Input(bytes);
-		ConstrainedShortestPathIntent intent = new ConstrainedShortestPathIntent(graph,
-				input.readString(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readDouble());
-		input.close();
-		return intent;
-	}
-
-	public Double getBandwidth() {
+	public double getBandwidth() {
 		return bandwidth;
 	}
-
-	@Override
-	public byte[] toBytes() {
-		byte[] buffer = new byte[1024];
-		Output output = new Output(buffer, -1);
-		output.writeString(id);
-		output.writeLong(srcPort.getSwitch().getDpid());
-		output.writeLong(srcPort.getNumber());
-		output.writeLong(srcMac.toLong());
-		output.writeLong(dstPort.getSwitch().getDpid());
-		output.writeLong(dstPort.getNumber());
-		output.writeLong(dstMac.toLong());
-		output.writeDouble(bandwidth);
-		output.close();
-		return output.toBytes();
-	}
 }
diff --git a/src/main/java/net/onrc/onos/intent/Intent.java b/src/main/java/net/onrc/onos/intent/Intent.java
index 070af25..921d430 100644
--- a/src/main/java/net/onrc/onos/intent/Intent.java
+++ b/src/main/java/net/onrc/onos/intent/Intent.java
@@ -4,7 +4,18 @@
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public abstract class Intent {
+	enum IntentState {
+		// TODO;
+	}
 	protected String id;
+	protected IntentState state;
+
+	/**
+	 * Default constructor for Kryo deserialization
+	 */
+	@Deprecated
+	public Intent() {
+	}
 
 	public Intent(String id) {
 		this.id = id;
@@ -14,7 +25,15 @@
 		return id;
 	}
 	
-	abstract public byte[] toBytes();
+	public IntentState getState() {
+		return state;
+	}
+	
+	public IntentState setState(IntentState newState) {
+		IntentState oldState = state;
+		state = newState;
+		return oldState;
+	}
 
 	@Override
 	public int hashCode() {
diff --git a/src/main/java/net/onrc/onos/intent/IntentDeserializer.java b/src/main/java/net/onrc/onos/intent/IntentDeserializer.java
index c146698..a3a6ae6 100644
--- a/src/main/java/net/onrc/onos/intent/IntentDeserializer.java
+++ b/src/main/java/net/onrc/onos/intent/IntentDeserializer.java
@@ -1,6 +1,5 @@
 package net.onrc.onos.intent;
 
-import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
 
 /**
  * @author Toshio Koide (t-koide@onlab.us)
@@ -9,11 +8,9 @@
 	private String id;
 	private String className;
 	private Intent intent = null;
-	private NetworkGraph g;
 
-	public IntentDeserializer(NetworkGraph graph, byte[] b) {
+	public IntentDeserializer(byte[] b) {
 		// TODO deserialize object and get (unique id, class name, object data) tuple.
-		g = graph;
 		id = "id";
 		className = "pi";
 		byte[] objectData = null;
@@ -35,17 +32,17 @@
 
 	private void parsePathIntent(byte[] objectData) {
 		// TODO deserialize object and create instance
-		intent = new PathIntent(id, null, null, null);
+		intent = new PathIntent(id, null, 0, null);
 	}
 
 	private void parseShortestPathIntent(byte[] objectData) {
 		// TODO deserialize object and create instance
-		intent = new ShortestPathIntent(g, id, 0L, 0L, 0L, 0L, 0L, 0L);
+		intent = new ShortestPathIntent(id, 0L, 0L, 0L, 0L, 0L, 0L);
 	}
 
 	private void parseConstrainedShortestPathIntent(byte[] objectData) {
 		// TODO deserialize object and create instance
-		intent = new ConstrainedShortestPathIntent(g, id, 0L, 0L, 0L, 0L, 0L, 0L, 0.0);
+		intent = new ConstrainedShortestPathIntent(id, 0L, 0L, 0L, 0L, 0L, 0L, 0.0);
 	}
 
 	public Intent getIntent() {
diff --git a/src/main/java/net/onrc/onos/intent/PathIntent.java b/src/main/java/net/onrc/onos/intent/PathIntent.java
index 3afa92e..4d1e71e 100644
--- a/src/main/java/net/onrc/onos/intent/PathIntent.java
+++ b/src/main/java/net/onrc/onos/intent/PathIntent.java
@@ -7,7 +7,7 @@
  */
 public class PathIntent extends Intent {
 	protected Path path;
-	protected Double bandwidth;
+	protected double bandwidth;
 	protected Intent parentIntent;
 	protected int id;
 
@@ -16,11 +16,11 @@
 	 * @param graph
 	 * @param path
 	 * @param bandwidth bandwidth which should be allocated for the path.
-	 * If null, it means no intent for bandwidth allocation (best effort).
-	 * @param parentIntent parent intent. If null, it means this is root intent.
+	 * If 0, no intent for bandwidth allocation (best effort).
+	 * @param parentIntent parent intent. If null, this is root intent.
 	 * @param id
 	 */
-	public PathIntent(String id, Path path, Double bandwidth, Intent parentIntent) {
+	public PathIntent(String id, Path path, double bandwidth, Intent parentIntent) {
 		super(id);
 		this.path = path;
 		this.bandwidth = bandwidth;
@@ -38,10 +38,4 @@
 	public Intent getParentIntent() {
 		return parentIntent;
 	}
-
-	@Override
-	public byte[] toBytes() {
-		// TODO not implemented yet
-		return null;
-	}
 }
diff --git a/src/main/java/net/onrc/onos/intent/ShortestPathIntent.java b/src/main/java/net/onrc/onos/intent/ShortestPathIntent.java
index 3fdcf66..2677942 100644
--- a/src/main/java/net/onrc/onos/intent/ShortestPathIntent.java
+++ b/src/main/java/net/onrc/onos/intent/ShortestPathIntent.java
@@ -1,90 +1,66 @@
 package net.onrc.onos.intent;
 
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-
 import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
-import net.onrc.onos.ofcontroller.networkgraph.Port;
+import net.onrc.onos.ofcontroller.util.Dpid;
 
 /**
  * @author Toshio Koide (t-koide@onlab.us)
  */
 public class ShortestPathIntent extends Intent {
-	protected Port srcPort = null;
-	protected Port dstPort = null;
-	protected MACAddress srcMac = null;
-	protected MACAddress dstMac = null;
+	protected long srcSwitchDpid;
+	protected long srcPortNumber;
+	protected long srcMacAddress;
+	protected long dstSwitchDpid;
+	protected long dstPortNumber;
+	protected long dstMacAddress;
 
-	public ShortestPathIntent(String id,
-			Port srcPort, MACAddress srcMac,
-			Port dstPort, MACAddress dstMac) {
-		super(id);
-		this.srcPort = srcPort;
-		this.dstPort = dstPort;
-		this.srcMac = srcMac;
-		this.dstMac = dstMac;
+	/**
+	 * Default constructor for Kryo deserialization
+	 */
+	@Deprecated
+	public ShortestPathIntent() {
 	}
 
-	public ShortestPathIntent(NetworkGraph graph, String id,
+	public ShortestPathIntent(String id,
 			long srcSwitch, long srcPort, long srcMac,
 			long dstSwitch, long dstPort, long dstMac) {
 		super(id);
-		this.srcPort = graph.getSwitch(srcSwitch).getPort(srcPort);
-		this.dstPort = graph.getSwitch(dstSwitch).getPort(srcPort);
-		this.srcMac = MACAddress.valueOf(srcMac);
-		this.dstMac = MACAddress.valueOf(dstMac);
+		srcSwitchDpid = srcSwitch;
+		srcPortNumber = srcPort;
+		srcMacAddress = srcMac;
+		dstSwitchDpid = dstSwitch;
+		dstPortNumber = dstPort;
+		dstMacAddress = dstMac;
 	}
 
-	public static ShortestPathIntent fromBytes(NetworkGraph graph, byte[] bytes) {
-		Input input = new Input(bytes);
-		ShortestPathIntent intent = new ShortestPathIntent(graph,
-				input.readString(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong(),
-				input.readLong());
-		input.close();
-		return intent;
-		}
-
-	public Port getSourcePort() {
-		return srcPort;
+	public long getSrcSwitchDpid() {
+		return srcSwitchDpid;
 	}
 
-	public MACAddress getSourceMac() {
-		return srcMac;
+	public long getSrcPortNumber() {
+		return srcPortNumber;
 	}
 
-	public Port getDestinationPort() {
-		return dstPort;
+	public long getSrcMac() {
+		return srcMacAddress;
 	}
 
-	public MACAddress getDestinationMac() {
-		return dstMac;
+	public long getDstSwitchDpid() {
+		return dstSwitchDpid;
+	}
+
+	public long getDstPortNumber() {
+		return dstPortNumber;
+	}
+
+	public long getDstMac() {
+		return dstMacAddress;
 	}
 
 	@Override
 	public String toString() {
-		return String.format("srcPort:%s, srcMac:%s, dstPort:%s, dstMac:%s",
-				srcPort.toString(), srcMac.toString(),
-				dstPort.toString(), dstMac.toString());
-	}
-
-	@Override
-	public byte[] toBytes() {
-		byte[] buffer = new byte[1024];
-		Output output = new Output(buffer, -1);
-		output.writeString(id);
-		output.writeLong(srcPort.getSwitch().getDpid());
-		output.writeLong(srcPort.getNumber());
-		output.writeLong(srcMac.toLong());
-		output.writeLong(dstPort.getSwitch().getDpid());
-		output.writeLong(dstPort.getNumber());
-		output.writeLong(dstMac.toLong());
-		output.close();
-		return output.toBytes();
+		return String.format("srcDpid:%s, srcPort:%d, srcMac:%s, dstDpid:%s, dstPort:%d, dstMac:%s",
+				new Dpid(srcSwitchDpid), srcPortNumber, MACAddress.valueOf(srcMacAddress),
+				new Dpid(dstSwitchDpid), dstPortNumber, MACAddress.valueOf(dstMacAddress));
 	}
 }
diff --git a/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntime.java b/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntime.java
index 60cf10d..8d9cc87 100644
--- a/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntime.java
+++ b/src/main/java/net/onrc/onos/intent/runtime/PathCalcRuntime.java
@@ -49,15 +49,15 @@
 			}
 
 			ShortestPathIntent spIntent = (ShortestPathIntent) intent;
-			Switch srcSwitch = spIntent.getSourcePort().getSwitch();
-			Switch dstSwitch = spIntent.getDestinationPort().getSwitch();
+			Switch srcSwitch = graph.getSwitch(spIntent.getSrcSwitchDpid());
+			Switch dstSwitch = graph.getSwitch(spIntent.getDstSwitchDpid());
 			if (srcSwitch == null || dstSwitch == null) {
 				// incomplete intent.
 				// TODO should push back the intent to caller
 				continue;
 			}
 
-			Double bandwidth = null;
+			double bandwidth = 0.0;
 			ConstrainedBFSTree tree = null;
 			if (intent instanceof ConstrainedShortestPathIntent) {
 				bandwidth = ((ConstrainedShortestPathIntent) intent).getBandwidth();
@@ -72,7 +72,7 @@
 				// TODO should push back the intent to caller
 				continue;
 			}
-
+			
 			pathIntents.addIntent(new PathIntent("pi" + intent.getId(), path, bandwidth, intent));
 		}
 		return pathIntents;
diff --git a/src/test/java/net/onrc/onos/intent/ConstrainedShortestPathIntentTest.java b/src/test/java/net/onrc/onos/intent/ConstrainedShortestPathIntentTest.java
index 8160ca8..354e053 100644
--- a/src/test/java/net/onrc/onos/intent/ConstrainedShortestPathIntentTest.java
+++ b/src/test/java/net/onrc/onos/intent/ConstrainedShortestPathIntentTest.java
@@ -2,10 +2,15 @@
 
 import static org.junit.Assert.*;
 import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
 public class ConstrainedShortestPathIntentTest {
 	NetworkGraph g;
 
@@ -22,21 +27,27 @@
 
 	@Test
 	public void test() {
+		Kryo kryo = new Kryo();
+		Output output = new Output(1024);
+
 		ConstrainedShortestPathIntent intent1 =
-				new ConstrainedShortestPathIntent(g, "1", 1L, 20L, 1L, 4L, 20L, 4L, 1000.0);
+				new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
-		byte b[] = intent1.toBytes();
+		kryo.writeObject(output, intent1);
+		output.close();
 
+		Input input = new Input(output.toBytes());
 		ConstrainedShortestPathIntent intent2 =
-				ConstrainedShortestPathIntent.fromBytes(g, b);
+				kryo.readObject(input, ConstrainedShortestPathIntent.class);
+		input.close();
 
 		assertEquals("1", intent2.getId());
-		assertEquals(Long.valueOf(1), intent2.getSourcePort().getSwitch().getDpid());
-		assertEquals(Long.valueOf(20), intent2.getSourcePort().getNumber());
-		assertEquals(1L, intent2.getSourceMac().toLong());
-		assertEquals(Long.valueOf(4), intent2.getDestinationPort().getSwitch().getDpid());
-		assertEquals(Long.valueOf(20), intent2.getDestinationPort().getNumber());
-		assertEquals(4L, intent2.getDestinationMac().toLong());
-		assertEquals(Double.valueOf(1000.0), intent2.getBandwidth());
+		assertEquals(2L, intent2.getSrcSwitchDpid());
+		assertEquals(3L, intent2.getSrcPortNumber());
+		assertEquals(4L, intent2.getSrcMac());
+		assertEquals(5L, intent2.getDstSwitchDpid());
+		assertEquals(6L, intent2.getDstPortNumber());
+		assertEquals(7L, intent2.getDstMac());
+		assertEquals(1000.0, intent2.getBandwidth(), 0.0);
 	}
 }
diff --git a/src/test/java/net/onrc/onos/intent/ShortestPathIntentTest.java b/src/test/java/net/onrc/onos/intent/ShortestPathIntentTest.java
index a0da341..e325be8 100644
--- a/src/test/java/net/onrc/onos/intent/ShortestPathIntentTest.java
+++ b/src/test/java/net/onrc/onos/intent/ShortestPathIntentTest.java
@@ -2,10 +2,15 @@
 
 import static org.junit.Assert.*;
 import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import com.esotericsoftware.kryo.Kryo;
+import com.esotericsoftware.kryo.io.Input;
+import com.esotericsoftware.kryo.io.Output;
+
 public class ShortestPathIntentTest {
 	NetworkGraph g;
 
@@ -22,21 +27,26 @@
 
 	@Test
 	public void test() {
+		Kryo kryo = new Kryo();
+		Output output = new Output(1024);
+
 		ShortestPathIntent intent1 =
-				new ShortestPathIntent(g, "1", 1L, 20L, 1L, 4L, 20L, 4L);
+				new ShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L);
 
-		byte b[] = intent1.toBytes();
+		kryo.writeObject(output, intent1);
+		output.close();
 
+		Input input = new Input(output.toBytes());
 		ShortestPathIntent intent2 =
-				ShortestPathIntent.fromBytes(g, b);
+				kryo.readObject(input, ShortestPathIntent.class);
+		input.close();
 
 		assertEquals("1", intent2.getId());
-		assertEquals(Long.valueOf(1), intent2.getSourcePort().getSwitch().getDpid());
-		assertEquals(Long.valueOf(20), intent2.getSourcePort().getNumber());
-		assertEquals(1L, intent2.getSourceMac().toLong());
-		assertEquals(Long.valueOf(4), intent2.getDestinationPort().getSwitch().getDpid());
-		assertEquals(Long.valueOf(20), intent2.getDestinationPort().getNumber());
-		assertEquals(4L, intent2.getDestinationMac().toLong());
+		assertEquals(2L, intent2.getSrcSwitchDpid());
+		assertEquals(3L, intent2.getSrcPortNumber());
+		assertEquals(4L, intent2.getSrcMac());
+		assertEquals(5L, intent2.getDstSwitchDpid());
+		assertEquals(6L, intent2.getDstPortNumber());
+		assertEquals(7L, intent2.getDstMac());
 	}
-
 }
diff --git a/src/test/java/net/onrc/onos/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/intent/runtime/UseCaseTest.java
index 73eee6b..554aece 100644
--- a/src/test/java/net/onrc/onos/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/intent/runtime/UseCaseTest.java
@@ -49,9 +49,9 @@
 	public void useCase1() {
 		// create shortest path intents
 		LinkedList<Intent> intents = new LinkedList<Intent>();
-		intents.add(new ShortestPathIntent(g, "1", 1L, 20L, 1L, 4L, 20L, 4L));
-		intents.add(new ShortestPathIntent(g, "2", 2L, 20L, 2L, 6L, 20L, 5L));
-		intents.add(new ShortestPathIntent(g, "3", 4L, 20L, 3L, 8L, 20L, 6L));
+		intents.add(new ShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 4L));
+		intents.add(new ShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 5L));
+		intents.add(new ShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 6L));
 
 		// compile high-level intents into low-level intents (calculate paths)
 		PathCalcRuntime runtime1 = new PathCalcRuntime(g);
@@ -65,11 +65,11 @@
 	public void useCase2() {
 		// create constrained shortest path intents
 		LinkedList<Intent> intents = new LinkedList<Intent>();
-		intents.add(new ConstrainedShortestPathIntent(g, "1", 1L, 20L, 1L, 4L, 20L, 17L, 400.0));
-		intents.add(new ConstrainedShortestPathIntent(g, "2", 2L, 20L, 2L, 6L, 20L, 18L, 400.0));
-		intents.add(new ConstrainedShortestPathIntent(g, "3", 4L, 20L, 3L, 8L, 20L, 19L, 400.0));
-		intents.add(new ConstrainedShortestPathIntent(g, "4", 3L, 20L, 4L, 8L, 20L, 20L, 400.0));
-		intents.add(new ConstrainedShortestPathIntent(g, "5", 4L, 20L, 5L, 8L, 20L, 21L, 400.0));
+		intents.add(new ConstrainedShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 17L, 400.0));
+		intents.add(new ConstrainedShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 18L, 400.0));
+		intents.add(new ConstrainedShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 19L, 400.0));
+		intents.add(new ConstrainedShortestPathIntent("4", 3L, 20L, 4L, 8L, 20L, 20L, 400.0));
+		intents.add(new ConstrainedShortestPathIntent("5", 4L, 20L, 5L, 8L, 20L, 21L, 400.0));
 
 		// compile high-level intents into low-level intents (calculate paths)
 		PathCalcRuntime runtime1 = new PathCalcRuntime(g);
@@ -83,11 +83,11 @@
 	public void useCase3() {
 		// create constrained & not best effort shortest path intents
 		LinkedList<Intent> intents = new LinkedList<Intent>();
-		intents.add(new ConstrainedShortestPathIntent(g, "1", 1L, 20L, 1L, 4L, 20L, 6L, 600.0));
-		intents.add(new ConstrainedShortestPathIntent(g, "2", 2L, 20L, 2L, 6L, 20L, 7L, 600.0));
-		intents.add(new ShortestPathIntent(g, "3", 4L, 20L, 3L, 8L, 20L, 8L));
-		intents.add(new ShortestPathIntent(g, "4", 4L, 20L, 4L, 8L, 20L, 9L));
-		intents.add(new ConstrainedShortestPathIntent(g, "5", 4L, 20L, 5L, 8L, 20L, 10L, 600.0));
+		intents.add(new ConstrainedShortestPathIntent("1", 1L, 20L, 1L, 4L, 20L, 6L, 600.0));
+		intents.add(new ConstrainedShortestPathIntent("2", 2L, 20L, 2L, 6L, 20L, 7L, 600.0));
+		intents.add(new ShortestPathIntent("3", 4L, 20L, 3L, 8L, 20L, 8L));
+		intents.add(new ShortestPathIntent("4", 4L, 20L, 4L, 8L, 20L, 9L));
+		intents.add(new ConstrainedShortestPathIntent("5", 4L, 20L, 5L, 8L, 20L, 10L, 600.0));
 
 		// compile high-level intents into low-level intents (calculate paths)
 		PathCalcRuntime runtime1 = new PathCalcRuntime(g);