Bug 5540 - Remove ConvertorManager singleton
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / match / MatchReactorTest.java
index e2d7de2439dd85f2bc04e9613a97fa2079c23950..eba0299e43cda8093386424b212995f376d6e2ee 100644 (file)
@@ -11,6 +11,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
@@ -23,8 +25,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * match conversion and injection test
  */
 public class MatchReactorTest {
-
     private MatchBuilder matchBuilder;
+    private ConvertorManager convertorManager;
 
     /**
      * prepare input match
@@ -37,6 +39,7 @@ public class MatchReactorTest {
         ethernetTypeBuilder.setType(new EtherType(42L));
         ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
         matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
+        convertorManager = ConvertorManagerFactory.createDefaultManager();
     }
 
     /**
@@ -46,7 +49,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_flow() {
         FlowModInputBuilder target = new FlowModInputBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -57,7 +60,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_flow() {
         FlowModInputBuilder target = new FlowModInputBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -69,7 +72,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_mpRequestFlow() {
         MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -80,7 +83,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_mpRequestFlow() {
         MultipartRequestFlowBuilder target = new MultipartRequestFlowBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -88,7 +91,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_null() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(null,
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }
 
@@ -99,7 +102,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_mpRequestAggregate() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
     }
 
@@ -107,7 +110,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV13_null() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(null,
-                OFConstants.OFP_VERSION_1_3, target);
+                OFConstants.OFP_VERSION_1_3, target, convertorManager);
         Assert.assertNotNull(target.getMatch());
         Assert.assertEquals(0, target.getMatch().getMatchEntry().size());
     }
@@ -119,7 +122,7 @@ public class MatchReactorTest {
     public void testMatchConvertorV10_mpRequestAggregate() {
         MultipartRequestAggregateBuilder target = new MultipartRequestAggregateBuilder();
         MatchReactor.getInstance().convert(matchBuilder.build(),
-                OFConstants.OFP_VERSION_1_0, target);
+                OFConstants.OFP_VERSION_1_0, target, convertorManager);
         Assert.assertNotNull(target.getMatchV10());
     }