This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push: new f1eadad THRIFT-4654 Minor fixes for dart 1 & 2 compatibility (backwards compatible) (#1617) f1eadad is described below commit f1eadad76edb3c680b9b964601d440ea05df02ca Author: Rob Becker <rob.bec...@workiva.com> AuthorDate: Mon Jan 21 20:24:01 2019 -0700 THRIFT-4654 Minor fixes for dart 1 & 2 compatibility (backwards compatible) (#1617) * THRIFT-4654 Minor fixes for dart 1 & 2 compatibility * update dockerfiles for CI to test dart 2 * THRIFT-4654 update pubspec for tests * THRIFT-4654 update dart test generator and readme to 1.24.3 * THRIFT-4654 update generated dart sdk to a range * fix the dart tutorials * Add .dart_tool directories to .gitignore * THRIFT-4654: use dart 2.1.0 and fix cross test dart client timeout --- .gitignore | 2 ++ build/docker/ubuntu-bionic/Dockerfile | 4 ++-- build/docker/ubuntu-xenial/Dockerfile | 6 +++--- .../cpp/src/thrift/generate/t_dart_generator.cc | 2 +- lib/dart/README.md | 2 +- lib/dart/lib/src/browser/t_web_socket.dart | 7 +++---- lib/dart/lib/src/console/t_web_socket.dart | 7 +++---- lib/dart/lib/src/protocol/t_compact_protocol.dart | 4 ++-- lib/dart/lib/src/protocol/t_json_protocol.dart | 8 ++++---- lib/dart/lib/src/serializer/t_deserializer.dart | 4 ++-- lib/dart/lib/src/serializer/t_serializer.dart | 2 +- lib/dart/lib/src/transport/t_http_transport.dart | 5 ++--- lib/dart/lib/thrift.dart | 5 +++-- lib/dart/pubspec.yaml | 15 +++++---------- lib/dart/test/protocol/t_protocol_test.dart | 6 +++--- .../test/transport/t_framed_transport_test.dart | 14 +++++++------- lib/dart/test/transport/t_http_transport_test.dart | 12 ++++++------ .../test/transport/t_socket_transport_test.dart | 22 +++++++++++----------- test/dart/test_client/pubspec.yaml | 6 +++--- test/tests.json | 2 ++ tutorial/dart/client/pubspec.yaml | 3 +-- tutorial/dart/client/web/index.html | 3 +-- tutorial/dart/console_client/pubspec.yaml | 4 ++-- tutorial/dart/server/pubspec.yaml | 4 ++-- 24 files changed, 72 insertions(+), 77 deletions(-) diff --git a/.gitignore b/.gitignore index b3a5920..82d3d48 100644 --- a/.gitignore +++ b/.gitignore @@ -196,6 +196,7 @@ project.lock.json /lib/d/test/transport_test /lib/d/unittest/ /lib/dart/coverage +/lib/dart/**/.dart_tool /lib/dart/**/.packages /lib/dart/**/packages /lib/dart/**/.pub/ @@ -305,6 +306,7 @@ project.lock.json /test/cpp/TestServer /test/csharp/obj /test/csharp/bin +/test/dart/**/.dart_tool /test/dart/**/.packages /test/dart/**/packages /test/dart/**/.pub/ diff --git a/build/docker/ubuntu-bionic/Dockerfile b/build/docker/ubuntu-bionic/Dockerfile index 43c99a9..db19112 100644 --- a/build/docker/ubuntu-bionic/Dockerfile +++ b/build/docker/ubuntu-bionic/Dockerfile @@ -15,7 +15,7 @@ # Using all stock Ubuntu Bionic packaging except for: # - cl: want latest # - d: dmd does not come with Ubuntu -# - dart: does not come with Ubuntu. Pinned to last 1.x release +# - dart: does not come with Ubuntu - we use 2.x here # - dotnet: does not come with Ubuntu # - go: want latest # - nodejs: want v8, bionic comes with v6 @@ -46,7 +46,6 @@ RUN apt-get update && \ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > \ /etc/apt/sources.list.d/dart_stable.list -ENV DART_VERSION 1.24.3-1 # dotnet (netcore) RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \ @@ -118,6 +117,7 @@ RUN \ mv deimos-openssl-1.1.0h/C/* /usr/include/dmd/druntime/import/C/ && \ rm -rf deimos-openssl-1.1.0h +ENV DART_VERSION 2.1.0-1 RUN apt-get install -y --no-install-recommends \ `# Dart dependencies` \ dart=$DART_VERSION diff --git a/build/docker/ubuntu-xenial/Dockerfile b/build/docker/ubuntu-xenial/Dockerfile index 3372b4d..88895a0 100644 --- a/build/docker/ubuntu-xenial/Dockerfile +++ b/build/docker/ubuntu-xenial/Dockerfile @@ -14,7 +14,7 @@ # Apache Thrift Docker build environment for Ubuntu Xenial # Using all stock Ubuntu Xenial packaging except for: # - d: does not come with Ubuntu so we're installing 2.075.1 for coverage -# - dart: does not come with Ubuntu so we're installing 1.22.1 for coverage +# - dart: does not come with Ubuntu so we're installing 1.24.3 for coverage # - dotnet: does not come with Ubuntu # - go: Xenial comes with 1.6, but we need 1.7 or later # - nodejs: Xenial comes with 4.2.6 which exits LTS April 2018, so we're installing 6.x @@ -50,7 +50,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EBCF975E5BA24D5E && RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > \ /etc/apt/sources.list.d/dart_stable.list -ENV DART_VERSION 1.22.1-1 # dotnet (core) RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \ @@ -120,6 +119,7 @@ RUN curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/v1.1.6+1.0 mv openssl-1.1.6-1.0.1g/C/* /usr/include/dmd/druntime/import/C/ && \ rm -rf openssl-1.1.6-1.0.1g +ENV DART_VERSION 1.24.3-1 RUN apt-get install -y --no-install-recommends \ `# Dart dependencies` \ dart=$DART_VERSION @@ -127,7 +127,7 @@ ENV PATH /usr/lib/dart/bin:$PATH RUN apt-get install -y --no-install-recommends \ `# dotnet core dependencies` \ - dotnet-sdk-2.1.4 + dotnet-sdk-2.1 RUN apt-get install -y --no-install-recommends \ `# Erlang dependencies` \ diff --git a/compiler/cpp/src/thrift/generate/t_dart_generator.cc b/compiler/cpp/src/thrift/generate/t_dart_generator.cc index 414c333..c82d26c 100644 --- a/compiler/cpp/src/thrift/generate/t_dart_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_dart_generator.cc @@ -423,7 +423,7 @@ void t_dart_generator::generate_dart_pubspec() { indent(f_pubspec) << "environment:" << endl; indent_up(); - indent(f_pubspec) << "sdk: ^1.12.0" << endl; + indent(f_pubspec) << "sdk: '>=1.24.3 <3.0.0'" << endl; indent_down(); f_pubspec << endl; diff --git a/lib/dart/README.md b/lib/dart/README.md index 2be168b..4c30291 100644 --- a/lib/dart/README.md +++ b/lib/dart/README.md @@ -23,4 +23,4 @@ under the License. Using Thrift with Dart ==================== -Dart 1.12.0 or newer is required +Dart 1.24.3 or newer is required diff --git a/lib/dart/lib/src/browser/t_web_socket.dart b/lib/dart/lib/src/browser/t_web_socket.dart index 17693b3..dac9ffd 100644 --- a/lib/dart/lib/src/browser/t_web_socket.dart +++ b/lib/dart/lib/src/browser/t_web_socket.dart @@ -18,7 +18,7 @@ library thrift.src.browser; import 'dart:async'; -import 'dart:convert' show BASE64; +import 'package:dart2_constant/convert.dart' show base64; import 'dart:html' show CloseEvent; import 'dart:html' show Event; import 'dart:html' show MessageEvent; @@ -90,7 +90,7 @@ class TWebSocket implements TSocket { void _sendRequests() { while (isOpen && _requests.isNotEmpty) { Uint8List data = _requests.removeAt(0); - _socket.sendString(BASE64.encode(data)); + _socket.sendString(base64.encode(data)); } } @@ -113,8 +113,7 @@ class TWebSocket implements TSocket { void _onMessage(MessageEvent message) { try { - Uint8List data = - new Uint8List.fromList(BASE64.decode(message.data)); + Uint8List data = new Uint8List.fromList(base64.decode(message.data)); _onMessageController.add(data); } on FormatException catch (_) { var error = new TProtocolError(TProtocolErrorType.INVALID_DATA, diff --git a/lib/dart/lib/src/console/t_web_socket.dart b/lib/dart/lib/src/console/t_web_socket.dart index 4ed7284..c938a96 100644 --- a/lib/dart/lib/src/console/t_web_socket.dart +++ b/lib/dart/lib/src/console/t_web_socket.dart @@ -18,7 +18,7 @@ library thrift.src.console.t_web_socket; import 'dart:async'; -import 'dart:convert' show BASE64; +import 'package:dart2_constant/convert.dart' show base64; import 'dart:io'; import 'dart:typed_data' show Uint8List; @@ -67,13 +67,12 @@ class TWebSocket implements TSocket { } void send(Uint8List data) { - _socket.add(BASE64.encode(data)); + _socket.add(base64.encode(data)); } void _onMessage(String message) { try { - Uint8List data = - new Uint8List.fromList(BASE64.decode(message)); + Uint8List data = new Uint8List.fromList(base64.decode(message)); _onMessageController.add(data); } on FormatException catch (_) { var error = new TProtocolError(TProtocolErrorType.INVALID_DATA, diff --git a/lib/dart/lib/src/protocol/t_compact_protocol.dart b/lib/dart/lib/src/protocol/t_compact_protocol.dart index 72d7641..ee8094f 100644 --- a/lib/dart/lib/src/protocol/t_compact_protocol.dart +++ b/lib/dart/lib/src/protocol/t_compact_protocol.dart @@ -187,7 +187,7 @@ class TCompactProtocol extends TProtocol { void writeDouble(double d) { if (d == null) d = 0.0; - tempBD.setFloat64(0, d, Endianness.LITTLE_ENDIAN); + tempBD.setFloat64(0, d, Endianness.little); transport.write(tempBD.buffer.asUint8List(), 0, 8); } @@ -364,7 +364,7 @@ class TCompactProtocol extends TProtocol { double readDouble() { transport.readAll(tempList, 0, 8); - return tempList.buffer.asByteData().getFloat64(0, Endianness.LITTLE_ENDIAN); + return tempList.buffer.asByteData().getFloat64(0, Endianness.little); } String readString() { diff --git a/lib/dart/lib/src/protocol/t_json_protocol.dart b/lib/dart/lib/src/protocol/t_json_protocol.dart index 7fbb7c4..180568d 100644 --- a/lib/dart/lib/src/protocol/t_json_protocol.dart +++ b/lib/dart/lib/src/protocol/t_json_protocol.dart @@ -155,8 +155,8 @@ class TJsonProtocol extends TProtocol { _context.write(); transport.writeAll(_Constants.QUOTE_BYTES); - String base64 = BASE64.encode(bytes); - transport.writeAll(utf8Codec.encode(base64)); + String base64text = base64.encode(bytes); + transport.writeAll(utf8Codec.encode(base64text)); transport.writeAll(_Constants.QUOTE_BYTES); } @@ -421,9 +421,9 @@ class TJsonProtocol extends TProtocol { Uint8List _readJsonBase64() { // convert UTF-8 bytes of a Base 64 encoded string to binary bytes Uint8List base64Bytes = _readJsonString(); - String base64 = utf8Codec.decode(base64Bytes); + String base64text = utf8Codec.decode(base64Bytes); - return new Uint8List.fromList(BASE64.decode(base64)); + return new Uint8List.fromList(base64.decode(base64text)); } void _readJsonObjectStart() { diff --git a/lib/dart/lib/src/serializer/t_deserializer.dart b/lib/dart/lib/src/serializer/t_deserializer.dart index ed1d139..aefbee2 100644 --- a/lib/dart/lib/src/serializer/t_deserializer.dart +++ b/lib/dart/lib/src/serializer/t_deserializer.dart @@ -26,7 +26,7 @@ class TDeserializer { this.transport = new TBufferedTransport(); if (protocolFactory == null) { - protocolFactory = new TBinaryProtocolFactory(); + protocolFactory = new TBinaryProtocolFactory(); } this.protocol = protocolFactory.getProtocol(this.transport); @@ -41,8 +41,8 @@ class TDeserializer { } void readString(TBase base, String data) { - transport.writeAll(BASE64.decode(data)); + transport.writeAll(base64.decode(data)); transport.flush(); base.read(protocol); diff --git a/lib/dart/lib/src/serializer/t_serializer.dart b/lib/dart/lib/src/serializer/t_serializer.dart index 20ddb6d..feec822 100644 --- a/lib/dart/lib/src/serializer/t_serializer.dart +++ b/lib/dart/lib/src/serializer/t_serializer.dart @@ -43,6 +43,6 @@ class TSerializer { Uint8List bytes = transport.consumeWriteBuffer(); - return BASE64.encode(bytes); + return base64.encode(bytes); } } diff --git a/lib/dart/lib/src/transport/t_http_transport.dart b/lib/dart/lib/src/transport/t_http_transport.dart index aa78e9c..630213f 100644 --- a/lib/dart/lib/src/transport/t_http_transport.dart +++ b/lib/dart/lib/src/transport/t_http_transport.dart @@ -44,7 +44,7 @@ class THttpClientTransport extends TBufferedTransport { } Future flush() { - var requestBody = BASE64.encode(consumeWriteBuffer()); + var requestBody = base64.encode(consumeWriteBuffer()); // Use a sync completer to ensure that the buffer can be read immediately // after the read buffer is set, and avoid a race condition where another @@ -56,8 +56,7 @@ class THttpClientTransport extends TBufferedTransport { .then((response) { Uint8List data; try { - data = new Uint8List.fromList( - BASE64.decode(response.body)); + data = new Uint8List.fromList(base64.decode(response.body)); } on FormatException catch (_) { throw new TProtocolError(TProtocolErrorType.INVALID_DATA, "Expected a Base 64 encoded string."); diff --git a/lib/dart/lib/thrift.dart b/lib/dart/lib/thrift.dart index 3d9bb01..c429d77 100644 --- a/lib/dart/lib/thrift.dart +++ b/lib/dart/lib/thrift.dart @@ -19,11 +19,12 @@ library thrift; import 'dart:async'; import 'dart:collection'; -import 'dart:convert' show Utf8Codec, BASE64; +import 'dart:convert' show Utf8Codec; import 'dart:typed_data' show ByteData; -import 'dart:typed_data' show Endianness; import 'dart:typed_data' show Uint8List; +import 'package:dart2_constant/convert.dart' show base64; +import 'package:dart2_constant/typed_data.dart' show Endianness; import 'package:fixnum/fixnum.dart'; import 'package:http/http.dart' show Client; import 'package:logging/logging.dart'; diff --git a/lib/dart/pubspec.yaml b/lib/dart/pubspec.yaml index fdc4a0d..ded0269 100644 --- a/lib/dart/pubspec.yaml +++ b/lib/dart/pubspec.yaml @@ -24,20 +24,15 @@ homepage: http://thrift.apache.org documentation: http://thrift.apache.org environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=1.24.3 <3.0.0" dependencies: + dart2_constant: ^1.0.0 fixnum: ^0.10.2 http: ^0.11.3 logging: ^0.11.0 dev_dependencies: - # test - mockito: ^1.0.0 - test: ^0.12.0 - - # dart_dev - https://github.com/Workiva/dart_dev - dart_dev: ^1.5.0 - coverage: ^0.7.3 - dart_style: ">=0.2.4 <0.3.0" - dartdoc: ^0.9.0 + dart_dev: ^2.0.0 + mockito: ">=2.2.2 <4.0.0" + test: ">=0.12.30 <2.0.0" diff --git a/lib/dart/test/protocol/t_protocol_test.dart b/lib/dart/test/protocol/t_protocol_test.dart index 0e6cde5..dc63dbb 100644 --- a/lib/dart/test/protocol/t_protocol_test.dart +++ b/lib/dart/test/protocol/t_protocol_test.dart @@ -18,9 +18,9 @@ library thrift.test.transport.t_json_protocol_test; import 'dart:async'; -import 'dart:convert' show UTF8; import 'dart:typed_data' show Uint8List; +import 'package:dart2_constant/convert.dart' show utf8; import 'package:test/test.dart'; import 'package:thrift/thrift.dart'; @@ -362,7 +362,7 @@ void main() { UTF-8: 0xF0 0x9D 0x84 0x9E UTF-16: 0xD834 0xDD1E */ - var buffer = UTF8.encode(r'"\u0001\u0e01 \ud834\udd1e"'); + var buffer = utf8.encode(r'"\u0001\u0e01 \ud834\udd1e"'); var transport = new TBufferedTransport(); transport.writeAll(buffer); @@ -372,7 +372,7 @@ void main() { var subject = protocol.readString(); expect(subject, - UTF8.decode([0x01, 0xE0, 0xB8, 0x81, 0x20, 0xF0, 0x9D, 0x84, 0x9E])); + utf8.decode([0x01, 0xE0, 0xB8, 0x81, 0x20, 0xF0, 0x9D, 0x84, 0x9E])); }); group('shared tests', sharedTests); diff --git a/lib/dart/test/transport/t_framed_transport_test.dart b/lib/dart/test/transport/t_framed_transport_test.dart index e072e68..7ab4905 100644 --- a/lib/dart/test/transport/t_framed_transport_test.dart +++ b/lib/dart/test/transport/t_framed_transport_test.dart @@ -18,9 +18,9 @@ library thrift.test.transport.t_framed_transport_test; import 'dart:async'; -import 'dart:convert'; import 'dart:typed_data' show Uint8List; +import 'package:dart2_constant/convert.dart' show utf8; import 'package:test/test.dart'; import 'package:thrift/thrift.dart'; @@ -66,14 +66,14 @@ void main() { expectNoReadableBytes(); // write first batch of body - socket.messageController.add(new Uint8List.fromList(UTF8.encode("He"))); + socket.messageController.add(new Uint8List.fromList(utf8.encode("He"))); // you shouldn't be able to get any bytes from the read, // because the frame has been consumed internally expectNoReadableBytes(); // write second batch of body - socket.messageController.add(new Uint8List.fromList(UTF8.encode("llo!"))); + socket.messageController.add(new Uint8List.fromList(utf8.encode("llo!"))); // have to wait for the flush to complete, // because it's only then that the frame is available for reading @@ -83,7 +83,7 @@ void main() { // at this point the frame is complete, so we expect the read to complete readBytes = transport.read(readBuffer, 0, readBuffer.lengthInBytes); expect(readBytes, 6); - expect(readBuffer.sublist(0, 6), UTF8.encode("Hello!")); + expect(readBuffer.sublist(0, 6), utf8.encode("Hello!")); }); test('Test transport reads messages where header is sent in pieces ' @@ -112,14 +112,14 @@ void main() { readBytes = expectNoReadableBytes(); // write first batch of body - socket.messageController.add(new Uint8List.fromList(UTF8.encode("H"))); + socket.messageController.add(new Uint8List.fromList(utf8.encode("H"))); // you shouldn't be able to get any bytes from the read, // because the frame has been consumed internally expectNoReadableBytes(); // write second batch of body - socket.messageController.add(new Uint8List.fromList(UTF8.encode("i!"))); + socket.messageController.add(new Uint8List.fromList(utf8.encode("i!"))); // have to wait for the flush to complete, // because it's only then that the frame is available for reading @@ -129,7 +129,7 @@ void main() { // at this point the frame is complete, so we expect the read to complete readBytes = transport.read(readBuffer, 0, readBuffer.lengthInBytes); expect(readBytes, 3); - expect(readBuffer.sublist(0, 3), UTF8.encode("Hi!")); + expect(readBuffer.sublist(0, 3), utf8.encode("Hi!")); }); }); } diff --git a/lib/dart/test/transport/t_http_transport_test.dart b/lib/dart/test/transport/t_http_transport_test.dart index 66f3d05..03ccede 100644 --- a/lib/dart/test/transport/t_http_transport_test.dart +++ b/lib/dart/test/transport/t_http_transport_test.dart @@ -19,9 +19,10 @@ library thrift.test.transport.t_socket_transport_test; import 'dart:async'; import 'dart:convert' show Encoding; -import 'dart:convert' show Utf8Codec, BASE64; +import 'dart:convert' show Utf8Codec; import 'dart:typed_data' show Uint8List; +import 'package:dart2_constant/convert.dart' show base64; import 'package:http/http.dart' show BaseRequest; import 'package:http/http.dart' show Client; import 'package:http/http.dart' show Response; @@ -52,15 +53,14 @@ void main() { expect(client.postRequest, isNotEmpty); - var requestText = - utf8Codec.decode(BASE64.decode(client.postRequest)); + var requestText = utf8Codec.decode(base64.decode(client.postRequest)); expect(requestText, expectedText); }); test('Test transport receives response', () async { var expectedText = 'my response'; var expectedBytes = utf8Codec.encode(expectedText); - client.postResponse = BASE64.encode(expectedBytes); + client.postResponse = base64.encode(expectedBytes); transport.writeAll(utf8Codec.encode('my request')); expect(transport.hasReadData, isFalse); @@ -94,7 +94,7 @@ void main() { // prepare a response transport.writeAll(utf8Codec.encode('request 1')); - client.postResponse = BASE64.encode(expectedBytes); + client.postResponse = base64.encode(expectedBytes); Future responseReady = transport.flush().then((_) { var buffer = new Uint8List(expectedBytes.length); @@ -105,7 +105,7 @@ void main() { // prepare a second response transport.writeAll(utf8Codec.encode('request 2')); var response2Bytes = utf8Codec.encode('response 2'); - client.postResponse = BASE64.encode(response2Bytes); + client.postResponse = base64.encode(response2Bytes); await transport.flush(); await responseReady; diff --git a/lib/dart/test/transport/t_socket_transport_test.dart b/lib/dart/test/transport/t_socket_transport_test.dart index 929ab17..90bffbe 100644 --- a/lib/dart/test/transport/t_socket_transport_test.dart +++ b/lib/dart/test/transport/t_socket_transport_test.dart @@ -18,9 +18,11 @@ library thrift.test.transport.t_socket_transport_test; import 'dart:async'; -import 'dart:convert' show Utf8Codec, BASE64; +import 'dart:convert' show Utf8Codec; import 'dart:typed_data' show Uint8List; +import 'package:dart2_constant/convert.dart' show base64; +import 'package:dart2_constant/core.dart' as core; import 'package:mockito/mockito.dart'; import 'package:test/test.dart'; import 'package:thrift/thrift.dart'; @@ -30,14 +32,13 @@ void main() { final requestText = 'my test request'; final requestBytes = new Uint8List.fromList(utf8Codec.encode(requestText)); - final requestBase64 = BASE64.encode(requestBytes); + final requestBase64 = base64.encode(requestBytes); final responseText = 'response 1'; final responseBytes = new Uint8List.fromList(utf8Codec.encode(responseText)); - final responseBase64 = BASE64.encode(responseBytes); + final responseBase64 = base64.encode(responseBytes); - final framedResponseBase64 = - BASE64.encode(_getFramedResponse(responseBytes)); + final framedResponseBase64 = base64.encode(_getFramedResponse(responseBytes)); group('TClientSocketTransport', () { FakeSocket socket; @@ -117,7 +118,7 @@ void main() { protocolFactory.message = new TMessage('foo', TMessageType.CALL, 123); transport = new TAsyncClientSocketTransport( socket, new TMessageReader(protocolFactory), - responseTimeout: Duration.ZERO); + responseTimeout: core.Duration.zero); await transport.open(); transport.writeAll(requestBytes); }); @@ -139,7 +140,7 @@ void main() { var response2Text = 'response 2'; var response2Bytes = new Uint8List.fromList(utf8Codec.encode(response2Text)); - var response2Base64 = BASE64.encode(response2Bytes); + var response2Base64 = base64.encode(response2Bytes); protocolFactory.message = new TMessage('foo2', TMessageType.REPLY, 124); socket.receiveFakeMessage(response2Base64); @@ -169,7 +170,7 @@ void main() { transport = new TFramedTransport(new TAsyncClientSocketTransport( socket, messageReader, - responseTimeout: Duration.ZERO)); + responseTimeout: core.Duration.zero)); await transport.open(); transport.writeAll(requestBytes); }); @@ -275,11 +276,10 @@ class FakeSocket extends TSocket { _sendPayload = data; } - void receiveFakeMessage(String base64) { + void receiveFakeMessage(String base64text) { if (!isOpen) throw new StateError('The socket is not open'); - var message = - new Uint8List.fromList(BASE64.decode(base64)); + var message = new Uint8List.fromList(base64.decode(base64text)); _onMessageController.add(message); } } diff --git a/test/dart/test_client/pubspec.yaml b/test/dart/test_client/pubspec.yaml index d1642f8..113054a 100644 --- a/test/dart/test_client/pubspec.yaml +++ b/test/dart/test_client/pubspec.yaml @@ -22,10 +22,10 @@ author: Apache Thrift Developers <d...@thrift.apache.org> homepage: http://thrift.apache.org environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=1.24.3 <3.0.0" dependencies: - args: ^0.13.0 + args: ">=0.13.0 <2.0.0" http: ^0.11.0 thrift: path: ../../../lib/dart @@ -33,4 +33,4 @@ dependencies: path: ../gen-dart/thrift_test dev_dependencies: - test: "^0.12.0" + test: ">=0.12.30 <2.0.0" diff --git a/test/tests.json b/test/tests.json index 43d6ded..3381a1f 100644 --- a/test/tests.json +++ b/test/tests.json @@ -562,6 +562,7 @@ { "name": "dart", "client": { + "timeout": 15, "transports": [ "buffered", "framed", @@ -577,6 +578,7 @@ ], "command": [ "dart", + "--enable-asserts", "test_client/bin/main.dart" ] }, diff --git a/tutorial/dart/client/pubspec.yaml b/tutorial/dart/client/pubspec.yaml index d8ede14..109db0f 100644 --- a/tutorial/dart/client/pubspec.yaml +++ b/tutorial/dart/client/pubspec.yaml @@ -22,10 +22,9 @@ author: Apache Thrift Developers <d...@thrift.apache.org> homepage: http://thrift.apache.org environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=1.13.0 <3.0.0" dependencies: - browser: ^0.10.0 shared: path: ../gen-dart/shared thrift: diff --git a/tutorial/dart/client/web/index.html b/tutorial/dart/client/web/index.html index 64b184e..9d36b43 100644 --- a/tutorial/dart/client/web/index.html +++ b/tutorial/dart/client/web/index.html @@ -24,8 +24,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Thrift Tutorial</title> <link rel="stylesheet" href="styles.css"> - <script async src="client.dart" type="application/dart"></script> - <script async src="packages/browser/dart.js"></script> + <script async src="client.dart.js"></script> </head> <body> diff --git a/tutorial/dart/console_client/pubspec.yaml b/tutorial/dart/console_client/pubspec.yaml index a34e26f..602bb5e 100644 --- a/tutorial/dart/console_client/pubspec.yaml +++ b/tutorial/dart/console_client/pubspec.yaml @@ -23,10 +23,10 @@ author: Apache Thrift Developers <d...@thrift.apache.org> homepage: http://thrift.apache.org environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=1.13.0 <3.0.0" dependencies: - args: ^0.13.0 + args: ">=0.13.0 <2.0.0" collection: ^1.1.0 shared: path: ../gen-dart/shared diff --git a/tutorial/dart/server/pubspec.yaml b/tutorial/dart/server/pubspec.yaml index 18d0737..b0b012d 100644 --- a/tutorial/dart/server/pubspec.yaml +++ b/tutorial/dart/server/pubspec.yaml @@ -22,10 +22,10 @@ author: Apache Thrift Developers <d...@thrift.apache.org> homepage: http://thrift.apache.org environment: - sdk: ">=1.13.0 <2.0.0" + sdk: ">=1.13.0 <3.0.0" dependencies: - args: ^0.13.0 + args: ">=0.13.0 <2.0.0" shared: path: ../gen-dart/shared thrift: