Skip to content

Commit

Permalink
[tests] Change the default logging level of the test run-time API.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed May 11, 2020
1 parent 4668434 commit 7342404
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 1 deletion.
@@ -0,0 +1,62 @@
/*
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-@RELEASE_YEAR@ 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.bugs.bug977.mocks

import io.sarl.core.Destroy
import io.sarl.core.Initialize
import io.sarl.sre.test.framework.skills.TestingCapacity
import io.sarl.sre.test.framework.skills.TestingSkill
import java.util.concurrent.atomic.AtomicInteger

abstract agent AbstractAgent {

protected var i = new AtomicInteger(0)

uses TestingCapacity

on Initialize {
setSkillIfAbsent(new TestingSkill(occurrence))
addResult("1")
}

on Initialize [i < 0] {
setSkillIfAbsent(new TestingSkill(occurrence))
addResult("-1-")
i.incrementAndGet
}

/* A disjoint condition from the previous */
on Initialize [i >= 0] {
setSkillIfAbsent(new TestingSkill(occurrence))
addResult("2")
i.decrementAndGet
}

def sayGoodBye : void {
addResult("-2-")
}

on Destroy {
sayGoodBye
}

}
Expand Up @@ -85,7 +85,7 @@ final class Constants {

/** The logging level when logging is enable during tests.
*/
public static val TEST_LOGGING_LEVEL = Level::ALL
public static val TEST_LOGGING_LEVEL = Level::INFO

/** Time to consider before doing a differed kill.
*/
Expand Down
Expand Up @@ -378,6 +378,7 @@ class SreRunContext {
this.rootContext = this.bootstrap.startWithoutAgent

var logger = this.bootstrap.kernelLogger
val klogger = logger
while (logger !== null) {
if (logger.useParentHandlers) {
logger.clearLogger
Expand All @@ -394,6 +395,11 @@ class SreRunContext {
}
]

if (klogger !== null) {
klogger.level = lvl
klogger.info("Starting SRE test: " + getExecutableName)
}

return this.bootstrap
}

Expand Down
@@ -0,0 +1,33 @@
/*
* $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.test.framework.events

/**
* Bye event.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.11
*/
event Bye
@@ -0,0 +1,33 @@
/*
* $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.test.framework.events

/**
* Bye event.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.11
*/
event ByeBye

0 comments on commit 7342404

Please sign in to comment.