use of org.apache.geode.distributed.internal.membership.gms.messenger.JGroupsMessenger in project geode by apache.
the class StatRecorderJUnitTest method messengerStackHoldsStatRecorder.
/**
* Ensure that the messenger JGroups configuration XML strings contain the statistics recorder
* protocol
*/
@Test
public void messengerStackHoldsStatRecorder() throws Exception {
Services mockServices = mock(Services.class);
ServiceConfig mockConfig = mock(ServiceConfig.class);
when(mockServices.getConfig()).thenReturn(mockConfig);
// first test to see if the non-multicast stack has the recorder installed
Properties nonDefault = new Properties();
nonDefault.put(MCAST_PORT, "0");
nonDefault.put(LOCATORS, "localhost[12345]");
DistributionConfigImpl config = new DistributionConfigImpl(nonDefault);
when(mockConfig.getDistributionConfig()).thenReturn(config);
RemoteTransportConfig transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE);
when(mockConfig.getTransport()).thenReturn(transport);
JGroupsMessenger messenger = new JGroupsMessenger();
messenger.init(mockServices);
String jgroupsConfig = messenger.getJGroupsStackConfig();
System.out.println(jgroupsConfig);
assertTrue(jgroupsConfig.contains("gms.messenger.StatRecorder"));
// now test to see if the multicast stack has the recorder installed
nonDefault.put(MCAST_PORT, "12345");
config = new DistributionConfigImpl(nonDefault);
transport = new RemoteTransportConfig(config, DistributionManager.NORMAL_DM_TYPE);
when(mockConfig.getDistributionConfig()).thenReturn(config);
when(mockConfig.getTransport()).thenReturn(transport);
messenger = new JGroupsMessenger();
messenger.init(mockServices);
assertTrue(jgroupsConfig.contains("gms.messenger.StatRecorder"));
}
use of org.apache.geode.distributed.internal.membership.gms.messenger.JGroupsMessenger in project geode by apache.
the class DistributedSystemDUnitTest method testMembershipPortRangeWithExactThreeValues.
@Test
public void testMembershipPortRangeWithExactThreeValues() throws Exception {
Properties config = new Properties();
config.setProperty(LOCATORS, "localhost[" + getDUnitLocatorPort() + "]");
config.setProperty(MEMBERSHIP_PORT_RANGE, this.lowerBoundOfPortRange + "-" + this.upperBoundOfPortRange);
InternalDistributedSystem system = getSystem(config);
Cache cache = CacheFactory.create(system);
cache.addCacheServer();
DistributionManager dm = (DistributionManager) system.getDistributionManager();
InternalDistributedMember member = dm.getDistributionManagerId();
GMSMembershipManager gms = (GMSMembershipManager) MembershipManagerHelper.getMembershipManager(system);
JGroupsMessenger messenger = (JGroupsMessenger) gms.getServices().getMessenger();
String jgConfig = messenger.getJGroupsStackConfig();
assertThat(jgConfig).as("expected to find port_range=\"2\" in " + jgConfig).contains("port_range=\"2\"");
verifyMembershipPortsInRange(member, this.lowerBoundOfPortRange, this.upperBoundOfPortRange);
}
Aggregations