EventPublishingConfigService implements ConfigService, NacosServiceMetaData { @Override public String getConfig(String dataId, String group, long timeoutMs) throws NacosException { try { return configService.getConfig(dataId, group, timeoutMs); } catch (NacosException e) { if (NacosException.SERVER_ERROR == e.getErrCode()) { publishEvent(new NacosConfigTimeoutEvent(configService, dataId, group, timeoutMs, e.getErrMsg())); } throw e; } } EventPublishingConfigService(ConfigService configService,
			Properties properties, ConfigurableApplicationContext context,
			Executor executor); @Override String getConfig(String dataId, String group, long timeoutMs); @Override String getConfigAndSignListener(String dataId, String group, long timeoutMs,
			Listener listener); void addListener(String dataId, String group, String type, Listener listener); @Override void addListener(String dataId, String group, Listener listener); @Override boolean publishConfig(String dataId, String group, String content); @Override boolean removeConfig(String dataId, String group); @Override void removeListener(String dataId, String group, Listener listener); @Override String getServerStatus(); @Override Properties getProperties();  }
@Test public void testGetConfig() throws NacosException { configService.publishConfig(DATA_ID, GROUP_ID, CONTENT); Assert.assertEquals(CONTENT, configService.getConfig(DATA_ID, GROUP_ID, 5000)); }
@Test(expected = NacosException.class) public void testGetConfigOnTimeout() throws NacosException { final long timeout = -1L; context.addApplicationListener( new ApplicationListener<NacosConfigTimeoutEvent>() { @Override public void onApplicationEvent(NacosConfigTimeoutEvent event) { assertNacosConfigEvent(event); Assert.assertEquals(timeout, event.getTimeout()); Assert.assertEquals(TIMEOUT_ERROR_MESSAGE, event.getErrorMessage()); } }); configService.getConfig(DATA_ID, GROUP_ID, timeout); }