2020-08-30 07:45:44 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2018-05-22 01:13:13
|
2020-09-01 15:05:06 +00:00
|
|
|
* @modify date 2020-09-01 17:04:33
|
2020-08-30 07:45:44 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Clear the Screen */
|
|
|
|
declare const process: any;
|
|
|
|
|
|
|
|
|
|
|
|
import { Builder } from '../../mod-Assembly-Builder/src/Container-Builder.FileLoader';
|
|
|
|
import * as PUBSUB from '../assembly/manual-assembly';
|
|
|
|
import { addObservables } from '../src/Pub-Sub-Observable';
|
|
|
|
|
2020-09-01 15:05:06 +00:00
|
|
|
Builder.instance.addElements(PUBSUB.EXPORT)
|
2020-08-30 07:45:44 +00:00
|
|
|
Builder.instance.addActivationHandler(addObservables);
|
|
|
|
|
|
|
|
Builder.load();
|
|
|
|
|
|
|
|
Builder.on('loaded', () => {
|
|
|
|
|
|
|
|
/** Create A PubSubSystem */
|
|
|
|
const _matcher = Builder.instance.container.get<PUBSUB.Matcher>(PUBSUB.TYPES.DefaultMatcher);
|
|
|
|
|
|
|
|
const _test = [
|
|
|
|
{
|
|
|
|
subscription: 'test.child',
|
|
|
|
offered: 'test',
|
|
|
|
result: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: 'test.child',
|
|
|
|
offered: 'test.child',
|
|
|
|
result: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: 'test.child',
|
|
|
|
offered: 'test.child.sub',
|
|
|
|
result: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: '+.child',
|
|
|
|
offered: 'test',
|
|
|
|
result: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: '+.child',
|
|
|
|
offered: 'hans.child',
|
|
|
|
result: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: '+.child',
|
|
|
|
offered: 'hans.child.test',
|
2020-09-01 15:05:06 +00:00
|
|
|
result: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
subscription: '+.#',
|
|
|
|
offered: 'hans.child.test',
|
2020-08-30 07:45:44 +00:00
|
|
|
result: true,
|
|
|
|
},
|
2020-09-01 15:05:06 +00:00
|
|
|
{
|
|
|
|
subscription: 'test.#',
|
|
|
|
offered: 'hans.child.test',
|
|
|
|
result: false,
|
|
|
|
},
|
2020-08-30 07:45:44 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
for (const _case of _test) {
|
|
|
|
const _res = _matcher.affected(_case.subscription, _case.offered);
|
|
|
|
|
|
|
|
if (_res != _case.result) {
|
|
|
|
console.log('ERROR on', _case.subscription, _case.offered, 'should', _case.result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|