From d709c6f135a09138adc9b73fa6f726fe16f2aa3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Galland?= Date: Sun, 14 May 2017 13:31:40 +0200 Subject: [PATCH] [ci] Change the AppVeyor configuration. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Galland --- appveyor.yml | 4 +- .../io/sarl/tests/api/AbstractSarlTest.java | 77 ++++++++++++------- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e51371861c..123406d6d3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,8 +4,8 @@ skip_tags: true environment: JAVA_HOME: C:\Program Files\Java\jdk1.8.0 - JAVA_OPTS: -XX:+CMSClassUnloadingEnabled -Xms512m -Xmx2g - MAVEN_OPTS: -XX:+CMSClassUnloadingEnabled -Xms512m -Xmx2g + JAVA_OPTS: -XX:+CMSClassUnloadingEnabled -Xms1g -Xmx2g + MAVEN_OPTS: -XX:+CMSClassUnloadingEnabled -Xms1g -Xmx2g PATH: C:\maven\apache-maven-3.3.9\bin;%JAVA_HOME%\bin;%PATH% install: diff --git a/tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java b/tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java index 785b04bda6..b3830224a8 100644 --- a/tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java +++ b/tests/io.sarl.tests.api/src/main/java/io/sarl/tests/api/AbstractSarlTest.java @@ -48,6 +48,8 @@ import java.util.logging.LogManager; import java.util.logging.Logger; +import javax.inject.Provider; + import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.base.Predicate; @@ -151,21 +153,19 @@ public abstract class AbstractSarlTest { public static final int DEFAULT_DECIMAL_COUNT = 6; @Inject - private ValidationTestHelper validationHelper; + protected ReflectExtensions reflect; @Inject private Injector injector; @Inject - private ParseHelper parser; + private Provider validationHelper; @Inject - private SarlJvmModelAssociations associations; + private Provider> parser; - /** Utility for reflection. - */ @Inject - public ReflectExtensions reflect; + private Provider associations; /** Temporary fixing a bug in the class loading of Mockito 2. * @@ -335,6 +335,16 @@ protected void finished(Description description) { }; + @Override + protected void finalize() throws Throwable { + this.injector = null; + this.reflect = null; + this.validationHelper = null; + this.parser = null; + this.associations = null; + this.rootSarlWatchter = null; + } + /** Helpfer for setting a field, even if it is not visible. * * @param instance - the object. @@ -1275,7 +1285,7 @@ protected SarlScript file(String string) throws Exception { /** Create an instance of class. */ protected SarlScript file(String string, boolean validate) throws Exception { - SarlScript script = this.parser.parse(string); + SarlScript script = this.parser.get().parse(string); if (validate) { Resource resource = script.eResource(); ResourceSet resourceSet = resource.getResourceSet(); @@ -1303,7 +1313,7 @@ protected List issues(SarlScript file) { /** Validate the given resource and reply the issues. */ protected List issues(Resource resource) { - return this.validationHelper.validate(resource); + return this.validationHelper.get().validate(resource); } /** Validate the given file and reply the validator. @@ -1384,14 +1394,14 @@ protected SarlAction function(String string, boolean validate, String... prefix) */ protected JvmOperation jvmOperation(String string, String... prefix) throws Exception { SarlAction action = function(string, prefix); - return (JvmOperation) this.associations.getPrimaryJvmElement(action); + return (JvmOperation) this.associations.get().getPrimaryJvmElement(action); } /** Create an instance of JVM function. */ protected JvmOperation jvmOperation(String string, boolean validate, String... prefix) throws Exception { SarlAction action = function(string, validate, prefix); - return (JvmOperation) this.associations.getPrimaryJvmElement(action); + return (JvmOperation) this.associations.get().getPrimaryJvmElement(action); } /** Create an instance of function signature. @@ -1416,14 +1426,14 @@ protected SarlAction functionSignature(String string, boolean validate, String.. */ protected JvmOperation jvmOperationSignature(String string, String... prefix) throws Exception { SarlAction action = functionSignature(string, prefix); - return (JvmOperation) this.associations.getPrimaryJvmElement(action); + return (JvmOperation) this.associations.get().getPrimaryJvmElement(action); } /** Create an instance of JVM function. */ protected JvmOperation jvmOperationSignature(String string, boolean validate, String... prefix) throws Exception { SarlAction action = functionSignature(string, validate, prefix); - return (JvmOperation) this.associations.getPrimaryJvmElement(action); + return (JvmOperation) this.associations.get().getPrimaryJvmElement(action); } /** Create an instance of constructor. @@ -1448,14 +1458,14 @@ protected SarlConstructor constructor(String string, boolean validate, String... */ protected JvmConstructor jvmConstructor(String string, String... prefix) throws Exception { SarlConstructor constructor = constructor(string, prefix); - return (JvmConstructor) this.associations.getPrimaryJvmElement(constructor); + return (JvmConstructor) this.associations.get().getPrimaryJvmElement(constructor); } /** Create an instance of JVM constructor. */ protected JvmConstructor jvmConstructor(String string, boolean validate, String... prefix) throws Exception { SarlConstructor constructor = constructor(string, validate, prefix); - return (JvmConstructor) this.associations.getPrimaryJvmElement(constructor); + return (JvmConstructor) this.associations.get().getPrimaryJvmElement(constructor); } /** Create an instance of field. @@ -1639,79 +1649,88 @@ public interface Validator { */ private class XtextValidator implements Validator { - private final Resource resource; + private Resource resource; + + private ValidationTestHelper testHelper; /** * @param resource - the resource to validate. */ private XtextValidator(Resource resource) { this.resource = resource; + this.testHelper = AbstractSarlTest.this.validationHelper.get(); + } + + @Override + protected void finalize() throws Throwable { + this.resource = null; + this.testHelper = null; } public List getIssues() { - return AbstractSarlTest.this.validationHelper.validate(this.resource); + return this.testHelper.validate(this.resource); } public Validator assertNoIssues() { - AbstractSarlTest.this.validationHelper.assertNoIssues(this.resource); + this.testHelper.assertNoIssues(this.resource); return this; } public Validator assertNoErrors() { - AbstractSarlTest.this.validationHelper.assertNoErrors(this.resource); + this.testHelper.assertNoErrors(this.resource); return this; } public Validator assertNoError(String issuecode) { - AbstractSarlTest.this.validationHelper.assertNoError(this.resource, issuecode); + this.testHelper.assertNoError(this.resource, issuecode); return this; } public Validator assertNoErrors(EClass objectType, String code, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertNoErrors(this.resource, objectType, code, messageParts); + this.testHelper.assertNoErrors(this.resource, objectType, code, messageParts); return this; } public Validator assertNoErrors(String code) { - AbstractSarlTest.this.validationHelper.assertNoErrors(this.resource, code); + this.testHelper.assertNoErrors(this.resource, code); return this; } public Validator assertNoIssues(EClass objectType) { - AbstractSarlTest.this.validationHelper.assertNoIssues(this.resource, objectType); + this.testHelper.assertNoIssues(this.resource, objectType); return this; } public Validator assertNoIssue(EClass objectType, String issuecode) { - AbstractSarlTest.this.validationHelper.assertNoIssue(this.resource, objectType, issuecode); + this.testHelper.assertNoIssue(this.resource, objectType, issuecode); return this; } public Validator assertError(EClass objectType, String code, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertError(this.resource, objectType, code, messageParts); + this.testHelper.assertError(this.resource, objectType, code, messageParts); return this; } public Validator assertIssue(EClass objectType, String code, Severity severity, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertIssue(this.resource, objectType, code, severity, messageParts); + this.testHelper.assertIssue(this.resource, objectType, code, severity, messageParts); return this; } public Validator assertNoIssues(EClass objectType, String code, Severity severity, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertNoIssues(this.resource, objectType, code, severity, messageParts); + this.testHelper.assertNoIssues(this.resource, objectType, code, severity, messageParts); return this; } public Validator assertWarning(EClass objectType, String code, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertWarning(this.resource, objectType, code, messageParts); + this.testHelper.assertWarning(this.resource, objectType, code, messageParts); return this; } public Validator assertNoWarnings(EClass objectType, String code, String... messageParts) { - AbstractSarlTest.this.validationHelper.assertNoWarnings(this.resource, objectType, code, messageParts); + this.testHelper.assertNoWarnings(this.resource, objectType, code, messageParts); return this; } - + } /**