Skip to content

Commit df2df82

Browse files
author
Quintin
authored
Merge pull request ably#591 from ably/feature/protocol-version-1-2
Bump protocol version to 1.2
2 parents 143092f + 090eba2 commit df2df82

4 files changed

Lines changed: 33 additions & 17 deletions

File tree

lib/src/main/java/io/ably/lib/transport/Defaults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class Defaults {
99
/* versions */
10-
public static final float ABLY_VERSION_NUMBER = 1.0f;
10+
public static final float ABLY_VERSION_NUMBER = 1.2f;
1111
public static final String ABLY_VERSION = new DecimalFormat("0.0").format(ABLY_VERSION_NUMBER);
1212
public static final String ABLY_LIB_VERSION = String.format("%s-%s", BuildConfig.LIBRARY_NAME, BuildConfig.VERSION);
1313

lib/src/test/java/io/ably/lib/test/realtime/RealtimeHttpHeaderTest.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,19 @@ public void realtime_websocket_param_test() {
7979
assertEquals("Verify correct key param", requestParameters.get("key"),
8080
Collections.singletonList(key));
8181

82-
/* Spec RTN2f */
83-
assertEquals("Verify correct version", requestParameters.get(Defaults.ABLY_VERSION_PARAM),
84-
Collections.singletonList(Defaults.ABLY_VERSION));
85-
86-
/* Spec RTN2g */
87-
assertEquals("Verify correct lib version", requestParameters.get(Defaults.ABLY_LIB_PARAM),
88-
Collections.singletonList(Defaults.ABLY_LIB_VERSION));
82+
/* Spec RTN2f
83+
* This test should not directly validate version against Defaults.ABLY_VERSION, nor
84+
* Defaults.ABLY_VERSION_PARAM, as ultimately the request param has been derived from those values.
85+
*/
86+
assertEquals("Verify correct version", requestParameters.get("v"),
87+
Collections.singletonList("1.2"));
88+
89+
/* Spec RTN2g
90+
* This test should not directly validate version against Defaults.ABLY_LIB_VERSION, nor
91+
* Defaults.ABLY_LIB_PARAM, as ultimately the request param has been derived from those values.
92+
*/
93+
assertEquals("Verify correct lib version", requestParameters.get("lib"),
94+
Collections.singletonList("java-1.2.1"));
8995

9096
/* Spec RTN2a */
9197
assertEquals("Verify correct format", requestParameters.get("format"),

lib/src/test/java/io/ably/lib/test/rest/HttpHeaderTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,14 @@ public void header_lib_channel_publish() {
7777
/* Get last headers */
7878
Map<String, String> headers = server.getHeaders();
7979

80-
/* Prepare checked header */
81-
String ably_version_header = Defaults.ABLY_VERSION_HEADER.toLowerCase();
82-
String ably_lib_header = Defaults.ABLY_LIB_HEADER.toLowerCase();
83-
84-
/* Check header */
80+
/* Check header
81+
* This test should not directly validate version against Defaults.ABLY_VERSION, Defaults.ABLY_LIB_VERSION,
82+
* Defaults.ABLY_VERSION_HEADER, nor Defaults.ABLY_LIB_HEADER, as ultimately these headers have been derived
83+
* from those values.
84+
*/
8585
Assert.assertNotNull("Expected headers", headers);
86-
Assert.assertTrue(String.format("Expected header %s", Defaults.ABLY_VERSION_HEADER), headers.containsKey(ably_version_header));
87-
Assert.assertEquals(headers.get(ably_version_header), Defaults.ABLY_VERSION);
88-
Assert.assertTrue(String.format("Expected header %s", Defaults.ABLY_LIB_HEADER), headers.containsKey(ably_lib_header));
89-
Assert.assertEquals(headers.get(ably_lib_header), Defaults.ABLY_LIB_VERSION);
86+
Assert.assertEquals(headers.get("x-ably-version"), "1.2");
87+
Assert.assertEquals(headers.get("x-ably-lib"), "java-1.2.1");
9088
} catch (AblyException e) {
9189
e.printStackTrace();
9290
Assert.fail("header_lib_channel_publish: Unexpected exception");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.ably.lib.transport;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class DefaultsTest {
8+
@Test
9+
public void versions() {
10+
assertEquals("1.2", Defaults.ABLY_VERSION);
11+
}
12+
}

0 commit comments

Comments
 (0)