Skip to content

Commit

Permalink
Merge pull request #86 from DoclerLabs/develop
Browse files Browse the repository at this point in the history
prepare 0.32
  • Loading branch information
aliokan authored Oct 31, 2017
2 parents b42b03d + eb0d720 commit a49122e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/hex/module/ContextModule.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package hex.module;

import haxe.macro.Expr;
import hex.config.stateful.IStatefulConfig;
import hex.config.stateless.IStatelessConfig;
import hex.core.IApplicationContext;
Expand Down Expand Up @@ -210,7 +209,7 @@ class ContextModule implements IContextModule
/**
*
*/
macro public function _getDependency<T>( ethis : Expr, clazz : ExprOf<Dependency<T>>, ?id : ExprOf<String> ) : ExprOf<T>
macro public function _getDependency<T>( ethis, clazz : ExprOf<Dependency<T>>, ?id : ExprOf<String> ) : ExprOf<T>
{
var classRepresentation = InjectorUtil._getStringClassRepresentation( clazz );
var classReference = InjectorUtil._getClassReference( clazz );
Expand Down
10 changes: 5 additions & 5 deletions src/hex/module/Module.hx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import hex.log.message.DomainMessageFactory;
import hex.metadata.AnnotationProvider;
import hex.metadata.IAnnotationProvider;
import hex.module.IModule;
import hex.module.dependency.IRuntimeDependencies;
import hex.module.dependency.RuntimeDependencyChecker;
import hex.view.IView;
import hex.view.viewhelper.IViewHelperTypedef;
import hex.view.viewhelper.ViewHelperManager;
Expand Down Expand Up @@ -249,12 +247,13 @@ class Module implements IModule
return this._injector;
}

#if debug
/**
* Getter for runtime dependencies that needs to be
* checked before initialisation end
* @return <code>IRuntimeDependencies</code> used by this module
*/
function _getRuntimeDependencies() : IRuntimeDependencies
function _getRuntimeDependencies() : hex.module.dependency.IRuntimeDependencies
{
throw new VirtualMethodException();
}
Expand All @@ -263,10 +262,11 @@ class Module implements IModule
* Check collection of injected dependencies
* @param dependencies
*/
function _checkRuntimeDependencies( dependencies : IRuntimeDependencies ) : Void
function _checkRuntimeDependencies( dependencies : hex.module.dependency.IRuntimeDependencies ) : Void
{
RuntimeDependencyChecker.check( this, this._injector, dependencies );
hex.module.dependency.RuntimeDependencyChecker.check( this, this._injector, dependencies );
}
#end

/**
* Add collection of module configuration classes that
Expand Down
2 changes: 2 additions & 0 deletions test/hex/metadata/MockModuleForAnnotationProviding.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class MockModuleForAnnotationProviding extends Module
return cast this._annotationProvider;
}

#if debug
override function _getRuntimeDependencies() : IRuntimeDependencies
{
return return new RuntimeDependencies();
}
#end

override function _onInitialisation() : Void
{
Expand Down
16 changes: 13 additions & 3 deletions test/hex/module/ModuleTest.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package hex.module;

#if debug
import hex.module.dependency.IRuntimeDependencies;
import hex.module.dependency.RuntimeDependencies;
import hex.module.dependency.RuntimeDependencyException;
#end

import hex.config.stateful.IStatefulConfig;
import hex.config.stateless.IStatelessConfig;
import hex.di.Dependency;
Expand All @@ -18,9 +24,6 @@ import hex.log.ILogger;
import hex.metadata.AnnotationProvider;
import hex.metadata.IAnnotationProvider;
import hex.module.IModule;
import hex.module.dependency.IRuntimeDependencies;
import hex.module.dependency.RuntimeDependencies;
import hex.module.dependency.RuntimeDependencyException;
import hex.service.IService;
import hex.service.ServiceConfiguration;
import hex.unittest.assertion.Assert;
Expand Down Expand Up @@ -292,10 +295,12 @@ private class MockModuleForTestingInitialisation extends Module
this.initialisationCallCount++;
}

#if debug
override function _getRuntimeDependencies() : IRuntimeDependencies
{
return new RuntimeDependencies();
}
#end

public function getPrivateDispatcher() : IDispatcher<{}>
{
Expand Down Expand Up @@ -323,10 +328,13 @@ private class MockModuleForTestingRelease extends Module
this.releaseCallCount++;
}

#if debug
override function _getRuntimeDependencies() : IRuntimeDependencies
{
return new RuntimeDependencies();
}
#end

public function getPrivateDispatcher() : IDispatcher<{}>
{
return this._internalDispatcher;
Expand Down Expand Up @@ -368,12 +376,14 @@ private class MockModuleForTestingRuntimeDependencies extends Module
this._injector.mapToType( IService, serviceClass );
}

#if debug
override function _getRuntimeDependencies() : IRuntimeDependencies
{
var rd : RuntimeDependencies = new RuntimeDependencies();
rd.addMappedDependencies([ {type: IService } ]);
return rd;
}
#end
}

private class MockModuleForTestingStatelessConfig extends Module
Expand Down

0 comments on commit a49122e

Please sign in to comment.