Bug 5540 - Remove ConvertorManager singleton
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / match / MatchConvertorV10ImplTest.java
index f454f4de004b906415773d67710c47de5205a7c2..639d6f31c11c51fb725b95da7307f3f483e13339 100644 (file)
@@ -9,9 +9,12 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match;
 
 import static org.junit.Assert.assertEquals;
+
 import java.math.BigInteger;
 import org.junit.Before;
 import org.junit.Test;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpVersion;
@@ -57,10 +60,12 @@ public class MatchConvertorV10ImplTest {
     private static final VlanId DEFAULT_VLAN_ID = new VlanId(42);
     private static final Ipv4Address DEFAULT_IPV4_ADDRESS = new Ipv4Address("10.0.0.1");
     private static final short DEFAULT_MASK = 24;
+    private ConvertorManager convertorManager;
 
     @Before
     public void setup() {
         OpenflowPortsUtil.init();
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     @Test
@@ -68,7 +73,7 @@ public class MatchConvertorV10ImplTest {
      * Test method for {@link MatchConvertorV10Impl#convert(Match,BigInteger)}
      */
     public void testConvert() {
-        MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build());
+        MatchV10 matchV10 = matchConvertorV10.convert(createL4UdpMatch().build(), null);
 
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
@@ -83,24 +88,24 @@ public class MatchConvertorV10ImplTest {
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
 
-        matchV10 = matchConvertorV10.convert(createL4TcpMatch().build());
+        matchV10 = matchConvertorV10.convert(createL4TcpMatch().build(), null);
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpSrc().intValue());
         assertEquals(DEFAULT_PORT.getValue().intValue(), matchV10.getTpDst().intValue());
 
-        matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build());
+        matchV10 = matchConvertorV10.convert(createVlanTcpMatch().build(), null);
         assertEquals(DEFAULT_VLAN_ID.getValue().intValue(), matchV10.getDlVlan().intValue());
 
     }
 
     /**
      * ICMPv4 match test for
-     * {@link MatchConvertorV10Impl#convert(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)}.
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertReactorConvertor#convert(Object, org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)}.
      */
     @Test
     public void testConvertIcmpv4() {
         MatchBuilder matchBuilder = createMatchBuilderWithDefaults();
         Match match = matchBuilder.build();
-        MatchV10 matchV10 = matchConvertorV10.convert(match);
+        MatchV10 matchV10 = matchConvertorV10.convert(match, convertorManager);
         Integer zero = 0;
         boolean wcTpSrc = true;
         boolean wcTpDst = true;
@@ -131,7 +136,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());
@@ -157,7 +162,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());
@@ -185,7 +190,7 @@ public class MatchConvertorV10ImplTest {
             wcTpDst, wcTpSrc);
         match = matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build()).
             build();
-        matchV10 = matchConvertorV10.convert(match);
+        matchV10 = matchConvertorV10.convert(match, convertorManager);
         assertEquals(ZERO_MAC, matchV10.getDlDst());
         assertEquals(FF_MAC, matchV10.getDlSrc());
         assertEquals(0, matchV10.getDlType().intValue());