Skip to content

Commit

Permalink
[#8965] Apply SharedTestLifeCycle to RabbitMq
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jun 23, 2022
1 parent eee9f5e commit 9fd59aa
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
package com.navercorp.pinpoint.plugin.rabbitmq;

import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.plugin.rabbitmq.util.TestBroker;
import com.navercorp.pinpoint.test.plugin.shared.AfterSharedClass;
import com.navercorp.pinpoint.test.plugin.shared.BeforeSharedClass;

import com.rabbitmq.client.ConnectionFactory;
import org.junit.Before;
Expand All @@ -30,20 +27,10 @@
*/
public abstract class RabbitMQClientITBase {

private static final TestBroker BROKER = new TestBroker();

private final ConnectionFactory connectionFactory = new ConnectionFactory();
protected final RabbitMQTestRunner testRunner = new RabbitMQTestRunner(connectionFactory);

@BeforeSharedClass
public static void sharedSetUp() throws Exception {
BROKER.start();
}

@AfterSharedClass
public static void sharedTearDown() {
BROKER.shutdown();
}

@Before
public void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -36,6 +37,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"com.rabbitmq:amqp-client:[2.7.0,3.0.0)", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class RabbitMQClient_2_7_0_to_3_3_0_IT extends com.navercorp.pinpoint.plugin.rabbitmq.RabbitMQClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.rabbitmq.client.ConnectionFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -37,6 +38,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"com.rabbitmq:amqp-client:[3.3.0,4.0.0)", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class RabbitMQClient_3_3_0_to_4_0_0_IT extends RabbitMQClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.rabbitmq.client.ConnectionFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -37,6 +38,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"com.rabbitmq:amqp-client:[4.0.0,4.max)", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class RabbitMQClient_4_x_IT extends RabbitMQClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.rabbitmq.client.ConnectionFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -39,6 +40,7 @@
@Dependency({"com.rabbitmq:amqp-client:[5.0.0,)", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmVersion(8)
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class RabbitMQClient_5_x_IT extends RabbitMQClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.navercorp.pinpoint.plugin.rabbitmq;

import com.navercorp.pinpoint.plugin.rabbitmq.util.TestBroker;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycle;

import java.util.Properties;

public class TestBrokerServer implements SharedTestLifeCycle {
private TestBroker broker = new TestBroker();
@Override
public Properties beforeAll() {
this.broker = new TestBroker();
try {
broker.start();
} catch (Exception e) {
throw new RuntimeException("broker start error", e);
}
return new Properties();
}

@Override
public void afterAll() {
if (broker != null) {
broker.shutdown();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
package com.navercorp.pinpoint.plugin.rabbitmq.spring;

import com.navercorp.pinpoint.plugin.rabbitmq.util.TestBroker;
import com.navercorp.pinpoint.test.plugin.shared.AfterSharedClass;
import com.navercorp.pinpoint.test.plugin.shared.BeforeSharedClass;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestBeforeAllResult;

import java.util.Properties;

/**
* @author kootaejin
*/
public class SpringAmqpRabbitITBase {

private static final TestBroker BROKER = new TestBroker();

@BeforeSharedClass
public static void sharedSetUp() throws Exception {
BROKER.start();
}

@AfterSharedClass
public static void sharedTearDown() {
BROKER.shutdown();
@SharedTestBeforeAllResult
public static void setBeforeAllResult(Properties beforeAllResult) {
// empty
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -29,6 +30,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Pre_1_4_0;
Expand Down Expand Up @@ -56,6 +58,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"org.springframework.amqp:spring-rabbit:[1.3.5.RELEASE,1.4.2.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_1_3_3_to_1_4_2_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -29,6 +30,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -57,6 +59,7 @@
// 1.4.5, 1.4.6, 1.6.4.RELEASE has dependency issues
@Dependency({"org.springframework.amqp:spring-rabbit:[1.4.2.RELEASE,1.4.5.RELEASE),[1.5.0.RELEASE,1.6.4.RELEASE),[1.6.5.RELEASE,1.7.0.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_1_4_2_to_1_7_0_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -29,6 +30,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -56,6 +58,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"org.springframework.amqp:spring-rabbit:[1.7.0.RELEASE,1.7.7.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_1_7_0_to_1_7_7_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -29,6 +30,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -59,6 +61,7 @@
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-rabbitmq-plugin", "com.navercorp.pinpoint:pinpoint-jetty-plugin", "com.navercorp.pinpoint:pinpoint-user-plugin"})
@Dependency({"org.springframework.amqp:spring-rabbit:[1.7.7.RELEASE,2.0.0.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_1_7_7_to_2_0_0_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -30,6 +31,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -66,6 +68,7 @@
@Dependency({"org.springframework.amqp:spring-rabbit:[2.0.0.RELEASE,2.0.3.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmVersion(8)
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_2_0_0_to_2_0_3_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
Expand All @@ -30,6 +31,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -65,6 +67,7 @@
@Dependency({"org.springframework.amqp:spring-rabbit:[2.0.3.RELEASE,2.1.0.RELEASE)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmVersion(8)
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_2_0_3_to_2_1_0_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedTrace;
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.plugin.rabbitmq.TestBrokerServer;
import com.navercorp.pinpoint.plugin.rabbitmq.util.RabbitMQTestConstants;
import com.navercorp.pinpoint.plugin.rabbitmq.util.TestBroker;
import com.navercorp.pinpoint.pluginit.utils.AgentPath;
import com.navercorp.pinpoint.test.plugin.Dependency;
import com.navercorp.pinpoint.test.plugin.ImportPlugin;
Expand All @@ -31,6 +31,7 @@
import com.navercorp.pinpoint.test.plugin.PinpointConfig;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import com.navercorp.test.pinpoint.plugin.rabbitmq.PropagationMarker;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.CommonConfig;
import com.navercorp.test.pinpoint.plugin.rabbitmq.spring.config.MessageListenerConfig_Post_1_4_0;
Expand Down Expand Up @@ -65,6 +66,7 @@
@Dependency({"org.springframework.amqp:spring-rabbit:[2.1.0.RELEASE],(2.1.1.RELEASE,2.1.9.RELEASE),(2.1.9.RELEASE,)", "com.fasterxml.jackson.core:jackson-core:2.8.11", "org.apache.qpid:qpid-broker:6.1.1"})
@JvmVersion(8)
@JvmArgument("-DtestLoggerEnable=false")
@SharedTestLifeCycleClass(TestBrokerServer.class)
public class SpringAmqpRabbit_2_1_x_to_2_x_IT extends SpringAmqpRabbitITBase {

private static final TestApplicationContext CONTEXT = new TestApplicationContext();
Expand Down

0 comments on commit 9fd59aa

Please sign in to comment.