Java Code Examples for org.springframework.jmx.export.MBeanExporter#setAssembler()
The following examples show how to use
org.springframework.jmx.export.MBeanExporter#setAssembler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MBeanClientInterceptorTests.java From spring-analysis-note with MIT License | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 2
Source File: AbstractMetadataAssemblerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }
Example 3
Source File: MBeanClientInterceptorTests.java From java-technology-stack with MIT License | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 4
Source File: AbstractMetadataAssemblerTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }
Example 5
Source File: MBeanConfiguration.java From JuniperBot with GNU General Public License v3.0 | 5 votes |
@Bean @Lazy(false) public MBeanExporter mBeanExporter() { MBeanExporter exporter = new MBeanExporter(); exporter.setAutodetect(true); exporter.setNamingStrategy(namingStrategy()); exporter.setAssembler(infoAssembler()); exporter.setEnsureUniqueRuntimeObjectNames(false); return exporter; }
Example 6
Source File: MBeanClientInterceptorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void onSetUp() throws Exception { target = new JmxTestBean(); target.setAge(100); target.setName("Rob Harrop"); MBeanExporter adapter = new MBeanExporter(); Map<String, Object> beans = new HashMap<String, Object>(); beans.put(OBJECT_NAME, target); adapter.setServer(getServer()); adapter.setBeans(beans); adapter.setAssembler(new ProxyTestAssembler()); start(adapter); }
Example 7
Source File: AbstractMetadataAssemblerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testWithCglibProxy() throws Exception { IJmxTestBean tb = createJmxTestBean(); ProxyFactory pf = new ProxyFactory(); pf.setTarget(tb); pf.addAdvice(new NopInterceptor()); Object proxy = pf.getProxy(); MetadataMBeanInfoAssembler assembler = (MetadataMBeanInfoAssembler) getAssembler(); MBeanExporter exporter = new MBeanExporter(); exporter.setBeanFactory(getContext()); exporter.setAssembler(assembler); String objectName = "spring:bean=test,proxy=true"; Map<String, Object> beans = new HashMap<String, Object>(); beans.put(objectName, proxy); exporter.setBeans(beans); start(exporter); MBeanInfo inf = getServer().getMBeanInfo(ObjectNameManager.getInstance(objectName)); assertEquals("Incorrect number of operations", getExpectedOperationCount(), inf.getOperations().length); assertEquals("Incorrect number of attributes", getExpectedAttributeCount(), inf.getAttributes().length); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); }