Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sre] Fixing the invalid emitting of ParticipantJoined.
Signed-off-by: Stéphane Galland <galland@arakhne.org>
- Loading branch information
1 parent
dd0cd89
commit 97a982c
Showing
9 changed files
with
182 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...nusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/internal/mocks/JoinerAgent2.sarl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2020 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License") | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sarl.sre.tests.runtime.internal.mocks | ||
|
||
import io.sarl.sre.tests.testutils.agents.TestingAgent | ||
import java.util.UUID | ||
import io.sarl.core.DefaultContextInteractions | ||
import io.sarl.core.OpenEventSpaceSpecification | ||
import io.sarl.core.Behaviors | ||
|
||
/** | ||
* @author $Author: sgalland$ | ||
* @version $FullVersion$ | ||
* @mavengroupid $GroupId$ | ||
* @mavenartifactid $ArtifactId$ | ||
*/ | ||
agent JoinerAgent2 extends TestingAgent { | ||
|
||
uses DefaultContextInteractions, Behaviors | ||
|
||
override runAgentTest : RunPolicy { | ||
var id = UUID::randomUUID | ||
val spc = defaultContext.getOrCreateSpaceWithSpec(typeof(OpenEventSpaceSpecification), id) | ||
spc.register(asEventListener) | ||
addResult(spc.spaceID) | ||
return RunPolicy::DIFFERED_KILLING | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
....janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/internal/mocks/SpyAgent2.sarl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* $Id$ | ||
* | ||
* SARL is an general-purpose agent programming language. | ||
* More details on http://www.sarl.io | ||
* | ||
* Copyright (C) 2014-2020 the original authors or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License") | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.sarl.sre.tests.runtime.internal.mocks | ||
|
||
import io.sarl.core.Lifecycle | ||
import io.sarl.core.ParticipantJoined | ||
import io.sarl.sre.tests.testutils.agents.TestingAgent | ||
import io.sarl.core.DefaultContextInteractions | ||
|
||
/** | ||
* @author $Author: sgalland$ | ||
* @version $FullVersion$ | ||
* @mavengroupid $GroupId$ | ||
* @mavenartifactid $ArtifactId$ | ||
*/ | ||
agent SpyAgent2 extends TestingAgent { | ||
|
||
uses Lifecycle, DefaultContextInteractions | ||
|
||
override runAgentTest : RunPolicy { | ||
return null | ||
} | ||
|
||
on ParticipantJoined { | ||
val spcid = defaultSpace.spaceID | ||
if (occurrence.spaceID != spcid) { | ||
addResult(occurrence) | ||
addResult(spcid) | ||
killMe | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters