bwu_datastore_launcher 0.3.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 0

#BWU Datastore Launcher

Simplify starting and stopping local Google Cloud Datastore Local Development Server(s) or AppEngine API Server(s) from unit tests.

See also:

Usage

Google Cloud Datastore Local Development Server example

import 'dart:io' as io;
import 'dart:async' show Future;
import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
import 'package:unittest/vm_config.dart';
import 'package:bwu_datastore_launcher/bwu_datastore_launcher.dart';

main() async {
  useVMConfiguration();

  group('launch local dev server', () {

    test('start and remoteSuthdown', () {
      var exitCalled = expectAsync((){});

      // Create an instance of the server launcher.
      final server = new DatastoreLocalDevServer('connect',
          workingDirectory: path.join(
              packageRoot().absolute.path, 'test/tmp_data/datastore_local_dev_server'),
          // `gcd` uses the `JAVA` environment variable to find the Java
          // executable. We make it to point to Java 7 because `gcd` has issues
          // with Java 8.
          environment: <String, String>{
        'JAVA': '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'
      });

      // create the datastore directory
      return server.create('test', deleteExisting: true).then((success) {
        expect(success, isTrue);

        // when done launch the Gcloud Datastore Local Development Server
        server.onExit.first.then((code) {
          return server
              .start(allowRemoteShutdown: true, doStoreOnDisk: false)
              .then((success) {
            expect(success, isTrue);

            server.onExit.first.then((code) {
              expect(code, equals(0));
              exitCalled();
            });

            return new Future.delayed(new Duration(seconds: 2),
                // () => server.kill(io.ProcessSignal.SIGTERM))
                // Darts Process kill doesn't kill child processes, therefore we
                // use the `remoteShutdown` feature of the server to not keep
                // unnecessary server processes running.
                () => server.remoteShutdown()).then(
                (success) => expect(success, isTrue));
          });
        });
      });
    });
  });
}

AppEngine API Server example

import 'dart:io' as io;
import 'dart:async' show Future;
import 'package:path/path.dart' as path;
import 'package:unittest/unittest.dart';
import 'package:unittest/vm_config.dart';
import 'package:bwu_datastore_launcher/bwu_datastore_launcher.dart';

main() async {
  useVMConfiguration();

  group('launch local dev server', () {
    test('start and remoteSuthdown', () {
      var exitCalled = expectAsync(() {});

      // Create an instance of the server launcher.
      final server = new AppEngineApiServer(
          path.join(packageRoot().absolute.path, 'test/tmp_data/appengine_api_server'), 'test-app', clearDatastore: true);

      // launch the Gcloud Datastore Local Development Server
      return server.start().then((success) {
        expect(success, isTrue);

        server.onExit.first.then((code) {
          expect(code, equals(-15));
          exitCalled();
        });

        return new Future.delayed(new Duration(seconds: 2),
                () => server.kill())
            .then((success) => expect(success, isTrue));
      });
    });
  });
}

0.3.1

  • lower logging level for server process output, because all output from the server is sent to stderr.

0.3.0+1

  • add dependency constraints

0.3.0

  • Use logging instead of print
  • Change shutdown delay to startup delay (the start command returns only after a delay to ensure the server is ready to process commands).

0.2.3+1

  • Fix some mistake with inconsistent version numbers during deployment.

0.2.3

  • Add minimum delay for remoteShutdown to wait until the server is ready to process the shutdown request.

0.2.2

  • move utility function getNextFreeIpPort to the bwu_util_server package.
  • change host field form String to InternetAddress.

0.2.1

  • Some refactoring

0.2.0

  • Support for Appengine API Server added

0.1.5

  • The same as 0.2.0 I just tried if I can publish an older version when a newer already exists.

##0.1.0

  • Initial support for Gcloud Datastore Local Development Server

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  bwu_datastore_launcher: ^0.3.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:bwu_datastore_launcher/bwu_datastore_launcher.dart';
  
Version Uploaded Documentation Archive
0.3.1 Feb 22, 2015 Go to the documentation of bwu_datastore_launcher 0.3.1 Download bwu_datastore_launcher 0.3.1 archive
0.3.0+1 Feb 20, 2015 Go to the documentation of bwu_datastore_launcher 0.3.0+1 Download bwu_datastore_launcher 0.3.0+1 archive
0.2.3+1 Feb 20, 2015 Go to the documentation of bwu_datastore_launcher 0.2.3+1 Download bwu_datastore_launcher 0.2.3+1 archive
0.2.2 Feb 19, 2015 Go to the documentation of bwu_datastore_launcher 0.2.2 Download bwu_datastore_launcher 0.2.2 archive
0.2.0 Feb 16, 2015 Go to the documentation of bwu_datastore_launcher 0.2.0 Download bwu_datastore_launcher 0.2.0 archive
0.1.5 Feb 17, 2015 Go to the documentation of bwu_datastore_launcher 0.1.5 Download bwu_datastore_launcher 0.1.5 archive
0.1.0 Feb 14, 2015 Go to the documentation of bwu_datastore_launcher 0.1.0 Download bwu_datastore_launcher 0.1.0 archive
0.4.0-dev.0 Apr 8, 2016 Go to the documentation of bwu_datastore_launcher 0.4.0-dev.0 Download bwu_datastore_launcher 0.4.0-dev.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0-dev.3.0 <2.0.0