diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-core-lib/openecomp-config-lib | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-config-lib')
12 files changed, 417 insertions, 99 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml index 5f2005d3c4..989895c9cb 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml @@ -3,46 +3,45 @@ 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> + <artifactId>openecomp-config-lib</artifactId> <parent> - <groupId>org.openecomp.sdc</groupId> + <groupId>org.openecomp.core</groupId> <artifactId>openecomp-core-lib</artifactId> <version>1.1.0-SNAPSHOT</version> </parent> - <artifactId>openecomp-config-lib</artifactId> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.12.4</version> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + </plugins> + </build> <dependencies> <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - <version>2.3.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - <version>1.14</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openecomp.sdc</groupId> + <groupId>org.openecomp.core</groupId> <artifactId>openecomp-nosqldb-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>6.9.10</version> + <version>${testng.version}</version> <scope>test</scope> </dependency> - <dependency> + <!--dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> <version>${project.version}</version> <scope>test</scope> - </dependency> + </dependency--> </dependencies> - -</project>
\ No newline at end of file +</project> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup new file mode 100644 index 0000000000..7d6cd8f980 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/pom.xml.versionsBackup @@ -0,0 +1,36 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <dependencies> + <dependency> + <groupId>org.openecomp.core</groupId> + <artifactId>openecomp-nosqldb-core</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>6.9.10</version> + <scope>test</scope> + </dependency> + <!--dependency> + <groupId>org.openecomp.sdc</groupId> + <artifactId>openecomp-sdc-vendor-software-product-api</artifactId> + <version>1.0-SNAPSHOT</version> + <scope>test</scope> + </dependency--> + </dependencies> + + <parent> + <groupId>org.openecomp.core</groupId> + <artifactId>openecomp-core-lib</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>openecomp-config-lib</artifactId> + <version>1.0-SNAPSHOT</version> + + +</project>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java index a68c6b614a..1d5fd16ee1 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfig.java @@ -25,6 +25,7 @@ import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; import java.util.Collection; + public interface ApplicationConfig { ConfigurationData getConfigurationData(String namespace, String key); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java index e022294dfd..c751b98c7e 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/ApplicationConfigFactory.java @@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig; import org.openecomp.core.factory.api.AbstractComponentFactory; import org.openecomp.core.factory.api.AbstractFactory; + public abstract class ApplicationConfigFactory extends AbstractComponentFactory<ApplicationConfig> { public static ApplicationConfigFactory getInstance() { diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java index 7fb0e2f5ae..b7cd576557 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoCassandraImpl.java @@ -36,8 +36,10 @@ import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; import java.util.Collection; import java.util.Objects; + public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<ApplicationConfigEntity> - implements ApplicationConfigDao { + implements + ApplicationConfigDao { private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface(); private static final Mapper<ApplicationConfigEntity> mapper = @@ -56,11 +58,6 @@ public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<Applicat } @Override - public Collection<ApplicationConfigEntity> list(ApplicationConfigEntity entity) { - return accessor.list(entity.getNamespace()).all(); - } - - @Override public void create(ApplicationConfigEntity entity) { accessor.updateApplicationConfigData(entity.getNamespace(), entity.getKey(), entity.getValue()); } @@ -76,6 +73,11 @@ public class ApplicationConfigDaoCassandraImpl extends CassandraBaseDao<Applicat } @Override + public Collection<ApplicationConfigEntity> list(ApplicationConfigEntity entity) { + return accessor.list(entity.getNamespace()).all(); + } + + @Override public long getValueTimestamp(String namespace, String key) { ResultSet resultSet = accessor.getValueAndTimestampOfConfigurationValue(namespace, key); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java index cea49ea8d1..23dde63e18 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/dao/impl/ApplicationConfigDaoFactoryImpl.java @@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig.dao.impl; import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDao; import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDaoFactory; + public class ApplicationConfigDaoFactoryImpl extends ApplicationConfigDaoFactory { private static final ApplicationConfigDao INSTANCE = new ApplicationConfigDaoCassandraImpl(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java index cca07fc227..eebd3320f0 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigFactoryImpl.java @@ -23,6 +23,7 @@ package org.openecomp.core.utilities.applicationconfig.impl; import org.openecomp.core.utilities.applicationconfig.ApplicationConfig; import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory; + public class ApplicationConfigFactoryImpl extends ApplicationConfigFactory { private static final ApplicationConfig INSTANCE = new ApplicationConfigImpl(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java index ff9c9aea87..16cd1bce17 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/impl/ApplicationConfigImpl.java @@ -32,9 +32,6 @@ import org.openecomp.sdc.common.errors.ErrorCode; import java.util.Collection; import java.util.Objects; -/** - * The type Application config. - */ public class ApplicationConfigImpl implements ApplicationConfig { private static final ApplicationConfigDao applicationConfigDao = ApplicationConfigDaoFactory.getInstance().createInterface(); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java index 53d3797e53..b41cda635d 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/java/org/openecomp/core/utilities/applicationconfig/type/ConfigurationData.java @@ -20,6 +20,7 @@ package org.openecomp.core.utilities.applicationconfig.type; + public class ConfigurationData { private String value; diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml new file mode 100644 index 0000000000..cec94f17b5 --- /dev/null +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/additional-logback.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<included> + + <property scope="system" name="OPENECOMP-component-name" value="ASDC" /> + <property scope="system" name="OPENECOMP-subcomponent-name" value="ASDC-BE" /> + + <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + <include resource="asdc_debug_logback.xml"/--> + + <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)--> + <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)--> + <property name="default-log-pattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${OPENECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> + + <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/> + + <appender name="DEBUG_PACKAGE_INCLUDE" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package_include.log + </file> + + <!-- No need to deny audit messages - they are INFO only, will be denied + anyway --> + <!-- Transaction messages filter - deny Transaction messages, there are + some DEBUG level messages among them --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- accept DEBUG and TRACE level --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression> + e.level.toInt() <= DEBUG.toInt() + </expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>NEUTRAL</OnMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package_include.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${asdc-debug-log-pattern}</pattern> + </encoder> + </appender> + + + <logger name="org.openecomp.sdc.validation.impl.validators" level="DEBUG" additivity ="false"> + <appender-ref ref="DEBUG_PACKAGE_INCLUDE" /> + </logger> + +</included>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml index e256e0b10a..92c486e901 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/main/resources/logback.xml @@ -1,23 +1,173 @@ -<!-- <?xml version="1.0" encoding="UTF-8"?> -<configuration> +<configuration scan="true" scanPeriod="5 seconds"> + <property scope="system" name="OPENECOMP-component-name" value="ASDC" /> + <property scope="system" name="OPENECOMP-subcomponent-name" value="ASDC-BE" /> + <property file="${config.home}/catalog-be/configuration.yaml" /> + <property scope="context" name="enable-all-log" value="false" /> + <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + <include resource="asdc_debug_logback.xml"/--> + + <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)--> + <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)--> + <property name="default-log-pattern" + value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${OPENECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> + + <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/> + + <!-- All log --> + <if condition='property("enable-all-log").equalsIgnoreCase("true")'> + <then> + <appender name="ALL_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log + </file> + + <rollingPolicy + class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/all.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="ALL_ROLLING" /> + </appender> + </then> + </if> + + <!-- Error log --> + <appender name="ERROR_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log + </file> + + <!-- Audit messages filter - deny audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>AUDIT_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- Transaction messages filter - deny Transaction messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- deny all events with a level below INFO, that is TRACE and DEBUG --> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>INFO</level> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/Error.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Debug log --> <appender name="DEBUG_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>DOX-BE.log + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log </file> - <!– No need to deny audit messages - they are INFO only, will be denied - anyway –> - <!– Transaction messages filter - deny Transaction messages, there are - some DEBUG level messages among them –> + <!-- No need to deny audit messages - they are INFO only, will be denied + anyway --> + <!-- Transaction messages filter - deny Transaction messages, there are + some DEBUG level messages among them --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + <!-- accept DEBUG and TRACE level --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression> + e.level.toInt() <= DEBUG.toInt() + </expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>NEUTRAL</OnMatch> + </filter> - <!– accept DEBUG and TRACE level –> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Debug log --> + <appender name="PACKAGE_DEBUG_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log + </file> + + <!-- No need to deny audit messages - they are INFO only, will be denied + anyway --> + <!-- Transaction messages filter - deny Transaction messages, there are + some DEBUG level messages among them --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>NEUTRAL</onMismatch> + <onMatch>DENY</onMatch> + </filter> + + <!-- accept DEBUG and TRACE level --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator"> + <expression> + e.level.toInt() <= DEBUG.toInt() + </expression> + </evaluator> + <OnMismatch>DENY</OnMismatch> + <OnMatch>NEUTRAL</OnMatch> + </filter> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>/DOX-BE.log.%i + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/debug_by_package.log.%i </fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> @@ -28,63 +178,107 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>%level [%d{yyyy-MM-dd'T'HH:mm:ss}] - Method=%M, Desc=<%msg>%n</pattern> + <pattern>${asdc-debug-log-pattern}</pattern> </encoder> </appender> + <!-- Audit log --> + <appender name="AUDIT_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> - <root level="info"> + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log + </file> + + <!-- Audit messages filter - accept audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>AUDIT_MARKER</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/audit.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- SdncTransaction log --> + <appender name="TRANSACTION_ROLLING" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + + <file>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log + </file> + + <!-- Transaction messages filter - accept audit messages --> + <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> + <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> + <marker>TRANSACTION_MARKER</marker> + </evaluator> + <onMismatch>DENY</onMismatch> + <onMatch>ACCEPT</onMatch> + </filter> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${log.home}/${OPENECOMP-component-name}/${OPENECOMP-subcomponent-name}/transaction.log.%i + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>20MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>${default-log-pattern}</pattern> + </encoder> + </appender> + + <!-- Asynchronicity Configurations --> + <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="DEBUG_ROLLING" /> + </appender> + + <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="TRANSACTION_ROLLING" /> + </appender> + + <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender"> + <appender-ref ref="ERROR_ROLLING" /> + </appender> + + + <root level="INFO"> + <appender-ref ref="ASYNC_ERROR" /> + <appender-ref ref="ASYNC_DEBUG" /> + <appender-ref ref="AUDIT_ROLLING" /> + <appender-ref ref="ASYNC_TRANSACTION" /> + <if condition='property("enable-all-log").equalsIgnoreCase("true")'> + <then> + <appender-ref ref="ALL_ROLLING" /> + </then> + </if> </root> -</configuration>--> -<configuration scan="true" scanPeriod="3 seconds"> - - <property name="logDir" value="logs"/> - <property name="componentName" value="ASDC"/> - <property name="ECOMP-subcomponent-name" value="ASDC-BE"/> - - <property name="defaultPattern" - value="%msg%n"/> - - <!--<property name="MetricsLogPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{CategoryLogLevel}|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIP}|%logger%n" /> - <property name="AuditLogPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{CategoryLogLevel}|%X{Severity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{ClientIP}%n" /> - <property name="ErrorLogPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS, GMT}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%msg%n"/> - <property name="DebugLogPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSS, GMT}|%X{RequestId}||%logger|%msg%n"/>--> - - <!-- new pattern --> - <property name="default-log-pattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{uuid}|%X{serviceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{userId}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%X{ErrorCategory}|%X{ErrorCode}|%X{ErrorDescription}|%level|%X{alarmSeverity}|%X{localAddr}|%X{ElapsedTime}|%X{beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n"/> - - <property name="logDirectory" value="${logDir}/${componentName}"/> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>${defaultPattern}</pattern> - </encoder> - </appender> - - <appender name="DISPATCHER" class="ch.qos.logback.classic.sift.SiftingAppender"> - <discriminator class="org.openecomp.core.logging.logback.EventTypeDiscriminator"/> - <sift> - <appender name="${eventType}" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${eventType}.log</file> - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${logDirectory}/${eventType}.%i.log.zip</fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>9</maxIndex> - </rollingPolicy> - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>${default-log-pattern}</pattern> - </encoder> - </appender> - </sift> - </appender> - - <root level="DEBUG"> - <appender-ref ref="DISPATCHER"/> - </root> + <logger name="org.openecomp.sdc" level="INFO" /> + + <logger name="org.openecomp.sdc.vendorsoftwareproduct" level="DEBUG" additivity ="false"> + <appender-ref ref="PACKAGE_DEBUG_ROLLING" /> + </logger> + + <logger name="org.openecomp.sdc.vendorlicense" level="DEBUG" additivity ="false"> + <appender-ref ref="PACKAGE_DEBUG_ROLLING" /> + </logger> </configuration>
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java index 40cde1ecb2..de41bb8202 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-config-lib/src/test/java/org/openecomp/sdc/applicationconfig/dao/ApplicationConfigImplDaoTest.java @@ -1,9 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.sdc.applicationconfig.dao; -import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.common.errors.ErrorCategory; -import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionEntityType; import org.openecomp.core.utilities.applicationconfig.ApplicationConfig; import org.openecomp.core.utilities.applicationconfig.ApplicationConfigFactory; import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDao; @@ -11,6 +27,9 @@ import org.openecomp.core.utilities.applicationconfig.dao.ApplicationConfigDaoFa import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfigEntity; import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.common.errors.CoreException; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -27,7 +46,7 @@ public class ApplicationConfigImplDaoTest { private static ApplicationConfig applicationConfig = ApplicationConfigFactory.getInstance().createInterface(); -// @BeforeClass + @BeforeClass public static void init() { try { @@ -55,17 +74,17 @@ public class ApplicationConfigImplDaoTest { return new String(FileUtils.toByteArray(FileUtils.loadFileToInputStream(path))); } -// @Test + @Test public void testApplicationConfigTimestampValue() { ConfigurationData configurationData = applicationConfig - .getConfigurationData("test - namespace", CompositionEntityType.vsp.name()); + .getConfigurationData("test - namespace", "vsp"); Assert.assertNotNull(configurationData); Assert.assertNotEquals(configurationData.getTimeStamp(), 0); } -// @Test(dependsOnMethods = "testApplicationConfigTimestampValue") + @Test(dependsOnMethods = "testApplicationConfigTimestampValue") public void testNotExistingApplicationConfigTimestampValue() { try { applicationConfig.getConfigurationData("test - namespace", "aaa"); @@ -76,7 +95,7 @@ public class ApplicationConfigImplDaoTest { } -// @Test(dependsOnMethods = "testApplicationConfigTimestampValue") + @Test(dependsOnMethods = "testApplicationConfigTimestampValue") public void testInsertApplicationConfiguration() { String testTemplate = loadFileToString("questionnaire/testTemplate.txt"); applicationConfig.insertValue("test_namespace", "test_key", testTemplate); |