Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.3.0M7] org.hamcrest in the test plugin
[Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871416] Sun, 13 May 2012 14:55 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I noted that re-running the workflow for a language with Xtext 2.3 M7
org.hamcrest is added to the tests plugin as an imported package... but
is it used somewhere?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871423 is a reply to message #871416] Sun, 13 May 2012 15:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i guess this dep is redunant since junit4 already requires the bundle org.hamcrest.core. (so dont care)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871456 is a reply to message #871423] Sun, 13 May 2012 20:35 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 13.05.12 17:42, schrieb Christian Dietrich:
> Hi,
>
> i guess this dep is redunant since junit4 already requires the bundle
> org.hamcrest.core. (so dont care)
>
> ~Christian

It's a PDE thing. Transitive package imports are not properly resolved
if you launch a test as a plain JUnit test thus you have to import
harmcrest explicitly.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871458 is a reply to message #871456] Sun, 13 May 2012 21:06 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/13/2012 10:35 PM, Sebastian Zarnekow wrote:
> Am 13.05.12 17:42, schrieb Christian Dietrich:
>> Hi,
>>
>> i guess this dep is redunant since junit4 already requires the bundle
>> org.hamcrest.core. (so dont care)
>>
>> ~Christian
>
> It's a PDE thing. Transitive package imports are not properly resolved
> if you launch a test as a plain JUnit test thus you have to import
> harmcrest explicitly.
>

but who is using harmcrest internally? I'm asking because by removing
that import the tests run anyway...

if those imports are left in the MANIFEST, then building with tycho
complains about not being able to resolve them...

I managed to build the test plugin (importing harmcrest) with tycho only
by adding swtbot (which I know provides harmcrest) in the p2 repositories...

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871462 is a reply to message #871458] Sun, 13 May 2012 21:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

there are some assertions within junit that use it.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871501 is a reply to message #871462] Mon, 14 May 2012 09:11 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/13/2012 11:53 PM, Christian Dietrich wrote:
> Hi,
>
> there are some assertions within junit that use it.
>
> ~Christian

but then who provides org.hamcrest? I'm asking because, as I said in my
previous post, if I don't include the swtbot update site (which I'm not
using in my DSL) tycho fails to resolve and install org.hamcrest...

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871504 is a reply to message #871501] Mon, 14 May 2012 09:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi isn't the package contained in the org.hamcrest.core plugin?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871506 is a reply to message #871504] Mon, 14 May 2012 09:37 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/14/2012 11:25 AM, Christian Dietrich wrote:
> Hi isn't the package contained in the org.hamcrest.core plugin?

Hi

actually I meant: which p2 repository/update site provides that plugin
(besides swtbot)?

Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871508 is a reply to message #871506] Mon, 14 May 2012 09:41 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 14.05.12 11:37, schrieb Lorenzo Bettini:
> On 05/14/2012 11:25 AM, Christian Dietrich wrote:
>> Hi isn't the package contained in the org.hamcrest.core plugin?
>
> Hi
>
> actually I meant: which p2 repository/update site provides that plugin
> (besides swtbot)?
>
> Lorenzo
>

It should be available from the orbit update site.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871519 is a reply to message #871508] Mon, 14 May 2012 10:09 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/14/2012 11:41 AM, Sebastian Zarnekow wrote:
> Am 14.05.12 11:37, schrieb Lorenzo Bettini:
>> On 05/14/2012 11:25 AM, Christian Dietrich wrote:
>>> Hi isn't the package contained in the org.hamcrest.core plugin?
>>
>> Hi
>>
>> actually I meant: which p2 repository/update site provides that plugin
>> (besides swtbot)?
>>
>> Lorenzo
>>
>
> It should be available from the orbit update site.
>

thus it is not available from the eclipse update site, nor from the
xtext update site?

Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #871532 is a reply to message #871519] Mon, 14 May 2012 10:56 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Lorenzo,

the orbit repo is hosted at Eclipse:

http://download.eclipse.org/tools/orbit/downloads/

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

Am 14.05.12 12:09, schrieb Lorenzo Bettini:
> On 05/14/2012 11:41 AM, Sebastian Zarnekow wrote:
>> Am 14.05.12 11:37, schrieb Lorenzo Bettini:
>>> On 05/14/2012 11:25 AM, Christian Dietrich wrote:
>>>> Hi isn't the package contained in the org.hamcrest.core plugin?
>>>
>>> Hi
>>>
>>> actually I meant: which p2 repository/update site provides that plugin
>>> (besides swtbot)?
>>>
>>> Lorenzo
>>>
>>
>> It should be available from the orbit update site.
>>
>
> thus it is not available from the eclipse update site, nor from the
> xtext update site?
>
> Lorenzo
>
>
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #873004 is a reply to message #871458] Thu, 17 May 2012 09:41 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I managed to solve the problem of building with tycho in the presence of
the generated dependencies on org.hamcrest as follows:

- in the tycho pom file I add this repository (so there's no need of
using the swtbot repository):

<repository>
<id>orbit</id>
<layout>p2</layout>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/</url>
</repository>

- this however is not enough... I don't know whether it is a tycho
thing, but it cannot resolve org.hamcrest (and download it) if it is
just an imported package: I have to add org.hamcrest as a required
bundle in the MANIFEST.MF, thus

Require-Bundle: ...
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3",
org.hamcrest <---------- MANUALLY ADDED
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.junit;version="4.5.0",
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,
org.hamcrest.core

is this a bug? would it do harm to generate in the MANIFEST.MF of the
test plugin also org.hamcrest as required bundle (besides as an imported
package)?

cheers
Lorenzo

On 05/13/2012 11:06 PM, Lorenzo Bettini wrote:
> On 05/13/2012 10:35 PM, Sebastian Zarnekow wrote:
>> Am 13.05.12 17:42, schrieb Christian Dietrich:
>>> Hi,
>>>
>>> i guess this dep is redunant since junit4 already requires the bundle
>>> org.hamcrest.core. (so dont care)
>>>
>>> ~Christian
>>
>> It's a PDE thing. Transitive package imports are not properly resolved
>> if you launch a test as a plain JUnit test thus you have to import
>> harmcrest explicitly.
>>
>
> but who is using harmcrest internally? I'm asking because by removing
> that import the tests run anyway...
>
> if those imports are left in the MANIFEST, then building with tycho
> complains about not being able to resolve them...
>
> I managed to build the test plugin (importing harmcrest) with tycho only
> by adding swtbot (which I know provides harmcrest) in the p2
> repositories...
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #873450 is a reply to message #873004] Fri, 18 May 2012 09:03 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

I think we fixed an issue in the unit test generator fragment that added
the package import for org.harmcrest by accident. Only
org.harmcrest.core is requrired (or the other way round - anyway, only
one of both imports was valid where the other one cause issues). Could
you please try with the latest nightlies?

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

Am 17.05.12 11:41, schrieb Lorenzo Bettini:
> Hi
>
> I managed to solve the problem of building with tycho in the presence of
> the generated dependencies on org.hamcrest as follows:
>
> - in the tycho pom file I add this repository (so there's no need of
> using the swtbot repository):
>
> <repository>
> <id>orbit</id>
> <layout>p2</layout>
> <url>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/</url>
>
> </repository>
>
> - this however is not enough... I don't know whether it is a tycho
> thing, but it cannot resolve org.hamcrest (and download it) if it is
> just an imported package: I have to add org.hamcrest as a required
> bundle in the MANIFEST.MF, thus
>
> Require-Bundle: ...
> org.eclipse.core.runtime,
> org.eclipse.xtext.junit4,
> org.junit4,
> org.eclipse.ui.workbench;resolution:=optional,
> org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
> org.eclipse.xtext.xbase;bundle-version="2.3.0",
> org.eclipse.jdt.core;bundle-version="3.7.3",
> org.hamcrest <---------- MANUALLY ADDED
> Import-Package: org.apache.commons.logging,
> org.apache.log4j,
> org.junit;version="4.5.0",
> 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,
> org.hamcrest.core
>
> is this a bug? would it do harm to generate in the MANIFEST.MF of the
> test plugin also org.hamcrest as required bundle (besides as an imported
> package)?
>
> cheers
> Lorenzo
>
> On 05/13/2012 11:06 PM, Lorenzo Bettini wrote:
>> On 05/13/2012 10:35 PM, Sebastian Zarnekow wrote:
>>> Am 13.05.12 17:42, schrieb Christian Dietrich:
>>>> Hi,
>>>>
>>>> i guess this dep is redunant since junit4 already requires the bundle
>>>> org.hamcrest.core. (so dont care)
>>>>
>>>> ~Christian
>>>
>>> It's a PDE thing. Transitive package imports are not properly resolved
>>> if you launch a test as a plain JUnit test thus you have to import
>>> harmcrest explicitly.
>>>
>>
>> but who is using harmcrest internally? I'm asking because by removing
>> that import the tests run anyway...
>>
>> if those imports are left in the MANIFEST, then building with tycho
>> complains about not being able to resolve them...
>>
>> I managed to build the test plugin (importing harmcrest) with tycho only
>> by adding swtbot (which I know provides harmcrest) in the p2
>> repositories...
>>
>
>
Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874238 is a reply to message #873450] Sun, 20 May 2012 08:32 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> I think we fixed an issue in the unit test generator fragment that added
> the package import for org.harmcrest by accident. Only
> org.harmcrest.core is requrired (or the other way round - anyway, only
> one of both imports was valid where the other one cause issues). Could
> you please try with the latest nightlies?

Hi Sebastian

I tried

http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/

i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the test
plugin, which shows the same problem (which, again, can be fixed by
adding org.hamcrest as a Require-Bundle and not just Import-Package):

Require-Bundle: org.xtext.example.mydsl,
org.xtext.example.mydsl.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3"
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.junit;version="4.5.0",
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,
org.hamcrest.core

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874626 is a reply to message #874238] Mon, 21 May 2012 09:18 Go to previous messageGo to next message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
Registered: July 2009
Senior Member

Lorenzo Bettini wrote on Sun, 20 May 2012 10:32
On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
I tried

http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/

i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the test
plugin, which shows the same problem (which, again, can be fixed by
adding org.hamcrest as a Require-Bundle and not just Import-Package):


Hi Lorenzo,
this bug was fixed on 15.05, so your version v20120519 contains the fix already, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=379521
I've tried both wizard and generator with the most recent version 2.3.0.v201205201426 and all works as expected. Only the org.hamcrest.core package import is generated.

Best regards,
Dennis.

P.S.: You can't import org.hamcrest package because it's hidden/protected, see the bug report for more information.



+Dennis Huebner

Get professional support from the Xtext committers at www.typefox.io

[Updated on: Mon, 21 May 2012 09:19]

Report message to a moderator

Re: [Xtext 2.3.0M7] org.hamcrest in the test plugin [message #874777 is a reply to message #874626] Mon, 21 May 2012 14:23 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 05/21/2012 11:18 AM, Dennis Huebner wrote:
> Lorenzo Bettini wrote on Sun, 20 May 2012 10:32
>> On 05/18/2012 11:03 AM, Sebastian Zarnekow wrote:
>> I tried
>>
>> http://download.eclipse.org/modeling/tmf/xtext/updates/composite/latest/
>>
>> i.e., 2.3.0.v201205191342 and I still get this MANIFEST.MF for the
>> test plugin, which shows the same problem (which, again, can be fixed
>> by adding org.hamcrest as a Require-Bundle and not just Import-Package):
>
>
> Hi Lorenzo,
> this bug was fixed on 15.05, so your version v20120519 contains the fix
> already, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=379521
> I've tried both wizard and generator with the most recent version
> 2.3.0.v201205201426 and all works as expected. Only the
> org.hamcrest.core package import is generated.
>
> Best regards,
> Dennis.
>

Hi Dennis

sorry I hadn't realized my workspace was using a target platform based
on xtext 2.3.0M7 so I wasn't actually using the latest generator :)

with the current 2.3.0.v201205210926 the generated MANIFEST.MF for the
test plugin is

Require-Bundle: org.xtext.example.mydsl,
org.xtext.example.mydsl.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.junit4,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.xbase.junit;bundle-version="2.3.0",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.jdt.core;bundle-version="3.7.3"
Import-Package: org.apache.commons.logging,
org.apache.log4j,
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

which keeps Tycho happy :)

thanks
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:higher-level access to model
Next Topic:First steps with 2.3
Goto Forum:
  


Current Time: Thu Mar 28 09:55:34 GMT 2024

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

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

Back to the top