Skip to content

Commit b48e94a

Browse files
Artem LabazinArtem Labazin
authored andcommitted
Minor bug fixes
1 parent 64276d1 commit b48e94a

File tree

11 files changed

+53
-16
lines changed

11 files changed

+53
-16
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Add more unit and integration tests.
1313

14+
## [0.4.1](https://github.com/appulse-projects/epmd-java/releases/tag/0.4.1) - 2018-02-16
15+
16+
Minor bug fixes
17+
18+
### Changed
19+
20+
- EPMD address and port are public now.
21+
- Lookup cache doesn't cache not found items any more.
22+
1423
## [0.4.0](https://github.com/appulse-projects/epmd-java/releases/tag/0.4.0) - 2018-02-16
1524

1625
Introducing NIO server.

client/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Include the dependency to your project's pom.xml file:
1414
<dependency>
1515
<groupId>io.appulse.epmd.java</groupId>
1616
<artifactId>client</artifactId>
17-
<version>0.4.0</version>
17+
<version>0.4.1</version>
1818
</dependency>
1919
...
2020
</dependencies>
@@ -23,7 +23,7 @@ Include the dependency to your project's pom.xml file:
2323
or Gradle:
2424

2525
```groovy
26-
compile 'io.appulse.epmd.java:client:0.4.0'
26+
compile 'io.appulse.epmd.java:client:0.4.1'
2727
```
2828

2929
### Create client

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limitations under the License.
2525
<parent>
2626
<groupId>io.appulse</groupId>
2727
<artifactId>epmd-java</artifactId>
28-
<version>0.4.0</version>
28+
<version>0.4.1</version>
2929
</parent>
3030

3131
<groupId>io.appulse.epmd.java</groupId>

client/src/main/java/io/appulse/epmd/java/client/EpmdClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ protected void finalize () throws Throwable {
175175
super.finalize();
176176
}
177177

178-
private static class Default {
178+
public static class Default {
179179

180-
private static final InetAddress ADDRESS = getDefaultInetAddress();
180+
public static final InetAddress ADDRESS = getDefaultInetAddress();
181181

182-
private static final int PORT = getDefaultPort();
182+
public static final int PORT = getDefaultPort();
183183

184184
@SneakyThrows
185185
private static InetAddress getDefaultInetAddress () {

client/src/main/java/io/appulse/epmd/java/client/LookupService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ class LookupService {
5555

5656
COMPUTE = (key, value) -> {
5757
if (value != null) {
58+
log.debug("Used cached value {}", value);
5859
return value;
5960
}
6061

6162
val request = new GetNodeInfo(key.getNode());
6263
try (val connection = new Connection(key.getAddress(), key.getPort())) {
63-
return connection.send(request, NodeInfo.class);
64+
val response = connection.send(request, NodeInfo.class);
65+
log.debug("Lookup result is {}", response);
66+
return response.isOk()
67+
? response
68+
: null;
6469
}
6570
};
6671
}
@@ -93,7 +98,7 @@ public Optional<NodeInfo> lookup (@NonNull String node, @NonNull InetAddress add
9398
val tokens = node.split("@", 2);
9499
val shortName = tokens[0];
95100

96-
log.debug("Looking up node '{}' at '{}'", shortName, address);
101+
log.debug("Looking up node '{}' at '{}:{}'", shortName, address, port);
97102

98103
val descriptor = new NodeDescriptor(shortName, address, port);
99104
val nodeInfo = CACHE.compute(descriptor, COMPUTE);

client/src/test/java/io/appulse/epmd/java/client/LocalEpmdClientTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,30 @@ public void invalidRegistration () {
122122
}
123123
}
124124

125+
@Test
126+
public void lookupAndRegistration () {
127+
assertThat(client.register("node-1", 61_111, R3_ERLANG, TCP, R6, R6))
128+
.isNotEqualTo(0);
129+
130+
val optional1 = client.lookup("node-1");
131+
assertThat(optional1)
132+
.isPresent();
133+
assertThat(optional1.get().isOk())
134+
.isTrue();
135+
136+
assertThat(client.lookup("node-2"))
137+
.isNotPresent();
138+
139+
assertThat(client.register("node-2", 61_011, R3_ERLANG, TCP, R6, R6))
140+
.isNotEqualTo(0);
141+
142+
val optional2 = client.lookup("node-2");
143+
assertThat(optional2)
144+
.isPresent();
145+
assertThat(optional2.get().isOk())
146+
.isTrue();
147+
}
148+
125149
@Test
126150
public void connectionBroken () {
127151
try (EpmdClient client2 = new EpmdClient(8091)) {

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limitations under the License.
2525
<parent>
2626
<groupId>io.appulse</groupId>
2727
<artifactId>epmd-java</artifactId>
28-
<version>0.4.0</version>
28+
<version>0.4.1</version>
2929
</parent>
3030

3131
<groupId>io.appulse.epmd.java</groupId>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.
2424

2525
<groupId>io.appulse</groupId>
2626
<artifactId>epmd-java</artifactId>
27-
<version>0.4.0</version>
27+
<version>0.4.1</version>
2828
<packaging>pom</packaging>
2929

3030
<modules>
@@ -68,7 +68,7 @@ limitations under the License.
6868
<url>https://github.com/appulse-projects/epmd-java</url>
6969
<connection>scm:git:https://github.com/appulse-projects/epmd-java.git</connection>
7070
<developerConnection>scm:git:https://github.com/appulse-projects/epmd-java.git</developerConnection>
71-
<tag>0.4.0</tag>
71+
<tag>0.4.1</tag>
7272
</scm>
7373

7474
<distributionManagement>

server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Include the dependency to your project's pom.xml file:
1818
<dependency>
1919
<groupId>io.appulse.epmd.java</groupId>
2020
<artifactId>server</artifactId>
21-
<version>0.4.0</version>
21+
<version>0.4.1</version>
2222
</dependency>
2323
...
2424
</dependencies>
@@ -27,5 +27,5 @@ Include the dependency to your project's pom.xml file:
2727
or Gradle:
2828

2929
```groovy
30-
compile 'io.appulse.epmd.java:server:0.4.0'
30+
compile 'io.appulse.epmd.java:server:0.4.1'
3131
```

server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limitations under the License.
2525
<parent>
2626
<groupId>io.appulse</groupId>
2727
<artifactId>epmd-java</artifactId>
28-
<version>0.4.0</version>
28+
<version>0.4.1</version>
2929
</parent>
3030

3131
<groupId>io.appulse.epmd.java</groupId>

0 commit comments

Comments
 (0)