DSpaceServiceManager implements ServiceManagerSystem { public void registerService(String name, Object service) { checkRunning(); if (name == null || service == null) { throw new IllegalArgumentException("name and service cannot be null"); } for (ServiceManagerSystem sms : serviceManagers) { sms.registerService(name, service); } } 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 testRegisterService() { dsm.startup(); String name = "myNewService"; dsm.registerService(name, "AZ"); String service = dsm.getServiceByName(name, String.class); assertNotNull(service); assertEquals("AZ", service); try { dsm.registerService("fakey", (Object)null); fail("should have thrown exception"); } catch (IllegalArgumentException e) { assertNotNull(e.getMessage()); } }