merge PR #271 - Hacking guide + test-suite refactor + couple more fixes

This commit is contained in:
Andy Taylor 2015-05-20 10:45:55 +01:00
commit 13cc616b2f
241 changed files with 3789 additions and 4099 deletions

332
README.md
View File

@ -1,107 +1,27 @@
# ActiveMQ Artemis
This file describes some minimum 'stuff one needs to know' to get
started coding in this project.
This file describes some minimum 'stuff one needs to know' to get started coding in this project.
## Source
The project's source code is hosted at:
https://git-wip-us.apache.org/repos/asf/activemq-artemis.git
### Git usage:
Pull requests should be merged without fast forwards '--no-ff'. An easy way to achieve that is to use
```% git config branch.master.mergeoptions --no-ff```
## Maven
The minimum required Maven version is 3.0.0.
Do note that there are some compatibility issues with Maven 3.X still
unsolved [1]. This is specially true for the 'site' plugin [2].
[1]: <https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html>
[2]: <https://cwiki.apache.org/MAVEN/maven-3x-and-site-plugin.html>
## building the distribution
If you want to build the full release with documentation, Javadocs and the full web site then run the following:
```% mvn -Prelease package```
If you want to install it to your local maven repo then run
```% mvn -Prelease install```
The full release uses gitbook to build a static website from the documentation, if you don't have gitbook installed then
install gitbook using npm
```npm install -g gitbook gitbook-cli```
### Installing NPM
If you don't have npm installed then you would need to install it first.
#### On Fedora
```yum install npm```
#### On Mac-OS
The easiest way would be through brew [brew]
You first install brew using the instructions on the [brew] website.
After you installed brew you can install npm by:
```brew install npm```
[brew]: <http://brew.sh>
#### Build without docs
It is possible to build a distribution with out the manuals and javadocs if you dont have or want gitbook installed,
simply run
```% mvn package```
## Tests
To run the unit tests:
```% mvn -Ptests test```
Generating reports from unit tests:
```% mvn install site```
Running tests individually
```% mvn -Ptests -DfailIfNoTests=false -Dtest=<test-name> test ```
where &lt;test-name> is the name of the Test class without its package name
For details about the modifying the code, building the project, running tests, IDE integration, etc. see
our [Hacking Guide](./docs/hacking-guide/en/README.md).
## Examples
To run an example firstly make sure you have run
```% mvn -Prelease install```
$ mvn -Prelease install
If the project version has already been released then this is unnecessary.
then you will need to set the following maven options, on Linux by
```export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m"```
$ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
and the finally run the examples by
```% mvn verify```
$ mvn verify
You can also run individual examples by running the same command from the directory of which ever example you want to run.
NB for this make sure you have installed examples/common.
@ -110,241 +30,5 @@ NB for this make sure you have installed examples/common.
If you are trying to copy the examples somewhere else and modifying them. Consider asking Maven to explicitly list all the dependencies:
```
# if trying to modify the 'topic' example:
cd examples/jms/topic && mvn dependency:list
```
## Eclipse
We recommend using Eclipse Kepler (4.3), due to the built-in support
for Maven and Git. Note that there are still some Maven plugins used
by sub-projects (e.g. documentation) which are not supported even in
Eclipse Kepler (4.3).
Eclipse [m2e] is already included in "Eclipse IDE for Java Developers", or it
can be installed from [Eclipse Kepler release repository].
[m2e]: http://eclipse.org/m2e/
[Eclipse Kepler release repository]: http://download.eclipse.org/releases/kepler
## IntelliJ IDEA
### Importing the Project
The following steps show how to import ActiveMQ Artemis source into IntelliJ IDEA and setup the correct maven profile to allow
running of JUnit tests from within the IDE. (Steps are based on version: 13.1.4)
* File --> Import Project --> Select the root directory of the ActiveMQ Artemis source folder. --> Click OK
This should open the import project wizard. From here:
* Select "Import from existing model" toggle box, then select Maven from the list box below. Click Next.
* Leave the defaults set on this page and click next.
* On the "Select profiles page", select the checkbox next to "tests" and click next.
* From here the default settings should suffice. Continue through the wizard, clicking next until the wizard is complete.
Once the project has been imported and IDEA has caught up importing all the relevant dependencies, you should be able to
run JUnit tests from with the IDE. Select any test class in the tests -> integration tests folder. Right click on the
class in the project tab and click "Run <classname>". If the "Run <classname>" option is present then you're all set to go.
### Style Templates for Idea
We have shared the style templates that are good for this project. If you want to apply them use these steps:
* File->Import Settings
* Select the file under ./artemis-cloned-folder/etc/IDEA-style.jar
* Select both Code Style Templates and File templates (it's the default option)
* Select OK and restart Idea
### Issue: My JUnit tests are not runnable with in the IDE.
If the "Run <classname>" or "Run all tests" option is not present. It is likely that the default profile has not been
imported properly. To (re)import the "tests" Maven profile in an existing project.
* Open the Maven Projects Tool Window: View -> Tool Windows -> Maven Projects
* Select the "profiles" drop down
* Unselect then reselect the checkbox next to "tests".
* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a ciruclar
blue arrow.
* Wait for IDEA to reload and try running a JUnit test again. The option to run should now be present.
### Annotation Pre-Processing
ActiveMQ Artemis uses [JBoss Logging] and that requires source code generation from Java
annotations. In order for it to 'just work' in Eclipse you need to install the
_Maven Integration for Eclipse JDT Annotation Processor Toolkit_ [m2e-apt]. See
this [JBoss blog post] for details.
[JBoss Logging]: <https://community.jboss.org/wiki/JBossLoggingTooling>
[m2e-apt]: https://github.com/jbosstools/m2e-apt
[JBoss blog post]: https://community.jboss.org/en/tools/blog/2012/05/20/annotation-processing-support-in-m2e-or-m2e-apt-100-is-out
### M2E Connector for Javacc-Maven-Plugin
Eclipse Indigo (3.7) has out-of-the-box support for it.
As of this writing, Eclipse Kepler (4.3) still lacks support for
Maven's javacc plugin. The available [m2e connector for
javacc-maven-plugin] requires a downgrade of Maven components to be
installed. manual installation instructions (as of this writing you
need to use the development update site). See [this post] for how to
do this with Eclipse Juno (4.2).
The current recommended solution for Eclipse Kepler is to mark
`javacc-maven-plugin` as ignored by Eclipse, run Maven from the
command line and then modify the project `activemq-core-client` adding
the folder `target/generated-sources/javacc` to its build path.
[m2e connector for javacc-maven-plugin]: https://github.com/objectledge/maven-extensions
[this post]:
http://dev.eclipse.org/mhonarc/lists/m2e-users/msg02725.html
### Use _Project Working Sets_
Importing all ActiveMQ Artemis subprojects will create _too many_ projects in Eclipse,
cluttering your _Package Explorer_ and _Project Explorer_ views. One way to address
that is to use [Eclipse's Working Sets] feature. A good introduction to it can be
found at a [Dzone article on Eclipse Working Sets].
[Eclipse's Working Sets]: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm
[Dzone article on Eclipse Working Sets]: http://eclipse.dzone.com/articles/categorise-projects-package
### Code Formatting
Eclipse code formatting and (basic) project configuration files can be found at
the ```etc/``` folder. You should manually copy them _after importing all your
projects_:
```
for settings_dir in `find . -type d -name .settings`; do
\cp -v etc/org.eclipse.jdt.* $settings_dir
done
```
Do not use the [maven-eclipse-plugin] to copy the files as it conflicts with [m2e].
[maven-eclipse-plugin]: https://maven.apache.org/plugins/maven-eclipse-plugin/
[m2e]: http://eclipse.org/m2e/
## Committing Changes
### Repositories
The code repository for ActiveMQ Artemis is hosted by Apache org and lives here: https://git-wip-us.apache.org/repos/asf/activemq-artemis.git.
We also host a mirror of the ActiveMQ Artemis repository on GitHub: https://github.com/apache/activemq-artemis. We use this mirror for all code submissions and reviews. To submit code to ActiveMQ Artemis please open a Pull Request as outlined as part of the GitHub workflow described here: https://guides.github.com/introduction/flow/index.html. Once a pull request is opened it will be reviewed and commented on. Any further changes as a result of comments / review process should be addressed and reflected in the original pull request as outlined in the GitHub workflow. When the pull request has went through the review process and ready to merge, the reviewer should comment with "Ack, Ready to Push". Once an Ack message is received one of the ActiveMQ Artemis core team members will push the changes to upstream Apache ActiveMQ Artemis repository and close the pull request.
### Commit Messages
We follow the 50/72 git commit message format. An ActiveMQ Artemis commit message should be formatted in the following manner:
* Add the ACTIVEMQ6 JIRA or Bugzilla reference (if one exists) followed by a brief description of the change in the first line.
* Insert a single blank line after the first line.
* Provide a detailed description of the change in the following lines, breaking paragraphs where needed.
* The first line should be limited to 50 characters
* Subsequent lines should be wrapped at 72 characters.
An example correctly formatted commit message:
```
ACTIVEMQ6-123 Add new commit msg format to README
Adds a description of the new commit message format as well as examples
of well formatted commit messages to the README.md. This is required
to enable developers to quickly identify what the commit is intended to
do and why the commit was added.
```
### Adding New Dependencies
Due to incompatibilities between some open source licenses and the Apache v2.0 license (that this project is licensed under)
care must be taken when adding new dependencies to the project. The Apache Software Foundation 3rd party
licensing policy has more information here: http://www.apache.org/legal/3party.html
To keep track of all licenses in ActiveMQ Artemis, new dependencies must be added in either the top level pom.xml or in test/pom.xml
(depending on whether this is a test only dependency or if it is used in the main code base). The dependency should be
added under the dependency management section with version and labelled with a comment highlighting the license for the
dependency version. See existing dependencies in the main pom.xml for examples. The dependency can then be added to
individual ActiveMQ Artemis modules *without* the version specified (the version is implied from the dependency management
section of the top level pom). This allows ActiveMQ Artemis developers to keep track of all dependencies and licenses.
### Core Contributers
Core ActiveMQ Artemis members have write access to the Apache ActiveMQ Artemis repositories and will be responsible for Ack'ing and pushing commits contributed via pull requests on GitHub. The follow steps can be used as an example for how to set up relevant ActiveMQ Artemis repositories for reviewing and pushing changes.
To setup repositories for reviewing and pushing:
```bash
# Clone the GitHub Mirror of ActiveMQ Artemis Repo:
git clone git@github.com:apache/activemq-artemis.git
# Add the following section to your <artemis-repo>/.git/config statement to fetch all pull requests sent to the GitHub mirror. Note that the remote name for git@github.com:apache/activemq-artemis.git may be different. Be sure to edit all references to the remote name. In this case "activemq".
[remote "origin"]
url = git@github.com:apache/activemq-artemis.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
# Add the Apache repository as a remote
git remote add upstream https://git-wip-us.apache.org/repos/asf/activemq-artemis.git
# Fetch
git fetch --all
```
To push commits from a pull request to the apache repository:
```bash
cd <artemis-repo>
# Download all the remote branches etc... including all the pull requests.
git fetch --all
# Checkout the pull request you wish to review
git checkout pr/2
# Review is done... READY TO MERGE.
# Check out the master branch.
git checkout master
# Ensure you are up to date
git pull
# Create a new merge commit from the
git merge --no-ff pr/2
# IMPORTANT: In this commit message be sure to write something along the lines of: "Merge Pull Request #2" Where 2 is the Pull Request ID. "#2" shows up as a link in the GitHub UI for navigating to the PR from the commit message.
# Pushes to the upstream repo.
git push upstream master
```
#### Notes:
The GitHub mirror repository is cloning the Apache ActiveMQ Artemis repository (The root repository). There maybe a slight delay between when a commit is pushed to the Apache repo and when that commit is reflected in the GitHub mirror. This may cause some difficulty when trying to push a PR to upstream (Apache) that has been merged on an out of date GitHub (mirror) master. You can wait for the mirror to update before performing the steps above. A solution to this is to change local master branch to track the upstream (Apache) master, rather than GitHub (mirror) master by editing your config to look like this:
```bash
[branch "master"]
remote = upstream
merge = refs/heads/master
```
Where upstream points to the Apache Repo.
If you'd like master to always track GitHub master, then another way to acheive this is to add another branch that tracks upstream master and push from that branch to upstream master e.g.
```bash
# .git/config entry
[branch "umaster"]
remote = upstream
merge = refs/heads/master
git checkout umaster
git pull
git merge --no-ff pr/2
git push upstream umaster:master # Push local branch umaster to upstream branch master.
```
# if trying to modify the 'topic' example:
cd examples/jms/topic && mvn dependency:list

View File

@ -1,89 +0,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.
*/
package org.apache.activemq.artemis.tests;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.client.ActiveMQClientLogger;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
public abstract class CoreUnitTestCase extends Assert
{
public static void assertEqualsByteArrays(final byte[] expected, final byte[] actual)
{
for (int i = 0; i < expected.length; i++)
{
Assert.assertEquals("byte at index " + i, expected[i], actual[i]);
}
}
private static final ActiveMQClientLogger log = ActiveMQClientLogger.LOGGER;
@Rule
public TestRule watcher = new TestWatcher()
{
@Override
protected void starting(Description description)
{
log.info(String.format("#*#*# Starting test: %s()...", description.getMethodName()));
}
@Override
protected void finished(Description description)
{
log.info(String.format("#*#*# Finished test: %s()...", description.getMethodName()));
}
};
/**
* Asserts that latch completes within a (rather large interval).
* <p/>
* Use this instead of just calling {@code latch.await()}. Otherwise your test may hang the whole
* test run if it fails to count-down the latch.
*
* @param latch
* @throws InterruptedException
*/
public static void waitForLatch(CountDownLatch latch) throws InterruptedException
{
assertTrue("Latch has got to return within a minute", latch.await(1, TimeUnit.MINUTES));
}
public static int countOccurrencesOf(String str, String sub)
{
if (str == null || sub == null || str.length() == 0 || sub.length() == 0)
{
return 0;
}
int count = 0;
int pos = 0;
int idx;
while ((idx = str.indexOf(sub, pos)) != -1)
{
++count;
pos = idx + sub.length();
}
return count;
}
}

View File

@ -16,16 +16,13 @@
*/
package org.apache.activemq.artemis.util;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
import org.junit.Assert;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import org.junit.Assert;
import org.apache.activemq.artemis.tests.CoreUnitTestCase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
import java.util.concurrent.TimeUnit;
public class TimeAndCounterIDGeneratorTest extends Assert
{
@ -105,7 +102,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert
try
{
latchAlign.countDown();
CoreUnitTestCase.waitForLatch(latchStart);
assertTrue("Latch has got to return within a minute", latchStart.await(1, TimeUnit.MINUTES));
long lastValue = 0L;
for (int i = 0; i < NUMBER_OF_IDS; i++)
@ -136,7 +133,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert
arrays[i].start();
}
CoreUnitTestCase.waitForLatch(latchAlign);
assertTrue("Latch has got to return within a minute", latchAlign.await(1, TimeUnit.MINUTES));
latchStart.countDown();

View File

@ -359,4 +359,7 @@ public interface ActiveMQMessageBundle
@Message(id = 119111, value = "Too many queues created by user ''{0}''. Queues allowed: {1}.", format = Message.Format.MESSAGE_FORMAT)
ActiveMQSessionCreationException queueLimitReached(String username, int limit);
@Message(id = 119112, value = "Cannot set MBeanServer during startup or while started")
IllegalStateException cannotSetMBeanserver();
}

View File

@ -48,6 +48,8 @@ import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import javax.management.MBeanServer;
/**
* This interface defines the internal interface of the ActiveMQ Artemis Server exposed to other components
* of the server.
@ -278,4 +280,6 @@ public interface ActiveMQServer extends ActiveMQComponent
HAPolicy getHAPolicy();
void setHAPolicy(HAPolicy haPolicy);
void setMBeanServer(MBeanServer mBeanServer);
}

View File

@ -183,7 +183,7 @@ public class ActiveMQServerImpl implements ActiveMQServer
private final Configuration configuration;
private final MBeanServer mbeanServer;
private MBeanServer mbeanServer;
private volatile SecurityStore securityStore;
@ -519,6 +519,16 @@ public class ActiveMQServerImpl implements ActiveMQServer
this.haPolicy = haPolicy;
}
@Override
public void setMBeanServer(MBeanServer mbeanServer)
{
if (state == SERVER_STATE.STARTING || state == SERVER_STATE.STARTED)
{
throw ActiveMQMessageBundle.BUNDLE.cannotSetMBeanserver();
}
this.mbeanServer = mbeanServer;
}
public ExecutorService getThreadPool()
{
return threadPool;
@ -2226,7 +2236,7 @@ public class ActiveMQServerImpl implements ActiveMQServer
{
File journalDir = new File(configuration.getJournalDirectory());
if (!journalDir.exists())
if (!journalDir.exists() && configuration.isPersistenceEnabled())
{
if (configuration.isCreateJournalDir())
{

View File

@ -15,10 +15,17 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.junit.Before;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayInputStream;
@ -26,16 +33,7 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.journal.impl.JournalConstants;
import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
public class ConfigurationImplTest extends UnitTestCase
public class ConfigurationImplTest extends ServiceTestBase
{
protected Configuration conf;

View File

@ -16,20 +16,20 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
import org.junit.Test;
public class FileConfigurationParserTest extends UnitTestCase
public class FileConfigurationParserTest extends ServiceTestBase
{
/**
* These "InvalidConfigurationTest*.xml" files are modified copies of {@value

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.FileDeploymentManager;
import org.apache.activemq.artemis.core.server.cluster.ha.ColocatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy;
@ -25,21 +26,20 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreMasterPolicy;
import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.ColocatedActivation;
import org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.impl.Activation;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation;
import org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
import java.util.List;
public class HAPolicyConfigurationTest extends UnitTestCase
public class HAPolicyConfigurationTest extends ServiceTestBase
{
@Test
public void liveOnlyTest() throws Exception

View File

@ -16,21 +16,21 @@
*/
package org.apache.activemq.artemis.core.config.impl;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import org.apache.activemq.artemis.core.deployers.impl.FileConfigurationParser;
import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
/**
* When running this test from an IDE add this to the test command line so that the AssertionLoggerHandler works properly:
* -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=file:<path_to_source>/tests/config/logging.properties
*/
public class WrongRoleFileConfigurationParserTest extends UnitTestCase
public class WrongRoleFileConfigurationParserTest extends ServiceTestBase
{
@BeforeClass
public static void prepareLogger()

View File

@ -17,12 +17,6 @@
package org.apache.activemq.artemis.core.server.group.impl;
import javax.management.ObjectName;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -39,8 +33,8 @@ import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.postoffice.PostOffice;
import org.apache.activemq.artemis.core.remoting.server.RemotingService;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Divert;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.QueueFactory;
import org.apache.activemq.artemis.core.server.ServerMessage;
@ -54,18 +48,24 @@ import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.ResourceManager;
import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.junit.Assert;
import org.junit.Test;
import javax.management.ObjectName;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* this is testing the case for resending notifications from RemotingGroupHandler
* There is a small window where you could receive notifications wrongly
* this test will make sure the component would play well with that notification
*/
public class ClusteredResetMockTest extends UnitTestCase
public class ClusteredResetMockTest extends ServiceTestBase
{
public static final SimpleString ANYCLUSTER = SimpleString.toSimpleString("anycluster");

View File

@ -19,11 +19,11 @@ package org.apache.activemq.artemis.core.settings;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
public class AddressSettingsTest extends UnitTestCase
public class AddressSettingsTest extends ServiceTestBase
{
@Test
public void testDefaults()

View File

@ -16,18 +16,18 @@
*/
package org.apache.activemq.artemis.core.settings;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class RepositoryTest extends UnitTestCase
import java.util.ArrayList;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
public class RepositoryTest extends ServiceTestBase
{
HierarchicalRepository<HashSet<Role>> securityRepository;

View File

@ -38,6 +38,6 @@ public class RemoveFolder extends ExternalResource
*/
protected void after()
{
UnitTestCase.deleteDirectory(new File(folderName));
ServiceTestBase.deleteDirectory(new File(folderName));
}
}

View File

@ -437,7 +437,7 @@ public class SimpleStringTest extends Assert
x[i].start();
}
UnitTestCase.waitForLatch(latch);
ServiceTestBase.waitForLatch(latch);
start.countDown();
for (T t : x)

View File

@ -59,7 +59,7 @@ public abstract class SingleServerTestBase extends ServiceTestBase
protected ServerLocator createLocator()
{
ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator retlocator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY));
addServerLocator(retlocator);
return retlocator;
}

View File

@ -27,43 +27,44 @@
<packaging>jar</packaging>
<name>ActiveMQ Artemis Web</name>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-core-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-journal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-selector</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-core-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-journal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-selector</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<properties>
<activemq.basedir>${project.basedir}/..</activemq.basedir>
<webapp-dir>${project.artifactId}-${project.version}</webapp-dir>
<webapp-outdir>${basedir}/target/classes/user-manual</webapp-outdir>
<activemq.basedir>${project.basedir}/..</activemq.basedir>
<webapp-dir>${project.artifactId}-${project.version}</webapp-dir>
<webapp-outdir-user-manual>${basedir}/target/classes/user-manual</webapp-outdir-user-manual>
<webapp-outdir-hacking-guide>${basedir}/target/classes/hacking-guide</webapp-outdir-hacking-guide>
</properties>
<build>
@ -109,35 +110,42 @@
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<condition property="gitbook.cmd" value="gitbook.cmd" else="gitbook">
<os family="windows" />
</condition>
<!-- lets generate the gitbook -->
<mkdir dir="${webapp-outdir}/gitbook" />
<echo>executing ${gitbook.cmd}</echo>
<exec executable="${gitbook.cmd}">
<arg value="build" />
<arg value="${basedir}/../docs/user-manual/en" />
<arg value="--output=${webapp-outdir}" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<condition property="gitbook.cmd" value="gitbook.cmd" else="gitbook">
<os family="windows"/>
</condition>
<!-- lets generate the gitbook -->
<mkdir dir="${webapp-outdir-user-manual}/gitbook"/>
<echo>executing ${gitbook.cmd}</echo>
<exec executable="${gitbook.cmd}">
<arg value="build"/>
<arg value="${basedir}/../docs/user-manual/en"/>
<arg value="--output=${webapp-outdir-user-manual}"/>
</exec>
<mkdir dir="${webapp-outdir-hacking-guide}/gitbook"/>
<echo>executing ${gitbook.cmd}</echo>
<exec executable="${gitbook.cmd}">
<arg value="build"/>
<arg value="${basedir}/../docs/hacking-guide/en"/>
<arg value="--output=${webapp-outdir-hacking-guide}"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</plugin>
</plugins>
</build>
</profile>
</profiles>

View File

@ -0,0 +1,24 @@
<!--
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.
-->
<h1>User Manual</h1>
<p>If you are seeing this message, it is because the Hacking Guide was not built during the Apache ActiveMQ Artemis build. To
build Apache ActiveMQ Artemis with the Hacking Guide you must use the maven release profile:
<code>mvn clean install -Prelease</code>.</p>

View File

@ -52,6 +52,7 @@
<ul>
<li><a target="_blank" href="api/index.html">API</a></li>
<li><a target="_blank" href="user-manual/index.html">User Manual</a></li>
<li><a target="_blank" href="hacking-guide/index.html">Hacking Guide</a></li>
<li><a href="examples/index.html">Examples</a></li>
<li><a href="http://activemq.apache.org/artemis">Apache ActiveMQ Artemis Website</a></li>
</ul>

View File

@ -22,5 +22,3 @@ under the License.
<p>If you are seeing this message, it is because the User Manual was not built during the Apache ActiveMQ Artemis build. To
build Apache ActiveMQ Artemis with the User Manual you must use the maven release profile:
<code>mvn clean install -Prelease</code>.</p>
<p>Please see the README in the source distribution for more information.</p>

View File

@ -0,0 +1,7 @@
![ActiveMQ Artemis logo](images/artemis-logo.jpg)
Apache ActiveMQ Artemis Hacking Guide
=====================================
This hacking guide outlines how developers can get involved in contributing to the Apache ActiveMQ Artemis project.

View File

@ -0,0 +1,10 @@
# Summary
* [Legal Notice](notice.md)
* [Working with the Code](code.md)
* [IDE Integration](ide.md)
* [Building](building.md)
* [Tests](tests.md)
* [Code Formatting](formatting.md)
* [Notes for Maintainers](maintainers.md)

View File

@ -0,0 +1,11 @@
{
"title": "ActiveMQ Artemis Documentation",
"description": "ActiveMQ Artemis Hacking Guide",
"github": "apache/activemq-artemis",
"githubHost": "https://github.com/",
"links": {
"home": "http://activemq.apache.org/",
"issues": "http://activemq.apache.org/",
"contribute": "http://activemq.apache.org/contributing.html"
}
}

View File

@ -0,0 +1,48 @@
# Building
We use Apache Maven to build the code, docs, distribution, etc. and to manage dependencies.
The minimum required Maven version is 3.0.0.
Note that there are some [compatibility issues with Maven 3.X](https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes)
still unsolved. This is specially true for the ['site' plugin](https://maven.apache.org/plugins-archives/maven-site-plugin-3.3/maven-3.html).
## Full Release
The full release uses `gitbook` to build a static website from the documentation, if you don't have `gitbook` installed
then you can build the distribution without docs (see below) or install `gitbook` using `npm`:
$ npm install -g gitbook gitbook-cli
If you don't have `npm` installed then you would need to install it first.
#### Install npm On Fedora
$ yum install npm
#### Install npm On Mac-OS
The easiest way would be through brew [brew]
You first install brew using the instructions on the [brew] website.
After you installed brew you can install npm by:
brew install npm
[brew]: <http://brew.sh>
To build the full release with documentation, Javadocs, and the full web site:
$ mvn -Prelease package
To install it to your local maven repo:
$ mvn -Prelease install
## Build the distribution without docs
It is possible to build a distribution with out the manuals and Javadocs if you don't have or want `gitbook` installed,
simply run
$ mvn package

View File

@ -0,0 +1,164 @@
# Working with the Code
While the canonical Apache ActiveMQ Artemis git repository is hosted on Apache hardware at https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git
the developers use a mirror on GitHub for collaboration and pull-request review functionality.
## Initial Steps
1. Create a github account if you don't have one already
http://github.com
1. Fork the apache-artemis repository into your account
https://github.com/apache/activemq-artemis
1. Clone your newly forked copy onto your local workspace:
$ git clone git@github.com:<your-user-name>/activemq-artemis.git
Cloning into 'activemq-artemis'...
remote: Counting objects: 63800, done.
remote: Compressing objects: 100% (722/722), done.
remote: Total 63800 (delta 149), reused 0 (delta 0), pack-reused 62748
Receiving objects: 100% (63800/63800), 18.28 MiB | 3.16 MiB/s, done.
Resolving deltas: 100% (28800/28800), done.
Checking connectivity... done.
$ cd activemq-artemis
1. Add a remote reference to `upstream` for pulling future updates
$ git remote add upstream https://github.com/apache/activemq-artemis
1. Build with Maven
Typically developers will want to build using the `dev` profile which disables license and code style checks. For
example:
$ mvn -Pdev install
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ActiveMQ Artemis Parent ........................... SUCCESS [2.298s]
[INFO] ActiveMQ Artemis Commons .......................... SUCCESS [1.821s]
[INFO] ActiveMQ Artemis Selector Implementation .......... SUCCESS [0.767s]
[INFO] ActiveMQ Artemis Native POM ....................... SUCCESS [0.189s]
[INFO] ActiveMQ Artemis Journal .......................... SUCCESS [0.646s]
[INFO] ActiveMQ Artemis Core Client ...................... SUCCESS [5.969s]
[INFO] ActiveMQ Artemis JMS Client ....................... SUCCESS [2.110s]
[INFO] ActiveMQ Artemis Server ........................... SUCCESS [11.540s]
...
[INFO] ActiveMQ Artemis stress Tests ..................... SUCCESS [0.332s]
[INFO] ActiveMQ Artemis performance Tests ................ SUCCESS [0.174s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
## Typical development cycle
1. Identify a task (e.g. a bug to fix or feature to implement)
https://issues.apache.org/jira/browse/ACTIVEMQ6
1. Create a topic branch in your local git repo to do your work
$ git checkout -b my_cool_feature
1. Make the changes and commit one or more times
$ git commit
<a name="commitMessageDetails"></a> When you commit your changes you will need to supply a commit message. We follow the
50/72 git commit message format. An ActiveMQ Artemis commit message should be formatted in the following manner:
1. Add the ACTIVEMQ6 JIRA (if one exists) followed by a brief description of the change in the first line. This line
should be limited to 50 characters.
1. Insert a single blank line after the first line.
1. Provide a detailed description of the change in the following lines, breaking paragraphs where needed. These lines
should be wrapped at 72 characters.
An example correctly formatted commit message:
ACTIVEMQ6-123 Add new commit msg format to README
Adds a description of the new commit message format as well as examples
of well formatted commit messages to the README.md. This is required
to enable developers to quickly identify what the commit is intended to
do and why the commit was added.
1. Occasionally you'll want to push your commit(s) to GitHub for safe-keeping and/or sharing with others.
git push origin my_cool_feature
Note that git push references the branch you are pushing and defaults to `master`, not your working branch.
1. Discuss your planned changes (if you want feedback)
On mailing list - http://activemq.apache.org/mailing-lists.html
On IRC - irc://irc.freenode.org/apache-activemq or https://webchat.freenode.net/?channels=apache-activemq
1. Once you're finished coding your feature/fix then rebase your branch against the latest master (applies your patches
on top of master)
git fetch upstream
git rebase -i upstream/master
# if you have conflicts fix them and rerun rebase
# The -f, forces the push, alters history, see note below
git push -f origin my_cool_feature
The `rebase -i` triggers an interactive update which also allows you to combine commits, alter commit messages etc.
It's a good idea to make the commit log very nice for external consumption (e.g. by squashing all related commits
into a single commit. Note that rebasing and/or using `push -f` can alter history. While this is great for making a
clean patch, it is unfriendly to anyone who has forked your branch. Therefore you'll want to make sure that you
either work in a branch that you don't share, or if you do share it, tell them you are about to revise the branch
history (and thus, they will then need to rebase on top of your branch once you push it out).
1. Get your changes merged into upstream
1. Send a github pull request, by clicking the pull request link while in your repo's fork.
1. An email will automatically be sent to the ActiveMQ developer list.
1. As part of the review you may see an automated test run comment on your request.
1. After review a maintainer will merge your PR into the canonical git repository at which point those changes will
be synced with the GitHub mirror repository (i.e. your `master`) and your PR will be closed by the `asfgit` bot.
## Other common tasks
1. Pulling updates from upstream
$ git pull --rebase upstream master
(`--rebase` will automatically move your local commits, if any, on top of the latest branch you pull from; you can leave
it off if you do not have any local commits).
One last option, which some prefer, is to avoid using pull altogether, and just use fetch + rebase (this is of course
more typing). For example:
$ git fetch upstream
$ git pull
1. Pushing pulled updates (or local commits if you aren't using topic branches) to your private github repo (origin)
$ git push
Counting objects: 192, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (44/44), done.
Writing objects: 100% (100/100), 10.67 KiB, done.
Total 100 (delta 47), reused 100 (delta 47)
To git@github.com:<your-user-name>/apache-artemis.git
3382570..1fa25df master -> master
You might need to say -f to force the changes.
## Adding New Dependencies
Due to incompatibilities between some open source licenses and the Apache v2.0 license (that this project is licensed under)
care must be taken when adding new dependencies to the project. The Apache Software Foundation 3rd party licensing
policy has more information here: http://www.apache.org/legal/3party.html
To keep track of all licenses in ActiveMQ Artemis, new dependencies must be added in either the top level pom.xml or in test/pom.xml
(depending on whether this is a test only dependency or if it is used in the main code base). The dependency should be
added under the dependency management section with version and labelled with a comment highlighting the license for the
dependency version. See existing dependencies in the main pom.xml for examples. The dependency can then be added to
individual ActiveMQ Artemis modules *without* the version specified (the version is implied from the dependency management
section of the top level pom). This allows ActiveMQ Artemis developers to keep track of all dependencies and licenses.

View File

@ -0,0 +1,11 @@
# Code Formatting
Eclipse code formatting and (basic) project configuration files can be found at the `etc/` folder. You should manually
copy them _after importing all your projects_:
for settings_dir in `find . -type d -name .settings`; do
\cp -v etc/org.eclipse.jdt.* $settings_dir
done
Do not use the [maven-eclipse-plugin](https://maven.apache.org/plugins/maven-eclipse-plugin/) to copy the files as it
conflicts with [m2e](http://eclipse.org/m2e/).

View File

@ -0,0 +1,79 @@
# IDE Integration
## IntelliJ IDEA
### Importing the Project
The following steps show how to import ActiveMQ Artemis source into IntelliJ IDEA and setup the correct maven profile to allow
running of JUnit tests from within the IDE. (Steps are based on version: 13.1.4)
* File --> Import Project --> Select the root directory of the ActiveMQ Artemis source folder. --> Click OK
This should open the import project wizard. From here:
* Select "Import from existing model" toggle box, then select Maven from the list box below. Click Next.
* Leave the defaults set on this page and click next.
* On the "Select profiles page", select the checkbox next to "dev" and click next.
* From here the default settings should suffice. Continue through the wizard, clicking next until the wizard is complete.
Once the project has been imported and IDEA has caught up importing all the relevant dependencies, you should be able to
run JUnit tests from with the IDE. Select any test class in the tests -> integration tests folder. Right click on the
class in the project tab and click "Run <classname>". If the "Run <classname>" option is present then you're all set to go.
### Style Templates for Idea
We have shared the style templates that are good for this project. If you want to apply them use these steps:
* File->Import Settings
* Select the file under ./artemis-cloned-folder/etc/IDEA-style.jar
* Select both Code Style Templates and File templates (it's the default option)
* Select OK and restart Idea
### Issue: My JUnit tests are not runnable with in the IDE.
If the "Run <classname>" or "Run all tests" option is not present. It is likely that the default profile has not been
imported properly. To (re)import the "tests" Maven profile in an existing project.
* Open the Maven Projects Tool Window: View -> Tool Windows -> Maven Projects
* Select the "profiles" drop down
* Unselect then reselect the checkbox next to "tests".
* Click on the "Reimport all maven projects" button in the top left hand corner of the window. (It looks like a ciruclar
blue arrow.
* Wait for IDEA to reload and try running a JUnit test again. The option to run should now be present.
## Eclipse
We recommend using Eclipse Kepler (4.3), due to the built-in support for Maven and Git. Note that there are still some
Maven plugins used by sub-projects (e.g. documentation) which are not supported even in Eclipse Kepler (4.3).
Eclipse [m2e](http://eclipse.org/m2e/) is already included in "Eclipse IDE for Java Developers", or it can be installed
from [Eclipse Kepler release repository](http://download.eclipse.org/releases/kepler).
### Annotation Pre-Processing
ActiveMQ Artemis uses [JBoss Logging](https://community.jboss.org/wiki/JBossLoggingTooling) and that requires source
code generation from Java annotations. In order for it to 'just work' in Eclipse you need to install the
_Maven Integration for Eclipse JDT Annotation Processor Toolkit_ [m2e-apt](https://github.com/jbosstools/m2e-apt). See
this [JBoss blog post](https://community.jboss.org/en/tools/blog/2012/05/20/annotation-processing-support-in-m2e-or-m2e-apt-100-is-out)
for details.
### M2E Connector for Javacc-Maven-Plugin
Eclipse Indigo (3.7) has out-of-the-box support for it.
As of this writing, Eclipse Kepler (4.3) still lacks support for Maven's javacc plugin. The available [m2e connector for
javacc-maven-plugin](https://github.com/objectledge/maven-extensions) requires a downgrade of Maven components to be
installed. manual installation instructions (as of this writing you need to use the development update site). See
[this post](http://dev.eclipse.org/mhonarc/lists/m2e-users/msg02725.html) for how to do this with Eclipse Juno (4.2).
The current recommended solution for Eclipse Kepler is to mark `javacc-maven-plugin` as ignored by Eclipse, run Maven
from the command line and then modify the project `activemq-core-client` adding the folder
`target/generated-sources/javacc` to its build path.
### Use _Project Working Sets_
Importing all ActiveMQ Artemis subprojects will create _too many_ projects in Eclipse, cluttering your _Package Explorer_
and _Project Explorer_ views. One way to address that is to use
[Eclipse's Working Sets](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fcworkset.htm)
feature. A good introduction to it can be found at a
[Dzone article on Eclipse Working Sets](http://eclipse.dzone.com/articles/categorise-projects-package).

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,90 @@
# Notes for Maintainers
Core ActiveMQ Artemis members have write access to the Apache ActiveMQ Artemis repositories and will be responsible for
acknowledging and pushing commits contributed via pull requests on GitHub.
## Commit Messages
Please ensure the commit messages follow the 50/72 format as described [here](code.md#commitMessageDetails).
## Configuring git repositories
Aside from the traditional `origin` and `upstream` repositories committers will need an additional reference for the
canonical Apache git repository where they will be merging and pushing pull-requests. For the purposes of this document,
let's assume these ref/repo associations already exist as described in the [Working with the Code](code.md) section:
- `origin` : https://github.com/(your-user-name)/activemq-artemis.git
- `upstream` : https://github.com/apache/activemq-artemis
1. Add the canonical Apache repository as a remote. Here we call it `apache`.
$ git remote add apache https://git-wip-us.apache.org/repos/asf/activemq-artemis.git
1. Add the following section to your <artemis-repo>/.git/config statement to fetch all pull requests sent to the GitHub
mirror. We are using `upstream` as the remote repo name (as noted above), but the remote repo name may be different
if you choose. Just be sure to edit all references to the remote repo name so it's consistent.
[remote "upstream"]
url = git@github.com:apache/activemq-artemis.git
fetch = +refs/heads/*:refs/remotes/upstream/*
fetch = +refs/pull/*/head:refs/remotes/upstream/pr/*
## Merging and pushing pull requests
Here are the basic commands to retrieve pull requests, merge, and push them to the canonical Apache repository:
1. Download all the remote branches etc... including all the pull requests.
$ git fetch --all
Fetching origin
Fetching upstream
remote: Counting objects: 566, done.
remote: Compressing objects: 100% (188/188), done.
remote: Total 566 (delta 64), reused 17 (delta 17), pack-reused 351
Receiving objects: 100% (566/566), 300.67 KiB | 0 bytes/s, done.
Resolving deltas: 100% (78/78), done.
From github.com:apache/activemq-artemis
* [new ref] refs/pull/105/head -> upstream/pr/105
1. Checkout the pull request you wish to review
$ git checkout pr/105
1. Once you've reviewed the change and are ready to merge checkout `master`.
$ git checkout master
1. Ensure you are up to date
$ git pull
1. Create a new merge commit from the pull-request. IMPORTANT: The commit message here should be something like: "This
closes #105" where "105" is the pull request ID. The "#105" shows up as a link in the GitHub UI for navigating to
the PR from the commit message.
$ git merge --no-ff pr/105
1. Push to the canonical Apache repo.
$ git push apache master
#### Notes:
The GitHub mirror repository (i.e. `upstream`) is cloning the canonical Apache repository. Because of this there may be
a slight delay between when a commit is pushed to the Apache repo and when that commit is reflected in the GitHub mirror.
This may cause some difficulty when trying to push a PR to `apache` that has been merged on the out-of-date GitHub mirror.
You can wait for the mirror to update before performing the steps above or you can change your local master branch to
track the master branch on the canonical Apache repository rather than the master branch on the GitHub mirror:
$ git branch master -u apache/master
Where `apache` points to the canonical Apache repository.
If you'd like your local master branch to always track `upstream/master` (i.e. the GitHub mirror) then another way to
achieve this is to add another branch that tracks `apache/master` and push from that branch e.g.
$ git checkout master
$ git branch apache_master --track apache/master
$ git pull
$ git merge --no-ff pr/105
$ git push

View File

@ -0,0 +1,17 @@
Legal Notice
============
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.

View File

@ -0,0 +1,27 @@
# Tests
## Running Tests
To run the unit tests:
$ mvn -Ptests test
Generating reports from unit tests:
$ mvn install site
Running tests individually
$ mvn -Ptests -DfailIfNoTests=false -Dtest=<test-name> test
where &lt;test-name> is the name of the Test class without its package name
## Writing Tests
The broker is comprised of POJOs so it's simple to configure and run a broker instance and test particular functionality.
Even complex test-cases involving multiple clustered brokers are relatively easy to write. Almost every test in the
test-suite follows this pattern - configure broker, start broker, test functionality, stop broker.
The test-suite uses JUnit to manage test execution and life-cycle. Most tests extend [org.apache.activemq.artemis.tests.util.ServiceTestBase](../../../artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ServiceTestBase.java)
which contains JUnit setup and tear-down methods as well as a wealth of utility functions to configure, start, manage,
and stop brokers as well as perform other common tasks.

View File

@ -949,8 +949,8 @@
<exclude>**/*.txt</exclude>
<exclude>**/*.md</exclude>
<exclude>etc/org.eclipse.*</exclude>
<exclude>docs/user-manual/en/*.json</exclude>
<exclude>docs/user-manual/en/_book/</exclude>
<exclude>docs/**/*.json</exclude>
<exclude>docs/**/_book/</exclude>
<exclude>**/target/</exclude>
<exclude>**/META-INF/services/*</exclude>
<exclude>**/*.iml</exclude>

View File

@ -179,7 +179,8 @@ public class ClosingConnectionTest extends ServiceTestBase
private ActiveMQServer newActiveMQServer() throws Exception
{
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()), mBeanServer);
ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()));
server.setMBeanServer(mBeanServer);
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(10 * 1024);

View File

@ -60,12 +60,12 @@ import org.apache.activemq.artemis.jms.server.JMSServerManager;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.unit.util.InVMNamingContext;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
public abstract class BridgeTestBase extends UnitTestCase
public abstract class BridgeTestBase extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -392,7 +392,7 @@ public abstract class BridgeTestBase extends UnitTestCase
if (largeMessage)
{
BytesMessage msg = sess.createBytesMessage();
((ActiveMQMessage) msg).setInputStream(UnitTestCase.createFakeLargeStream(1024L * 1024L));
((ActiveMQMessage) msg).setInputStream(ServiceTestBase.createFakeLargeStream(1024L * 1024L));
msg.setStringProperty("msg", "message" + i);
prod.send(msg);
}

View File

@ -16,34 +16,31 @@
*/
package org.apache.activemq.artemis.tests.integration;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.apache.activemq.artemis.api.core.ActiveMQDuplicateIdException;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
public class DuplicateDetectionTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -57,7 +54,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testSimpleDuplicateDetecion() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -165,7 +162,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
{
final int TEST_SIZE = 100;
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnNonDurableSend(true);
@ -242,7 +239,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testSimpleDuplicateDetectionWithString() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -313,7 +310,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testCacheSize() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -473,7 +470,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection1() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -526,7 +523,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection2() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -573,7 +570,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testTransactedDuplicateDetection3() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -639,7 +636,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testRollbackThenSend() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -688,7 +685,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testEntireTransactionRejected() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -784,7 +781,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection1() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -864,7 +861,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection2() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -946,7 +943,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection3() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1027,7 +1024,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetectionPrepareAndRollback() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1100,7 +1097,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetectionPrepareAndRollbackStopServer() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1187,7 +1184,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
@Test
public void testXADuplicateDetection4() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1296,7 +1293,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1383,7 +1380,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1465,7 +1462,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1558,7 +1555,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1659,7 +1656,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1745,7 +1742,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1834,7 +1831,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -1954,7 +1951,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -2057,7 +2054,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);
@ -2158,7 +2155,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
messagingService2.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = createSessionFactory(locator);

View File

@ -33,7 +33,7 @@ import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
*
@ -43,7 +43,7 @@ import org.apache.activemq.artemis.tests.util.UnitTestCase;
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4806007
* http://jira.jboss.com/jira/browse/JBAS-2641
*/
public class String64KLimitTest extends UnitTestCase
public class String64KLimitTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -17,32 +17,23 @@
package org.apache.activemq.artemis.tests.integration.aerogear;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ConnectorServiceConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConnectorServiceFactory;
import org.apache.activemq.artemis.integration.aerogear.AeroGearConstants;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONException;
import org.apache.activemq.artemis.utils.json.JSONObject;
@ -54,6 +45,14 @@ import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.AbstractHandler;
import org.mortbay.jetty.nio.SelectChannelConnector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class AeroGearBasicServerTest extends ServiceTestBase
{
@ -128,7 +127,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
CountDownLatch latch = new CountDownLatch(1);
AeroGearHandler aeroGearHandler = new AeroGearHandler(latch);
jetty.addHandler(aeroGearHandler);
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -277,7 +276,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -331,7 +330,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@ -369,7 +368,7 @@ public class AeroGearBasicServerTest extends ServiceTestBase
}
});
TransportConfiguration tpconf = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY);
TransportConfiguration tpconf = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
locator = ActiveMQClient.createServerLocatorWithoutHA(tpconf);
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);

View File

@ -15,13 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Interceptor;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -29,7 +24,6 @@ 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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -41,14 +35,16 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
*
* From https://jira.jboss.org/jira/browse/HORNETQ-144
*
*/
public class ActiveMQCrashTest extends UnitTestCase
public class ActiveMQCrashTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -156,7 +152,6 @@ public class ActiveMQCrashTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
addServerLocator(locator);
locator = createInVMNonHALocator();
}
}

View File

@ -62,7 +62,7 @@ public class ConcurrentCreateDeleteProduceTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false)
.setJournalSyncTransactional(false);

View File

@ -16,9 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.SimpleString;
@ -28,10 +25,8 @@ 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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
@ -44,6 +39,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class ConsumerCloseTest extends ServiceTestBase
{
@ -72,7 +70,7 @@ public class ConsumerCloseTest extends ServiceTestBase
Assert.assertTrue(consumer.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -80,7 +78,7 @@ public class ConsumerCloseTest extends ServiceTestBase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -88,7 +86,7 @@ public class ConsumerCloseTest extends ServiceTestBase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -314,9 +312,7 @@ public class ConsumerCloseTest extends ServiceTestBase
address = RandomUtil.randomSimpleString();
queue = RandomUtil.randomSimpleString();
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);

View File

@ -17,19 +17,17 @@
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.Test;
@ -59,7 +57,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTest() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
locator.setConnectionTTL(1000);
locator.setClientFailureCheckPeriod(100);
locator.setConsumerWindowSize(10 * 1024 * 1024);
@ -170,7 +168,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void testClientStuckTestWithDirectDelivery() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
locator.setConnectionTTL(1000);
locator.setClientFailureCheckPeriod(100);
locator.setConsumerWindowSize(10 * 1024 * 1024);
@ -228,7 +226,7 @@ public class ConsumerStuckTest extends ServiceTestBase
public void run()
{
try (
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
ServerLocator locator = createNettyNonHALocator();
ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = factory.createSession(false, true, true, true);
ClientProducer producer = session.createProducer(QUEUE);

View File

@ -15,27 +15,17 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -46,7 +36,14 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class DeadLetterAddressTest extends ServiceTestBase
{
@ -512,7 +509,7 @@ public class DeadLetterAddressTest extends ServiceTestBase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -523,7 +520,7 @@ public class DeadLetterAddressTest extends ServiceTestBase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = addClientSession(sessionFactory.createSession(false, true, false));
}

View File

@ -15,31 +15,28 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.message.impl.MessageImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ExpiryAddressTest extends ServiceTestBase
{
@ -236,7 +233,7 @@ public class ExpiryAddressTest extends ServiceTestBase
clientSession.createQueue(qName, qName, null, false);
ServerLocator locator1 =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator1);
@ -388,7 +385,7 @@ public class ExpiryAddressTest extends ServiceTestBase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)

View File

@ -93,7 +93,7 @@ public class HangConsumerTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
.setMessageExpiryScanPeriod(10);
ActiveMQSecurityManager securityManager = new ActiveMQSecurityManagerImpl();

View File

@ -15,21 +15,6 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import java.util.HashMap;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -42,8 +27,18 @@ import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
public class HeuristicXATest extends ServiceTestBase
{
@ -70,7 +65,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(false, configuration);
server.setMBeanServer(mbeanServer);
server.start();
ActiveMQServerControl jmxServer = ManagementControlHelper.createActiveMQServerControl(mbeanServer);
@ -95,7 +91,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(false, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(false, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -190,7 +187,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -290,7 +288,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();
@ -399,7 +398,8 @@ public class HeuristicXATest extends ServiceTestBase
Configuration configuration = createDefaultConfig()
.setJMXManagementEnabled(true);
ActiveMQServer server = createServer(true, configuration, mbeanServer, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, configuration);
server.setMBeanServer(mbeanServer);
server.start();
Xid xid = newXID();

View File

@ -261,7 +261,7 @@ public class IncompatibleVersionTest extends ServiceTestBase
}
}
private static class ClientStarter
private class ClientStarter
{
public void perform() throws Exception
{
@ -269,7 +269,7 @@ public class IncompatibleVersionTest extends ServiceTestBase
ClientSessionFactory sf = null;
try
{
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY));
locator = createNettyNonHALocator();
sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
log.info("### client: connected. server incrementingVersion = " + session.getVersion());
@ -284,6 +284,12 @@ public class IncompatibleVersionTest extends ServiceTestBase
}
public static void main(String[] args) throws Exception
{
IncompatibleVersionTest incompatibleVersionTest = new IncompatibleVersionTest();
incompatibleVersionTest.execute(args);
}
private void execute(String[] args) throws Exception
{
if (args[0].equals("server"))
{

View File

@ -38,7 +38,7 @@ import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.largemessage.LargeMessageTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.filter.Filter;
import org.apache.activemq.artemis.core.paging.cursor.PageSubscription;
import org.apache.activemq.artemis.core.persistence.StorageManager;
@ -128,7 +128,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
server.stop(false);
UnitTestCase.forceGC();
ServiceTestBase.forceGC();
server.start();
@ -261,7 +261,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
}
clientMessage.acknowledge();
}
@ -340,7 +340,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase
Assert.assertNotNull(clientMessage);
for (int countByte = 0; countByte < LARGE_MESSAGE_SIZE; countByte++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(countByte), clientMessage.getBodyBuffer().readByte());
}
clientMessage.acknowledge();
}

View File

@ -16,6 +16,22 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import javax.jms.BytesMessage;
import javax.jms.Connection;
import javax.jms.DeliveryMode;
@ -26,22 +42,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.junit.Assert;
import org.junit.Test;
/**
* -- https://issues.jboss.org/browse/HORNETQ-746
* Stress test using netty with NIO and many JMS clients concurrently, to try
@ -92,7 +92,11 @@ public class JmsNettyNioStressTest extends ServiceTestBase
// minimize threads to maximize possibility for deadlock
params.put(TransportConstants.NIO_REMOTING_THREADS_PROPNAME, 1);
params.put(TransportConstants.BATCH_DELAY, 50);
Configuration config = createDefaultConfig(params, ServiceTestBase.NETTY_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.NETTY_ACCEPTOR_FACTORY, params);
Configuration config = createBasicConfig(-1)
.setJMXManagementEnabled(false)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(transportConfig);
ActiveMQServer server = createServer(true, config);
server.getConfiguration().setThreadPoolMaxSize(2);
server.start();

View File

@ -25,7 +25,7 @@ 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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.junit.Assert;
@ -350,7 +350,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}
@ -375,7 +375,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}
@ -394,7 +394,7 @@ public class LargeMessageAvoidLargeMessagesTest extends LargeMessageTest
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1
.getBodyBuffer().readByte());
}

View File

@ -49,7 +49,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -489,7 +489,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.close();
@ -513,7 +513,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -530,7 +530,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -579,7 +579,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
session.rollback();
@ -594,7 +594,7 @@ public class LargeMessageTest extends LargeMessageTestBase
msg.acknowledge();
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
Assert.assertEquals(2, msg.getDeliveryCount());
msg.acknowledge();
@ -662,7 +662,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -680,7 +680,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -704,7 +704,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.commit();
@ -778,7 +778,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -795,7 +795,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int j = 0; j < messageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), msg1.getBodyBuffer().readByte());
}
session.rollback();
@ -824,7 +824,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.commit();
@ -891,7 +891,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
session.close();
@ -915,7 +915,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < messageSize; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg1.getBodyBuffer().readByte());
}
msg1.acknowledge();
@ -1195,7 +1195,7 @@ public class LargeMessageTest extends LargeMessageTestBase
assertNotNull(msg);
for (long i = 0; i < messageSize; i++)
{
Assert.assertEquals("position " + i, UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals("position " + i, ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
}
@ -2447,7 +2447,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile);
}
@ -2480,7 +2480,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{
for (int byteRead = 0; byteRead < SIZE; byteRead++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
}
}
@ -2551,7 +2551,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
producer.send(clientFile);
}
@ -2583,7 +2583,7 @@ public class LargeMessageTest extends LargeMessageTestBase
{
for (int byteRead = 0; byteRead < SIZE; byteRead++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(byteRead), msg.getBodyBuffer().readByte());
}
}
@ -2910,7 +2910,7 @@ public class LargeMessageTest extends LargeMessageTestBase
session.createQueue(ADDRESS, ADDRESS, null, true);
ClientMessage clientFile = session.createMessage(true);
clientFile.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
clientFile.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
ClientProducer producer = session.createProducer(ADDRESS);
@ -2989,7 +2989,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage msg = session.createMessage(true);
msg.setBodyInputStream(UnitTestCase.createFakeLargeStream(SIZE));
msg.setBodyInputStream(ServiceTestBase.createFakeLargeStream(SIZE));
msg.putIntProperty(new SimpleString("key"), i);
producer.send(msg);
@ -3047,7 +3047,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{
fileMessage.addBytes(new byte[]{UnitTestCase.getSamplebyte(i)});
fileMessage.addBytes(new byte[]{ServiceTestBase.getSamplebyte(i)});
}
// The server would be doing this
@ -3077,7 +3077,7 @@ public class LargeMessageTest extends LargeMessageTestBase
for (int i = 0; i < LARGE_MESSAGE_SIZE; i++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(i), msg.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(i), msg.getBodyBuffer().readByte());
}
msg.acknowledge();

View File

@ -19,7 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.junit.Test;
import org.apache.activemq.artemis.core.asyncio.impl.AsynchronousFileImpl;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
* This tests is placed in duplication here to validate that the libaio module is properly loaded on this
@ -27,7 +27,7 @@ import org.apache.activemq.artemis.tests.util.UnitTestCase;
*
* This test should be placed on each one of the tests modules to make sure the library is loaded correctly.
*/
public class LibaioDependencyCheckTest extends UnitTestCase
public class LibaioDependencyCheckTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -25,7 +25,6 @@ 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.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
@ -150,7 +149,7 @@ public class MessageDurabilityTest extends ServiceTestBase
session.start();
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -178,7 +177,7 @@ public class MessageDurabilityTest extends ServiceTestBase
restart();
session.start();
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, new ActiveMQAction()
{
public void run() throws ActiveMQException
{

View File

@ -15,34 +15,31 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class MessageGroupingConnectionFactoryTest extends UnitTestCase
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class MessageGroupingConnectionFactoryTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -121,7 +118,7 @@ public class MessageGroupingConnectionFactoryTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)

View File

@ -15,40 +15,37 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
public class MessageGroupingTest extends UnitTestCase
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class MessageGroupingTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -282,7 +279,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingTXCommit() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(false, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
@ -343,7 +340,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingTXRollback() throws Exception
{
log.info("*** starting test");
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(false, false, false);
@ -419,7 +416,7 @@ public class MessageGroupingTest extends UnitTestCase
private void dotestMultipleGroupingXACommit() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(true, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
@ -479,7 +476,7 @@ public class MessageGroupingTest extends UnitTestCase
private void doTestMultipleGroupingXARollback() throws Exception
{
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession clientSession = sessionFactory.createSession(true, false, false);
@ -611,7 +608,7 @@ public class MessageGroupingTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -623,7 +620,7 @@ public class MessageGroupingTest extends UnitTestCase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
clientSessionFactory = createSessionFactory(locator);
clientSession = addClientSession(clientSessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false);

View File

@ -18,12 +18,12 @@ package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
@ -32,12 +32,11 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class MessagePriorityTest extends UnitTestCase
public class MessagePriorityTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -164,7 +164,7 @@ public class MultipleThreadFilterOneTest extends ServiceTestBase
for (int i = 0; i < numberOfMessages; i++)
{
ClientMessage msg = consumer.receive(5000);
ClientMessage msg = consumer.receive(15000);
Assert.assertNotNull(msg);
Assert.assertEquals(nr, msg.getIntProperty("prodNR").intValue());
msg.acknowledge();

View File

@ -16,23 +16,12 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
@ -42,9 +31,18 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Test;
public class NIOvsOIOTest extends UnitTestCase
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
public class NIOvsOIOTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -85,7 +83,7 @@ public class NIOvsOIOTest extends UnitTestCase
List<ClientSessionFactory> factories = new ArrayList<ClientSessionFactory>();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
for (int i = 0; i < numReceivers; i++)
{

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -42,7 +42,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
*
* A NewDeadLetterAddressTest
*/
public class NewDeadLetterAddressTest extends UnitTestCase
public class NewDeadLetterAddressTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -75,7 +75,7 @@ public class NewDeadLetterAddressTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setSecurityEnabled(false)
@ -86,7 +86,7 @@ public class NewDeadLetterAddressTest extends UnitTestCase
// then we create a client as normal
locator =
addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(
UnitTestCase.INVM_CONNECTOR_FACTORY)));
INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, false);
}

View File

@ -800,7 +800,8 @@ public class PagingOrderTest extends ServiceTestBase
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false);
ActiveMQServer server = createServer(true, config, -1, -1, AddressFullMessagePolicy.BLOCK, new HashMap<String, AddressSettings>());
ActiveMQServer server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
JMSServerManagerImpl jmsServer = new JMSServerManagerImpl(server);
InVMNamingContext context = new InVMNamingContext();
@ -857,7 +858,8 @@ public class PagingOrderTest extends ServiceTestBase
jmsServer.stop();
server = createServer(true, config, -1, -1, AddressFullMessagePolicy.BLOCK, new HashMap<String, AddressSettings>());
server = createServer(true, config, -1, -1, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
jmsServer = new JMSServerManagerImpl(server);
context = new InVMNamingContext();

View File

@ -16,23 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
@ -46,9 +29,6 @@ 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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.DivertConfiguration;
@ -76,10 +56,29 @@ import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
public class PagingTest extends ServiceTestBase
{
private ServerLocator locator;
@ -1236,12 +1235,8 @@ public class PagingTest extends ServiceTestBase
Configuration config = createDefaultConfig()
.setJournalSyncNonTransactional(false);
server = createServer(true,
config,
PagingTest.PAGE_SIZE,
PagingTest.PAGE_MAX,
AddressFullMessagePolicy.BLOCK,
new HashMap<String, AddressSettings>());
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX, new HashMap<String, AddressSettings>());
server.getAddressSettingsRepository().getMatch("#").setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
server.start();
@ -2342,8 +2337,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2541,8 +2536,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2694,8 +2689,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;
@ -2713,7 +2708,7 @@ public class PagingTest extends ServiceTestBase
buffer.readBytes(other);
UnitTestCase.assertEqualsByteArrays(body, other);
ServiceTestBase.assertEqualsByteArrays(body, other);
}
/**
@ -3360,7 +3355,7 @@ public class PagingTest extends ServiceTestBase
for (int j = 0; j < numberOfBytes; j++)
{
body[j] = UnitTestCase.getSamplebyte(j);
body[j] = ServiceTestBase.getSamplebyte(j);
}
long scheduledTime = System.currentTimeMillis() + 5000;
@ -3429,8 +3424,8 @@ public class PagingTest extends ServiceTestBase
}
catch (AssertionError e)
{
PagingTest.log.info("Expected buffer:" + UnitTestCase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + UnitTestCase.dumbBytesHex(message2.getBodyBuffer()
PagingTest.log.info("Expected buffer:" + ServiceTestBase.dumbBytesHex(body, 40));
PagingTest.log.info("Arriving buffer:" + ServiceTestBase.dumbBytesHex(message2.getBodyBuffer()
.toByteBuffer()
.array(), 40));
throw e;

View File

@ -15,16 +15,9 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientProducer;
import org.apache.activemq.artemis.api.core.client.ClientSession;
@ -34,6 +27,10 @@ import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ProducerCloseTest extends ServiceTestBase
{
@ -54,7 +51,7 @@ public class ProducerCloseTest extends ServiceTestBase
Assert.assertTrue(producer.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{

View File

@ -16,13 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -32,7 +25,6 @@ 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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientProducerCreditManagerImpl;
import org.apache.activemq.artemis.core.client.impl.ClientProducerCredits;
import org.apache.activemq.artemis.core.client.impl.ClientProducerInternal;
@ -48,6 +40,13 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class ProducerFlowControlTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -274,7 +273,7 @@ public class ProducerFlowControlTest extends ServiceTestBase
message.getBodyBuffer().readBytes(bytesRead);
UnitTestCase.assertEqualsByteArrays(bytes, bytesRead);
ServiceTestBase.assertEqualsByteArrays(bytes, bytesRead);
message.acknowledge();

View File

@ -52,7 +52,7 @@ public class ReceiveImmediateTest extends ServiceTestBase
{
super.setUp();
Configuration config = createDefaultConfig(false);
Configuration config = createDefaultConfig();
server = createServer(false, config);
server.start();
locator = createInVMNonHALocator();

View File

@ -27,7 +27,6 @@ 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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientMessageImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
@ -214,7 +213,7 @@ public class RequestorTest extends ServiceTestBase
}
};
UnitTestCase.expectActiveMQException("ClientRequestor's session must not be closed",
ServiceTestBase.expectActiveMQException("ClientRequestor's session must not be closed",
ActiveMQExceptionType.OBJECT_CLOSED,
activeMQAction);
}
@ -258,7 +257,7 @@ public class RequestorTest extends ServiceTestBase
}
};
UnitTestCase.expectActiveMQException("can not send a request on a closed ClientRequestor",
ServiceTestBase.expectActiveMQException("can not send a request on a closed ClientRequestor",
ActiveMQExceptionType.OBJECT_CLOSED, activeMQAction);
}

View File

@ -24,11 +24,10 @@ 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.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
@ -118,7 +117,7 @@ public class SelfExpandingBufferTest extends ServiceTestBase
msg2.getBodyBuffer().readBytes(receivedBytes);
UnitTestCase.assertEqualsByteArrays(bytes, receivedBytes);
ServiceTestBase.assertEqualsByteArrays(bytes, receivedBytes);
msg2 = cons.receive(3000);
@ -126,7 +125,7 @@ public class SelfExpandingBufferTest extends ServiceTestBase
msg2.getBodyBuffer().readBytes(receivedBytes);
UnitTestCase.assertEqualsByteArrays(bytes, receivedBytes);
ServiceTestBase.assertEqualsByteArrays(bytes, receivedBytes);
}
finally
{

View File

@ -16,19 +16,18 @@
*/
package org.apache.activemq.artemis.tests.integration.client;
import java.lang.ref.WeakReference;
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.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.lang.ref.WeakReference;
public class SessionCloseOnGCTest extends ServiceTestBase
{
private ActiveMQServer server;
@ -70,7 +69,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
@ -78,7 +77,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -103,7 +102,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
@ -111,7 +110,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -134,13 +133,13 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -160,13 +159,13 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
ServiceTestBase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new WeakReference<ClientSessionFactory>(factory);
factory = null;
UnitTestCase.checkWeakReferences(fref, wrs1, wrs2);
ServiceTestBase.checkWeakReferences(fref, wrs1, wrs2);
}
@Test
@ -181,7 +180,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
locator.close();
locator = null;
UnitTestCase.checkWeakReferences(fref);
ServiceTestBase.checkWeakReferences(fref);
}
@Test
@ -197,7 +196,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
session = null;
UnitTestCase.checkWeakReferences(wses);
ServiceTestBase.checkWeakReferences(wses);
Assert.assertEquals(0, sf.numSessions());
Assert.assertEquals(1, sf.numConnections());
@ -223,7 +222,7 @@ public class SessionCloseOnGCTest extends ServiceTestBase
session2 = null;
session3 = null;
UnitTestCase.checkWeakReferences(ref1, ref2, ref3);
ServiceTestBase.checkWeakReferences(ref1, ref2, ref3);
int count = 0;
final int TOTAL_SLEEP_TIME = 400;

View File

@ -15,34 +15,31 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class SessionCloseTest extends UnitTestCase
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
public class SessionCloseTest extends ServiceTestBase
{
// Constants -----------------------------------------------------
@ -69,7 +66,7 @@ public class SessionCloseTest extends UnitTestCase
Assert.assertTrue(session.isClosed());
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -77,7 +74,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -85,7 +82,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -95,7 +92,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -103,7 +100,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -111,7 +108,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -119,7 +116,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -127,7 +124,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -135,7 +132,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -143,7 +140,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
ServiceTestBase.expectActiveMQException(ActiveMQExceptionType.OBJECT_CLOSED, new ActiveMQAction()
{
public void run() throws ActiveMQException
{
@ -164,7 +161,7 @@ public class SessionCloseTest extends UnitTestCase
Assert.assertTrue(session.isXA());
Assert.assertTrue(session.isClosed());
UnitTestCase.expectXAException(XAException.XA_RETRY, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XA_RETRY, new ActiveMQAction()
{
public void run() throws XAException
{
@ -172,7 +169,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -180,7 +177,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -188,7 +185,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -196,7 +193,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -204,7 +201,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -212,7 +209,7 @@ public class SessionCloseTest extends UnitTestCase
}
});
UnitTestCase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
ServiceTestBase.expectXAException(XAException.XAER_RMERR, new ActiveMQAction()
{
public void run() throws XAException
{
@ -260,7 +257,7 @@ public class SessionCloseTest extends UnitTestCase
server.start();
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ServerLocator locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
}

View File

@ -37,7 +37,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.SingleServerTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.client.impl.ClientProducerImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.protocol.core.Packet;
@ -574,7 +574,7 @@ public class TemporaryQueueTest extends SingleServerTestBase
}
};
UnitTestCase.expectActiveMQException("temp queue must not exist after the server detected the client crash",
ServiceTestBase.expectActiveMQException("temp queue must not exist after the server detected the client crash",
ActiveMQExceptionType.QUEUE_DOES_NOT_EXIST, activeMQAction);
session.close();

View File

@ -15,15 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.client;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -31,13 +24,17 @@ 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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class WildCardRoutingTest extends UnitTestCase
public class WildCardRoutingTest extends ServiceTestBase
{
private ActiveMQServer server;
private ServerLocator locator;
@ -784,7 +781,7 @@ public class WildCardRoutingTest extends UnitTestCase
public void setUp() throws Exception
{
super.setUp();
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
TransportConfiguration transportConfig = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY);
Configuration configuration = createDefaultConfig()
.setWildcardRoutingEnabled(true)
@ -797,7 +794,7 @@ public class WildCardRoutingTest extends UnitTestCase
server.start();
server.getManagementService().enableNotifications(false);
// then we create a client as normal
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
locator = createInVMNonHALocator();
sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, true);
}

View File

@ -17,13 +17,11 @@
package org.apache.activemq.artemis.tests.integration.cluster;
import org.apache.activemq.artemis.api.core.ActiveMQClusterSecurityException;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.ClusterControl;
import org.apache.activemq.artemis.core.server.cluster.ClusterController;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.junit.After;
import org.junit.Before;
@ -70,7 +68,7 @@ public class ClusterControllerTest extends ClusterTestBase
@Test
public void controlWithDifferentConnector() throws Exception
{
try (ServerLocatorImpl locator = (ServerLocatorImpl) ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)))
try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator())
{
locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance());
ClusterController controller = new ClusterController(getServer(0), getServer(0).getScheduledPool());
@ -82,7 +80,7 @@ public class ClusterControllerTest extends ClusterTestBase
@Test
public void controlWithDifferentPassword() throws Exception
{
try (ServerLocatorImpl locator = (ServerLocatorImpl) ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY)))
try (ServerLocatorImpl locator = (ServerLocatorImpl) createInVMNonHALocator())
{
locator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance());
ClusterController controller = new ClusterController(getServer(1), getServer(1).getScheduledPool());

View File

@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.activemq.artemis.tests.util.SpawnedVMSupport;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
import org.apache.activemq.artemis.utils.UUID;
@ -37,7 +37,7 @@ public class RealNodeManagerTest extends NodeManagerTest
UUID id1 = nodeManager.getUUID();
nodeManager.stop();
nodeManager.start();
UnitTestCase.assertEqualsByteArrays(id1.asBytes(), nodeManager.getUUID().asBytes());
ServiceTestBase.assertEqualsByteArrays(id1.asBytes(), nodeManager.getUUID().asBytes());
nodeManager.stop();
}

View File

@ -16,33 +16,27 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.bridge;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.Interceptor;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.config.BridgeConfiguration;
import org.apache.activemq.artemis.core.config.CoreQueueConfiguration;
import org.apache.activemq.artemis.core.journal.PreparedTransactionInfo;
import org.apache.activemq.artemis.core.journal.RecordInfo;
import org.apache.activemq.artemis.core.journal.SequentialFileFactory;
import org.apache.activemq.artemis.core.journal.impl.JournalImpl;
import org.apache.activemq.artemis.core.journal.impl.NIOSequentialFileFactory;
import org.apache.activemq.artemis.core.persistence.impl.journal.DescribeJournal;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds;
import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache;
import org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl;
import org.apache.activemq.artemis.core.protocol.core.Packet;
@ -56,6 +50,7 @@ import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl;
import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.utils.LinkedListIterator;
@ -66,6 +61,18 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@RunWith(value = Parameterized.class)
public class BridgeTest extends ServiceTestBase
{
@ -226,7 +233,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
message.putIntProperty(propKey, i);
@ -403,7 +410,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
message.putIntProperty(propKey, i);
@ -588,7 +595,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
producer0.send(message);
@ -606,7 +613,7 @@ public class BridgeTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(1024 * 1024));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(1024 * 1024));
}
producer0.send(message);
@ -1869,4 +1876,59 @@ public class BridgeTest extends ServiceTestBase
}
/**
* It will inspect the journal directly and determine if there are queues on this journal,
*
* @param serverToInvestigate
* @return a Map containing the reference counts per queue
* @throws Exception
*/
protected Map<Long, AtomicInteger> loadQueues(ActiveMQServer serverToInvestigate) throws Exception
{
SequentialFileFactory messagesFF = new NIOSequentialFileFactory(serverToInvestigate.getConfiguration()
.getJournalDirectory());
JournalImpl messagesJournal = new JournalImpl(serverToInvestigate.getConfiguration().getJournalFileSize(),
serverToInvestigate.getConfiguration().getJournalMinFiles(),
0,
0,
messagesFF,
"activemq-data",
"amq",
1);
List<RecordInfo> records = new LinkedList<RecordInfo>();
List<PreparedTransactionInfo> preparedTransactions = new LinkedList<PreparedTransactionInfo>();
messagesJournal.start();
messagesJournal.load(records, preparedTransactions, null);
// These are more immutable integers
Map<Long, AtomicInteger> messageRefCounts = new HashMap<Long, AtomicInteger>();
for (RecordInfo info : records)
{
Object o = DescribeJournal.newObjectEncoding(info);
if (info.getUserRecordType() == JournalRecordIds.ADD_REF)
{
DescribeJournal.ReferenceDescribe ref = (DescribeJournal.ReferenceDescribe) o;
AtomicInteger count = messageRefCounts.get(ref.refEncoding.queueID);
if (count == null)
{
count = new AtomicInteger(1);
messageRefCounts.put(ref.refEncoding.queueID, count);
}
else
{
count.incrementAndGet();
}
}
}
messagesJournal.stop();
return messageRefCounts;
}
}

View File

@ -20,7 +20,7 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.tests.util.InVMNodeManagerServer;
import org.junit.After;
public abstract class BridgeTestBase extends UnitTestCase
public abstract class BridgeTestBase extends ServiceTestBase
{
@Override

View File

@ -16,21 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
@ -39,14 +24,13 @@ import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
import org.apache.activemq.artemis.core.client.impl.Topology;
import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
@ -68,9 +52,9 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.server.NodeManager;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding;
import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl;
import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum;
@ -83,6 +67,21 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public abstract class ClusterTestBase extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
@ -138,7 +137,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
forceGC();
UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
ServiceTestBase.checkFreePort(ClusterTestBase.PORTS);
consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
@ -187,7 +186,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
super.tearDown();
UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
ServiceTestBase.checkFreePort(ClusterTestBase.PORTS);
}
@ -663,7 +662,7 @@ public abstract class ClusterTestBase extends ServiceTestBase
{
// Proxy the failure and print a dump into System.out, so it is captured by Jenkins reports
e.printStackTrace();
System.out.println(UnitTestCase.threadDump(" - fired by ClusterTestBase::addConsumer"));
System.out.println(ServiceTestBase.threadDump(" - fired by ClusterTestBase::addConsumer"));
throw e;
}
@ -1541,11 +1540,11 @@ public abstract class ClusterTestBase extends ServiceTestBase
if (netty)
{
serverTotc = new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY, params);
}
else
{
serverTotc = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
}
if (ha)
@ -1582,11 +1581,11 @@ public abstract class ClusterTestBase extends ServiceTestBase
if (netty)
{
serverTotc = new TransportConfiguration(UnitTestCase.NETTY_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY, params);
}
else
{
serverTotc = new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY, params);
serverTotc = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params);
}
locators[node] = ActiveMQClient.createServerLocatorWithoutHA(serverTotc);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Before;
@ -34,9 +34,9 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
{
protected final String groupAddress = UnitTestCase.getUDPDiscoveryAddress();
protected final String groupAddress = ServiceTestBase.getUDPDiscoveryAddress();
protected final int groupPort = UnitTestCase.getUDPDiscoveryPort();
protected final int groupPort = ServiceTestBase.getUDPDiscoveryPort();
protected boolean isNetty()
{

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -153,7 +153,7 @@ public class SymmetricClusterTest extends ClusterTestBase
}
catch (Throwable e)
{
System.out.println(UnitTestCase.threadDump("SymmetricClusterTest::testStopAllStartAll"));
System.out.println(ServiceTestBase.threadDump("SymmetricClusterTest::testStopAllStartAll"));
throw e;
}

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
@ -121,7 +121,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
}
catch (Throwable e)
{
System.out.println(UnitTestCase.threadDump("SymmetricClusterWithBackupTest::testStopAllStartAll"));
System.out.println(ServiceTestBase.threadDump("SymmetricClusterWithBackupTest::testStopAllStartAll"));
throw e;
}
}

View File

@ -18,15 +18,15 @@ package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
public class SymmetricClusterWithDiscoveryTest extends SymmetricClusterTest
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
protected final String groupAddress = UnitTestCase.getUDPDiscoveryAddress();
protected final String groupAddress = ServiceTestBase.getUDPDiscoveryAddress();
protected final int groupPort = UnitTestCase.getUDPDiscoveryPort();
protected final int groupPort = ServiceTestBase.getUDPDiscoveryPort();
protected boolean isNetty()
{

View File

@ -330,7 +330,11 @@ public class AutomaticColocatedQuorumVoteTest extends ServiceTestBase
transportConfigurationList.add(otherLiveNode.getName());
haPolicy.getExcludedConnectors().add(otherLiveNode.getName());
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), transportConfigurationList));
String[] input = new String[transportConfigurationList.size()];
transportConfigurationList.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), input));
haPolicy.setBackupPortOffset(100);
haPolicy.setBackupRequestRetries(-1);
haPolicy.setBackupRequestRetryInterval(500);

View File

@ -18,7 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Test;
import java.io.File;
@ -130,7 +130,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
final ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final ClientMessage message = session.createMessage(true);
final int largeMessageSize = 1000 * MIN_LARGE_MESSAGE;
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(largeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(largeMessageSize));
final AtomicBoolean caughtException = new AtomicBoolean(false);
final CountDownLatch latch = new CountDownLatch(1);
@ -162,7 +162,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
Executors.defaultThreadFactory().newThread(r).start();
waitForLatch(latch);
startBackupFinishSyncing();
UnitTestCase.waitForLatch(latch2);
ServiceTestBase.waitForLatch(latch2);
crash(session);
assertFalse("no exceptions while sending message", caughtException.get());
@ -174,7 +174,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest
for (int j = 0; j < largeMessageSize; j++)
{
Assert.assertTrue("large msg , expecting " + largeMessageSize + " bytes, got " + j, buffer.readable());
Assert.assertEquals("equal at " + j, UnitTestCase.getSamplebyte(j), buffer.readByte());
Assert.assertEquals("equal at " + j, ServiceTestBase.getSamplebyte(j), buffer.readByte());
}
receiveMessages(consumer, 0, 20, true);
assertNull("there should be no more messages!", consumer.receiveImmediate());

View File

@ -16,26 +16,15 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.core.client.TopologyMember;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorInternal;
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
@ -50,10 +39,20 @@ import org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.apache.activemq.artemis.tests.util.ReplicatedBackupUtils;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public abstract class FailoverTestBase extends ServiceTestBase
{
// Constants -----------------------------------------------------
@ -143,7 +142,7 @@ public abstract class FailoverTestBase extends ServiceTestBase
{
try
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(LARGE_MESSAGE_SIZE));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(LARGE_MESSAGE_SIZE));
}
catch (Exception e)
{
@ -164,7 +163,7 @@ public abstract class FailoverTestBase extends ServiceTestBase
for (int j = 0; j < LARGE_MESSAGE_SIZE; j++)
{
Assert.assertTrue("msg " + i + ", expecting " + LARGE_MESSAGE_SIZE + " bytes, got " + j, buffer.readable());
Assert.assertEquals("equal at " + j, UnitTestCase.getSamplebyte(j), buffer.readByte());
Assert.assertEquals("equal at " + j, ServiceTestBase.getSamplebyte(j), buffer.readByte());
}
}

View File

@ -32,6 +32,7 @@ import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -56,7 +57,7 @@ public class LiveToLiveFailoverTest extends FailoverTest
TransportConfiguration liveConnector0 = getConnectorTransportConfiguration(true, 0);
TransportConfiguration liveConnector1 = getConnectorTransportConfiguration(true, 1);
backupConfig = super.createDefaultConfig(1)
backupConfig = super.createDefaultConfig(1, new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 1))
.setHAPolicyConfiguration(new ColocatedPolicyConfiguration()
@ -72,7 +73,7 @@ public class LiveToLiveFailoverTest extends FailoverTest
backupServer = createColocatedTestableServer(backupConfig, nodeManager1, nodeManager0, 1);
liveConfig = super.createDefaultConfig(0)
liveConfig = super.createDefaultConfig(0, new HashMap<String, Object>(), INVM_ACCEPTOR_FACTORY)
.clearAcceptorConfigurations()
.addAcceptorConfiguration(getAcceptorTransportConfiguration(true, 0))
.setHAPolicyConfiguration(new ColocatedPolicyConfiguration()

View File

@ -33,9 +33,7 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer
import org.junit.After;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -177,12 +175,12 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
config1.addConnectorConfiguration(backupConnector.getName(), backupConnector);
List<String> clusterNodes = new ArrayList<String>();
for (int node : otherClusterNodes)
String[] clusterNodes = new String[otherClusterNodes.length];
for (int i = 0; i < otherClusterNodes.length; i++)
{
TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(otherClusterNodes[i], isNetty()));
config1.addConnectorConfiguration(connector.getName(), connector);
clusterNodes.add(connector.getName());
clusterNodes[i] = connector.getName();
}
config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), clusterNodes));
@ -204,12 +202,12 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai
.setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode)
.addConnectorConfiguration(liveConnector.getName(), liveConnector);
List<String> pairs = new ArrayList<String>();
for (int node : otherLiveNodes)
String[] pairs = new String[otherLiveNodes.length];
for (int i = 0; i < otherLiveNodes.length; i++)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(otherLiveNodes[i], isNetty()));
config0.addConnectorConfiguration(otherLiveConnector.getName(), otherLiveConnector);
pairs.add(otherLiveConnector.getName());
pairs[i] = otherLiveConnector.getName();
}
config0.addClusterConfiguration(basicClusterConnectionConfig(liveConnector.getName(), pairs));

View File

@ -129,7 +129,9 @@ public abstract class MultipleServerFailoverTestBase extends ServiceTestBase
}
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(livetc.getName(), connectors));
String[] input = new String[connectors.size()];
connectors.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(livetc.getName(), input));
liveConfigs.add(configuration);
ActiveMQServer server = createServer(true, configuration);
TestableServer activeMQServer = new SameProcessActiveMQServer(server);
@ -190,7 +192,9 @@ public abstract class MultipleServerFailoverTestBase extends ServiceTestBase
connectors.add(staticTc.getName());
}
}
configuration.addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), connectors));
String[] input = new String[connectors.size()];
connectors.toArray(input);
configuration.addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), input));
backupConfigs.add(configuration);
ActiveMQServer server = createServer(true, configuration);
TestableServer testableServer = new SameProcessActiveMQServer(server);

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.cluster.failover;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.server.cluster.qourum.BooleanVote;
import org.apache.activemq.artemis.core.server.cluster.qourum.QuorumVoteServerConnect;
import org.apache.activemq.artemis.tests.integration.server.FakeStorageManager;
@ -29,7 +29,7 @@ import java.util.Arrays;
import java.util.Collection;
@RunWith(Parameterized.class)
public class QuorumVoteServerConnectTest extends UnitTestCase
public class QuorumVoteServerConnectTest extends ServiceTestBase
{
private final int size;

View File

@ -33,9 +33,7 @@ import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer
import org.junit.After;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -146,13 +144,12 @@ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailov
.setPagingDirectory(getPageDir() + "_" + liveNode)
.setLargeMessagesDirectory(getLargeMessagesDir() + "_" + liveNode);
List<String> staticConnectors = new ArrayList<String>();
for (int node : nodes)
String[] staticConnectors = new String[nodes.length];
for (int i = 0; i < nodes.length; i++)
{
TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(nodes[i], isNetty()));
config1.addConnectorConfiguration(liveConnector.getName(), liveConnector);
staticConnectors.add(liveConnector.getName());
staticConnectors[i] = liveConnector.getName();
}
config1.addClusterConfiguration(basicClusterConnectionConfig(backupConnector.getName(), staticConnectors));

View File

@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.After;
@ -1277,7 +1277,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt
@After
public void tearDown() throws Exception
{
UnitTestCase.stopComponent(liveServer);
ServiceTestBase.stopComponent(liveServer);
liveServer = null;
@ -1317,7 +1317,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt
@Override
protected void stop() throws Exception
{
UnitTestCase.stopComponent(liveServer);
ServiceTestBase.stopComponent(liveServer);
System.gc();

View File

@ -15,17 +15,8 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.junit.Before;
import org.junit.After;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.junit.Assert;
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;
@ -35,7 +26,14 @@ import org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImp
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnector;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
public abstract class MultiThreadReattachSupportTestBase extends ServiceTestBase
{
@ -122,7 +120,7 @@ public abstract class MultiThreadReattachSupportTestBase extends ServiceTestBase
// Case a failure happened here, it should print the Thread dump
// Sending it to System.out, as it would show on the Tests report
System.out.println(UnitTestCase.threadDump(" - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (" + t.getLocalizedMessage() +
System.out.println(ServiceTestBase.threadDump(" - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (" + t.getLocalizedMessage() +
")"));
}
}

View File

@ -16,6 +16,32 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
@ -24,34 +50,7 @@ import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl;
import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMRegistry;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class RandomReattachTest extends UnitTestCase
public class RandomReattachTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -16,23 +16,22 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.topology;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.Topology;
import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class IsolatedTopologyTest extends ServiceTestBase
{
@ -109,7 +108,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
TransportConfiguration acceptor1VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc1");
@ -117,7 +116,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "2");
TransportConfiguration acceptor2VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc2");
@ -166,7 +165,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "3");
TransportConfiguration acceptor1VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc1");
@ -174,7 +173,7 @@ public class IsolatedTopologyTest extends ServiceTestBase
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "4");
TransportConfiguration acceptor2VM1 = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY,
TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
params,
"acceptor-cc2");

View File

@ -16,11 +16,6 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.topology;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
import org.apache.activemq.artemis.api.core.ActiveMQObjectClosedException;
@ -32,21 +27,25 @@ import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ClusterTopologyListener;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.core.client.TopologyMember;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import static java.util.concurrent.TimeUnit.SECONDS;
public abstract class TopologyClusterTestBase extends ClusterTestBase
@ -396,7 +395,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase
s.getConfiguration().setSecurityEnabled(true);
}
}
Assert.assertEquals(UnitTestCase.CLUSTER_PASSWORD, config.getClusterPassword());
Assert.assertEquals(ServiceTestBase.CLUSTER_PASSWORD, config.getClusterPassword());
config.setClusterPassword(config.getClusterPassword() + "-1-2-3-");
startServers(0, 1, 2, 4, 3);
int n = 0;
@ -412,7 +411,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase
final String address = "foo1235";
ServerLocator locator = createNonHALocator(isNetty());
ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(config.getClusterUser(), UnitTestCase.CLUSTER_PASSWORD, false, true, true, false, 1);
ClientSession session = sf.createSession(config.getClusterUser(), ServiceTestBase.CLUSTER_PASSWORD, false, true, true, false, 1);
session.createQueue(address, address, true);
ClientProducer producer = session.createProducer(address);
sendMessages(session, producer, 100);

View File

@ -28,7 +28,7 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.cluster.DiscoveryEntry;
import org.apache.activemq.artemis.core.cluster.DiscoveryGroup;
import org.apache.activemq.artemis.core.cluster.DiscoveryListener;
@ -39,7 +39,7 @@ import org.apache.activemq.artemis.core.server.management.NotificationService;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert;
public class DiscoveryBaseTest extends UnitTestCase
public class DiscoveryBaseTest extends ServiceTestBase
{
protected static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -16,27 +16,24 @@
*/
package org.apache.activemq.artemis.tests.integration.divert;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.apache.activemq.artemis.api.core.SimpleString;
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.ActiveMQClient;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.DivertConfiguration;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
public class PersistentDivertTest extends ServiceTestBase
{
@ -144,7 +141,7 @@ public class PersistentDivertTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(minLargeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(minLargeMessageSize));
}
message.putIntProperty(propKey, i);
@ -235,7 +232,7 @@ public class PersistentDivertTest extends ServiceTestBase
{
for (int j = 0; j < minLargeMessageSize; j++)
{
Assert.assertEquals(UnitTestCase.getSamplebyte(j), message.getBodyBuffer().readByte());
Assert.assertEquals(ServiceTestBase.getSamplebyte(j), message.getBodyBuffer().readByte());
}
}
@ -332,7 +329,7 @@ public class PersistentDivertTest extends ServiceTestBase
if (largeMessage)
{
message.setBodyInputStream(UnitTestCase.createFakeLargeStream(minLargeMessageSize));
message.setBodyInputStream(ServiceTestBase.createFakeLargeStream(minLargeMessageSize));
}
producer.send(message);

View File

@ -32,7 +32,7 @@ public class ValidateAIOTest extends ServiceTestBase
@Test
public void testValidateAIO() throws Exception
{
Configuration config = createDefaultConfig(false)
Configuration config = createDefaultConfig()
// This will force AsyncIO
.setJournalType(JournalType.ASYNCIO);
ActiveMQServer server = ActiveMQServers.newActiveMQServer(config, true);

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration.http;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.junit.Before;
import org.junit.Test;
@ -40,7 +40,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
public class CoreClientOverHttpTest extends UnitTestCase
public class CoreClientOverHttpTest extends ServiceTestBase
{
private static final SimpleString QUEUE = new SimpleString("CoreClientOverHttpTestQueue");
private Configuration conf;

View File

@ -16,7 +16,7 @@
*/
package org.apache.activemq.artemis.tests.integration.jms;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.junit.Before;
@ -50,7 +50,7 @@ import org.apache.activemq.artemis.tests.util.RandomUtil;
*
* A ActiveMQConnectionFactoryTest
*/
public class ActiveMQConnectionFactoryTest extends UnitTestCase
public class ActiveMQConnectionFactoryTest extends ServiceTestBase
{
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;

View File

@ -45,13 +45,13 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
/**
*
* A FloodServerTest
*/
public class FloodServerTest extends UnitTestCase
public class FloodServerTest extends ServiceTestBase
{
// Constants -----------------------------------------------------

View File

@ -40,7 +40,7 @@ import org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFa
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.tests.util.UnitTestCase;
import org.apache.activemq.artemis.tests.util.ServiceTestBase;
import org.apache.activemq.artemis.core.config.Configuration;
import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
@ -56,7 +56,7 @@ import org.junit.Test;
*
* A ActiveMQConnectionFactoryTest
*/
public class SimpleJNDIClientTest extends UnitTestCase
public class SimpleJNDIClientTest extends ServiceTestBase
{
private final String groupAddress = getUDPDiscoveryAddress();

Some files were not shown because too many files have changed in this diff Show More