use of org.apache.geode.distributed.internal.DistributionAdvisor.Profile in project geode by apache.
the class GridProfileTest method shouldBeMockable.
@Test
public void shouldBeMockable() throws Exception {
GridProfile mockGridProfile = mock(GridProfile.class);
ProfileId mockProfileId = mock(ProfileId.class);
List<Profile> listOfProfiles = new ArrayList<>();
listOfProfiles.add(mock(Profile.class));
when(mockGridProfile.getHost()).thenReturn("HOST");
when(mockGridProfile.getPort()).thenReturn(1);
when(mockGridProfile.getId()).thenReturn(mockProfileId);
mockGridProfile.setHost("host");
mockGridProfile.setPort(2);
mockGridProfile.tellLocalControllers(true, true, listOfProfiles);
mockGridProfile.tellLocalBridgeServers(true, true, listOfProfiles);
verify(mockGridProfile, times(1)).setHost("host");
verify(mockGridProfile, times(1)).setPort(2);
verify(mockGridProfile, times(1)).tellLocalControllers(true, true, listOfProfiles);
verify(mockGridProfile, times(1)).tellLocalBridgeServers(true, true, listOfProfiles);
assertThat(mockGridProfile.getHost()).isEqualTo("HOST");
assertThat(mockGridProfile.getPort()).isEqualTo(1);
assertThat(mockGridProfile.getId()).isSameAs(mockProfileId);
}
use of org.apache.geode.distributed.internal.DistributionAdvisor.Profile in project geode by apache.
the class FilterProfile method fillInCQRoutingInfo.
/**
* get continuous query routing information
*
* @param event the event to process
* @param peerProfiles the profiles getting this event
* @param frInfo the routing table to update
*/
private void fillInCQRoutingInfo(CacheEvent event, boolean processLocalProfile, Profile[] peerProfiles, FilterRoutingInfo frInfo) {
CqService cqService = getCqService(event.getRegion());
if (cqService != null) {
try {
Profile local = processLocalProfile ? this.localProfile : null;
cqService.processEvents(event, local, peerProfiles, frInfo);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// now, so don't let this thread continue.
throw err;
} catch (Throwable t) {
SystemFailure.checkFailure();
logger.error(LocalizedMessage.create(LocalizedStrings.CacheClientNotifier_EXCEPTION_OCCURRED_WHILE_PROCESSING_CQS), t);
}
}
}
Aggregations