File tree Expand file tree Collapse file tree
main/java/io/ably/lib/transport Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88public 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
Original file line number Diff line number Diff 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" ),
Original file line number Diff line number Diff 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" );
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments