org.ops4j.pax.wicket.test.spring
Class PaxWicketSpringBeanComponentInjector
java.lang.Object
org.ops4j.pax.wicket.test.spring.PaxWicketSpringBeanComponentInjector
- All Implemented Interfaces:
- org.apache.wicket.application.IComponentInstantiationListener
public class PaxWicketSpringBeanComponentInjector
- extends Object
- implements org.apache.wicket.application.IComponentInstantiationListener
Wicket component injector which should be used to test PaxWicketBean
annotated fields. Those fields could be
injected using an ApplicationContextMock
. The typical use case is almost similar to a regular wicket spring
test looking like:
1. setup dependencies and mock objects
2. setup mock injection environment
ApplicationContextMock appctx=new ApplicationContextMock();
appctx.putBean("contactDao", dao);
3. setup WicketTester and injector for @SpringBean
WicketTester app=new WicketTester();
app.getApplication().addComponentInstantiationListener(
new PaxWicketSpringComponentInjector(app.getApplication(), appctx ));
4. run the test
For simplicity we do not provide an own mocking class for blueprint. Simply reuse the spring
ApplicationContextMock
. Though, make sure that you set the simulateBlueprint
flag to true. That way
you make sure that the test case simulates the special behavior for blueprint injection.
Method Summary |
void |
onInstantiation(org.apache.wicket.Component component)
|
void |
registerForAdditionalName(String applicationKey)
This method is required in a case where you need to add the same injector to an additional application. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PaxWicketSpringBeanComponentInjector
public PaxWicketSpringBeanComponentInjector(org.apache.wicket.protocol.http.WebApplication webApp,
org.springframework.context.ApplicationContext appContext)
PaxWicketSpringBeanComponentInjector
public PaxWicketSpringBeanComponentInjector(org.apache.wicket.protocol.http.WebApplication webApp,
org.springframework.context.ApplicationContext appContext,
boolean simulateBlueprint)
registerForAdditionalName
public void registerForAdditionalName(String applicationKey)
- This method is required in a case where you need to add the same injector to an additional application.
onInstantiation
public void onInstantiation(org.apache.wicket.Component component)
- Specified by:
onInstantiation
in interface org.apache.wicket.application.IComponentInstantiationListener
Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.