From 4bb42b6acc9d4c445748371cf60d85fd1915c86b Mon Sep 17 00:00:00 2001 From: kornilova Date: Thu, 8 Feb 2018 20:17:04 +0200 Subject: [PATCH] Updated agent tests --- .../github/kornilova_l/flamegraph/proxy/TestWithProxy.java | 3 ++- .../github/kornilova_l/proxy_test_classes/ReturnsValue.java | 5 +++++ .../kornilova_l/proxy_test_classes/ThrowsException.java | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/agent-test/src/test/java/com/github/kornilova_l/flamegraph/proxy/TestWithProxy.java b/agent-test/src/test/java/com/github/kornilova_l/flamegraph/proxy/TestWithProxy.java index 81aa235e..c78c3e33 100644 --- a/agent-test/src/test/java/com/github/kornilova_l/flamegraph/proxy/TestWithProxy.java +++ b/agent-test/src/test/java/com/github/kornilova_l/flamegraph/proxy/TestWithProxy.java @@ -67,7 +67,8 @@ static void addProxy() { try { Method method = urlClass.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); - method.invoke(urlClassLoader, Paths.get(pathToAgentDir.toString(), "proxy.jar").toUri().toURL()); + method.invoke(urlClassLoader, + new URL(Paths.get(pathToAgentDir.toString(), "proxy.jar").toUri().toString().replaceAll("%20", " "))); } catch (NoSuchMethodException | IllegalAccessException | MalformedURLException | InvocationTargetException e) { e.printStackTrace(); } diff --git a/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ReturnsValue.java b/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ReturnsValue.java index ad6de107..98f9821d 100644 --- a/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ReturnsValue.java +++ b/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ReturnsValue.java @@ -5,6 +5,11 @@ public class ReturnsValue implements TestModule { @Override public int run(long l, String s, double d) { System.out.println(l + s + d); + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } return 42; } } diff --git a/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ThrowsException.java b/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ThrowsException.java index e2b4ab26..d1f4162c 100644 --- a/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ThrowsException.java +++ b/agent-test/src/test/java/com/github/kornilova_l/proxy_test_classes/ThrowsException.java @@ -4,6 +4,11 @@ public class ThrowsException implements TestModule { @Override public int run(long l, String s, double d) { System.out.println(l + s + d); + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } throw new RuntimeException("I am an exception"); } }