MBeanJMXAdapter implements ManagementConstants { public static String getMemberNameOrUniqueId(DistributedMember member) { if (member.getName() != null && !member.getName().equals("")) { return makeCompliantName(member.getName()); } return makeCompliantName(member.getUniqueId()); } MBeanJMXAdapter(DistributedMember distMember); ObjectName registerMBean(Object object, ObjectName objectName, boolean isGemFireMBean); boolean hasNotificationSupport(ObjectName objectName); void registerMBeanProxy(Object object, ObjectName objectName); void unregisterMBean(ObjectName objectName); Object getMBeanObject(ObjectName objectName); T findMBeanByName(ObjectName objectName, Class<T> interfaceClass); boolean isLocalMBean(ObjectName objectName); void unregisterAll(); void cleanJMXResource(); boolean isRegistered(ObjectName objectName); static String getMemberNameOrUniqueId(DistributedMember member); static String makeCompliantName(String value); static String makeCompliantRegionPath(String value); static String makeCompliantRegionNameAppender(String value); MemberMXBean getMemberMXBean(); RegionMXBean getLocalRegionMXBean(String regionPath); LockServiceMXBean getLocalLockServiceMXBean(String lockServiceName); DiskStoreMXBean getLocalDiskStoreMXBean(String disStoreName); CacheServerMXBean getClientServiceMXBean(int serverPort); DistributedLockServiceMXBean getDistributedLockServiceMXBean(String lockServiceName); DistributedRegionMXBean getDistributedRegionMXBean(String regionPath); ManagerMXBean getManagerMXBean(); DistributedSystemMXBean getDistributedSystemMXBean(); GatewayReceiverMXBean getGatewayReceiverMXBean(); GatewaySenderMXBean getGatewaySenderMXBean(String senderId); AsyncEventQueueMXBean getAsyncEventQueueMXBean(String queueId); LocatorMXBean getLocatorMXBean(); static ObjectName getObjectName(String name); static ObjectName getMemberMBeanName(DistributedMember member); static ObjectName getMemberMBeanName(String member); static ObjectName getRegionMBeanName(DistributedMember member, String regionPath); static ObjectName getRegionMBeanName(String member, String regionPath); static ObjectName getRegionMBeanName(ObjectName memberMBeanName, String regionPath); static ObjectName getDiskStoreMBeanName(DistributedMember member, String diskName); static ObjectName getDiskStoreMBeanName(String member, String diskName); static ObjectName getClientServiceMBeanName(int serverPort, DistributedMember member); static ObjectName getClientServiceMBeanName(int serverPort, String member); static ObjectName getLockServiceMBeanName(DistributedMember member,
      String lockServiceName); static ObjectName getLockServiceMBeanName(String member, String lockServiceName); static ObjectName getGatewayReceiverMBeanName(DistributedMember member); static ObjectName getGatewayReceiverMBeanName(String member); static ObjectName getGatewaySenderMBeanName(DistributedMember member, String id); static ObjectName getGatewaySenderMBeanName(String member, String id); static ObjectName getAsyncEventQueueMBeanName(DistributedMember member, String queueId); static ObjectName getDistributedRegionMbeanName(String regionPath); static ObjectName getDistributedRegionMbeanNameInternal(String regionPath); static ObjectName getDistributedLockServiceName(String lockService); static ObjectName getDistributedSystemName(); static ObjectName getManagerName(); static ObjectName getLocatorMBeanName(DistributedMember member); static ObjectName getLocatorMBeanName(String member); static ObjectName getCacheServiceMBeanName(DistributedMember member,
      String cacheServiceId); Map<ObjectName, Object> getLocalGemFireMBean(); static String getUniqueIDForMember(InternalDistributedMember member); static boolean isAttributeAvailable(String attributeName, String objectName); @MutableForTesting
  static MBeanServer mbeanServer; }
@Test public void getMemberNameOrUniqueIdReturnsNameIfProvided() { String memberName = "member-name"; when(distMember.getName()).thenReturn(memberName); String result = MBeanJMXAdapter.getMemberNameOrUniqueId(distMember); assertThat(result).isEqualTo(memberName); }
@Test public void getMemberNameOrUniqueIdReturnsUniqueIdIfNameIsNotProvided() { when(distMember.getName()).thenReturn(""); String result = MBeanJMXAdapter.getMemberNameOrUniqueId(distMember); assertThat(result).isEqualTo(UNIQUE_ID); }