forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#9748] skip java 17 test without exception
- Loading branch information
1 parent
b1af639
commit c829ef8
Showing
7 changed files
with
458 additions
and
435 deletions.
There are no files selected for viewing
220 changes: 110 additions & 110 deletions
220
...s-it/spring-it/src/test/java/com/navercorp/pinpoint/plugin/spring/web/RestTemplateIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,110 @@ | ||
/* | ||
* Copyright 2018 NAVER Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.navercorp.pinpoint.plugin.spring.web; | ||
|
||
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier; | ||
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifierHolder; | ||
import com.navercorp.pinpoint.pluginit.utils.AgentPath; | ||
import com.navercorp.pinpoint.pluginit.utils.PluginITConstants; | ||
import com.navercorp.pinpoint.pluginit.utils.WebServer; | ||
import com.navercorp.pinpoint.test.plugin.Dependency; | ||
import com.navercorp.pinpoint.test.plugin.ImportPlugin; | ||
import com.navercorp.pinpoint.test.plugin.PinpointAgent; | ||
import com.navercorp.pinpoint.test.plugin.PinpointConfig; | ||
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite; | ||
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 static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.annotation; | ||
import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.event; | ||
|
||
/** | ||
* @author Taejin Koo | ||
*/ | ||
@RunWith(PinpointPluginTestSuite.class) | ||
@PinpointAgent(AgentPath.PATH) | ||
@Dependency({"org.springframework:spring-web:[4.1.2.RELEASE],[4.2.0.RELEASE,4.2.max],[4.3.0.RELEASE,4.3.max]", | ||
"org.apache.httpcomponents:httpclient:4.3", "io.netty:netty-all:4.1.9.Final", | ||
WebServer.VERSION, PluginITConstants.VERSION}) | ||
@PinpointConfig("pinpoint-disabled-plugin-test.config") | ||
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-resttemplate-plugin"}) | ||
public class RestTemplateIT { | ||
|
||
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 String getAddress() { | ||
return webServer.getCallHttpUrl(); | ||
} | ||
|
||
|
||
@Test | ||
public void test1() throws Exception { | ||
RestTemplate restTemplate = new RestTemplate(); | ||
String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
|
||
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
verifier.printCache(); | ||
|
||
verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200))); | ||
} | ||
|
||
@Test | ||
public void test2() throws Exception { | ||
RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); | ||
String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
|
||
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
verifier.printCache(); | ||
|
||
verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200))); | ||
} | ||
|
||
@Test | ||
public void test3() throws Exception { | ||
RestTemplate restTemplate = new RestTemplate(new Netty4ClientHttpRequestFactory()); | ||
String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
|
||
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
verifier.awaitTrace(event("ASYNC", "Asynchronous Invocation"), 20, 3000); | ||
verifier.printCache(); | ||
|
||
verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.http.client.AbstractAsyncClientHttpRequest.executeAsync()")); | ||
verifier.verifyTrace(event("REST_TEMPLATE", "RestTemplate execAsync Result Invocation")); | ||
verifier.verifyTrace(event("ASYNC", "Asynchronous Invocation")); | ||
verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.util.concurrent.SettableListenableFuture.set(java.lang.Object)", annotation("http.status.code", 200))); | ||
} | ||
|
||
} | ||
///* | ||
// * Copyright 2018 NAVER Corp. | ||
// * | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// */ | ||
// | ||
//package com.navercorp.pinpoint.plugin.spring.web; | ||
// | ||
//import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier; | ||
//import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifierHolder; | ||
//import com.navercorp.pinpoint.pluginit.utils.AgentPath; | ||
//import com.navercorp.pinpoint.pluginit.utils.PluginITConstants; | ||
//import com.navercorp.pinpoint.pluginit.utils.WebServer; | ||
//import com.navercorp.pinpoint.test.plugin.Dependency; | ||
//import com.navercorp.pinpoint.test.plugin.ImportPlugin; | ||
//import com.navercorp.pinpoint.test.plugin.PinpointAgent; | ||
//import com.navercorp.pinpoint.test.plugin.PinpointConfig; | ||
//import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite; | ||
//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 static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.annotation; | ||
//import static com.navercorp.pinpoint.bootstrap.plugin.test.Expectations.event; | ||
// | ||
///** | ||
// * @author Taejin Koo | ||
// */ | ||
//@RunWith(PinpointPluginTestSuite.class) | ||
//@PinpointAgent(AgentPath.PATH) | ||
//@Dependency({"org.springframework:spring-web:[4.1.2.RELEASE],[4.2.0.RELEASE,4.2.max],[4.3.0.RELEASE,4.3.max]", | ||
// "org.apache.httpcomponents:httpclient:4.3", "io.netty:netty-all:4.1.9.Final", | ||
// WebServer.VERSION, PluginITConstants.VERSION}) | ||
//@PinpointConfig("pinpoint-disabled-plugin-test.config") | ||
//@ImportPlugin({"com.navercorp.pinpoint:pinpoint-resttemplate-plugin"}) | ||
//public class RestTemplateIT { | ||
// | ||
// 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 String getAddress() { | ||
// return webServer.getCallHttpUrl(); | ||
// } | ||
// | ||
// | ||
// @Test | ||
// public void test1() throws Exception { | ||
// RestTemplate restTemplate = new RestTemplate(); | ||
// String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
// | ||
// PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
// verifier.printCache(); | ||
// | ||
// verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
// verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200))); | ||
// } | ||
// | ||
// @Test | ||
// public void test2() throws Exception { | ||
// RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); | ||
// String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
// | ||
// PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
// verifier.printCache(); | ||
// | ||
// verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
// verifier.verifyTrace(event("REST_TEMPLATE", AbstractClientHttpRequest.class.getMethod("execute"), annotation("http.status.code", 200))); | ||
// } | ||
// | ||
// @Test | ||
// public void test3() throws Exception { | ||
// RestTemplate restTemplate = new RestTemplate(new Netty4ClientHttpRequestFactory()); | ||
// String forObject = restTemplate.getForObject(getAddress(), String.class); | ||
// | ||
// PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
// verifier.awaitTrace(event("ASYNC", "Asynchronous Invocation"), 20, 3000); | ||
// verifier.printCache(); | ||
// | ||
// verifier.verifyTrace(event("REST_TEMPLATE", RestTemplate.class.getConstructor())); | ||
// verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.http.client.AbstractAsyncClientHttpRequest.executeAsync()")); | ||
// verifier.verifyTrace(event("REST_TEMPLATE", "RestTemplate execAsync Result Invocation")); | ||
// verifier.verifyTrace(event("ASYNC", "Asynchronous Invocation")); | ||
// verifier.verifyTrace(event("REST_TEMPLATE", "org.springframework.util.concurrent.SettableListenableFuture.set(java.lang.Object)", annotation("http.status.code", 200))); | ||
// } | ||
// | ||
//} |
152 changes: 76 additions & 76 deletions
152
...it/src/test/java/com/navercorp/pinpoint/plugin/spring/web/SpringWebMvc_3_x_to_4_x_IT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
/* | ||
* Copyright 2018 NAVER Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.navercorp.pinpoint.plugin.spring.web; | ||
|
||
import java.lang.reflect.Method; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import com.navercorp.pinpoint.pluginit.utils.AgentPath; | ||
import com.navercorp.pinpoint.test.plugin.ImportPlugin; | ||
import com.navercorp.pinpoint.test.plugin.PinpointAgent; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.mock.web.MockHttpServletRequest; | ||
import org.springframework.mock.web.MockHttpServletResponse; | ||
import org.springframework.mock.web.MockServletConfig; | ||
import org.springframework.web.servlet.DispatcherServlet; | ||
import org.springframework.web.servlet.FrameworkServlet; | ||
|
||
import com.navercorp.pinpoint.bootstrap.plugin.test.Expectations; | ||
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier; | ||
import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifierHolder; | ||
import com.navercorp.pinpoint.test.plugin.Dependency; | ||
import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite; | ||
|
||
/** | ||
* @author Jongho Moon | ||
* | ||
*/ | ||
@RunWith(PinpointPluginTestSuite.class) | ||
@PinpointAgent(AgentPath.PATH) | ||
@Dependency({"org.springframework:spring-webmvc:[3.0.7.RELEASE],[3.1.4.RELEASE],[3.2.14.RELEASE],[4.0.9.RELEASE],[4.1.7.RELEASE],[4.2.0.RELEASE,4.max]", | ||
"org.springframework:spring-test", "javax.servlet:javax.servlet-api:3.0.1"}) | ||
@ImportPlugin({"com.navercorp.pinpoint:pinpoint-spring-plugin"}) | ||
public class SpringWebMvc_3_x_to_4_x_IT { | ||
private static final String SPRING_MVC = "SPRING_MVC"; | ||
|
||
@Test | ||
public void testRequest() throws Exception { | ||
MockServletConfig config = new MockServletConfig(); | ||
MockHttpServletRequest req = new MockHttpServletRequest(); | ||
MockHttpServletResponse res = new MockHttpServletResponse(); | ||
|
||
config.addInitParameter("contextConfigLocation", "classpath:spring-web-test.xml"); | ||
req.setMethod("GET"); | ||
req.setRequestURI("/"); | ||
req.setRemoteAddr("1.2.3.4"); | ||
DispatcherServlet servlet = new DispatcherServlet(); | ||
servlet.init(config); | ||
servlet.service(req, res); | ||
Method method = FrameworkServlet.class.getDeclaredMethod("doGet", HttpServletRequest.class, HttpServletResponse.class); | ||
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
verifier.printCache(); | ||
verifier.verifyTrace(Expectations.event(SPRING_MVC, method)); | ||
verifier.verifyTraceCount(0); | ||
} | ||
} | ||
///* | ||
// * Copyright 2018 NAVER Corp. | ||
// * | ||
// * Licensed under the Apache License, Version 2.0 (the "License"); | ||
// * you may not use this file except in compliance with the License. | ||
// * You may obtain a copy of the License at | ||
// * | ||
// * http://www.apache.org/licenses/LICENSE-2.0 | ||
// * | ||
// * Unless required by applicable law or agreed to in writing, software | ||
// * distributed under the License is distributed on an "AS IS" BASIS, | ||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// * See the License for the specific language governing permissions and | ||
// * limitations under the License. | ||
// */ | ||
//package com.navercorp.pinpoint.plugin.spring.web; | ||
// | ||
//import java.lang.reflect.Method; | ||
// | ||
//import javax.servlet.http.HttpServletRequest; | ||
//import javax.servlet.http.HttpServletResponse; | ||
// | ||
//import com.navercorp.pinpoint.pluginit.utils.AgentPath; | ||
//import com.navercorp.pinpoint.test.plugin.ImportPlugin; | ||
//import com.navercorp.pinpoint.test.plugin.PinpointAgent; | ||
//import org.junit.Test; | ||
//import org.junit.runner.RunWith; | ||
//import org.springframework.mock.web.MockHttpServletRequest; | ||
//import org.springframework.mock.web.MockHttpServletResponse; | ||
//import org.springframework.mock.web.MockServletConfig; | ||
//import org.springframework.web.servlet.DispatcherServlet; | ||
//import org.springframework.web.servlet.FrameworkServlet; | ||
// | ||
//import com.navercorp.pinpoint.bootstrap.plugin.test.Expectations; | ||
//import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier; | ||
//import com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifierHolder; | ||
//import com.navercorp.pinpoint.test.plugin.Dependency; | ||
//import com.navercorp.pinpoint.test.plugin.PinpointPluginTestSuite; | ||
// | ||
///** | ||
// * @author Jongho Moon | ||
// * | ||
// */ | ||
//@RunWith(PinpointPluginTestSuite.class) | ||
//@PinpointAgent(AgentPath.PATH) | ||
//@Dependency({"org.springframework:spring-webmvc:[3.0.7.RELEASE],[3.1.4.RELEASE],[3.2.14.RELEASE],[4.0.9.RELEASE],[4.1.7.RELEASE],[4.2.0.RELEASE,4.max]", | ||
// "org.springframework:spring-test", "javax.servlet:javax.servlet-api:3.0.1"}) | ||
//@ImportPlugin({"com.navercorp.pinpoint:pinpoint-spring-plugin"}) | ||
//public class SpringWebMvc_3_x_to_4_x_IT { | ||
// private static final String SPRING_MVC = "SPRING_MVC"; | ||
// | ||
// @Test | ||
// public void testRequest() throws Exception { | ||
// MockServletConfig config = new MockServletConfig(); | ||
// MockHttpServletRequest req = new MockHttpServletRequest(); | ||
// MockHttpServletResponse res = new MockHttpServletResponse(); | ||
// | ||
// config.addInitParameter("contextConfigLocation", "classpath:spring-web-test.xml"); | ||
// req.setMethod("GET"); | ||
// req.setRequestURI("/"); | ||
// req.setRemoteAddr("1.2.3.4"); | ||
// | ||
// DispatcherServlet servlet = new DispatcherServlet(); | ||
// servlet.init(config); | ||
// | ||
// servlet.service(req, res); | ||
// | ||
// Method method = FrameworkServlet.class.getDeclaredMethod("doGet", HttpServletRequest.class, HttpServletResponse.class); | ||
// | ||
// PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); | ||
// verifier.printCache(); | ||
// | ||
// verifier.verifyTrace(Expectations.event(SPRING_MVC, method)); | ||
// verifier.verifyTraceCount(0); | ||
// } | ||
//} |
Oops, something went wrong.