Commit 2f24e4ee authored by Yiming Liu's avatar Yiming Liu

Merge pull request #111 from nobodyiam/log-cat-refactor

Refactor client log and cat
parents 2d0b0e8a 2c62b51e
...@@ -42,7 +42,7 @@ public class ConfigService { ...@@ -42,7 +42,7 @@ public class ConfigService {
return null; return null;
} }
ApolloConfig config = new ApolloConfig(release.getAppId(), release.getClusterName(), ApolloConfig config = new ApolloConfig(release.getAppId(), release.getClusterName(),
namespaceName, release.getId()); namespaceName, String.valueOf(release.getId()));
config.setConfigurations(transformConfigurationToMap(release.getConfigurations())); config.setConfigurations(transformConfigurationToMap(release.getConfigurations()));
return config; return config;
} }
......
...@@ -22,7 +22,7 @@ public abstract class AbstractConfigRepository implements ConfigRepository { ...@@ -22,7 +22,7 @@ public abstract class AbstractConfigRepository implements ConfigRepository {
sync(); sync();
} catch (Throwable ex) { } catch (Throwable ex) {
Cat.logError(ex); Cat.logError(ex);
logger.error("Sync config failed with repository {}", this.getClass(), ex); logger.warn("Sync config failed with repository {}, reason: {}", this.getClass(), ex);
} }
} }
......
...@@ -29,6 +29,9 @@ public class ConfigServiceLocator { ...@@ -29,6 +29,9 @@ public class ConfigServiceLocator {
private AtomicReference<List<ServiceDTO>> m_configServices; private AtomicReference<List<ServiceDTO>> m_configServices;
private Type m_responseType; private Type m_responseType;
/**
* Create a config service locator
*/
public ConfigServiceLocator() { public ConfigServiceLocator() {
List<ServiceDTO> initial = Lists.newArrayList(); List<ServiceDTO> initial = Lists.newArrayList();
m_configServices = new AtomicReference<>(initial); m_configServices = new AtomicReference<>(initial);
...@@ -64,7 +67,7 @@ public class ConfigServiceLocator { ...@@ -64,7 +67,7 @@ public class ConfigServiceLocator {
try { try {
HttpResponse<List<ServiceDTO>> response = m_httpUtil.doGet(request, m_responseType); HttpResponse<List<ServiceDTO>> response = m_httpUtil.doGet(request, m_responseType);
m_configServices.set(response.getBody()); m_configServices.set(response.getBody());
Cat.logEvent("Apollo.Config.Services", response.getBody().toString()); logConfigServicesToCat(response.getBody());
transaction.setStatus(Message.SUCCESS); transaction.setStatus(Message.SUCCESS);
return; return;
} catch (Throwable ex) { } catch (Throwable ex) {
...@@ -77,11 +80,17 @@ public class ConfigServiceLocator { ...@@ -77,11 +80,17 @@ public class ConfigServiceLocator {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) { } catch (InterruptedException ex) {
//ignore //ignore
} }
} }
throw new RuntimeException("Get config services failed", exception); throw new RuntimeException("Get config services failed", exception);
} }
private void logConfigServicesToCat(List<ServiceDTO> serviceDTOs) {
for (ServiceDTO serviceDTO : serviceDTOs) {
Cat.logEvent("Apollo.Config.Services", serviceDTO.getHomepageUrl());
}
}
} }
...@@ -48,10 +48,9 @@ public class DefaultConfig extends AbstractConfig implements RepositoryChangeLis ...@@ -48,10 +48,9 @@ public class DefaultConfig extends AbstractConfig implements RepositoryChangeLis
m_configProperties.set(m_configRepository.getConfig()); m_configProperties.set(m_configRepository.getConfig());
m_configRepository.addChangeListener(this); m_configRepository.addChangeListener(this);
} catch (Throwable ex) { } catch (Throwable ex) {
String message = String.format("Init Apollo Local Config failed - namespace: %s",
m_namespace);
Cat.logError(ex); Cat.logError(ex);
logger.error(message, ex); logger.warn("Init Apollo Local Config failed - namespace: {}, reason: {}.",
m_namespace, ex);
} }
} }
......
...@@ -4,6 +4,8 @@ import com.google.common.base.Preconditions; ...@@ -4,6 +4,8 @@ import com.google.common.base.Preconditions;
import com.ctrip.apollo.util.ConfigUtil; import com.ctrip.apollo.util.ConfigUtil;
import com.dianping.cat.Cat; import com.dianping.cat.Cat;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
...@@ -85,12 +87,19 @@ public class LocalFileConfigRepository extends AbstractConfigRepository ...@@ -85,12 +87,19 @@ public class LocalFileConfigRepository extends AbstractConfigRepository
@Override @Override
protected void sync() { protected void sync() {
Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "queryLocalConfigFile");
Throwable exception = null;
try { try {
transaction.addData("Basedir", m_baseDir.getAbsolutePath());
m_fileProperties = this.loadFromLocalCacheFile(m_baseDir, m_namespace); m_fileProperties = this.loadFromLocalCacheFile(m_baseDir, m_namespace);
transaction.setStatus(Message.SUCCESS);
} catch (Throwable ex) { } catch (Throwable ex) {
Cat.logError(ex); Cat.logError(ex);
ex.printStackTrace(); transaction.setStatus(ex);
exception = ex;
//ignore //ignore
} finally {
transaction.complete();
} }
//sync with fallback immediately //sync with fallback immediately
...@@ -98,7 +107,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository ...@@ -98,7 +107,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository
if (m_fileProperties == null) { if (m_fileProperties == null) {
throw new RuntimeException( throw new RuntimeException(
"Load config from local config failed!"); "Load config from local config failed!", exception);
} }
} }
...@@ -111,7 +120,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository ...@@ -111,7 +120,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository
updateFileProperties(properties); updateFileProperties(properties);
} catch (Throwable ex) { } catch (Throwable ex) {
Cat.logError(ex); Cat.logError(ex);
logger.warn("Sync config from fallback repository {} failed", m_fallback.getClass(), ex); logger.warn("Sync config from fallback repository {} failed, reason: {}", m_fallback.getClass(), ex);
} }
} }
...@@ -166,12 +175,16 @@ public class LocalFileConfigRepository extends AbstractConfigRepository ...@@ -166,12 +175,16 @@ public class LocalFileConfigRepository extends AbstractConfigRepository
OutputStream out = null; OutputStream out = null;
Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "persistLocalConfigFile");
transaction.addData("LocalConfigFile", file.getAbsolutePath());
try { try {
out = new FileOutputStream(file); out = new FileOutputStream(file);
m_fileProperties.store(out, "Persisted by DefaultConfig"); m_fileProperties.store(out, "Persisted by DefaultConfig");
transaction.setStatus(Message.SUCCESS);
} catch (IOException ex) { } catch (IOException ex) {
Cat.logError(ex); Cat.logError(ex);
logger.error("Persist local cache file {} failed", file.getAbsolutePath(), ex); transaction.setStatus(ex);
logger.warn("Persist local cache file {} failed, reason: {}.", file.getAbsolutePath(), ex);
} finally { } finally {
if (out != null) { if (out != null) {
try { try {
...@@ -180,6 +193,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository ...@@ -180,6 +193,7 @@ public class LocalFileConfigRepository extends AbstractConfigRepository
//ignore //ignore
} }
} }
transaction.complete();
} }
} }
......
...@@ -78,7 +78,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository { ...@@ -78,7 +78,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
} }
private void schedulePeriodicRefresh() { private void schedulePeriodicRefresh() {
logger.info("Schedule periodic refresh with interval: {} {}", logger.debug("Schedule periodic refresh with interval: {} {}",
m_configUtil.getRefreshInterval(), m_configUtil.getRefreshTimeUnit()); m_configUtil.getRefreshInterval(), m_configUtil.getRefreshTimeUnit());
this.m_executorService.scheduleAtFixedRate( this.m_executorService.scheduleAtFixedRate(
new Runnable() { new Runnable() {
...@@ -100,7 +100,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository { ...@@ -100,7 +100,7 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
return; return;
} }
logger.info("Remote Config changes!"); logger.debug("Remote Config refreshed!");
m_configCache.set(current); m_configCache.set(current);
...@@ -162,20 +162,19 @@ public class RemoteConfigRepository extends AbstractConfigRepository { ...@@ -162,20 +162,19 @@ public class RemoteConfigRepository extends AbstractConfigRepository {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) { } catch (InterruptedException ex) {
//ignore //ignore
} }
} }
String message = String.format( String message = String.format(
"Load Apollo Config failed - appId: %s, cluster: %s, namespace: %s, services: %s", "Load Apollo Config failed - appId: %s, cluster: %s, namespace: %s, services: %s",
appId, cluster, m_namespace, configServices); appId, cluster, m_namespace, configServices);
logger.error(message, exception);
throw new RuntimeException(message, exception); throw new RuntimeException(message, exception);
} }
private String assembleUrl(String uri, String appId, String cluster, String namespace, private String assembleUrl(String uri, String appId, String cluster, String namespace,
ApolloConfig previousConfig) { ApolloConfig previousConfig) {
String path = "config/%s/%s"; String path = "configs/%s/%s";
List<String> params = Lists.newArrayList(appId, cluster); List<String> params = Lists.newArrayList(appId, cluster);
if (!Strings.isNullOrEmpty(namespace)) { if (!Strings.isNullOrEmpty(namespace)) {
......
...@@ -25,7 +25,8 @@ public class SimpleConfig extends AbstractConfig implements RepositoryChangeList ...@@ -25,7 +25,8 @@ public class SimpleConfig extends AbstractConfig implements RepositoryChangeList
/** /**
* Constructor. * Constructor.
* @param namespace the namespace for this config instance *
* @param namespace the namespace for this config instance
* @param configRepository the config repository for this config instance * @param configRepository the config repository for this config instance
*/ */
public SimpleConfig(String namespace, ConfigRepository configRepository) { public SimpleConfig(String namespace, ConfigRepository configRepository) {
...@@ -39,10 +40,8 @@ public class SimpleConfig extends AbstractConfig implements RepositoryChangeList ...@@ -39,10 +40,8 @@ public class SimpleConfig extends AbstractConfig implements RepositoryChangeList
m_configProperties = m_configRepository.getConfig(); m_configProperties = m_configRepository.getConfig();
m_configRepository.addChangeListener(this); m_configRepository.addChangeListener(this);
} catch (Throwable ex) { } catch (Throwable ex) {
String message = String.format("Init Apollo Simple Config failed - namespace: %s", Cat.logError(ex);
m_namespace); logger.warn("Init Apollo Simple Config failed - namespace: {}, reason: {}", m_namespace, ex);
Cat.logError(message, ex);
logger.error(message, ex);
} }
} }
......
...@@ -6,6 +6,8 @@ import com.ctrip.apollo.internals.DefaultConfig; ...@@ -6,6 +6,8 @@ import com.ctrip.apollo.internals.DefaultConfig;
import com.ctrip.apollo.internals.LocalFileConfigRepository; import com.ctrip.apollo.internals.LocalFileConfigRepository;
import com.ctrip.apollo.internals.RemoteConfigRepository; import com.ctrip.apollo.internals.RemoteConfigRepository;
import com.dianping.cat.Cat; import com.dianping.cat.Cat;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -36,11 +38,19 @@ public class DefaultConfigFactory implements ConfigFactory { ...@@ -36,11 +38,19 @@ public class DefaultConfigFactory implements ConfigFactory {
if (baseDir.exists()) { if (baseDir.exists()) {
return; return;
} }
Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "createLocalConfigDir");
transaction.addData("BaseDir", baseDir.getAbsolutePath());
try { try {
Files.createDirectory(baseDir.toPath()); Files.createDirectory(baseDir.toPath());
transaction.setStatus(Message.SUCCESS);
} catch (IOException ex) { } catch (IOException ex) {
Cat.logError(ex); Cat.logError(ex);
logger.error("Unable to create directory: " + baseDir, ex); transaction.setStatus(ex);
logger.warn(
"Unable to create local config cache directory {}, reason: {}. Will not able to cache config file.",
baseDir, ex);
} finally {
transaction.complete();
} }
} }
......
...@@ -31,7 +31,7 @@ public class HttpUtil { ...@@ -31,7 +31,7 @@ public class HttpUtil {
public HttpUtil() { public HttpUtil() {
gson = new Gson(); gson = new Gson();
try { try {
basicAuth = "Basic " + BaseEncoding.base64().encode("".getBytes("UTF-8")); basicAuth = "Basic " + BaseEncoding.base64().encode("user:".getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -41,7 +41,7 @@ import static org.junit.Assert.assertThat; ...@@ -41,7 +41,7 @@ import static org.junit.Assert.assertThat;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
public class ConfigIntegrationTest extends BaseIntegrationTest { public class ConfigIntegrationTest extends BaseIntegrationTest {
private long someReleaseId; private String someReleaseId;
private File configDir; private File configDir;
private String someNamespace; private String someNamespace;
...@@ -50,7 +50,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest { ...@@ -50,7 +50,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest {
super.setUp(); super.setUp();
someNamespace = ConfigConsts.NAMESPACE_APPLICATION; someNamespace = ConfigConsts.NAMESPACE_APPLICATION;
someReleaseId = 1; someReleaseId = "1";
configDir = new File(ClassLoaderUtil.getClassPath() + "config-cache"); configDir = new File(ClassLoaderUtil.getClassPath() + "config-cache");
configDir.mkdirs(); configDir.mkdirs();
} }
...@@ -195,8 +195,13 @@ public class ConfigIntegrationTest extends BaseIntegrationTest { ...@@ -195,8 +195,13 @@ public class ConfigIntegrationTest extends BaseIntegrationTest {
final List<ConfigChangeEvent> changeEvents = Lists.newArrayList(); final List<ConfigChangeEvent> changeEvents = Lists.newArrayList();
config.addChangeListener(new ConfigChangeListener() { config.addChangeListener(new ConfigChangeListener() {
AtomicInteger counter = new AtomicInteger(0);
@Override @Override
public void onChange(ConfigChangeEvent changeEvent) { public void onChange(ConfigChangeEvent changeEvent) {
//only need to assert once
if (counter.incrementAndGet() > 1) {
return;
}
assertEquals(1, changeEvent.getChanges().size()); assertEquals(1, changeEvent.getChanges().size());
assertEquals(someValue, changeEvent.getChange(someKey).getOldValue()); assertEquals(someValue, changeEvent.getChange(someKey).getOldValue());
assertEquals(anotherValue, changeEvent.getChange(someKey).getNewValue()); assertEquals(anotherValue, changeEvent.getChange(someKey).getNewValue());
...@@ -207,7 +212,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest { ...@@ -207,7 +212,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest {
apolloConfig.getConfigurations().put(someKey, anotherValue); apolloConfig.getConfigurations().put(someKey, anotherValue);
Thread.sleep(someRefreshTimeUnit.toMillis(someRefreshInterval * 2)); someRefreshTimeUnit.sleep(someRefreshInterval * 2);
assertThat( assertThat(
"Change event's size should equal to one or there must be some assertion failed in change listener", "Change event's size should equal to one or there must be some assertion failed in change listener",
...@@ -217,7 +222,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest { ...@@ -217,7 +222,7 @@ public class ConfigIntegrationTest extends BaseIntegrationTest {
private ContextHandler mockConfigServerHandler(final int statusCode, final ApolloConfig result, private ContextHandler mockConfigServerHandler(final int statusCode, final ApolloConfig result,
final boolean failedAtFirstTime) { final boolean failedAtFirstTime) {
ContextHandler context = new ContextHandler("/config/*"); ContextHandler context = new ContextHandler("/configs/*");
context.setHandler(new AbstractHandler() { context.setHandler(new AbstractHandler() {
AtomicInteger counter = new AtomicInteger(0); AtomicInteger counter = new AtomicInteger(0);
......
...@@ -107,7 +107,7 @@ public class RemoteConfigRepositoryTest extends ComponentTestCase { ...@@ -107,7 +107,7 @@ public class RemoteConfigRepositoryTest extends ComponentTestCase {
private ApolloConfig assembleApolloConfig(Map<String, String> configurations) { private ApolloConfig assembleApolloConfig(Map<String, String> configurations) {
String someAppId = "appId"; String someAppId = "appId";
String someClusterName = "cluster"; String someClusterName = "cluster";
long someReleaseId = 1; String someReleaseId = "1";
ApolloConfig apolloConfig = ApolloConfig apolloConfig =
new ApolloConfig(someAppId, someClusterName, someNamespace, someReleaseId); new ApolloConfig(someAppId, someClusterName, someNamespace, someReleaseId);
......
...@@ -20,25 +20,28 @@ import javax.servlet.http.HttpServletResponse; ...@@ -20,25 +20,28 @@ import javax.servlet.http.HttpServletResponse;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@RestController @RestController
@RequestMapping("/config") @RequestMapping("/configs")
public class ConfigController { public class ConfigController {
@Autowired @Autowired
private ConfigService configService; private ConfigService configService;
@RequestMapping(value = "/{appId}/{clusterName}", method = RequestMethod.GET) @RequestMapping(value = "/{appId}/{clusterName}", method = RequestMethod.GET)
public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName, public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName,
@RequestParam(value = "releaseId", defaultValue = "-1") long clientSideReleaseId, @RequestParam(value = "releaseId", defaultValue = "-1") String clientSideReleaseId,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
return this.queryConfig(appId, clusterName, ConfigConsts.NAMESPACE_APPLICATION, clientSideReleaseId, return this
.queryConfig(appId, clusterName, ConfigConsts.NAMESPACE_APPLICATION, clientSideReleaseId,
response); response);
} }
@RequestMapping(value = "/{appId}/{clusterName}/{namespace}", method = RequestMethod.GET) @RequestMapping(value = "/{appId}/{clusterName}/{namespace}", method = RequestMethod.GET)
public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName, public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName,
@PathVariable String namespace, @PathVariable String namespace,
@RequestParam(value = "releaseId", defaultValue = "-1") long clientSideReleaseId, @RequestParam(value = "releaseId", defaultValue = "-1") String clientSideReleaseId,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
Release release = configService.findRelease(appId, clusterName, namespace); Release release = configService.findRelease(appId, clusterName, namespace);
//TODO if namespace != application, should also query config by namespace and DC?
//And if found, should merge config, as well as releaseId -> make releaseId a string?
if (release == null) { if (release == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND, response.sendError(HttpServletResponse.SC_NOT_FOUND,
String.format( String.format(
...@@ -46,7 +49,7 @@ public class ConfigController { ...@@ -46,7 +49,7 @@ public class ConfigController {
appId, clusterName, namespace)); appId, clusterName, namespace));
return null; return null;
} }
if (release.getId() == clientSideReleaseId) { if (String.valueOf(release.getId()).equals(clientSideReleaseId)) {
// Client side configuration is the same with server side, return 304 // Client side configuration is the same with server side, return 304
response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return null; return null;
......
...@@ -57,7 +57,7 @@ public class ConfigControllerTest { ...@@ -57,7 +57,7 @@ public class ConfigControllerTest {
when(configService.loadConfig(someRelease, someNamespaceName)).thenReturn(someApolloConfig); when(configService.loadConfig(someRelease, someNamespaceName)).thenReturn(someApolloConfig);
ApolloConfig result = configController.queryConfig(someAppId, someClusterName, ApolloConfig result = configController.queryConfig(someAppId, someClusterName,
someNamespaceName, someClientSideReleaseId, someResponse); someNamespaceName, String.valueOf(someClientSideReleaseId), someResponse);
assertEquals(someApolloConfig, result); assertEquals(someApolloConfig, result);
verify(configService, times(1)).findRelease(someAppId, someClusterName, someNamespaceName); verify(configService, times(1)).findRelease(someAppId, someClusterName, someNamespaceName);
...@@ -76,7 +76,7 @@ public class ConfigControllerTest { ...@@ -76,7 +76,7 @@ public class ConfigControllerTest {
when(configService.findRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); when(configService.findRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null);
ApolloConfig result = configController.queryConfig(someAppId, someClusterName, ApolloConfig result = configController.queryConfig(someAppId, someClusterName,
someNamespaceName, someClientSideReleaseId, someResponse); someNamespaceName, String.valueOf(someClientSideReleaseId), someResponse);
assertNull(result); assertNull(result);
verify(someResponse, times(1)).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString()); verify(someResponse, times(1)).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
...@@ -98,7 +98,7 @@ public class ConfigControllerTest { ...@@ -98,7 +98,7 @@ public class ConfigControllerTest {
when(configService.loadConfig(someRelease, someNamespaceName)).thenReturn(null); when(configService.loadConfig(someRelease, someNamespaceName)).thenReturn(null);
ApolloConfig result = configController.queryConfig(someAppId, someClusterName, ApolloConfig result = configController.queryConfig(someAppId, someClusterName,
someNamespaceName, someClientSideReleaseId, someResponse); someNamespaceName, String.valueOf(someClientSideReleaseId), someResponse);
assertNull(result); assertNull(result);
verify(someResponse, times(1)).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString()); verify(someResponse, times(1)).sendError(eq(HttpServletResponse.SC_NOT_FOUND), anyString());
...@@ -119,7 +119,7 @@ public class ConfigControllerTest { ...@@ -119,7 +119,7 @@ public class ConfigControllerTest {
when(someRelease.getId()).thenReturn(someServerSideReleaseId); when(someRelease.getId()).thenReturn(someServerSideReleaseId);
ApolloConfig result = configController.queryConfig(someAppId, someClusterName, someNamespaceName, ApolloConfig result = configController.queryConfig(someAppId, someClusterName, someNamespaceName,
someClientSideReleaseId, someResponse); String.valueOf(someClientSideReleaseId), someResponse);
assertNull(result); assertNull(result);
verify(someResponse, times(1)).setStatus(HttpServletResponse.SC_NOT_MODIFIED); verify(someResponse, times(1)).setStatus(HttpServletResponse.SC_NOT_MODIFIED);
......
...@@ -17,12 +17,12 @@ public class ApolloConfig { ...@@ -17,12 +17,12 @@ public class ApolloConfig {
private Map<String, String> configurations; private Map<String, String> configurations;
private long releaseId; private String releaseId;
public ApolloConfig(String appId, public ApolloConfig(String appId,
String cluster, String cluster,
String namespace, String namespace,
long releaseId) { String releaseId) {
super(); super();
this.appId = appId; this.appId = appId;
this.cluster = cluster; this.cluster = cluster;
...@@ -42,7 +42,7 @@ public class ApolloConfig { ...@@ -42,7 +42,7 @@ public class ApolloConfig {
return namespace; return namespace;
} }
public long getReleaseId() { public String getReleaseId() {
return releaseId; return releaseId;
} }
......
package com.ctrip.apollo.core.dto;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class ApolloConfigNotification {
private final String appId;
private final String cluster;
private final String namespace;
public ApolloConfigNotification(String appId, String cluster, String namespace) {
this.appId = appId;
this.cluster = cluster;
this.namespace = namespace;
}
public String getAppId() {
return appId;
}
public String getCluster() {
return cluster;
}
public String getNamespace() {
return namespace;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment