-
1. Re: What is the best practices to develop in JBoss Fuse with OSGI?
cpandey Jun 12, 2017 4:26 AM (in response to celsoagra)Hi,
I am not sure if you are aware of feature.xml file. You can create a feature.xml once, and you can just install this feature at the time of deployment. One feature.xml can have multiple features. You can add this feature using below command in karaf console.
features:addurl file://path/to/features.xml
#Once added, just add the feature you want to install:
features:install get-started-basic.
#That's it all bundles or features within this feature will be installed in a single command.
<?xml version="1.0" encoding="UTF-8"?>
<features name="get-started">
<feature name="get-started-basic"> <
bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
<bundle>mvn:org.fusesource.example/camel-basic/1.0-SNAPSHOT</bundle>
</feature>
<feature name="get-started-cxf">
<bundle>mvn:org.fusesource.example/cxf-basic/1.0-SNAPSHOT</bundle>
</feature>
</features> -
2. Re: What is the best practices to develop in JBoss Fuse with OSGI?
celsoagra Jun 12, 2017 11:27 AM (in response to cpandey)Thanks cpandey !!
I'll try to do that.
Also, I'm using this kind of configuration:
```
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fabric8.version}</version>
<configuration>
<jolokiaUrl>http://xxxxxx:xxxxxx@localhost:8181/jolokia</jolokiaUrl>
<profile>manager</profile>
<profileConfigDir>src/main/resources</profileConfigDir>
<scope>compile</scope>
<parentProfiles>jboss-fuse-full</parentProfiles>
<features>camel-jackson camel-jsonpath hibernate-validator camel-http4 camel-restlet fabric-hawtio-swagger</features>
<bundles>
wrap:mvn:org.jboss.resteasy/resteasy-jackson2-provider/3.1.3.Final
wrap:mvn:org.jboss.resteasy/resteasy-jaxrs/3.1.3.Final
wrap:mvn:org.jboss.resteasy/resteasy-jackson-provider/3.1.3.Final
wrap:mvn:org.jboss.resteasy/resteasy-multipart-provider/3.1.3.Final
wrap:mvn:org.jboss.resteasy/resteasy-client/3.1.3.Final
</bundles>
</configuration>
</plugin>
```
I did a list about all of problems that I had during the development:
1. Integration tests
I found examples
and here -> http://blog.christianposta.com/testing/integration-testing-jboss-fuse-6-x-with-pax-exam-part-i/
This seems good. I just simulate my JBoss Fuse environment and could run some tests, but for some reason I got this error below:
```
java.lang.IllegalStateException: No karaf base dir found in extracted distribution.
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.searchKarafBase(KarafTestContainer.java:585)
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:157)
at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79)
at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:267)
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.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
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:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
```
As I understand, I could test in local environment using specific properties in "camel-context" and parameters
2. Multiple Camel-Context
How Can I create multiple camel-context for different environments? I'd like to do something similiar to Active Providers. Camel-NMR seems to be difficult.
3. Debug
Would be possible debug my application with Integration Tests?
-
3. Re: What is the best practices to develop in JBoss Fuse with OSGI?
cpandey Jun 16, 2017 6:43 AM (in response to celsoagra)1. Integration tests
I found examples
and here -> http://blog.christianposta.com/testing/integration-testing-jboss-fuse-6-x-with-pax-exam-part-i/
ChandraShekhar: I would suggest to raise a support case with Red Hat JBoss Fuse.
2. Multiple Camel-Context
How Can I create multiple camel-context for different environments? I'd like to do something similiar to Active Providers. Camel-NMR seems to be difficult.
ChandraShekhar: Different environments means differents jvm ?
3. Debug
Would be possible debug my application with Integration Tests?
ChandraShekhar: Yes it should be.
-
4. Re: What is the best practices to develop in JBoss Fuse with OSGI?
celsoagra Jun 20, 2017 8:39 AM (in response to cpandey)cpandey ,
2. Multiple Camel-Context
How Can I create multiple camel-context for different environments? I'd like to do something similiar to Active Providers. Camel-NMR seems to be difficult.
ChandraShekhar: Different environments means differents jvm ?
Celso: Could be different environments, with different parameters, such as, production is connected to database xxx.xxx.xxx.xxx and stage it is connected in yyy.yyy.yyy.yyy
-
5. Re: What is the best practices to develop in JBoss Fuse with OSGI?
cpandey Jun 27, 2017 5:09 AM (in response to celsoagra)Ok, I understood. Here you don't need different camelcontext but different properties file for each environment. What I can think of as a quick solution is to create two properties file like in ${karaf.home}/etc folder:
org.fusesource.example.get.started.cfg.prod
org.fusesource.example.get.started.cfg.dev
Now follow doc[1]. If it prod environment change org.fusesource.example.get.started.cfg.prod to org.fusesource.example.get.started.cfg. Similarly if it dev, org.fusesource.example.get.started.cfg.dev to org.fusesource.example.get.started.cfg.
CamelContext(or route) remains same just configuration changes as per prod/dev/uat.
[1]Red Hat JBoss Fuse - Getting Started - Configure the Application