Search in sources :

Example 1 with Profile

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);
}
Also used : ProfileId(org.apache.geode.distributed.internal.DistributionAdvisor.ProfileId) GridProfile(org.apache.geode.internal.cache.GridAdvisor.GridProfile) ArrayList(java.util.ArrayList) Profile(org.apache.geode.distributed.internal.DistributionAdvisor.Profile) GridProfile(org.apache.geode.internal.cache.GridAdvisor.GridProfile) Test(org.junit.Test) UnitTest(org.apache.geode.test.junit.categories.UnitTest)

Example 2 with Profile

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);
        }
    }
}
Also used : CqService(org.apache.geode.cache.query.internal.cq.CqService) CacheProfile(org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile) Profile(org.apache.geode.distributed.internal.DistributionAdvisor.Profile)

Aggregations

Profile (org.apache.geode.distributed.internal.DistributionAdvisor.Profile)2 ArrayList (java.util.ArrayList)1 CqService (org.apache.geode.cache.query.internal.cq.CqService)1 ProfileId (org.apache.geode.distributed.internal.DistributionAdvisor.ProfileId)1 CacheProfile (org.apache.geode.internal.cache.CacheDistributionAdvisor.CacheProfile)1 GridProfile (org.apache.geode.internal.cache.GridAdvisor.GridProfile)1 UnitTest (org.apache.geode.test.junit.categories.UnitTest)1 Test (org.junit.Test)1