ServiceDomainManager { public ServiceDomain createDomain() { return createDomain(ROOT_DOMAIN, null); } ServiceDomainManager();  ServiceDomainManager(SystemSecurity systemSecurity); ServiceDomain createDomain(); ServiceDomain createDomain(QName domainName, SwitchYardModel switchyardConfig); EventManager getEventManager(); ServiceRegistry getRegistry(); static final String[] MBEAN_DISALLOWED_STRINGS; static final QName ROOT_DOMAIN; }
@Test public void testHandlerRegistration() throws Exception { SwitchYardModel switchyard = new ModelPuller<SwitchYardModel>().pull( "/switchyard-config-properties-01.xml", getClass()); ServiceDomain domain = new ServiceDomainManager().createDomain( new QName("test"), switchyard); Assert.assertEquals("abc-value", domain.getProperty("abc")); Assert.assertEquals("xyz-value", domain.getProperty("xyz")); Assert.assertNull(domain.getProperty("nothing")); }
@Test public void testJMXName() throws Exception { SwitchYardModel switchyard = new ModelPuller<SwitchYardModel>().pull( "/switchyard-config-properties-01.xml", getClass()); String contextNamespace = "http String contextName = "test"; QName serviceDomain = new QName(contextNamespace, contextName); ServiceDomainManager domainManager = new ServiceDomainManager(); ServiceDomain domain = domainManager.createDomain(serviceDomain, switchyard); MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); Method method = ServiceDomainManager.class.getDeclaredMethod("sanitizeServiceQNameForMBean", QName.class); method.setAccessible(true); String mBeanContextName = (String) method.invoke(domainManager, serviceDomain); String objectNameString = MBEAN_PREFIX + mBeanContextName + MBEAN_INTERMEDIATE + '"' + mBeanContextName + '"'; MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(new ObjectName(objectNameString)); Assert.assertNotNull(mBeanInfo); Assert.assertNull(domain.getProperty("nothing")); }