From 774ce8bca3e9986bfc6b6857edfeaa12f219ff33 Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Wed, 29 May 2024 22:24:50 +0530 Subject: [PATCH 1/6] Add cache sync dependencies. --- .../tests-integration/tests-backend/pom.xml | 155 ++++++++++++++++++ .../src/test/resources/testng.xml | 6 + 2 files changed, 161 insertions(+) diff --git a/modules/integration/tests-integration/tests-backend/pom.xml b/modules/integration/tests-integration/tests-backend/pom.xml index 08f1be8d61e..50ee5c4469a 100644 --- a/modules/integration/tests-integration/tests-backend/pom.xml +++ b/modules/integration/tests-integration/tests-backend/pom.xml @@ -399,6 +399,105 @@ + + copy-jms-cache-sync-manager + compile + + copy + + + + + org.wso2.carbon.cache.sync.manager + org.wso2.carbon.cache.sync.jms.manager + 2.0.14-SNAPSHOT + jar + false + + ${basedir}/target/test-classes/samples/cache + + org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar + + + org.apache.geronimo.specs + geronimo-j2ee-management_1.1_spec + 1.0.1 + jar + false + + ${basedir}/target/test-classes/samples/cache + + geronimo-j2ee-management_1.1_spec-1.0.1.jar + + + org.apache.activemq + activemq-broker + 5.16.3 + jar + false + + ${basedir}/target/test-classes/samples/cache + + activemq-broker-5.16.3.jar + + + org.apache.activemq + activemq-client + 5.16.3 + jar + false + + ${basedir}/target/test-classes/samples/cache + + activemq-client-5.16.3.jar + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1.1 + jar + false + + ${basedir}/target/test-classes/samples/cache + + geronimo-jms_1.1_spec-1.1.1.jar + + + org.fusesource.hawtbuf + hawtbuf + 1.11 + jar + false + + ${basedir}/target/test-classes/samples/cache + + hawtbuf-1.11.jar + + + org.slf4j + slf4j-api + 1.7.31 + jar + false + + ${basedir}/target/test-classes/samples/cache + + slf4j-api-1.7.31.jar + + + org.wso2.orbit.javax.jms + jms-api + 2.0.1.wso2v1 + jar + false + + ${basedir}/target/test-classes/samples/cache + + jms-api_2-2.0.1.wso2v1.jar + + + + copy-resources-dropins compile @@ -941,6 +1040,62 @@ ${samples.is.version} war + + org.wso2.carbon.cache.sync.manager + org.wso2.carbon.cache.sync.jms.manager + 2.0.14-SNAPSHOT + + + org.apache.activemq + activemq-broker + 5.16.3 + + + org.apache.activemq + activemq-client + 5.16.3 + + + org.apache.activemq + activemq-all + 5.16.3 + + + org.apache.activemq + activemq-all + + + + + org.apache.geronimo.specs + geronimo-j2ee-management_1.1_spec + 1.0.1 + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1.1 + + + org.fusesource.hawtbuf + hawtbuf + 1.11 + + + org.slf4j + slf4j-api + 1.7.31 + + + org.wso2.orbit.javax.jms + jms-api + 2.0.1.wso2v1 + + + + + + org.wso2.samples.is org.wso2.carbon.identity.sample.extension.authenticators diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml index aae33d8d42d..ad2c8e78140 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml @@ -392,4 +392,10 @@ + + + + + + From 772ee7a9bebd336a8d26ee654d2fa1ec1e5f31b9 Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Wed, 29 May 2024 22:25:10 +0530 Subject: [PATCH 2/6] Add cache sync tests. --- .../test/cache/JMSCacheSyncTestCase.java | 375 ++++++++++++++++++ 1 file changed, 375 insertions(+) create mode 100755 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java new file mode 100755 index 00000000000..2d7645fe529 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you 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. + */ + +package org.wso2.identity.integration.test.cache; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerPlugin; +import org.apache.activemq.broker.BrokerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; +import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException; +import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; +import org.wso2.carbon.utils.CarbonUtils; +import org.wso2.identity.integration.common.utils.ISIntegrationTest; +import org.wso2.identity.integration.test.util.Utils; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Scanner; + +import javax.jms.Connection; +import javax.jms.DeliveryMode; +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.jms.Topic; + +public class JMSCacheSyncTestCase extends ISIntegrationTest { + + private static final Log log = LogFactory.getLog(JMSCacheSyncTestCase.class); + private static final String BROKER_URL = "tcp://localhost:61616"; + private static final String TOPIC_NAME = "CacheTopic"; + private static final String SERVICE_STARTED_MESSAGE = + "Cache Sync JMS Manager Service bundle activated successfully."; + private static final String RECEIVED_MESSAGE = "Received cache invalidation message from other cluster nodes"; + private static final String SENT_MESSAGE = "Sending cache invalidation message to other cluster nodes"; + public static final String CACHE_SYNC_JMS_MANAGER_JAR = "org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar"; + public static final String JMS_API_JAR = "jms-api_2-2.0.1.wso2v1.jar"; + + private static Connection connection; + private static Session session; + private static MessageProducer producer; + private static BrokerService broker; + + private ServerConfigurationManager scm; + private File defaultConfigFile; + private File defaultLog4j2File; + private File carbonLogfile; + private String jarPathString; + + @BeforeTest(alwaysRun = true) + public void initCacheSyncConfig() throws Exception { + + startBroker(); + String carbonHome = CarbonUtils.getCarbonHome(); + carbonLogfile = new File(carbonHome + File.separator + "repository" + + File.separator + "logs" + File.separator + "wso2carbon.log"); + removeExistingCarbonLog(); + + super.init(); + applyDropinJar(CACHE_SYNC_JMS_MANAGER_JAR); + applyDropinJar(JMS_API_JAR); + applyAllActiveMQJars(); + + scm = new ServerConfigurationManager(isServer); + + applyCacheSyncDeploymentConfigurations(carbonHome); + applyCacheSyncDebugLogConfigurations(carbonHome); + } + + @AfterClass(alwaysRun = true) + public void testClear() throws Exception { + + stopBroker(); +// removeDropinsJar(CACHE_SYNC_JMS_MANAGER_JAR); +// removeDropinsJar(JMS_API_JAR); +// removeAllActiveMQJars(); + resetISConfiguration(); + } + + @Test + public void confirmAllRelatedArtifactsPresence() { + + Assert.assertTrue(Files.exists(Paths.get(getDropinsFilePath(CACHE_SYNC_JMS_MANAGER_JAR).toURI())), + "Cache sync manager jar is not copied successfully."); + Assert.assertTrue(Files.exists(Paths.get(getDropinsFilePath(JMS_API_JAR).toURI())), + "JMS api jar is not copied successfully."); + } + + @Test + public void isServiceStarted() { + + Assert.assertTrue( + checkLogForMessage(SERVICE_STARTED_MESSAGE), + "Error while starting JMS cache sync service."); + } + + @Test + public void isMessageReceived() throws InterruptedException { + + Thread.sleep(50000); + sendMessage(); + System.out.println("Message send successfully"); + Thread.sleep(50000); + + Assert.assertTrue( + checkLogForMessage(RECEIVED_MESSAGE), + "Error while receiving message from jms broker."); + } + + @Test + public void isMessageSent() { + + Assert.assertTrue( + checkLogForMessage(SENT_MESSAGE), + "Error while sending message to jms broker."); + } + + private enum ActiveMQJars { + + GERONIMO_J2EE_MANAGEMENT("geronimo-j2ee-management_1.1_spec-1.0.1.jar"), + ACTIVEMQ_BROKER("activemq-broker-5.16.3.jar"), + ACTIVEMQ_CLIENT("activemq-client-5.16.3.jar"), + GERONIMO_JMS("geronimo-jms_1.1_spec-1.1.1.jar"), + HAWTBUF("hawtbuf-1.11.jar"), + SLF4J_API("slf4j-api-1.7.31.jar"); + + private final String jarName; + + ActiveMQJars(String jarName) { + this.jarName = jarName; + } + + public String getJarName() { + return jarName; + } + } + + private void applyCacheSyncDebugLogConfigurations(String carbonHome) throws IOException { + + log.info("Replacing default log4j2.properties & enabling cache sync debug logs"); + defaultLog4j2File = new File(carbonHome + File.separator + "repository" + File.separator + + "conf" + File.separator + "log4j2.properties"); + File configuredLo4j2File = new File(getISResourceLocation() + File.separator + "cache" + + File.separator + "cache_sync_log4j2.properties"); + scm.applyConfigurationWithoutRestart(configuredLo4j2File, defaultLog4j2File, true); + } + + private void applyCacheSyncDeploymentConfigurations(String carbonHome) throws AutomationUtilException, IOException { + + log.info("Replacing default deployment.toml & enabling cache sync manager."); + defaultConfigFile = getDeploymentTomlFile(carbonHome); + File cacheSyncConfigFile = new File( + getISResourceLocation() + File.separator + "cache" + File.separator + + "cache_sync_config.toml"); + scm.applyConfiguration(cacheSyncConfigFile, defaultConfigFile, true, true); + } + + private void applyDropinJar(String jarName) throws IOException { + + InputStream jarUrl = getClass() + .getResourceAsStream(ISIntegrationTest.URL_SEPARATOR + "samples" + ISIntegrationTest.URL_SEPARATOR + + "cache" + ISIntegrationTest.URL_SEPARATOR + jarName); + jarPathString = Utils.getResidentCarbonHome() + + File.separator + "repository" + + File.separator + "components" + File.separator + + "dropins" + File.separator + jarName; + File jarDestFile = new File(jarPathString); + FileOutputStream jarDest = new FileOutputStream(jarDestFile); + copyFileUsingStream(jarUrl, jarDest); + log.info("Copied the cache sync manager jar file to " + jarPathString); + } + + private void applyAllActiveMQJars() throws IOException { + + for (ActiveMQJars jar : ActiveMQJars.values()) { + applyLibJar(jar.getJarName()); + } + } + + private void applyLibJar(String jarName) throws IOException { + + InputStream jarUrl = getClass().getResourceAsStream(ISIntegrationTest.URL_SEPARATOR + + "samples" + ISIntegrationTest.URL_SEPARATOR + + "cache" + ISIntegrationTest.URL_SEPARATOR + jarName); + String jarPathString = Utils.getResidentCarbonHome() + + File.separator + "repository" + + File.separator + "components" + File.separator + + "lib" + File.separator + jarName; + File jarDestFile = new File(jarPathString); + FileOutputStream jarDest = new FileOutputStream(jarDestFile); + copyFileUsingStream(jarUrl, jarDest); + log.info("Copied the activemq jar file to " + jarPathString); + } + + private void removeAllActiveMQJars() { + + for (ActiveMQJars jar : ActiveMQJars.values()) { + removeLibJar(jar.getJarName()); + removeDropinsJar(transformJarName(jar.getJarName())); + } + } + + private String transformJarName(String originalName) { + return originalName.replace("-", "_").replaceAll("(\\.\\w+)$", "_1.0.0$1"); + } + + private void removeExistingCarbonLog() { + + if (carbonLogfile.exists()) { + carbonLogfile.delete(); + } + } + + private File getLibFilePath(String jarName) { + + File jarDestFile = new File(Utils.getResidentCarbonHome() + + File.separator + File.separator + "repository" + + File.separator + "components" + File.separator + + "lib" + File.separator + jarName); + return jarDestFile; + } + + private void removeLibJar(String jarName) { + + File jarDestFile = getLibFilePath(jarName); + if (jarDestFile.exists()) { + jarDestFile.delete();; + } + } + + private void removeDropinsJar(String jarName) { + + File jarDestFile = getDropinsFilePath(jarName); + if (jarDestFile.exists()) { + jarDestFile.delete();; + } + } + + private File getDropinsFilePath(String jarName) { + + File jarDestFile = new File(Utils.getResidentCarbonHome() + + File.separator + File.separator + "repository" + + File.separator + "components" + File.separator + + "dropins" + File.separator + jarName); + return jarDestFile; + } + + private void resetISConfiguration() throws Exception { + + log.info("Replacing log4j2.properties with default configurations"); + scm.restoreToLastConfiguration(false); + } + + private boolean checkLogForMessage(String message) { + + try (Scanner scanner = new Scanner(carbonLogfile)) { + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + if (line.contains(message)) { + log.info("Found related log message: " + message); + return true; + } + } + } catch (FileNotFoundException e) { + log.error("Exception occurred while reading the log file: ", e); + } + return false; + } + + private void startBroker() { + + try { + // Create a new instance of the broker service + if (broker != null) { + broker.stop(); + } + broker = new BrokerService(); + broker.setBrokerName("embeddedBroker"); + broker.addConnector("tcp://localhost:61616"); + broker.setPersistent(false); + broker.setPlugins(new BrokerPlugin[0]); + broker.start(); + log.info("ActiveMQ broker started successfully."); + } catch (Exception e) { + log.error("Error while starting the ActiveMQ broker." + e); + } + } + + private void stopBroker() { + + try { + broker.stop(); + System.out.println("ActiveMQ broker stopped successfully."); + } catch (Exception e) { + log.error("Error while stopping the ActiveMQ broker.");; + } + } + + private void sendMessage() { + + try { + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(BROKER_URL); + connection = connectionFactory.createConnection(); + connection.start(); + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Topic topic = session.createTopic(TOPIC_NAME); + producer = session.createProducer(topic); + producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); + + String invalidationMsg = "ClusterCacheInvalidationRequest{" + + "tenantId=-1234, " + + "tenantDomain='example.com', " + + "messageId=message-id-1234, " + + "cacheManager=IdentityApplicationManagementCacheManager, " + + "cache=$__local__$.AppAuthFrameworkSessionContextCache, " + + "cacheKey=org.wso2.carbon.identity.application.authentication.framework.cache." + + "SessionContextCacheKey@543af693}"; + TextMessage message = session.createTextMessage(invalidationMsg); + producer.send(message); + log.info("Sending cache invalidation message to other cluster nodes:" + invalidationMsg); + + } catch (Exception e) { + log.error("Exception while sending message to ActiveMQ: ", e); + } finally { + try { + if (producer != null) producer.close(); + if (session != null) session.close(); + if (connection != null) connection.close(); + } catch (JMSException e) { + log.error("Exception while closing JMS resources: ", e); + } + } + } + + private void copyFileUsingStream(InputStream source, OutputStream dest) throws IOException { + + try { + byte[] buffer = new byte[1024]; + int length; + while ((length = source.read(buffer)) > 0) { + dest.write(buffer, 0, length); + } + } finally { + source.close(); + dest.close(); + } + } +} From 97de1f2acf51fbf4bcd99e31a033fce60a25141d Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Wed, 29 May 2024 22:25:29 +0530 Subject: [PATCH 3/6] Add cache sync artifacts. --- .../artifacts/IS/cache/cache_sync_config.toml | 85 +++ .../IS/cache/cache_sync_log4j2.properties | 490 ++++++++++++++++++ 2 files changed, 575 insertions(+) create mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_config.toml create mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_config.toml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_config.toml new file mode 100644 index 00000000000..cd571fb8ad4 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_config.toml @@ -0,0 +1,85 @@ +[server] +hostname = "localhost" +node_ip = "127.0.0.1" +base_path = "https://$ref{server.hostname}:${carbon.management.port}" + +[super_admin] +username = "admin" +password = "admin" +create_admin_account = true + +[user_store] +type = "database_unique_id" + +[database.identity_db] +type = "h2" +url = "jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" +username = "wso2carbon" +password = "wso2carbon" + +[database.shared_db] +type = "h2" +url = "jdbc:h2:./repository/database/WSO2SHARED_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" +username = "wso2carbon" +password = "wso2carbon" + +[keystore.primary] +file_name = "wso2carbon.jks" +password = "wso2carbon" +type="JKS" + +[truststore] +file_name="client-truststore.jks" +password="wso2carbon" +type="JKS" + +[account_recovery.endpoint.auth] +hash= "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262" + +[identity.auth_framework.endpoint] +app_password= "dashboard" + +# The KeyStore which is used for encrypting/decrypting internal data. By default the primary keystore is used as the internal keystore. + +#[keystore.internal] +#file_name = "$ref{keystore.primary.file_name}" +#type = "$ref{keystore.primary.type}" +#password = "$ref{keystore.primary.password}" +#alias = "$ref{keystore.primary.alias}" +#key_password = "$ref{keystore.primary.key_password}" + +# The KeyStore which is used for tls communication. By default the primary keystore is used as the tls keystore. + +#[keystore.tls] +#file_name = "$ref{keystore.primary.file_name}" +#type = "$ref{keystore.primary.type}" +#password = "$ref{keystore.primary.password}" +#alias = "$ref{keystore.primary.alias}" +#key_password = "$ref{keystore.primary.key_password}" + +#Google reCAPTCHA settings. + +#[recaptcha] +#enabled = true +#api_url = "https://www.google.com/recaptcha/api.js" +#verify_url = "https://www.google.com/recaptcha/api/siteverify" +#site_key = "" +#secret_key = "" + +# SMTP email sender settings. +#[output_adapter.email] +#from_address= "abcd@gmail.com" +#username= "abcd" +#password= "xxxx" +#hostname= "smtp.gmail.com" +#port= 587 + +[cache_invalidator.mb] +enabled="true" +broker_type="jms" +initial_naming_factory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" +provider_url="failover:tcp://localhost:61616" +# provider_url="tcp://localhost:61616" +topic_name="CacheTopic" +producer_name="producer1" +hybrid_mode_enabled="false" diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties new file mode 100644 index 00000000000..378c89d5150 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties @@ -0,0 +1,490 @@ +# +# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +# +# WSO2 Inc. licenses this file to you 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. +# + +# list of all appenders +#add entry "syslog" to use the syslog appender +appenders = CARBON_CONSOLE, CARBON_LOGFILE, AUDIT_LOGFILE, ATOMIKOS_LOGFILE, CARBON_TRACE_LOGFILE, DELETE_EVENT_LOGFILE, TRANSACTION_LOGFILE, osgi, DIAGNOSTICS +#, syslog + +# CARBON_CONSOLE is set to be a ConsoleAppender using a PatternLayout. +appender.CARBON_CONSOLE.type = Console +appender.CARBON_CONSOLE.name = CARBON_CONSOLE +appender.CARBON_CONSOLE.layout.type = PatternLayout +appender.CARBON_CONSOLE.layout.pattern = [%d] [%X{Correlation-ID}] %5p {%c} - %mm%ex%n +appender.CARBON_CONSOLE.filter.threshold.type = ThresholdFilter +appender.CARBON_CONSOLE.filter.threshold.level = DEBUG + +# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout. +appender.CARBON_LOGFILE.type = RollingFile +appender.CARBON_LOGFILE.name = CARBON_LOGFILE +appender.CARBON_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/wso2carbon.log +appender.CARBON_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/wso2carbon-%d{MM-dd-yyyy}.%i.log +appender.CARBON_LOGFILE.layout.type = PatternLayout +appender.CARBON_LOGFILE.layout.pattern = TID: [%tenantId] [%appName] [%d] [%X{Correlation-ID}] %5p {%c} - %mm%ex%n +appender.CARBON_LOGFILE.policies.type = Policies +appender.CARBON_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.CARBON_LOGFILE.policies.time.interval = 1 +appender.CARBON_LOGFILE.policies.time.modulate = true +appender.CARBON_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.CARBON_LOGFILE.policies.size.size=10MB +appender.CARBON_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.CARBON_LOGFILE.strategy.max = 20 +appender.CARBON_LOGFILE.filter.threshold.type = ThresholdFilter +appender.CARBON_LOGFILE.filter.threshold.level = DEBUG + +# Appender config to AUDIT_LOGFILE +appender.AUDIT_LOGFILE.type = RollingFile +appender.AUDIT_LOGFILE.name = AUDIT_LOGFILE +appender.AUDIT_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/audit.log +appender.AUDIT_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/audit-%d{MM-dd-yyyy}.%i.log +appender.AUDIT_LOGFILE.layout.type = PatternLayout +appender.AUDIT_LOGFILE.layout.pattern = TID: [%tenantId] [%d] [%X{Correlation-ID}] %5p {%c} - %mm%ex%n +appender.AUDIT_LOGFILE.policies.type = Policies +appender.AUDIT_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.AUDIT_LOGFILE.policies.time.interval = 1 +appender.AUDIT_LOGFILE.policies.time.modulate = true +appender.AUDIT_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.AUDIT_LOGFILE.policies.size.size=10MB +appender.AUDIT_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.AUDIT_LOGFILE.strategy.max = 20 +appender.AUDIT_LOGFILE.filter.threshold.type = ThresholdFilter +appender.AUDIT_LOGFILE.filter.threshold.level = INFO + +# Appender config to send Atomikos transaction logs to new log file tm.out. +appender.ATOMIKOS_LOGFILE.type = RollingFile +appender.ATOMIKOS_LOGFILE.name = ATOMIKOS_LOGFILE +appender.ATOMIKOS_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/tm.out +appender.ATOMIKOS_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/tm-%d{MM-dd-yyyy}.%i.out +appender.ATOMIKOS_LOGFILE.layout.type = PatternLayout +appender.ATOMIKOS_LOGFILE.layout.pattern = [%d] [%tenantId] %5p {%c} - %mm%ex%n +appender.ATOMIKOS_LOGFILE.policies.type = Policies +appender.ATOMIKOS_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.ATOMIKOS_LOGFILE.policies.time.interval = 1 +appender.ATOMIKOS_LOGFILE.policies.time.modulate = true +appender.ATOMIKOS_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.ATOMIKOS_LOGFILE.policies.size.size=10MB +appender.ATOMIKOS_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.ATOMIKOS_LOGFILE.strategy.max = 20 + +# Appender config to CARBON_TRACE_LOGFILE +appender.CARBON_TRACE_LOGFILE.type = RollingFile +appender.CARBON_TRACE_LOGFILE.name = CARBON_TRACE_LOGFILE +appender.CARBON_TRACE_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/wso2carbon-trace-messages.log +appender.CARBON_TRACE_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/wso2carbon-trace-messages-%d{MM-dd-yyyy}.%i.log +appender.CARBON_TRACE_LOGFILE.layout.type = PatternLayout +appender.CARBON_TRACE_LOGFILE.layout.pattern = [%d] [%tenantId] %5p {%c} - %mm%ex%n +appender.CARBON_TRACE_LOGFILE.policies.type = Policies +appender.CARBON_TRACE_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.CARBON_TRACE_LOGFILE.policies.time.interval = 1 +appender.CARBON_TRACE_LOGFILE.policies.time.modulate = true +appender.CARBON_TRACE_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.CARBON_TRACE_LOGFILE.policies.size.size=10MB +appender.CARBON_TRACE_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.CARBON_TRACE_LOGFILE.strategy.max = 20 + +# Appender config to put correlation Log. +appender.CORRELATION.type = RollingFile +appender.CORRELATION.name = CORRELATION +appender.CORRELATION.fileName =${sys:carbon.home}/repository/logs/correlation.log +appender.CORRELATION.filePattern =${sys:carbon.home}/repository/logs/correlation-%d{MM-dd-yyyy}.%i.log +appender.CORRELATION.layout.type = PatternLayout +appender.CORRELATION.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}|%X{Correlation-ID}|%t|%mm%n +appender.CORRELATION.policies.type = Policies +appender.CORRELATION.policies.time.type = TimeBasedTriggeringPolicy +appender.CORRELATION.policies.time.interval = 1 +appender.CORRELATION.policies.time.modulate = true +appender.CORRELATION.policies.size.type = SizeBasedTriggeringPolicy +appender.CORRELATION.policies.size.size=10MB +appender.CORRELATION.strategy.type = DefaultRolloverStrategy +appender.CORRELATION.strategy.max = 20 +appender.CORRELATION.filter.threshold.type = ThresholdFilter +appender.CORRELATION.filter.threshold.level = INFO + +#Appender config to put diagnostics Log. +appender.DIAGNOSTICS.type = RollingFile +appender.DIAGNOSTICS.name = DIAGNOSTICS +appender.DIAGNOSTICS.fileName =${sys:carbon.home}/repository/logs/diagnostics.log +appender.DIAGNOSTICS.filePattern =${sys:carbon.home}/repository/logs/diagnostics-%d{MM-dd-yyyy}.%i.log +appender.DIAGNOSTICS.layout.type = PatternLayout +appender.DIAGNOSTICS.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS}|%X{Correlation-ID}|Tenant:%X{tenantDomain}|%t|%mm%n +appender.DIAGNOSTICS.policies.type = Policies +appender.DIAGNOSTICS.policies.time.type = TimeBasedTriggeringPolicy +appender.DIAGNOSTICS.policies.time.interval = 1 +appender.DIAGNOSTICS.policies.time.modulate = true +appender.DIAGNOSTICS.policies.size.type = SizeBasedTriggeringPolicy +appender.DIAGNOSTICS.policies.size.size=10MB +appender.DIAGNOSTICS.strategy.type = DefaultRolloverStrategy +appender.DIAGNOSTICS.strategy.max = 20 +appender.DIAGNOSTICS.filter.threshold.type = ThresholdFilter +appender.DIAGNOSTICS.filter.threshold.level = INFO + +# Uncomment the below lines to use the Syslog Appender +#appender.syslog.type = Syslog +#appender.syslog.name = Syslog +#appender.syslog.host = localhost +#appender.syslog.port = 514 +#appender.syslog.protocol = UDP +#appender.syslog.layout.type = PatternLayout +#appender.syslog.layout.pattern = [%d] [%tenantId] %5p {%c} - %mm%ex%n +#appender.syslog.filter.threshold.type = ThresholdFilter +#appender.syslog.filter.threshold.level = DEBUG + +appender.osgi.type = PaxOsgi +appender.osgi.name = PaxOsgi +appender.osgi.filter = * + +loggers = AUDIT_LOG, trace-messages, diagnostics, org-apache-coyote, com-hazelcast, javax-mail, Owasp-CsrfGuard, org-apache-axis2-wsdl-codegen-writer-PrettyPrinter, org-apache-axis2-clustering, org-apache-catalina, org-apache-tomcat, org-apache-axis2-description, org-wso2-carbon-apacheds, org-apache-directory-server-ldap, org-apache-directory-server-core-event, com-atomikos, org-quartz, org-apache-jackrabbit-webdav, org-apache-juddi, org-apache-commons-digester-Digester, org-apache-jasper-compiler-TldLocationsCache, org-apache-qpid, org-apache-qpid-server-Main, qpid-message, qpid-message-broker-listening, org-apache-tiles, org-apache-commons-httpclient, org-apache-solr, me-prettyprint-cassandra-hector-TimingLogger, org-apache-axis-enterprise, org-apache-directory-shared-ldap, org-apache-directory-server-ldap-handlers, org-apache-directory-shared-ldap-entry-DefaultServerAttribute, org-apache-directory-server-core-DefaultDirectoryService, org-apache-directory-shared-ldap-ldif-LdifReader, org-apache-directory-server-ldap-LdapProtocolHandler, org-apache-directory-server-core, org-apache-directory-server-ldap-LdapSession, DataNucleus, Datastore, Datastore-Schema, JPOX-Datastore, JPOX-Plugin, JPOX-MetaData, JPOX-Query, JPOX-General, JPOX-Enhancer, org-apache-hadoop-hive, hive, ExecMapper, ExecReducer, net-sf-ehcache, axis2Deployment, equinox, tomcat2, StAXDialectDetector, org-apache-directory-api, org-apache-directory-api-ldap-model-entry, TRANSACTION_LOGGER, DELETE_EVENT_LOGGER, org-springframework, org-opensaml-xml-security-credential-criteria, org-wso2-carbon-user-core, org-wso2-carbon-identity, org-wso2-carbon-identity-sso-saml, org-wso2-carbon-identity-application, org-wso2-carbon-identity-application-authentication-framework, org-wso2-carbon-identity-oauth2, org-wso2-carbon-identity-oauth, org-wso2-carbon-identity-application-authenticator, org-wso2-carbon-identity-scim, org-wso2-carbon-identity-scim2, org-wso2-charon-core, org-wso2-charon3-core, org-eclipse-jetty, cache-sync + +logger.AUDIT_LOG.name = AUDIT_LOG +logger.AUDIT_LOG.level = INFO +logger.AUDIT_LOG.appenderRef.AUDIT_LOGFILE.ref = AUDIT_LOGFILE +logger.AUDIT_LOG.additivity = false + +logger.trace-messages.name = trace.messages +logger.trace-messages.level = TRACE +logger.trace-messages.appenderRef.CARBON_TRACE_LOGFILE.ref = CARBON_TRACE_LOGFILE + +logger.org-apache-coyote.name = org.apache.coyote +logger.org-apache-coyote.level = WARN + +logger.org-apache-axis2-description.name = org.apache.axis2.description +logger.org-apache-axis2-description.level = ERROR + +logger.com-hazelcast.name = com.hazelcast +logger.com-hazelcast.level = ERROR + +logger.cache-sync.name = org.wso2.carbon.cache.sync.jms.manager +logger.cache-sync.level = DEBUG + +logger.javax-mail.name = javax.mail +logger.javax-mail.level = ERROR + +logger.org-eclipse-jetty.name = org.eclipse.jetty +logger.org-eclipse-jetty.level = ERROR + +logger.Owasp-CsrfGuard.name = Owasp.CsrfGuard +logger.Owasp-CsrfGuard.level = WARN + +logger.org-apache-axis2-wsdl-codegen-writer-PrettyPrinter.name = org.apache.axis2.wsdl.codegen.writer.PrettyPrinter +logger.org-apache-axis2-wsdl-codegen-writer-PrettyPrinter.level = ERROR +logger.org-apache-axis2-wsdl-codegen-writer-PrettyPrinter.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-axis2-clustering.name = org.apache.axis2.clustering +logger.org-apache-axis2-clustering.level = INFO +logger.org-apache-axis2-clustering.additivity = false + +logger.org-apache.name = org.apache +logger.org-apache.level = INFO +logger.org-apache.additivity = false +logger.org-apache.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-catalina.name = org.apache.catalina +logger.org-apache-catalina.level = ERROR + +logger.org-apache-tomcat.name = org.apache.tomcat +logger.org-apache-tomcat.level = INFO + +logger.org-wso2-carbon-apacheds.name = org.wso2.carbon.apacheds +logger.org-wso2-carbon-apacheds.level = WARN + +logger.org-apache-directory-server-ldap.name = org.apache.directory.server.ldap +logger.org-apache-directory-server-ldap.level = ERROR + +logger.org-apache-directory-server-core-event.name = org.apache.directory.server.core.event +logger.org-apache-directory-server-core-event.level = WARN + +logger.com-atomikos.name = com.atomikos +logger.com-atomikos.level = INFO +logger.com-atomikos.additivity = false +logger.com-atomikos.appenderRef.ATOMIKOS_LOGFILE.ref = ATOMIKOS_LOGFILE + +logger.org-quartz.name = org.quartz +logger.org-quartz.level = WARN + +logger.org-apache-jackrabbit-webdav.name = org.apache.jackrabbit.webdav +logger.org-apache-jackrabbit-webdav.level = WARN + +logger.org-apache-juddi.name = org.apache.juddi +logger.org-apache-juddi.level = ERROR + +logger.org-apache-commons-digester-Digester.name = org.apache.commons.digester.Digester +logger.org-apache-commons-digester-Digester.level = WARN + +logger.org-apache-jasper-compiler-TldLocationsCache.name = org.apache.jasper.compiler.TldLocationsCache +logger.org-apache-jasper-compiler-TldLocationsCache.level = WARN + +logger.org-apache-qpid.name = org.apache.qpid +logger.org-apache-qpid.level = WARN + +logger.org-apache-qpid-server-Main.name = org.apache.qpid.server.Main +logger.org-apache-qpid-server-Main.level = INFO + +logger.qpid-message.name = qpid.message +logger.qpid-message.level = WARN + +logger.qpid-message-broker-listening.name = qpid.message.broker.listening +logger.qpid-message-broker-listening.level = INFO + +logger.org-apache-tiles.name = org.apache.tiles +logger.org-apache-tiles.level = WARN + +logger.org-apache-commons-httpclient.name = org.apache.commons.httpclient +logger.org-apache-commons-httpclient.level = ERROR + +logger.org-apache-solr.name = org.apache.solr +logger.org-apache-solr.level = ERROR + +logger.me-prettyprint-cassandra-hector-TimingLogger.name = me.prettyprint.cassandra.hector.TimingLogger +logger.me-prettyprint-cassandra-hector-TimingLogger.level = ERROR + +logger.org-wso2.name = org.wso2 +logger.org-wso2.level = ERROR + +logger.org-apache-axis-enterprise.name = org.apache.axis2.enterprise +logger.org-apache-axis-enterprise.level = FATAL +logger.org-apache-axis-enterprise.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-shared-ldap.name = org.apache.directory.shared.ldap +logger.org-apache-directory-shared-ldap.level = WARN +logger.org-apache-directory-shared-ldap.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-server-ldap-handlers.name = org.apache.directory.server.ldap.handlers +logger.org-apache-directory-server-ldap-handlers.level = WARN +logger.org-apache-directory-server-ldap-handlers.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +#Following are to remove false error messages from startup (IS) +logger.org-apache-directory-shared-ldap-entry-DefaultServerAttribute.name = org.apache.directory.shared.ldap.entry.DefaultServerAttribute +logger.org-apache-directory-shared-ldap-entry-DefaultServerAttribute.level = FATAL +logger.org-apache-directory-shared-ldap-entry-DefaultServerAttribute.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-server-core-DefaultDirectoryService.name = org.apache.directory.server.core.DefaultDirectoryService +logger.org-apache-directory-server-core-DefaultDirectoryService.level = ERROR +logger.org-apache-directory-server-core-DefaultDirectoryService.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-shared-ldap-ldif-LdifReader.name = org.apache.directory.shared.ldap.ldif.LdifReader +logger.org-apache-directory-shared-ldap-ldif-LdifReader.level = ERROR +logger.org-apache-directory-shared-ldap-ldif-LdifReader.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-server-ldap-LdapProtocolHandler.name = org.apache.directory.server.ldap.LdapProtocolHandler +logger.org-apache-directory-server-ldap-LdapProtocolHandler.level = ERROR +logger.org-apache-directory-server-ldap-LdapProtocolHandler.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-server-core.name = org.apache.directory.server.core +logger.org-apache-directory-server-core.level = ERROR +logger.org-apache-directory-server-core.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.org-apache-directory-server-ldap-LdapSession.name = org.apache.directory.server.ldap.LdapSession +logger.org-apache-directory-server-ldap-LdapSession.level = Error +logger.org-apache-directory-server-ldap-LdapSession.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE + +logger.correlation.name = correlation +logger.correlation.level = INFO +logger.correlation.appenderRef.CORRELATION.ref = CORRELATION +logger.correlation.additivity = false + +logger.diagnostics.name = diagnostics +logger.diagnostics.level = INFO +logger.diagnostics.appenderRef.DIAGNOSTICS.ref = DIAGNOSTICS +logger.diagnostics.additivity = false + +#Hive Related Log configurations +logger.DataNucleus.name = DataNucleus +logger.DataNucleus.level = ERROR + +logger.Datastore.name = Datastore +logger.Datastore.level = ERROR + +logger.Datastore-Schema.name = Datastore.Schema +logger.Datastore-Schema.level = ERROR + +logger.JPOX-Datastore.name = JPOX.Datastore +logger.JPOX-Datastore.level = ERROR + +logger.JPOX-Plugin.name = JPOX.Plugin +logger.JPOX-Plugin.level = ERROR + +logger.JPOX-MetaData.name = JPOX.MetaData +logger.JPOX-MetaData.level = ERROR + +logger.JPOX-Query.name = JPOX.Query +logger.JPOX-Query.level = ERROR + +logger.JPOX-General.name = JPOX.General +logger.JPOX-General.level = ERROR + +logger.JPOX-Enhancer.name = JPOX.Enhancer +logger.JPOX-Enhancer.level = ERROR + +logger.org-apache-hadoop-hive.name = org.apache.hadoop.hive +logger.org-apache-hadoop-hive.level = WARN + +logger.hive.name = hive +logger.hive.level = WARN + +logger.ExecMapper.name = ExecMapper +logger.ExecMapper.level = WARN + +logger.ExecReducer.name = ExecReducer +logger.ExecReducer.level = WARN + +logger.net-sf-ehcache.name = net.sf.ehcache +logger.net-sf-ehcache.level = ERROR + +logger.axis2Deployment.name = org.apache.axis2.deployment +logger.axis2Deployment.level = WARN + +logger.equinox.name = org.eclipse.equinox +logger.equinox.level = FATAL + +logger.tomcat2.name = tomcat +logger.tomcat2.level = FATAL + +logger.StAXDialectDetector.name = org.apache.axiom.util.stax.dialect.StAXDialectDetector +logger.StAXDialectDetector.level = ERROR + + +# root loggers +#uncomment the last line to add syslog appender to the root loggers +rootLogger.level = INFO +rootLogger.appenderRef.CARBON_CONSOLE.ref = CARBON_CONSOLE +rootLogger.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE +rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi +#rootLogger.appenderRef.syslog.ref = Syslog + + +logger.org-apache-directory-api.name=org.apache.directory.api +logger.org-apache-directory-api.level=ERROR + +logger.org-apache-directory-api-ldap-model-entry.name=org.apache.directory.api.ldap.model.entry +logger.org-apache-directory-api-ldap-model-entry.level=FATAL + +logger.org-springframework.name=org.springframework +logger.org-springframework.level=WARN + +logger.org-opensaml-xml-security-credential-criteria.name=org.opensaml.xml.security.credential.criteria +logger.org-opensaml-xml-security-credential-criteria.level=WARN + +logger.org-wso2-carbon-user-core.name=org.wso2.carbon.user.core +logger.org-wso2-carbon-user-core.level=INFO + +logger.org-wso2-carbon-identity.name=org.wso2.carbon.identity +logger.org-wso2-carbon-identity.level=INFO + +logger.org-wso2-carbon-identity-sso-saml.name=org.wso2.carbon.identity.sso.saml +logger.org-wso2-carbon-identity-sso-saml.level=INFO + +logger.org-wso2-carbon-identity-application.name=org.wso2.carbon.identity.application +logger.org-wso2-carbon-identity-application.level=INFO + +logger.org-wso2-carbon-identity-application-authentication-framework.name=org.wso2.carbon.identity.application.authentication.framework +logger.org-wso2-carbon-identity-application-authentication-framework.level=INFO + +#logger.org-wso2-carbon-identity-mgt.name=org.wso2.carbon.identity.mgt +#logger.org-wso2-carbon-identity-mgt.level=DEBUG + +logger.org-wso2-carbon-identity-oauth2.name=org.wso2.carbon.identity.oauth2 +logger.org-wso2-carbon-identity-oauth2.level=INFO + +logger.org-wso2-carbon-identity-oauth.name=org.wso2.carbon.identity.oauth +logger.org-wso2-carbon-identity-oauth.level=INFO + +logger.org-wso2-carbon-identity-oidc.name=org.wso2.carbon.identity.oidc +logger.org-wso2-carbon-identity-oidc.level=INFO + +logger.org-wso2-carbon-identity-application-authenticator.name=org.wso2.carbon.identity.application.authenticator +logger.org-wso2-carbon-identity-application-authenticator.level=INFO + +logger.org-wso2-carbon-identity-scim.name=org.wso2.carbon.identity.scim +logger.org-wso2-carbon-identity-scim.level=INFO + +logger.org-wso2-carbon-identity-scim2.name=org.wso2.carbon.identity.scim2 +logger.org-wso2-carbon-identity-scim2.level=INFO + +logger.org-wso2-charon-core.name=org.wso2.charon.core +logger.org-wso2-charon-core.level=INFO + +logger.org-wso2-charon3-core.name=org.wso2.charon3.core +logger.org-wso2-charon3-core.level=INFO + +#logger.org-wso2-carbon-identity-mgt.name=org.wso2.carbon.identity.mgt +#logger.org-wso2-carbon-identity-mgt.level=DEBUG + +#logger.org-wso2-carbon-idp-mgt.name=org.wso2.carbon.idp.mgt +#logger.org-wso2-carbon-idp-mgt.level=DEBUG + +#logger.org-wso2-carbon-identity-provisioning.name=org.wso2.carbon.identity.provisioning +#logger.org-wso2-carbon-identity-provisioning.level=DEBUG + +#logger.org-wso2-carbon-identity-user-account-association.name=org.wso2.carbon.identity.user.account.association +#logger.org-wso2-carbon-identity-user-account-association.level=DEBUG + +#logger.org-wso2-carbon-identity-user-profile-mgt.name=org.wso2.carbon.identity.user.profile.mgt +#logger.org-wso2-carbon-identity-user-profile-mgt.level=DEBUG + +#logger.org-wso2-carbon-security.name=org.wso2.carbon.security +#logger.org-wso2-carbon-security.level=DEBUG + +#logger.org-wso2-carbon-identity-sso-agent.name=org.wso2.carbon.identity.sso.agent +#logger.org-wso2-carbon-identity-sso-agent.level=DEBUG + +#logger.org-wso2-carbon-identity-core.name=org.wso2.carbon.identity.core +#logger.org-wso2-carbon-identity-core.level=DEBUG + +# Appender config to CARBON_TRACE_LOGFILE +appender.DELETE_EVENT_LOGFILE.type = RollingFile +appender.DELETE_EVENT_LOGFILE.name = DELETE_EVENT_LOGFILE +appender.DELETE_EVENT_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/delete-event.log +appender.DELETE_EVENT_LOGFILE.filePattern =${sys:carbon.home}/repository/logs/delete-event-%d{MM-dd-yyyy}.%i.log +appender.DELETE_EVENT_LOGFILE.layout.type = PatternLayout +appender.DELETE_EVENT_LOGFILE.layout.pattern = %mm %n +appender.DELETE_EVENT_LOGFILE.policies.type = Policies +appender.DELETE_EVENT_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.DELETE_EVENT_LOGFILE.policies.time.interval = 1 +appender.DELETE_EVENT_LOGFILE.policies.time.modulate = true +appender.DELETE_EVENT_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.DELETE_EVENT_LOGFILE.policies.size.size=10MB +appender.DELETE_EVENT_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.DELETE_EVENT_LOGFILE.strategy.max = 20 +appender.DELETE_EVENT_LOGFILE.threshold.type = ThresholdFilter +appender.DELETE_EVENT_LOGFILE.threshold.level = INFO + +appender.TRANSACTION_LOGFILE.type = RollingFile +appender.TRANSACTION_LOGFILE.name = TRANSACTION_LOGFILE +appender.TRANSACTION_LOGFILE.fileName = ${sys:carbon.home}/repository/logs/transaction.log +appender.TRANSACTION_LOGFILE.filePattern = ${sys:carbon.home}/repository/logs/transaction-%d{MM-dd-yyyy}.%i.log +appender.TRANSACTION_LOGFILE.layout.type = PatternLayout +appender.TRANSACTION_LOGFILE.layout.pattern = [%d] - %mm %n +appender.TRANSACTION_LOGFILE.policies.type = Policies +appender.TRANSACTION_LOGFILE.policies.time.type = TimeBasedTriggeringPolicy +appender.TRANSACTION_LOGFILE.policies.time.interval = 1 +appender.TRANSACTION_LOGFILE.policies.time.modulate = true +appender.TRANSACTION_LOGFILE.policies.size.type = SizeBasedTriggeringPolicy +appender.TRANSACTION_LOGFILE.policies.size.size=10MB +appender.TRANSACTION_LOGFILE.strategy.type = DefaultRolloverStrategy +appender.TRANSACTION_LOGFILE.strategy.max = 20 +appender.TRANSACTION_LOGFILE.threshold.type = ThresholdFilter +appender.TRANSACTION_LOGFILE.threshold.level = INFO + +logger.TRANSACTION_LOGGER.name=TRANSACTION_LOGGER +logger.TRANSACTION_LOGGER.level=INFO +logger.TRANSACTION_LOGGER.appenderRef.TRANSACTION_LOGFILE.ref = TRANSACTION_LOGFILE + +logger.DELETE_EVENT_LOGGER.name=DELETE_EVENT_LOGGER +logger.DELETE_EVENT_LOGGER.level=INFO +logger.DELETE_EVENT_LOGGER.appenderRef.TRANSACTION_LOGFILE.ref = TRANSACTION_LOGFILE + From dab09caff161e795f73e2d8ceea9515ee4705e63 Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Mon, 3 Jun 2024 19:54:46 +0530 Subject: [PATCH 4/6] Improve message send test case. --- .../test/cache/JMSCacheSyncTestCase.java | 62 ++++++++++++++----- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java index 2d7645fe529..3044f25cc14 100755 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java @@ -18,19 +18,23 @@ package org.wso2.identity.integration.test.cache; +import io.restassured.response.Response; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.broker.BrokerPlugin; import org.apache.activemq.broker.BrokerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import org.wso2.carbon.automation.engine.context.TestUserMode; import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException; import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.identity.integration.common.utils.ISIntegrationTest; +import org.wso2.identity.integration.test.rest.api.user.selfRegister.SelfRegisterTestBase; import org.wso2.identity.integration.test.util.Utils; import java.io.File; @@ -51,7 +55,7 @@ import javax.jms.TextMessage; import javax.jms.Topic; -public class JMSCacheSyncTestCase extends ISIntegrationTest { +public class JMSCacheSyncTestCase extends SelfRegisterTestBase { private static final Log log = LogFactory.getLog(JMSCacheSyncTestCase.class); private static final String BROKER_URL = "tcp://localhost:61616"; @@ -60,7 +64,8 @@ public class JMSCacheSyncTestCase extends ISIntegrationTest { "Cache Sync JMS Manager Service bundle activated successfully."; private static final String RECEIVED_MESSAGE = "Received cache invalidation message from other cluster nodes"; private static final String SENT_MESSAGE = "Sending cache invalidation message to other cluster nodes"; - public static final String CACHE_SYNC_JMS_MANAGER_JAR = "org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar"; + public static final String CACHE_SYNC_JMS_MANAGER_JAR = + "org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar"; public static final String JMS_API_JAR = "jms-api_2-2.0.1.wso2v1.jar"; private static Connection connection; @@ -83,24 +88,33 @@ public void initCacheSyncConfig() throws Exception { + File.separator + "logs" + File.separator + "wso2carbon.log"); removeExistingCarbonLog(); - super.init(); + super.init(TestUserMode.SUPER_TENANT_ADMIN); applyDropinJar(CACHE_SYNC_JMS_MANAGER_JAR); applyDropinJar(JMS_API_JAR); applyAllActiveMQJars(); scm = new ServerConfigurationManager(isServer); - applyCacheSyncDeploymentConfigurations(carbonHome); applyCacheSyncDebugLogConfigurations(carbonHome); + + super.init(TestUserMode.SUPER_TENANT_ADMIN); + initUpdateIDPProperty(); + this.context = isServer; + this.authenticatingUserName = context.getContextTenant().getTenantAdmin().getUserName(); + this.authenticatingCredential = context.getContextTenant().getTenantAdmin().getPassword(); + this.tenant = context.getContextTenant().getDomain(); + + super.testInit(API_VERSION_SELF_REGISTER, swaggerDefinitionSelfRegister, tenant, + API_SELF_REGISTER_BASE_PATH_IN_SWAGGER, API_SELF_REGISTER_BASE_PATH); } @AfterClass(alwaysRun = true) public void testClear() throws Exception { stopBroker(); -// removeDropinsJar(CACHE_SYNC_JMS_MANAGER_JAR); -// removeDropinsJar(JMS_API_JAR); -// removeAllActiveMQJars(); + removeDropinsJar(CACHE_SYNC_JMS_MANAGER_JAR); + removeDropinsJar(JMS_API_JAR); + removeAllActiveMQJars(); resetISConfiguration(); } @@ -126,8 +140,7 @@ public void isMessageReceived() throws InterruptedException { Thread.sleep(50000); sendMessage(); - System.out.println("Message send successfully"); - Thread.sleep(50000); + Thread.sleep(30000); Assert.assertTrue( checkLogForMessage(RECEIVED_MESSAGE), @@ -135,13 +148,31 @@ public void isMessageReceived() throws InterruptedException { } @Test - public void isMessageSent() { + public void isMessageSent() throws Exception { + doSelfRegister(); + Thread.sleep(30000); Assert.assertTrue( checkLogForMessage(SENT_MESSAGE), "Error while sending message to jms broker."); } + private void doSelfRegister() throws Exception { + + updateResidentIDPProperty(ENABLE_SELF_SIGN_UP, "true", true); + String selfRegisterPath = getISResourceLocation() + File.separator + "cache" + File.separator + + "self-register-tenanted-user-request-body.json"; + String selfRegisterUserInfo = readFileAsString(selfRegisterPath); + Response responseOfPost = getResponseOfPost(SELF_REGISTRATION_ENDPOINT, selfRegisterUserInfo); + Assert.assertEquals(responseOfPost.statusCode(), HttpStatus.SC_CREATED, + "Self register user unsuccessful" + responseOfPost.asString()); + } + + public String readFileAsString(String filePath) throws IOException { + + return new String(Files.readAllBytes(Paths.get(filePath))); + } + private enum ActiveMQJars { GERONIMO_J2EE_MANAGEMENT("geronimo-j2ee-management_1.1_spec-1.0.1.jar"), @@ -154,10 +185,12 @@ private enum ActiveMQJars { private final String jarName; ActiveMQJars(String jarName) { + this.jarName = jarName; } public String getJarName() { + return jarName; } } @@ -228,6 +261,7 @@ private void removeAllActiveMQJars() { } private String transformJarName(String originalName) { + return originalName.replace("-", "_").replaceAll("(\\.\\w+)$", "_1.0.0$1"); } @@ -251,7 +285,7 @@ private void removeLibJar(String jarName) { File jarDestFile = getLibFilePath(jarName); if (jarDestFile.exists()) { - jarDestFile.delete();; + jarDestFile.delete(); } } @@ -259,7 +293,7 @@ private void removeDropinsJar(String jarName) { File jarDestFile = getDropinsFilePath(jarName); if (jarDestFile.exists()) { - jarDestFile.delete();; + jarDestFile.delete(); } } @@ -317,9 +351,9 @@ private void stopBroker() { try { broker.stop(); - System.out.println("ActiveMQ broker stopped successfully."); + log.info("ActiveMQ broker stopped successfully."); } catch (Exception e) { - log.error("Error while stopping the ActiveMQ broker.");; + log.error("Error while stopping the ActiveMQ broker."); } } From d4857c79e14b5a0185965a9eba8277ab5290ef44 Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Mon, 3 Jun 2024 19:55:46 +0530 Subject: [PATCH 5/6] Remove transitive dependencies. --- .../tests-integration/tests-backend/pom.xml | 133 +++++++++++++++++- ...f-register-tenanted-user-request-body.json | 31 ++++ 2 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/self-register-tenanted-user-request-body.json diff --git a/modules/integration/tests-integration/tests-backend/pom.xml b/modules/integration/tests-integration/tests-backend/pom.xml index 50ee5c4469a..65d9dc1ac79 100644 --- a/modules/integration/tests-integration/tests-backend/pom.xml +++ b/modules/integration/tests-integration/tests-backend/pom.xml @@ -46,7 +46,7 @@ false 2.22.1 - + -Xmx1024m -Dorg.apache.jasper.compiler.disablejsr199=true --add-opens=java.base/java.lang=ALL-UNNAMED @@ -203,6 +203,13 @@ + + 11 + 5.16.3 + 1.7.32 + 1.2.6 + + @@ -718,6 +725,53 @@ + + + + org.apache.activemq + activemq-all + 5.16.3 + compile + + + javax.jms + javax.jms-api + 2.0.1 + + + org.apache.activemq + activemq-core + 5.7.0 + compile + + + org.apache.activemq + activemq-core + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + + org.slf4j + log4j-over-slf4j + ${slf4j.version} + + + + @@ -746,6 +800,11 @@ org.apache.httpcomponents httpclient + + javax.jms + javax.jms-api + 2.0.1 + io.rest-assured rest-assured @@ -1059,13 +1118,83 @@ org.apache.activemq activemq-all 5.16.3 + + + log4j + log4j + + + org.slf4j + slf4j-log4j12 + + + + + org.apache.activemq + activemq-core + 5.7.0 org.apache.activemq - activemq-all + activemq-core + + org.slf4j + slf4j-api + ${slf4j.version} + + + + + ch.qos.logback + logback-classic + ${logback.version} + + + + + + + + + + + + junit + junit + 4.13.2 + test + + + org.apache.logging.log4j + log4j-core + 2.17.1 + + + org.apache.logging.log4j + log4j-api + 2.17.1 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.1 + + + + + + + + + + javax + javaee-api + 8.0 + provided + org.apache.geronimo.specs geronimo-j2ee-management_1.1_spec diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/self-register-tenanted-user-request-body.json b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/self-register-tenanted-user-request-body.json new file mode 100644 index 00000000000..2cac933ec58 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/self-register-tenanted-user-request-body.json @@ -0,0 +1,31 @@ +{ + "user": { + "username": "selfRegisterTenantedTestUser@wso2.com", + "realm": "PRIMARY", + "password": "Password12!", + "claims": [ + { + "uri": "http://wso2.org/claims/givenname", + "value": "selfRegisterTenantedTestUser" + }, + { + "uri": "http://wso2.org/claims/emailaddress", + "value": "selfRegisterTenantedTestUser@gmail.com" + }, + { + "uri": "http://wso2.org/claims/lastname", + "value": "selfRegisterTenantedTestUser" + }, + { + "uri": "http://wso2.org/claims/mobile", + "value": "+947721584558" + } + ] + }, + "properties": [ + { + "key": "callback", + "value": "https://localhost:9853/myaccount/login" + } + ] +} From 9e82f1554583ce0b3c9517a09c30a77631e605fd Mon Sep 17 00:00:00 2001 From: Inthirakumaaran Date: Mon, 3 Jun 2024 21:35:50 +0530 Subject: [PATCH 6/6] Improve dependencies definition. --- .../tests-integration/tests-backend/pom.xml | 140 +++++------------- .../test/cache/JMSCacheSyncTestCase.java | 2 +- .../IS/cache/cache_sync_log4j2.properties | 18 --- 3 files changed, 40 insertions(+), 120 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/pom.xml b/modules/integration/tests-integration/tests-backend/pom.xml index 65d9dc1ac79..39c0eca8799 100644 --- a/modules/integration/tests-integration/tests-backend/pom.xml +++ b/modules/integration/tests-integration/tests-backend/pom.xml @@ -46,7 +46,7 @@ false 2.22.1 - + -Xmx1024m -Dorg.apache.jasper.compiler.disablejsr199=true --add-opens=java.base/java.lang=ALL-UNNAMED @@ -203,13 +203,6 @@ - - 11 - 5.16.3 - 1.7.32 - 1.2.6 - - @@ -417,18 +410,18 @@ org.wso2.carbon.cache.sync.manager org.wso2.carbon.cache.sync.jms.manager - 2.0.14-SNAPSHOT + ${cache.sync.jms.manager.version} jar false ${basedir}/target/test-classes/samples/cache - org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar + org.wso2.carbon.cache.sync.jms.manager-2.0.14.jar org.apache.geronimo.specs geronimo-j2ee-management_1.1_spec - 1.0.1 + ${geronimo-j2ee-management_1.1_spec.version} jar false @@ -439,7 +432,7 @@ org.apache.activemq activemq-broker - 5.16.3 + ${activemq.version} jar false @@ -450,7 +443,7 @@ org.apache.activemq activemq-client - 5.16.3 + ${activemq.version} jar false @@ -461,7 +454,7 @@ org.apache.geronimo.specs geronimo-jms_1.1_spec - 1.1.1 + ${geronimo-jms_1.1_spec.version} jar false @@ -472,7 +465,7 @@ org.fusesource.hawtbuf hawtbuf - 1.11 + ${hawtbuf.version} jar false @@ -483,7 +476,7 @@ org.slf4j slf4j-api - 1.7.31 + ${slf4j-api-server.version} jar false @@ -494,7 +487,7 @@ org.wso2.orbit.javax.jms jms-api - 2.0.1.wso2v1 + ${jms-api.version} jar false @@ -730,18 +723,13 @@ org.apache.activemq activemq-all - 5.16.3 + ${activemq.version} compile - - javax.jms - javax.jms-api - 2.0.1 - org.apache.activemq activemq-core - 5.7.0 + ${old-activemq-core.version} compile @@ -755,15 +743,6 @@ slf4j-api ${slf4j.version} - - - - ch.qos.logback - logback-classic - ${logback.version} - - - org.slf4j log4j-over-slf4j @@ -800,11 +779,6 @@ org.apache.httpcomponents httpclient - - javax.jms - javax.jms-api - 2.0.1 - io.rest-assured rest-assured @@ -1102,22 +1076,22 @@ org.wso2.carbon.cache.sync.manager org.wso2.carbon.cache.sync.jms.manager - 2.0.14-SNAPSHOT + ${cache.sync.jms.manager.version} org.apache.activemq activemq-broker - 5.16.3 + ${activemq.version} org.apache.activemq activemq-client - 5.16.3 + ${activemq.version} org.apache.activemq activemq-all - 5.16.3 + ${activemq.version} log4j @@ -1129,102 +1103,51 @@ - - org.apache.activemq - activemq-core - 5.7.0 - - - org.apache.activemq - activemq-core - - - org.slf4j slf4j-api ${slf4j.version} - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - - - - - - - - - junit - junit - 4.13.2 - test - org.apache.logging.log4j log4j-core - 2.17.1 + ${logging.log4j.version} org.apache.logging.log4j log4j-api - 2.17.1 + ${logging.log4j.version} org.apache.logging.log4j log4j-slf4j-impl - 2.17.1 - - - - - - - - - - javax - javaee-api - 8.0 - provided + ${logging.log4j.version} org.apache.geronimo.specs geronimo-j2ee-management_1.1_spec - 1.0.1 + ${geronimo-j2ee-management_1.1_spec.version} org.apache.geronimo.specs geronimo-jms_1.1_spec - 1.1.1 + ${geronimo-jms_1.1_spec.version} org.fusesource.hawtbuf hawtbuf - 1.11 + ${hawtbuf.version} org.slf4j slf4j-api - 1.7.31 + ${slf4j-api-server.version} org.wso2.orbit.javax.jms jms-api - 2.0.1.wso2v1 + ${jms-api.version} - - - - - org.wso2.samples.is org.wso2.carbon.identity.sample.extension.authenticators @@ -1352,4 +1275,19 @@ test + + + 11 + 5.16.3 + 1.7.32 + 1.2.6 + 1.1.1 + 1.0.1 + 1.11 + 1.7.31 + 2.0.1.wso2v1 + 2.0.14 + 2.17.1 + 5.7.0 + diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java index 3044f25cc14..fff955e8777 100755 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/cache/JMSCacheSyncTestCase.java @@ -65,7 +65,7 @@ public class JMSCacheSyncTestCase extends SelfRegisterTestBase { private static final String RECEIVED_MESSAGE = "Received cache invalidation message from other cluster nodes"; private static final String SENT_MESSAGE = "Sending cache invalidation message to other cluster nodes"; public static final String CACHE_SYNC_JMS_MANAGER_JAR = - "org.wso2.carbon.cache.sync.jms.manager-2.0.14-SNAPSHOT.jar"; + "org.wso2.carbon.cache.sync.jms.manager-2.0.14.jar"; public static final String JMS_API_JAR = "jms-api_2-2.0.1.wso2v1.jar"; private static Connection connection; diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties index 378c89d5150..fd5cde12ce1 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/IS/cache/cache_sync_log4j2.properties @@ -1,21 +1,3 @@ -# -# Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -# -# WSO2 Inc. licenses this file to you 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. -# - # list of all appenders #add entry "syslog" to use the syslog appender appenders = CARBON_CONSOLE, CARBON_LOGFILE, AUDIT_LOGFILE, ATOMIKOS_LOGFILE, CARBON_TRACE_LOGFILE, DELETE_EVENT_LOGFILE, TRANSACTION_LOGFILE, osgi, DIAGNOSTICS