use of javax.management.ObjectName in project camel by apache.
the class TestSupportJmxCleanup method removeMBeans.
public static void removeMBeans(String domain) throws Exception {
MBeanServer mbsc = ManagementFactory.getPlatformMBeanServer();
Set<ObjectName> s = mbsc.queryNames(new ObjectName(getDomainName(domain) + ":*"), null);
for (ObjectName on : s) {
mbsc.unregisterMBean(on);
}
}
use of javax.management.ObjectName in project camel by apache.
the class LanguageLoadScriptFromFileCachedTest method testClearCachedScriptViaJmx.
public void testClearCachedScriptViaJmx() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Hello World", "Hello World", "Bye World");
template.sendBody("direct:start", "World");
// even if we update the file the content is cached
template.sendBodyAndHeader("file:target/script", "Bye ${body}", Exchange.FILE_NAME, "myscript.txt");
template.sendBody("direct:start", "World");
// now clear the cache via the mbean server
MBeanServer mbeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
Set<ObjectName> objNameSet = mbeanServer.queryNames(new ObjectName("org.apache.camel:type=endpoints,name=\"language://simple:*contentCache=true*\",*"), null);
ObjectName managedObjName = new ArrayList<ObjectName>(objNameSet).get(0);
mbeanServer.invoke(managedObjName, "clearContentCache", null, null);
template.sendBody("direct:start", "World");
assertMockEndpointsSatisfied();
}
use of javax.management.ObjectName in project camel by apache.
the class DualManagedThreadPoolWithIdTest method testManagedThreadPool.
public void testManagedThreadPool() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = ObjectName.getInstance("org.apache.camel:context=camel-1,type=threadpools,name=\"myThreads(threads)\"");
Integer corePoolSize = (Integer) mbeanServer.getAttribute(on, "CorePoolSize");
assertEquals(15, corePoolSize.intValue());
Integer maxPoolSize = (Integer) mbeanServer.getAttribute(on, "MaximumPoolSize");
assertEquals(30, maxPoolSize.intValue());
String id = (String) mbeanServer.getAttribute(on, "Id");
assertEquals("myThreads", id);
String source = (String) mbeanServer.getAttribute(on, "SourceId");
assertEquals("threads", source);
String route = (String) mbeanServer.getAttribute(on, "RouteId");
assertEquals("route1", route);
on = ObjectName.getInstance("org.apache.camel:context=camel-1,type=threadpools,name=\"myOtherThreads(threads)\"");
corePoolSize = (Integer) mbeanServer.getAttribute(on, "CorePoolSize");
assertEquals(1, corePoolSize.intValue());
maxPoolSize = (Integer) mbeanServer.getAttribute(on, "MaximumPoolSize");
assertEquals(2, maxPoolSize.intValue());
id = (String) mbeanServer.getAttribute(on, "Id");
assertEquals("myOtherThreads", id);
source = (String) mbeanServer.getAttribute(on, "SourceId");
assertEquals("threads", source);
route = (String) mbeanServer.getAttribute(on, "RouteId");
assertEquals("route2", route);
}
use of javax.management.ObjectName in project camel by apache.
the class EndpointCompletionTest method testEndpointConfigurationJson.
public void testEndpointConfigurationJson() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = ObjectName.getInstance("org.apache.camel:context=camel-1,type=context,name=\"camel-1\"");
assertNotNull(on);
mbeanServer.isRegistered(on);
assertParameterJsonSchema(mbeanServer, on, "bean");
assertParameterJsonSchema(mbeanServer, on, "timer");
}
use of javax.management.ObjectName in project camel by apache.
the class EndpointCompletionTest method testEndpointCompletion.
public void testEndpointCompletion() throws Exception {
// JMX tests dont work well on AIX CI servers (hangs them)
if (isPlatform("aix")) {
return;
}
MBeanServer mbeanServer = getMBeanServer();
ObjectName on = ObjectName.getInstance("org.apache.camel:context=camel-1,type=context,name=\"camel-1\"");
assertNotNull(on);
mbeanServer.isRegistered(on);
String componentName = "file";
Map<String, Object> properties = new HashMap<String, Object>();
assertCompletion(mbeanServer, on, componentName, properties, "");
assertCompletion(mbeanServer, on, componentName, properties, "po");
assertCompletion(mbeanServer, on, componentName, properties, "/");
assertCompletion(mbeanServer, on, componentName, properties, "/usr/local");
assertCompletion(mbeanServer, on, componentName, properties, "/usr/local/");
assertCompletion(mbeanServer, on, componentName, properties, "/usr/local/b");
}
Aggregations