This is an automated email from the ASF dual-hosted git repository.

robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new cb96a89  ARTEMIS-3616 Fix netty epoll not available
     new 0e2fbad  This closes #3387
cb96a89 is described below

commit cb96a895248df8863a84b66377cf68e343a0ddce
Author: Domenico Francesco Bruscino <[email protected]>
AuthorDate: Thu Jan 13 14:17:28 2022 +0100

    ARTEMIS-3616 Fix netty epoll not available
---
 artemis-distribution/src/main/assembly/dep.xml     |   1 +
 pom.xml                                            |   6 +
 tests/smoke-tests/pom.xml                          |  16 ++
 .../main/resources/servers/nettynative/broker.xml  | 240 +++++++++++++++++++++
 .../servers/nettynative/logging.properties         |  91 ++++++++
 .../artemis/tests/smoke/common/SmokeTestBase.java  |  32 +++
 .../tests/smoke/logging/AuditLoggerTestBase.java   |  31 +--
 .../tests/smoke/nettynative/NettyNativeTest.java   |  78 +++++++
 8 files changed, 465 insertions(+), 30 deletions(-)

diff --git a/artemis-distribution/src/main/assembly/dep.xml 
b/artemis-distribution/src/main/assembly/dep.xml
index 342a0cf..a9de2c8 100644
--- a/artemis-distribution/src/main/assembly/dep.xml
+++ b/artemis-distribution/src/main/assembly/dep.xml
@@ -86,6 +86,7 @@
             <include>io.netty:netty-codec-socks</include>
             <include>io.netty:netty-common</include>
             <include>io.netty:netty-resolver</include>
+            <include>io.netty:netty-transport-native-unix-common</include>
             <include>io.netty:netty-transport-classes-epoll</include>
             <include>io.netty:netty-transport-native-epoll</include>
             <include>io.netty:netty-transport-classes-kqueue</include>
diff --git a/pom.xml b/pom.xml
index f35b6b7..b9d22c6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -627,6 +627,12 @@
          </dependency>
          <dependency>
             <groupId>io.netty</groupId>
+            <artifactId>netty-transport-native-unix-common</artifactId>
+            <version>${netty.version}</version>
+            <!-- License: Apache 2.0 -->
+         </dependency>
+         <dependency>
+            <groupId>io.netty</groupId>
             <artifactId>netty-transport-classes-epoll</artifactId>
             <version>${netty.version}</version>
             <!-- License: Apache 2.0 -->
diff --git a/tests/smoke-tests/pom.xml b/tests/smoke-tests/pom.xml
index 62d1700..5622308 100644
--- a/tests/smoke-tests/pom.xml
+++ b/tests/smoke-tests/pom.xml
@@ -1294,6 +1294,22 @@
                      </args>
                   </configuration>
                </execution>
+               <execution>
+                  <phase>test-compile</phase>
+                  <id>create-create-nettynative</id>
+                  <goals>
+                     <goal>create</goal>
+                  </goals>
+                  <configuration>
+                     <role>amq</role>
+                     <user>admin</user>
+                     <password>admin</password>
+                     <allowAnonymous>false</allowAnonymous>
+                     <noWeb>true</noWeb>
+                     <instance>${basedir}/target/nettynative</instance>
+                     
<configuration>${basedir}/target/classes/servers/nettynative</configuration>
+                  </configuration>
+               </execution>
             </executions>
             <dependencies>
                <dependency>
diff --git 
a/tests/smoke-tests/src/main/resources/servers/nettynative/broker.xml 
b/tests/smoke-tests/src/main/resources/servers/nettynative/broker.xml
new file mode 100644
index 0000000..f0489ac
--- /dev/null
+++ b/tests/smoke-tests/src/main/resources/servers/nettynative/broker.xml
@@ -0,0 +1,240 @@
+<?xml version='1.0'?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF 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.
+-->
+
+<configuration xmlns="urn:activemq"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+               xmlns:xi="http://www.w3.org/2001/XInclude";
+               xsi:schemaLocation="urn:activemq 
/schema/artemis-configuration.xsd">
+
+   <core xmlns="urn:activemq:core" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="urn:activemq:core ">
+
+      <name>0.0.0.0</name>
+
+
+      <persistence-enabled>true</persistence-enabled>
+
+      <!-- this could be ASYNCIO, MAPPED, NIO
+           ASYNCIO: Linux Libaio
+           MAPPED: mmap files
+           NIO: Plain Java Files
+       -->
+      <journal-type>ASYNCIO</journal-type>
+
+      <paging-directory>./data/paging</paging-directory>
+
+      <bindings-directory>./data/bindings</bindings-directory>
+
+      <journal-directory>./data/journal</journal-directory>
+
+      
<large-messages-directory>./data/large-messages</large-messages-directory>
+
+      
+      <!-- if you want to retain your journal uncomment this following 
configuration.
+
+      This will allow your system to keep 7 days of your data, up to 10G. 
Tweak it accordingly to your use case and capacity.
+
+      it is recommended to use a separate storage unit from the journal for 
performance considerations.
+
+      <journal-retention-directory period="7" unit="DAYS" 
storage-limit="10G">data/retention</journal-retention-directory>
+
+      You can also enable retention by using the argument journal-retention on 
the `artemis create` command -->
+
+
+
+      <journal-datasync>true</journal-datasync>
+
+      <journal-min-files>2</journal-min-files>
+
+      <journal-pool-files>10</journal-pool-files>
+
+      <journal-device-block-size>4096</journal-device-block-size>
+
+      <journal-file-size>10M</journal-file-size>
+            <!--
+        You can verify the network health of a particular NIC by specifying 
the <network-check-NIC> element.
+         <network-check-NIC>theNicName</network-check-NIC>
+        -->
+
+      <!--
+        Use this to use an HTTP server to validate the network
+         
<network-check-URL-list>http://www.apache.org</network-check-URL-list> -->
+
+      <!-- <network-check-period>10000</network-check-period> -->
+      <!-- <network-check-timeout>1000</network-check-timeout> -->
+
+      <!-- this is a comma separated list, no spaces, just DNS or IPs
+           it should accept IPV6
+
+           Warning: Make sure you understand your network topology as this is 
meant to validate if your network is valid.
+                    Using IPs that could eventually disappear or be partially 
visible may defeat the purpose.
+                    You can use a list of multiple IPs, and if any successful 
ping will make the server OK to continue running -->
+      <!-- <network-check-list>10.0.0.1</network-check-list> -->
+
+      <!-- use this to customize the ping used for ipv4 addresses -->
+      <!-- <network-check-ping-command>ping -c 1 -t %d 
%s</network-check-ping-command> -->
+
+      <!-- use this to customize the ping used for ipv6 addresses -->
+      <!-- <network-check-ping6-command>ping6 -c 1 
%2$s</network-check-ping6-command> -->
+
+
+
+
+      <!-- how often we are looking for how many bytes are being used on the 
disk in ms -->
+      <disk-scan-period>5000</disk-scan-period>
+
+      <!-- once the disk hits this limit the system will block, or close the 
connection in certain protocols
+           that won't support flow control. -->
+      <max-disk-usage>90</max-disk-usage>
+
+      <!-- should the broker detect dead locks and other issues -->
+      <critical-analyzer>true</critical-analyzer>
+
+      <critical-analyzer-timeout>120000</critical-analyzer-timeout>
+
+      <critical-analyzer-check-period>60000</critical-analyzer-check-period>
+
+      <critical-analyzer-policy>HALT</critical-analyzer-policy>
+
+      
+
+            <!-- the system will enter into page mode once you hit this limit.
+           This is an estimate in bytes of how much the messages are using in 
memory
+
+            The system will use half of the available memory (-Xmx) by default 
for the global-max-size.
+            You may specify a different value here if you need to customize it 
to your needs.
+
+            <global-max-size>100Mb</global-max-size>
+
+      -->
+
+      <acceptors>
+
+         <!-- useEpoll means: it will use Netty epoll if you are on a system 
(Linux) that supports it -->
+         <!-- amqpCredits: The number of credits sent to AMQP producers -->
+         <!-- amqpLowCredits: The server will send the # credits specified at 
amqpCredits at this low mark -->
+         <!-- amqpDuplicateDetection: If you are not using duplicate 
detection, set this to false
+                                      as duplicate detection requires 
applicationProperties to be parsed on the server. -->
+         <!-- amqpMinLargeMessageSize: Determines how many bytes are 
considered large, so we start using files to hold their data.
+                                       default: 102400, -1 would mean to 
disable large mesasge control -->
+
+         <!-- Note: If an acceptor needs to be compatible with HornetQ and/or 
Artemis 1.x clients add
+                    "anycastPrefix=jms.queue.;multicastPrefix=jms.topic." to 
the acceptor url.
+                    See https://issues.apache.org/jira/browse/ARTEMIS-1644 for 
more information. -->
+
+
+         <!-- Acceptor for every supported protocol -->
+         <acceptor 
name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;useKQueue=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;supportAdvisory=false;suppressInternalManagementObjects=false</acceptor>
+
+         <!-- AMQP Acceptor.  Listens on default AMQP port for AMQP traffic.-->
+         <acceptor 
name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;useKQueue=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true</acceptor>
+
+         <!-- STOMP Acceptor. -->
+         <acceptor 
name="stomp">tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;useKQueue=true</acceptor>
+
+         <!-- HornetQ Compatibility Acceptor.  Enables HornetQ Core and STOMP 
for legacy HornetQ clients. -->
+         <acceptor 
name="hornetq">tcp://0.0.0.0:5445?anycastPrefix=jms.queue.;multicastPrefix=jms.topic.;protocols=HORNETQ,STOMP;useEpoll=true;useKQueue=true</acceptor>
+
+         <!-- MQTT Acceptor -->
+         <acceptor 
name="mqtt">tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true;useKQueue=true</acceptor>
+
+      </acceptors>
+
+
+      <security-settings>
+         <security-setting match="#">
+            <permission type="createNonDurableQueue" roles="amq"/>
+            <permission type="deleteNonDurableQueue" roles="amq"/>
+            <permission type="createDurableQueue" roles="amq"/>
+            <permission type="deleteDurableQueue" roles="amq"/>
+            <permission type="createAddress" roles="amq"/>
+            <permission type="deleteAddress" roles="amq"/>
+            <permission type="consume" roles="amq"/>
+            <permission type="browse" roles="amq"/>
+            <permission type="send" roles="amq"/>
+            <!-- we need this otherwise ./artemis data imp wouldn't work -->
+            <permission type="manage" roles="amq"/>
+         </security-setting>
+      </security-settings>
+
+      <address-settings>
+         <!-- if you define auto-create on certain queues, management has to 
be auto-create -->
+         <address-setting match="activemq.management#">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            
<message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>PAGE</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+         </address-setting>
+         <!--default for catch all-->
+         <address-setting match="#">
+            <dead-letter-address>DLQ</dead-letter-address>
+            <expiry-address>ExpiryQueue</expiry-address>
+            <redelivery-delay>0</redelivery-delay>
+            <!-- with -1 only the global-max-size is in use for limiting -->
+            <max-size-bytes>-1</max-size-bytes>
+            
<message-counter-history-day-limit>10</message-counter-history-day-limit>
+            <address-full-policy>PAGE</address-full-policy>
+            <auto-create-queues>true</auto-create-queues>
+            <auto-create-addresses>true</auto-create-addresses>
+            <auto-create-jms-queues>true</auto-create-jms-queues>
+            <auto-create-jms-topics>true</auto-create-jms-topics>
+            <auto-delete-queues>false</auto-delete-queues>
+            <auto-delete-addresses>false</auto-delete-addresses>
+         </address-setting>
+      </address-settings>
+
+      <addresses>
+         <address name="DLQ">
+            <anycast>
+               <queue name="DLQ" />
+            </anycast>
+         </address>
+         <address name="ExpiryQueue">
+            <anycast>
+               <queue name="ExpiryQueue" />
+            </anycast>
+         </address>
+
+      </addresses>
+
+
+      <!-- Uncomment the following if you want to use the Standard 
LoggingActiveMQServerPlugin pluging to log in events
+      <broker-plugins>
+         <broker-plugin 
class-name="org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin">
+            <property key="LOG_ALL_EVENTS" value="true"/>
+            <property key="LOG_CONNECTION_EVENTS" value="true"/>
+            <property key="LOG_SESSION_EVENTS" value="true"/>
+            <property key="LOG_CONSUMER_EVENTS" value="true"/>
+            <property key="LOG_DELIVERING_EVENTS" value="true"/>
+            <property key="LOG_SENDING_EVENTS" value="true"/>
+            <property key="LOG_INTERNAL_EVENTS" value="true"/>
+         </broker-plugin>
+      </broker-plugins>
+      -->
+
+   </core>
+</configuration>
diff --git 
a/tests/smoke-tests/src/main/resources/servers/nettynative/logging.properties 
b/tests/smoke-tests/src/main/resources/servers/nettynative/logging.properties
new file mode 100644
index 0000000..1847064
--- /dev/null
+++ 
b/tests/smoke-tests/src/main/resources/servers/nettynative/logging.properties
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF 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.
+#
+
+# Additional logger names to configure (root logger is always configured)
+# Root logger option
+loggers=org.eclipse.jetty,org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.utils.critical,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms.server,org.apache.activemq.artemis.integration.bootstrap,org.apache.activemq.audit.base,org.apache.activemq.audit.message,org.apache.activemq.audit.resource,org.apache.curator,org.apache.zookeeper,org.apache.activemq.artemis.core.remoting.impl.netty
+
+# Root logger level
+logger.level=INFO
+# ActiveMQ Artemis logger levels
+logger.org.apache.activemq.artemis.core.server.level=INFO
+logger.org.apache.activemq.artemis.journal.level=INFO
+logger.org.apache.activemq.artemis.utils.level=INFO
+logger.org.apache.activemq.artemis.core.remoting.impl.netty.level=DEBUG
+
+# if you have issues with CriticalAnalyzer, setting this as TRACE would give 
you extra troubleshooting information.
+# but do not use it regularly as it would incur in some extra CPU usage for 
this diagnostic.
+logger.org.apache.activemq.artemis.utils.critical.level=INFO
+
+logger.org.apache.activemq.artemis.jms.level=INFO
+logger.org.apache.activemq.artemis.integration.bootstrap.level=INFO
+logger.org.eclipse.jetty.level=WARN
+# Root logger handlers
+logger.handlers=FILE,CONSOLE
+
+# quorum logger levels
+logger.org.apache.curator.level=WARN
+logger.org.apache.zookeeper.level=ERROR
+
+# to enable audit change the level to INFO
+logger.org.apache.activemq.audit.base.level=ERROR
+logger.org.apache.activemq.audit.base.handlers=AUDIT_FILE
+logger.org.apache.activemq.audit.base.useParentHandlers=false
+
+logger.org.apache.activemq.audit.resource.level=ERROR
+logger.org.apache.activemq.audit.resource.handlers=AUDIT_FILE
+logger.org.apache.activemq.audit.resource.useParentHandlers=false
+
+logger.org.apache.activemq.audit.message.level=ERROR
+logger.org.apache.activemq.audit.message.handlers=AUDIT_FILE
+logger.org.apache.activemq.audit.message.useParentHandlers=false
+
+# Console handler configuration
+handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
+handler.CONSOLE.properties=autoFlush
+handler.CONSOLE.level=DEBUG
+handler.CONSOLE.autoFlush=true
+handler.CONSOLE.formatter=PATTERN
+
+# File handler configuration
+handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
+handler.FILE.level=DEBUG
+handler.FILE.properties=suffix,append,autoFlush,fileName
+handler.FILE.suffix=.yyyy-MM-dd
+handler.FILE.append=true
+handler.FILE.autoFlush=true
+handler.FILE.fileName=${artemis.instance}/log/artemis.log
+handler.FILE.formatter=PATTERN
+
+# Formatter pattern configuration
+formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.PATTERN.properties=pattern
+formatter.PATTERN.pattern=%d %-5p [%c] %s%E%n
+
+#Audit logger
+handler.AUDIT_FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
+handler.AUDIT_FILE.level=INFO
+handler.AUDIT_FILE.properties=suffix,append,autoFlush,fileName
+handler.AUDIT_FILE.suffix=.yyyy-MM-dd
+handler.AUDIT_FILE.append=true
+handler.AUDIT_FILE.autoFlush=true
+handler.AUDIT_FILE.fileName=${artemis.instance}/log/audit.log
+handler.AUDIT_FILE.formatter=AUDIT_PATTERN
+
+formatter.AUDIT_PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.AUDIT_PATTERN.properties=pattern
+formatter.AUDIT_PATTERN.pattern=%d [AUDIT](%t) %s%E%n
diff --git 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/common/SmokeTestBase.java
 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/common/SmokeTestBase.java
index 0090f98..c9d2b28 100644
--- 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/common/SmokeTestBase.java
+++ 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/common/SmokeTestBase.java
@@ -21,7 +21,9 @@ import javax.management.MBeanServerInvocationHandler;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.util.HashSet;
@@ -172,4 +174,34 @@ public class SmokeTestBase extends ActiveMQTestBase {
       return false;
    }
 
+   protected void checkLogRecord(File logFile, boolean exist, String... 
values) throws Exception {
+      Assert.assertTrue(logFile.exists());
+      boolean hasRecord = false;
+      try (BufferedReader reader = new BufferedReader(new 
FileReader(logFile))) {
+         String line = reader.readLine();
+         while (line != null) {
+            if (line.contains(values[0])) {
+               boolean hasAll = true;
+               for (int i = 1; i < values.length; i++) {
+                  if (!line.contains(values[i])) {
+                     hasAll = false;
+                     break;
+                  }
+               }
+               if (hasAll) {
+                  hasRecord = true;
+                  System.out.println("audit has it: " + line);
+                  break;
+               }
+            }
+            line = reader.readLine();
+         }
+         if (exist) {
+            Assert.assertTrue(hasRecord);
+         } else {
+            Assert.assertFalse(hasRecord);
+         }
+      }
+   }
+
 }
diff --git 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java
 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java
index 73aea8f..9c346d3 100644
--- 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java
+++ 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/logging/AuditLoggerTestBase.java
@@ -17,15 +17,12 @@
 package org.apache.activemq.artemis.tests.smoke.logging;
 
 import javax.jms.ConnectionFactory;
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.PrintWriter;
 
 import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
-import org.junit.Assert;
 import org.junit.Before;
 
 public abstract class AuditLoggerTestBase extends SmokeTestBase {
@@ -59,33 +56,7 @@ public abstract class AuditLoggerTestBase extends 
SmokeTestBase {
 
    //check the audit log has a line that contains all the values
    protected void checkAuditLogRecord(boolean exist, String... values) throws 
Exception {
-      Assert.assertTrue(getAuditLog().exists());
-      boolean hasRecord = false;
-      try (BufferedReader reader = new BufferedReader(new 
FileReader(getAuditLog()))) {
-         String line = reader.readLine();
-         while (line != null) {
-            if (line.contains(values[0])) {
-               boolean hasAll = true;
-               for (int i = 1; i < values.length; i++) {
-                  if (!line.contains(values[i])) {
-                     hasAll = false;
-                     break;
-                  }
-               }
-               if (hasAll) {
-                  hasRecord = true;
-                  System.out.println("audit has it: " + line);
-                  break;
-               }
-            }
-            line = reader.readLine();
-         }
-         if (exist) {
-            Assert.assertTrue(hasRecord);
-         } else {
-            Assert.assertFalse(hasRecord);
-         }
-      }
+      checkLogRecord(getAuditLog(), exist, values);
    }
 
    public static ConnectionFactory createConnectionFactory(String protocol, 
String uri) {
diff --git 
a/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/nettynative/NettyNativeTest.java
 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/nettynative/NettyNativeTest.java
new file mode 100644
index 0000000..d2e655b
--- /dev/null
+++ 
b/tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/nettynative/NettyNativeTest.java
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.activemq.artemis.tests.smoke.nettynative;
+
+import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
+import org.apache.activemq.artemis.util.ServerUtil;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import java.io.File;
+
+public class NettyNativeTest extends SmokeTestBase {
+
+   public static final String SERVER_NAME = "nettynative";
+   protected static final String SERVER_ADMIN_USERNAME = "admin";
+   protected static final String SERVER_ADMIN_PASSWORD = "admin";
+
+   @Before
+   public void before() throws Exception {
+      cleanupData(SERVER_NAME);
+      disableCheckThread();
+      startServer(SERVER_NAME, 0, 0);
+      ServerUtil.waitForServerToStart(0, SERVER_ADMIN_USERNAME, 
SERVER_ADMIN_PASSWORD, 30000);
+   }
+
+   @Test
+   public void testNettyNativeAvailable() throws Exception {
+      ConnectionFactory factory = new 
ActiveMQConnectionFactory("tcp://localhost:61616", SERVER_ADMIN_USERNAME, 
SERVER_ADMIN_PASSWORD);
+
+      try (Connection connection = factory.createConnection()) {
+         try (Session session = connection.createSession(true, 
Session.SESSION_TRANSACTED)) {
+            Queue queue = session.createQueue("TEST");
+            MessageProducer producer = session.createProducer(queue);
+            producer.send(session.createTextMessage("TEST"));
+
+            session.commit();
+
+            MessageConsumer consumer = session.createConsumer(queue);
+            connection.start();
+
+            TextMessage txt = (TextMessage) consumer.receive(10000);
+            Assert.assertNotNull(txt);
+            Assert.assertEquals("TEST", txt.getText());
+
+            session.commit();
+         }
+      }
+
+      File artemisLog = new File("target/" + SERVER_NAME + "/log/artemis.log");
+      checkLogRecord(artemisLog, true, "Acceptor using native");
+      checkLogRecord(artemisLog, false, "Acceptor using nio");
+   }
+
+}

Reply via email to