Commit 9ab9ec4202546f2fe720b39f0b9950ee7621d0b6
rename in abstract container
wanderer committed on 11/21/2017, 9:27:05 PMParent: f6890c630f97bee18c05dac66e886069049ec4ab
Files changed
package-lock.json | changed |
package.json | changed |
tests/index.js | changed |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 321574 bytes New file size: 321574 bytes |
package.json | ||
---|---|---|
@@ -43,9 +43,9 @@ | ||
43 | 43 | "coveralls": "^3.0.0", |
44 | 44 | "documentation": "^5.3.3", |
45 | 45 | "level": "^2.0.1", |
46 | 46 | "nyc": "^11.3.0", |
47 | - "primea-abstract-container": "0.0.5", | |
47 | + "primea-abstract-container": "0.0.6", | |
48 | 48 | "standard": "10.0.3", |
49 | 49 | "tape": "^4.6.3" |
50 | 50 | } |
51 | 51 | } |
tests/index.js | ||
---|---|---|
@@ -69,9 +69,9 @@ | ||
69 | 69 | |
70 | 70 | class testVMContainerA extends BaseContainer { |
71 | 71 | onCreation (m) { |
72 | 72 | message = new Message() |
73 | - return this.kernel.send(m.caps[0], message) | |
73 | + return this.actor.send(m.caps[0], message) | |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | class testVMContainerB extends BaseContainer { |
@@ -111,9 +111,9 @@ | ||
111 | 111 | |
112 | 112 | class testVMContainerA extends BaseContainer { |
113 | 113 | onCreation (m) { |
114 | 114 | message = new Message() |
115 | - return this.kernel.send(m.caps[0], message) | |
115 | + return this.actor.send(m.caps[0], message) | |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | 119 | class testVMContainerB extends BaseContainer { |
@@ -158,12 +158,12 @@ | ||
158 | 158 | let ticks = 1 |
159 | 159 | |
160 | 160 | class testVMContainerA extends BaseContainer { |
161 | 161 | async onCreation (m) { |
162 | - this.kernel.incrementTicks(ticks) | |
162 | + this.actor.incrementTicks(ticks) | |
163 | 163 | ticks++ |
164 | 164 | message = new Message() |
165 | - await this.kernel.send(m.caps[0], message) | |
165 | + await this.actor.send(m.caps[0], message) | |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | 169 | class testVMContainerB extends BaseContainer { |
@@ -210,10 +210,10 @@ | ||
210 | 210 | |
211 | 211 | class testVMContainerA extends BaseContainer { |
212 | 212 | onCreation (m) { |
213 | 213 | message = new Message() |
214 | - message.responseCap = this.kernel.mintCap() | |
215 | - return this.kernel.send(m.caps[0], message) | |
214 | + message.responseCap = this.actor.mintCap() | |
215 | + return this.actor.send(m.caps[0], message) | |
216 | 216 | } |
217 | 217 | |
218 | 218 | onMessage (m) { |
219 | 219 | t.true(m, 'should recive a response message') |
@@ -257,10 +257,10 @@ | ||
257 | 257 | |
258 | 258 | class testVMContainerA extends BaseContainer { |
259 | 259 | onCreation (m) { |
260 | 260 | message = new Message() |
261 | - message.responseCap = this.kernel.mintCap() | |
262 | - return this.kernel.send(m.caps[0], message) | |
261 | + message.responseCap = this.actor.mintCap() | |
262 | + return this.actor.send(m.caps[0], message) | |
263 | 263 | } |
264 | 264 | |
265 | 265 | onMessage (m) { |
266 | 266 | t.true(m.data.exceptionError instanceof Error, 'should recive a response message') |
@@ -305,11 +305,11 @@ | ||
305 | 305 | |
306 | 306 | class testVMContainerA extends BaseContainer { |
307 | 307 | onCreation (m) { |
308 | 308 | message = new Message() |
309 | - const cap = this.kernel.mintCap() | |
309 | + const cap = this.actor.mintCap() | |
310 | 310 | message.caps.push(cap) |
311 | - return this.kernel.createActor(testVMContainerB.typeId, message) | |
311 | + return this.actor.createActor(testVMContainerB.typeId, message) | |
312 | 312 | } |
313 | 313 | |
314 | 314 | onMessage (m) { |
315 | 315 | t.true(m, 'should recive a response message') |
@@ -318,9 +318,9 @@ | ||
318 | 318 | |
319 | 319 | class testVMContainerB extends BaseContainer { |
320 | 320 | onCreation (m) { |
321 | 321 | const cap = m.caps[0] |
322 | - return this.kernel.send(cap, new Message()) | |
322 | + return this.actor.send(cap, new Message()) | |
323 | 323 | } |
324 | 324 | |
325 | 325 | static get typeId () { |
326 | 326 | return 8 |
@@ -358,13 +358,13 @@ | ||
358 | 358 | }) |
359 | 359 | const message3 = new Message({ |
360 | 360 | data: 'third' |
361 | 361 | }) |
362 | - this.kernel.send(m.caps[0], message1) | |
363 | - this.kernel.incrementTicks(1) | |
364 | - this.kernel.send(m.caps[0], message2) | |
365 | - this.kernel.incrementTicks(1) | |
366 | - return this.kernel.send(m.caps[0], message3) | |
362 | + this.actor.send(m.caps[0], message1) | |
363 | + this.actor.incrementTicks(1) | |
364 | + this.actor.send(m.caps[0], message2) | |
365 | + this.actor.incrementTicks(1) | |
366 | + return this.actor.send(m.caps[0], message3) | |
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
370 | 370 | let recMsg = 0 |
@@ -415,9 +415,9 @@ | ||
415 | 415 | onCreation (m) { |
416 | 416 | message = new Message({ |
417 | 417 | data: m.data |
418 | 418 | }) |
419 | - this.kernel.send(m.caps[0], message) | |
419 | + this.actor.send(m.caps[0], message) | |
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
423 | 423 | let recMsg = 0 |
@@ -478,13 +478,13 @@ | ||
478 | 478 | |
479 | 479 | class testVMContainerA extends BaseContainer { |
480 | 480 | async onMessage (m) { |
481 | 481 | t.true(m, 'should recive first message') |
482 | - const rCap = this.kernel.mintCap(1) | |
482 | + const rCap = this.actor.mintCap(1) | |
483 | 483 | const message = new Message() |
484 | 484 | message.responseCap = rCap |
485 | - await this.kernel.send(m.caps[0], message) | |
486 | - const rMessage = await this.kernel.inbox.waitOnTag([1], 44) | |
485 | + await this.actor.send(m.caps[0], message) | |
486 | + const rMessage = await this.actor.inbox.waitOnTag([1], 44) | |
487 | 487 | t.true(rMessage, 'should recive a response message') |
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
@@ -524,15 +524,15 @@ | ||
524 | 524 | |
525 | 525 | class testVMContainerA extends BaseContainer { |
526 | 526 | async onMessage (m) { |
527 | 527 | t.true(m, 'should recive first message') |
528 | - const rCap = this.kernel.mintCap(1) | |
528 | + const rCap = this.actor.mintCap(1) | |
529 | 529 | const message = new Message({data: 'first'}) |
530 | 530 | message.responseCap = rCap |
531 | - await this.kernel.send(m.caps[0], message) | |
532 | - const promise = this.kernel.inbox.waitOnTag([1], 44) | |
531 | + await this.actor.send(m.caps[0], message) | |
532 | + const promise = this.actor.inbox.waitOnTag([1], 44) | |
533 | 533 | try { |
534 | - await this.kernel.inbox.waitOnTag([1], 44) | |
534 | + await this.actor.inbox.waitOnTag([1], 44) | |
535 | 535 | } catch (e) { |
536 | 536 | t.true(e, 'should error if waiting twice') |
537 | 537 | } |
538 | 538 | return promise |
@@ -576,10 +576,10 @@ | ||
576 | 576 | class testVMContainerA extends BaseContainer { |
577 | 577 | async onMessage (m) { |
578 | 578 | t.true(m, 'should recive first message') |
579 | 579 | if (m.caps.length) { |
580 | - const cap1 = this.kernel.mintCap(1) | |
581 | - const cap2 = this.kernel.mintCap(2) | |
580 | + const cap1 = this.actor.mintCap(1) | |
581 | + const cap2 = this.actor.mintCap(2) | |
582 | 582 | const message1 = new Message({ |
583 | 583 | data: 'first' |
584 | 584 | }) |
585 | 585 | const message2 = new Message({ |
@@ -587,12 +587,12 @@ | ||
587 | 587 | }) |
588 | 588 | message1.caps.push(cap1) |
589 | 589 | message2.caps.push(cap2) |
590 | 590 | await Promise.all([ |
591 | - this.kernel.send(m.caps[0], message1), | |
592 | - this.kernel.send(m.caps[1], message2) | |
591 | + this.actor.send(m.caps[0], message1), | |
592 | + this.actor.send(m.caps[1], message2) | |
593 | 593 | ]) |
594 | - const rMessage = await this.kernel.inbox.waitOnTag([1, 2], 44) | |
594 | + const rMessage = await this.actor.inbox.waitOnTag([1, 2], 44) | |
595 | 595 | t.true(rMessage, 'should recive a response message') |
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
@@ -600,10 +600,10 @@ | ||
600 | 600 | class testVMContainerB extends BaseContainer { |
601 | 601 | async onMessage (m) { |
602 | 602 | t.true(m, 'should recive a message') |
603 | 603 | const cap = m.caps[0] |
604 | - this.kernel.incrementTicks(1) | |
605 | - await this.kernel.send(cap, new Message({data: m.data})) | |
604 | + this.actor.incrementTicks(1) | |
605 | + await this.actor.send(cap, new Message({data: m.data})) | |
606 | 606 | |
607 | 607 | return new Promise((resolve, reject) => { |
608 | 608 | setTimeout(resolve, 200) |
609 | 609 | }) |
@@ -642,21 +642,21 @@ | ||
642 | 642 | class testVMContainerA extends BaseContainer { |
643 | 643 | async onMessage (m) { |
644 | 644 | t.true(m, 'should recive first message') |
645 | 645 | if (m.caps.length) { |
646 | - const cap1 = this.kernel.mintCap(1) | |
647 | - const cap2 = this.kernel.mintCap(2) | |
646 | + const cap1 = this.actor.mintCap(1) | |
647 | + const cap2 = this.actor.mintCap(2) | |
648 | 648 | const message1 = new Message({ |
649 | 649 | data: 'first' |
650 | 650 | }) |
651 | 651 | const message2 = new Message({ |
652 | 652 | data: 'second' |
653 | 653 | }) |
654 | 654 | message1.caps.push(cap1) |
655 | 655 | message2.caps.push(cap2) |
656 | - await this.kernel.send(m.caps[0], message1) | |
657 | - await this.kernel.send(m.caps[1], message2) | |
658 | - const rMessage = await this.kernel.inbox.waitOnTag([1, 2], 44) | |
656 | + await this.actor.send(m.caps[0], message1) | |
657 | + await this.actor.send(m.caps[1], message2) | |
658 | + const rMessage = await this.actor.inbox.waitOnTag([1, 2], 44) | |
659 | 659 | t.true(rMessage, 'should recive a response message') |
660 | 660 | } |
661 | 661 | } |
662 | 662 | } |
@@ -664,10 +664,10 @@ | ||
664 | 664 | class testVMContainerB extends BaseContainer { |
665 | 665 | async onMessage (m) { |
666 | 666 | t.true(m, 'should recive a message') |
667 | 667 | const cap = m.caps[0] |
668 | - this.kernel.incrementTicks(1) | |
669 | - await this.kernel.send(cap, new Message({data: m.data})) | |
668 | + this.actor.incrementTicks(1) | |
669 | + await this.actor.send(cap, new Message({data: m.data})) | |
670 | 670 | |
671 | 671 | return new Promise((resolve, reject) => { |
672 | 672 | setTimeout(resolve, 200) |
673 | 673 | }) |
@@ -706,21 +706,21 @@ | ||
706 | 706 | class testVMContainerA extends BaseContainer { |
707 | 707 | async onMessage (m) { |
708 | 708 | t.true(m, 'should recive first message') |
709 | 709 | if (m.caps.length) { |
710 | - const cap1 = this.kernel.mintCap(1) | |
711 | - const cap2 = this.kernel.mintCap(2) | |
710 | + const cap1 = this.actor.mintCap(1) | |
711 | + const cap2 = this.actor.mintCap(2) | |
712 | 712 | const message1 = new Message({ |
713 | 713 | data: 'first' |
714 | 714 | }) |
715 | 715 | const message2 = new Message({ |
716 | 716 | data: 'second' |
717 | 717 | }) |
718 | 718 | message1.caps.push(cap1) |
719 | 719 | message2.caps.push(cap2) |
720 | - await this.kernel.send(m.caps[0], message1) | |
721 | - await this.kernel.send(m.caps[1], message2) | |
722 | - const rMessage = await this.kernel.inbox.waitOnTag([2], 44) | |
720 | + await this.actor.send(m.caps[0], message1) | |
721 | + await this.actor.send(m.caps[1], message2) | |
722 | + const rMessage = await this.actor.inbox.waitOnTag([2], 44) | |
723 | 723 | t.true(rMessage, 'should recive a response message') |
724 | 724 | } |
725 | 725 | } |
726 | 726 | } |
@@ -728,10 +728,10 @@ | ||
728 | 728 | class testVMContainerB extends BaseContainer { |
729 | 729 | async onMessage (m) { |
730 | 730 | t.true(m, 'should recive a message') |
731 | 731 | const cap = m.caps[0] |
732 | - this.kernel.incrementTicks(1) | |
733 | - await this.kernel.send(cap, new Message({data: m.data})) | |
732 | + this.actor.incrementTicks(1) | |
733 | + await this.actor.send(cap, new Message({data: m.data})) | |
734 | 734 | |
735 | 735 | return new Promise((resolve, reject) => { |
736 | 736 | setTimeout(resolve, 200) |
737 | 737 | }) |
@@ -769,18 +769,18 @@ | ||
769 | 769 | |
770 | 770 | class testVMContainerA extends BaseContainer { |
771 | 771 | async onMessage (m) { |
772 | 772 | t.true(m, 'should recive first message 1') |
773 | - const rMessage = await this.kernel.inbox.waitOnTag([1], 50) | |
773 | + const rMessage = await this.actor.inbox.waitOnTag([1], 50) | |
774 | 774 | t.equals(rMessage, undefined, 'should recive a response message 1') |
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | 778 | class testVMContainerB extends BaseContainer { |
779 | 779 | async onMessage (m) { |
780 | 780 | t.true(m, 'should recive first message 2') |
781 | - this.kernel.incrementTicks(47) | |
782 | - const rMessage = await this.kernel.inbox.waitOnTag([1], 1) | |
781 | + this.actor.incrementTicks(47) | |
782 | + const rMessage = await this.actor.inbox.waitOnTag([1], 1) | |
783 | 783 | t.equals(rMessage, undefined, 'should recive a response message 2') |
784 | 784 | } |
785 | 785 | |
786 | 786 | static get typeId () { |
@@ -790,10 +790,10 @@ | ||
790 | 790 | |
791 | 791 | class testVMContainerC extends BaseContainer { |
792 | 792 | async onMessage (m) { |
793 | 793 | t.true(m, 'should recive first message 3') |
794 | - this.kernel.incrementTicks(45) | |
795 | - const rMessage = await this.kernel.inbox.waitOnTag([1], 1) | |
794 | + this.actor.incrementTicks(45) | |
795 | + const rMessage = await this.actor.inbox.waitOnTag([1], 1) | |
796 | 796 | t.equals(rMessage, undefined, 'should recive a response message 3') |
797 | 797 | } |
798 | 798 | |
799 | 799 | static get typeId () { |
Built with git-ssb-web