Remove logback related stuff 33/60833/3
authorMichael Vorburger <vorburger@redhat.com>
Thu, 27 Jul 2017 18:55:27 +0000 (00:25 +0530)
committerRobert Varga <nite@hq.sk>
Wed, 2 Aug 2017 10:21:28 +0000 (10:21 +0000)
as discussed on https://lists.opendaylight.org/pipermail/odlparent-dev/2017-July/001262.html '

Change-Id: I09146cd363d1ab706143bc12c8b1e37aa96c8723
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
40 files changed:
opendaylight/commons/logback_settings/pom.xml [deleted file]
opendaylight/commons/logback_settings/src/main/resources/logback.xml [deleted file]
opendaylight/commons/protocol-framework/pom.xml
opendaylight/commons/protocol-framework/src/test/resources/logback-test.xml [deleted file]
opendaylight/config/config-artifacts/pom.xml
opendaylight/config/config-persister-impl/src/test/resources/capabilities-all.txt
opendaylight/config/config-persister-impl/src/test/resources/logback-test.xml [deleted file]
opendaylight/config/logback-config-loader/pom.xml [deleted file]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java [deleted file]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java [deleted file]
opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java [deleted file]
opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java [deleted file]
opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml [deleted file]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml [deleted file]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml [deleted file]
opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml [deleted file]
opendaylight/config/logback-config/pom.xml [deleted file]
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetter.java [deleted file]
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImpl.java [deleted file]
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModule.java [deleted file]
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleFactory.java [deleted file]
opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackStatusListener.java [deleted file]
opendaylight/config/logback-config/src/main/yang/config-logging.yang [deleted file]
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImplTest.java [deleted file]
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleTest.java [deleted file]
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleWithInitialConfigurationTest.java [deleted file]
opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackWithXmlConfigModuleTest.java [deleted file]
opendaylight/config/logback-config/src/test/resources/simple_config_logback.xml [deleted file]
opendaylight/config/pom.xml
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/sal-binding-it/src/test/resources/controller.xml
opendaylight/md-sal/sal-binding-it/src/test/resources/logback.xml [deleted file]
opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/logback.xml [deleted file]
pom.xml

diff --git a/opendaylight/commons/logback_settings/pom.xml b/opendaylight/commons/logback_settings/pom.xml
deleted file mode 100644 (file)
index 63b15a1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>odlparent</artifactId>
-    <version>2.0.2</version>
-    <relativePath/>
-  </parent>
-  <groupId>org.opendaylight.controller</groupId>
-  <artifactId>commons.logback_settings</artifactId>
-  <version>0.5.0-SNAPSHOT</version>
-  <scm>
-    <connection>scm:git:http://git.opendaylight.org/gerrit/controller.git</connection>
-    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
-    <tag>HEAD</tag>
-    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
-  </scm>
-</project>
diff --git a/opendaylight/commons/logback_settings/src/main/resources/logback.xml b/opendaylight/commons/logback_settings/src/main/resources/logback.xml
deleted file mode 100644 (file)
index 05e6075..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<configuration scan="true">
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="error">
-    <appender-ref ref="STDOUT" />
-  </root>
-</configuration>
index a5124b39d882c56c31232bacf06c6377cd8400b9..65922054fa1a57469eaf7776674771658829f94b 100644 (file)
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/opendaylight/commons/protocol-framework/src/test/resources/logback-test.xml b/opendaylight/commons/protocol-framework/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index 7ace930..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
-    </encoder>
-  </appender>
-
-  <root level="TRACE">
-    <appender-ref ref="STDOUT" />
-  </root>
-</configuration>
index b70b3da53d338857a77b900603636b6860131b67..1393e880b4ca7ae7c8a4e4c8efe8f7d2192391fd 100644 (file)
                 <type>test-jar</type>
                 <scope>test</scope>
             </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>logback-config</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>logback-config-loader</artifactId>
-                <version>${project.version}</version>
-            </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>netty-config-api</artifactId>
index 84c85b740cc61818725f9f9abf464408411a745e..b40741103d3ec3b50b9531efe9e174969ea2b7b7 100644 (file)
@@ -13,7 +13,6 @@ urn:ietf:params:netconf:capability:rollback-on-error:1.0
 urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&revision=2010-09-24
 urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl?module=threadpool-impl&revision=2013-04-05
 urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl?module=opendaylight-sal-dom-broker-impl&revision=2013-10-28
-urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&revision=2013-07-16
 urn:opendaylight:yang:extension:yang-ext?module=yang-ext&revision=2013-07-09
 urn:opendaylight:params:xml:ns:yang:iana?module=iana&revision=2013-08-16
 urn:opendaylight:params:xml:ns:yang:controller:md:sal:common?module=opendaylight-md-sal-common&revision=2013-10-28
diff --git a/opendaylight/config/config-persister-impl/src/test/resources/logback-test.xml b/opendaylight/config/config-persister-impl/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index a4ff3ab..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<configuration scan="true">
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <root level="error">
-        <appender-ref ref="STDOUT" />
-    </root>
-    <logger name="org.opendaylight.controller.netconf.persist.impl" level="TRACE"/>
-</configuration>
diff --git a/opendaylight/config/logback-config-loader/pom.xml b/opendaylight/config/logback-config-loader/pom.xml
deleted file mode 100644 (file)
index 711f1d4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>config-plugin-parent</artifactId>
-    <version>0.7.0-SNAPSHOT</version>
-    <relativePath>../config-plugin-parent</relativePath>
-  </parent>
-  <artifactId>logback-config-loader</artifactId>
-  <packaging>bundle</packaging>
-  <name>${project.artifactId}</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <configuration>
-          <instructions>
-            <Bundle-Activator>org.opendaylight.controller.logback.config.loader.Activator</Bundle-Activator>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/Activator.java
deleted file mode 100644 (file)
index fa67009..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader;
-
-import java.io.File;
-import java.util.List;
-import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigUtil;
-import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigurationLoader;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * default activator for loading multiple logback configuration files
- */
-public class Activator implements BundleActivator {
-
-    /**
-     * expected environment variable name, containing the root folder containing
-     * logback configurations
-     */
-    private static final String LOGBACK_CONFIG_D = "logback.config.d";
-    private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
-
-    @Override
-    public void start(BundleContext context) {
-        LOG.info("Starting logback configuration loader");
-        String logbackConfigRoot = System.getProperty(LOGBACK_CONFIG_D);
-        LOG.debug("configRoot: {}", logbackConfigRoot);
-        if (logbackConfigRoot != null) {
-            File logbackConfigRootFile = new File(logbackConfigRoot);
-            List<File> sortedConfigFiles = LogbackConfigUtil.harvestSortedConfigFiles(logbackConfigRootFile);
-            LogbackConfigurationLoader.load(true, sortedConfigFiles.toArray());
-        }
-    }
-
-    @Override
-    public void stop(BundleContext context) {
-        LOG.info("Stopping logback configuration loader");
-        // TODO: need reset/reload default config?
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigUtil.java
deleted file mode 100644 (file)
index 47e420f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.impl;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * logback config utils
- */
-public final class LogbackConfigUtil {
-
-    /** logback config file pattern (*.xml) */
-    protected static final String LOGBACK_CONFIG_FILE_REGEX_SEED = ".+\\.xml";
-    private static final Logger LOG = LoggerFactory
-            .getLogger(LogbackConfigUtil.class);
-
-    /**
-     *  forbidden ctor
-     */
-    private LogbackConfigUtil() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @param logConfigRoot folder containing configuration files
-     * @return sorted list of found files
-     */
-    public static List<File> harvestSortedConfigFiles(File logConfigRoot) {
-        final Pattern xmlFilePattern = Pattern.compile(LOGBACK_CONFIG_FILE_REGEX_SEED);
-        File[] configs = logConfigRoot.listFiles(new FileFilter() {
-            @Override
-            public boolean accept(File pathname) {
-                return pathname.isFile()
-                        && xmlFilePattern.matcher(pathname.getName()).find();
-            }
-        });
-
-        List<File> sortedConfigFiles = new ArrayList<File>(configs.length);
-        for (File cfgItem : configs) {
-            LOG.trace("config: {}", cfgItem.toURI());
-            sortedConfigFiles.add(cfgItem);
-        }
-        Collections.sort(sortedConfigFiles);
-
-        return sortedConfigFiles;
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java b/opendaylight/config/logback-config-loader/src/main/java/org/opendaylight/controller/logback/config/loader/impl/LogbackConfigurationLoader.java
deleted file mode 100644 (file)
index accb6e1..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Copyright (c) 201 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.impl;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.util.StatusPrinter;
-import java.io.File;
-import java.net.URL;
-import org.slf4j.ILoggerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Logback configuration loader.
- * Strategy:
- * <ol>
- * <li>reset actual configuration (probably default configuration)</li>
- * <li>load all given logback config xml files in given order</li>
- * </ol>
- */
-public final class LogbackConfigurationLoader {
-
-    private static final Logger LOG = LoggerFactory
-            .getLogger(LogbackConfigurationLoader.class);
-
-    /**
-     *  forbidden ctor
-     */
-    private LogbackConfigurationLoader() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * load given logback configurations in given order, reset existing configuration before applying first one
-     * @param purgeBefore require reset before loading first config
-     * @param args
-     */
-    public static void load(boolean purgeBefore, Object...args) {
-        try {
-            if (purgeBefore) {
-                resetExistingConfiguration();
-            }
-            for (Object logbackConfig : args) {
-                load(logbackConfig);
-            }
-        } catch (IllegalStateException e) {
-            LOG.warn("loading of multiple logback configurations failed", e);
-        }
-    }
-
-    /**
-     * purge existing logback configuration
-     */
-    public static void resetExistingConfiguration() {
-        LOG.trace("resetting existing logback configuration");
-        LoggerContext context = getLoggerContext();
-        JoranConfigurator configurator = new JoranConfigurator();
-        configurator.setContext(context);
-        context.reset();
-    }
-
-    /**
-     * @return logback context
-     */
-    private static LoggerContext getLoggerContext() {
-        ILoggerFactory context = LoggerFactory.getILoggerFactory();
-        if (context != null && context instanceof LoggerContext) {
-            // now SLF4J is bound to logback in the current environment
-            return (LoggerContext) context;
-        }
-        throw new IllegalStateException("current logger factory is not supported: " + context);
-    }
-
-    /**
-     * @param logbackConfig
-     * @param reset true if previous configuration needs to get purged
-     */
-    public static void load(Object logbackConfig) {
-        LOG.trace("BEFORE logback reconfig");
-        try {
-            LoggerContext context = getLoggerContext();
-            JoranConfigurator configurator = new JoranConfigurator();
-            configurator.setContext(context);
-            if (logbackConfig instanceof String) {
-                configurator.doConfigure((String) logbackConfig);
-            } else if (logbackConfig instanceof URL) {
-                configurator.doConfigure((URL) logbackConfig);
-            } else if (logbackConfig instanceof File) {
-                configurator.doConfigure((File) logbackConfig);
-            }
-
-            LOG.trace("applied {}", logbackConfig);
-            StatusPrinter.printInCaseOfErrorsOrWarnings(context);
-        } catch (IllegalStateException | JoranException je) {
-            LOG.warn("Logback configuration loading failed: {}", logbackConfig);
-        }
-        LOG.trace("AFTER logback reconfig");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/LogbackConfigurationLoaderTest.java
deleted file mode 100644 (file)
index 44a84b7..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigUtil;
-import org.opendaylight.controller.logback.config.loader.impl.LogbackConfigurationLoader;
-import org.opendaylight.controller.logback.config.loader.test.logwork.Debugger;
-import org.opendaylight.controller.logback.config.loader.test.logwork.Errorer;
-import org.opendaylight.controller.logback.config.loader.test.logwork.Informer;
-import org.opendaylight.controller.logback.config.loader.test.logwork.Tracer;
-import org.opendaylight.controller.logback.config.loader.test.logwork.Warner;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * test of logging config loader - {@link LogbackConfigurationLoader}
- */
-@RunWith(JUnit4.class)
-public class LogbackConfigurationLoaderTest {
-
-    /** logback config root */
-    private static final String LOGBACK_D = "/logback.d";
-    private static final Logger LOG = LoggerFactory
-            .getLogger(LogbackConfigurationLoaderTest.class);
-
-    /**
-     * Test of method {@link LogbackConfigurationLoader#load(boolean, Object[])}
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testLoad() throws Exception {
-        File logConfigRoot = new File(LogbackConfigurationLoaderTest.class
-                .getResource(LOGBACK_D).getFile());
-        List<File> sortedConfigFiles = LogbackConfigUtil.harvestSortedConfigFiles(logConfigRoot);
-        LogbackConfigurationLoader.load(true, sortedConfigFiles.toArray());
-
-        LOG.info("LOGBACK ready -> about to use it");
-
-        Tracer.doSomeAction();
-        Debugger.doSomeAction();
-        Informer.doSomeAction();
-        Warner.doSomeAction();
-        Errorer.doSomeAction();
-
-        // check logs
-        String[] expectedLogs = new String[] {
-            "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest: LOGBACK ready -> about to use it",
-            "LoggingEvent -> [TRACE] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: tracing",
-            "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: debugging",
-            "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: infoing",
-            "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: warning",
-            "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Tracer: erroring",
-            "LoggingEvent -> [DEBUG] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: debugging",
-            "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: infoing",
-            "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: warning",
-            "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Debugger: erroring",
-            "LoggingEvent -> [INFO] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: infoing",
-            "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: warning",
-            "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Informer: erroring",
-            "LoggingEvent -> [WARN] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: warning",
-            "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Warner: erroring",
-            "LoggingEvent -> [ERROR] org.opendaylight.controller.logback.config.loader.test.logwork.Errorer: erroring"
-        };
-
-        List<String> logSnapshot = new ArrayList<>(TestAppender.getLogRecord());
-        for (String logLine : logSnapshot) {
-            LOG.info("\"{}\",", logLine);
-        }
-
-        Assert.assertArrayEquals(expectedLogs, logSnapshot.toArray());
-    }
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/TestAppender.java
deleted file mode 100644 (file)
index a950c81..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test;
-
-import ch.qos.logback.classic.spi.LoggingEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.LogbackException;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.spi.FilterReply;
-import ch.qos.logback.core.status.Status;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * dummy appender for collecting log messages
- *
- * @param <E>
- */
-public class TestAppender<E> implements Appender<E> {
-
-    private boolean started;
-    private Context context;
-    private String name;
-
-    private static List<String> logRecord = new ArrayList<>();
-
-    @Override
-    public void start() {
-        started = true;
-    }
-
-    @Override
-    public void stop() {
-        started = false;
-    }
-
-    @Override
-    public boolean isStarted() {
-        return started;
-    }
-
-    @Override
-    public void setContext(Context context) {
-        this.context = context;
-    }
-
-    @Override
-    public Context getContext() {
-        return context;
-    }
-
-    @Override
-    public void addStatus(Status status) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addInfo(String msg) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addInfo(String msg, Throwable ex) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addWarn(String msg) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addWarn(String msg, Throwable ex) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addError(String msg) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addError(String msg, Throwable ex) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void addFilter(Filter<E> newFilter) {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public void clearAllFilters() {
-        // TODO Auto-generated method stub
-    }
-
-    @Override
-    public List<Filter<E>> getCopyOfAttachedFiltersList() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public FilterReply getFilterChainDecision(E event) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public void doAppend(E event) throws LogbackException {
-        if (event instanceof LoggingEvent) {
-            LoggingEvent lEvent = (LoggingEvent) event;
-            logRecord.add(String.format("%s -> [%s] %s: %s", event.getClass()
-                    .getSimpleName(), lEvent.getLevel(),
-                    lEvent.getLoggerName(), lEvent.getMessage()));
-        } else {
-            logRecord.add(event.getClass() + " -> " + event.toString());
-        }
-    }
-
-    @Override
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * @return the logRecord
-     */
-    public static List<String> getLogRecord() {
-        return logRecord;
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Debugger.java
deleted file mode 100644 (file)
index ec10ae9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test.logwork;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * dummy logging guy
- */
-public class Debugger {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Debugger.class);
-
-    /**
-     * all logging
-     */
-    public static void doSomeAction() {
-        LOG.trace("tracing");
-        LOG.debug("debugging");
-        LOG.info("infoing");
-        LOG.warn("warning");
-        LOG.error("erroring");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Errorer.java
deleted file mode 100644 (file)
index e33b7f9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test.logwork;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * dummy logging guy
- */
-public class Errorer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Errorer.class);
-
-    /**
-     * all logging
-     */
-    public static void doSomeAction() {
-        LOG.trace("tracing");
-        LOG.debug("debugging");
-        LOG.info("infoing");
-        LOG.warn("warning");
-        LOG.error("erroring");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Informer.java
deleted file mode 100644 (file)
index 06c5183..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test.logwork;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * dummy logging guy
- */
-public class Informer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Informer.class);
-
-    /**
-     * all logging
-     */
-    public static void doSomeAction() {
-        LOG.trace("tracing");
-        LOG.debug("debugging");
-        LOG.info("infoing");
-        LOG.warn("warning");
-        LOG.error("erroring");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Tracer.java
deleted file mode 100644 (file)
index c842c1a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test.logwork;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * dummy logging guy
- */
-public class Tracer {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Tracer.class);
-
-    /**
-     * all logging
-     */
-    public static void doSomeAction() {
-        LOG.trace("tracing");
-        LOG.debug("debugging");
-        LOG.info("infoing");
-        LOG.warn("warning");
-        LOG.error("erroring");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java b/opendaylight/config/logback-config-loader/src/test/java/org/opendaylight/controller/logback/config/loader/test/logwork/Warner.java
deleted file mode 100644 (file)
index aae0c34..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.logback.config.loader.test.logwork;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * dummy logging guy
- */
-public class Warner {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Warner.class);
-
-    /**
-     * all logging
-     */
-    public static void doSomeAction() {
-        LOG.trace("tracing");
-        LOG.debug("debugging");
-        LOG.info("infoing");
-        LOG.warn("warning");
-        LOG.error("erroring");
-    }
-
-}
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback-test.xml
deleted file mode 100755 (executable)
index 52f2521..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="true">
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="INFO">
-    <appender-ref ref="STDOUT" />
-  </root>
-
-  <!--  Base log level  -->
-  <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>
-
-</configuration>
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt.xml
deleted file mode 100755 (executable)
index e4f8dfc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="false">
-
-  <appender name="TEST" class="org.opendaylight.controller.logback.config.loader.test.TestAppender"/>
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%date{"yyyy-MM-dd HH:mm:ss.SSS z"} [%thread] %-5level %logger{36} - %msg%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="INFO">
-    <appender-ref ref="TEST" />
-    <appender-ref ref="STDOUT" />
-  </root>
-
-  <!--  Base log level  -->
-  <logger name="org.opendaylight.controller.logback.config.loader" level="INFO"/>
-
-</configuration>
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt2.xml
deleted file mode 100755 (executable)
index 83557f6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="false">
-
-  <!--  Base log level  -->
-  <logger name="org.opendaylight.controller.logback.config.loader" level="DEBUG"/>
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Tracer" level="TRACE"/>
-<!--   <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Debugger" level="DEBUG"/> -->
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="DEBUG"/>
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="ERROR"/>
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Errorer" level="ERROR"/>
-
-</configuration>
diff --git a/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml b/opendaylight/config/logback-config-loader/src/test/resources/logback.d/logback-alt3.xml
deleted file mode 100755 (executable)
index a944cc2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration debug="false">
-  <root level="INFO">
-    <appender-ref ref="TEST" />
-  </root>
-
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Informer" level="INFO"/>
-  <logger name="org.opendaylight.controller.logback.config.loader.test.logwork.Warner" level="WARN"/>
-
-  <logger name="org.opendaylight.controller.logback.config.loader.test.LogbackConfigurationLoaderTest" level="TRACE"/>
-</configuration>
diff --git a/opendaylight/config/logback-config/pom.xml b/opendaylight/config/logback-config/pom.xml
deleted file mode 100644 (file)
index 57f4e7f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.opendaylight.controller</groupId>
-    <artifactId>config-plugin-parent</artifactId>
-    <version>0.7.0-SNAPSHOT</version>
-    <relativePath>../config-plugin-parent</relativePath>
-  </parent>
-  <artifactId>logback-config</artifactId>
-  <packaging>bundle</packaging>
-  <name>${project.artifactId}</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>config-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-classic</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>ch.qos.logback</groupId>
-      <artifactId>logback-core</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.opendaylight.yangtools</groupId>
-      <artifactId>mockito-configuration</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-
-    <!-- test dependencies -->
-
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>config-manager</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>config-manager</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>config-util</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <configuration>
-          <instructions>
-            <Export-Package>org.opendaylight.controller.config.yang.logback.config,
-                            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.logback.config.rev130716.*,</Export-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yang-maven-plugin</artifactId>
-      </plugin>
-
-    </plugins>
-  </build>
-</project>
diff --git a/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetter.java b/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetter.java
deleted file mode 100644 (file)
index 8caa647..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-/**
- * Updates current state of Logback configuration.
- */
-public interface ContextSetter {
-
-    void updateContext(LogbackModule module);
-
-}
diff --git a/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImpl.java b/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImpl.java
deleted file mode 100644 (file)
index cbb2182..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
-import ch.qos.logback.classic.filter.ThresholdFilter;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
-import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
-import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
-import ch.qos.logback.core.util.FileSize;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of {@link ContextSetter}. Resets running logback
- * configuration.
- */
-public class ContextSetterImpl implements ContextSetter, Closeable {
-
-    private final LogbackStatusListener statusListener;
-    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ContextSetterImpl.class);
-
-    public ContextSetterImpl(final LogbackRuntimeRegistrator rootRuntimeBeanRegistratorWrapper) {
-        statusListener = new LogbackStatusListener(rootRuntimeBeanRegistratorWrapper);
-        statusListener.register();
-    }
-
-    @Override
-    public void updateContext(final LogbackModule module) {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-
-        List<ch.qos.logback.classic.Logger> loggersBefore = context.getLoggerList();
-
-        createLoggers(context, module, Sets.newHashSet(loggersBefore));
-    }
-
-    private Map<String, Appender<ILoggingEvent>> createConsoleAppenders(final LoggerContext context, final LogbackModule module) {
-        Map<String, Appender<ILoggingEvent>> appendersMap = new HashMap<>();
-        for (ConsoleAppenderTO appender : module.getConsoleAppenderTO()) {
-            Preconditions.checkState(appendersMap.containsKey(appender.getName()) == false,
-                    "Duplicate appender name %s", appender.getName());
-            ch.qos.logback.core.ConsoleAppender<ILoggingEvent> app = new ch.qos.logback.core.ConsoleAppender<>();
-            app.setContext(context);
-            PatternLayoutEncoder encoder = new PatternLayoutEncoder();
-            encoder.setContext(context);
-            encoder.setPattern(appender.getEncoderPattern());
-            encoder.start();
-            app.setEncoder(encoder);
-            ThresholdFilter filter = new ThresholdFilter();
-            filter.setContext(context);
-            filter.setLevel(appender.getThresholdFilter());
-            filter.start();
-            app.getCopyOfAttachedFiltersList().add(filter);
-            app.setName(appender.getName());
-            app.start();
-            appendersMap.put(app.getName(), app);
-        }
-        return appendersMap;
-    }
-
-    private void createLoggers(final LoggerContext context, final LogbackModule module,
-            final Set<ch.qos.logback.classic.Logger> loggersBefore) {
-
-        Map<String, Appender<ILoggingEvent>> appendersMap = getAppenders(module, context);
-
-        for (LoggerTO logger : module.getLoggerTO()) {
-            LOG.trace("Setting configuration for logger {}", logger.getLoggerName());
-            final ch.qos.logback.classic.Logger logbackLogger = context.getLogger(logger.getLoggerName());
-
-            Optional<Set<Appender<ILoggingEvent>>> appendersBefore = getAppendersBefore(loggersBefore, logbackLogger);
-            LOG.trace("Logger {}: Appenders registered before: {}", logger.getLoggerName(),
-                    appendersBefore.isPresent() ? appendersBefore.get() : "NO APPENDERS BEFORE");
-
-            logbackLogger.setLevel(Level.toLevel(logger.getLevel()));
-
-            addNewAppenders(appendersMap, logger, logbackLogger, appendersBefore);
-            removeBeforeAppenders(loggersBefore, logger, logbackLogger, appendersBefore);
-        }
-    }
-
-    private void addNewAppenders(final Map<String, Appender<ILoggingEvent>> appendersMap, final LoggerTO logger,
-            final ch.qos.logback.classic.Logger logbackLogger, final Optional<Set<Appender<ILoggingEvent>>> appendersBefore) {
-        if (logger.getAppenders() != null) {
-            for (String appenderName : logger.getAppenders()) {
-                if (appendersMap.containsKey(appenderName)) {
-                    logbackLogger.addAppender(appendersMap.get(appenderName));
-                    LOG.trace("Logger {}: Adding new appender: {}", logger.getLoggerName(), appenderName);
-                } else {
-                    throw new IllegalStateException("No appender " + appenderName
-                            + " found. This error should have been discovered by validation");
-                }
-            }
-        }
-    }
-
-    private void removeBeforeAppenders(final Set<ch.qos.logback.classic.Logger> loggersBefore, final LoggerTO logger,
-            final ch.qos.logback.classic.Logger logbackLogger, final Optional<Set<Appender<ILoggingEvent>>> appendersBefore) {
-        if (appendersBefore.isPresent()) {
-            for (Appender<ILoggingEvent> appenderBefore : appendersBefore.get()) {
-                logbackLogger.detachAppender(appenderBefore);
-                appenderBefore.stop();
-                LOG.trace("Logger {}: Removing old appender: {}", logger.getLoggerName(),
-                        appenderBefore.getName());
-            }
-            loggersBefore.remove(logbackLogger);
-        }
-    }
-
-    private Optional<Set<Appender<ILoggingEvent>>> getAppendersBefore(final Set<ch.qos.logback.classic.Logger> loggersBefore,
-            final ch.qos.logback.classic.Logger logbackLogger) {
-        if (loggersBefore.contains(logbackLogger)) {
-            Iterator<Appender<ILoggingEvent>> appenderIt = logbackLogger.iteratorForAppenders();
-            Set<Appender<ILoggingEvent>> appendersBefore = Sets.newHashSet();
-            while (appenderIt.hasNext()) {
-                appendersBefore.add(appenderIt.next());
-            }
-            return Optional.of(appendersBefore);
-        } else {
-            return Optional.absent();
-        }
-
-    }
-
-    private Map<String, Appender<ILoggingEvent>> getAppenders(final LogbackModule module, final LoggerContext context) {
-        Map<String, Appender<ILoggingEvent>> appendersMap = new HashMap<>();
-        addAllAppenders(appendersMap, createRollingAppenders(context, module));
-        addAllAppenders(appendersMap, createFileAppenders(context, module));
-        addAllAppenders(appendersMap, createConsoleAppenders(context, module));
-
-        return appendersMap;
-    }
-
-    private void addAllAppenders(final Map<String, Appender<ILoggingEvent>> allAppenders,
-            final Map<String, Appender<ILoggingEvent>> appendersToAdd) {
-        for (String appenderName : appendersToAdd.keySet()) {
-            Preconditions.checkState(allAppenders.containsKey(appenderName) == false, "Duplicate appender name %s",
-                    appenderName);
-            allAppenders.put(appenderName, appendersToAdd.get(appenderName));
-        }
-    }
-
-    private Map<String, Appender<ILoggingEvent>> createFileAppenders(final LoggerContext context, final LogbackModule module) {
-        Map<String, Appender<ILoggingEvent>> appendersMap = new HashMap<>();
-        for (FileAppenderTO appender : module.getFileAppenderTO()) {
-            Preconditions.checkState(appendersMap.containsKey(appender.getName()) == false,
-                    "Duplicate appender name %s", appender.getName());
-            ch.qos.logback.core.FileAppender<ILoggingEvent> app = new ch.qos.logback.core.FileAppender<>();
-            app.setAppend(appender.getAppend());
-            app.setContext(context);
-            PatternLayoutEncoder encoder = new PatternLayoutEncoder();
-            encoder.setContext(context);
-            encoder.setPattern(appender.getEncoderPattern());
-            encoder.start();
-            app.setEncoder(encoder);
-            app.setFile(appender.getFileName());
-            app.setName(appender.getName());
-            app.start();
-            appendersMap.put(app.getName(), app);
-        }
-
-        return appendersMap;
-    }
-
-    private Map<String, Appender<ILoggingEvent>> createRollingAppenders(final LoggerContext context, final LogbackModule module) {
-        Map<String, Appender<ILoggingEvent>> appendersMap = new HashMap<>();
-        for (RollingFileAppenderTO appender : module.getRollingFileAppenderTO()) {
-            Preconditions.checkState(appendersMap.containsKey(appender.getName()) == false,
-                    "Duplicate appender name %s", appender.getName());
-            ch.qos.logback.core.rolling.RollingFileAppender<ILoggingEvent> app = new ch.qos.logback.core.rolling.RollingFileAppender<>();
-            app.setAppend(appender.getAppend());
-            app.setContext(context);
-            PatternLayoutEncoder encoder = new PatternLayoutEncoder();
-            encoder.setContext(context);
-            encoder.setPattern(appender.getEncoderPattern());
-            encoder.start();
-            app.setEncoder(encoder);
-            app.setFile(appender.getFileName());
-            if (appender.getRollingPolicyType().equals("FixedWindowRollingPolicy")) {
-                FixedWindowRollingPolicy policy = new FixedWindowRollingPolicy();
-                policy.setContext(context);
-                policy.setMaxIndex(appender.getMaxIndex());
-                policy.setMinIndex(appender.getMinIndex());
-                policy.setFileNamePattern(appender.getFileNamePattern());
-                policy.setParent(app);
-                policy.start();
-                app.setRollingPolicy(policy);
-            } else if (appender.getRollingPolicyType().equals("TimeBasedRollingPolicy")) {
-                TimeBasedRollingPolicy<ILoggingEvent> policy = new TimeBasedRollingPolicy<>();
-                policy.setContext(context);
-                policy.setMaxHistory(appender.getMaxHistory());
-                if (appender.getCleanHistoryOnStart() != null) {
-                    policy.setCleanHistoryOnStart(appender.getCleanHistoryOnStart());
-                }
-                policy.setFileNamePattern(appender.getFileNamePattern());
-                policy.setParent(app);
-                policy.start();
-                app.setRollingPolicy(policy);
-            }
-            SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<>();
-            triggeringPolicy.setContext(context);
-            triggeringPolicy.setMaxFileSize(FileSize.valueOf(appender.getMaxFileSize()));
-            triggeringPolicy.start();
-            app.setTriggeringPolicy(triggeringPolicy);
-            app.setName(appender.getName());
-            app.start();
-            appendersMap.put(app.getName(), app);
-        }
-        return appendersMap;
-    }
-
-    @Override
-    public void close() throws IOException {
-        statusListener.close();
-    }
-}
diff --git a/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModule.java b/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModule.java
deleted file mode 100644 (file)
index 3a5fc3a..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/**
- * Generated file
-
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jul 17 15:26:45 CEST 2013
- *
- * Do not modifiy this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import com.google.common.collect.Sets;
-import java.util.Set;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-
-/**
-*
-*/
-public final class LogbackModule extends org.opendaylight.controller.config.yang.logback.config.AbstractLogbackModule {
-
-    public LogbackModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(name, dependencyResolver);
-    }
-
-    public LogbackModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
-            final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
-            final org.opendaylight.controller.config.yang.logback.config.AbstractLogbackModule oldModule,
-            final java.lang.AutoCloseable oldInstance) {
-        super(name, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void validate() {
-        super.validate();
-        Set<String> appenderNames = Sets.newHashSet();
-        validateRollingObjects(appenderNames);
-        validateConsoleObjects(appenderNames);
-        validateFileObjects(appenderNames);
-        validateLoggersObjects(appenderNames);
-    }
-
-    private void validateLoggersObjects(final Set<String> appenderNames) {
-        JmxAttributeValidationException.checkNotNull(getLoggerTO(), loggersJmxAttribute);
-
-        for (LoggerTO loggerToValidate : getLoggerTO()) {
-            JmxAttributeValidationException.checkNotNull(loggerToValidate.getLoggerName(), "LoggerName is null",
-                    loggersJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(loggerToValidate.getLevel(), "Level is null",
-                    loggersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!loggerToValidate.getLoggerName().isEmpty(),
-                    "LoggerName needs to be set", loggersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!loggerToValidate.getLevel().isEmpty(),
-                    "Level needs to be set", loggersJmxAttribute);
-            if (loggerToValidate.getAppenders() != null) {
-                for (String appenderName : loggerToValidate.getAppenders()) {
-                    JmxAttributeValidationException.checkCondition(appenderNames.contains(appenderName), "Appender "
-                            + appenderName + " referenced by logger " + loggerToValidate.getLoggerName()
-                            + " not present in configuration, present appenders: " + appenderNames, loggersJmxAttribute);
-                }
-            }
-
-        }
-    }
-
-    private void validateConsoleObjects(final Set<String> appenderNames) {
-
-        JmxAttributeValidationException.checkNotNull(getConsoleAppenderTO(), consoleAppendersJmxAttribute);
-        for (ConsoleAppenderTO object : getConsoleAppenderTO()) {
-            JmxAttributeValidationException.checkNotNull(object.getEncoderPattern(), "EncoderPattern is null",
-                    consoleAppendersJmxAttribute);
-
-            validateAppenderName(appenderNames, object.getName(), consoleAppendersJmxAttribute);
-
-            JmxAttributeValidationException.checkNotNull(object.getThresholdFilter(), "Filterlevel is null",
-                    consoleAppendersJmxAttribute);
-        }
-    }
-
-    private void validateFileObjects(final Set<String> appenderNames) {
-        JmxAttributeValidationException.checkNotNull(getFileAppenderTO(), fileAppendersJmxAttribute);
-        for (FileAppenderTO object : getFileAppenderTO()) {
-            JmxAttributeValidationException.checkNotNull(object.getEncoderPattern(), "EncoderPattern is null",
-                    fileAppendersJmxAttribute);
-
-            validateAppenderName(appenderNames, object.getName(), fileAppendersJmxAttribute);
-
-            JmxAttributeValidationException.checkNotNull(object.getFileName(), "FileName is null",
-                    fileAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getEncoderPattern().isEmpty(),
-                    "EncoderPattern needs to be set", fileAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getFileName().isEmpty(), "FileName needs to be set",
-                    fileAppendersJmxAttribute);
-
-        }
-    }
-
-    private void validateRollingObjects(final Set<String> appenderNames) {
-
-        JmxAttributeValidationException.checkNotNull(getRollingFileAppenderTO(), rollingAppendersJmxAttribute);
-        for (RollingFileAppenderTO object : getRollingFileAppenderTO()) {
-            JmxAttributeValidationException.checkNotNull(object.getEncoderPattern(), "EncoderPattern is null",
-                    rollingAppendersJmxAttribute);
-
-            validateAppenderName(appenderNames, object.getName(), rollingAppendersJmxAttribute);
-
-            JmxAttributeValidationException.checkNotNull(object.getFileName(), "FileName is null",
-                    rollingAppendersJmxAttribute);
-
-            JmxAttributeValidationException.checkNotNull(object.getFileNamePattern(), "FileNamePattern is null",
-                    rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkNotNull(object.getRollingPolicyType(), "RollingPolicyType is null",
-                    rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getFileNamePattern().isEmpty(),
-                    "FileNamePattern is not set", rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getRollingPolicyType().isEmpty(),
-                    "RollingPolicyType is not set", rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(
-                    (object.getRollingPolicyType().equals("FixedWindowRollingPolicy") || object.getRollingPolicyType()
-                            .equals("TimeBasedRollingPolicy")), object.getRollingPolicyType()
-                            + " RollingPolicyType is not supported", rollingAppendersJmxAttribute);
-
-            if (object.getRollingPolicyType().equals("FixedWindowRollingPolicy")) {
-                JmxAttributeValidationException.checkNotNull(object.getMinIndex(), "MinIndex is null",
-                        rollingAppendersJmxAttribute);
-                JmxAttributeValidationException.checkNotNull(object.getMaxIndex(), "MaxIndex is null",
-                        rollingAppendersJmxAttribute);
-            } else if (object.getRollingPolicyType().equals("TimeBasedRollingPolicy")) {
-                JmxAttributeValidationException.checkNotNull(object.getMaxHistory(), "MaxHistory is null",
-                        rollingAppendersJmxAttribute);
-            }
-            JmxAttributeValidationException.checkNotNull(object.getMaxFileSize(), "MaxFileSize is null",
-                    rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getEncoderPattern().isEmpty(),
-                    "EncoderPattern needs to be set", rollingAppendersJmxAttribute);
-            JmxAttributeValidationException.checkCondition(!object.getFileName().isEmpty(), "FileName needs to be set",
-                    rollingAppendersJmxAttribute);
-
-        }
-    }
-
-    private void validateAppenderName(final Set<String> appenderNames, final String appenderName, final JmxAttribute jmxAttribute) {
-        JmxAttributeValidationException.checkNotNull(appenderName, "Name is null", jmxAttribute);
-        JmxAttributeValidationException.checkCondition(appenderNames.contains(appenderName) == false,
-                "Duplicate appender name " + appenderName, jmxAttribute);
-        appenderNames.add(appenderName);
-        JmxAttributeValidationException.checkCondition(!appenderName.isEmpty(), "Name needs to be set", jmxAttribute);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        ContextSetterImpl setter = new ContextSetterImpl(getRootRuntimeBeanRegistratorWrapper());
-
-        setter.updateContext(this);
-
-        return setter;
-    }
-
-}
diff --git a/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleFactory.java b/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleFactory.java
deleted file mode 100644 (file)
index 23828f7..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/**
- * Generated file
-
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jul 17 15:26:45 CEST 2013
- *
- * Do not modifiy this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.classic.spi.LoggerComparator;
-import ch.qos.logback.core.Appender;
-import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
-import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
-import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
-import ch.qos.logback.core.util.FileSize;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.DependencyResolverFactory;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.osgi.framework.BundleContext;
-import org.slf4j.LoggerFactory;
-
-/**
-*
-*/
-public class LogbackModuleFactory extends
-        org.opendaylight.controller.config.yang.logback.config.AbstractLogbackModuleFactory {
-
-    public static final String INSTANCE_NAME = "singleton";
-    private Map<String, LoggerTO> loggersDTOs;
-    private Map<String, RollingFileAppenderTO> rollingDTOs;
-    private Map<String, ConsoleAppenderTO> consoleDTOs;
-    private Map<String, FileAppenderTO> fileDTOs;
-
-    @Override
-    public LogbackModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
-            final BundleContext bundleContext) {
-        Preconditions.checkArgument(instanceName.equals(INSTANCE_NAME),
-                "There should be just one instance of logback, named " + INSTANCE_NAME);
-        prepareDTOs();
-        LogbackModule module = new LogbackModule(new ModuleIdentifier(getImplementationName(), INSTANCE_NAME),
-                dependencyResolver);
-        module.setFileAppenderTO(Lists.newArrayList(fileDTOs.values()));
-        module.setConsoleAppenderTO(Lists.newArrayList(consoleDTOs.values()));
-        module.setRollingFileAppenderTO(Lists.newArrayList(rollingDTOs.values()));
-        module.setLoggerTO(Lists.newArrayList(loggersDTOs.values()));
-        return module;
-    }
-
-    @Override
-    public LogbackModule instantiateModule(final String instanceName, final DependencyResolver dependencyResolver,
-            final LogbackModule oldModule, final AutoCloseable oldInstance, final BundleContext bundleContext) {
-        Preconditions.checkArgument(instanceName.equals(INSTANCE_NAME),
-                "There should be just one instance of logback, named " + INSTANCE_NAME);
-        prepareDTOs();
-        LogbackModule module = new LogbackModule(new ModuleIdentifier(getImplementationName(), INSTANCE_NAME),
-                dependencyResolver, oldModule, oldInstance);
-        module.setConsoleAppenderTO(Lists.newArrayList(consoleDTOs.values()));
-        /*
-         * module.setJCloudsAppender(Lists.newArrayList(jcloudsDTOs.values()));
-         */
-        module.setFileAppenderTO(Lists.newArrayList(fileDTOs.values()));
-        module.setRollingFileAppenderTO(Lists.newArrayList(rollingDTOs.values()));
-        module.setLoggerTO(Lists.newArrayList(loggersDTOs.values()));
-        return module;
-    }
-
-    private void prepareDTOs() {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        this.loggersDTOs = prepareLoggersDTOs(context);
-        prepareAppendersDTOs(context);
-    }
-
-    private void prepareAppendersDTOs(final LoggerContext context) {
-        this.rollingDTOs = new HashMap<>();
-        this.consoleDTOs = new HashMap<>();
-        this.fileDTOs = new HashMap<>();
-        ch.qos.logback.core.rolling.RollingFileAppender<ILoggingEvent> rollingApp;
-        ch.qos.logback.core.ConsoleAppender<ILoggingEvent> consoleApp;
-        ch.qos.logback.core.FileAppender<ILoggingEvent> fileApp;
-        Map<Logger, List<Appender<ILoggingEvent>>> appendersAll = new HashMap<>();
-        for (Logger log : context.getLoggerList()) {
-            List<Appender<ILoggingEvent>> appenders = new ArrayList<>();
-            Iterator<Appender<ILoggingEvent>> iter = log.iteratorForAppenders();
-            while (iter.hasNext()) {
-                Appender<ILoggingEvent> element = iter.next();
-                appenders.add(element);
-            }
-            appendersAll.put(log, appenders);
-        }
-        for (List<ch.qos.logback.core.Appender<ILoggingEvent>> appEntry : appendersAll.values()) {
-            for (ch.qos.logback.core.Appender<ILoggingEvent> appender : appEntry) {
-                if (appender instanceof ch.qos.logback.core.rolling.RollingFileAppender<?>) {
-                    RollingFileAppenderTO app = new RollingFileAppenderTO();
-                    rollingApp = (ch.qos.logback.core.rolling.RollingFileAppender<ILoggingEvent>) appender;
-                    app.setAppend(rollingApp.isAppend());
-                    PatternLayoutEncoder encoder = (PatternLayoutEncoder) rollingApp.getEncoder();
-                    app.setEncoderPattern(encoder.getPattern());
-                    app.setFileName(rollingApp.getFile());
-                    if (rollingApp.getRollingPolicy() instanceof FixedWindowRollingPolicy) {
-                        FixedWindowRollingPolicy rollingPolicy = (FixedWindowRollingPolicy) rollingApp
-                                .getRollingPolicy();
-                        app.setMaxIndex(rollingPolicy.getMaxIndex());
-                        app.setMinIndex(rollingPolicy.getMinIndex());
-                        app.setFileNamePattern(rollingPolicy.getFileNamePattern());
-                        app.setRollingPolicyType("FixedWindowRollingPolicy");
-                    } else if (rollingApp.getRollingPolicy() instanceof TimeBasedRollingPolicy<?>) {
-                        TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = (TimeBasedRollingPolicy<ILoggingEvent>) rollingApp.getRollingPolicy();
-                        app.setRollingPolicyType("TimeBasedRollingPolicy");
-                        app.setFileNamePattern(rollingPolicy.getFileNamePattern());
-                        app.setMaxHistory(rollingPolicy.getMaxHistory());
-                        app.setCleanHistoryOnStart(rollingPolicy.isCleanHistoryOnStart());
-                    }
-                    SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = (SizeBasedTriggeringPolicy<ILoggingEvent>) rollingApp
-                            .getTriggeringPolicy();
-                    app.setMaxFileSize(getMaxFileSize(triggeringPolicy).toString());
-                    app.setName(rollingApp.getName());
-                    this.rollingDTOs.put(rollingApp.getName(), app);
-                } else if (appender instanceof ch.qos.logback.core.FileAppender<?>) {
-                    FileAppenderTO app = new FileAppenderTO();
-                    fileApp = (ch.qos.logback.core.FileAppender<ILoggingEvent>) appender;
-                    app.setName(fileApp.getName());
-                    app.setAppend(fileApp.isAppend());
-                    app.setFileName(fileApp.getFile());
-                    PatternLayoutEncoder encoder = (PatternLayoutEncoder) fileApp.getEncoder();
-                    app.setEncoderPattern(encoder.getPattern());
-                    this.fileDTOs.put(fileApp.getName(), app);
-                }
-                if (appender instanceof ch.qos.logback.core.ConsoleAppender<?>) {
-                    ConsoleAppenderTO app = new ConsoleAppenderTO();
-                    consoleApp = (ch.qos.logback.core.ConsoleAppender<ILoggingEvent>) appender;
-                    consoleApp.getCopyOfAttachedFiltersList();
-                    PatternLayoutEncoder encoder = (PatternLayoutEncoder) consoleApp.getEncoder();
-                    app.setEncoderPattern(encoder.getPattern());
-                    app.setName(consoleApp.getName());
-                    app.setThresholdFilter(context.getLogger(Logger.ROOT_LOGGER_NAME).getEffectiveLevel().levelStr);
-                    this.consoleDTOs.put(consoleApp.getName(), app);
-                }
-            }
-        }
-    }
-
-    private Map<String, LoggerTO> prepareLoggersDTOs(final LoggerContext context) {
-        Map<String, LoggerTO> DTOs = new HashMap<>();
-        List<String> appenders = new ArrayList<>();
-        List<org.slf4j.Logger> loggersToBeAdd = removeUnusableLoggers(context.getLoggerList(),
-                context.getLogger(Logger.ROOT_LOGGER_NAME));
-        for (org.slf4j.Logger log : loggersToBeAdd) {
-            LoggerTO logger = new LoggerTO();
-            if (((Logger) log).getLevel() != null) {
-                logger.setLevel(((Logger) log).getLevel().levelStr);
-            } else {
-                logger.setLevel(((Logger) log).getEffectiveLevel().levelStr);
-            }
-            logger.setLoggerName(log.getName());
-            Iterator<Appender<ILoggingEvent>> iter = ((Logger) log).iteratorForAppenders();
-            while (iter.hasNext()) {
-                Appender<ILoggingEvent> element = iter.next();
-                appenders.add(element.getName());
-            }
-            logger.setAppenders(appenders);
-            DTOs.put(log.getName(), logger);
-            appenders = new ArrayList<>();
-
-        }
-        return DTOs;
-    }
-
-    private List<org.slf4j.Logger> removeUnusableLoggers(final List<Logger> loggerList, final Logger rootLogger) {
-        Collections.sort(loggerList, new LoggerComparator());
-        Map<String, org.slf4j.Logger> loggersToReturn = new HashMap<>();
-
-        for (org.slf4j.Logger log : loggerList) {
-            boolean shouldAdd = true;
-            for (Entry<String, org.slf4j.Logger> entry : loggersToReturn.entrySet()) {
-                if (StringUtils.contains(log.getName(), entry.getKey())) {
-                    if (((Logger) log).getLevel() != null
-                            && ((Logger) log).getLevel().equals(((Logger) entry.getValue()).getLevel())
-                            && !((Logger) log).iteratorForAppenders().hasNext()) {
-                        shouldAdd = false;
-                        break;
-                    }
-                    if (((Logger) log).getLevel() == null
-                            && ((Logger) log).getEffectiveLevel().equals(
-                                    ((Logger) entry.getValue()).getEffectiveLevel())
-                            && !((Logger) log).iteratorForAppenders().hasNext()) {
-                        shouldAdd = false;
-                        break;
-                    }
-                }
-                if (((Logger) log).getLevel() != null && ((Logger) log).getLevel().equals(rootLogger.getLevel())
-                        && !((Logger) log).iteratorForAppenders().hasNext()) {
-                    shouldAdd = false;
-                    break;
-                }
-                if (((Logger) log).getLevel() == null
-                        && ((Logger) log).getEffectiveLevel().equals(rootLogger.getEffectiveLevel())
-                        && !((Logger) log).iteratorForAppenders().hasNext()) {
-                    shouldAdd = false;
-                    break;
-                }
-            }
-            if (shouldAdd) {
-                loggersToReturn.put(log.getName(), log);
-            }
-        }
-        return Lists.newArrayList(loggersToReturn.values());
-    }
-
-    @Override
-    public Set<LogbackModule> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory,
-            final BundleContext bundleContext) {
-        DependencyResolver resolver = dependencyResolverFactory.createDependencyResolver(new ModuleIdentifier(
-                getImplementationName(), INSTANCE_NAME));
-        LogbackModule defaultLogback = instantiateModule(INSTANCE_NAME, resolver, bundleContext);
-        Set<LogbackModule> defaultModules = Sets.newHashSet(defaultLogback);
-        return defaultModules;
-    }
-
-    // Ugly hack to deal with logback changing its api
-    private static final Field MAX_FILE_SIZE_FIELD;
-    static {
-        Field f;
-        try {
-            f = SizeBasedTriggeringPolicy.class.getDeclaredField("maxFileSize");
-            f.setAccessible(true);
-        } catch (NoSuchFieldException | SecurityException e) {
-            throw new ExceptionInInitializerError(e);
-        }
-
-        MAX_FILE_SIZE_FIELD = f;
-    }
-
-    @VisibleForTesting
-    static FileSize getMaxFileSize(final SizeBasedTriggeringPolicy<?> policy) {
-        try {
-            return (FileSize) MAX_FILE_SIZE_FIELD.get(policy);
-        } catch (IllegalArgumentException | IllegalAccessException e) {
-            throw new IllegalStateException("Cannot get maxFileSize field", e);
-        }
-    }
-}
diff --git a/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackStatusListener.java b/opendaylight/config/logback-config/src/main/java/org/opendaylight/controller/config/yang/logback/config/LogbackStatusListener.java
deleted file mode 100644 (file)
index dd58c94..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/**
- * Generated file
-
- * Generated from: yang module name: config-test  yang module local name: testing
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Fri Sep 27 14:06:33 CEST 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.core.status.StatusBase;
-import ch.qos.logback.core.status.StatusListener;
-import ch.qos.logback.core.status.StatusManager;
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.slf4j.LoggerFactory;
-
-public class LogbackStatusListener implements StatusListener, LogbackRuntimeMXBean, Closeable {
-
-    private final List<StatusTO> receivedStatuses;
-    private final LogbackRuntimeRegistrator rootRuntimeBeanRegistratorWrapper;
-    private LogbackRuntimeRegistration reg;
-
-    public LogbackStatusListener(final LogbackRuntimeRegistrator rootRuntimeBeanRegistratorWrapper) {
-        receivedStatuses = new ArrayList<>();
-        this.rootRuntimeBeanRegistratorWrapper = rootRuntimeBeanRegistratorWrapper;
-    }
-
-    @Override
-    public synchronized List<StatusTO> getStatusTO() {
-        return Collections.unmodifiableList(receivedStatuses);
-    }
-
-    @Override
-    public synchronized void reset() {
-        receivedStatuses.clear();
-    }
-
-    public LogbackRuntimeRegistration register() {
-        reg = registerToJMX(rootRuntimeBeanRegistratorWrapper);
-        registerToLogback();
-        return reg;
-    }
-
-    private LogbackRuntimeRegistration registerToJMX(final LogbackRuntimeRegistrator rootRuntimeBeanRegistratorWrapper) {
-        return rootRuntimeBeanRegistratorWrapper.register(this);
-    }
-
-    private synchronized void registerToLogback() {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        final StatusManager statusManager = context.getStatusManager();
-
-        statusManager.remove(this);
-        reset();
-
-        statusManager.add(this);
-        addInitialStatuses(statusManager);
-    }
-
-    private void addInitialStatuses(final StatusManager statusManager) {
-        for (ch.qos.logback.core.status.Status status : statusManager.getCopyOfStatusList()) {
-            addStatusEvent(status);
-        }
-    }
-
-    @Override
-    public synchronized void addStatusEvent(final ch.qos.logback.core.status.Status status) {
-        receivedStatuses.add(transformStatus(status));
-    }
-
-    private StatusTO transformStatus(final ch.qos.logback.core.status.Status status) {
-        StatusTO transformed = new StatusTO();
-
-        transformed.setDate(status.getDate());
-        transformed.setLevel(transformStatusLevel(status.getLevel()));
-        transformed.setMessage(status.getMessage());
-
-        return transformed;
-    }
-
-    private String transformStatusLevel(final int status) {
-        switch (status) {
-        case StatusBase.INFO:
-            return "INFO";
-        case StatusBase.WARN:
-            return "WARN";
-        case StatusBase.ERROR:
-            return "ERROR";
-        default:
-            throw new IllegalStateException("Unknown status level " + status);
-        }
-    }
-
-    @Override
-    public void close() throws IOException {
-        if (reg != null) {
-            reg.close();
-        }
-        unregisterFromLogback();
-    }
-
-    private void unregisterFromLogback() {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        final StatusManager statusManager = context.getStatusManager();
-        statusManager.remove(this);
-    }
-}
diff --git a/opendaylight/config/logback-config/src/main/yang/config-logging.yang b/opendaylight/config/logback-config/src/main/yang/config-logging.yang
deleted file mode 100644 (file)
index 477876c..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-// vi: set smarttab et sw=4 tabstop=4:
-module config-logging {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:controller:logback:config";
-    prefix "logging";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
-
-    organization "Cisco Systems, Inc.";
-
-    description
-        "This module contains the base YANG definitions for NS-OS
-         logging module.";
-
-    revision "2013-07-16" {
-        description
-            "Initial revision.";
-    }
-
-    identity logback {
-        description
-            "Actual state of logback configuration.";
-        base config:module-type;
-        config:java-name-prefix Logback;
-    }
-
-    identity logback-rpc;
-
-    augment "/config:modules/config:module/config:configuration" {
-        case logback {
-            when "/config:modules/config:module/config:type = 'logback'";
-
-            list file-appenders {
-                leaf append {
-                    type boolean;
-                    mandatory false;
-                }
-
-                leaf file-name {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf encoder-pattern {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf name {
-                    type string;
-                    mandatory true;
-                }
-                key name;
-                config:java-name-prefix FileAppenderTO;
-            }
-
-            list rolling-appenders {
-                leaf append {
-                    type boolean;
-                    mandatory false;
-                }
-
-                leaf file-name {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf encoder-pattern {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf min-index {
-                    type int32;
-                    mandatory true;
-                }
-
-                leaf max-index {
-                    type int32;
-                    mandatory true;
-                }
-
-                leaf max-file-size {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf name {
-                    type string;
-                    mandatory true;
-                }
-                key name;
-
-                leaf file-name-pattern {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf rolling-policy-type {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf max-history {
-                    type int32;
-                    mandatory true;
-                }
-
-                leaf clean-history-on-start {
-                    type boolean;
-                    default false;
-                }
-                config:java-name-prefix RollingFileAppenderTO;
-            }
-
-            list console-appenders {
-
-                leaf encoder-pattern {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf threshold-filter {
-                    type string;
-                    default 'ALL';
-                }
-
-                leaf name {
-                    type string;
-                    mandatory true;
-                }
-                key name;
-
-                config:java-name-prefix ConsoleAppenderTO;
-            }
-
-            list loggers {
-                leaf logger-name {
-                    type string;
-                    mandatory true;
-                }
-                key logger-name;
-
-                leaf level {
-                    type string;
-                    mandatory true;
-                }
-
-                leaf-list appenders {
-                    type string;
-                }
-                config:java-name-prefix LoggerTO;
-            }
-        }
-    }
-
-
-    augment "/config:modules/config:module/config:state" {
-        case logback {
-            when "/config:modules/config:module/config:type = 'logback'";
-
-            rpcx:rpc-context-instance "logback-rpc";
-
-            list status {
-                config:java-name-prefix StatusTO;
-
-                leaf level {
-                    type string;
-                }
-
-                leaf message {
-                    type string;
-                }
-
-                leaf date {
-                    type uint32;
-                }
-            }
-        }
-    }
-
-    rpc reset {
-        input {
-            uses rpcx:rpc-context-ref {
-                refine context-instance {
-                    rpcx:rpc-context-instance logback-rpc;
-                }
-            }
-        }
-    }
-
-}
-
diff --git a/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImplTest.java b/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/ContextSetterImplTest.java
deleted file mode 100644 (file)
index 17572e5..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.Appender;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.slf4j.LoggerFactory;
-
-public class ContextSetterImplTest {
-
-    @Mock
-    private LogbackRuntimeRegistrator runtimeRegistratorMock;
-    @Mock
-    private DependencyResolver dependencyResolverMock;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        LogbackRuntimeRegistration reg = mock(LogbackRuntimeRegistration.class);
-        doReturn(reg).when(runtimeRegistratorMock).register(any(LogbackRuntimeMXBean.class));
-        doNothing().when(reg).close();
-    }
-
-    @Test
-    public void testUpdate() throws Exception {
-        Multimap<String, String> loggersToAppenders = HashMultimap.create();
-        loggersToAppenders.put("l1", "a1");
-        loggersToAppenders.put("l1", "a2");
-        createContextSetter(loggersToAppenders);
-
-        assertLoggerWithAppenders("l1", "a1", "a2");
-    }
-
-    @Test
-    public void testUpdateTwice() throws Exception {
-        Multimap<String, String> loggersToAppenders = HashMultimap.create();
-        loggersToAppenders.put("l1", "a1");
-        loggersToAppenders.put("l1", "a2");
-        createContextSetter(loggersToAppenders);
-
-        loggersToAppenders.clear();
-        loggersToAppenders.put("l1", "a3");
-        loggersToAppenders.put("l1", "a2");
-        loggersToAppenders.put("l1", "a4");
-        createContextSetter(loggersToAppenders);
-
-        assertLoggerWithAppenders("l1", "a2", "a3", "a4");
-    }
-
-    @Test
-    public void testKeepOtherLoggers() throws Exception {
-        Multimap<String, String> loggersToAppenders = HashMultimap.create();
-        loggersToAppenders.put("l1", "a1");
-        loggersToAppenders.put("l1", "a2");
-        loggersToAppenders.put("l2", "a22");
-        createContextSetter(loggersToAppenders);
-
-        loggersToAppenders.clear();
-        loggersToAppenders.put("l1", "a3");
-        createContextSetter(loggersToAppenders);
-
-        assertLoggerWithAppenders("l1", "a3");
-        assertLoggerWithAppenders("l2", "a22");
-    }
-
-    private void createContextSetter(final Multimap<String, String> loggersToAppenders) throws IOException {
-        try (ContextSetterImpl setter = new ContextSetterImpl(runtimeRegistratorMock)) {
-
-            List<LoggerTO> logger = Lists.newArrayList();
-            List<ConsoleAppenderTO> consoleAppenders = Lists.newArrayList();
-
-            for (String loggerName : loggersToAppenders.keySet()) {
-                LoggerTO l1 = createLogger(loggerName, loggersToAppenders.get(loggerName));
-                logger.add(l1);
-                for (String appenderName : loggersToAppenders.get(loggerName)) {
-                    consoleAppenders.add(createConsoleAppender(appenderName));
-                }
-
-            }
-
-            LogbackModule logbackModule = createLogbackModule(logger, consoleAppenders);
-            setter.updateContext(logbackModule);
-        }
-    }
-
-    private void assertLoggerWithAppenders(final String name, final String... appenders) {
-        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
-        ch.qos.logback.classic.Logger logger = context.getLogger(name);
-        Iterator<Appender<ILoggingEvent>> it = logger.iteratorForAppenders();
-
-        Multimap<String, Appender<?>> foundAppenders = HashMultimap.create();
-        while (it.hasNext()) {
-            final Appender<ILoggingEvent> app = it.next();
-            foundAppenders.put(app.getName(), app);
-        }
-
-        if (appenders.length == 0) {
-            assertEquals(0, foundAppenders.values().size());
-        }
-
-        for (String appender : appenders) {
-            boolean isPresent = foundAppenders.get(appender).isEmpty();
-            assertFalse("Appender " + appender + " for logger " + name + " was not present, present appenders: "
-                    + foundAppenders.keys(), isPresent);
-        }
-
-    }
-
-    private LogbackModule createLogbackModule(final List<LoggerTO> logger, final List<ConsoleAppenderTO> consoleAppenders) {
-        LogbackModule logbackModule = new LogbackModule(new ModuleIdentifier("fact", "first"), dependencyResolverMock);
-        logbackModule.setLoggerTO(logger);
-        logbackModule.setConsoleAppenderTO(consoleAppenders);
-        logbackModule.setRollingFileAppenderTO(Lists.<RollingFileAppenderTO> newArrayList());
-        logbackModule.setFileAppenderTO(Lists.<FileAppenderTO> newArrayList());
-        return logbackModule;
-    }
-
-    private LoggerTO createLogger(final String name, final Collection<String> appenders) {
-        LoggerTO l1 = new LoggerTO();
-        l1.setAppenders(Lists.newArrayList(appenders));
-        l1.setLoggerName(name);
-        l1.setLevel("INFO");
-        return l1;
-    }
-
-    private ConsoleAppenderTO createConsoleAppender(final String name) {
-        ConsoleAppenderTO a = new ConsoleAppenderTO();
-        a.setName(name);
-        a.setEncoderPattern("%-4relative [%thread] %-5level %logger{35} - %msg%n");
-        return a;
-    }
-
-}
diff --git a/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleTest.java b/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleTest.java
deleted file mode 100644 (file)
index c3c7831..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-
-public class LogbackModuleTest extends AbstractConfigTest {
-
-    private static final String INSTANCE_NAME = "singleton";
-
-    private LogbackModuleFactory factory;
-
-    @Before
-    public void setUp() throws Exception {
-
-        factory = new LogbackModuleFactory();
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory));
-    }
-
-    @Test
-    public void testCreateBean() throws Exception {
-
-        CommitStatus status = createBeans(true, "target/rollingApp",
-                "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5, "target/%i.log", "rolling",
-                "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0, "FileAppender").commit();
-
-        assertBeanCount(1, factory.getImplementationName());
-        assertStatus(status, 1, 0, 0);
-    }
-
-    @Test
-    public void testReusingInstance() throws Exception {
-        createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0,
-                "FileAppender").commit();
-
-        assertBeanCount(1, factory.getImplementationName());
-
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        CommitStatus status = transaction.commit();
-
-        assertBeanCount(1, factory.getImplementationName());
-        assertStatus(status, 0, 0, 1);
-    }
-
-    @Test
-    public void testRecreateInstance() throws Exception {
-        createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0,
-                "FileAppender").commit();
-
-        assertBeanCount(1, LogbackModuleFactory.NAME);
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-
-        ObjectName logback = transaction.lookupConfigBean(LogbackModuleFactory.NAME, "singleton");
-        LogbackModuleMXBean nwBean = transaction.newMXBeanProxy(logback, LogbackModuleMXBean.class);
-        CommitStatus status = transaction.commit();
-        assertBeanCount(1, LogbackModuleFactory.NAME);
-
-        assertStatus(status, 0, 0, 1);
-    }
-
-    @Test
-    public void testDestroyInstance() throws Exception {
-        createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0,
-                "FileAppender").commit();
-        assertBeanCount(1, factory.getImplementationName());
-
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        transaction.destroyModule(factory.getImplementationName(), INSTANCE_NAME);
-        CommitStatus status = transaction.commit();
-
-        assertBeanCount(0, factory.getImplementationName());
-        assertStatus(status, 0, 0, 0);
-    }
-
-    @Ignore
-    @Test
-    public void testValidation1() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                    "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy",
-                    0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("FileName is null"));
-        }
-    }
-
-    @Test
-    public void testValidation2() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", null, "30MB", 1, 5, "target/%i.log", "rolling", "consoleName",
-                    "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("EncoderPattern is null"));
-        }
-    }
-
-    @Test
-    public void testValidation4() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", null, 1, 5,
-                    "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy",
-                    0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("MaxFileSize is null"));
-        }
-    }
-
-    @Test
-    public void testValidation6() throws Exception {
-        try {
-            createBeans(true, "", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5, "target/%i.log",
-                    "rolling", "consoleName", "ALL", "logger1", "DEBUG", "FixedWindowRollingPolicy", 0, "FileAppender")
-                    .commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("FileName needs to be set"));
-        }
-    }
-
-    @Test
-    public void testValidation7() throws Exception {
-        try {
-            createBeans(
-
-                true, "target/rollingApp", "", "30MB", 1, 5, "target/%i.log", "rolling", "consoleName", "ALL", "logger1",
-                    "DEBUG", "FixedWindowRollingPolicy", 0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("EncoderPattern needs to be set"));
-        }
-    }
-
-    @Test
-    public void testValidation8() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                    "target/%i.log", "rolling", "consoleName", "ALL", null, "DEBUG", "FixedWindowRollingPolicy", 0,
-                    "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("LoggerName is null"));
-        }
-    }
-
-    @Test
-    public void testValidation9() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1, 5,
-                    "target/%i.log", "rolling", "consoleName", "ALL", "", "DEBUG", "FixedWindowRollingPolicy", 0,
-                    "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("LoggerName needs to be set"));
-        }
-    }
-
-    @Test
-    public void testValidation10() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", null,
-                    5, "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG",
-                    "FixedWindowRollingPolicy", 0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("MinIndex is null"));
-        }
-    }
-
-    @Test
-    public void testValidation11() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1,
-                    null, "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG",
-                    "FixedWindowRollingPolicy", 0, "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("MaxIndex is null"));
-        }
-    }
-
-    @Test
-    public void testValidation12() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1,
-                    null, "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", null, 1, "FileAppender")
-                    .commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("RollingPolicyType is null"));
-        }
-    }
-
-    @Test
-    public void testValidation13() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1,
-                    null, "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "", 1, "FileAppender")
-                    .commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("RollingPolicyType is not set"));
-        }
-    }
-
-    @Test
-    public void testValidation14() throws Exception {
-        try {
-            createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", 1,
-                    null, "target/%i.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "RollingPolicy", 1,
-                    "FileAppender").commit();
-            fail();
-        } catch (final ValidationException e) {
-            assertThat(e.getFailedValidations().toString(), containsString("RollingPolicyType is not supported"));
-        }
-    }
-
-    @Test
-    public void testTimeBasedRollingPolicy() throws Exception {
-        createBeans(true, "target/rollingApp", "%-4relative [%thread] %-5level %logger{35} - %msg%n", "30MB", null,
-                null, "target/%d.log", "rolling", "consoleName", "ALL", "logger1", "DEBUG", "TimeBasedRollingPolicy",
-                1, "FileAppender").commit();
-    }
-
-    private ConfigTransactionJMXClient createBeans(final Boolean isAppend, final String rollingFileName, final String encoderPattern,
-            final String maxFileSize, final Integer minIndex, final Integer maxIndex, final String fileNamePattern, final String rollingName,
-            final String consoleName, final String thresholdFilter, final String loggerName, final String level, final String rollingPolicyType,
-            final int maxHistory, final String fileAppName) throws Exception {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        ObjectName nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), INSTANCE_NAME);
-        LogbackModuleMXBean bean = transaction.newMXBeanProxy(nameRetrieved, LogbackModuleMXBean.class);
-
-        List<RollingFileAppenderTO> rollingAppenders = new ArrayList<>();
-        RollingFileAppenderTO rollingAppender = new RollingFileAppenderTO();
-        rollingAppender.setAppend(isAppend);
-        rollingAppender.setEncoderPattern(encoderPattern);
-        rollingAppender.setFileName(rollingFileName);
-        rollingAppender.setMaxFileSize(maxFileSize);
-        rollingAppender.setMaxIndex(maxIndex);
-        rollingAppender.setMinIndex(minIndex);
-        rollingAppender.setFileNamePattern(fileNamePattern);
-        rollingAppender.setName(rollingName);
-        rollingAppender.setRollingPolicyType(rollingPolicyType);
-        rollingAppender.setMaxHistory(maxHistory);
-        rollingAppenders.add(rollingAppender);
-
-        List<ConsoleAppenderTO> consoleAppenders = new ArrayList<>();
-        ConsoleAppenderTO consoleAppender = new ConsoleAppenderTO();
-        consoleAppender.setEncoderPattern(encoderPattern);
-        consoleAppender.setName(consoleName);
-        consoleAppender.setThresholdFilter(thresholdFilter);
-        consoleAppenders.add(consoleAppender);
-
-        List<FileAppenderTO> fileAppenders = new ArrayList<>();
-        FileAppenderTO fileAppender = new FileAppenderTO();
-        fileAppender.setName(fileAppName);
-        fileAppender.setAppend(isAppend);
-        fileAppender.setEncoderPattern(encoderPattern);
-        fileAppender.setFileName(rollingFileName);
-        fileAppenders.add(fileAppender);
-
-        List<LoggerTO> loggers = new ArrayList<>();
-
-        LoggerTO logger = new LoggerTO();
-
-        logger.setAppenders(Arrays.<String> asList());
-
-        logger.setLevel(level);
-        logger.setLoggerName(loggerName);
-        loggers.add(logger);
-        bean.setLoggerTO(loggers);
-        bean.setRollingFileAppenderTO(rollingAppenders);
-        bean.setConsoleAppenderTO(consoleAppenders);
-        bean.setFileAppenderTO(fileAppenders);
-
-        transaction.validateConfig();
-
-        return transaction;
-    }
-
-}
diff --git a/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleWithInitialConfigurationTest.java b/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackModuleWithInitialConfigurationTest.java
deleted file mode 100644 (file)
index eeed459..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import static org.junit.Assert.assertEquals;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.joran.spi.JoranException;
-import ch.qos.logback.core.rolling.FixedWindowRollingPolicy;
-import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy;
-import com.google.common.collect.Lists;
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.JMX;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.ConflictingVersionException;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionClient;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.slf4j.LoggerFactory;
-
-public class LogbackModuleWithInitialConfigurationTest extends AbstractConfigTest {
-
-    private LogbackModuleFactory factory;
-
-    @Before
-    public void setUp() throws IOException, ClassNotFoundException {
-
-        factory = new LogbackModuleFactory();
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory));
-    }
-
-    /**
-     * Tests that initial configuration was changed. Changed attributes:
-     * location, fileName, duplicateInsertTries. Added new FileAppender.
-     */
-    @Test
-    public void test() throws Exception {
-
-        createBeans();
-
-        ConfigTransactionClient transaction = configRegistryClient.createTransaction();
-
-        LogbackModuleMXBean bean = JMX.newMXBeanProxy(ManagementFactory.getPlatformMBeanServer(),
-                transaction.lookupConfigBean("logback", "singleton"), LogbackModuleMXBean.class);
-        assertEquals(1, bean.getConsoleAppenderTO().size());
-        assertEquals(1, bean.getRollingFileAppenderTO().size());
-        assertEquals(0, bean.getFileAppenderTO().size());
-        assertEquals(1, bean.getLoggerTO().size());
-
-        RollingFileAppenderTO rolling = new RollingFileAppenderTO();
-        RollingFileAppenderTO old = bean.getRollingFileAppenderTO().get(0);
-        rolling.setAppend(old.getAppend());
-        rolling.setEncoderPattern(old.getEncoderPattern());
-        rolling.setRollingPolicyType(old.getRollingPolicyType());
-        rolling.setFileName("target/logFile1.log");
-        rolling.setFileNamePattern("target/%i.log");
-        rolling.setMaxFileSize(old.getMaxFileSize());
-        rolling.setMinIndex(old.getMinIndex());
-        rolling.setMaxIndex(old.getMaxIndex());
-        rolling.setName("FILE");
-
-        ConsoleAppenderTO console = new ConsoleAppenderTO();
-        console.setEncoderPattern("%date %level [%thread] %logger{10} %msg%n");
-        console.setName("SYSTEM");
-        console.setThresholdFilter("DEBUG");
-
-        FileAppenderTO file = new FileAppenderTO();
-        file.setName("FILE_APPENDER");
-        file.setAppend(true);
-        file.setEncoderPattern("%-4relative [%thread] %-5level %logger{35} - %msg%n");
-        file.setFileName("target/testFile.log");
-
-        bean.setConsoleAppenderTO(Lists.newArrayList(console));
-        bean.setRollingFileAppenderTO(Lists.newArrayList(rolling));
-        bean.setFileAppenderTO(Lists.newArrayList(file));
-
-        LoggerTO logger = new LoggerTO();
-        logger.setLevel("INFO");
-        logger.setLoggerName("logger");
-        logger.setAppenders(Lists.newArrayList("SYSTEM"));
-
-        LoggerTO fileLogger = new LoggerTO();
-        fileLogger.setLevel("DEBUG");
-        fileLogger.setLoggerName("fileLogger");
-        fileLogger.setAppenders(Lists.newArrayList("FILE_APPENDER"));
-
-        List<LoggerTO> loggers = Lists.newArrayList(logger, fileLogger);
-        bean.setLoggerTO(loggers);
-
-        transaction.commit();
-
-        LogbackModuleMXBean logback = configRegistryClient.newMXBeanProxy(
-                ObjectNameUtil.createReadOnlyModuleON("logback", "singleton"), LogbackModuleMXBean.class);
-
-        List<RollingFileAppenderTO> rollingList = logback.getRollingFileAppenderTO();
-        assertEquals(1, rollingList.size());
-
-        RollingFileAppenderTO rollingApp = rollingList.get(0);
-        assertEquals(rollingApp.getFileName(), "target/logFile1.log");
-        assertEquals(rollingApp.getName(), "FILE");
-
-        List<ConsoleAppenderTO> consoleList = logback.getConsoleAppenderTO();
-        assertEquals(1, consoleList.size());
-
-        ConsoleAppenderTO consoleApp = consoleList.get(0);
-        assertEquals(consoleApp.getThresholdFilter(), "DEBUG");
-        assertEquals(consoleApp.getName(), "SYSTEM");
-
-        List<FileAppenderTO> fileList = logback.getFileAppenderTO();
-        assertEquals(1, fileList.size());
-
-        FileAppenderTO fileApp = fileList.get(0);
-        assertEquals(fileApp.getFileName(), "target/testFile.log");
-        assertEquals(fileApp.getName(), "FILE_APPENDER");
-
-        loggers = logback.getLoggerTO();
-        assertEquals(2, loggers.size());
-        assertEquals("logger", loggers.get(0).getLoggerName());
-        assertEquals("fileLogger", loggers.get(1).getLoggerName());
-
-    }
-
-    public ObjectName createBeans() throws JoranException, InstanceAlreadyExistsException, IOException,
-            MalformedObjectNameException, InstanceNotFoundException, ValidationException, ConflictingVersionException {
-
-        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
-
-        JoranConfigurator configurator = new JoranConfigurator();
-        configurator.setContext(lc);
-        configurator.doConfigure("src/test/resources/simple_config_logback.xml");
-        File f = new File("target/it");
-        if (f.exists()) {
-            cleanDirectory(f);
-        }
-        ch.qos.logback.classic.Logger logger = lc.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
-        ch.qos.logback.core.rolling.RollingFileAppender<ILoggingEvent> fileAppender = (ch.qos.logback.core.rolling.RollingFileAppender<ILoggingEvent>) logger
-                .getAppender("VARLOGFILE");
-        fileAppender.start();
-
-        ch.qos.logback.core.ConsoleAppender<ILoggingEvent> consoleAppender = (ch.qos.logback.core.ConsoleAppender<ILoggingEvent>) logger
-                .getAppender("STDOUT");
-        consoleAppender.start();
-        List<RollingFileAppenderTO> rollingAppenders = new ArrayList<>();
-        RollingFileAppenderTO rollingApp = new RollingFileAppenderTO();
-        rollingApp.setAppend(fileAppender.isAppend());
-        PatternLayoutEncoder enc = (PatternLayoutEncoder) fileAppender.getEncoder();
-        rollingApp.setEncoderPattern(enc.getPattern());
-        rollingApp.setFileName(fileAppender.getFile());
-        FixedWindowRollingPolicy rollingPolicy = (FixedWindowRollingPolicy) fileAppender.getRollingPolicy();
-        rollingApp.setRollingPolicyType("FixedWindowRollingPolicy");
-        rollingApp.setMaxIndex(rollingPolicy.getMaxIndex());
-        rollingApp.setMinIndex(rollingPolicy.getMinIndex());
-        SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = (SizeBasedTriggeringPolicy<ILoggingEvent>) fileAppender
-                .getTriggeringPolicy();
-        rollingApp.setMaxFileSize(LogbackModuleFactory.getMaxFileSize(triggeringPolicy).toString());
-        rollingApp.setName(fileAppender.getName());
-        rollingApp.setFileNamePattern(rollingPolicy.getFileNamePattern());
-        rollingAppenders.add(rollingApp);
-
-        assertEquals("target/osgi.log", rollingApp.getFileName());
-        assertEquals("50 MB", rollingApp.getMaxFileSize());
-        assertEquals("VARLOGFILE", rollingApp.getName());
-
-        List<ConsoleAppenderTO> consoleAppenders = new ArrayList<>();
-        ConsoleAppenderTO consoleApp = new ConsoleAppenderTO();
-        enc = (PatternLayoutEncoder) consoleAppender.getEncoder();
-        consoleApp.setEncoderPattern(enc.getPattern());
-        consoleApp.setName(consoleAppender.getName());
-        consoleApp.setThresholdFilter("ALL");
-        consoleAppenders.add(consoleApp);
-
-        List<FileAppenderTO> fileAppenders = new ArrayList<>();
-
-        List<LoggerTO> loggersDTOs = new ArrayList<>();
-        LoggerTO log = new LoggerTO();
-        log.setAppenders(Arrays.asList(fileAppender.getName(), consoleApp.getName()));
-
-        log.setLevel(logger.getLevel().toString());
-        log.setLoggerName(logger.getName());
-        loggersDTOs.add(log);
-
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        ObjectName nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), LogbackModuleFactory.INSTANCE_NAME);
-        LogbackModuleMXBean bean = transaction.newMXBeanProxy(nameRetrieved, LogbackModuleMXBean.class);
-
-        bean.setLoggerTO(loggersDTOs);
-        bean.setRollingFileAppenderTO(rollingAppenders);
-        bean.setConsoleAppenderTO(consoleAppenders);
-        bean.setFileAppenderTO(fileAppenders);
-
-        transaction.commit();
-
-        return nameRetrieved;
-    }
-}
diff --git a/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackWithXmlConfigModuleTest.java b/opendaylight/config/logback-config/src/test/java/org/opendaylight/controller/config/yang/logback/config/LogbackWithXmlConfigModuleTest.java
deleted file mode 100644 (file)
index 1c784a9..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.config.yang.logback.config;
-
-import static org.junit.Assert.assertEquals;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.core.joran.spi.JoranException;
-import com.google.common.collect.Lists;
-import java.io.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.InstanceNotFoundException;
-import javax.management.JMX;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.ConflictingVersionException;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.slf4j.LoggerFactory;
-
-public class LogbackWithXmlConfigModuleTest extends AbstractConfigTest {
-
-    private LogbackModuleFactory factory;
-    private LoggerContext lc;
-
-    @Before
-    public void setUp() throws JoranException, IOException {
-
-        factory = new LogbackModuleFactory();
-        super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,factory));
-
-        lc = (LoggerContext) LoggerFactory.getILoggerFactory();
-        JoranConfigurator configurator = new JoranConfigurator();
-        lc.reset();
-        configurator.setContext(lc);
-        configurator.doConfigure("src/test/resources/simple_config_logback.xml");
-        File f = new File("target/it");
-        if (f.exists())
-            cleanDirectory(f);
-    }
-
-    /**
-     * Tests configuration of Logger factory.
-     *
-     * @throws MalformedObjectNameException
-     */
-    @Test
-    public void test() throws InstanceAlreadyExistsException, InstanceNotFoundException, MalformedObjectNameException, ValidationException, ConflictingVersionException {
-
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        ObjectName nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), LogbackModuleFactory.INSTANCE_NAME);
-
-        LogbackModuleMXBean bean = transaction.newMXBeanProxy(nameRetrieved, LogbackModuleMXBean.class);
-
-        assertEquals(1, bean.getConsoleAppenderTO().size());
-
-        assertEquals(1, bean.getRollingFileAppenderTO().size());
-
-        transaction.commit();
-
-        transaction = configRegistryClient.createTransaction();
-
-        nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), "singleton");
-
-        bean = JMX.newMXBeanProxy(platformMBeanServer, nameRetrieved, LogbackModuleMXBean.class);
-
-        assertEquals(1, bean.getConsoleAppenderTO().size());
-        assertEquals(1, bean.getRollingFileAppenderTO().size());
-
-    }
-
-    /**
-     * Tests filtering loggers. Loggers inherited from ROOT logger and duplicate
-     * loggers should be removed.
-     */
-    @Test
-    public void testAllLoggers() throws InstanceAlreadyExistsException, InstanceNotFoundException {
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-
-        LogbackModuleMXBean bean = JMX.newMXBeanProxy(ManagementFactory.getPlatformMBeanServer(),
-                transaction.lookupConfigBean("logback", "singleton"), LogbackModuleMXBean.class);
-
-        assertEquals(5, bean.getLoggerTO().size());
-    }
-
-    /**
-     * Add new logger using FileAppender
-     *
-     * @throws MalformedObjectNameException
-     */
-    @Test
-    public void testAddNewLogger() throws InstanceAlreadyExistsException, InstanceNotFoundException,
-            MalformedObjectNameException, ValidationException, ConflictingVersionException {
-
-        ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
-        ObjectName nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), LogbackModuleFactory.INSTANCE_NAME);
-        LogbackModuleMXBean bean = transaction.newMXBeanProxy(nameRetrieved, LogbackModuleMXBean.class);
-
-        assertEquals(5, bean.getLoggerTO().size());
-
-        List<LoggerTO> loggers = Lists.newArrayList(bean.getLoggerTO());
-        LoggerTO logger = new LoggerTO();
-        logger.setAppenders(Lists.newArrayList("FILE"));
-        logger.setLevel("INFO");
-        logger.setLoggerName("fileLogger");
-        loggers.add(logger);
-        bean.setLoggerTO(loggers);
-
-        transaction.commit();
-
-        transaction = configRegistryClient.createTransaction();
-        nameRetrieved = transaction.lookupConfigBean(factory.getImplementationName(), "singleton");
-        bean = JMX.newMXBeanProxy(platformMBeanServer, nameRetrieved, LogbackModuleMXBean.class);
-
-        assertEquals(6, bean.getLoggerTO().size());
-    }
-
-}
diff --git a/opendaylight/config/logback-config/src/test/resources/simple_config_logback.xml b/opendaylight/config/logback-config/src/test/resources/simple_config_logback.xml
deleted file mode 100644 (file)
index f00a7f0..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<configuration>
-
-    <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
-        <resetJUL>true</resetJUL>
-    </contextListener>
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>INFO</level>
-        </filter>
-        <encoder>
-            <pattern>[%d{HH:mm:ss.SSS}] [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <!-- rolling file /var/log/osgi/osgi.log that keeps last 3 backups of 5MB -->
-    <appender name="VARLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>target/osgi.log</file>
-        <append>true</append>
-        <encoder>
-            <pattern>[%d{HH:mm:ss.SSS}] [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
-            <fileNamePattern>/opt/Demo1/logs/osgi.log.%i.gz</fileNamePattern>
-            <minIndex>1</minIndex>
-            <maxIndex>5</maxIndex>
-        </rollingPolicy>
-
-        <triggeringPolicy
-                class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
-            <maxFileSize>50MB</maxFileSize>
-        </triggeringPolicy>
-
-    </appender>
-
-    <appender name="BGPDUMPFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>target/bgp.log</file>
-        <append>false</append>
-        <encoder>
-            <pattern>[%d{HH:mm:ss.SSS}] [%thread] %-5level %logger - %msg%n</pattern>
-        </encoder>
-        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-            <fileNamePattern>/opt/Demo1/logs/bgp.log.%d{yyyy-MM-dd}.gz</fileNamePattern>
-            <maxHistory>30</maxHistory>
-        </rollingPolicy>
-
-        <triggeringPolicy
-                class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
-            <maxFileSize>5MB</maxFileSize>
-        </triggeringPolicy>
-
-    </appender>
-    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
-        <file>target/testFile.log</file>
-        <append>true</append>
-        <encoder>
-           <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
-        </encoder>
-    </appender>
-
-    <!-- Increase to INFO to see content of REST messages -->
-    <logger name="org.apache.cxf.interceptor.LoggingInInterceptor"
-            level="WARN"/>
-    <logger name="org.apache.cxf.interceptor.LoggingOutInterceptor"
-            level="WARN"/>
-    <!-- Increase to INFO to see content of SOAP messages -->
-    <logger name="org.apache.cxf.services"
-            level="WARN"/>
-    <logger name="org.opendaylight"
-            level="DEBUG"/>
-    <logger name="com"
-            level="INFO"/>
-    <root level="INFO">
-        <!--
-        <appender-ref ref="ALL_APPENDER"/>
-        -->
-        <appender-ref ref="STDOUT"/>
-        <appender-ref ref="VARLOGFILE"/>
-        <appender-ref ref="FILE"/>
-    </root>
-
-</configuration>
index dc650d8560938a0562b20998e3558a87224ac86f..b64165c5f1d747a6706ef5c30866670540a0a224 100644 (file)
@@ -27,7 +27,6 @@
     <module>yang-jmx-generator</module>
     <module>yang-jmx-generator-plugin</module>
     <module>yang-test</module>
-    <module>logback-config</module>
     <module>threadpool-config-api</module>
     <module>netty-config-api</module>
     <module>threadpool-config-impl</module>
index 5d9576112823e5ffd31697c513c241a7d385c0b2..fcfd1840bf91dfe61c3bc19a3e680362b16b3dbe 100644 (file)
@@ -60,7 +60,6 @@ public class TestHelper {
                 mavenBundle("commons-io", "commons-io").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "config-manager-facade-xml").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
-                mavenBundle(CONTROLLER, "logback-config").versionAsInProject(), //
                 mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
 
                 mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
index 49fcabeae7ed9c742eda89928ce60a463e626050..98494417226239a9ef3193594e5c91102bb0e62c 100644 (file)
@@ -23,7 +23,6 @@
                 <capability>
                     urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl?module=opendaylight-sal-dom-broker-impl&amp;revision=2013-10-28
                 </capability>
-                <capability>urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&amp;revision=2013-07-16</capability>
                 <capability>urn:opendaylight:yang:extension:yang-ext?module=yang-ext&amp;revision=2013-07-09
                 </capability>
                 <capability>
diff --git a/opendaylight/md-sal/sal-binding-it/src/test/resources/logback.xml b/opendaylight/md-sal/sal-binding-it/src/test/resources/logback.xml
deleted file mode 100644 (file)
index 0d69c44..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<configuration scan="true">
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-      </pattern>
-    </encoder>
-  </appender>
-
-  <root level="INFO">
-    <appender-ref ref="STDOUT" />
-  </root>
-  <logger name="org.opendaylight.yangtools" level="INFO"/>
-  <logger name="org.opendaylight.controller" level="INFO"/>
-  <logger name="org.opendaylight.config" level="DEBUG"/>
-  <logger name="org.opendaylight.yangtools.objcache" level="ERROR"/>
-  <logger name="org.opendaylight.yangtools.yang.parser.util.ModuleDependencySort" level="ERROR"/>
-</configuration>
diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/logback.xml b/opendaylight/md-sal/sal-remoterpc-connector/src/test/resources/logback.xml
deleted file mode 100644 (file)
index 5246f01..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<configuration scan="true">
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
-      </pattern>
-    </encoder>
-  </appender>
-
-  <root level="debug">
-    <appender-ref ref="STDOUT" />
-  </root>
-</configuration>
diff --git a/pom.xml b/pom.xml
index 32d51a5a6910964e18212e9e923fe7218ee03a66..4174627fab44dae789f7895c6d44f5e249abbaa9 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,6 @@
 
     <!-- Parents -->
     <module>opendaylight/commons/protocol-framework</module>
-    <module>opendaylight/commons/logback_settings</module>
     <module>opendaylight/commons/liblldp</module>
     <module>benchmark</module>
     <module>opendaylight/commons/jolokia</module>