jboss-fuse / wsdl2rest

A tool allowing quick migration from existing JAX-WS services to REST
Apache License 2.0
26 stars 22 forks source link

Update blueprint template to enable standalone testing as well as OSGi deployment #73

Open bfitzpat opened 5 years ago

bfitzpat commented 5 years ago

Though the Blueprint velocity template generates a valid configuration for OSGi deployment, it does not currently allow for standalone testing like the Spring template does. We will need to investigate how to adjust the template to enable both cases or provide one case to rule them all.

bfitzpat commented 5 years ago

To enable standalone testing, we can...

  1. Comment out the generated camel servlet options in the generated config:

    <!-- Setup camel servlet with OSGi HttpService -->
    <!-- <reference id="httpService" interface="org.osgi.service.http.HttpService"/>
    
    <bean class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
       init-method="register"
       destroy-method="unregister">
      <property name="alias" value="/wsdl2rest"/>
      <property name="httpService" ref="httpService"/>
      <property name="servlet" ref="camelServlet"/>
    </bean>
    
    <bean id="camelServlet" class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/> -->
  2. Change the restConfiguration element to use the jetty component:

        <restConfiguration component="jetty" host="localhost" port="8081" bindingMode="json">
        </restConfiguration>
  3. And add the following dependencies to the pom.xml:

        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>5.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-all</artifactId>
            <version>5.2</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>5.0.0</version>
        </dependency>
bfitzpat commented 5 years ago

I am unsure how to make a single configuration work so that it can be deployed on Karaf/OSGi and tested in standalone mode. Waiting for some feedback from Freeman to see if that's possible.