List of usage examples for org.apache.wicket.spring.injection.annot SpringComponentInjector SpringComponentInjector
public SpringComponentInjector(final WebApplication webapp, final ApplicationContext ctx)
From source file:almira.sample.web.AbstractWicketSpringPageTest.java
License:Apache License
/** * Constructor./*from w ww . j a v a2s . c o m*/ */ AbstractWicketSpringPageTest() { super(new MainApplication() { @Override protected void initSpringInjector() { getComponentInstantiationListeners().add(new SpringComponentInjector(this, APPCTX)); } }); }
From source file:ca.travelagency.Application.java
License:Apache License
private void initComponentInstantiationListeners() { SpringComponentInjector springComponentInjector = new SpringComponentInjector(this, applicationContext); ComponentInstantiationListenerCollection componentInstantiationListeners = getComponentInstantiationListeners(); componentInstantiationListeners.add(springComponentInjector); }
From source file:com.cubeia.games.poker.admin.wicket.pages.system.SystemManagementTest.java
License:Open Source License
@Before public void setup() { initMocks(this); ApplicationContextMock context = new ApplicationContextMock(); context.putBean("networkClient", networkClient); context.putBean("jmxFactory", jmxFactory); context.putBean("adminConfig", config); tester = new WicketTester(); tester.getApplication().getComponentInstantiationListeners() .add(new SpringComponentInjector(tester.getApplication(), context)); }
From source file:com.cubeia.games.poker.admin.wicket.pages.tournaments.history.ShowTournamentTest.java
License:Open Source License
@Test public void testShowTournament() { WicketTester tester = new WicketTester(); tester.getApplication().getComponentInstantiationListeners() .add(new SpringComponentInjector(tester.getApplication(), context)); PageParameters pageParameters = new PageParameters(); pageParameters.set("historicTournamentId", "someId"); HistoricTournament tournament = new HistoricTournament(); tournament.setId(new ObjectId()); when(historyService.findTournamentByHistoricId("someId")).thenReturn(tournament); tester.startPage(new ShowTournament(pageParameters)); tester.assertRenderedPage(ShowTournament.class); }
From source file:com.cubeia.games.poker.admin.wicket.pages.WicketTestHelper.java
License:Open Source License
public static WicketTester createWicketTester(HistoryService historyService, AdminDAO adminDAO, NetworkClient networkClient, AdminConfig config) { ApplicationContextMock context = new ApplicationContextMock(); context.putBean("historyService", historyService); context.putBean("adminDAO", adminDAO); context.putBean("networkClient", networkClient); context.putBean("adminConfig", config); WicketTester tester = new WicketTester(); tester.getApplication().getComponentInstantiationListeners() .add(new SpringComponentInjector(tester.getApplication(), context)); return tester; }
From source file:com.przemo.projectmanagementweb.Application.java
@Override protected void init() { super.init(); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); ctx.refresh();/*from w w w . j a va2 s.c o m*/ getComponentInstantiationListeners().add(new SpringComponentInjector(this, ctx)); Properties applicationProperties = new Properties(); try { applicationProperties.load(this.getClass().getResourceAsStream("application.properties")); APPLICATION_VERSION = applicationProperties.getProperty(APPLICATION_VERSION_PROPERTY); } catch (IOException ex) { APPLICATION_VERSION = "_"; Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:de.bessonov.BaseTest.java
License:Open Source License
@SuppressWarnings("unchecked") @Before//from w w w . j a v a 2 s . co m public void setUp() { // create new application and init Spring DI WicketApplication app = new WicketApplication() { @Override protected void initSpring() { // Bind Spring DI getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext)); }; }; tester = new WicketTester(app); //tester.setupRequestAndResponse(); session = (UserSession<UserModel>) tester.getSession(); session.setLocale(Locale.GERMAN); // create test user user = new UserModel(); user.setEmail("test@test.test"); user.setPassword(userPassword); }
From source file:de.codepitbull.spring2.TestHomePage.java
License:Apache License
@Before public void setUp() { ApplicationContextMock applicationContextMock = new ApplicationContextMock(); applicationContextMock.putBean(mock(TestService.class)); tester = new WicketTester(); tester.getApplication().getComponentInstantiationListeners() .add(new SpringComponentInjector(tester.getApplication(), applicationContextMock)); }
From source file:de.lichtflut.glasnost.is.GlasnostWebTest.java
License:Apache License
@Before public void setUp() throws Exception { applicationContextMock = new ApplicationContextMock(); earlyInitialize();/* w ww .j a v a 2 s. co m*/ GlasnostWebApplication application = new GlasnostWebApplication() { @Override public Session newSession(final Request request, final Response response) { return getRBWebSession(request); } @Override public void init() { // Overwrite so that SpringComponentInjector(this) will not be called from super! // Instead it will be added a few lines below. getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContextMock)); } }; registerMocks(); tester = new WicketTester(application); tester.getSession().setLocale(Locale.ENGLISH); localizer = tester.getApplication().getResourceSettings().getLocalizer(); setupTest(); }
From source file:guru.mmp.application.web.WebApplication.java
License:Apache License
@Override protected void init() { super.init(); getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext)); getSecuritySettings().setAuthorizationStrategy(new WebAuthorizationStrategy()); if ((System.getProperty("was.install.root") != null) || (System.getProperty("wlp.user.dir") != null)) { setRequestCycleProvider(new WebSphereAbsoluteUrlRequestCycleProvider()); }/* w ww . j a v a2 s. c o m*/ }