How to get correct path of component for put it in properties file
Hi all, I have problems to find the correct path of my component to place it in the properties file. In particular validation retrieves the name of the component through the properties file to display it in the browser if validation fails. I did "component.getPath()" and "component.getRelativePath()" in the code and put the result of both in properties file like: myPopupForm.myAttr=test1 templateContent.myPopupForm.myAttr=test2 But this didnt work. Is there a way how to find out the string which is the key for an entry in the properties file? Regards, yka -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-get-correct-path-of-component-for-put-it-in-properties-file-tp4657273.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester with BookmarkablePageLink
Thanks mate. Works fine now :) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657091.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester with BookmarkablePageLink
Hi Vineet, tried it out. My setup() method now looks like this: @Before public void setUp() { MockitoAnnotations.initMocks(this); app = new StartApplication() { @Override public ServletContext getServletContext() { ServletContext servletContext = super.getServletContext(); ApplicationContextMock appctx = new ApplicationContextMock(); Service service = Mockito.mock(Service.class); appctx.putBean(service); WebApplication application = new MockApplication(); WicketTester tester = new WicketTester(application); SpringComponentInjector componentInjector = new SpringComponentInjector( tester.getApplication(), appctx, false); tester.getApplication().getComponentInstantiationListeners() .add(componentInjector); return servletContext; } }; org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger("org.apache.wicket.util.tester"); logger.setLevel(Level.DEBUG); tester = new WicketTester(app); } But when I run the test, I get: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:90) at org.apache.wicket.spring.injection.annot.SpringComponentInjector.(SpringComponentInjector.java:81) at com.index.StartApplication.init(StartApplication.java:16) at org.apache.wicket.Application.initApplication(Application.java:818) at org.apache.wicket.util.tester.BaseWicketTester.(BaseWicketTester.java:287) at org.apache.wicket.util.tester.BaseWicketTester.(BaseWicketTester.java:231) at org.apache.wicket.util.tester.WicketTester.(WicketTester.java:184) at com.customer.web.AbstractBasePageTester.setUp(AbstractBasePageTester.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657053.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket Tester with BookmarkablePageLink
Sure, this is the test code: public class AbstractBasePageTester { private WicketTester tester; private StartApplication app; @Mock private CustomerService aService; @Before public void setUp() { MockitoAnnotations.initMocks(this); app = new StartApplication() { @Override public ServletContext getServletContext() { ServletContext servletContext = super.getServletContext(); XmlWebApplicationContext applicationContext = new XmlWebApplicationContext(); applicationContext .setConfigLocation("classpath:applicationContext.xml"); applicationContext.setServletContext(servletContext); // applicationContext.refresh(); servletContext .setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext); return servletContext; } }; org.apache.log4j.Logger logger = org.apache.log4j.Logger .getLogger("org.apache.wicket.util.tester"); logger.setLevel(Level.DEBUG); tester = new WicketTester(app); } @Test public void homepageRendersSuccessfully() { // start and render the test page tester.startPage(Start.class); tester.assertRenderedPage(Start.class); tester.assertNoErrorMessage(); tester.debugComponentTrees(); tester.assertComponent("createCustomerLink", BookmarkablePageLink.class); tester.assertComponent("showCustomersLink", BookmarkablePageLink.class); tester.clickLink("createCustomerLink"); } } And this the normal code: public class Start extends WebPage { public Start() { BookmarkablePageLink customerLink = new BookmarkablePageLink( "createCustomerLink", CreateCustomer.class); customerLink.add(new Label("createCustomerLabel", getString("createCustomerLabel"))); add(customerLink); BookmarkablePageLink showCustomersLink = new BookmarkablePageLink( "showCustomersLink", ShowCustomers.class); showCustomersLink.add(new Label("showCustomersLabel", getString("showCustomersLabel"))); add(showCustomersLink); } } public class StartApplication extends WebApplication { @Override public Class getHomePage() { return Start.class; } @Override protected void init() { super.init(); SpringComponentInjector springComponentInjector = new SpringComponentInjector( this); getComponentInstantiationListeners().add(springComponentInjector); } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4656954.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket Tester with BookmarkablePageLink
Hi all, are there any known problems with testing BookmarkablePageLinks? Im trying to click a BookmarkablePageLink from my start page and receive the following trace. I dont understand why he cant use the public constructor. I've wrote the default constructor... org.apache.wicket.WicketRuntimeException: Internal error in WicketTester. Please report this in Wicket's Issue Tracker. at org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1879) at org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1760) at com.customer.web.AbstractBasePageTester.homepageRendersSuccessfully(AbstractBasePageTester.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.customer.CreateCustomer()'. Might be it doesn't exist, may be it is not visible (public). at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:193) at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:66) at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:133) at org.apache.wicket.core.request.handler.PageProvider.resolvePageInstance(PageProvider.java:278) at org.apache.wicket.core.request.handler.PageProvider.getPageInstance(PageProvider.java:166) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2628) at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider.get(BaseWicketTester.java:2614) at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:164) at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:840) at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:254) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:211) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:282) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:643) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:572) at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:544) at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:1186) at org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1875) .
Re: Serialzation Problem
Ok, but what exactly does that mean? And how can I avoid the chaining problem? I think the code is pretty forward and I dont know what I did wrong. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Serializable-Problem-tp4656886p4656891.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Serialzation Problem
Hi all, my code looks like: " *private final transient Customer customer = new Customer(); public CreateCustomer() { this("main"); } public CreateCustomer(String string) { init(); } private void init() { Form form = new Form("form", new CompoundPropertyModel(customer)) { @Override protected void onSubmit() { customer.setCustomerNumber(3); } }; form.add(new TextField("name")); add(form); }* " But when I render the page I get: "*2013-02-28 21:49:33,641 ERROR [org.apache.wicket.serialize.java.JavaSerializer] - org.apache.wicket.core.util.objects.checker.CheckingObjectOutputStream$ObjectCheckException: The object type is not Serializable! A problem occurred while checking object with type: com.customer.Customer Field hierarchy is: 0 [class=com.customer.CreateCustomer, path=0] private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;] private java.util.List org.apache.wicket.request.mapper.parameter.PageParameters.namedParameters[2] [class=org.apache.wicket.markup.html.form.Form, path=0:form] java.lang.Object org.apache.wicket.Component.data [class=org.apache.wicket.model.CompoundPropertyModel] private java.lang.Object org.apache.wicket.model.ChainingModel.target [class=com.customer.Customer] <- field that is causing the problem* " This is very confusing for me. The error message says that the Customer instance is not serializable, although I marked the field as transient !! Any suggestions? Cheers, Y -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Serialzation-Problem-tp4656886.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Passing IModel in Constructor of bookmarkable Page?
Well all this page stuff is not related to the topic in this thread. Please open another thread for that. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-tp4655546p4655570.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket + Spring
To go more into detail. The Web part is a dynamic web project and is added to Tomcat Server within Eclipse (Right-click on Tomcat in Servers-Tab -> And and Remove -> Add the web project.) The spring part is a just a java project... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-tp4655546p461.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket + Spring
Well I dont use Maven, I start Tomcat from within Eclipse... Any ideas? If I start Spring standalone or Wicket+Tomcat standalon it works fine... -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-tp4655546p460.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org