@Test public void addService() { Mockery context = new Mockery(); MMFMonitoringDataManager monitoringDataManager = new MMFMonitoringDataManager(MONITORING_FILE); try { assertNotNull(monitoringDataManager); MonitoringEntityFactory monitoringEntityFactory = monitoringDataManager.initialize(); try { assertNotNull(monitoringEntityFactory); MonitoredService monitoredService = context.mock(MonitoredService.class); context.checking(new Expectations() {{ oneOf(monitoredService).getServiceName(); }}); ServiceCounterManagerImpl serviceCounterManager = monitoringDataManager.addService(monitoredService); assertNotNull(serviceCounterManager); } finally { monitoringEntityFactory.close(); } } finally { monitoringDataManager.close(); } }
@Override public ServiceCounterManagerImpl addService(MonitoredService monitoredService) { MonitoringEntityFactory serviceCountersFactory = monitorFileWriter.getServiceMonitoringEntityFactory( monitoredService, serviceCount); serviceCount++; return new ServiceCounterManagerImpl(serviceCountersFactory); }
MMFMonitoringDataManager implements MonitoringDataManager { @Override public ServiceCounterManagerImpl addService(MonitoredService monitoredService) { MonitoringEntityFactory serviceCountersFactory = monitorFileWriter.getServiceMonitoringEntityFactory( monitoredService, serviceCount); serviceCount++; return new ServiceCounterManagerImpl(serviceCountersFactory); } }
MMFMonitoringDataManager implements MonitoringDataManager { @Override public ServiceCounterManagerImpl addService(MonitoredService monitoredService) { MonitoringEntityFactory serviceCountersFactory = monitorFileWriter.getServiceMonitoringEntityFactory( monitoredService, serviceCount); serviceCount++; return new ServiceCounterManagerImpl(serviceCountersFactory); } MMFMonitoringDataManager(String gatewayId); }
MMFMonitoringDataManager implements MonitoringDataManager { @Override public ServiceCounterManagerImpl addService(MonitoredService monitoredService) { MonitoringEntityFactory serviceCountersFactory = monitorFileWriter.getServiceMonitoringEntityFactory( monitoredService, serviceCount); serviceCount++; return new ServiceCounterManagerImpl(serviceCountersFactory); } MMFMonitoringDataManager(String gatewayId); @Override MonitoringEntityFactory initialize(); @Override ServiceCounterManagerImpl addService(MonitoredService monitoredService); @Override void close(); }
MMFMonitoringDataManager implements MonitoringDataManager { @Override public ServiceCounterManagerImpl addService(MonitoredService monitoredService) { MonitoringEntityFactory serviceCountersFactory = monitorFileWriter.getServiceMonitoringEntityFactory( monitoredService, serviceCount); serviceCount++; return new ServiceCounterManagerImpl(serviceCountersFactory); } MMFMonitoringDataManager(String gatewayId); @Override MonitoringEntityFactory initialize(); @Override ServiceCounterManagerImpl addService(MonitoredService monitoredService); @Override void close();  }