Browse files

Merge pull request #29 from racker/upgrade_to_2.0.0_and_improve_stuff

Upgrade to 2.0.0 and improve stuff
  • Loading branch information...
2 parents 298ca2c + 6d9f1a4 commit 36a0a32c01163f8a801ee6feb53deb3d8252f86e @Kami Kami committed Mar 27, 2013
View
2 service-registry-archaius/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>com.rackspacecloud</groupId>
<artifactId>service-registry-client</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
View
5 ...stry-archaius/src/main/java/com/netflix/config/sources/ServiceRegistryClientProvider.java
@@ -12,13 +12,14 @@
public ServiceRegistryClientProvider(String user, String key, String region) {
client = new Client(user, key, region);
}
+
@Override
public List<Service> getServices(String tag) throws Exception {
- return client.services.list(null, tag);
+ return client.getServicesClient().list(null, tag);
}
@Override
public List<ConfigurationValue> getConfiguration() throws Exception {
- return client.configuration.list(null);
+ return client.getConfigurationClient().list(null);
}
}
View
8 ...chaius/src/main/java/com/netflix/config/sources/ServiceRegistryConfigurationProvider.java
@@ -48,9 +48,15 @@ public PollResult poll(boolean initial, Object checkPoint)
for (String tag: serviceTags) {
Set<InetSocketAddress> pairs = new HashSet<InetSocketAddress>();
String key = PREFIX + DELIMITER + tag + DELIMITER + SUFFIX;
+
for (Service service : client.getServices(tag)) {
- pairs.add(getHostPortPair(service));
+ InetSocketAddress pair = getHostPortPair(service);
+
+ if (pair != null) {
+ pairs.add(pair);
+ }
}
+
if (!pairs.isEmpty()) {
map.put(key, StringUtils.join(pairs, SEPARATOR));
}
View
4 ...c/test/java/com/netflix/config/sources/test/ServiceRegistryConfigurationProviderTest.java
@@ -86,7 +86,7 @@ public void testPolling() throws Exception {
testInstance.addService(tag, ServiceRegistryConfigurationProvider.setHostPortPair(
host,
port,
- new Service("faux" + i, "fauxSession", Collections.singletonList(tag), new HashMap<String, String>())));
+ new Service("faux" + i, 15, Collections.singletonList(tag), new HashMap<String, String>())));
}
String key = ServiceRegistryConfigurationProvider.PREFIX + "." + tag + ".addresses";
pollOnce();
@@ -110,7 +110,7 @@ public void testPollingChanging() throws Exception {
testInstance.addService(tags[i], ServiceRegistryConfigurationProvider.setHostPortPair(
host + i + j,
port,
- new Service("faux" + i + j, "fauxSession", Collections.singletonList(tags[i]), new HashMap<String, String>())));
+ new Service("faux" + i + j, 15, Collections.singletonList(tags[i]), new HashMap<String, String>())));
Integer score = scoreboard.get(tags[i]);

0 comments on commit 36a0a32

Please sign in to comment.