LocalManager extends Manager { @Override public void startManager() { startLocalManagement(); running = true; } LocalManager(ManagementResourceRepo repo, InternalDistributedSystem system,
      SystemManagementService service, InternalCache cache, StatisticsFactory statisticsFactory,
      StatisticsClock statisticsClock); @VisibleForTesting ScheduledExecutorService getFederationScheduler(); @VisibleForTesting void runManagementTaskAdhoc(); @Override boolean isRunning(); @Override void startManager(); @Override void stopManager(); Map<ObjectName, FederationComponent> getFedComponents();  }
@Test public void startLocalManagementCreatesMonitoringRegion() throws Exception { InternalDistributedMember member = member(1, 20); when(system.getDistributedMember()).thenReturn(member); LocalManager localManager = new LocalManager(repo, system, service, cache, statisticsFactory, statisticsClock); localManager.startManager(); verify(regionFactory1).create("_monitoringRegion_null<v1>20"); }
@Test public void addMemberArtifactsCreatesMonitoringRegionWithHasOwnStats() throws Exception { InternalDistributedMember member = member(2, 40); when(system.getDistributedMember()).thenReturn(member); LocalManager localManager = new LocalManager(repo, system, service, cache, statisticsFactory, statisticsClock); localManager.startManager(); ArgumentCaptor<HasCachePerfStats> captor = ArgumentCaptor.forClass(HasCachePerfStats.class); verify(regionFactory1).setCachePerfStatsHolder(captor.capture()); assertThat(captor.getValue().hasOwnStats()).isTrue(); }
@Test public void addMemberArtifactsCreatesNotificationRegion() throws Exception { InternalDistributedMember member = member(3, 60); when(system.getDistributedMember()).thenReturn(member); LocalManager localManager = new LocalManager(repo, system, service, cache, statisticsFactory, statisticsClock); localManager.startManager(); verify(regionFactory2).create("_notificationRegion_null<v3>60"); }
@Test public void addMemberArtifactsCreatesNotificationRegionWithHasOwnStats() throws Exception { InternalDistributedMember member = member(4, 80); when(system.getDistributedMember()).thenReturn(member); LocalManager localManager = new LocalManager(repo, system, service, cache, statisticsFactory, statisticsClock); localManager.startManager(); ArgumentCaptor<HasCachePerfStats> captor = ArgumentCaptor.forClass(HasCachePerfStats.class); verify(regionFactory2).setCachePerfStatsHolder(captor.capture()); assertThat(captor.getValue().hasOwnStats()).isTrue(); }