Add unit tests to check serialization of resource API constructs
Change-Id: Id8291cac684994c4b87b1ceb3b62a8a84f426001
Showing
1 changed file
with
16 additions
and
0 deletions
... | @@ -24,6 +24,7 @@ import org.junit.After; | ... | @@ -24,6 +24,7 @@ import org.junit.After; |
24 | import org.junit.Before; | 24 | import org.junit.Before; |
25 | import org.junit.BeforeClass; | 25 | import org.junit.BeforeClass; |
26 | import org.junit.Test; | 26 | import org.junit.Test; |
27 | +import org.onlab.packet.VlanId; | ||
27 | import org.onlab.util.Bandwidth; | 28 | import org.onlab.util.Bandwidth; |
28 | import org.onlab.util.Frequency; | 29 | import org.onlab.util.Frequency; |
29 | import org.onosproject.cluster.NodeId; | 30 | import org.onosproject.cluster.NodeId; |
... | @@ -59,6 +60,8 @@ import org.onosproject.net.flow.FlowId; | ... | @@ -59,6 +60,8 @@ import org.onosproject.net.flow.FlowId; |
59 | import org.onosproject.net.flow.FlowRule; | 60 | import org.onosproject.net.flow.FlowRule; |
60 | import org.onosproject.net.flow.FlowRuleBatchEntry; | 61 | import org.onosproject.net.flow.FlowRuleBatchEntry; |
61 | import org.onosproject.net.intent.IntentId; | 62 | import org.onosproject.net.intent.IntentId; |
63 | +import org.onosproject.net.newresource.DefaultResource; | ||
64 | +import org.onosproject.net.newresource.DefaultResourceAllocation; | ||
62 | import org.onosproject.net.provider.ProviderId; | 65 | import org.onosproject.net.provider.ProviderId; |
63 | import org.onosproject.net.resource.link.BandwidthResource; | 66 | import org.onosproject.net.resource.link.BandwidthResource; |
64 | import org.onosproject.net.resource.link.BandwidthResourceAllocation; | 67 | import org.onosproject.net.resource.link.BandwidthResourceAllocation; |
... | @@ -126,6 +129,7 @@ public class KryoSerializerTest { | ... | @@ -126,6 +129,7 @@ public class KryoSerializerTest { |
126 | .build(); | 129 | .build(); |
127 | private static final OchSignal OCH_SIGNAL1 = (OchSignal) org.onosproject.net.Lambda.ochSignal( | 130 | private static final OchSignal OCH_SIGNAL1 = (OchSignal) org.onosproject.net.Lambda.ochSignal( |
128 | GridType.DWDM, ChannelSpacing.CHL_100GHZ, -8, 4); | 131 | GridType.DWDM, ChannelSpacing.CHL_100GHZ, -8, 4); |
132 | + private static final VlanId VLAN1 = VlanId.vlanId((short) 100); | ||
129 | 133 | ||
130 | private KryoSerializer serializer; | 134 | private KryoSerializer serializer; |
131 | 135 | ||
... | @@ -368,6 +372,18 @@ public class KryoSerializerTest { | ... | @@ -368,6 +372,18 @@ public class KryoSerializerTest { |
368 | testSerializable(new DefaultLinkResourceAllocations(request, allocations)); | 372 | testSerializable(new DefaultLinkResourceAllocations(request, allocations)); |
369 | } | 373 | } |
370 | 374 | ||
375 | + @Test | ||
376 | + public void testDefaultResouce() { | ||
377 | + testSerializedEquals(new DefaultResource<>(LinkKey.linkKey(CP1, CP2), VLAN1)); | ||
378 | + } | ||
379 | + | ||
380 | + @Test | ||
381 | + public void testDefaultResourceAllocation() { | ||
382 | + testSerializedEquals(new DefaultResourceAllocation<>( | ||
383 | + LinkKey.linkKey(CP1, CP2), | ||
384 | + VLAN1, | ||
385 | + IntentId.valueOf(30))); | ||
386 | + } | ||
371 | 387 | ||
372 | @Test | 388 | @Test |
373 | public void testFrequency() { | 389 | public void testFrequency() { | ... | ... |
-
Please register or login to post a comment