Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6BC3510C40 for ; Wed, 11 Mar 2015 12:08:41 +0000 (UTC) Received: (qmail 91922 invoked by uid 500); 11 Mar 2015 12:08:38 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 91886 invoked by uid 500); 11 Mar 2015 12:08:38 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 91876 invoked by uid 99); 11 Mar 2015 12:08:38 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2015 12:08:38 +0000 Date: Wed, 11 Mar 2015 12:08:38 +0000 (UTC) From: "Jani (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CAMEL-8475) CamelSpringDelegatingTestContextLoader and TestNG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Jani created CAMEL-8475: --------------------------- Summary: CamelSpringDelegatingTestContextLoader and TestNG Key: CAMEL-8475 URL: https://issues.apache.org/jira/browse/CAMEL-8475 Project: Camel Issue Type: Bug Components: camel-test Affects Versions: 2.14.1 Reporter: Jani I'm trying to use {{CamelSpringDelegatingTestContextLoader}} with TestNG. Here's my exception: {code:title=MyTest.java|} @ContextConfiguration(classes = SpringTestConfiguration.class, loader = CamelSpringDelegatingTestContextLoader.class) @ActiveProfiles("test") public class MyTest extends AbstractCamelTestNGSpringContextTests { @Autowired private CamelContext camelContext; @Test public void test() { Assert.notNull(camelContext); } } {code} Here's the exception I'm getting: {code} org.testng.TestNGException: Cannot instantiate class com.mycompany.demo.MyTest at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38) at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:380) at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:293) at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:115) at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:200) at org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:120) at org.testng.TestRunner.initMethods(TestRunner.java:409) at org.testng.TestRunner.init(TestRunner.java:235) at org.testng.TestRunner.init(TestRunner.java:205) at org.testng.TestRunner.(TestRunner.java:160) at org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:141) at org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:271) at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:575) at org.testng.SuiteRunner.init(SuiteRunner.java:159) at org.testng.SuiteRunner.(SuiteRunner.java:113) at org.testng.TestNG.createSuiteRunner(TestNG.java:1299) at org.testng.TestNG.createSuiteRunners(TestNG.java:1286) at org.testng.TestNG.runSuitesLocally(TestNG.java:1140) at org.testng.TestNG.run(TestNG.java:1057) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29) ... 27 more Caused by: java.lang.IllegalStateException: Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults, and no ApplicationContextInitializers were declared for context configuration [ContextConfigurationAttributes@327b636c declaringClass = 'org.apache.camel.testng.AbstractCamelTestNGSpringContextTests', classes = '{}', locations = '{}', inheritLocations = true, initializers = '{}', inheritInitializers = true, name = [null], contextLoaderClass = 'org.apache.camel.testng.AbstractCamelTestNGSpringContextTests$TestNGCamelSpringTestContextLoader'] at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.processContextConfiguration(AbstractDelegatingSmartContextLoader.java:201) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:607) at org.springframework.test.context.ContextLoaderUtils.buildMergedContextConfiguration(ContextLoaderUtils.java:560) at org.springframework.test.context.TestContext.(TestContext.java:99) at org.springframework.test.context.TestContextManager.(TestContextManager.java:121) at org.springframework.test.context.TestContextManager.(TestContextManager.java:107) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.(AbstractTestNGSpringContextTests.java:108) at org.apache.camel.testng.AbstractCamelTestNGSpringContextTests.(AbstractCamelTestNGSpringContextTests.java:49) at com.mycompany.demo.MyTest.(MyTest.java:12) ... 32 more {code} If I drop {{AbstractCamelTestNGSpringContextTests}} and use {{AbstractTestNGSpringContextTests}} and copy the listeners I'm able to execute the test. -- This message was sent by Atlassian JIRA (v6.3.4#6332)