OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / OpenflowPluginBulkTransactionProvider.java
index 65d33d106d4ef6ecbe1e83686a05f8dd2cb6dcaf..c761ae54980454f0ffc62cfcffa22c0c32c88795 100644 (file)
@@ -20,7 +20,6 @@ import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
@@ -117,20 +116,21 @@ import org.slf4j.LoggerFactory;
 public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkTransactionProvider.class);
-    private DataBroker dataBroker;
+    private final DataBroker dataBroker;
     private final BundleContext ctx;
     private final String originalFlowName = "Foo";
     private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl();
-    private NotificationService notificationService;
+    private final NotificationService notificationService;
 
-    public OpenflowPluginBulkTransactionProvider(BundleContext ctx) {
+    public OpenflowPluginBulkTransactionProvider(DataBroker dataBroker, NotificationService notificationService,
+            BundleContext ctx) {
+        this.dataBroker = dataBroker;
+        this.notificationService = notificationService;
         this.ctx = ctx;
     }
 
-    public void onSessionInitiated(ProviderContext session) {
-        notificationService = session.getSALService(NotificationService.class);
+    public void init() {
         notificationService.registerNotificationListener(nodeErrorListener);
-        dataBroker = session.getSALService(DataBroker.class);
         ctx.registerService(CommandProvider.class.getName(), this, null);
         createTestFlow(createTestNode(null), null, null);
     }
@@ -659,7 +659,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
 
             @Override
             public void onFailure(Throwable throwable) {
-                LOG.error(throwable.getMessage(), throwable);
+                LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
         }, MoreExecutors.directExecutor());
@@ -716,7 +716,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider {
 
             @Override
             public void onFailure(Throwable throwable) {
-                LOG.error(throwable.getMessage(), throwable);
+                LOG.error("Status of Group Data Loaded Transaction : failure. Reason : {}", throwable);
                 ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
             }
         }, MoreExecutors.directExecutor());