ARTEMIS-3341 update checkstyle to latest + update code

As a follow-up to #3618/dc7de893747b90b627d729f9f18a758bb4dad9d5 update
checkstyle to the latest version, restoring the originally intended
"RightCurly" style, and updating all the code to properly adhere to the
style as enforced by the new checkstyle version.

The version of checkstyle we used before the aforementioned commit had
a bug which didn't properly enforced our intended "RightCurly" style
(see https://github.com/checkstyle/checkstyle/issues/6345). That commit
changed the style to accommodate the handful of unintended style
violations. This commit reverts that change for 2 main reasons:
 - The style was always intended to use `alone` for both `METHOD_DEF`
and `CTOR_DEF`.
 - There are over 1,000 existing uses of the intended style and around
30 violations of this style which were unintentionally allowed.

Reverting the style back to the original and cleaning up the unintented
violations makes the code more consistent and prevents further style
inconsistencies in the future.

There were a handful of other changes related to checkstyle bugs which
allowed unintended style violations. These were related to indentation
levels.

This closes #3619
(with some minor changes from Robbie to fix remaining violations)
This commit is contained in:
Justin Bertram 2021-06-10 22:56:40 -05:00 committed by Robbie Gemmell
parent dc7de89374
commit a4c1155a01
48 changed files with 614 additions and 505 deletions

View File

@ -23,7 +23,8 @@ package org.apache.activemq.artemis.utils;
@Deprecated @Deprecated
public class TypedProperties extends org.apache.activemq.artemis.utils.collections.TypedProperties { public class TypedProperties extends org.apache.activemq.artemis.utils.collections.TypedProperties {
public TypedProperties() { } public TypedProperties() {
}
public TypedProperties(final org.apache.activemq.artemis.utils.collections.TypedProperties other) { public TypedProperties(final org.apache.activemq.artemis.utils.collections.TypedProperties other) {
super(other); super(other);

View File

@ -39,7 +39,8 @@ public abstract class AbstractJDBCDriver {
protected JDBCConnectionProvider connectionProvider; protected JDBCConnectionProvider connectionProvider;
public AbstractJDBCDriver() { } public AbstractJDBCDriver() {
}
public AbstractJDBCDriver(JDBCConnectionProvider connectionProvider, SQLProvider provider) { public AbstractJDBCDriver(JDBCConnectionProvider connectionProvider, SQLProvider provider) {
this.connectionProvider = connectionProvider; this.connectionProvider = connectionProvider;

View File

@ -29,63 +29,92 @@ import org.apache.qpid.proton.engine.Transport;
*/ */
public interface EventHandler { public interface EventHandler {
default void onAuthInit(ProtonHandler handler, Connection connection, boolean sasl) { } default void onAuthInit(ProtonHandler handler, Connection connection, boolean sasl) {
}
default void onSaslRemoteMechanismChosen(ProtonHandler handler, String mech) { } default void onSaslRemoteMechanismChosen(ProtonHandler handler, String mech) {
}
default void onAuthFailed(ProtonHandler protonHandler, Connection connection) { } default void onAuthFailed(ProtonHandler protonHandler, Connection connection) {
}
default void onAuthSuccess(ProtonHandler protonHandler, Connection connection) { } default void onAuthSuccess(ProtonHandler protonHandler, Connection connection) {
}
default void onSaslMechanismsOffered(ProtonHandler handler, String[] mechanisms) { } default void onSaslMechanismsOffered(ProtonHandler handler, String[] mechanisms) {
}
default void onInit(Connection connection) throws Exception { } default void onInit(Connection connection) throws Exception {
}
default void onLocalOpen(Connection connection) throws Exception { } default void onLocalOpen(Connection connection) throws Exception {
}
default void onRemoteOpen(Connection connection) throws Exception { } default void onRemoteOpen(Connection connection) throws Exception {
}
default void onLocalClose(Connection connection) throws Exception { } default void onLocalClose(Connection connection) throws Exception {
}
default void onRemoteClose(Connection connection) throws Exception { } default void onRemoteClose(Connection connection) throws Exception {
}
default void onFinal(Connection connection) throws Exception { } default void onFinal(Connection connection) throws Exception {
}
default void onInit(Session session) throws Exception { } default void onInit(Session session) throws Exception {
}
default void onLocalOpen(Session session) throws Exception { } default void onLocalOpen(Session session) throws Exception {
}
default void onRemoteOpen(Session session) throws Exception { } default void onRemoteOpen(Session session) throws Exception {
}
default void onLocalClose(Session session) throws Exception { } default void onLocalClose(Session session) throws Exception {
}
default void onRemoteClose(Session session) throws Exception { } default void onRemoteClose(Session session) throws Exception {
}
default void onFinal(Session session) throws Exception { } default void onFinal(Session session) throws Exception {
}
default void onInit(Link link) throws Exception { } default void onInit(Link link) throws Exception {
}
default void onLocalOpen(Link link) throws Exception { } default void onLocalOpen(Link link) throws Exception {
}
default void onRemoteOpen(Link link) throws Exception { } default void onRemoteOpen(Link link) throws Exception {
}
default void onLocalClose(Link link) throws Exception { } default void onLocalClose(Link link) throws Exception {
}
default void onRemoteClose(Link link) throws Exception { } default void onRemoteClose(Link link) throws Exception {
}
default void onFlow(Link link) throws Exception { } default void onFlow(Link link) throws Exception {
}
default void onFinal(Link link) throws Exception { } default void onFinal(Link link) throws Exception {
}
default void onRemoteDetach(Link link) throws Exception { } default void onRemoteDetach(Link link) throws Exception {
}
default void onLocalDetach(Link link) throws Exception { } default void onLocalDetach(Link link) throws Exception {
}
default void onDelivery(Delivery delivery) throws Exception { } default void onDelivery(Delivery delivery) throws Exception {
}
default void onTransport(Transport transport) throws Exception { } default void onTransport(Transport transport) throws Exception {
}
default void pushBytes(ByteBuf bytes) { } default void pushBytes(ByteBuf bytes) {
}
default boolean flowControl(ReadyListener readyListener) { default boolean flowControl(ReadyListener readyListener) {
return true; return true;

View File

@ -167,7 +167,7 @@ public class PostOfficeJournalLoader implements JournalLoader {
if (queueBindingInfo.getQueueStatusEncodings() != null) { if (queueBindingInfo.getQueueStatusEncodings() != null) {
for (QueueStatusEncoding encoding : queueBindingInfo.getQueueStatusEncodings()) { for (QueueStatusEncoding encoding : queueBindingInfo.getQueueStatusEncodings()) {
if (encoding.getStatus() == AddressQueueStatus.PAUSED) if (encoding.getStatus() == AddressQueueStatus.PAUSED)
queue.reloadPause(encoding.getId()); queue.reloadPause(encoding.getId());
} }
} }

View File

@ -22,7 +22,8 @@ import org.apache.activemq.artemis.api.core.Message;
public interface Transformer { public interface Transformer {
default void init(Map<String, String> properties) { } default void init(Map<String, String> properties) {
}
Message transform(Message message); Message transform(Message message);
} }

View File

@ -48,7 +48,8 @@ public class TestJDBCDriver extends AbstractJDBCDriver {
} }
@Override @Override
protected void prepareStatements() { } protected void prepareStatements() {
}
@Override @Override
protected void createSchema() { protected void createSchema() {

View File

@ -93,7 +93,7 @@ public class NoProcessFilesBehind extends TestWatcher {
processInput.readLine(); processInput.readLine();
while ((outputLine = processInput.readLine()) != null) { while ((outputLine = processInput.readLine()) != null) {
if (!filtered || (!outputLine.endsWith(".jar") && !outputLine.endsWith(".so") && !outputLine.contains("type=STREAM"))) if (!filtered || (!outputLine.endsWith(".jar") && !outputLine.endsWith(".so") && !outputLine.contains("type=STREAM")))
openFiles.add(outputLine); openFiles.add(outputLine);
} }
} }
} catch (Exception ignore) { } catch (Exception ignore) {

View File

@ -69,11 +69,7 @@ under the License.
<module name="RightCurly"/> <module name="RightCurly"/>
<module name="RightCurly"> <module name="RightCurly">
<property name="option" value="alone"/> <property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/> <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="RightCurly">
<property name="option" value="alone_or_singleline"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
</module> </module>
<!-- Checks that there is no whitespace after certain tokens; e.g. "." and "!". --> <!-- Checks that there is no whitespace after certain tokens; e.g. "." and "!". -->
<module name="NoWhitespaceAfter"/> <module name="NoWhitespaceAfter"/>

View File

@ -101,7 +101,7 @@
<maven.bundle.plugin.version>5.1.2</maven.bundle.plugin.version> <maven.bundle.plugin.version>5.1.2</maven.bundle.plugin.version>
<maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version> <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
<sevntu.checks.version>1.39.0</sevntu.checks.version> <sevntu.checks.version>1.39.0</sevntu.checks.version>
<checkstyle.version>8.29</checkstyle.version> <checkstyle.version>8.43</checkstyle.version>
<mockito.version>3.9.0</mockito.version> <mockito.version>3.9.0</mockito.version>
<jctools.version>2.1.2</jctools.version> <jctools.version>2.1.2</jctools.version>
<netty.version>4.1.65.Final</netty.version> <netty.version>4.1.65.Final</netty.version>

View File

@ -65,12 +65,13 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "interrupt", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext", name = "interrupt",
targetMethod = "xaEnd", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext",
targetLocation = "ENTRY", targetMethod = "xaEnd",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();")})
public void testSimpleMessageReceivedOnQueue() throws Exception { public void testSimpleMessageReceivedOnQueue() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
resourceAdapter = qResourceAdapter; resourceAdapter = qResourceAdapter;
@ -134,12 +135,13 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "interrupt", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext", name = "interrupt",
targetMethod = "xaEnd", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext",
targetLocation = "ENTRY", targetMethod = "xaEnd",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQMessageHandlerTest.interrupt();")})
public void testSimpleMessageReceivedOnQueueTwoPhase() throws Exception { public void testSimpleMessageReceivedOnQueueTwoPhase() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
resourceAdapter = qResourceAdapter; resourceAdapter = qResourceAdapter;

View File

@ -64,11 +64,12 @@ public class ActiveMQServerControlMultiThreadTest extends ManagementTestBase {
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "Delay listAddress() by 2 secs ", @BMRules(rules = {
targetClass = "org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl", @BMRule(name = "Delay listAddress() by 2 secs ",
targetMethod = "getAddressInfo(org.apache.activemq.artemis.api.core.SimpleString)", targetClass = "org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl",
targetLocation = "ENTRY", targetMethod = "getAddressInfo(org.apache.activemq.artemis.api.core.SimpleString)",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQServerControlMultiThreadTest.delay(2)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQServerControlMultiThreadTest.delay(2)")})
public void listAddressDuringDeleteAddress() throws Exception { public void listAddressDuringDeleteAddress() throws Exception {
@ -125,11 +126,12 @@ public class ActiveMQServerControlMultiThreadTest extends ManagementTestBase {
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "Delay listConsumers() by 2 secs ", @BMRules(rules = {
targetClass = "org.apache.activemq.artemis.core.management.impl.view.ConsumerView", @BMRule(name = "Delay listConsumers() by 2 secs ",
targetMethod = "toJson(org.apache.activemq.artemis.core.server.ServerConsumer)", targetClass = "org.apache.activemq.artemis.core.management.impl.view.ConsumerView",
targetLocation = "ENTRY", targetMethod = "toJson(org.apache.activemq.artemis.core.server.ServerConsumer)",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQServerControlMultiThreadTest.delay(2)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ActiveMQServerControlMultiThreadTest.delay(2)")})
public void listConsumersDuringSessionClose() throws Exception { public void listConsumersDuringSessionClose() throws Exception {

View File

@ -90,12 +90,13 @@ public class BMFailoverTest extends FailoverTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace ActiveMQSessionContext xaEnd", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext", name = "trace ActiveMQSessionContext xaEnd",
targetMethod = "xaEnd", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext",
targetLocation = "AT EXIT", targetMethod = "xaEnd",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.stopAndThrow()")}) targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.stopAndThrow()")})
//https://bugzilla.redhat.com/show_bug.cgi?id=1152410 //https://bugzilla.redhat.com/show_bug.cgi?id=1152410
public void testFailOnEndAndRetry() throws Exception { public void testFailOnEndAndRetry() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
@ -161,12 +162,13 @@ public class BMFailoverTest extends FailoverTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace clientsessionimpl commit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "trace clientsessionimpl commit",
targetMethod = "start(javax.transaction.xa.Xid, int)", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "AT EXIT", targetMethod = "start(javax.transaction.xa.Xid, int)",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnCommit2() throws Exception { public void testFailoverOnCommit2() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator();
@ -248,12 +250,13 @@ public class BMFailoverTest extends FailoverTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace clientsessionimpl commit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "trace clientsessionimpl commit",
targetMethod = "commit", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "ENTRY", targetMethod = "commit",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnCommit() throws Exception { public void testFailoverOnCommit() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator();
@ -277,12 +280,13 @@ public class BMFailoverTest extends FailoverTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace clientsessionimpl commit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "trace clientsessionimpl commit",
targetMethod = "commit", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "ENTRY", targetMethod = "commit",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnReceiveCommit() throws Exception { public void testFailoverOnReceiveCommit() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator(); locator = getServerLocator();

View File

@ -71,24 +71,25 @@ public class ClusteredBridgeReconnectTest extends ClusterTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "enter", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl", name = "enter",
targetMethod = "connect", targetClass = "org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl",
targetLocation = "ENTRY", targetMethod = "connect",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.enterConnect();"), @BMRule( targetLocation = "ENTRY",
name = "exit", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.enterConnect();"),
targetClass = "org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl", @BMRule(
targetMethod = "connect", name = "exit",
targetLocation = "EXIT", targetClass = "org.apache.activemq.artemis.core.server.cluster.impl.BridgeImpl",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.exitConnect();"), @BMRule( targetMethod = "connect",
name = "send", targetLocation = "EXIT",
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.exitConnect();"),
targetMethod = "send(org.apache.activemq.artemis.core.protocol.core.Packet)", @BMRule(
targetLocation = "EXIT", name = "send",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.send();") targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl",
targetMethod = "send(org.apache.activemq.artemis.core.protocol.core.Packet)",
}) targetLocation = "EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredBridgeReconnectTest.send();")})
public void testReconnectBridge() throws Exception { public void testReconnectBridge() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty()); setupServer(1, isFileStorage(), isNetty());

View File

@ -41,17 +41,19 @@ public class ClusteredGroupingTest extends ClusterTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "blow-up", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler", name = "blow-up",
targetMethod = "removeGrouping", targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler",
targetLocation = "ENTRY", targetMethod = "removeGrouping",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause($1);"), @BMRule( targetLocation = "ENTRY",
name = "blow-up2", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause($1);"),
targetClass = "org.apache.activemq.artemis.core.server.group.impl.GroupHandlingAbstract", @BMRule(
targetMethod = "forceRemove", name = "blow-up2",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.group.impl.GroupHandlingAbstract",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")}) targetMethod = "forceRemove",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")})
public void test2serversLocalGoesDown() throws Exception { public void test2serversLocalGoesDown() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty()); setupServer(1, isFileStorage(), isNetty());
@ -101,16 +103,18 @@ public class ClusteredGroupingTest extends ClusterTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "blow-up", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler", name = "blow-up",
targetMethod = "onNotification", targetClass = "org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler",
targetLocation = "ENTRY", targetMethod = "onNotification",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"), @BMRule(name = "blow-up2", targetLocation = "ENTRY",
targetClass = "org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"),
targetMethod = "remove", @BMRule(name = "blow-up2",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")}) targetMethod = "remove",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")})
public void test3serversLocalGoesDown() throws Exception { public void test3serversLocalGoesDown() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty()); setupServer(1, isFileStorage(), isNetty());
@ -171,16 +175,18 @@ public class ClusteredGroupingTest extends ClusterTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "blow-up", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler", name = "blow-up",
targetMethod = "onNotification", targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler",
targetLocation = "ENTRY", targetMethod = "onNotification",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"), @BMRule(name = "blow-up2", targetLocation = "ENTRY",
targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"),
targetMethod = "remove", @BMRule(name = "blow-up2",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")}) targetMethod = "remove",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")})
public void testLocal3serversLocalGoesDown() throws Exception { public void testLocal3serversLocalGoesDown() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty()); setupServer(1, isFileStorage(), isNetty());
@ -241,16 +247,18 @@ public class ClusteredGroupingTest extends ClusterTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "blow-up", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler", name = "blow-up",
targetMethod = "onNotification", targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler",
targetLocation = "ENTRY", targetMethod = "onNotification",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"), @BMRule(name = "blow-up2", targetLocation = "ENTRY",
targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler", action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.pause2($1);"),
targetMethod = "remove", @BMRule(name = "blow-up2",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")}) targetMethod = "remove",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ClusteredGroupingTest.restart2();")})
public void testLocal4serversLocalGoesDown() throws Exception { public void testLocal4serversLocalGoesDown() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty()); setupServer(1, isFileStorage(), isNetty());

View File

@ -83,12 +83,13 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "enterCancel-holdThere", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", name = "enterCancel-holdThere",
targetMethod = "close", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
targetLocation = "ENTRY", targetMethod = "close",
action = "org.apache.activemq.artemis.tests.extras.byteman.ConcurrentDeliveryCancelTest.enterCancel();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.ConcurrentDeliveryCancelTest.enterCancel();")})
public void testConcurrentCancels() throws Exception { public void testConcurrentCancels() throws Exception {
log.debug(server.getConfiguration().getJournalLocation().toString()); log.debug(server.getConfiguration().getJournalLocation().toString());

View File

@ -76,12 +76,13 @@ public class CriticalAnalyzerFaultInjectionTest extends JMSTestBase {
} }
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Sync file data hangs", @BMRule(
targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile", name = "Sync file data hangs",
targetMethod = "sync", targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile",
targetLocation = "ENTRY", targetMethod = "sync",
action = "org.apache.activemq.artemis.tests.extras.byteman.CriticalAnalyzerFaultInjectionTest.methodHang();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.CriticalAnalyzerFaultInjectionTest.methodHang();")})
@Test(timeout = 60000) @Test(timeout = 60000)
public void testSlowDiskSync() throws Exception { public void testSlowDiskSync() throws Exception {
sendConsumeDurableMessage(); sendConsumeDurableMessage();

View File

@ -56,12 +56,13 @@ public class DisconnectOnCriticalFailureTest extends JMSTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Corrupt Decoding", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.PacketDecoder", name = "Corrupt Decoding",
targetMethod = "decode(byte)", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.PacketDecoder",
targetLocation = "ENTRY", targetMethod = "decode(byte)",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow();")})
public void testSendDisconnect() throws Exception { public void testSendDisconnect() throws Exception {
createQueue("queue1"); createQueue("queue1");
final Connection producerConnection = nettyCf.createConnection(); final Connection producerConnection = nettyCf.createConnection();
@ -90,12 +91,13 @@ public class DisconnectOnCriticalFailureTest extends JMSTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Corrupt Decoding", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.ClientPacketDecoder", name = "Corrupt Decoding",
targetMethod = "decode(org.apache.activemq.artemis.api.core.ActiveMQBuffer)", targetClass = "org.apache.activemq.artemis.core.protocol.ClientPacketDecoder",
targetLocation = "ENTRY", targetMethod = "decode(org.apache.activemq.artemis.api.core.ActiveMQBuffer)",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow($1);")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow($1);")})
public void testClientDisconnect() throws Exception { public void testClientDisconnect() throws Exception {
Queue q1 = createQueue("queue1"); Queue q1 = createQueue("queue1");
final Connection connection = nettyCf.createConnection(); final Connection connection = nettyCf.createConnection();
@ -132,12 +134,13 @@ public class DisconnectOnCriticalFailureTest extends JMSTestBase {
@Test(timeout = 60000) @Test(timeout = 60000)
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Corrupt Decoding", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.ClientPacketDecoder", name = "Corrupt Decoding",
targetMethod = "decode(org.apache.activemq.artemis.api.core.ActiveMQBuffer)", targetClass = "org.apache.activemq.artemis.core.protocol.ClientPacketDecoder",
targetLocation = "ENTRY", targetMethod = "decode(org.apache.activemq.artemis.api.core.ActiveMQBuffer)",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow($1);")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.DisconnectOnCriticalFailureTest.doThrow($1);")})
public void testClientDisconnectLarge() throws Exception { public void testClientDisconnectLarge() throws Exception {
Queue q1 = createQueue("queue1"); Queue q1 = createQueue("queue1");
final Connection connection = nettyCf.createConnection(); final Connection connection = nettyCf.createConnection();

View File

@ -63,25 +63,27 @@ public class FailureXATest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Crash after onephase committed", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl", name = "Crash after onephase committed",
targetMethod = "xaCommit(javax.transaction.xa.Xid, boolean)", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl",
targetLocation = "EXIT", targetMethod = "xaCommit(javax.transaction.xa.Xid, boolean)",
action = "throw new RuntimeException()")}) targetLocation = "EXIT",
action = "throw new RuntimeException()")})
public void testCrashServerAfterOnePhaseCommit() throws Exception { public void testCrashServerAfterOnePhaseCommit() throws Exception {
doTestCrashServerAfterXACommit(true); doTestCrashServerAfterXACommit(true);
} }
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Crash after onephase committed", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl", name = "Crash after onephase committed",
targetMethod = "xaCommit(javax.transaction.xa.Xid, boolean)", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl",
targetLocation = "EXIT", targetMethod = "xaCommit(javax.transaction.xa.Xid, boolean)",
//helper = "org.apache.activemq.artemis.tests.extras.byteman.FailureXATest", targetLocation = "EXIT",
action = "throw new RuntimeException()")}) //helper = "org.apache.activemq.artemis.tests.extras.byteman.FailureXATest",
action = "throw new RuntimeException()")})
public void testCrashServerAfterTwoPhaseCommit() throws Exception { public void testCrashServerAfterTwoPhaseCommit() throws Exception {
doTestCrashServerAfterXACommit(false); doTestCrashServerAfterXACommit(false);
} }

View File

@ -50,7 +50,7 @@ public class FileLockMonitorTest {
@Test @Test
@BMRules(rules = { @BMRules(rules = {
@BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", targetMethod = "isLiveLockLost", action = "return true;") }) @BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", targetMethod = "isLiveLockLost", action = "return true;") })
public void testLockMonitorInvalid() throws Exception { public void testLockMonitorInvalid() throws Exception {
lostLock = false; lostLock = false;
startServer(); startServer();
@ -66,7 +66,7 @@ public class FileLockMonitorTest {
@Test @Test
@BMRules(rules = { @BMRules(rules = {
@BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", @BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager",
targetMethod = "getState", targetMethod = "getState",
action = "org.apache.activemq.artemis.tests.extras.byteman.FileLockMonitorTest.throwNodeManagerException(\"EFS is disconnected\");") }) action = "org.apache.activemq.artemis.tests.extras.byteman.FileLockMonitorTest.throwNodeManagerException(\"EFS is disconnected\");") })
public void testLockMonitorIOException() throws Exception { public void testLockMonitorIOException() throws Exception {
@ -88,7 +88,7 @@ public class FileLockMonitorTest {
@Test @Test
@BMRules(rules = { @BMRules(rules = {
@BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", targetMethod = "getState", action = "return 70;") }) @BMRule(name = "lock is invalid", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", targetMethod = "getState", action = "return 70;") })
public void testLockMonitorHasLockWrongState() throws Exception { public void testLockMonitorHasLockWrongState() throws Exception {
lostLock = false; lostLock = false;
startServer(); startServer();

View File

@ -45,7 +45,8 @@ public class FileLockNodeManagerTest {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
@BMRule(
name = "throw IOException during activation", name = "throw IOException during activation",
targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager", targetClass = "org.apache.activemq.artemis.core.server.impl.FileLockNodeManager",
targetMethod = "tryLock", targetMethod = "tryLock",

View File

@ -61,12 +61,13 @@ public class GroupingTest extends JMSTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace clientsessionimpl commit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl", name = "trace clientsessionimpl commit",
targetMethod = "rollback", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerSessionImpl",
targetLocation = "EXIT", targetMethod = "rollback",
action = "org.apache.activemq.artemis.tests.extras.byteman.GroupingTest.pause();")}) targetLocation = "EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.GroupingTest.pause();")})
public void testGroupingRollbackOnClose() throws Exception { public void testGroupingRollbackOnClose() throws Exception {
Connection sendConnection = null; Connection sendConnection = null;
Connection connection = null; Connection connection = null;

View File

@ -33,10 +33,12 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class) @RunWith(BMUnitRunner.class)
@BMRules(rules = {@BMRule(name = "modify map during iteration", @BMRules(rules = {
targetClass = "org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository", @BMRule(name = "modify map during iteration",
targetMethod = "getPossibleMatches(String)", targetLocation = "AT INVOKE java.util.HashMap.put", targetClass = "org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository",
action = "org.apache.activemq.artemis.tests.extras.byteman.HierarchicalObjectRepositoryTest.bum()"),}) targetMethod = "getPossibleMatches(String)",
targetLocation = "AT INVOKE java.util.HashMap.put",
action = "org.apache.activemq.artemis.tests.extras.byteman.HierarchicalObjectRepositoryTest.bum()"),})
public class HierarchicalObjectRepositoryTest { public class HierarchicalObjectRepositoryTest {
private static final String A = "a."; private static final String A = "a.";

View File

@ -63,17 +63,19 @@ public class InterruptedMessageHandlerTest extends ActiveMQRATestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "throw ActiveMQException(CONNETION_TIMEOUT) during rollback", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "throw ActiveMQException(CONNETION_TIMEOUT) during rollback",
targetMethod = "flushAcks", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "AFTER INVOKE flushAcks", targetMethod = "flushAcks",
action = "org.apache.activemq.artemis.tests.extras.byteman.InterruptedMessageHandlerTest.throwActiveMQQExceptionConnectionTimeout();"), @BMRule( targetLocation = "AFTER INVOKE flushAcks",
name = "check that outcome of XA transaction is TwoPhaseOutcome.FINISH_ERROR=8", action = "org.apache.activemq.artemis.tests.extras.byteman.InterruptedMessageHandlerTest.throwActiveMQQExceptionConnectionTimeout();"),
targetClass = "com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord", @BMRule(
targetMethod = "topLevelAbort", name = "check that outcome of XA transaction is TwoPhaseOutcome.FINISH_ERROR=8",
targetLocation = "AT EXIT", targetClass = "com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord",
action = "org.apache.activemq.artemis.tests.extras.byteman.InterruptedMessageHandlerTest.assertTxOutComeIsOfStatusFinishedError($!);")}) targetMethod = "topLevelAbort",
targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.InterruptedMessageHandlerTest.assertTxOutComeIsOfStatusFinishedError($!);")})
public void testSimpleMessageReceivedOnQueueTwoPhaseFailPrepareByConnectionTimout() throws Exception { public void testSimpleMessageReceivedOnQueueTwoPhaseFailPrepareByConnectionTimout() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
resourceAdapter = qResourceAdapter; resourceAdapter = qResourceAdapter;

View File

@ -40,17 +40,19 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace clientsessionimpl send", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl", name = "trace clientsessionimpl send",
targetMethod = "send", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl",
targetLocation = "ENTRY", targetMethod = "send",
action = "org.apache.activemq.artemis.tests.extras.byteman.JMSBridgeReconnectionTest.pause($1);"), @BMRule( targetLocation = "ENTRY",
name = "trace sendRegularMessage", action = "org.apache.activemq.artemis.tests.extras.byteman.JMSBridgeReconnectionTest.pause($1);"),
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientProducerImpl", @BMRule(
targetMethod = "sendRegularMessage", name = "trace sendRegularMessage",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientProducerImpl",
action = "org.apache.activemq.artemis.tests.extras.byteman.JMSBridgeReconnectionTest.pause2($2,$3,$4);")}) targetMethod = "sendRegularMessage",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.JMSBridgeReconnectionTest.pause2($2,$3,$4);")})
public void performCrashDestinationStopBridge() throws Exception { public void performCrashDestinationStopBridge() throws Exception {
activeMQServer = server1; activeMQServer = server1;
ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse0 = cff0;

View File

@ -43,15 +43,13 @@ public class JournalImplConcurrencyTest extends JournalImplTestBase {
*/ */
@Test(timeout = 2000) @Test(timeout = 2000)
@BMRules(rules = { @BMRules(rules = {
@BMRule( @BMRule(
name = "BlockOnFinalLargeMessagePacket", name = "BlockOnFinalLargeMessagePacket",
targetClass = "java.util.concurrent.locks.ReentrantReadWriteLock", targetClass = "java.util.concurrent.locks.ReentrantReadWriteLock",
targetMethod = "readLock()", targetMethod = "readLock()",
targetLocation = "EXIT", targetLocation = "EXIT",
condition = "Thread.currentThread().getName().contains(\"ArtemisIOThread\")", condition = "Thread.currentThread().getName().contains(\"ArtemisIOThread\")",
action = "throw RuntimeException(\"Injected exception\");" action = "throw RuntimeException(\"Injected exception\");")})
)
})
public void testTryDelete() throws Exception { public void testTryDelete() throws Exception {
setup(10, 10 * 1024, true); setup(10, 10 * 1024, true);
createJournal(); createJournal();

View File

@ -74,15 +74,13 @@ public class LargeMessageOnShutdownTest extends ActiveMQTestBase {
action = action =
"org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOnShutdownTest.stopServer();" + "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOnShutdownTest.stopServer();" +
"waitFor(\"testLargeMessageOnShutdown\", 5000);" + "waitFor(\"testLargeMessageOnShutdown\", 5000);" +
"flag(\"testLargeMessageOnShutdown\")" "flag(\"testLargeMessageOnShutdown\")"),
),
@BMRule( @BMRule(
name = "ReleaseBlockOnSessionCleanup", name = "ReleaseBlockOnSessionCleanup",
targetClass = "org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler", targetClass = "org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler",
targetMethod = "clearLargeMessage()", targetMethod = "clearLargeMessage()",
targetLocation = "EXIT", targetLocation = "EXIT",
action = "signalWake(\"testLargeMessageOnShutdown\")" action = "signalWake(\"testLargeMessageOnShutdown\")")
)
} }
) )
public void testLargeMessageOnShutdown() throws Exception { public void testLargeMessageOnShutdown() throws Exception {

View File

@ -133,12 +133,13 @@ public class LargeMessageOverReplicationTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "InterruptSending", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext", name = "InterruptSending",
targetMethod = "sendLargeMessageChunk", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext",
targetLocation = "ENTRY", targetMethod = "sendLargeMessageChunk",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOverReplicationTest.messageChunkSent();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOverReplicationTest.messageChunkSent();")})
public void testSendLargeMessage() throws Exception { public void testSendLargeMessage() throws Exception {
MapMessage message = createLargeMessage(); MapMessage message = createLargeMessage();
@ -168,12 +169,13 @@ public class LargeMessageOverReplicationTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "InterruptReceive", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback", name = "InterruptReceive",
targetMethod = "sendLargeMessageContinuation", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback",
targetLocation = "ENTRY", targetMethod = "sendLargeMessageContinuation",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOverReplicationTest.messageChunkReceived();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageOverReplicationTest.messageChunkReceived();")})
public void testReceiveLargeMessage() throws Exception { public void testReceiveLargeMessage() throws Exception {
MapMessage message = createLargeMessage(); MapMessage message = createLargeMessage();

View File

@ -111,23 +111,26 @@ public class LargeMessageReplicationTest extends FailoverTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "record large message copy thread", @BMRule(
targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageImpl", name = "record large message copy thread",
targetMethod = "copy(long)", targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageImpl",
targetLocation = "ENTRY", targetMethod = "copy(long)",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.copyThread()"), @BMRule( targetLocation = "ENTRY",
name = "record byte array in addBytes", action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.copyThread()"),
targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageImpl", @BMRule(
targetMethod = "addBytes(byte[])", name = "record byte array in addBytes",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMessageImpl",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.addBytesIn($1)"), @BMRule( targetMethod = "addBytes(byte[])",
name = "record byte array used for reading large message", targetLocation = "ENTRY",
targetClass = "^org.apache.activemq.artemis.core.io.SequentialFile", action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.addBytesIn($1)"),
isInterface = true, @BMRule(
targetMethod = "read(java.nio.ByteBuffer)", name = "record byte array used for reading large message",
targetLocation = "ENTRY", targetClass = "^org.apache.activemq.artemis.core.io.SequentialFile",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.originBuff($1)")}) isInterface = true,
targetMethod = "read(java.nio.ByteBuffer)",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LargeMessageReplicationTest.originBuff($1)")})
//https://issues.apache.org/jira/browse/ARTEMIS-1220 //https://issues.apache.org/jira/browse/ARTEMIS-1220
public void testDivertCopyMessageBuffer() throws Exception { public void testDivertCopyMessageBuffer() throws Exception {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();

View File

@ -41,17 +41,19 @@ public class LatencyTest extends ActiveMQTestBase {
* */ * */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "trace ClientBootstrap.connect", @BMRule(
targetClass = "org.jboss.netty.bootstrap.ClientBootstrap", name = "trace ClientBootstrap.connect",
targetMethod = "connect", targetClass = "org.jboss.netty.bootstrap.ClientBootstrap",
targetLocation = "ENTRY", targetMethod = "connect",
action = "org.apache.activemq.artemis.tests.extras.byteman.LatencyTest.debugLog(\"netty connecting\")"), @BMRule( targetLocation = "ENTRY",
name = "sleep OioWorker.run", action = "org.apache.activemq.artemis.tests.extras.byteman.LatencyTest.debugLog(\"netty connecting\")"),
targetClass = "org.jboss.netty.channel.socket.oio.OioWorker", @BMRule(
targetMethod = "run", name = "sleep OioWorker.run",
targetLocation = "ENTRY", targetClass = "org.jboss.netty.channel.socket.oio.OioWorker",
action = "Thread.sleep(500)")}) targetMethod = "run",
targetLocation = "ENTRY",
action = "Thread.sleep(500)")})
public void testLatency() throws Exception { public void testLatency() throws Exception {
ActiveMQServer server = createServer(createDefaultNettyConfig()); ActiveMQServer server = createServer(createDefaultNettyConfig());
server.start(); server.start();

View File

@ -48,11 +48,12 @@ public class LoggingActiveMQServerPluginAMQPTest extends LoggingActiveMQServerPl
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test logAll EVENT", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test logAll EVENT",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogAll() throws Exception { public void testLogAll() throws Exception {
//initial plugin //initial plugin
@ -94,11 +95,12 @@ public class LoggingActiveMQServerPluginAMQPTest extends LoggingActiveMQServerPl
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_CONSUMER_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_CONSUMER_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogConsumerEvents() throws Exception { public void testLogConsumerEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONSUMER_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONSUMER_EVENTS);
@ -140,12 +142,12 @@ public class LoggingActiveMQServerPluginAMQPTest extends LoggingActiveMQServerPl
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_SESSION_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_SESSION_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogSessionEvents() throws Exception { public void testLogSessionEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS);

View File

@ -52,11 +52,12 @@ public class LoggingActiveMQServerPluginOpenWireTest extends LoggingActiveMQServ
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test queue creation log", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test queue creation log",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testQueueCreationLog() throws Exception { public void testQueueCreationLog() throws Exception {
//initial plugin //initial plugin
@ -100,12 +101,12 @@ public class LoggingActiveMQServerPluginOpenWireTest extends LoggingActiveMQServ
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_SESSION_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_SESSION_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogSessionEvents() throws Exception { public void testLogSessionEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS);
@ -141,11 +142,12 @@ public class LoggingActiveMQServerPluginOpenWireTest extends LoggingActiveMQServ
*/ */
@Override @Override
@Test @Test
@BMRules(rules = {@BMRule(name = "test logAll EVENT", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test logAll EVENT",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogAll() throws Exception { public void testLogAll() throws Exception {
//initial plugin //initial plugin

View File

@ -78,11 +78,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_CONNECTION_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_CONNECTION_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogConnectEvents() throws Exception { public void testLogConnectEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONNECTION_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONNECTION_EVENTS);
@ -129,11 +130,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_SESSION_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_SESSION_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogSessionEvents() throws Exception { public void testLogSessionEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_SESSION_EVENTS);
@ -165,11 +167,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_CONSUMER_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_CONSUMER_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogConsumerEvents() throws Exception { public void testLogConsumerEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONSUMER_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_CONSUMER_EVENTS);
@ -207,11 +210,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_DELIVERING_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_DELIVERING_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogDeliveringEvents() throws Exception { public void testLogDeliveringEvents() throws Exception {
ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_DELIVERING_EVENTS); ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_DELIVERING_EVENTS);
@ -249,11 +253,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test LOG_SENDING_EVENTS", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test LOG_SENDING_EVENTS",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogSendingEvents() throws Exception { public void testLogSendingEvents() throws Exception {
//initial plugin //initial plugin
@ -293,11 +298,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test queue creation log", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test queue creation log",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testQueueCreationLog() throws Exception { public void testQueueCreationLog() throws Exception {
//initial plugin //initial plugin
@ -336,11 +342,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test queue creation log", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test queue creation log",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testExpireMessageLog() throws Exception { public void testExpireMessageLog() throws Exception {
//initial plugin //initial plugin
@ -381,11 +388,12 @@ public class LoggingActiveMQServerPluginTest extends ActiveMQTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@BMRules(rules = {@BMRule(name = "test logAll EVENT", @BMRules(rules = {
targetClass = "org.jboss.logging.Logger", @BMRule(name = "test logAll EVENT",
targetMethod = "logv", targetClass = "org.jboss.logging.Logger",
targetLocation = "ENTRY", targetMethod = "logv",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")})
public void testLogAll() throws Exception { public void testLogAll() throws Exception {
//initial plugin //initial plugin

View File

@ -62,13 +62,13 @@ public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
} }
@Test @Test
@BMRules( @BMRules(rules = {
rules = {@BMRule( @BMRule(
name = "checking ActiveMQServerControl methods", name = "checking ActiveMQServerControl methods",
targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl", targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl",
targetMethod = "createQueue(org.apache.activemq.artemis.api.core.SimpleString, org.apache.activemq.artemis.api.core.RoutingType, org.apache.activemq.artemis.api.core.SimpleString, org.apache.activemq.artemis.api.core.SimpleString, boolean, boolean, int, boolean, boolean)", targetMethod = "createQueue(org.apache.activemq.artemis.api.core.SimpleString, org.apache.activemq.artemis.api.core.RoutingType, org.apache.activemq.artemis.api.core.SimpleString, org.apache.activemq.artemis.api.core.SimpleString, boolean, boolean, int, boolean, boolean)",
targetLocation = "EXIT", targetLocation = "EXIT",
action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")}) action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")})
public void testActiveMQServerControl() throws Exception { public void testActiveMQServerControl() throws Exception {
try { try {
server.getActiveMQServerControl().createQueue(new QueueConfiguration("some.queue").setAddress("some.address").setRoutingType(RoutingType.ANYCAST).toJSON()); server.getActiveMQServerControl().createQueue(new QueueConfiguration("some.queue").setAddress("some.address").setRoutingType(RoutingType.ANYCAST).toJSON());
@ -81,13 +81,13 @@ public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
} }
@Test @Test
@BMRules( @BMRules(rules = {
rules = {@BMRule( @BMRule(
name = "checking ActiveMQServerControl methods", name = "checking ActiveMQServerControl methods",
targetClass = "org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl", targetClass = "org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl",
targetMethod = "route(org.apache.activemq.artemis.api.core.Message, boolean)", targetMethod = "route(org.apache.activemq.artemis.api.core.Message, boolean)",
targetLocation = "ENTRY", targetLocation = "ENTRY",
action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")}) action = "throw new org.apache.activemq.artemis.api.core.ActiveMQException(\"gotcha\")")})
public void testAddressControl() throws Exception { public void testAddressControl() throws Exception {
server.getActiveMQServerControl().createAddress("test.address", "ANYCAST"); server.getActiveMQServerControl().createAddress("test.address", "ANYCAST");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

View File

@ -109,19 +109,21 @@ public class OrphanedConsumerTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "closeExit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", name = "closeExit",
targetMethod = "close", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
targetLocation = "AT EXIT", targetMethod = "close",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"), @BMRule( condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
name = "closeEnter", action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"),
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", @BMRule(
targetMethod = "close", name = "closeEnter",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", targetMethod = "close",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()")}) targetLocation = "ENTRY",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()")})
public void testOrphanedConsumers() throws Exception { public void testOrphanedConsumers() throws Exception {
internalTestOrphanedConsumers(false); internalTestOrphanedConsumers(false);
} }
@ -136,19 +138,21 @@ public class OrphanedConsumerTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "closeExit", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", name = "closeExit",
targetMethod = "close", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
targetLocation = "AT EXIT", targetMethod = "close",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"), @BMRule( condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
name = "closeEnter", action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"),
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", @BMRule(
targetMethod = "close", name = "closeEnter",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", targetMethod = "close",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()")}) targetLocation = "ENTRY",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.leavingCloseOnTestCountersWhileClosing()")})
public void testOrphanedConsumersByManagement() throws Exception { public void testOrphanedConsumersByManagement() throws Exception {
internalTestOrphanedConsumers(true); internalTestOrphanedConsumers(true);
} }

View File

@ -66,17 +66,19 @@ public class PagingLeakTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "newPosition", @BMRule(
targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl", name = "newPosition",
targetMethod = "<init>()", targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl",
targetLocation = "ENTRY", targetMethod = "<init>()",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingLeakTest.newPosition()"), @BMRule( targetLocation = "ENTRY",
name = "finalPosition", action = "org.apache.activemq.artemis.tests.extras.byteman.PagingLeakTest.newPosition()"),
targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl", @BMRule(
targetMethod = "finalize", name = "finalPosition",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PagePositionImpl",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingLeakTest.deletePosition()")}) targetMethod = "finalize",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingLeakTest.deletePosition()")})
public void testValidateLeak() throws Throwable { public void testValidateLeak() throws Throwable {
log.debug("location::" + getBindingsDir()); log.debug("location::" + getBindingsDir());

View File

@ -77,12 +77,13 @@ public class PagingOMETest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "fakeOME", @BMRule(
targetClass = "org.apache.activemq.artemis.core.paging.cursor.PagedReferenceImpl", name = "fakeOME",
targetMethod = "getPagedMessage", targetClass = "org.apache.activemq.artemis.core.paging.cursor.PagedReferenceImpl",
targetLocation = "ENTRY", targetMethod = "getPagedMessage",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingOMETest.refCheck()")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingOMETest.refCheck()")})
public void testPageCleanup() throws Exception { public void testPageCleanup() throws Exception {
clearDataRecreateServerDirs(); clearDataRecreateServerDirs();

View File

@ -32,6 +32,7 @@ import org.junit.runner.RunWith;
public class QueueDeploymentFailedTest extends ActiveMQTestBase { public class QueueDeploymentFailedTest extends ActiveMQTestBase {
@Test @Test
@BMRule(name = "blow up queue deployment", @BMRule(name = "blow up queue deployment",
targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl", targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl",
targetMethod = "createQueue(SimpleString,RoutingType,SimpleString,SimpleString,SimpleString,boolean,boolean,boolean,boolean,boolean,int,boolean,boolean,boolean,int,long,boolean", targetMethod = "createQueue(SimpleString,RoutingType,SimpleString,SimpleString,SimpleString,boolean,boolean,boolean,boolean,boolean,int,boolean,boolean,boolean,int,long,boolean",

View File

@ -97,12 +97,13 @@ public class RaceOnClosingConsumerWhileReconnecting extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "session.removeConsumer wait", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "session.removeConsumer wait",
targetMethod = "removeConsumer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal)", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "ENTRY", targetMethod = "removeConsumer(org.apache.activemq.artemis.core.client.impl.ClientConsumerInternal)",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.waitForReconnection();")}) targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.waitForReconnection();")})
public void testClosingConsumerBeforeReconnecting() throws Exception { public void testClosingConsumerBeforeReconnecting() throws Exception {
conn = session.getConnection(); conn = session.getConnection();
@ -119,12 +120,13 @@ public class RaceOnClosingConsumerWhileReconnecting extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "session.closeConsumer before recreating consumer", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "session.closeConsumer before recreating consumer",
targetMethod = "handleFailover", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "AFTER WRITE $consumerInternal 1", targetMethod = "handleFailover",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.closeConsumer();")}) targetLocation = "AFTER WRITE $consumerInternal 1",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.closeConsumer();")})
public void testClosingConsumerBeforeRecreatingOneConsumer() throws Exception { public void testClosingConsumerBeforeRecreatingOneConsumer() throws Exception {
RemotingConnection conn = session.getConnection(); RemotingConnection conn = session.getConnection();
@ -139,12 +141,13 @@ public class RaceOnClosingConsumerWhileReconnecting extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "session.closeConsumer before recreating consumer", @BMRule(
targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl", name = "session.closeConsumer before recreating consumer",
targetMethod = "handleFailover", targetClass = "org.apache.activemq.artemis.core.client.impl.ClientSessionImpl",
targetLocation = "AFTER WRITE $consumerInternal 1", targetMethod = "handleFailover",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.closeConsumer();")}) targetLocation = "AFTER WRITE $consumerInternal 1",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnClosingConsumerWhileReconnecting.closeConsumer();")})
public void testClosingConsumerBeforeRecreatingTwoConsumers() throws Exception { public void testClosingConsumerBeforeRecreatingTwoConsumers() throws Exception {
RemotingConnection conn = session.getConnection(); RemotingConnection conn = session.getConnection();

View File

@ -143,12 +143,13 @@ public class RaceOnCursorIteratorTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "raceLiveCache", @BMRule(
targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageSubscriptionImpl", name = "raceLiveCache",
targetMethod = "moveNextPage", targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageSubscriptionImpl",
targetLocation = "EXIT", targetMethod = "moveNextPage",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnCursorIteratorTest.raceAddLivePageCache()")}) targetLocation = "EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnCursorIteratorTest.raceAddLivePageCache()")})
public void testSkipLivePageCache() { public void testSkipLivePageCache() {
skipLivePageCache = true; skipLivePageCache = true;
// Simulate scenario #1 depicted in https://issues.apache.org/jira/browse/ARTEMIS-2418 // Simulate scenario #1 depicted in https://issues.apache.org/jira/browse/ARTEMIS-2418
@ -159,12 +160,13 @@ public class RaceOnCursorIteratorTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "raceLiveCache", @BMRule(
targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageSubscriptionImpl", name = "raceLiveCache",
targetMethod = "moveNextPage", targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageSubscriptionImpl",
targetLocation = "EXIT", targetMethod = "moveNextPage",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnCursorIteratorTest.raceAddLivePageCache()"), targetLocation = "EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnCursorIteratorTest.raceAddLivePageCache()"),
@BMRule( @BMRule(
name = "raceNullCache", name = "raceNullCache",
targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl", targetClass = "org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl",

View File

@ -160,17 +160,19 @@ public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "InterruptSending", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext", name = "InterruptSending",
targetMethod = "sendLargeMessageChunk", targetClass = "org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext",
targetLocation = "ENTRY", targetMethod = "sendLargeMessageChunk",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplication2Test.messageChunkSent();"), @BMRule( targetLocation = "ENTRY",
name = "InterruptSync", action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplication2Test.messageChunkSent();"),
targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager", @BMRule(
targetMethod = "sendLargeMessageFiles", name = "InterruptSync",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplication2Test.syncLargeMessage();")}) targetMethod = "sendLargeMessageFiles",
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplication2Test.syncLargeMessage();")})
public void testSendLargeMessage() throws Exception { public void testSendLargeMessage() throws Exception {
final CountDownLatch failedOver = new CountDownLatch(1); final CountDownLatch failedOver = new CountDownLatch(1);

View File

@ -150,12 +150,13 @@ public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase
*/ */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "InterruptSync", @BMRule(
targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager", name = "InterruptSync",
targetMethod = "createLargeMessage(long,org.apache.activemq.artemis.core.message.impl.MessageInternal)", targetClass = "org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager",
targetLocation = "EXIT", targetMethod = "createLargeMessage(long,org.apache.activemq.artemis.core.message.impl.MessageInternal)",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplicationTest.syncLargeMessage();")}) targetLocation = "EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.RaceOnSyncLargeMessageOverReplicationTest.syncLargeMessage();")})
public void testSendLargeMessage() throws Exception { public void testSendLargeMessage() throws Exception {
final CountDownLatch failedOver = new CountDownLatch(1); final CountDownLatch failedOver = new CountDownLatch(1);

View File

@ -43,12 +43,13 @@ public class ReplicationBackupTest extends ActiveMQTestBase {
*/ */
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "prevent backup annoucement", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation", name = "prevent backup annoucement",
targetMethod = "run", targetClass = "org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation",
targetLocation = "AT EXIT", targetMethod = "run",
action = "org.apache.activemq.artemis.tests.extras.byteman.ReplicationBackupTest.breakIt();")}) targetLocation = "AT EXIT",
action = "org.apache.activemq.artemis.tests.extras.byteman.ReplicationBackupTest.breakIt();")})
public void testReplicatedBackupAnnouncement() throws Exception { public void testReplicatedBackupAnnouncement() throws Exception {
TransportConfiguration liveConnector = TransportConfigurationUtils.getNettyConnector(true, 0); TransportConfiguration liveConnector = TransportConfigurationUtils.getNettyConnector(true, 0);
TransportConfiguration liveAcceptor = TransportConfigurationUtils.getNettyAcceptor(true, 0); TransportConfiguration liveAcceptor = TransportConfigurationUtils.getNettyAcceptor(true, 0);

View File

@ -52,23 +52,26 @@ public class StartStopDeadlockTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "Server.start wait-init", @BMRule(
targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl", name = "Server.start wait-init",
targetMethod = "initialisePart2", targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl",
targetLocation = "ENTRY", targetMethod = "initialisePart2",
condition = "incrementCounter(\"server-Init\") == 2", targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.StartStopDeadlockTest.debugLog(\"server backup init\"), waitFor(\"start-init\")"), @BMRule( condition = "incrementCounter(\"server-Init\") == 2",
name = "JMSServer.stop wait-init", action = "org.apache.activemq.artemis.tests.extras.byteman.StartStopDeadlockTest.debugLog(\"server backup init\"), waitFor(\"start-init\")"),
targetClass = "org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl", @BMRule(
targetMethod = "stop", name = "JMSServer.stop wait-init",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl",
action = "signalWake(\"start-init\", true)"), @BMRule( targetMethod = "stop",
name = "StartStopDeadlockTest tearDown", targetLocation = "ENTRY",
targetClass = "org.apache.activemq.artemis.tests.extras.byteman.StartStopDeadlockTest", action = "signalWake(\"start-init\", true)"),
targetMethod = "tearDown", @BMRule(
targetLocation = "ENTRY", name = "StartStopDeadlockTest tearDown",
action = "deleteCounter(\"server-Init\")")}) targetClass = "org.apache.activemq.artemis.tests.extras.byteman.StartStopDeadlockTest",
targetMethod = "tearDown",
targetLocation = "ENTRY",
action = "deleteCounter(\"server-Init\")")})
public void testDeadlock() throws Exception { public void testDeadlock() throws Exception {
// A live server that will always be crashed // A live server that will always be crashed

View File

@ -51,13 +51,14 @@ public class StompInternalStateTest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "StompProtocolManager Leak Server Rule", @BMRule(
targetClass = "org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManager", name = "StompProtocolManager Leak Server Rule",
targetMethod = "onNotification(org.apache.activemq.artemis.core.server.management.Notification)", targetClass = "org.apache.activemq.artemis.core.protocol.stomp.StompProtocolManager",
targetLocation = "EXIT", targetMethod = "onNotification(org.apache.activemq.artemis.core.server.management.Notification)",
helper = "org.apache.activemq.artemis.tests.extras.byteman.StompInternalStateTest", targetLocation = "EXIT",
action = "verifyBindingAddRemove($1, $0.destinations)")}) helper = "org.apache.activemq.artemis.tests.extras.byteman.StompInternalStateTest",
action = "verifyBindingAddRemove($1, $0.destinations)")})
public void testStompProtocolManagerLeak() throws Exception { public void testStompProtocolManagerLeak() throws Exception {
ClientSession session = null; ClientSession session = null;
try { try {

View File

@ -82,19 +82,21 @@ public class TimeoutXATest extends ActiveMQTestBase {
@Test @Test
@BMRules( @BMRules(
rules = {@BMRule( rules = {
name = "removing TX", @BMRule(
targetClass = "org.apache.activemq.artemis.core.transaction.impl.ResourceManagerImpl", name = "removing TX",
targetMethod = "removeTransaction(javax.transaction.xa.Xid)", targetClass = "org.apache.activemq.artemis.core.transaction.impl.ResourceManagerImpl",
targetLocation = "ENTRY", targetMethod = "removeTransaction(javax.transaction.xa.Xid)",
helper = "org.apache.activemq.artemis.tests.extras.byteman.TimeoutXATest", targetLocation = "ENTRY",
action = "removingTX()"), @BMRule( helper = "org.apache.activemq.artemis.tests.extras.byteman.TimeoutXATest",
name = "afterRollback TX", action = "removingTX()"),
targetClass = "org.apache.activemq.artemis.core.transaction.impl.TransactionImpl", @BMRule(
targetMethod = "afterRollback", name = "afterRollback TX",
targetLocation = "ENTRY", targetClass = "org.apache.activemq.artemis.core.transaction.impl.TransactionImpl",
helper = "org.apache.activemq.artemis.tests.extras.byteman.TimeoutXATest", targetMethod = "afterRollback",
action = "afterRollback()")}) targetLocation = "ENTRY",
helper = "org.apache.activemq.artemis.tests.extras.byteman.TimeoutXATest",
action = "afterRollback()")})
public void testTimeoutOnTX2() throws Exception { public void testTimeoutOnTX2() throws Exception {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
XAConnection connection = connectionFactory.createXAConnection(); XAConnection connection = connectionFactory.createXAConnection();

View File

@ -33,11 +33,21 @@ import org.junit.runner.RunWith;
public class FileSystemSyncBlockedTest extends CriticalAnalyzerFaultInjectionTestBase { public class FileSystemSyncBlockedTest extends CriticalAnalyzerFaultInjectionTestBase {
private static final Logger log = Logger.getLogger(FileSystemSyncBlockedTest.class); private static final Logger log = Logger.getLogger(FileSystemSyncBlockedTest.class);
@BMRules(rules = {@BMRule(name = "Simulate Slow Disk Sync", targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile", targetMethod = "sync", targetLocation = "ENTRY", condition = "!flagged(\"testSlowDiskSync\")", // Once the server shutdowns we stop applying this rule. @BMRules(rules = {
action = "waitFor(\"testSlowDiskSync\")"), @BMRule( @BMRule(
// We ensure that no more name = "Simulate Slow Disk Sync",
name = "Release Suspended Thread during Server Shutdown", // Releases wakes up suspended threads to allow shutdown to complete targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile",
targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl", targetMethod = "stop", targetLocation = "ENTRY", action = "flag(\"testSlowDiskSync\"); signalWake(\"testSlowDiskSync\")")}) targetMethod = "sync",
targetLocation = "ENTRY",
condition = "!flagged(\"testSlowDiskSync\")", // Once the server shutdowns we stop applying this rule.
action = "waitFor(\"testSlowDiskSync\")"),
@BMRule(
// We ensure that no more
name = "Release Suspended Thread during Server Shutdown", // Releases wakes up suspended threads to allow shutdown to complete
targetClass = "org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl",
targetMethod = "stop",
targetLocation = "ENTRY",
action = "flag(\"testSlowDiskSync\"); signalWake(\"testSlowDiskSync\")")})
@Test(timeout = 60000) @Test(timeout = 60000)
public void testSlowDiskSync() throws Exception { public void testSlowDiskSync() throws Exception {
testSendDurableMessage(); testSendDurableMessage();

View File

@ -107,8 +107,8 @@ import static org.apache.activemq.artemis.tests.util.ActiveMQTestBase.NETTY_ACCE
@RunWith(FrameworkRunner.class) @RunWith(FrameworkRunner.class)
@CreateDS(name = "Example", @CreateDS(name = "Example",
partitions = {@CreatePartition(name = "example", suffix = "dc=example,dc=com", partitions = {@CreatePartition(name = "example", suffix = "dc=example,dc=com",
contextEntry = @ContextEntry(entryLdif = "dn: dc=example,dc=com\n" + "dc: example\n" + "objectClass: top\n" + "objectClass: domain\n\n"), contextEntry = @ContextEntry(entryLdif = "dn: dc=example,dc=com\n" + "dc: example\n" + "objectClass: top\n" + "objectClass: domain\n\n"),
indexes = {@CreateIndex(attribute = "objectClass"), @CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou")})}, indexes = {@CreateIndex(attribute = "objectClass"), @CreateIndex(attribute = "dc"), @CreateIndex(attribute = "ou")})},
additionalInterceptors = { KeyDerivationInterceptor.class }) additionalInterceptors = { KeyDerivationInterceptor.class })
@CreateLdapServer(transports = {@CreateTransport(protocol = "LDAP", port = 1024)}, @CreateLdapServer(transports = {@CreateTransport(protocol = "LDAP", port = 1024)},

View File

@ -1494,7 +1494,7 @@ public class BridgeTest extends ActiveMQTestBase {
msgCount.incrementAndGet(); msgCount.incrementAndGet();
if (i % 500 == 0) if (i % 500 == 0)
instanceLog.debug("received " + i); instanceLog.debug("received " + i);
} }
boolean failed = false; boolean failed = false;