Ok, got it to work. The small test component is running just fine in XWiki. However, if I try to run unit tests with maven I get the following error:
Results : Failed tests: testGetDocument(com.aims.DocumentScriptTest): unexpected invocation: context.getContext() no expectations specified: did you... - forget to start an expectation with a cardinality clause? - call a mocked method to specify the parameter of an expectation? what happened before this: nothing! This are the relevant parts of my code: @Component @Named("documentScript") @Singleton public class DocumentScript implements ScriptService { @Inject Execution context; .... public Document GetDocument(int id){ try { ExecutionContext context = this.context.getContext(); // The exception trace points here XWikiContext wikiContext = (XWikiContext)context.getProperty("xwikicontext"); XWiki wiki = wikiContext.getWiki(); .... No dia 10 de Abril de 2012 14:37, Marius Dumitru Florea <mariusdumitru.flo...@xwiki.com> escreveu: > > On Tue, Apr 10, 2012 at 4:34 PM, Thomas Mortagne > <thomas.morta...@xwiki.com> wrote: > > Probably mean you don't have the right configuration in your > > .m2/settings.xml. See > > http://dev.xwiki.org/xwiki/bin/view/Community/Building#HInstallingMaven > > Yes, I can see the 4.0-SNAPSHOT version of xwiki-platform-oldcore in > the maven repo > http://maven.xwiki.org/snapshots/org/xwiki/platform/xwiki-platform-oldcore/4.0-SNAPSHOT/ > . > > Hope this helps, > Marius > > > > > On Tue, Apr 10, 2012 at 3:24 PM, _diego <diego.a.r...@gmail.com> wrote: > >> Well, I've been trying, but maven doesn't find that dependency. > >> > >> I've tried with several versions of the following: > >> > >> <dependency> > >> <groupId>org.xwiki.platform</groupId> > >> <artifactId>xwiki-platform-oldcore</artifactId> > >> <version>4.0-SNAPSHOT</version> > >> </dependency> > >> > >> I also search in maven repository but there is no reference there to the > >> old > >> core. Should I build the source from git and include the jar in my project? > >> > >> -- > >> View this message in context: > >> http://xwiki.475771.n2.nabble.com/Components-Bridge-to-old-core-and-objects-tp7208056p7452865.html > >> Sent from the XWiki- Users mailing list archive at Nabble.com. > >> _______________________________________________ > >> users mailing list > >> users@xwiki.org > >> http://lists.xwiki.org/mailman/listinfo/users > > > > > > > > -- > > Thomas Mortagne > > _______________________________________________ > > users mailing list > > users@xwiki.org > > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users