Skip to content

Commit

Permalink
[pinpoint-apm#8965] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Jun 24, 2022
1 parent b6a406a commit bea06df
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 159 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@
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.SharedTestBeforeAllResult;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingMessage;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.interceptor.MessageSenderInterceptor;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.message.Message;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Properties;

import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.annotation;
import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.event;

Expand All @@ -51,18 +49,22 @@
@Dependency({"org.apache.cxf:cxf-rt-rs-client:[3.0.0][3.0.16][3.1.0][3.1.16],[3.2.1,)", WebServer.VERSION, PluginITConstants.VERSION})
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-cxf-plugin", "com.navercorp.pinpoint:pinpoint-jdk-http-plugin"})
@PinpointConfig("cxf/pinpoint-cxf-test.config")
@SharedTestLifeCycleClass(HttpWebServer.class)
public class CxfClientIT {

private static String HOST_PORT;
public static WebServer webServer;

@BeforeClass
public static void beforeClass() throws Exception {
webServer = WebServer.newTestWebServer();
}

@SharedTestBeforeAllResult
public static void setBeforeAllResult(Properties beforeAllResult) {
HOST_PORT = beforeAllResult.getProperty("HOST_PORT");
@AfterClass
public static void afterClass() throws Exception {
webServer = WebServer.cleanup(webServer);
}

public String getAddress() {
return "http://" + HOST_PORT;
return webServer.getCallHttpUrl();
}

@Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,45 @@
import com.navercorp.pinpoint.test.plugin.ImportPlugin;
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestBeforeAllResult;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Properties;

/**
* @author jaehong.kim
*/
@RunWith(PinpointPluginTestSuite.class)
@PinpointAgent(AgentPath.PATH)
@ImportPlugin("com.navercorp.pinpoint:pinpoint-httpclient3-plugin")
@Dependency({ "commons-httpclient:commons-httpclient:[3.0],[3.0.1],[3.1]", WebServer.VERSION, PluginITConstants.VERSION})
@SharedTestLifeCycleClass(HttpWebServer.class)
public class HttpClientIT {

private static String HOST_PORT;
public static WebServer webServer;

@BeforeClass
public static void beforeClass() throws Exception {
webServer = WebServer.newTestWebServer();

}

@SharedTestBeforeAllResult
public static void setBeforeAllResult(Properties beforeAllResult) {
HOST_PORT = beforeAllResult.getProperty("HOST_PORT");
@AfterClass
public static void afterClass() throws Exception {
webServer = WebServer.cleanup(webServer);
}

public String getAddress() {
return "http://" + HOST_PORT;
return webServer.getCallHttpUrl();
}

public static String getHostPort() {
return webServer.getHostAndPort();
}


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.apache.http.HttpClientConnection;
import org.apache.http.HttpEntity;
import org.apache.http.HttpRequest;
Expand Down Expand Up @@ -56,7 +55,6 @@
@ImportPlugin("com.navercorp.pinpoint:pinpoint-httpclient4-plugin")
@Dependency({"org.apache.httpcomponents:httpclient:[4.3],[4.3.1],[4.3.2],[4.3.3],[4.3.4],[4.3.6],[4.4],[4.4.1],[4.5],[4.5.1],[4.5.2],[4.5.3],[4.5.4],[4.3.5]",
WebServer.VERSION, PluginITConstants.VERSION})
@SharedTestLifeCycleClass(HttpWebServer.class)
public class CloaeableHttpClientIT extends HttpClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.apache.http.Consts;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
Expand Down Expand Up @@ -58,7 +57,6 @@
@ImportPlugin("com.navercorp.pinpoint:pinpoint-httpclient4-plugin")
@Dependency({"org.apache.httpcomponents:httpasyncclient:[4.0],[4.0.1],[4.0.2],[4.1],[4.1.1],[4.1.2],[4.1.3]",
WebServer.VERSION, PluginITConstants.VERSION})
@SharedTestLifeCycleClass(HttpWebServer.class)
public class ClosableAsyncHttpClientIT extends HttpClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
@ImportPlugin("com.navercorp.pinpoint:pinpoint-httpclient4-plugin")
@Dependency({"org.apache.httpcomponents:httpclient:[4.0],[4.0.1],[4.0.2],[4.0.3],[4.1],[4.1.1],[4.1.2],[4.1.3],[4.2],[4.2.1],[4.2.2],[4.2.3],[4.2.4],[4.2.4],[4.2.6],[4.3.3]",
WebServer.VERSION, PluginITConstants.VERSION})
@SharedTestLifeCycleClass(HttpWebServer.class)
public class HttpClientIT extends HttpClientITBase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,31 @@

package com.navercorp.pinpoint.plugin.httpclient4;

import com.navercorp.pinpoint.test.plugin.shared.SharedTestBeforeAllResult;
import com.navercorp.pinpoint.pluginit.utils.WebServer;
import org.junit.AfterClass;
import org.junit.BeforeClass;

import java.util.Properties;

public abstract class HttpClientITBase {
public static WebServer webServer;

private static String ADDRESS;
private static String HOST_PORT;
@BeforeClass
public static void beforeClass() throws Exception {
webServer = WebServer.newTestWebServer();

@SharedTestBeforeAllResult
public static void setBeforeAllResult(Properties beforeAllResult) {
HOST_PORT = beforeAllResult.getProperty("HOST_PORT");
}

@AfterClass
public static void afterClass() throws Exception {
webServer = WebServer.cleanup(webServer);
}

public String getAddress() {
return "http://" + HOST_PORT;
return webServer.getCallHttpUrl();
}

public static String getHostPort() {
return HOST_PORT;
return webServer.getHostAndPort();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.navercorp.pinpoint.test.plugin.JvmVersion;
import com.navercorp.pinpoint.test.plugin.PinpointAgent;
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -54,6 +55,7 @@
@Dependency({"mysql:mysql-connector-java:[5.1.6],[5.1.34],[5.1.36,5.max]",
"log4j:log4j:1.2.16", "org.slf4j:slf4j-log4j12:1.7.5",
JDBCTestConstants.VERSION, TestcontainersOption.MYSQLDB})
@SharedTestLifeCycleClass(MySqlServer.class)
public class MySqlLoadBalance_5_X_IT extends MySql_IT_Base {

private final Logger logger = LogManager.getLogger(this.getClass());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@
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.SharedTestBeforeAllResult;
import com.navercorp.pinpoint.test.plugin.shared.SharedTestLifeCycleClass;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.http.client.AbstractClientHttpRequest;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.Netty4ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import java.util.Properties;

import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.annotation;
import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.event;

Expand All @@ -50,24 +48,29 @@
WebServer.VERSION, PluginITConstants.VERSION})
@PinpointConfig("pinpoint-disabled-plugin-test.config")
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-resttemplate-plugin"})
@SharedTestLifeCycleClass(HttpWebServer.class)
public class RestTemplateIT {

private static String HOST_PORT;
@SharedTestBeforeAllResult
public static void setBeforeAllResult(Properties beforeAllResult) {
HOST_PORT = beforeAllResult.getProperty("HOST_PORT");
public static WebServer webServer;

@BeforeClass
public static void beforeClass() throws Exception {
webServer = WebServer.newTestWebServer();
}

@AfterClass
public static void afterClass() throws Exception {
webServer = WebServer.cleanup(webServer);
}

public static String getCallUrl() {
return "http://" + HOST_PORT;
public String getAddress() {
return webServer.getCallHttpUrl();
}


@Test
public void test1() throws Exception {
RestTemplate restTemplate = new RestTemplate();
String forObject = restTemplate.getForObject(getCallUrl(), String.class);
String forObject = restTemplate.getForObject(getAddress(), String.class);

PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Expand All @@ -79,7 +82,7 @@ public void test1() throws Exception {
@Test
public void test2() throws Exception {
RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
String forObject = restTemplate.getForObject(getCallUrl(), String.class);
String forObject = restTemplate.getForObject(getAddress(), String.class);

PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Expand All @@ -91,7 +94,7 @@ public void test2() throws Exception {
@Test
public void test3() throws Exception {
RestTemplate restTemplate = new RestTemplate(new Netty4ClientHttpRequestFactory());
String forObject = restTemplate.getForObject(getCallUrl(), String.class);
String forObject = restTemplate.getForObject(getAddress(), String.class);

PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.awaitTrace(event("ASYNC", "Asynchronous Invocation"), 20, 3000);
Expand Down

0 comments on commit bea06df

Please sign in to comment.