On Tue, Apr 10, 2012 at 6:08 PM, Diego Jesus <diego.a.r.jz(a)gmail.com> wrote:
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;
You get a mock Execution injected when the test is run, most probably,
so you have to specify the behaviour of getContext() method before
calling GetDocument(int). It should probably return a mock
ExecutionContext which in turn should return a mock XWikiContext when
calling getProperty("xwikicontext").
You need to specify these expectations at the beginning of your test,
or in the setUp (@Before) if more tests share the same expectations.
Hope this helps,
Marius
....
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.florea(a)xwiki.com> escreveu:
On Tue, Apr 10, 2012 at 4:34 PM, Thomas Mortagne
<thomas.mortagne(a)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/…
.
Hope this helps,
Marius
On Tue, Apr 10, 2012 at 3:24 PM, _diego <diego.a.r.jz(a)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…
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users