Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Upgrade to 2.0.0 and improve stuff #29

Merged
merged 3 commits into from

2 participants

Tomaz Muraus Gary Dusbabek
Tomaz Muraus

Based on move_archaius_bindings_here branch.

Tomaz Muraus Kami referenced this pull request
Merged

Move archaius bindings here #25

Gary Dusbabek

+1 ok.

Tomaz Muraus Kami merged commit 36a0a32 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
  1. Tomaz Muraus
  2. Tomaz Muraus

    Style.

    Kami authored
  3. Tomaz Muraus

    Add a null check.

    Kami authored
This page is out of date. Refresh to see the latest.
2  service-registry-archaius/pom.xml
View
@@ -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>
5 service-registry-archaius/src/main/java/com/netflix/config/sources/ServiceRegistryClientProvider.java
View
@@ -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);
}
}
8 ...ice-registry-archaius/src/main/java/com/netflix/config/sources/ServiceRegistryConfigurationProvider.java
View
@@ -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));
}
4 ...try-archaius/src/test/java/com/netflix/config/sources/test/ServiceRegistryConfigurationProviderTest.java
View
@@ -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]);
Something went wrong with that request. Please try again.