2016-09-28 24 views
2

同じアプリケーションで私はProject APropject Bです。 Project Bにはコンポーネントの実装があり、これはProject Aでも使用されています。Wicketはテストでプロパティを解決できません

org.apache.wicket.WicketRuntimeException: Exception in rendering component: [UploadPanel [Component id = content]] 
    at org.apache.wicket.Component.internalRenderComponent(Component.java:2589) 
    at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1663) 
    at org.apache.wicket.Component.internalRender(Component.java:2380) 
    at org.apache.wicket.Component.render(Component.java:2308) 
    at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1521) 
    at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1724) 
    at org.apache.wicket.Page.onRender(Page.java:879) 
    at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:141) 
    at org.apache.wicket.Component.internalRender(Component.java:2380) 
    at org.apache.wicket.Component.render(Component.java:2308) 
    at org.apache.wicket.Page.renderPage(Page.java:1018) 
    at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:124) 
    at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:236) 
    at org.apache.wicket.util.tester.BaseWicketTester$LastPageRecordingPageRendererProvider$1.respond(BaseWicketTester.java:2766) 
    at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175) 
    at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895) 
    at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) 
    at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) 
    at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) 
    at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) 
    at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:714) 
    at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:653) 
    at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:883) 
    at org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:900) 
    at org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1462) 
    at org.apache.wicket.util.tester.BaseWicketTester.startComponentInPage(BaseWicketTester.java:1382) 
    at (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.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:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 
Caused by: java.lang.RuntimeException: An error occurred while getting the model object for Component: [EmailLink [Component id = dataexchange.email.link, page = org.apache.wicket.util.tester.BaseWicketTester$StartComponentInPage, path = 1:content:dataexchange.email.link.EmailLink, isVisible = true, isVersioned = true, markup = [markup = file:/C:/dev/projects/Project A/web/content/upload/UploadPanel.html 
<a href="#" wicket:id="dataexchange.email.link"><wicket:message key="massmeldupload.desc.3"/></a>, index = 0, current = '<a href="#" wicket:id="dataexchange.email.link">' (line 0, column 0)]]] 
    at org.apache.wicket.Component.getDefaultModelObject(Component.java:1631) 
    at org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1654) 
    at Project B.web.comp.EmailLink.onComponentTag(EmailLink.java:36) 
    at org.apache.wicket.Component.internalRenderComponent(Component.java:2521) 
    at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1663) 
    at org.apache.wicket.Component.internalRender(Component.java:2380) 
    at org.apache.wicket.Component.render(Component.java:2308) 
    at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1521) 
    at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1724) 
    at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1699) 
    at org.apache.wicket.MarkupContainer.renderAssociatedMarkup(MarkupContainer.java:799) 
    at org.apache.wicket.markup.html.panel.AssociatedMarkupSourcingStrategy.renderAssociatedMarkup(AssociatedMarkupSourcingStrategy.java:77) 
    at org.apache.wicket.markup.html.panel.PanelMarkupSourcingStrategy.onComponentTagBody(PanelMarkupSourcingStrategy.java:112) 
    at org.apache.wicket.Component.internalRenderComponent(Component.java:2565) 
    ... 49 more 
Caused by: java.util.MissingResourceException: Unable to find property: 'teaser.contact.dataexchange.email' for component: content:dataexchange.email.link [class=Project B.EmailLink]. Locale: null, style: null 
    at org.apache.wicket.Localizer.getString(Localizer.java:268) 
    at org.apache.wicket.model.ResourceModel$AssignmentWrapper.load(ResourceModel.java:129) 
    at org.apache.wicket.model.ResourceModel$AssignmentWrapper.load(ResourceModel.java:99) 
    at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:134) 
    at org.apache.wicket.Component.getDefaultModelObject(Component.java:1626) 
    ... 62 more 

プロパティteaser.contact.dataexchange.emailProject Bで定義されていないが、決してProject Aで:Project Aのためのテストを実行しているとき、私は、次のスタックトレースを取得します。
これらのプロパティはすべて1つのDBに書き込まれ、そこから読み込まれるため、失敗したテストに過ぎません。この問題を解決するにはどうすればよいですか?

答えて

6

あなたはそれを見つけるためにウィケットを助ける必要があります。 YourTest.javaで

、あなたは何をする必要があります。

tester.getApplication().getResourceSettings().getStringResourceLoaders().add(loader) 

性質がSomeClassInB.propertiesである場合、loadernew ClassStringResourceLoader(SomeClassInB.class)する必要があります。それ以外の場合は、IStringResourceLoaderインターフェイスの他の実装を使用するか、独自のプロパティを読み込んでプロパティを読み込む方法を知ることができます。

関連する問題