You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by neduz <na...@neduz.be> on 2012/11/05 17:32:25 UTC

Pax Exam Karaf - deploy blueprint XML files

Hello,

I'm trying to use Pax Exam Karaf (in Karaf 2.3.0). In my setup I use .xml
file in the Karaf deploy folder to instantiate beans and services; I also
use xbean-blueprint to make use of a custom xml namespace.

Now I want to make testing easier with Pax Exam (it's my first experience
with Pax Exam). I'm trying to achieve this by setting up the test
environment like this:

@RunWith(JUnit4TestRunner.class)
@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
public class TestMonitor {

	@Configuration
	public static Option[] configuration() throws Exception {
		System.out.print("Before configuration of karaf");
		return new Option[] {
				karafDistributionConfiguration()
						.frameworkUrl(
								"mvn:org.apache.karaf/apache-karaf/2.3.0/zip")
						.karafVersion("2.3.0").name("TestKaraf")
						.unpackDirectory(new File("target/paxexam/unpack")),
				junitBundles(),
				mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec",
"1.1.1"),
				mavenBundle("org.apache.geronimo.specs", "geronimo-jms_1.1_spec",
"1.1.1"),
				mavenBundle("org.apache.xbean", "xbean-blueprint", "3.12"),
				mavenBundle("mypackage", "status-tables","0.0.1-SNAPSHOT"),
				provision("file:C:\\Documents and
Settings\\Neduz\\workspace\\StatusTables.xml") 
			};
	}


Instead of "provision" I also tried "org.ops4j.pax.exam.CoreOptions.bundle",
but this doesn't seem to instantiate the beans & services defined in the XML

I use this to get a reference to the "StatusTable" created in the XML file:

	 @Inject
	 private StatusTable statusTable;

But this always results in:
test:TestMonitor.test:KarafTestContainer{mvn:org.apache.karaf/apache-karaf/2.3.0/zip}(mypackage.tests.TestMonitor) 
Time elapsed: 28.11 sec  <<< ERROR!
org.ops4j.pax.swissbox.framework.ServiceLookupException: gave up waiting for
service mypackage.StatusTable

How can I properly get an blueprint xml "interpreted" in a pax-exam-karaf
environment? 

Kind regards,

Tom Mercelis



--
View this message in context: http://karaf.922171.n3.nabble.com/Pax-Exam-Karaf-deploy-blueprint-XML-files-tp4026693.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Pax Exam Karaf - deploy blueprint XML files

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi guys,

and thanks for the report, we gonna take a look on that.

Regards
JB

On 11/07/2012 10:03 PM, gavin_scott wrote:
> I ran into the same problem.  Looks like a bug to me.  I filed a bug for it,
> KARAF-2005.  A workaround in the meantime is to include the type (xml) in
> your url path.  For example a url like "file:C:/tmp/xml/blueprint.xml" would
> work.
>
> --
> Gavin Scott
> gavin_scott@dell.com
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Pax-Exam-Karaf-deploy-blueprint-XML-files-tp4026693p4026714.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Pax Exam Karaf - deploy blueprint XML files

Posted by gavin_scott <ga...@dell.com>.
I ran into the same problem.  Looks like a bug to me.  I filed a bug for it,
KARAF-2005.  A workaround in the meantime is to include the type (xml) in
your url path.  For example a url like "file:C:/tmp/xml/blueprint.xml" would
work.

--
Gavin Scott
gavin_scott@dell.com



--
View this message in context: http://karaf.922171.n3.nabble.com/Pax-Exam-Karaf-deploy-blueprint-XML-files-tp4026693p4026714.html
Sent from the Karaf - User mailing list archive at Nabble.com.