Skip to content
Permalink
Browse files
6661: Simplify Agent JMX tests
Reviewed-by: hirt
  • Loading branch information
Jessye Coleman-Shapiro authored and thegreystone committed Jan 20, 2020
1 parent c2134e2 commit e647a9d122699bb1e4c5d2a39b93b91432fd4e7c
Showing with 5 additions and 7 deletions.
  1. +5 −7 core/org.openjdk.jmc.agent/src/test/java/org/openjdk/jmc/agent/test/TestDefineEventProbes.java
@@ -41,7 +41,7 @@
import java.util.HashMap;
import java.util.Map;

import javax.management.MBeanServer;
import javax.management.JMX;
import javax.management.ObjectName;

import org.junit.Test;
@@ -56,6 +56,7 @@
import org.openjdk.jmc.agent.ReturnValue;
import org.openjdk.jmc.agent.jfr.JFRTransformDescriptor;
import org.openjdk.jmc.agent.jfrnext.impl.JFRNextEventClassGenerator;
import org.openjdk.jmc.agent.jmx.AgentControllerMBean;
import org.openjdk.jmc.agent.util.TypeUtils;

public class TestDefineEventProbes {
@@ -160,12 +161,9 @@ protected void onMethodExit(int opcode) {
}

private void doDefineEventProbes(String xmlDescription) throws Exception {
ObjectName name = new ObjectName(AGENT_OBJECT_NAME);
Object[] parameters = {xmlDescription};
String[] signature = {String.class.getName()};

MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.invoke(name, "defineEventProbes", parameters, signature);
AgentControllerMBean mbean = JMX.newMXBeanProxy(ManagementFactory.getPlatformMBeanServer(),
new ObjectName(AGENT_OBJECT_NAME), AgentControllerMBean.class, false);
mbean.defineEventProbes(xmlDescription);
}

public void test() {

0 comments on commit e647a9d

Please sign in to comment.