Added example for testing
This commit is contained in:
parent
f5735ad919
commit
55ecadce60
7 changed files with 454 additions and 0 deletions
1
experiment/container/example1/analysis_options.yaml
Normal file
1
experiment/container/example1/analysis_options.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include: package:lints/recommended.yaml
|
25
experiment/container/example1/bin/example.dart
Normal file
25
experiment/container/example1/bin/example.dart
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import 'package:angel3_container/mirrors.dart';
|
||||||
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
|
import 'package:angel3_framework/http.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
print("Starting up");
|
||||||
|
//Logger.root.onRecord.listen(print);
|
||||||
|
|
||||||
|
var app = Angel(logger: Logger('example'), reflector: MirrorsReflector());
|
||||||
|
var http = AngelHttp(app);
|
||||||
|
|
||||||
|
app.get("/", (req, res) => "Hello, world!");
|
||||||
|
|
||||||
|
// Simple fallback to throw a 404 on unknown paths.
|
||||||
|
app.fallback((req, res) {
|
||||||
|
throw AngelHttpException.notFound(
|
||||||
|
message: 'Unknown path: "${req.uri?.path}"',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
var server = await http.startServer('localhost', 3000);
|
||||||
|
|
||||||
|
print("End");
|
||||||
|
}
|
48
experiment/container/example1/pubspec.yaml
Normal file
48
experiment/container/example1/pubspec.yaml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: example1
|
||||||
|
version: 0.0.1
|
||||||
|
description: Example 1.
|
||||||
|
environment:
|
||||||
|
sdk: '>=2.17.0 <3.0.0'
|
||||||
|
dependencies:
|
||||||
|
angel3_container: ^7.0.0
|
||||||
|
angel3_http_exception: ^7.0.0
|
||||||
|
angel3_framework: ^7.0.0
|
||||||
|
angel3_model: ^7.0.0
|
||||||
|
angel3_route: ^7.0.0
|
||||||
|
angel3_mock_request: ^7.0.0
|
||||||
|
belatuk_merge_map: ^4.0.0
|
||||||
|
belatuk_combinator: ^4.0.0
|
||||||
|
belatuk_http_server: ^3.0.0
|
||||||
|
charcode: ^1.2.0
|
||||||
|
file: ^6.1.0
|
||||||
|
http_parser: ^4.0.0
|
||||||
|
http2: ^2.0.0
|
||||||
|
logging: ^1.0.0
|
||||||
|
matcher: ^0.12.10
|
||||||
|
meta: ^1.3.0
|
||||||
|
mime: ^1.0.0
|
||||||
|
path: ^1.8.0
|
||||||
|
quiver: ^3.0.1
|
||||||
|
recase: ^4.0.0
|
||||||
|
stack_trace: ^1.10.0
|
||||||
|
string_scanner: ^1.1.0
|
||||||
|
tuple: ^2.0.0
|
||||||
|
uuid: ^3.0.1
|
||||||
|
collection: ^1.15.0
|
||||||
|
dev_dependencies:
|
||||||
|
http: ^0.13.1
|
||||||
|
io: ^1.0.0
|
||||||
|
test: ^1.21.0
|
||||||
|
lints: ^2.0.0
|
||||||
|
# dependency_overrides:
|
||||||
|
# angel3_container:
|
||||||
|
# path: ../container/angel_container
|
||||||
|
# angel3_http_exception:
|
||||||
|
# path: ../http_exception
|
||||||
|
# angel3_model:
|
||||||
|
# path: ../model
|
||||||
|
# angel3_route:
|
||||||
|
# path: ../route
|
||||||
|
# angel3_mock_request:
|
||||||
|
# path: ../mock_request
|
||||||
|
|
1
experiment/container/example2/analysis_options.yaml
Normal file
1
experiment/container/example2/analysis_options.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
include: package:lints/recommended.yaml
|
30
experiment/container/example2/bin/example.dart
Normal file
30
experiment/container/example2/bin/example.dart
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import 'package:angel3_container/angel3_container.dart';
|
||||||
|
import 'package:angel3_container_generator/angel3_container_generator.dart';
|
||||||
|
import 'package:angel3_framework/angel3_framework.dart';
|
||||||
|
import 'package:angel3_framework/http.dart';
|
||||||
|
|
||||||
|
import 'example.reflectable.dart';
|
||||||
|
|
||||||
|
@Expose('/controller')
|
||||||
|
class MyController extends Controller {
|
||||||
|
@Expose('/')
|
||||||
|
a() => "Hello, world!";
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
var reflector = const GeneratedReflector();
|
||||||
|
Container container = Container(reflector);
|
||||||
|
|
||||||
|
container.registerSingleton<MyController>(MyController());
|
||||||
|
|
||||||
|
initializeReflectable();
|
||||||
|
|
||||||
|
var app = Angel(reflector: reflector);
|
||||||
|
|
||||||
|
var http = AngelHttp(app);
|
||||||
|
|
||||||
|
await app.mountController<MyController>();
|
||||||
|
|
||||||
|
var server = await http.startServer();
|
||||||
|
print("Angel server listening at ${http.uri}");
|
||||||
|
}
|
300
experiment/container/example2/bin/example.reflectable.dart
Normal file
300
experiment/container/example2/bin/example.reflectable.dart
Normal file
|
@ -0,0 +1,300 @@
|
||||||
|
// This file has been generated by the reflectable package.
|
||||||
|
// https://github.com/dart-lang/reflectable.
|
||||||
|
// @dart = 2.12
|
||||||
|
|
||||||
|
import 'dart:core';
|
||||||
|
import 'package:angel3_container_generator/angel3_container_generator.dart'
|
||||||
|
as prefix0;
|
||||||
|
import 'package:reflectable/capability.dart' as prefix1;
|
||||||
|
import 'package:reflectable/mirrors.dart' as prefix2;
|
||||||
|
|
||||||
|
// ignore_for_file: camel_case_types
|
||||||
|
// ignore_for_file: implementation_imports
|
||||||
|
// ignore_for_file: prefer_adjacent_string_concatenation
|
||||||
|
// ignore_for_file: prefer_collection_literals
|
||||||
|
// ignore_for_file: unnecessary_const
|
||||||
|
|
||||||
|
// ignore:unused_import
|
||||||
|
import 'package:reflectable/mirrors.dart' as m;
|
||||||
|
// ignore:unused_import
|
||||||
|
import 'package:reflectable/src/reflectable_builder_based.dart' as r;
|
||||||
|
// ignore:unused_import
|
||||||
|
import 'package:reflectable/reflectable.dart' as r show Reflectable;
|
||||||
|
|
||||||
|
final _data = <r.Reflectable, r.ReflectorData>{
|
||||||
|
const prefix0.ContainedReflectable(): r.ReflectorData(
|
||||||
|
<m.TypeMirror>[
|
||||||
|
r.NonGenericClassMirrorImpl(
|
||||||
|
r'ContainedReflectable',
|
||||||
|
r'.ContainedReflectable',
|
||||||
|
134217735,
|
||||||
|
0,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <int>[0],
|
||||||
|
const <int>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||||
|
const <int>[],
|
||||||
|
-1,
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
{r'': (bool b) => () => b ? prefix0.ContainedReflectable() : null},
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
const <int>[],
|
||||||
|
const <Object>[prefix0.contained],
|
||||||
|
null)
|
||||||
|
],
|
||||||
|
<m.DeclarationMirror>[
|
||||||
|
r.MethodMirrorImpl(r'', 128, 0, -1, 0, 0, const <int>[], const <int>[],
|
||||||
|
const prefix0.ContainedReflectable(), const []),
|
||||||
|
r.MethodMirrorImpl(r'==', 2097154, -1, -1, 1, 1, const <int>[],
|
||||||
|
const <int>[0], const prefix0.ContainedReflectable(), const []),
|
||||||
|
r.MethodMirrorImpl(r'toString', 2097154, -1, -1, 2, 2, const <int>[],
|
||||||
|
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'noSuchMethod',
|
||||||
|
524290,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[1],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const []),
|
||||||
|
r.MethodMirrorImpl(r'hashCode', 2097155, -1, -1, 3, 3, const <int>[],
|
||||||
|
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||||
|
r.MethodMirrorImpl(r'runtimeType', 2097155, -1, -1, 4, 4, const <int>[],
|
||||||
|
const <int>[], const prefix0.ContainedReflectable(), const []),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'capabilities',
|
||||||
|
35651587,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
const <int>[5],
|
||||||
|
const <int>[],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const []),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'canReflect',
|
||||||
|
2097154,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[2],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'reflect',
|
||||||
|
2097154,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
8,
|
||||||
|
8,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[3],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'canReflectType',
|
||||||
|
2097154,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[4],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'reflectType',
|
||||||
|
2097154,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
9,
|
||||||
|
9,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[5],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'findLibrary',
|
||||||
|
2097154,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
const <int>[],
|
||||||
|
const <int>[6],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'libraries',
|
||||||
|
35651587,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
const <int>[11, 10],
|
||||||
|
const <int>[],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override]),
|
||||||
|
r.MethodMirrorImpl(
|
||||||
|
r'annotatedClasses',
|
||||||
|
35651587,
|
||||||
|
-1,
|
||||||
|
-1,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
const <int>[14],
|
||||||
|
const <int>[],
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <Object>[override])
|
||||||
|
],
|
||||||
|
<m.ParameterMirror>[
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'other',
|
||||||
|
134348806,
|
||||||
|
1,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
17,
|
||||||
|
17,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'invocation',
|
||||||
|
134348806,
|
||||||
|
3,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
18,
|
||||||
|
18,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'reflectee',
|
||||||
|
134348806,
|
||||||
|
7,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
17,
|
||||||
|
17,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'reflectee',
|
||||||
|
134348806,
|
||||||
|
8,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
17,
|
||||||
|
17,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'type',
|
||||||
|
134348806,
|
||||||
|
9,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'type',
|
||||||
|
134348806,
|
||||||
|
10,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
4,
|
||||||
|
4,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null),
|
||||||
|
r.ParameterMirrorImpl(
|
||||||
|
r'libraryName',
|
||||||
|
134348806,
|
||||||
|
11,
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
-1,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
const <int>[],
|
||||||
|
const [],
|
||||||
|
null,
|
||||||
|
null)
|
||||||
|
],
|
||||||
|
<Type>[
|
||||||
|
prefix0.ContainedReflectable,
|
||||||
|
bool,
|
||||||
|
String,
|
||||||
|
int,
|
||||||
|
Type,
|
||||||
|
prefix1.ReflectCapability,
|
||||||
|
const m.TypeValue<List<prefix1.ReflectCapability>>().type,
|
||||||
|
List,
|
||||||
|
prefix2.InstanceMirror,
|
||||||
|
prefix2.TypeMirror,
|
||||||
|
prefix2.LibraryMirror,
|
||||||
|
Uri,
|
||||||
|
const m.TypeValue<Map<Uri, prefix2.LibraryMirror>>().type,
|
||||||
|
Map,
|
||||||
|
prefix2.ClassMirror,
|
||||||
|
const m.TypeValue<Iterable<prefix2.ClassMirror>>().type,
|
||||||
|
Iterable,
|
||||||
|
Object,
|
||||||
|
Invocation
|
||||||
|
],
|
||||||
|
1,
|
||||||
|
{
|
||||||
|
r'==': (dynamic instance) => (x) => instance == x,
|
||||||
|
r'toString': (dynamic instance) => instance.toString,
|
||||||
|
r'noSuchMethod': (dynamic instance) => instance.noSuchMethod,
|
||||||
|
r'hashCode': (dynamic instance) => instance.hashCode,
|
||||||
|
r'runtimeType': (dynamic instance) => instance.runtimeType,
|
||||||
|
r'capabilities': (dynamic instance) => instance.capabilities,
|
||||||
|
r'canReflect': (dynamic instance) => instance.canReflect,
|
||||||
|
r'reflect': (dynamic instance) => instance.reflect,
|
||||||
|
r'canReflectType': (dynamic instance) => instance.canReflectType,
|
||||||
|
r'reflectType': (dynamic instance) => instance.reflectType,
|
||||||
|
r'findLibrary': (dynamic instance) => instance.findLibrary,
|
||||||
|
r'libraries': (dynamic instance) => instance.libraries,
|
||||||
|
r'annotatedClasses': (dynamic instance) => instance.annotatedClasses
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
<m.LibraryMirror>[
|
||||||
|
r.LibraryMirrorImpl(
|
||||||
|
r'',
|
||||||
|
Uri.parse(r'reflectable://0/'),
|
||||||
|
const prefix0.ContainedReflectable(),
|
||||||
|
const <int>[],
|
||||||
|
{},
|
||||||
|
{},
|
||||||
|
const [],
|
||||||
|
null)
|
||||||
|
],
|
||||||
|
[])
|
||||||
|
};
|
||||||
|
|
||||||
|
final _memberSymbolMap = null;
|
||||||
|
|
||||||
|
void initializeReflectable() {
|
||||||
|
r.data = _data;
|
||||||
|
r.memberSymbolMap = _memberSymbolMap;
|
||||||
|
}
|
49
experiment/container/example2/pubspec.yaml
Normal file
49
experiment/container/example2/pubspec.yaml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
name: example2
|
||||||
|
version: 0.0.1
|
||||||
|
description: Example 2.
|
||||||
|
environment:
|
||||||
|
sdk: '>=2.17.0 <3.0.0'
|
||||||
|
dependencies:
|
||||||
|
angel3_container: ^7.0.0
|
||||||
|
angel3_container_generator: ^7.0.0
|
||||||
|
angel3_http_exception: ^7.0.0
|
||||||
|
angel3_framework: ^7.0.0
|
||||||
|
angel3_model: ^7.0.0
|
||||||
|
angel3_route: ^7.0.0
|
||||||
|
angel3_mock_request: ^7.0.0
|
||||||
|
belatuk_merge_map: ^4.0.0
|
||||||
|
belatuk_combinator: ^4.0.0
|
||||||
|
belatuk_http_server: ^3.0.0
|
||||||
|
charcode: ^1.2.0
|
||||||
|
file: ^6.1.0
|
||||||
|
http_parser: ^4.0.0
|
||||||
|
http2: ^2.0.0
|
||||||
|
logging: ^1.0.0
|
||||||
|
matcher: ^0.12.10
|
||||||
|
meta: ^1.3.0
|
||||||
|
mime: ^1.0.0
|
||||||
|
path: ^1.8.0
|
||||||
|
quiver: ^3.0.1
|
||||||
|
recase: ^4.0.0
|
||||||
|
stack_trace: ^1.10.0
|
||||||
|
string_scanner: ^1.1.0
|
||||||
|
tuple: ^2.0.0
|
||||||
|
uuid: ^3.0.1
|
||||||
|
collection: ^1.15.0
|
||||||
|
dev_dependencies:
|
||||||
|
http: ^0.13.1
|
||||||
|
io: ^1.0.0
|
||||||
|
test: ^1.21.0
|
||||||
|
lints: ^2.0.0
|
||||||
|
# dependency_overrides:
|
||||||
|
# angel3_container:
|
||||||
|
# path: ../container/angel_container
|
||||||
|
# angel3_http_exception:
|
||||||
|
# path: ../http_exception
|
||||||
|
# angel3_model:
|
||||||
|
# path: ../model
|
||||||
|
# angel3_route:
|
||||||
|
# path: ../route
|
||||||
|
# angel3_mock_request:
|
||||||
|
# path: ../mock_request
|
||||||
|
|
Loading…
Reference in a new issue