DSpaceServiceManager implements ServiceManagerSystem { public <T> List<T> getServicesByType(Class<T> type) { checkRunning(); if (type == null) { throw new IllegalArgumentException("type cannot be null"); } HashSet<T> set = new HashSet<T>(); for (ServiceManagerSystem sms : serviceManagers) { try { set.addAll( sms.getServicesByType(type) ); } catch (Exception e) { } } List<T> services = new ArrayList<T>(set); Collections.sort(services, new ServiceManagerUtils.ServiceComparator()); return services; } DSpaceServiceManager(DSpaceConfigurationService configurationService); protected  DSpaceServiceManager(DSpaceConfigurationService configurationService, String... springXmlConfigFiles); boolean isRunning(); void notifyServiceManagerReady(); @Override void shutdown(); @Override void startup(); void registerService(String name, Object service); @Override void registerServiceNoAutowire(String name, Object service); T registerServiceClass(String name, Class<T> type); void unregisterService(String name); T getServiceByName(String name, Class<T> type); List<T> getServicesByType(Class<T> type); List<String> getServicesNames(); boolean isServiceExists(String name); Map<String, Object> getServices(); void pushConfig(Map<String, Object> properties); static void configureService(String serviceName, Object service, ConfigurationService config); static void initService(Object service); static void shutdownService(Object service);  }
@Test public void testGetServicesByType() { dsm.startup(); int currentSize = dsm.getServicesByType(ConcreteExample.class).size(); assertTrue(currentSize > 0); List<ConcreteExample> l = dsm.getServicesByType(ConcreteExample.class); assertNotNull(l); assertEquals("azeckoski", l.get(0).getName()); l = null; List<SampleAnnotationBean> l2 = dsm.getServicesByType(SampleAnnotationBean.class); assertNotNull(l2); assertTrue(l2.size() >= 1); l2 = null; }