From 3cc07c90f703ef24ff04c112172ecf69d5b644f9 Mon Sep 17 00:00:00 2001 From: jhh Date: Tue, 1 Mar 2022 14:49:08 -0600 Subject: Remove features-session-persistence and eelf These are unused. Issue-ID: POLICY-3922 Signed-off-by: jhh Change-Id: I9ef6af27d4d5ed5667a60db841a82b4d492f79f4 --- feature-eelf/pom.xml | 120 -------------- feature-eelf/src/assembly/assemble_zip.xml | 76 --------- .../src/main/feature/config/logback-eelf.xml | 184 --------------------- feature-eelf/src/main/feature/install/disable | 33 ---- feature-eelf/src/main/feature/install/enable | 35 ---- .../org/onap/policy/drools/eelf/EelfFeature.java | 73 -------- ...p.policy.drools.features.PolicyEngineFeatureApi | 1 - .../org/onap/policy/drools/eelf/test/EElfTest.java | 146 ---------------- 8 files changed, 668 deletions(-) delete mode 100644 feature-eelf/pom.xml delete mode 100644 feature-eelf/src/assembly/assemble_zip.xml delete mode 100644 feature-eelf/src/main/feature/config/logback-eelf.xml delete mode 100644 feature-eelf/src/main/feature/install/disable delete mode 100644 feature-eelf/src/main/feature/install/enable delete mode 100644 feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java delete mode 100644 feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi delete mode 100644 feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java (limited to 'feature-eelf') diff --git a/feature-eelf/pom.xml b/feature-eelf/pom.xml deleted file mode 100644 index 2cd33abc..00000000 --- a/feature-eelf/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - org.onap.policy.drools-pdp - drools-pdp - 1.10.1-SNAPSHOT - - - feature-eelf - - feature-eelf - Loadable module that uses EELF and common module logging infrastructure - - - 1.8 - 1.8 - - - - - - maven-assembly-plugin - - - zipfile - - single - - package - - true - ${project.artifactId}-${project.version} - - src/assembly/assemble_zip.xml - - false - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - - copy-dependencies - - prepare-package - - false - ${project.build.directory}/assembly/lib - false - true - true - false - false - false - runtime - true - - - - - - - - - - ch.qos.logback - logback-classic - test - - - com.att.eelf - eelf-core - 2.0.0-oss - - - org.onap.policy.common - ONAP-Logging - ${policy.common.version} - - - org.onap.policy.drools-pdp - policy-management - ${project.version} - provided - - - junit - junit - test - - - - diff --git a/feature-eelf/src/assembly/assemble_zip.xml b/feature-eelf/src/assembly/assemble_zip.xml deleted file mode 100644 index 005d0389..00000000 --- a/feature-eelf/src/assembly/assemble_zip.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - feature-eelf-package - - zip - - - false - - - - target - lib/feature - - feature-eelf-${project.version}.jar - - - - target/assembly/lib - lib/dependencies - - *.jar - - - - src/main/feature/config - config - 0644 - - - - src/main/feature/bin - bin - 0744 - - - - src/main/feature/db - db - 0744 - - - - src/main/feature/install - install - 0744 - - - - - diff --git a/feature-eelf/src/main/feature/config/logback-eelf.xml b/feature-eelf/src/main/feature/config/logback-eelf.xml deleted file mode 100644 index 7acd33fa..00000000 --- a/feature-eelf/src/main/feature/config/logback-eelf.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - ${defaultPattern} - - - - - ${logDirectory}/${auditLogName}.log - - ${logDirectory}/${auditLogName}.%i.log.zip - - 1 - 5 - - - 10MB - - - ${defaultAuditPattern} - - - - - - - - - ${logDirectory}/${metricsLogName}.log - - ${logDirectory}/${metricsLogName}.%i.log.zip - - 1 - 5 - - - 15MB - - - ${defaultMetricPattern} - - - - - - - - - - ${logDirectory}/${errorLogName}.log - - ${logDirectory}/${errorLogName}.%i.log.zip - - 1 - 5 - - - ERROR - - - 20MB - - - ${defaultErrorPattern} - - - - - - - - - ${debugLogDirectory}/${debugLogName}.log - - ${debugLogDirectory}/${debugLogName}.%i.log.zip - - 1 - 5 - - - 20MB - - - ${debugPattern} - - - - - - - - - ${logDirectory}/${networkLogName}.log - - ${logDirectory}/${networkLogName}.%i.log.zip - - 1 - 5 - - - 15MB - - - ${networkPattern} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature-eelf/src/main/feature/install/disable b/feature-eelf/src/main/feature/install/disable deleted file mode 100644 index eb4e0fac..00000000 --- a/feature-eelf/src/main/feature/install/disable +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env sh - -### -# ============LICENSE_START======================================================= -# ONAP POLICY -# ================================================================================ -# Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -## - -if [ "${DEBUG}" = "y" ]; then - set -x -fi - -SYSTEM_PROPS="${POLICY_HOME}"/config/system.properties - -if [ -f "${SYSTEM_PROPS}" ] && [ -r "${SYSTEM_PROPS}" ]; then - if grep -q "^logback.configurationFile=.*$" "${SYSTEM_PROPS}"; then - sed -i -e "s|^logback.configurationFile=.*$|logback.configurationFile=config/logback.xml|" "${SYSTEM_PROPS}" - fi -fi diff --git a/feature-eelf/src/main/feature/install/enable b/feature-eelf/src/main/feature/install/enable deleted file mode 100644 index 50cd9c1e..00000000 --- a/feature-eelf/src/main/feature/install/enable +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env sh - -### -# ============LICENSE_START======================================================= -# ONAP POLICY -# ================================================================================ -# Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -## - -if [ "${DEBUG}" = "y" ]; then - set -x -fi - -SYSTEM_PROPS="${POLICY_HOME}"/config/system.properties - -if [ -f "${SYSTEM_PROPS}" ] && [ -r "${SYSTEM_PROPS}" ]; then - if grep -q "^logback.configurationFile=.*$" "${SYSTEM_PROPS}"; then - sed -i -e "s|^logback.configurationFile=.*$|logback.configurationFile=config/logback-eelf.xml|" "${SYSTEM_PROPS}" - else - echo "logback.configurationFile=config/logback-eelf.xml" >> "${SYSTEM_PROPS}" - fi -fi diff --git a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java b/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java deleted file mode 100644 index 58679d48..00000000 --- a/feature-eelf/src/main/java/org/onap/policy/drools/eelf/EelfFeature.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * feature-eelf - * ================================================================================ - * Copyright (C) 2017-2019, 2021 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.drools.eelf; - -import com.att.eelf.configuration.Configuration; -import java.nio.file.Paths; -import org.onap.policy.common.logging.flexlogger.FlexLogger; -import org.onap.policy.common.logging.flexlogger.Logger; -import org.onap.policy.drools.features.PolicyEngineFeatureApi; -import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.drools.utils.logging.LoggerUtil; - -/** - * Feature EELF : Enables EELF Logging Libraries . - */ -public class EelfFeature implements PolicyEngineFeatureApi { - - @Override - public final boolean beforeBoot(PolicyEngine engine, String[] cliArgs) { - - String logback = System.getProperty(LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY, - LoggerUtil.LOGBACK_CONFIGURATION_FILE_DEFAULT); - var logbackPath = Paths.get(logback); - - if (System.getProperty(Configuration.PROPERTY_LOGGING_FILE_PATH) == null) { - System.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, - logbackPath.toAbsolutePath().getParent().toString()); - } - - if (System.getProperty(Configuration.PROPERTY_LOGGING_FILE_NAME) == null) { - System.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, - logbackPath.getFileName().toString()); - } - - var logger = FlexLogger.getLogger(this.getClass(), true); - - if (logger.isInfoEnabled()) { - logProperty(logger, LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY); - logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_PATH); - logProperty(logger, Configuration.PROPERTY_LOGGING_FILE_NAME); - } - - return false; - } - - private void logProperty(Logger logger, String propnm) { - logger.info("eelf-feature: Property " + propnm + "=" + System.getProperty(propnm)); - } - - @Override - public int getSequenceNumber() { - return 0; - } - -} diff --git a/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi b/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi deleted file mode 100644 index f2bcc4cb..00000000 --- a/feature-eelf/src/main/resources/META-INF/services/org.onap.policy.drools.features.PolicyEngineFeatureApi +++ /dev/null @@ -1 +0,0 @@ -org.onap.policy.drools.eelf.EelfFeature diff --git a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java b/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java deleted file mode 100644 index 10e2632a..00000000 --- a/feature-eelf/src/test/java/org/onap/policy/drools/eelf/test/EElfTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * feature-eelf - * ================================================================================ - * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.drools.eelf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import ch.qos.logback.classic.LoggerContext; -import com.att.eelf.configuration.Configuration; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFLogger.Level; -import com.att.eelf.configuration.EELFManager; -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.common.logging.flexlogger.FlexLogger; -import org.onap.policy.drools.eelf.EelfFeature; -import org.onap.policy.drools.system.PolicyEngineConstants; -import org.onap.policy.drools.utils.logging.LoggerUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Logger Tests. - */ -public class EElfTest { - - /** - * logback configuration location. - */ - public static final String LOGBACK_CONFIGURATION_FILE_DEFAULT = "src/main/feature/config/logback-eelf.xml"; - - /** - * SLF4J Logger. - */ - private final Logger slf4jLogger = LoggerFactory.getLogger(EElfTest.class); - - /** - * Get all loggers. - * - * @return list of all loggers - */ - protected List loggers() { - List loggers = new ArrayList(); - LoggerContext context = - (LoggerContext) org.slf4j.LoggerFactory.getILoggerFactory(); - for (org.slf4j.Logger logger: context.getLoggerList()) { - loggers.add(logger.getName()); - } - slf4jLogger.info(loggers.toString()); - return loggers; - } - - /** - * Assert Log Levels are the same between an EELF Logger and an SLF4J Logger. - * - * @param eelfLogger EELF Logger - * @param slf4jLogger SLF4J Logger - */ - protected void assertLogLevels(EELFLogger eelfLogger, Logger slf4jLogger) { - assertEquals(slf4jLogger.isDebugEnabled(), eelfLogger.isDebugEnabled()); - assertEquals(slf4jLogger.isInfoEnabled(), eelfLogger.isInfoEnabled()); - assertEquals(slf4jLogger.isErrorEnabled(), eelfLogger.isErrorEnabled()); - assertEquals(slf4jLogger.isWarnEnabled(), eelfLogger.isWarnEnabled()); - assertEquals(slf4jLogger.isTraceEnabled(), eelfLogger.isTraceEnabled()); - } - - @Test - public void testSlf4jLog() { - - /* standard slf4j using defaults */ - - slf4jLogger.info("slf4j info"); - - List loggers = loggers(); - - assertFalse(loggers.contains(Configuration.DEBUG_LOGGER_NAME)); - assertFalse(loggers.contains(Configuration.AUDIT_LOGGER_NAME)); - assertFalse(loggers.contains(Configuration.ERROR_LOGGER_NAME)); - assertFalse(loggers.contains(Configuration.METRICS_LOGGER_NAME)); - - /* set logback configuration */ - - System.setProperty(LoggerUtil.LOGBACK_CONFIGURATION_FILE_SYSTEM_PROPERTY, - LOGBACK_CONFIGURATION_FILE_DEFAULT); - - /* set up eelf throuth common loggings library */ - - EelfFeature feature = new EelfFeature(); - feature.beforeBoot(PolicyEngineConstants.getManager(), null); - - loggers = loggers(); - assertTrue(loggers.contains(Configuration.DEBUG_LOGGER_NAME)); - assertTrue(loggers.contains(Configuration.AUDIT_LOGGER_NAME)); - assertTrue(loggers.contains(Configuration.ERROR_LOGGER_NAME)); - assertTrue(loggers.contains(Configuration.METRICS_LOGGER_NAME)); - - final EELFLogger eelfAuditLogger = EELFManager.getAuditLogger(); - final Logger slf4jAuditLogger = org.slf4j.LoggerFactory.getLogger(Configuration.AUDIT_LOGGER_NAME); - org.onap.policy.common.logging.flexlogger.Logger flexLogger = - FlexLogger.getLogger(EElfTest.class, true); - - /* generate an error entry */ - - Exception testException = new IllegalStateException("exception test"); - flexLogger.error("flex-logger exception", testException); - EELFManager.getErrorLogger().error("eelf-logger exception", testException); - org.slf4j.LoggerFactory.getLogger(Configuration.ERROR_LOGGER_NAME).error("slf4j-logger", testException); - - - /* generate an audit entry through all logs */ - - flexLogger.audit("flexlogger audit"); - eelfAuditLogger.info("eelf audit"); - slf4jAuditLogger.info("slf4j audit"); - - /* check log levels in eelf and standard slf4j change in both directions */ - - /* eelf initiated */ - eelfAuditLogger.setLevel(Level.ERROR); - assertLogLevels(eelfAuditLogger, slf4jAuditLogger); - - /* slf4j initiated */ - ((ch.qos.logback.classic.Logger) slf4jLogger).setLevel((ch.qos.logback.classic.Level.INFO)); - assertLogLevels(eelfAuditLogger, slf4jAuditLogger); - } -} -- cgit 1.2.3-korg