bwu_datastore_launcher 0.3.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 29

#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:

  • https://cloud.google.com/datastore/docs/tools/devserver
  • https://cloud.google.com/datastore/docs/tools/
  • https://cloud.google.com/sdk/gcloud/

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

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages 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

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
97 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
29

Platforms

Detected platforms: Flutter, other

Primary library: package:bwu_datastore_launcher/bwu_datastore_launcher.dart with components: io.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use bwu_datastore_launcher.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0-dev.3.0 <2.0.0
bwu_utils_server ^0.0.4 0.0.4+1
logging ^0.9.3 0.9.3 0.11.3+1
logging_handlers ^0.8.0 0.8.0
path ^1.3.0 1.5.1
quiver_log ^1.0.3 1.0.5
Transitive dependencies
bwu_utils 0.0.2 0.1.3
intl 0.15.2
Dev dependencies
unittest 0.12.0-alpha.0