Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Testing content assist(Is there a tutorial or some code example ?)
Testing content assist [message #705706] Sat, 30 July 2011 07:51 Go to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
I am trying to understand how to implement JUnit testing for Content Assist of my DSL.

I tried to pull the string starting with xtext.ui.junit.editor.contentassist.AbstractContentAssistProcessorTest but life would be easier if I could get some documentation and/or code examples. Is there something available ?

Thanks for help
MS
Re: Testing content assist [message #705717 is a reply to message #705706] Sat, 30 July 2011 08:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the is not much to tutorialize

package test;

import org.eclipse.xtext.ISetup;
import org.eclipse.xtext.ui.junit.editor.contentassist.AbstractContentAssistProcessorTest;
import org.xtext.example.mydsl.MyDslUiInjectorProvider;

import com.google.inject.Injector;

public class CATest extends AbstractContentAssistProcessorTest {
	
	public void testSomething() throws Exception {
		newBuilder(getSetup())
		.assertText("Hello")
		.append("Hello")
		.append(" ")
		.assertText("Name")
		.append("Michel")
		.append(" ")
		.assertText("!")
		.append("!");
	}
	
	private ISetup getSetup() {
		return new ISetup() {
			
			@Override
			public Injector createInjectorAndDoEMFRegistration() {
				return new MyDslUiInjectorProvider().getInjector();
			}
		};
	}

}


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Testing content assist [message #705748 is a reply to message #705717] Sat, 30 July 2011 09:30 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Thank you Christian for the quick reaction. I'll try to find my way and come back if I get stuck!

MS
Re: Testing content assist [message #714831 is a reply to message #705748] Thu, 11 August 2011 15:10 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Hi Christian,

It is only now that I tried to run your code as a JUnit test on a newly created Mydsl project. I get the following error:
java.lang.NullPointerException
at org.xtext.example.mydsl.MyDslUiInjectorProvider.getInjector(MyDslUiInjectorProvider.java:13)
at test.CATest$1.createInjectorAndDoEMFRegistration(CATest.java:28)
at org.eclipse.xtext.junit.AbstractXtextTests.with(AbstractXtextTests.java:109)
at org.eclipse.xtext.ui.junit.editor.contentassist.AbstractContentAssistProcessorTest.newBuilder(AbstractContentAssistProcessorTest.java:23)
at test.CATest.testSomething(CATest.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

I must have missed something. Please help !
Thanks
MS
Re: Testing content assist [message #714855 is a reply to message #714831] Thu, 11 August 2011 15:48 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Michel,

please make sure that you execute your tests as plugin tests.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 11.08.11 17:10, Michel Simeon wrote:
> Hi Christian,
>
> It is only now that I tried to run your code as a JUnit test on a newly
> created Mydsl project. I get the following error:
> java.lang.NullPointerException
> at
> org.xtext.example.mydsl.MyDslUiInjectorProvider.getInjector(MyDslUiInjectorProvider.java:13)
>
> at test.CATest$1.createInjectorAndDoEMFRegistration(CATest.java:28)
> at
> org.eclipse.xtext.junit.AbstractXtextTests.with(AbstractXtextTests.java:109)
>
> at
> org.eclipse.xtext.ui.junit.editor.contentassist.AbstractContentAssistProcessorTest.newBuilder(AbstractContentAssistProcessorTest.java:23)
>
> at test.CATest.testSomething(CATest.java:12)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:243)
> at junit.framework.TestSuite.run(TestSuite.java:238)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
> I must have missed something. Please help !
> Thanks
> MS
Re: Testing content assist [message #714894 is a reply to message #714855] Thu, 11 August 2011 17:14 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Thanks. It does run indeed if I specify Run as JUnit Plug-in test. But it takes quite a long time !
And it gives strange messages on the console, as follows:

!SESSION 2011-08-11 19:02:22.697 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -version 3 -port 65423 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames test.CATest -application org.eclipse.pde.junit.runtime.uitestapplication -product org.eclipse.sdk.ide -testpluginname org.xtext.example.mydsl.tests
Command-line arguments: -os win32 -ws win32 -arch x86 -consoleLog -version 3 -port 65423 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames test.CATest -application org.eclipse.pde.junit.runtime.uitestapplication -product org.eclipse.sdk.ide -data C:\Users\msimeon\workspaceIndigo/../junit-workspace -dev file:C:/Users/msimeon/workspaceIndigo/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -testpluginname org.xtext.example.mydsl.tests

!ENTRY org.eclipse.osgi 2 0 2011-08-11 19:02:27.807
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.807
!MESSAGE Bundle org.eclipse.core.filesystem.aix.ppc_1.1.0.v20110423-0524 [90] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.aix.ppc 2 0 2011-08-11 19:02:27.807
!MESSAGE Platform filter did not match: (& (osgi.os=aix) (osgi.arch=ppc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.808
!MESSAGE Bundle org.eclipse.core.filesystem.hpux.ia64_32_1.0.100.v20110423-0524 [91] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.hpux.ia64_32 2 0 2011-08-11 19:02:27.808
!MESSAGE Platform filter did not match: (& (osgi.os=hpux) (osgi.arch=ia64_32))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.808
!MESSAGE Bundle org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524 [92] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.linux.x86 2 0 2011-08-11 19:02:27.809
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.809
!MESSAGE Bundle org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524 [93] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.linux.x86_64 2 0 2011-08-11 19:02:27.809
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.809
!MESSAGE Bundle org.eclipse.core.filesystem.macosx_1.3.0.v20110423-0524 [94] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.macosx 2 0 2011-08-11 19:02:27.810
!MESSAGE Platform filter did not match: (& (osgi.os=macosx) (|(osgi.arch=x86) (osgi.arch=ppc) (osgi.arch=x86_64)))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.810
!MESSAGE Bundle org.eclipse.core.filesystem.solaris.sparc_1.2.0.v20110423-0524 [95] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.solaris.sparc 2 0 2011-08-11 19:02:27.810
!MESSAGE Platform filter did not match: (& (osgi.os=solaris) (osgi.arch=sparc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.811
!MESSAGE Bundle org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524 [97] was not resolved.
!SUBENTRY 2 org.eclipse.core.filesystem.win32.x86_64 2 0 2011-08-11 19:02:27.811
!MESSAGE Platform filter did not match: (& (osgi.os=win32) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.811
!MESSAGE Bundle org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800 [100] was not resolved.
!SUBENTRY 2 org.eclipse.core.net.linux.x86 2 0 2011-08-11 19:02:27.812
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.812
!MESSAGE Bundle org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827 [101] was not resolved.
!SUBENTRY 2 org.eclipse.core.net.linux.x86_64 2 0 2011-08-11 19:02:27.812
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.813
!MESSAGE Bundle org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827 [103] was not resolved.
!SUBENTRY 2 org.eclipse.core.net.win32.x86_64 2 0 2011-08-11 19:02:27.813
!MESSAGE Platform filter did not match: (& (osgi.os=win32) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.813
!MESSAGE Bundle org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502 [211] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.carbon.macosx 2 0 2011-08-11 19:02:27.814
!MESSAGE Platform filter did not match: (& (osgi.ws=carbon) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.814
!MESSAGE Bundle org.eclipse.equinox.launcher.cocoa.macosx_1.1.100.v20110502 [212] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.cocoa.macosx 2 0 2011-08-11 19:02:27.814
!MESSAGE Platform filter did not match: (& (osgi.ws=cocoa) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.814
!MESSAGE Bundle org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502 [213] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.cocoa.macosx.x86_64 2 0 2011-08-11 19:02:27.815
!MESSAGE Platform filter did not match: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.815
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530 [214] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.aix.ppc 2 0 2011-08-11 19:02:27.815
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.816
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530 [215] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.aix.ppc64 2 0 2011-08-11 19:02:27.816
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.816
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502 [216] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.hpux.ia64_32 2 0 2011-08-11 19:02:27.816
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=hpux) (osgi.arch=ia64_32))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.817
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505 [217] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.linux.ppc64 2 0 2011-08-11 19:02:27.817
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=ppc64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.817
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505 [218] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.linux.s390 2 0 2011-08-11 19:02:27.818
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s390))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.818
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505 [219] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.linux.s390x 2 0 2011-08-11 19:02:27.818
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s390x))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.819
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505 [220] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.linux.x86 2 0 2011-08-11 19:02:27.819
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.819
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505 [221] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.linux.x86_64 2 0 2011-08-11 19:02:27.819
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.820
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505 [222] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.solaris.sparc 2 0 2011-08-11 19:02:27.821
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=sparc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.821
!MESSAGE Bundle org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505 [223] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.gtk.solaris.x86 2 0 2011-08-11 19:02:27.821
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.821
!MESSAGE Bundle org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502 [225] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.launcher.win32.win32.x86_64 2 0 2011-08-11 19:02:27.822
!MESSAGE Platform filter did not match: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.822
!MESSAGE Bundle org.eclipse.equinox.security.macosx_1.100.100.v20100503 [260] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.security.macosx 2 0 2011-08-11 19:02:27.822
!MESSAGE Platform filter did not match: (& (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=x86_64)(osgi.arch=ppc)) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.823
!MESSAGE Bundle org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502 [263] was not resolved.
!SUBENTRY 2 org.eclipse.equinox.security.win32.x86_64 2 0 2011-08-11 19:02:27.823
!MESSAGE Platform filter did not match: (& (osgi.os=win32) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.823
!MESSAGE Bundle org.eclipse.jdt.launching.macosx_3.2.100.v20110509 [291] was not resolved.
!SUBENTRY 2 org.eclipse.jdt.launching.macosx 2 0 2011-08-11 19:02:27.824
!MESSAGE Platform filter did not match: (osgi.os=macosx)
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.824
!MESSAGE Bundle org.eclipse.jdt.launching.ui.macosx_1.0.100.v20110509 [292] was not resolved.
!SUBENTRY 2 org.eclipse.jdt.launching.ui.macosx 2 0 2011-08-11 19:02:27.824
!MESSAGE Platform filter did not match: (osgi.os=macosx)
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.824
!MESSAGE Bundle org.eclipse.swt.carbon.macosx_3.7.0.v3735b [357] was not resolved.
!SUBENTRY 2 org.eclipse.swt.carbon.macosx 2 0 2011-08-11 19:02:27.825
!MESSAGE Platform filter did not match: (& (osgi.ws=carbon) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.825
!MESSAGE Bundle org.eclipse.swt.cocoa.macosx_3.7.0.v3735b [358] was not resolved.
!SUBENTRY 2 org.eclipse.swt.cocoa.macosx 2 0 2011-08-11 19:02:27.825
!MESSAGE Platform filter did not match: (& (osgi.ws=cocoa) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.826
!MESSAGE Bundle org.eclipse.swt.cocoa.macosx.x86_64_3.7.0.v3735b [359] was not resolved.
!SUBENTRY 2 org.eclipse.swt.cocoa.macosx.x86_64 2 0 2011-08-11 19:02:27.826
!MESSAGE Platform filter did not match: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.826
!MESSAGE Bundle org.eclipse.swt.gtk.aix.ppc_3.7.0.v3735b [360] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.aix.ppc 2 0 2011-08-11 19:02:27.826
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.827
!MESSAGE Bundle org.eclipse.swt.gtk.aix.ppc64_3.7.0.v3735b [361] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.aix.ppc64 2 0 2011-08-11 19:02:27.827
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.827
!MESSAGE Bundle org.eclipse.swt.gtk.hpux.ia64_32_3.7.0.v3735b [362] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.hpux.ia64_32 2 0 2011-08-11 19:02:27.827
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=hpux) (osgi.arch=ia64_32))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.828
!MESSAGE Bundle org.eclipse.swt.gtk.linux.ppc64_3.7.0.v3735b [363] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.linux.ppc64 2 0 2011-08-11 19:02:27.828
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=ppc64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.828
!MESSAGE Bundle org.eclipse.swt.gtk.linux.s390_3.7.0.v3735b [364] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.linux.s390 2 0 2011-08-11 19:02:27.829
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s390))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.829
!MESSAGE Bundle org.eclipse.swt.gtk.linux.s390x_3.7.0.v3735b [365] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.linux.s390x 2 0 2011-08-11 19:02:27.829
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s390x))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.829
!MESSAGE Bundle org.eclipse.swt.gtk.linux.x86_3.7.0.v3735b [366] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.linux.x86 2 0 2011-08-11 19:02:27.830
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.830
!MESSAGE Bundle org.eclipse.swt.gtk.linux.x86_64_3.7.0.v3735b [367] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.linux.x86_64 2 0 2011-08-11 19:02:27.830
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.831
!MESSAGE Bundle org.eclipse.swt.gtk.solaris.sparc_3.7.0.v3735b [368] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.solaris.sparc 2 0 2011-08-11 19:02:27.835
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=sparc))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.835
!MESSAGE Bundle org.eclipse.swt.gtk.solaris.x86_3.7.0.v3735b [369] was not resolved.
!SUBENTRY 2 org.eclipse.swt.gtk.solaris.x86 2 0 2011-08-11 19:02:27.836
!MESSAGE Platform filter did not match: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch=x86))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.836
!MESSAGE Bundle org.eclipse.swt.win32.win32.x86_64_3.7.0.v3735b [371] was not resolved.
!SUBENTRY 2 org.eclipse.swt.win32.win32.x86_64 2 0 2011-08-11 19:02:27.837
!MESSAGE Platform filter did not match: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86_64))
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.837
!MESSAGE Bundle org.eclipse.ui.carbon_4.0.100.I20101109-0800 [390] was not resolved.
!SUBENTRY 2 org.eclipse.ui.carbon 2 0 2011-08-11 19:02:27.838
!MESSAGE Platform filter did not match: (osgi.ws=carbon)
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.839
!MESSAGE Bundle org.eclipse.ui.cocoa_1.1.0.I20101109-0800 [392] was not resolved.
!SUBENTRY 2 org.eclipse.ui.cocoa 2 0 2011-08-11 19:02:27.846
!MESSAGE Platform filter did not match: (osgi.ws=cocoa)
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-08-11 19:02:27.846
!MESSAGE Bundle org.eclipse.update.core.linux_3.2.200.v20100512 [419] was not resolved.
!SUBENTRY 2 org.eclipse.update.core.linux 2 0 2011-08-11 19:02:27.846
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86))

!ENTRY org.eclipse.jface 2 0 2011-08-11 19:02:54.146
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-11 19:02:54.146
!MESSAGE A conflict occurred for ALT+CTRL+I:
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Ignore,Ignore,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
org.eclipse.egit.ui.internal.actions.IgnoreActionHandler,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.AddToSVNIgnoreCommand,Add to svn:ignore...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-11 19:02:54.147
!MESSAGE A conflict occurred for ALT+CTRL+C:
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Commit,Commit,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.CommitCommand,Commit...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)

What should I do about it ?

More broadly, could you give me some pointers on how to test the following kind of situation:
- at a given point, CA gives me the choice between various user-defined templates, templates that might include cross-references or enum lists.
- I'd like to test not only the template but also the enum list or the cross-reference list of IDs
Thanks for your help
MS
Re: Testing content assist [message #716792 is a reply to message #714894] Thu, 18 August 2011 13:36 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Following the previous exhanges, I just did the following:

- I updated XText to the latest (nightly) 2.0.1 version using the recently announced composite update site

- I created a new workspace

- I created a new default XText project (MyDsl), I created a CATest.java file by copying the code provided by Christian earlier, and run it as a JUnit plug-in test. This is what I get:
In the console:
!ENTRY org.eclipse.jface 2 0 2011-08-18 15:29:24.745
!MESSAGE Keybinding conflicts occurred. They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-18 15:29:24.745
!MESSAGE A conflict occurred for ALT+CTRL+I:
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Ignore,Ignore,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
org.eclipse.egit.ui.internal.actions.IgnoreActionHandler,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.AddToSVNIgnoreCommand,Add to svn:ignore...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-18 15:29:24.745
!MESSAGE A conflict occurred for ALT+CTRL+C:
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Commit,Commit,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.CommitCommand,Commit...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)

In the JUnit view:

java.lang.Exception: No runnable methods
at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:177)
at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:122)
at org.junit.runners.ParentRunner.validate(ParentRunner.java:269)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:66)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:58)
at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:13)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

=================

Then I have an additional problem:

I installed the Domainmodel example and created a similar CATest file (where MyDslUiInjectorProvider is replaced by DomainmodelUiInjectorProvider but the rest is identical.

I get and error in getSetup() that goes away when I drop the @Override annotation.

I do not understand why there is this difference in behavior !

Help most welcome, as usual !
MS

Re: Testing content assist [message #716930 is a reply to message #716792] Thu, 18 August 2011 19:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

regarding the exception a simple @Test to the textXXX method should
make the class Junit 4 enabled.
regarding your other problem. this is a Java 5 (execution envirionment
of the domain example) vs java 6 (execution envirionment of the mydsl
created by the wizard) problem

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Testing content assist [message #716947 is a reply to message #716930] Thu, 18 August 2011 21:17 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Hi Christian.

Many thanks for the tips.

I did add:
import org.junit.Test;
...
@Test
public void testSomething() throws Exception {
super.setUp();
...

Now the test runs ...

The console still gives messages and I do not really understand what is going on :
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-18 23:14:17.919
!MESSAGE A conflict occurred for ALT+CTRL+I:
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Ignore,Ignore,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
org.eclipse.egit.ui.internal.actions.IgnoreActionHandler,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+I,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.AddToSVNIgnoreCommand,Add to svn:ignore...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2011-08-18 23:14:17.919
!MESSAGE A conflict occurred for ALT+CTRL+C:
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.egit.ui.team.Commit,Commit,
,
Category(org.eclipse.egit.ui.commandCategory,Git,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
Binding(ALT+CTRL+C,
ParameterizedCommand(Command(org.eclipse.team.svn.ui.command.CommitCommand,Commit...,
,
Category(org.eclipse.team.svn.ui.command.category,SVN,null,true),
,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
org.eclipse.ui.contexts.window,,,system)
log4j:WARN No appenders could be found for logger (org.eclipse.xtext.ui.internal.Activator).
log4j:WARN Please initialize the log4j system properly.



Thanks again

MS
Re: Testing content assist [message #716950 is a reply to message #716947] Thu, 18 August 2011 21:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Don't care about the message: you have plugins installed with conflicting keybindings.
Thats all.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Testing content assist [message #716954 is a reply to message #716950] Thu, 18 August 2011 21:32 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Fine then ... Thanks again

Michel
Re: Testing content assist [message #726018 is a reply to message #716954] Fri, 16 September 2011 12:30 Go to previous messageGo to next message
Eszter Hofmann is currently offline Eszter HofmannFriend
Messages: 16
Registered: July 2011
Junior Member
Hi guys,

I am also trying to execute a content assist test inspired by your sample code, but I am getting the following exception:

com.google.inject.ConfigurationException: Guice configuration errors:

1) No implementation for org.eclipse.xtext.parser.antlr.Lexer annotated with @com.google.inject.name.Named(value=org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Lexer.HIGHLIGHTING) was bound.
while locating com.google.inject.Provider<org.eclipse.xtext.parser.antlr.Lexer> annotated with @com.google.inject.name.Named(value=org.eclipse.xtext.ui.editor.contentassist.antlr.internal.Lexer.HIGHLIGHTING)
for field at org.eclipse.xtext.ui.editor.model.DocumentTokenSource.lexer(DocumentTokenSource.java:176)
while locating org.eclipse.xtext.ui.editor.model.DocumentTokenSource
for parameter 0 at org.eclipse.xtext.ui.editor.model.XtextDocument.<init>(XtextDocument.java:53)
while locating org.eclipse.xtext.ui.editor.model.XtextDocument

1 error
at com.google.inject.InjectorImpl.getProvider(InjectorImpl.java:784)
at com.google.inject.InjectorImpl.getProvider(InjectorImpl.java:743)
at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:793)
at org.eclipse.xtext.ui.junit.editor.contentassist.ContentAssistProcessorTestBuilder.get(ContentAssistProcessorTestBuilder.java:332)
at org.eclipse.xtext.ui.junit.editor.contentassist.ContentAssistProcessorTestBuilder.getDocument(ContentAssistProcessorTestBuilder.java:290)
at org.eclipse.xtext.ui.junit.editor.contentassist.ContentAssistProcessorTestBuilder.computeCompletionProposals(ContentAssistProcessorTestBuilder.java:249)
at org.eclipse.xtext.ui.junit.editor.contentassist.ContentAssistProcessorTestBuilder.assertTextAtCursorPosition(ContentAssistProcessorTestBuilder.java:149)
at org.eclipse.xtext.ui.junit.editor.contentassist.ContentAssistProcessorTestBuilder.assertText(ContentAssistProcessorTestBuilder.java:131)
at com.fabasoft.ducx.dsl.xp.ui.contentassist.CATtest.testSomething(CATtest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:54)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:48)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


I guess my Setup is not correct, I am doing it the following way:

  
private ISetup getSetup() {
    try {
      super.setUp();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
      return new ISetup() {
      
      @Override
      public Injector createInjectorAndDoEMFRegistration() {
        return new MyDslStandaloneSetup().createInjectorAndDoEMFRegistration();
      }
    };
  }


I am using MyDslStandaloneSetup sice I didn't find any class with similar name as "MyDslUiInjectorProvider". Do I need to implement my own class? If yes, how should I implement it?

Another question: The file on which the content assist is tested must be part of a project. How should I proceed? I can still imagine to create or import a project in the setUp() but how can I tell to use this project as context?

Thanks,
Eszter
Re: Testing content assist [message #726039 is a reply to message #726018] Fri, 16 September 2011 13:07 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Hi Eszter,

Regarding your first point, your "MyDslUiInjectorProvider" should be part of a .../mydsl/tests project that should have been generated automatically if you created your project with the latest version of XText. If this is not the case you could try to recreate a project from scratch (i.e. using your xtext grammar), or try to just create the missing class. Mine is as follows (Mads is the name of my language):

package fr.msimeon.mads;

import org.eclipse.xtext.junit4.IInjectorProvider;
import com.google.inject.Injector;

public class MadsUiInjectorProvider implements IInjectorProvider {
public Injector getInjector() {
return fr.msimeon.mads.ui.internal.MadsActivator.getInstance().getInjector("fr.msimeon.mads.Mads");
}
}

On the second point: you can build your model file step by step, and a any point test CA content with assertText, as follows:


package CATests;

import org.eclipse.xtext.ISetup;
import org.eclipse.xtext.ui.junit.editor.contentassist.AbstractContentAssistProcessorTest;
import fr.msimeon.mads.MadsUiInjectorProvider;
import com.google.inject.Injector;
import org.junit.Test;

@SuppressWarnings("all")

// Testing content assist (CA) - run as JUnit Plug-in Test

public class CATest_Headers extends AbstractContentAssistProcessorTest {

@Test
public void testHeaders() throws Exception {
super.setUp();
newBuilder(SetUp.getSetup())
.assertText( "\"countryName\"",
"-Headers in English - template for header data", "-Headers in French - template for header data",
"Country Name", "Nom du pays")
.append("Country Name")
.append(" ")
.assertText("=")
.append("=")
.append(" ")
.assertText("\"countryName\"")
.append("Mali")
.append(" ")
.append(";")
.append("\n ")
.assertText("\"projectName\"", "Project Name", "Nom du projet")
.append("Project Name")
.append(" = ")
.assertText("\"projectName\"")
.append("Project CA Test")
.append(" ")
.append(" ; ")
..............
.append("end")
.append(" ")
.assertText("model")
.append("model")
.appendNl(" ")
;
}
}

The setup file:

package CATests;

import org.eclipse.xtext.ISetup;
import com.google.inject.Injector;
import fr.msimeon.mads.MadsUiInjectorProvider;

class SetUp {

static ISetup getSetup() throws Exception {
return new ISetup() {
@Override
public Injector createInjectorAndDoEMFRegistration() {
return new MadsUiInjectorProvider().getInjector();
}
};
}
}

Hope this helps
MS
Re: Testing content assist [message #726660 is a reply to message #726039] Mon, 19 September 2011 08:04 Go to previous messageGo to next message
Eszter Hofmann is currently offline Eszter HofmannFriend
Messages: 16
Registered: July 2011
Junior Member
Hi,

thank you for the quick answear. Problem 1 is solved!
Regarding my second question I try to describe it in more detail:
In my language I can import the content of a set of other files and my completion proposals depend from this imported content. So in order to be able to test the completion proposals, I need to set the location of these files. But all this depends from my implementation so I need to figure out by myself how to do the whole thing Smile

Eszter
Re: Testing content assist [message #726662 is a reply to message #726660] Mon, 19 September 2011 08:18 Go to previous messageGo to next message
Michel Simeon is currently offline Michel SimeonFriend
Messages: 130
Registered: December 2009
Senior Member
Eszter,

I never tried to test CA across several files. If and when you find out please post the answers for the benefit of others.

An other area where I am myself short on answers is testing templates with cross-references.

Cheers
MS
Re: Testing content assist [message #726667 is a reply to message #726660] Mon, 19 September 2011 08:26 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi, the content assist class does not support this out of the box but
it is easy to reach it anyway: create the project and the files with
eclipse resource means (dont forget the Xtext nature) and patch the
test class regarding the URI so that the test model is created within
the project. Regards Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:problem with content assist
Next Topic:The generated @Inject constructor in the label provider
Goto Forum:
  


Current Time: Thu Apr 25 01:45:13 GMT 2024

Powered by FUDForum. Page generated in 0.05027 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top