Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] example of tests for m2e plugin based on BuildContext

The tests expect to be run inside an Eclipse instance.  For examples you could look at the tests in m2e source, or one of the connectors in m2e-extras ( https://github.com/sonatype/m2eclipse-extras/ ).

On 16 October 2012 15:52, Steven Bethard <steven.bethard@xxxxxxxxxxxx> wrote:
On Oct 16, 2012, at 1:08 PM, Matthew Piggott <mpiggott@xxxxxxxxxxxx> wrote:
> No, I thought you were looking for source; it appears snapshots are published on http://repository.sonatype.org I'm not sure if releases are published anywhere other than as p2 update sites.

Thanks. I just tried using the snapshots in http://repository.sonatype.org/content/groups/sonatype-public-grid and that gets everything to compile.

But I guess it's not as easy as just copying over the m2e-connector tests, since they fail:

java.lang.IllegalStateException: Workspace is closed.
        at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:367)
        at org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase.setUp(AbstractMavenProjectTestCase.java:100)
        at junit.framework.TestCase.runBare(TestCase.java:132)
        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)

Presumably this is because AbstractMavenProjectTestCase is intended to be launched by Tycho, no by `mvn test`.

Well, I'm not married to the AbstractMavenProjectTestCase infrastructure. I just want some way to test things like:

* I modified a grammar file in Eclipse. Did the code generation run? (It should have.)
* I modified an unrelated Java file in Eclipse. Did the code generation run? (It shouldn't have.)

Any ideas of how to do this?

Steve

>
> On 16 October 2012 15:02, Steven Bethard <steven.bethard@xxxxxxxxxxxx> wrote:
> On Oct 16, 2012, at 12:59 PM, Matthew Piggott <mpiggott@xxxxxxxxxxxx> wrote:
> > There should be a link to the git repo on the m2e site, or alternatively Github was offering mirrors under the Eclipse user.
>
> And I can use the git repo as a Maven repository?
>
> Or the git repo has examples of integration tests using the BuildContext approach?
>
> Steve
>
> >
> > On 16 October 2012 14:54, Steven Bethard <steven.bethard@xxxxxxxxxxxx> wrote:
> > On Oct 15, 2012, at 4:52 PM, Steven Bethard <Steven.Bethard@xxxxxxxxxxxx> wrote:
> > > I've been updating a code-generation plugin to use BuildContext as suggested in the instructions here:
> > >
> > > http://wiki.eclipse.org/M2E_compatible_maven_plugins
> > >
> > > Is there an example anywhere of testing a Maven plugin like this?
> > >
> > > In particular, I'm wondering how to migrate tests written in the m2e connector style (where you subclass org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase and use Tycho to configure dependencies) to the normal Maven style (where tests go in src/test/java and Maven configures the dependencies).
> >
> > I could just copy my m2e connector tests over if someone can tell me where to find the following packages:
> >
> > org.eclipse.core.resources
> > org.eclipse.jdt.core
> > org.eclipse.m2e.core.project
> > org.eclipse.m2e.tests.common
> >
> > If they're in Maven Central, I couldn't find them.
> >
> > Steve
> > _______________________________________________
> > m2e-users mailing list
> > m2e-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/m2e-users
> >
> > _______________________________________________
> > m2e-users mailing list
> > m2e-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/m2e-users
>
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-users
>
> _______________________________________________
> m2e-users mailing list
> m2e-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users


Back to the top