Created
March 31, 2011 19:52
-
-
Save mproch/897109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profile("felix.fileinstall"), | |
systemProperty("felix.fileinstall.dir").value(resources + "etc"), | |
systemProperty("felix.fileinstall.filter").value(".*\\.cfg"), | |
systemProperty("felix.fileinstall.poll").value("1000"), | |
systemProperty("felix.fileinstall.noInitialDelay").value("true"), | |
mavenBundle("org.apache.felix", "org.apache.felix.configadmin").startLevel(2), | |
mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").startLevel(2), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected <T> T getBean(Class<T> klazz, String beanName) throws Exception { | |
ServiceTracker tracker = new ServiceTracker(bundleContext, bundleContext.createFilter( | |
"(&(objectClass=" + klazz.getName() + ")(org.springframework.osgi.bean.name=" + beanName + "))"), null); | |
tracker.open(); | |
T bean = (T) tracker.waitForService(10000); | |
tracker.close(); | |
assertNotNull(bean); | |
return bean; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.osgi.framework.system.packages = \ | |
com.sun.org.apache.xalan.internal.xsltc.trax, \ | |
com.sun.org.apache.xerces.internal.dom, \ | |
com.sun.org.apache.xerces.internal.jaxp, \ | |
com.sun.org.apache.xerces.internal.xni, \ | |
com.sun.org.apache.xpath.internal.jaxp, \ | |
com.sun.org.apache.xerces.internal.jaxp.validation, \ | |
... | |
# javax.xml.soap, \ | |
# javax.xml.stream, \ | |
# javax.xml.stream.events, \ | |
# javax.xml.stream.util, \ | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Option[] configuration() throws Exception { | |
String resources = BasicIntegrationTest.class.getResource("/").getFile(); | |
System.setProperty("org.ops4j.pax.runner.platform.ee", "file://" + resources + "etc/jre.properties"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
systemProperty("karaf.startLocalConsole").value("false"), | |
systemProperty("karaf.home").value(resources), | |
systemProperty("karaf.startRemoteShell").value("false"), | |
mavenBundle("org.apache.karaf.shell", "org.apache.karaf.shell.console", karafVersion).startLevel(3), | |
mavenBundle("org.apache.karaf", "org.apache.karaf.management", karafVersion).startLevel(3), | |
mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint", "0.2-incubating").startLevel(2), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public static Option[] configuration() throws Exception { | |
return options( | |
//... | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void sendMessage() throws Exception { | |
Thread.sleep(1000); | |
Source out= sendMessage("{http://touk.pl/smx4/paxexam}service1", "<request/>"); | |
String response = XPathBuilder.xpath("//ns:response/text()").namespace("ns", "http://touk.pl/smx4/paxexam") | |
.evaluate(getCamelContext("serviceContext"), out) | |
assertEquals("response", response); | |
Assert.assertEquals(1, ((Listener) getBean(ExchangeListener.class, "listener")).exchanges.size()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected Source sendMessage(String service, String message) throws Exception { | |
NMR nmr = getNMR(); | |
ExchangeImpl ei = new ExchangeImpl(Pattern.InOut); | |
ei.getIn().setBody(new StringSource(message)); | |
Reference ref = nmr.getEndpointRegistry().lookup(Collections.singletonMap("SERVICE_NAME", service)); | |
ei.setTarget(ref); | |
Channel channel = nmr.createChannel(); | |
channel.sendSync(ei); | |
Source out = ei.getOut().getBody(Source.class); | |
ei.setStatus(Status.Done); | |
channel.send(ei); | |
channel.close(); | |
return out; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mavenBundle("org.apache.xbean", "xbean-blueprint", "3.7").startLevel(4), | |
mavenBundle("org.apache.commons", "commons-jexl", "2.0.1").startLevel(4), | |
mavenBundle("org.apache.servicemix.specs", | |
"org.apache.servicemix.specs.scripting-api-1.0", "1.7.0").startLevel(4), | |
scanFeatures( | |
maven().groupId("org.apache.servicemix") | |
.artifactId("apache-servicemix") | |
.type("xml").classifier("features") | |
.version("4.3.0"), | |
"servicemix-camel", "servicemix-cxf-bc", "camel-nmr" | |
).startLevel(4), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return options( | |
workingDirectory(resources + "paxExam"), | |
felix(), | |
logProfile(), | |
profile("spring.dm", "1.2.0"), | |
profile("spring"), | |
systemProperty("javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema") | |
.value("com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl"), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment