Update integration test base classes to use Log4J2
[controller.git] / opendaylight / md-sal / mdsal-it-base / src / main / java / org / opendaylight / controller / mdsal / it / base / AbstractMdsalTestBase.java
index 843cfced1fdc1f250bdd716f2d7b71c8549eaa74..500ce8980e560f1c351152ff22796fdf9e89dc4b 100644 (file)
@@ -22,7 +22,6 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
 import org.ops4j.pax.exam.util.Filter;
 import org.osgi.framework.BundleContext;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
 import org.ops4j.pax.exam.util.Filter;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -32,6 +31,8 @@ public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase imple
     private static final int REGISTRATION_TIMEOUT = 70000;
     @Inject @Filter(timeout=60000)
     private BundleContext context;
     private static final int REGISTRATION_TIMEOUT = 70000;
     @Inject @Filter(timeout=60000)
     private BundleContext context;
+    @Inject @Filter(timeout=60000)
+    private BindingAwareBroker broker;
     private ProviderContext session = null;
 
     public ProviderContext getSession() {
     private ProviderContext session = null;
 
     public ProviderContext getSession() {
@@ -49,11 +50,6 @@ public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase imple
     public void setup() throws Exception {
         super.setup();
         long start = System.nanoTime();
     public void setup() throws Exception {
         super.setup();
         long start = System.nanoTime();
-        ServiceReference<BindingAwareBroker> serviceReference = context.getServiceReference(BindingAwareBroker.class);
-        if(serviceReference == null) {
-            throw new RuntimeException("BindingAwareBroker not found");
-        }
-        BindingAwareBroker broker = context.getService(serviceReference);
         broker.registerProvider(this);
         for(int i=0;i<REGISTRATION_TIMEOUT;i++) {
             if(session !=null) {
         broker.registerProvider(this);
         for(int i=0;i<REGISTRATION_TIMEOUT;i++) {
             if(session !=null) {
@@ -72,8 +68,11 @@ public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase imple
     @Override
     public Option getLoggingOption() {
         Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
     @Override
     public Option getLoggingOption() {
         Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
-                        logConfiguration(AbstractMdsalTestBase.class),
-                        LogLevel.INFO.name());
+                "log4j2.logger.mdsal-it-base.name",
+                AbstractMdsalTestBase.class.getPackage().getName());
+        option = composite(option, editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+                "log4j2.logger.mdsal-it-base.level",
+                LogLevel.INFO.name()));
         option = composite(option, super.getLoggingOption());
         return option;
     }
         option = composite(option, super.getLoggingOption());
         return option;
     }