diff --git a/artemis-core-client-osgi/pom.xml b/artemis-core-client-osgi/pom.xml new file mode 100644 index 00000000000..21a3a0de60f --- /dev/null +++ b/artemis-core-client-osgi/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.5.0-SNAPSHOT + + + artemis-core-client-osgi + bundle + ActiveMQ Artemis Client OSGi + + + Combines the commons and core-client as they contain too many duplicate packages + to be deployed separately. + + + + ${project.basedir}/.. + + + + + org.apache.activemq + artemis-commons + ${project.version} + + + org.apache.activemq + artemis-core-client + ${project.version} + + + org.jboss.modules + jboss-modules + 1.3.1.Final + provided + true + + + org.jboss.logmanager + jboss-logmanager + true + provided + + + org.jboss.logging + jboss-logging-processor + provided + true + + + org.jboss.logging + jboss-logging-annotations + provided + true + + + org.jboss.logging + jboss-logging + + + xalan + xalan + 2.7.2 + true + provided + + + org.osgi + org.osgi.core + provided + + + org.osgi + osgi.cmpn + provided + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + *;scope=compile|runtime;groupId=org.apache.activemq + + io.netty.buffer;io.netty.*;version="[4.1,5)", + org.apache.johnzon.core, + * + + <_exportcontents>org.apache.activemq.artemis.*;-noimport:=true + + + + + + + diff --git a/artemis-features/src/main/resources/features.xml b/artemis-features/src/main/resources/features.xml index 45094d5a12f..92803ec53f0 100644 --- a/artemis-features/src/main/resources/features.xml +++ b/artemis-features/src/main/resources/features.xml @@ -38,18 +38,13 @@ mvn:io.netty/netty-transport-native-epoll/${netty.version} mvn:io.netty/netty-transport-native-kqueue/${netty.version} mvn:io.netty/netty-transport-native-unix-common/${netty.version} + mvn:io.netty/netty-codec-http/${netty.version} - + transaction netty-core - scr - mvn:org.apache.activemq/artemis-features/${pom.version}/cfg - mvn:org.apache.activemq/artemis-features/${pom.version}/xml/artemis - - mvn:org.apache.geronimo.specs/geronimo-jms_2.0_spec/${geronimo.jms.2.spec.version} mvn:com.google.guava/guava/${guava.version} - mvn:io.netty/netty-codec-http/${netty.version} mvn:commons-beanutils/commons-beanutils/${commons.beanutils.version} mvn:commons-collections/commons-collections/${commons.collections.version} @@ -58,11 +53,39 @@ mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.json-api-1.1/${servicemix.json-1.1.spec.version} mvn:org.apache.johnzon/johnzon-core/${johnzon.version} + + + + artemis-common + scr + mvn:org.apache.activemq/artemis-features/${pom.version}/cfg + mvn:org.apache.activemq/artemis-features/${pom.version}/xml/artemis + + mvn:org.apache.geronimo.specs/geronimo-jms_2.0_spec/${geronimo.jms.2.spec.version} mvn:org.apache.activemq/artemis-native/${pom.version} mvn:org.apache.activemq/artemis-server-osgi/${pom.version} + + artemis-common + mvn:org.apache.activemq/artemis-core-client-osgi/${pom.version} + + + + artemis-common + mvn:org.apache.geronimo.specs/geronimo-jms_2.0_spec/${geronimo.jms.2.spec.version} + mvn:org.apache.activemq/artemis-jms-client-osgi/${pom.version} + + + + transaction + netty-core + mvn:org.apache.geronimo.specs/geronimo-jms_2.0_spec/${geronimo.jms.2.spec.version} + mvn:org.apache.qpid/proton-j/${proton.version} + mvn:org.apache.qpid/qpid-jms-client/${qpid.jms.version} + + artemis-core mvn:org.apache.qpid/proton-j/${proton.version} diff --git a/artemis-jms-client-osgi/pom.xml b/artemis-jms-client-osgi/pom.xml new file mode 100644 index 00000000000..d4a8d03d570 --- /dev/null +++ b/artemis-jms-client-osgi/pom.xml @@ -0,0 +1,123 @@ + + + 4.0.0 + + + org.apache.activemq + artemis-pom + 2.5.0-SNAPSHOT + + + artemis-jms-client-osgi + bundle + ActiveMQ Artemis JMS Client OSGi + + + Combines the commons, jms-client and core-client as they contain too many duplicate packages + to be deployed separately. + + + + ${project.basedir}/.. + + + + + org.apache.activemq + artemis-commons + ${project.version} + + + org.apache.activemq + artemis-core-client + ${project.version} + + + org.apache.activemq + artemis-selector + ${project.version} + + + org.apache.activemq + artemis-jms-client + ${project.version} + + + org.jboss.modules + jboss-modules + 1.3.1.Final + provided + true + + + org.jboss.logmanager + jboss-logmanager + true + provided + + + org.jboss.logging + jboss-logging-processor + provided + true + + + org.jboss.logging + jboss-logging-annotations + provided + true + + + org.jboss.logging + jboss-logging + + + xalan + xalan + 2.7.2 + true + provided + + + org.osgi + org.osgi.core + provided + + + org.osgi + osgi.cmpn + provided + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + *;scope=compile|runtime;groupId=org.apache.activemq + + io.netty.buffer;io.netty.*;version="[4.1,5)", + org.apache.johnzon.core, + * + + <_exportcontents>org.apache.activemq.artemis.*;-noimport:=true + + + + + + + diff --git a/artemis-server/pom.xml b/artemis-server/pom.xml index 43312820fd6..b97e9763983 100644 --- a/artemis-server/pom.xml +++ b/artemis-server/pom.xml @@ -24,7 +24,7 @@ artemis-server - jar + bundle ActiveMQ Artemis Server @@ -237,6 +237,11 @@ + + org.apache.felix + maven-bundle-plugin + 3.3.0 + diff --git a/pom.xml b/pom.xml index 0b4ed1a7295..d6b8ccf29e2 100644 --- a/pom.xml +++ b/pom.xml @@ -41,10 +41,12 @@ artemis-selector artemis-core-client artemis-core-client-all + artemis-core-client-osgi artemis-server artemis-junit artemis-jms-client artemis-jms-client-all + artemis-jms-client-osgi artemis-jms-server artemis-native artemis-journal @@ -73,6 +75,8 @@ scp://people.apache.org/x1/www/activemq.apache.org + 4.0.6 + 4.9.1 2.1 3.0 5.14.5 diff --git a/tests/integration-tests/pom.xml b/tests/integration-tests/pom.xml index 0249033b85d..bf3f575278a 100644 --- a/tests/integration-tests/pom.xml +++ b/tests/integration-tests/pom.xml @@ -29,8 +29,6 @@ ${project.basedir}/../.. - 4.0.6 - 4.9.1 1.1.0 diff --git a/tests/karaf-client-integration-tests/pom.xml b/tests/karaf-client-integration-tests/pom.xml new file mode 100644 index 00000000000..927e12216cc --- /dev/null +++ b/tests/karaf-client-integration-tests/pom.xml @@ -0,0 +1,197 @@ + + + 4.0.0 + + + org.apache.activemq.tests + artemis-tests-pom + 2.5.0-SNAPSHOT + + + karaf-client-integration-tests + jar + ActiveMQ Artemis Client Integration Tests + + + Integration tests for the artemis client features using Apache Karaf + + + + ${project.basedir}/../.. + + + + + org.apache.activemq + artemis-jms-client + ${project.version} + test + + + junit + junit + test + + + org.apache.qpid + qpid-jms-client + ${qpid.jms.version} + test + + + org.apache.qpid + proton-j + test + + + org.jboss.logmanager + jboss-logmanager + test + + + + + + org.ops4j.pax.exam + pax-exam-container-karaf + ${pax.exam.version} + test + + + org.ops4j.pax.exam + pax-exam-junit4 + ${pax.exam.version} + test + + + org.apache.karaf + apache-karaf + ${karaf.version} + test + tar.gz + + + org.apache.karaf.shell + org.apache.karaf.shell.console + ${karaf.version} + test + + + org.apache.activemq + artemis-features + ${project.version} + features + xml + test + + + org.apache.karaf.features + enterprise + ${karaf.version} + features + xml + test + + + + + + + org.apache.servicemix.tooling + depends-maven-plugin + 1.2 + + + generate-depends-file + + generate-depends-file + + + + + + org.apache.activemq + artemis-maven-plugin + + + create + pre-integration-test + + create + + + ${skipIntegrationTests} + + + + start + pre-integration-test + + cli + + + ${skipIntegrationTests} + true + tcp://localhost:61616 + + run + + + + + stop + post-integration-test + + cli + + + ${skipIntegrationTests} + + stop + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.20.1 + + + + integration-test + verify + + + + + ${skipIntegrationTests} + ${activemq-surefire-argline} + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisAMQPClientFeatureIT.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisAMQPClientFeatureIT.java new file mode 100644 index 00000000000..5e41d09075f --- /dev/null +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisAMQPClientFeatureIT.java @@ -0,0 +1,84 @@ +/** + * 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.integration.karaf.client; + +import org.apache.qpid.jms.JmsConnectionFactory; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; + +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.IOException; + +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_AMQP_CLIENT; +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.KARAF; +import static org.junit.Assert.assertEquals; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.when; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration; + + +/** + * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class ArtemisAMQPClientFeatureIT { + + @Configuration + public Option[] config() throws IOException { + return options( + KARAF.option(), + ARTEMIS_AMQP_CLIENT.option(), + when(false) + .useOptions( + debugConfiguration("5005", true)) + ); + } + + @Test + public void testArtemisAMQPClient() throws Exception { + // setup connection + + ConnectionFactory connectionFactory = new JmsConnectionFactory("amqp://localhost:5672"); + try (Connection connection = connectionFactory.createConnection()) { + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + // send message + Queue queue = session.createQueue("artemisAMPQClientFeatureITQueue"); + MessageProducer sender = session.createProducer(queue); + String message = "Hello world "; + sender.send(session.createTextMessage(message)); + + // receive message and assert + connection.start(); + MessageConsumer consumer = session.createConsumer(queue); + TextMessage m = (TextMessage) consumer.receive(5000); + assertEquals(message, m.getText()); + } + } +} diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java new file mode 100644 index 00000000000..dc9a1b60cf4 --- /dev/null +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisCoreClientFeatureIT.java @@ -0,0 +1,84 @@ +/** + * 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.integration.karaf.client; + +import org.apache.activemq.artemis.api.core.RoutingType; +import org.apache.activemq.artemis.api.core.client.ActiveMQClient; +import org.apache.activemq.artemis.api.core.client.ClientConsumer; +import org.apache.activemq.artemis.api.core.client.ClientMessage; +import org.apache.activemq.artemis.api.core.client.ClientProducer; +import org.apache.activemq.artemis.api.core.client.ClientSession; +import org.apache.activemq.artemis.api.core.client.ClientSessionFactory; +import org.apache.activemq.artemis.api.core.client.ServerLocator; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; + +import java.io.IOException; + +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_CORE_CLIENT; +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.KARAF; +import static org.junit.Assert.assertEquals; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.when; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration; + + +/** + * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class ArtemisCoreClientFeatureIT { + + @Configuration + public Option[] config() throws IOException { + return options( + KARAF.option(), + ARTEMIS_CORE_CLIENT.option(), + when(false) + .useOptions( + debugConfiguration("5005", true)) + ); + } + + @Test + public void testArtemisCoreClient() throws Exception { + try (ServerLocator locator = ActiveMQClient.createServerLocator("tcp://localhost:61616")) { + ClientSessionFactory factory = locator.createSessionFactory(); + ClientSession session = factory.createSession(); + String queueName = "artemisCoreClientFeatureITQueue"; + ClientProducer producer = session.createProducer(queueName); + ClientMessage message = session.createMessage(true); + // send message + String textMessage = "Hello"; + message.getBodyBuffer().writeString(textMessage); + session.createQueue(queueName, RoutingType.ANYCAST, queueName, true); + producer.send(message); + + // assert + ClientConsumer consumer = session.createConsumer(queueName); + session.start(); + ClientMessage msgReceived = consumer.receive(); + assertEquals(textMessage, msgReceived.getBodyBuffer().readString()); + } + } +} diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJMSClientFeatureIT.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJMSClientFeatureIT.java new file mode 100644 index 00000000000..101340aefb3 --- /dev/null +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisJMSClientFeatureIT.java @@ -0,0 +1,84 @@ +/** + * 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.integration.karaf.client; + +import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; + +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.IOException; + +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_JMS_CLIENT; +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.KARAF; +import static org.junit.Assert.assertEquals; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.when; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration; + + +/** + * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class ArtemisJMSClientFeatureIT { + + @Configuration + public Option[] config() throws IOException { + return options( + KARAF.option(), + ARTEMIS_JMS_CLIENT.option(), + when(false) + .useOptions( + debugConfiguration("5005", true)) + ); + } + + @Test + public void testArtemisJMSClient() throws Exception { + // setup connection + ConnectionFactory cf = new ActiveMQJMSConnectionFactory("tcp://localhost:61616"); + try (Connection connection = cf.createConnection()) { + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + connection.start(); + Queue queue = ActiveMQJMSClient.createQueue("artemisJMSClientFeatureITQueue"); + MessageProducer producer = session.createProducer(queue); + // send message + String textMessage = "This is a text message"; + TextMessage message = session.createTextMessage(textMessage); + producer.send(message); + + // receive message and assert + MessageConsumer messageConsumer = session.createConsumer(queue); + TextMessage messageReceived = (TextMessage) messageConsumer.receive(100); + assertEquals(textMessage, messageReceived.getText()); + } + } +} diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisTransactionalJMSClientFeatureIT.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisTransactionalJMSClientFeatureIT.java new file mode 100644 index 00000000000..c90d22496f0 --- /dev/null +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/ArtemisTransactionalJMSClientFeatureIT.java @@ -0,0 +1,108 @@ +/** + * 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.integration.karaf.client; + +import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; +import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; + +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.IOException; + +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_JMS_CLIENT; +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.ARTEMIS_TRANSACTION_MANAGER; +import static org.apache.activemq.artemis.tests.integration.karaf.client.PaxExamOptions.KARAF; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.when; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration; + + +/** + * Useful docs about this test: https://ops4j1.jira.com/wiki/display/paxexam/FAQ + */ +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class ArtemisTransactionalJMSClientFeatureIT { + + @Configuration + public Option[] config() throws IOException { + return options( + KARAF.option(), + ARTEMIS_JMS_CLIENT.option(), + ARTEMIS_TRANSACTION_MANAGER.option(), + when(false) + .useOptions( + debugConfiguration("5005", true)) + ); + } + + @Test + public void testTransactionalArtemisJMSClient() throws Exception { + // setup connection + ConnectionFactory cf = new ActiveMQJMSConnectionFactory("tcp://localhost:61616"); + try (Connection connection = cf.createConnection()) { + connection.start(); + Queue queue = ActiveMQJMSClient.createQueue("ArtemisTransactionalJMSClientFeatureITQueue"); + Session session = connection.createSession(true, Session.SESSION_TRANSACTED); + MessageProducer messageProducer = session.createProducer(queue); + MessageConsumer messageConsumer = session.createConsumer(queue); + + // send messages + String textMessage1 = "This is a text message1"; + TextMessage message1 = session.createTextMessage(textMessage1); + String textMessage2 = "This is a text message2"; + TextMessage message2 = session.createTextMessage(textMessage2); + messageProducer.send(message1); + messageProducer.send(message2); + + // assert null before commit + TextMessage receivedMessage = (TextMessage) messageConsumer.receive(10); + assertNull(receivedMessage); + + // commit and rollback + session.commit(); + receivedMessage = (TextMessage) messageConsumer.receive(10); + assertNotNull(receivedMessage); + session.rollback(); + + // assert messages + receivedMessage = (TextMessage) messageConsumer.receive(100); + assertEquals(textMessage1, receivedMessage.getText()); + receivedMessage = (TextMessage) messageConsumer.receive(100); + assertEquals(textMessage2, receivedMessage.getText()); + session.commit(); + receivedMessage = (TextMessage) messageConsumer.receive(10); + assertNull(receivedMessage); + } + } +} diff --git a/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java new file mode 100644 index 00000000000..1899b167c95 --- /dev/null +++ b/tests/karaf-client-integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/karaf/client/PaxExamOptions.java @@ -0,0 +1,98 @@ +/** + * 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.integration.karaf.client; + +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.karaf.options.LogLevelOption; +import org.ops4j.pax.exam.options.DefaultCompositeOption; + +import java.io.File; + +import static org.ops4j.pax.exam.CoreOptions.maven; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; + +public enum PaxExamOptions { + KARAF( + karafDistributionConfiguration() + .frameworkUrl( + maven() + .groupId("org.apache.karaf") + .artifactId("apache-karaf") + .versionAsInProject() + .type("zip")) + .name("Apache Karaf") + .useDeployFolder(false) + .unpackDirectory(new File("target/paxexam/unpack/")), + keepRuntimeFolder(), + configureConsole().ignoreLocalConsole(), + logLevel(LogLevelOption.LogLevel.INFO) + ), + ARTEMIS_CORE_CLIENT( + features( + maven() + .groupId("org.apache.activemq") + .artifactId("artemis-features") + .type("xml") + .classifier("features") + .versionAsInProject(), + "artemis-core-client") + ), + ARTEMIS_JMS_CLIENT( + features( + maven() + .groupId("org.apache.activemq") + .artifactId("artemis-features") + .type("xml") + .classifier("features") + .versionAsInProject(), + "artemis-jms-client") + ), + ARTEMIS_AMQP_CLIENT( + features( + maven() + .groupId("org.apache.activemq") + .artifactId("artemis-features") + .type("xml") + .classifier("features") + .versionAsInProject(), + "artemis-amqp-client") + ), + ARTEMIS_TRANSACTION_MANAGER( + features( + maven() + .groupId("org.apache.karaf.features") + .artifactId("enterprise") + .type("xml") + .classifier("features") + .versionAsInProject(), + "transaction-manager-narayana") + ); + + private final Option[] options; + + PaxExamOptions(Option... options) { + this.options = options; + } + + public Option option() { + return new DefaultCompositeOption(options); + } +} diff --git a/tests/pom.xml b/tests/pom.xml index a281b96ba5f..5dcf61c93e8 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -126,6 +126,7 @@ timing-tests jms-tests integration-tests + karaf-client-integration-tests compatibility-tests soak-tests stress-tests