Hello, i have a tapestry app that consist of 1-2 pages, and lots of services. The apps is used to crawl another website. The apps uses hibernate module, quartz and some other contribution. Because of the nature of my apps, i want to test the services class using TestNG. I've created a simple test that build the tapestry registry for my services and run it. But i received an error that the ComponentRequestHandler doesn't exist. Here's the contribution in the appmodule, test file and the stack trace. I wonder what I've missed ?
Cheers, Abangkis public class AppModule { .... public void contributeComponentRequestHandler(OrderedConfiguration<ComponentRequestFilter> configuration) { configuration.addInstance("PageProtectionFilter", PageProtectionFilter.class); } public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration, PageRenderLinkSource pageRenderLinkSource) { final HashSet<String> ASSETS_WHITE_LIST = new HashSet<String>(Arrays.asList("jpg", "jpeg", "png", "gif", "js", "css", "ico", "html", "json")); configuration.add("AssetProtectionFilter", new AssetProtectionFilter(ASSETS_WHITE_LIST, pageRenderLinkSource), "before:*"); } .... } public class MyTest { private Registry registry; @Test public void f() { String pageName = "DummyPage"; MovieManager movieManager = registry.getService(MovieManager.class); String result = movieManager.getMovieTitle(pageName); assertEquals("Gullivers Island", result); } @BeforeClass public void beforeClass() { // registry = IOCUtilities.buildDefaultRegistry(); initRegistry(); } private void initRegistry() { RegistryBuilder builder = new RegistryBuilder(); builder.add(ChenilleKitQuartzModule.class); builder.add(AppModule.class); registry = builder.build(); registry.performRegistryStartup(); } @AfterClass public void afterClass() { registry.shutdown(); } } FAILED CONFIGURATION: @BeforeClass beforeClass java.lang.IllegalArgumentException: Contribution net.mreunion.cinematorserver.services.AppModule.contributeComponentRequestHandler(OrderedConfiguration) (at AppModule.java:145) is for service 'ComponentRequestHandler', which does not exist. at org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:253) at org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:229) at org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:170) at net.mreunion.cinematorserver.TestEscapedCharacter.initRegistry(MyTest .java:45) at net.mreunion.cinematorserver.TestEscapedCharacter.beforeClass(MyTest .java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:74) at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:130) at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105) at org.testng.TestRunner.runWorkers(TestRunner.java:1125) at org.testng.TestRunner.privateRun(TestRunner.java:749) at org.testng.TestRunner.run(TestRunner.java:600) at org.testng.SuiteRunner.runTest(SuiteRunner.java:317) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274) at org.testng.SuiteRunner.run(SuiteRunner.java:223) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:995) at org.testng.TestNG.runSuitesLocally(TestNG.java:920) at org.testng.TestNG.run(TestNG.java:856) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:110) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174) -- http://www.mreunion-labs.net/ twitter : @mreunionlabs blog : mreunion.wordpress.com Follow our android survey at : http://www.mreunion-labs.net/downloads:dlapk/MySurvey.apk