diff --git a/eclipse-products/io.sarl.lang.updatesite/io.sarl.lang.product b/eclipse-products/io.sarl.lang.updatesite/io.sarl.lang.product index a0445a6eb6..005c095717 100644 --- a/eclipse-products/io.sarl.lang.updatesite/io.sarl.lang.product +++ b/eclipse-products/io.sarl.lang.updatesite/io.sarl.lang.product @@ -258,33 +258,33 @@ + + - + - - + + - + - - + - + - @@ -296,8 +296,6 @@ - - diff --git a/eclipse-sarl/features/io.sarl.baseplatform/feature.xml b/eclipse-sarl/features/io.sarl.baseplatform/feature.xml index 0338d0af08..74e36c7c57 100644 --- a/eclipse-sarl/features/io.sarl.baseplatform/feature.xml +++ b/eclipse-sarl/features/io.sarl.baseplatform/feature.xml @@ -232,6 +232,50 @@ id="org.eclipse.epp.mpc" version="0.0.0"/> + + + + + + + + + + + + + + + + + + + + + + @@ -508,4 +552,11 @@ version="15.0.0.v201403281430" unpack="false"/> + + diff --git a/eclipse-sarl/plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2 b/eclipse-sarl/plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2 index e8cc35c553..a28c2acdd7 100644 --- a/eclipse-sarl/plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2 +++ b/eclipse-sarl/plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2 @@ -74,13 +74,13 @@ var fileHeader = "/* * SARL is an general-purpose agent programming language. * More details on http://www.sarl.io * - * Copyright 2014-\${year} the original authors and authors. + * Copyright (C) 2014-\${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 + * 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, diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/META-INF/MANIFEST.MF b/eclipse-sarl/plugins/io.sarl.lang.ui/META-INF/MANIFEST.MF index e3f5fa23d0..4350a6350a 100644 --- a/eclipse-sarl/plugins/io.sarl.lang.ui/META-INF/MANIFEST.MF +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/META-INF/MANIFEST.MF @@ -1,44 +1,46 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %Bundle-Name -Bundle-Vendor: %Bundle-Vendor -Bundle-Version: 0.5.0.qualifier -Bundle-SymbolicName: io.sarl.lang.ui; singleton:=true -Bundle-ActivationPolicy: lazy -Require-Bundle: io.sarl.lang;bundle-version="0.5.0";visibility:=reexport, - org.eclipse.xtext.ui;bundle-version="2.11.0", - org.eclipse.xtext.ui.shared;bundle-version="2.11.0", - org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.11.0", - org.eclipse.xtext.xbase.ui;bundle-version="2.11.0", - org.eclipse.xtext.builder;bundle-version="2.11.0", - org.eclipse.xtend.ide;bundle-version="2.11.0", - org.eclipse.xtend.core;bundle-version="2.11.0", - org.eclipse.xtext.common.types.ui;bundle-version="2.11.0", - org.apache.log4j;bundle-version="1.2.15", - org.eclipse.jdt.core;bundle-version="3.12.2", - org.eclipse.jdt.ui;bundle-version="3.12.2", - org.eclipse.compare;bundle-version="3.7.0", - org.eclipse.jdt.debug.ui;bundle-version="3.7.201", - org.eclipse.ui;bundle-version="3.108.1", - org.eclipse.ui.editors;bundle-version="3.10.1", - org.arakhne.afc.core.references;bundle-version="14.0.0" -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-Activator: io.sarl.lang.ui.internal.LangActivator -Export-Package: io.sarl.lang.ide.contentassist.antlr, - io.sarl.lang.ide.contentassist.antlr.internal, - io.sarl.lang.ui;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.builder, - io.sarl.lang.ui.contentassist, - io.sarl.lang.ui.editor, - io.sarl.lang.ui.highlighting, - io.sarl.lang.ui.images;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.internal, - io.sarl.lang.ui.labeling;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.outline;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.preferences, - io.sarl.lang.ui.quickfix;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.quickfix.acceptors;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.refactoring.rename, - io.sarl.lang.ui.tasks;x-friends:="io.sarl.lang.ui.tests", - io.sarl.lang.ui.validation;x-friends:="io.sarl.lang.ui.tests" -Import-Package: org.apache.log4j +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-Vendor: %Bundle-Vendor +Bundle-Version: 0.5.0.qualifier +Bundle-SymbolicName: io.sarl.lang.ui; singleton:=true +Bundle-ActivationPolicy: lazy +Require-Bundle: io.sarl.lang;bundle-version="0.5.0";visibility:=reexport, + org.eclipse.xtext.ui;bundle-version="2.11.0", + org.eclipse.xtext.ui.shared;bundle-version="2.11.0", + org.eclipse.xtext.ui.codetemplates.ui;bundle-version="2.11.0", + org.eclipse.xtext.xbase.ui;bundle-version="2.11.0", + org.eclipse.xtext.builder;bundle-version="2.11.0", + org.eclipse.xtend.ide;bundle-version="2.11.0", + org.eclipse.xtend.core;bundle-version="2.11.0", + org.eclipse.xtext.common.types.ui;bundle-version="2.11.0", + org.apache.log4j;bundle-version="1.2.15", + org.eclipse.jdt.core;bundle-version="3.12.2", + org.eclipse.jdt.ui;bundle-version="3.12.2", + org.eclipse.compare;bundle-version="3.7.0", + org.eclipse.jdt.debug.ui;bundle-version="3.7.201", + org.eclipse.ui;bundle-version="3.108.1", + org.eclipse.ui.editors;bundle-version="3.10.1", + org.arakhne.afc.core.references;bundle-version="14.0.0", + org.antlr.runtime +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-Activator: io.sarl.lang.ui.internal.LangActivator +Export-Package: io.sarl.lang.ide, + io.sarl.lang.ide.contentassist.antlr, + io.sarl.lang.ide.contentassist.antlr.internal, + io.sarl.lang.ui;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.builder, + io.sarl.lang.ui.contentassist, + io.sarl.lang.ui.editor, + io.sarl.lang.ui.highlighting, + io.sarl.lang.ui.images;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.internal, + io.sarl.lang.ui.labeling;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.outline;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.preferences, + io.sarl.lang.ui.quickfix;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.quickfix.acceptors;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.refactoring.rename, + io.sarl.lang.ui.tasks;x-friends:="io.sarl.lang.ui.tests", + io.sarl.lang.ui.validation;x-friends:="io.sarl.lang.ui.tests" +Import-Package: org.apache.log4j diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/META-INF/services/org.eclipse.xtext.ISetup b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/META-INF/services/org.eclipse.xtext.ISetup new file mode 100644 index 0000000000..0cd95f950e --- /dev/null +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/META-INF/services/org.eclipse.xtext.ISetup @@ -0,0 +1 @@ +io.sarl.lang.ide.SARLIdeSetup diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/AbstractSARLIdeModule.java b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/AbstractSARLIdeModule.java new file mode 100644 index 0000000000..5963d9be00 --- /dev/null +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/AbstractSARLIdeModule.java @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * File is automatically generated by the Xtext language generator. + * Do not change it. + * + * SARL is an general-purpose agent programming language. + * More details on http://www.sarl.io + * + * Copyright 2014-2017 the original authors and 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.lang.ide; + +import com.google.inject.Binder; +import com.google.inject.name.Names; +import io.sarl.lang.ide.contentassist.antlr.SARLParser; +import io.sarl.lang.ide.contentassist.antlr.internal.InternalSARLLexer; +import org.eclipse.xtext.ide.LexerIdeBindings; +import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper; +import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory; +import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; +import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory; +import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; +import org.eclipse.xtext.xbase.ide.DefaultXbaseIdeModule; + +/** + * Manual modifications go to {@link SARLIdeModule}. + */ +@SuppressWarnings("all") +public abstract class AbstractSARLIdeModule extends DefaultXbaseIdeModule { + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public void configureContentAssistLexer(Binder binder) { + binder.bind(Lexer.class) + .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST)) + .to(InternalSARLLexer.class); + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIContentAssistParser() { + return SARLParser.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindIProposalConflictHelper() { + return AntlrProposalConflictHelper.class; + } + + // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 + public Class bindContentAssistContextFactory() { + return PartialContentAssistContextFactory.class; + } + +} diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/contentassist/antlr/SARLParser.java b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/contentassist/antlr/SARLParser.java index 0810e5547c..519ab80a1c 100644 --- a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/contentassist/antlr/SARLParser.java +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ide/contentassist/antlr/SARLParser.java @@ -26,14 +26,10 @@ import com.google.inject.Inject; import io.sarl.lang.ide.contentassist.antlr.internal.InternalSARLParser; import io.sarl.lang.services.SARLGrammarAccess; -import java.util.Collection; import java.util.HashMap; import java.util.Map; -import org.antlr.runtime.RecognitionException; import org.eclipse.xtext.AbstractElement; import org.eclipse.xtext.ide.editor.contentassist.antlr.AbstractPartialContentAssistParser; -import org.eclipse.xtext.ide.editor.contentassist.antlr.FollowElement; -import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser; public class SARLParser extends AbstractPartialContentAssistParser { @@ -1061,18 +1057,7 @@ protected String getRuleName(AbstractElement element) { } return nameMappings.get(element); } - - @Override - protected Collection getFollowElements(AbstractInternalContentAssistParser parser) { - try { - InternalSARLParser typedParser = (InternalSARLParser) parser; - typedParser.entryRuleSarlScript(); - return typedParser.getFollowElements(); - } catch(RecognitionException ex) { - throw new RuntimeException(ex); - } - } - + @Override protected String[] getInitialHiddenTokens() { return new String[] { "RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT" }; diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ui/AbstractSARLUiModule.java b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ui/AbstractSARLUiModule.java index feb7b11c0d..77e90e2b01 100644 --- a/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ui/AbstractSARLUiModule.java +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src-gen/io/sarl/lang/ui/AbstractSARLUiModule.java @@ -113,9 +113,7 @@ import org.eclipse.xtext.generator.IContextualOutputConfigurationProvider; import org.eclipse.xtext.ide.LexerIdeBindings; import org.eclipse.xtext.ide.editor.bracketmatching.IBracePairProvider; -import org.eclipse.xtext.ide.editor.contentassist.antlr.ContentAssistContextFactory; import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser; -import org.eclipse.xtext.ide.editor.contentassist.antlr.PartialContentAssistContextFactory; import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer; import org.eclipse.xtext.ide.editor.partialEditing.IPartialEditingContentAssistParser; import org.eclipse.xtext.ide.editor.syntaxcoloring.ISemanticHighlightingCalculator; @@ -219,7 +217,7 @@ public AbstractSARLUiModule(AbstractUIPlugin plugin) { } // contributed by org.eclipse.xtext.xtext.generator.ImplicitFragment - public Provider provideIAllContainersState() { + public Provider provideIAllContainersState() { return Access.getJavaProjectsState(); } @@ -274,11 +272,6 @@ public void configureContentAssistLexerProvider(Binder binder) { binder.bind(InternalSARLLexer.class).toProvider(LexerProvider.create(InternalSARLLexer.class)); } - // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 - public Class bindContentAssistContextFactory() { - return PartialContentAssistContextFactory.class; - } - // contributed by org.eclipse.xtext.xtext.generator.formatting.Formatter2Fragment2 public Class bindIContentFormatterFactory() { return ContentFormatterFactory.class; @@ -435,12 +428,12 @@ public Class bindIUnresolvedTypeResolver() { } // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 - public Provider provideTemplatesLanguageConfiguration() { + public Provider provideTemplatesLanguageConfiguration() { return AccessibleCodetemplatesActivator.getTemplatesLanguageConfigurationProvider(); } // contributed by org.eclipse.xtext.xtext.generator.ui.templates.CodetemplatesGeneratorFragment2 - public Provider provideLanguageRegistry() { + public Provider provideLanguageRegistry() { return AccessibleCodetemplatesActivator.getLanguageRegistry(); } diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeModule.java b/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeModule.java new file mode 100644 index 0000000000..ed94112010 --- /dev/null +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeModule.java @@ -0,0 +1,35 @@ +/* + * $Id$ + * + * SARL is an general-purpose agent programming language. + * More details on http://www.sarl.io + * + * Copyright (C) 2014-2017 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.lang.ide; + + +/** + * Use this class to register ide components. + * + * @author $Author: sgalland$ + * @version $FullVersion$ + * @mavengroupid $GroupId$ + * @mavenartifactid $ArtifactId$ + */ +public class SARLIdeModule extends AbstractSARLIdeModule { + // +} diff --git a/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeSetup.java b/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeSetup.java new file mode 100644 index 0000000000..81f5b47296 --- /dev/null +++ b/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ide/SARLIdeSetup.java @@ -0,0 +1,46 @@ +/* + * $Id$ + * + * SARL is an general-purpose agent programming language. + * More details on http://www.sarl.io + * + * Copyright (C) 2014-2017 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.lang.ide; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import org.eclipse.xtext.util.Modules2; + +import io.sarl.lang.SARLRuntimeModule; +import io.sarl.lang.SARLStandaloneSetup; + +/** + * Initialization support for running Xtext languages as language servers. + * + * @author $Author: sgalland$ + * @version $FullVersion$ + * @mavengroupid $GroupId$ + * @mavenartifactid $ArtifactId$ + */ +public class SARLIdeSetup extends SARLStandaloneSetup { + + @Override + public Injector createInjector() { + return Guice.createInjector(Modules2.mixin(new SARLRuntimeModule(), new SARLIdeModule())); + } + +} diff --git a/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/AbstractSARLRuntimeModule.java b/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/AbstractSARLRuntimeModule.java index 5583e7a10a..c02cc5193a 100644 --- a/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/AbstractSARLRuntimeModule.java +++ b/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/AbstractSARLRuntimeModule.java @@ -284,7 +284,7 @@ public Class bindITokenDefProvider() { } // contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2 - public Provider provideInternalSARLLexer() { + public Provider provideInternalSARLLexer() { return LexerProvider.create(InternalSARLLexer.class); } diff --git a/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/SARL.xtextbin b/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/SARL.xtextbin index 0072cdc077..b8ca8037a9 100644 Binary files a/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/SARL.xtextbin and b/eclipse-sarl/plugins/io.sarl.lang/src-gen/io/sarl/lang/SARL.xtextbin differ diff --git a/formatting-styles/latex/sarl-beamer-listing.sty b/formatting-styles/latex/sarl-beamer-listing.sty index e2daefe2e3..f42c8345dd 100644 --- a/formatting-styles/latex/sarl-beamer-listing.sty +++ b/formatting-styles/latex/sarl-beamer-listing.sty @@ -22,7 +22,7 @@ % limitations under the License. % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sarl-beamer-listing}[2017/02/03] +\ProvidesPackage{sarl-beamer-listing}[2017/02/06] \RequirePackage{algpseudocode} \RequirePackage{listings} \RequirePackage{xspace} diff --git a/formatting-styles/latex/sarl-colorized-listing.sty b/formatting-styles/latex/sarl-colorized-listing.sty index fa3b91266a..7929746fea 100644 --- a/formatting-styles/latex/sarl-colorized-listing.sty +++ b/formatting-styles/latex/sarl-colorized-listing.sty @@ -22,7 +22,7 @@ % limitations under the License. % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sarl-colorized-listing}[2017/02/03] +\ProvidesPackage{sarl-colorized-listing}[2017/02/06] \RequirePackage{algpseudocode} \RequirePackage{listings} \RequirePackage{xspace} diff --git a/formatting-styles/latex/sarl-listing.sty b/formatting-styles/latex/sarl-listing.sty index aaf55c3ce9..b1f4afe85b 100644 --- a/formatting-styles/latex/sarl-listing.sty +++ b/formatting-styles/latex/sarl-listing.sty @@ -22,7 +22,7 @@ % limitations under the License. % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sarl-listing}[2017/02/03] +\ProvidesPackage{sarl-listing}[2017/02/06] \RequirePackage{algpseudocode} \RequirePackage{listings} \RequirePackage{xspace} diff --git a/sre/io.janusproject/io.janusproject.feature/feature.xml b/sre/io.janusproject/io.janusproject.feature/feature.xml index 432be4081c..1a763f447f 100644 --- a/sre/io.janusproject/io.janusproject.feature/feature.xml +++ b/sre/io.janusproject/io.janusproject.feature/feature.xml @@ -228,6 +228,7 @@ + @@ -240,7 +241,6 @@ - () { - @Override - public void apply(FormatterTestRequest it) { - it.setToBeFormatted(input); - it.setExpectation(expected); - it.setAllowSyntaxErrors(false); - it.setAllowUnformattedWhitespace(true); - it.setUseNodeModel(true); - it.setUseSerializer(false); - } - }); + protected void assertFormatted(final String input, final String expected) { + this.helper.assertFormatted((it) -> configureFormatterTestRequest(input, expected, it)); } } \ No newline at end of file diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AbstractMemberFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AbstractMemberFormatterTest.java index d8a56acaaa..c0f4448584 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AbstractMemberFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AbstractMemberFormatterTest.java @@ -16,8 +16,8 @@ package io.sarl.lang.tests.modules.formatting2; import com.google.inject.Inject; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; +import org.eclipse.xtext.testing.formatter.FormatterTestHelper; +import org.eclipse.xtext.testing.formatter.FormatterTestRequest; import org.eclipse.xtext.xbase.lib.Procedures; import io.sarl.tests.api.AbstractSarlTest; @@ -33,24 +33,15 @@ public abstract class AbstractMemberFormatterTest extends AbstractSarlTest { @Inject - private FormatterTester tester; + private FormatterTestHelper tester; /** Assert formatting * * @param input the input. * @param expected the expected input. */ - protected void assertFormatted(CharSequence input, final CharSequence expected) { - this.tester.assertFormatted(new Procedures.Procedure1() { - @Override - public void apply(FormatterTestRequest it) { - it.setToBeFormatted(input); - it.setExpectation(expected); - it.setAllowSyntaxErrors(false); - it.setUseNodeModel(true); - it.setUseSerializer(false); - } - }); + protected void assertFormatted(final CharSequence input, final CharSequence expected) { + this.tester.assertFormatted((it) -> AbstractFormatterTest.configureFormatterTestRequest(input, expected, it)); } /** Replies the keyword for declaring the top element. diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ActionFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ActionFormatterTest.java index 1c08b234ff..7917e9b40f 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ActionFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ActionFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting actions. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AgentFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AgentFormatterTest.java index 18bfa7b5d8..13b023d38b 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AgentFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AgentFormatterTest.java @@ -15,27 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; -import org.junit.Before; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.lang.tests.general.compilation.general.ArgDefaultValueCompilerTest; -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting agents. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AnnotationTypeFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AnnotationTypeFormatterTest.java index 420a5d6ca5..b943e99a1e 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AnnotationTypeFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/AnnotationTypeFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting enumerations. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorFormatterTest.java index 57b6feaa47..7b406b8de9 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting agents. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorUnitFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorUnitFormatterTest.java index e85c3bdf9b..5025a597a3 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorUnitFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/BehaviorUnitFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting behavior units. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityFormatterTest.java index 49cfcded40..31c49fa59b 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting capacities. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityUsesFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityUsesFormatterTest.java index c4ac38dfda..321b540ede 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityUsesFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/CapacityUsesFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting capacity uses. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ClassFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ClassFormatterTest.java index 77ae3768f4..ca5873b21f 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ClassFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ClassFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting classes. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ConstructorFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ConstructorFormatterTest.java index 14b07f9db7..77647cc20a 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ConstructorFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ConstructorFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting constructors. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/DocumentationFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/DocumentationFormatterTest.java index bd66b02bd7..b5b68925a2 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/DocumentationFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/DocumentationFormatterTest.java @@ -15,49 +15,16 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; -import javax.swing.text.StyledEditorKit.BoldAction; - import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; -import org.junit.Assume; -import org.junit.AssumptionViolatedException; import org.junit.ComparisonFailure; -import org.junit.Rule; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; -import org.junit.rules.TestName; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.Statement; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; import io.sarl.lang.documentation.IDocumentationFormatter; import io.sarl.tests.api.AbstractSarlTest; -import io.sarl.tests.api.TestScope; /** Abstract test of a SARL documentation formatter. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EnumFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EnumFormatterTest.java index e47232607d..46b9f36237 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EnumFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EnumFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting enumerations. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EventFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EventFormatterTest.java index 2ef4ef884f..60ea7b7d90 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EventFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/EventFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting events. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/InterfaceFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/InterfaceFormatterTest.java index a25fee7c80..1178ab3ffc 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/InterfaceFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/InterfaceFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting interfaces. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/RequiredCapacityFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/RequiredCapacityFormatterTest.java index 199b8267a7..167e9ae6a6 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/RequiredCapacityFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/RequiredCapacityFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting required capacities. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/SkillFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/SkillFormatterTest.java index 12e5d8f0d3..42412e51c4 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/SkillFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/SkillFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting skills. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ValueFieldFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ValueFieldFormatterTest.java index 4d1dc4adca..d3f1c78fd3 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ValueFieldFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/ValueFieldFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting fields. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/VariableFieldFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/VariableFieldFormatterTest.java index 9e46fafd20..94243d77a8 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/VariableFieldFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/VariableFieldFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting fields. * diff --git a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/XExpressionFormatterTest.java b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/XExpressionFormatterTest.java index 594ca2f08b..3f6563022a 100644 --- a/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/XExpressionFormatterTest.java +++ b/tests/io.sarl.lang.tests/src/io/sarl/lang/tests/modules/formatting2/XExpressionFormatterTest.java @@ -15,25 +15,10 @@ */ package io.sarl.lang.tests.modules.formatting2; -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Named; - -import com.google.inject.Inject; -import junit.framework.TestSuite; -import org.eclipse.xtext.junit4.formatter.FormatterTestRequest; -import org.eclipse.xtext.junit4.formatter.FormatterTester; -import org.eclipse.xtext.util.Strings; -import org.eclipse.xtext.xbase.lib.Procedures; import org.junit.Test; -import org.junit.internal.builders.AllDefaultPossibilitiesBuilder; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.model.InitializationError; - -import io.sarl.tests.api.AbstractSarlTest; /** Tests for formatting several XExpressions. * diff --git a/tests/io.sarl.lang.ui.tests/META-INF/MANIFEST.MF b/tests/io.sarl.lang.ui.tests/META-INF/MANIFEST.MF index f16c3d799d..439cd06188 100644 --- a/tests/io.sarl.lang.ui.tests/META-INF/MANIFEST.MF +++ b/tests/io.sarl.lang.ui.tests/META-INF/MANIFEST.MF @@ -7,10 +7,18 @@ Bundle-SymbolicName: io.sarl.lang.ui.tests; singleton:=true Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: io.sarl.tests.api;bundle-version="0.5.0", io.sarl.tests.testdata;bundle-version="0.5.0", - org.eclipse.xtend.ide;bundle-version="2.10.0", + org.eclipse.xtend.ide;bundle-version="2.11.0", + org.eclipse.xtext.junit4;bundle-version="2.11.0", + org.eclipse.xtext.ui.ecore;bundle-version="2.11.0", + org.eclipse.xtext.xbase.ui;bundle-version="2.11.0", + org.eclipse.xtext.ui;bundle-version="2.11.0", org.eclipse.jdt.ui;bundle-version="3.12.2", + org.eclipse.jface.text;bundle-version="3.11.2", org.mockito.mockito-core;bundle-version="2.0.111", - org.arakhne.afc.core.text;bundle-version="14.0.0" + org.arakhne.afc.core.text;bundle-version="14.0.0", + org.eclipse.swt;bundle-version="3.105.2", + org.eclipse.core.resources;bundle-version="3.11.1", + org.eclipse.ui;bundle-version="3.108.1" Export-Package: io.sarl.lang.ui.tests.bugs, io.sarl.lang.ui.tests.contentassist, io.sarl.lang.ui.tests.highlighting, diff --git a/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java index f2db4ade52..5b1001930c 100644 --- a/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java +++ b/tests/io.sarl.lang.ui.tests/src/io/sarl/lang/ui/tests/contentassist/AbstractContentAssistTest.java @@ -37,7 +37,6 @@ import org.eclipse.core.resources.IFile; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; @@ -48,7 +47,6 @@ import org.eclipse.xtext.junit4.ui.ContentAssistProcessorTestBuilder; import org.eclipse.xtext.junit4.util.ResourceLoadHelper; import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal; import org.eclipse.xtext.ui.editor.contentassist.ReplacementTextApplier; import org.eclipse.xtext.ui.editor.model.IXtextDocument; @@ -336,7 +334,7 @@ private Shell ensureShell() { } @Override - protected ICompletionProposal[] computeCompletionProposals(final IXtextDocument xtextDocument, int cursorPosition) + protected ICompletionProposal[] computeCompletionProposals(IXtextDocument xtextDocument, int cursorPosition) throws BadLocationException { if (isEclipseRuntimeEnvironment()) { Shell shell = getShell(); @@ -363,7 +361,7 @@ protected ICompletionProposal[] computeCompletionProposals(final IXtextDocument } return resultBuffer.get(0); } - + @Override public ContentAssistProcessorTestBuilder applyProposal(int position, String proposalString) throws Exception { throw new UnsupportedOperationException("must be overriden for Shell access"); diff --git a/tests/io.sarl.m2e.tests/META-INF/MANIFEST.MF b/tests/io.sarl.m2e.tests/META-INF/MANIFEST.MF index 2f30a4268b..a8fcecd994 100644 --- a/tests/io.sarl.m2e.tests/META-INF/MANIFEST.MF +++ b/tests/io.sarl.m2e.tests/META-INF/MANIFEST.MF @@ -9,8 +9,13 @@ Require-Bundle: io.sarl.m2e;bundle-version="0.5.0", io.sarl.eclipse;bundle-version="0.5.0", io.sarl.tests.api;bundle-version="0.5.0", io.sarl.tests.testdata;bundle-version="0.5.0", + org.eclipse.xtext.junit4;bundle-version="2.11.0", + org.eclipse.xtext.ui;bundle-version="2.11.0", org.eclipse.jdt.core;bundle-version="3.12.2", org.eclipse.m2e.maven.runtime;bundle-version="1.7.0", org.eclipse.m2e.core;bundle-version="1.7.0", - org.mockito.mockito-core;bundle-version="2.0.111" + org.mockito.mockito-core;bundle-version="2.0.111", + org.eclipse.core.resources;bundle-version="3.11.1", + org.eclipse.equinox.common;bundle-version="3.8.0", + org.eclipse.swt;bundle-version="3.105.2" Export-Package: io.sarl.m2e.tests diff --git a/tests/io.sarl.tests.api/META-INF/MANIFEST.MF b/tests/io.sarl.tests.api/META-INF/MANIFEST.MF index 955f16b220..d18d099994 100644 --- a/tests/io.sarl.tests.api/META-INF/MANIFEST.MF +++ b/tests/io.sarl.tests.api/META-INF/MANIFEST.MF @@ -1,35 +1,39 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: io.sarl.tests.api;singleton:=true -Bundle-Version: 0.5.0.qualifier -Bundle-Vendor: %Bundle-Vendor -Bundle-Name: %Bundle-Name -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Bundle-ActivationPolicy: lazy -Require-Bundle: io.sarl.lang;bundle-version="0.5.0", - io.sarl.lang.ui;bundle-version="0.5.0";visibility:=reexport, - org.eclipse.xtext.junit4;bundle-version="2.11.0";visibility:=reexport, - org.eclipse.xtext.xbase.lib;bundle-version="2.11.0", - org.eclipse.xtext.xbase.junit;bundle-version="2.11.0";visibility:=reexport, - org.eclipse.xtend.core;bundle-version="2.11.0";visibility:=reexport, - org.junit;bundle-version="4.12.0";visibility:=reexport, - org.mockito.mockito-core;bundle-version="2.0.111", - org.eclipse.jdt.ui;bundle-version="3.12.2", - org.eclipse.jdt.core;bundle-version="3.12.2", - org.eclipse.core.filesystem;bundle-version="1.6.1", - org.eclipse.ui.ide;bundle-version="3.12.2", - org.eclipse.core.runtime;bundle-version="3.12.0", - org.eclipse.ui.workbench;bundle-version="3.108.2";resolution:=optional, - org.objectweb.asm;bundle-version="5.0.1";resolution:=optional, - org.eclipse.jdt.annotation;bundle-version="2.1.0";visibility:=reexport -Import-Package: org.junit.runner;version="4.5.0", - org.junit.runner.manipulation;version="4.5.0", - org.junit.runner.notification;version="4.5.0", - org.junit.runners;version="4.5.0", - org.junit.runners.model;version="4.5.0", - org.hamcrest.core, - org.junit;version="4.5.0" -Export-Package: io.sarl.lang.tests, - io.sarl.lang.ui.tests, - io.sarl.tests.api -Bundle-Activator: io.sarl.tests.api.TestPluginActivator +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: io.sarl.tests.api;singleton:=true +Bundle-Version: 0.5.0.qualifier +Bundle-Vendor: %Bundle-Vendor +Bundle-Name: %Bundle-Name +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-ActivationPolicy: lazy +Require-Bundle: io.sarl.lang;bundle-version="0.5.0", + io.sarl.lang.ui;bundle-version="0.5.0";visibility:=reexport, + org.eclipse.xtext.testing;bundle-version="2.11.0";visibility:=reexport, + org.eclipse.xtext.xbase.testing;bundle-version="2.11.0";visibility:=reexport, + org.eclipse.xtext.xbase.lib;bundle-version="2.11.0", + org.eclipse.xtext.ui;bundle-version="2.11.0", + org.eclipse.xtext.junit4;bundle-version="2.11.0", + org.eclipse.xtext.xbase.junit;bundle-version="2.11.0", + org.eclipse.xtend.core;bundle-version="2.11.0";visibility:=reexport, + org.junit;bundle-version="4.12.0";visibility:=reexport, + org.mockito.mockito-core;bundle-version="2.0.111", + org.eclipse.jdt.ui;bundle-version="3.12.2", + org.eclipse.jdt.core;bundle-version="3.12.2", + org.eclipse.core.filesystem;bundle-version="1.6.1", + org.eclipse.ui.ide;bundle-version="3.12.2", + org.eclipse.core.runtime;bundle-version="3.12.0", + org.eclipse.ui.workbench;bundle-version="3.108.2";resolution:=optional, + org.objectweb.asm;bundle-version="5.0.1";resolution:=optional, + org.eclipse.jdt.annotation;bundle-version="2.1.0";visibility:=reexport, + org.eclipse.jface;bundle-version="3.12.1" +Import-Package: org.junit.runner;version="4.5.0", + org.junit.runner.manipulation;version="4.5.0", + org.junit.runner.notification;version="4.5.0", + org.junit.runners;version="4.5.0", + org.junit.runners.model;version="4.5.0", + org.hamcrest.core, + org.junit;version="4.5.0" +Export-Package: io.sarl.lang.tests;x-internal=true, + io.sarl.lang.ui.tests;x-internal=true, + io.sarl.tests.api +Bundle-Activator: io.sarl.tests.api.TestPluginActivator diff --git a/tests/io.sarl.tests.api/src-gen/io/sarl/lang/tests/SARLInjectorProvider.java b/tests/io.sarl.tests.api/src-gen/io/sarl/lang/tests/SARLInjectorProvider.java index 79100b8103..b76c02e23e 100644 --- a/tests/io.sarl.tests.api/src-gen/io/sarl/lang/tests/SARLInjectorProvider.java +++ b/tests/io.sarl.tests.api/src-gen/io/sarl/lang/tests/SARLInjectorProvider.java @@ -27,10 +27,10 @@ import com.google.inject.Injector; import io.sarl.lang.SARLRuntimeModule; import io.sarl.lang.SARLStandaloneSetup; -import org.eclipse.xtext.junit4.GlobalRegistries; -import org.eclipse.xtext.junit4.GlobalRegistries.GlobalStateMemento; -import org.eclipse.xtext.junit4.IInjectorProvider; -import org.eclipse.xtext.junit4.IRegistryConfigurator; +import org.eclipse.xtext.testing.GlobalRegistries; +import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; +import org.eclipse.xtext.testing.IInjectorProvider; +import org.eclipse.xtext.testing.IRegistryConfigurator; public class SARLInjectorProvider implements IInjectorProvider, IRegistryConfigurator { diff --git a/tests/io.sarl.tests.api/src-gen/io/sarl/lang/ui/tests/SARLUiInjectorProvider.java b/tests/io.sarl.tests.api/src-gen/io/sarl/lang/ui/tests/SARLUiInjectorProvider.java index c647c29ad5..0af4788331 100644 --- a/tests/io.sarl.tests.api/src-gen/io/sarl/lang/ui/tests/SARLUiInjectorProvider.java +++ b/tests/io.sarl.tests.api/src-gen/io/sarl/lang/ui/tests/SARLUiInjectorProvider.java @@ -25,7 +25,7 @@ import com.google.inject.Injector; import io.sarl.lang.ui.internal.LangActivator; -import org.eclipse.xtext.junit4.IInjectorProvider; +import org.eclipse.xtext.testing.IInjectorProvider; public class SARLUiInjectorProvider implements IInjectorProvider { diff --git a/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlTest.java b/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlTest.java index b7457d6bbe..107959d76a 100644 --- a/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlTest.java +++ b/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlTest.java @@ -63,11 +63,11 @@ import org.eclipse.xtext.common.types.JvmOperation; import org.eclipse.xtext.common.types.JvmTypeReference; import org.eclipse.xtext.diagnostics.Severity; -import org.eclipse.xtext.junit4.InjectWith; -import org.eclipse.xtext.junit4.XtextRunner; -import org.eclipse.xtext.junit4.util.ParseHelper; -import org.eclipse.xtext.junit4.validation.ValidationTestHelper; import org.eclipse.xtext.resource.XtextResourceSet; +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.eclipse.xtext.testing.util.ParseHelper; +import org.eclipse.xtext.testing.validation.ValidationTestHelper; import org.eclipse.xtext.util.JavaVersion; import org.eclipse.xtext.validation.Issue; import org.eclipse.xtext.xbase.XExpression; @@ -127,7 +127,7 @@ */ @SuppressWarnings("all") @RunWith(XtextRunner.class) -@InjectWith(SARLInjectorProvider.class) +@InjectWith(ExtendedSARLInjectorProvider.class) public abstract class AbstractSarlTest { /** URL of the Maven central repository. diff --git a/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlUiTest.java b/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlUiTest.java index 04a220ff79..1fa820d964 100644 --- a/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlUiTest.java +++ b/tests/io.sarl.tests.api/src/io/sarl/tests/api/AbstractSarlUiTest.java @@ -21,7 +21,6 @@ package io.sarl.tests.api; -import static org.eclipse.xtext.junit4.ui.util.IResourcesSetupUtil.reallyWaitForAutoBuild; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -48,9 +47,9 @@ import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider; import org.eclipse.jdt.ui.JavaElementImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.xtext.junit4.InjectWith; -import org.eclipse.xtext.junit4.ui.util.JavaProjectSetupUtil; +import org.eclipse.xtext.testing.InjectWith; import org.eclipse.xtext.ui.XtextProjectHelper; +import org.eclipse.xtext.ui.util.JREContainerProvider; import org.eclipse.xtext.ui.util.PluginProjectFactory; import org.eclipse.xtext.util.JavaVersion; import org.eclipse.xtext.util.Strings; @@ -213,13 +212,11 @@ protected Module[] getInjectionModules() { new Module() { @Override public void configure(Binder binder) { - binder.bind(ProjectCreator.class).to(JavaProjectCreator.class); - binder.bind(JavaVersion.class).toProvider(new Provider() { - @Override - public JavaVersion get() { - return JavaVersion.JAVA8; - } - }); + final JavaVersion version = JavaVersion.JAVA8; + binder.bind(JavaVersion.class).toProvider(() -> version); + binder.bind(ProjectCreator.class).toProvider(() -> { + return new JavaProjectCreator(version); + }).asEagerSingleton(); } }, }; @@ -374,18 +371,18 @@ protected SarlScript file(String string, boolean validate) throws Exception { * @mavenartifactid $ArtifactId$ */ @Singleton - private static class JavaProjectCreator implements ProjectCreator { + private class JavaProjectCreator implements ProjectCreator { - @Inject - private Injector injector; - - @Inject @Nullable - private JavaVersion javaVersion; + private final JavaVersion javaVersion; + JavaProjectCreator(JavaVersion version) { + this.javaVersion = version; + } + @Override public Injector getInjector() { - return this.injector; + return getInjectedInjector(); } @Override @@ -427,12 +424,26 @@ public String[] getNatures() { @Override public void addJreClasspathEntry(IJavaProject javaProject) throws JavaModelException { - JavaProjectSetupUtil.addJreClasspathEntry(javaProject); + IClasspathEntry existingJreContainerClasspathEntry = JREContainerProvider.getJREContainerEntry(javaProject); + if (existingJreContainerClasspathEntry == null) { + addToClasspath(javaProject, JREContainerProvider.getDefaultJREContainerEntry()); + } } @Override public void addToClasspath(IJavaProject javaProject, IClasspathEntry newClassPathEntry) throws JavaModelException { - JavaProjectSetupUtil.addToClasspath(javaProject, newClassPathEntry); + IClasspathEntry[] newClassPath; + IClasspathEntry[] classPath = javaProject.getRawClasspath(); + for (IClasspathEntry classPathEntry : classPath) { + if (classPathEntry.equals(newClassPathEntry)) { + return; + } + } + newClassPath = new IClasspathEntry[classPath.length + 1]; + System.arraycopy(classPath, 0, newClassPath, 1, classPath.length); + newClassPath[0] = newClassPathEntry; + javaProject.setRawClasspath(newClassPath, null); + helper().awaitAutoBuild(); } @Override @@ -449,7 +460,7 @@ public void addToClasspath(IJavaProject javaProject, newClassPath.toArray(classPath); javaProject.setRawClasspath(classPath, null); if (autobuild) { - reallyWaitForAutoBuild(); + helper().awaitAutoBuild(); } } diff --git a/tests/io.sarl.tests.api/src/io/sarl/tests/api/ExtendedSARLInjectorProvider.java b/tests/io.sarl.tests.api/src/io/sarl/tests/api/ExtendedSARLInjectorProvider.java new file mode 100644 index 0000000000..18aa32361d --- /dev/null +++ b/tests/io.sarl.tests.api/src/io/sarl/tests/api/ExtendedSARLInjectorProvider.java @@ -0,0 +1,92 @@ +/* + * $Id$ + * + * SARL is an general-purpose agent programming language. + * More details on http://www.sarl.io + * + * Copyright (C) 2014-2017 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.tests.api; + +import com.google.inject.Binder; +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Module; +import com.google.inject.Provider; +import org.eclipse.xtext.util.JavaVersion; +import org.eclipse.xtext.xbase.testing.OnTheFlyJavaCompiler2; + +import io.sarl.lang.SARLStandaloneSetup; +import io.sarl.lang.tests.SARLInjectorProvider; + +/** Override the module definition for tests only. + * + *

This class is implemented for overriding the default Javba version of the on-the-fly Java compiler + * that is used by the testing framework. Indeed, the default Java version for this compiler is Java 6. But, + * we are expecting at least Java 8 in tests. + * + * @author $Author: sgalland$ + * @version $FullVersion$ + * @mavengroupid $GroupId$ + * @mavenartifactid $ArtifactId$ + */ +public class ExtendedSARLInjectorProvider extends SARLInjectorProvider { + + @Override + protected Injector internalCreateInjector() { + return new SARLStandaloneSetup() { + @SuppressWarnings("synthetic-access") + @Override + public Injector createInjector() { + return Guice.createInjector(createRuntimeModule(), createRuntimeTestModule()); + } + }.createInjectorAndDoEMFRegistration(); + } + + /** Create the module for tests of the runtime libraries. + * + * @return the module. + */ + @SuppressWarnings("static-method") + protected Module createRuntimeTestModule() { + return new Module() { + + @Override + public void configure(Binder binder) { + binder.bind(OnTheFlyJavaCompiler2.class).toProvider(JavaCompilerProvider.class).asEagerSingleton(); + } + + }; + } + + /** Provider of the on-the-fly Java compiler. + * + * @author $Author: sgalland$ + * @version $FullVersion$ + * @mavengroupid $GroupId$ + * @mavenartifactid $ArtifactId$ + */ + public static class JavaCompilerProvider implements Provider { + + @Override + public OnTheFlyJavaCompiler2 get() { + return new OnTheFlyJavaCompiler2( + SARLInjectorProvider.class.getClassLoader(), + JavaVersion.JAVA8); + } + + } + +} diff --git a/tests/io.sarl.tests.api/src/io/sarl/tests/api/WorkbenchTestHelper.java b/tests/io.sarl.tests.api/src/io/sarl/tests/api/WorkbenchTestHelper.java index 04ba299209..1a47a3b895 100644 --- a/tests/io.sarl.tests.api/src/io/sarl/tests/api/WorkbenchTestHelper.java +++ b/tests/io.sarl.tests.api/src/io/sarl/tests/api/WorkbenchTestHelper.java @@ -52,15 +52,19 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceDescription; +import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -83,7 +87,6 @@ import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.xtend.core.xtend.XtendTypeDeclaration; -import org.eclipse.xtext.junit4.ui.util.IResourcesSetupUtil; import org.eclipse.xtext.resource.FileExtensionProvider; import org.eclipse.xtext.ui.editor.XtextEditor; import org.eclipse.xtext.ui.editor.XtextEditorInfo; @@ -218,14 +221,25 @@ protected void execute(IProgressMonitor monitor) throws CoreException, } }.run(null); - IResourcesSetupUtil.reallyWaitForAutoBuild(); + awaitAutoBuild(); } + private static void deleteProjects(IProject[] projects) throws CoreException { + for (IProject iProject : projects) { + if (iProject.exists()) { + iProject.delete(true,true, new NullProgressMonitor()); + } + } + } + /** Clear the workspace. */ public void clearWorkspace() { try { - IResourcesSetupUtil.cleanWorkspace(); + IProject[] visibleProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + deleteProjects(visibleProjects); + IProject[] hiddenProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(org.eclipse.core.resources.IContainer.INCLUDE_HIDDEN); + deleteProjects(hiddenProjects); } catch (Exception e) { throw new RuntimeException(e); } @@ -337,6 +351,35 @@ public IFile createFile(String fileName, String content) throws Exception { return createFileImpl(fullFileName, content); } + private static IProject createProject(IProject project) throws CoreException { + if (!project.exists()) + project.create(new NullProgressMonitor()); + project.open(new NullProgressMonitor()); + return project; + } + + private static void create(org.eclipse.core.resources.IContainer container) + throws InvocationTargetException, InterruptedException { + new WorkspaceModifyOperation() { + + @SuppressWarnings("synthetic-access") + @Override + protected void execute(IProgressMonitor monitor) + throws CoreException, InvocationTargetException, + InterruptedException { + if (!container.exists()) { + create(container.getParent()); + if (container instanceof IFolder) { + ((IFolder) container).create(true, true, new NullProgressMonitor()); + } else { + IProject iProject = (IProject) container; + createProject(iProject); + } + } + } + }.run(new NullProgressMonitor()); + } + /** Create a file. * * @param fullFileName the name of the file to create. @@ -345,7 +388,19 @@ public IFile createFile(String fileName, String content) throws Exception { * @throws Exception */ public IFile createFileImpl(String fullFileName, String content) throws Exception { - IFile file = IResourcesSetupUtil.createFile(fullFileName, content); + final IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fullFileName)); + new WorkspaceModifyOperation() { + @SuppressWarnings({ "synthetic-access", "resource" }) + @Override + protected void execute(IProgressMonitor monitor) + throws CoreException, InvocationTargetException, + InterruptedException { + create(file.getParent()); + file.delete(true, new NullProgressMonitor()); + file.create(new StringInputStream(content), true, new NullProgressMonitor()); + } + + }.run(new NullProgressMonitor()); getFiles().add(file); return file; } @@ -706,7 +761,7 @@ public IProject createPluginProject(String name, ProjectCreator creator, String. exception.getLocalizedMessage(), exception)); } - IResourcesSetupUtil.reallyWaitForAutoBuild(); + awaitAutoBuild(); return result; } @@ -978,7 +1033,18 @@ public void awaitUIUpdate(Functions.Function0 test, final long timeout) /** Wait for the end of auto-build. */ public void awaitAutoBuild() { - IResourcesSetupUtil.reallyWaitForAutoBuild(); + boolean wasInterrupted = false; + do { + try { + Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, + null); + wasInterrupted = false; + } catch (OperationCanceledException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + wasInterrupted = true; + } + } while (wasInterrupted); } /** Do a full build. @@ -992,7 +1058,20 @@ public void fullBuild(Resource... resources) throws CoreException { resource.getContents(); } } - IResourcesSetupUtil.fullBuild(); + ResourcesPlugin.getWorkspace().build( + IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor()); + boolean wasInterrupted = false; + do { + try { + Job.getJobManager().join(ResourcesPlugin.FAMILY_MANUAL_BUILD, + null); + wasInterrupted = false; + } catch (OperationCanceledException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + wasInterrupted = true; + } + } while (wasInterrupted); } /** Generate a filename for a resource that does not exist yet. diff --git a/tests/io.sarl.util.tests/META-INF/MANIFEST.MF b/tests/io.sarl.util.tests/META-INF/MANIFEST.MF index 4f156ad744..0d0cc4bfd6 100644 --- a/tests/io.sarl.util.tests/META-INF/MANIFEST.MF +++ b/tests/io.sarl.util.tests/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Bundle-Name: %Bundle-Name Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: io.sarl.util;bundle-version="0.5.0", io.sarl.tests.api;bundle-version="0.5.0", - org.mockito.mockito-core;bundle-version="2.0.111" + org.mockito.mockito-core;bundle-version="2.0.111", + javax.inject;bundle-version="1.0.0" Export-Package: io.sarl.util.tests.eventdispatching, io.sarl.util.tests.sarlspecification, io.sarl.util.tests.util diff --git a/tests/io.sarl.util.tests/src/io/sarl/util/tests/eventdispatching/BehaviorGuardEvaluatorRegistryTest.java b/tests/io.sarl.util.tests/src/io/sarl/util/tests/eventdispatching/BehaviorGuardEvaluatorRegistryTest.java index f03b0a6b8c..301de244b0 100644 --- a/tests/io.sarl.util.tests/src/io/sarl/util/tests/eventdispatching/BehaviorGuardEvaluatorRegistryTest.java +++ b/tests/io.sarl.util.tests/src/io/sarl/util/tests/eventdispatching/BehaviorGuardEvaluatorRegistryTest.java @@ -15,37 +15,24 @@ */ package io.sarl.util.tests.eventdispatching; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; -import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.UUID; -import java.util.concurrent.CopyOnWriteArraySet; import javax.inject.Inject; -import com.google.common.base.MoreObjects; import com.google.common.collect.Collections2; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.common.collect.Multimap; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import org.mockito.Mock; -import org.mockito.Mockito; import io.sarl.eventdispatching.BehaviorGuardEvaluator; import io.sarl.eventdispatching.BehaviorGuardEvaluatorRegistry; import io.sarl.lang.annotation.PerceptGuardEvaluator; import io.sarl.lang.core.Agent; -import io.sarl.lang.core.BuiltinCapacitiesProvider; import io.sarl.lang.core.Event; import io.sarl.tests.api.AbstractSarlTest; import io.sarl.tests.api.Nullable;