You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ie...@apache.org on 2013/02/07 12:15:17 UTC
svn commit: r1443412 - in /james/server/trunk: ./ data/data-library/
dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/
fetchmail/src/main/resources/META-INF/spring/ karaf/
karaf/distribution/src/main/filtered-resources/etc/ karaf/featu...
Author: ieugen
Date: Thu Feb 7 11:15:16 2013
New Revision: 1443412
URL: http://svn.apache.org/viewvc?rev=1443412&view=rev
Log:
James-Karaf integration
Added:
james/server/trunk/karaf/README.md
Modified:
james/server/trunk/data/data-library/pom.xml
james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-context.xml
james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-osgi.xml
james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-context.xml
james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-osgi.xml
james/server/trunk/karaf/distribution/src/main/filtered-resources/etc/org.apache.karaf.features.cfg
james/server/trunk/karaf/features/pom.xml
james/server/trunk/karaf/features/src/main/resources/features.xml
james/server/trunk/karaf/integration/pom.xml
james/server/trunk/karaf/integration/src/test/java/org/apache/james/karaf/karaf/KarafFeatureInstallTest.java
james/server/trunk/pom.xml
Modified: james/server/trunk/data/data-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/data/data-library/pom.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/data/data-library/pom.xml (original)
+++ james/server/trunk/data/data-library/pom.xml Thu Feb 7 11:15:16 2013
@@ -55,7 +55,6 @@
<groupId>org.apache.james</groupId>
<artifactId>apache-mailet-api</artifactId>
</dependency>
-
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.commons-configuration</artifactId>
Modified: james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-context.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-context.xml (original)
+++ james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-context.xml Thu Feb 7 11:15:16 2013
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- ! Licensed to the Apache Software Foundation (ASF) under one ! ! or
- more contributor license agreements. See the NOTICE file ! !
- distributed with this work for additional information ! ! regarding
- copyright ownership. The ASF licenses this file ! ! to you under the
- Apache License, Version 2.0 (the ! ! "License"); you may not use this
- file except in compliance ! ! with the License. You may obtain a copy
- of the License at ! ! ! ! http://www.apache.org/licenses/LICENSE-2.0 !
- ! ! ! Unless required by applicable law or agreed to in writing, ! !
- software distributed under the License is distributed on an ! ! "AS
- IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ! ! KIND, either
- express or implied. See the License for the ! ! specific language
- governing permissions and limitations ! ! under the License. !
- -->
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one ! ! or
+ more contributor license agreements. See the NOTICE file ! !
+ distributed with this work for additional information ! ! regarding
+ copyright ownership. The ASF licenses this file ! ! to you under the
+ Apache License, Version 2.0 (the ! ! "License"); you may not use this
+ file except in compliance ! ! with the License. You may obtain a copy
+ of the License at ! ! ! ! http://www.apache.org/licenses/LICENSE-2.0 !
+ ! ! ! Unless required by applicable law or agreed to in writing, ! !
+ software distributed under the License is distributed on an ! ! "AS
+ IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ! ! KIND, either
+ express or implied. See the License for the ! ! specific language
+ governing permissions and limitations ! ! under the License. !
+-->
-<beans xmlns="http://www.springframework.org/schema/beans"
+<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
- <bean id="dnsservice" class="org.apache.james.dnsservice.dnsjava.DNSJavaService" />
+
+ <bean id="dnsservice" class="org.apache.james.dnsservice.dnsjava.DNSJavaService"/>
</beans>
Modified: james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-osgi.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-osgi.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-osgi.xml (original)
+++ james/server/trunk/dns-service/dnsservice-dnsjava/src/main/resources/META-INF/spring/dns-osgi.xml Thu Feb 7 11:15:16 2013
@@ -17,21 +17,21 @@
specific language governing permissions and limitations
under the License.
-->
-<beans:beans
- xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
+<beans:beans
+ xmlns="http://www.springframework.org/schema/osgi"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- export the dnsserver as osgi service -->
<osgi:service ref="dnsservice">
- <osgi:interfaces>
- <beans:value>org.apache.james.dnsservice.api.DNSService</beans:value>
- <beans:value>org.apache.james.dnsservice.api.DNSServiceMBean</beans:value>
- </osgi:interfaces>
- </osgi:service>
+ <osgi:interfaces>
+ <beans:value>org.apache.james.dnsservice.api.DNSService</beans:value>
+ <beans:value>org.apache.james.dnsservice.api.DNSServiceMBean</beans:value>
+ </osgi:interfaces>
+ </osgi:service>
</beans:beans>
Modified: james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-context.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-context.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-context.xml (original)
+++ james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-context.xml Thu Feb 7 11:15:16 2013
@@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- ! Licensed to the Apache Software Foundation (ASF) under one ! ! or
- more contributor license agreements. See the NOTICE file ! !
- distributed with this work for additional information ! ! regarding
- copyright ownership. The ASF licenses this file ! ! to you under the
- Apache License, Version 2.0 (the ! ! "License"); you may not use this
- file except in compliance ! ! with the License. You may obtain a copy
- of the License at ! ! ! ! http://www.apache.org/licenses/LICENSE-2.0 !
- ! ! ! Unless required by applicable law or agreed to in writing, ! !
- software distributed under the License is distributed on an ! ! "AS
- IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ! ! KIND, either
- express or implied. See the License for the ! ! specific language
- governing permissions and limitations ! ! under the License. !
- -->
+<!--
+ ! Licensed to the Apache Software Foundation (ASF) under one ! ! or
+ more contributor license agreements. See the NOTICE file ! !
+ distributed with this work for additional information ! ! regarding
+ copyright ownership. The ASF licenses this file ! ! to you under the
+ Apache License, Version 2.0 (the ! ! "License"); you may not use this
+ file except in compliance ! ! with the License. You may obtain a copy
+ of the License at ! ! ! ! http://www.apache.org/licenses/LICENSE-2.0 !
+ ! ! ! Unless required by applicable law or agreed to in writing, ! !
+ software distributed under the License is distributed on an ! ! "AS
+ IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ! ! KIND, either
+ express or implied. See the License for the ! ! specific language
+ governing permissions and limitations ! ! under the License. !
+-->
-<beans xmlns="http://www.springframework.org/schema/beans"
+<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
+
<!-- Import PostBeanProcessors -->
<import resource="classpath*:org/apache/james/container/spring/server-context.xml"/>
-
+
<!--
===========================================================================
FetchMail
===========================================================================
-->
- <bean id="fetchmail" class="org.apache.james.fetchmail.FetchScheduler" />
+ <bean id="fetchmail" class="org.apache.james.fetchmail.FetchScheduler"/>
</beans>
Modified: james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-osgi.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-osgi.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-osgi.xml (original)
+++ james/server/trunk/fetchmail/src/main/resources/META-INF/spring/fetchmail-osgi.xml Thu Feb 7 11:15:16 2013
@@ -17,19 +17,19 @@
specific language governing permissions and limitations
under the License.
-->
-<beans:beans
- xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
+<beans:beans
+ xmlns="http://www.springframework.org/schema/osgi"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd
http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<osgi:service ref="fetchmail">
- <osgi:interfaces>
- <beans:value> org.apache.james.fetchmail.FetchSchedulerMBean</beans:value>
- </osgi:interfaces>
- </osgi:service>
+ <osgi:interfaces>
+ <beans:value>org.apache.james.fetchmail.FetchSchedulerMBean</beans:value>
+ </osgi:interfaces>
+ </osgi:service>
</beans:beans>
Added: james/server/trunk/karaf/README.md
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/README.md?rev=1443412&view=auto
==============================================================================
--- james/server/trunk/karaf/README.md (added)
+++ james/server/trunk/karaf/README.md Thu Feb 7 11:15:16 2013
@@ -0,0 +1,85 @@
+Apache James - Karaf integration
+================================
+
+This Maven project deploy Apache James inside Apache Karaf OSGi container. Since James is built with Spring, we will
+use Spring-DM for creating OSGi services thus allowing the same James components be used unchanged in or outside OSGi.
+
+* http://karaf.apache.org/
+* http://james.apache.org/
+* http://static.springsource.org/osgi/docs/1.2.x/reference/html/
+
+Why?
+====
+
+Apache Karaf provide a great container for deploying applications and managing their lifecycle. Read more about that on
+the Karaf homepage.
+
+OSGi promotes the use of services and modules that drive the creation of components easy to reuse and integrate into
+other projects.
+
+Running James inside Karaf container provides means for a secure administration console (over SSH).
+This enable us to write commands to administer the server and do things like:
+
+* start/stop IMAP/POP3/SMTP components without bringing down the entire server.
+* add/remove users manually
+* much more
+
+Project structure
+=================
+
+* karaf/features - Builds a Karaf features that match James components to easy provision the application
+ http://karaf.apache.org/manual/latest-2.3.x/users-guide/provisioning.html
+* karaf/distribution - Builds a custom Karaf distribution bundled with James components. Uses the James features
+* karaf/integration - Integration tests for deploying James inside Karaf
+
+Build and run
+=============
+
+You can build the project by running the script provided in karaf folder:
+ $ ./build.sh
+
+You can also build each project individually by running **$ mvn clean install** inside each maven project.
+
+You might wish to build the whole James project to ensure all artifacts are available in the local Maven repo. You can
+do that by running **$ mvn clean install** in the project top level directory.
+
+If everything goes well, look for a file called *distribution-VERSION-.tar.gz* under karaf/distribution/target.
+Unpack, change the current directory to be inside the application and run **./bin/karaf**. This will start Karaf and
+present you with a administration console. You are ready to install James features if not already installed and start
+playing with James.
+
+Run **features:install james-server-dnsservice-dnsjava** to provision and start the DNSService that
+James uses to resolve mail hosts. To see the state of things you can run **list**. An output like the following means
+the DNSService has started successfully:
+
+~~~
+ karaf@root> list
+ START LEVEL 100 , List Threshold: 50
+ ID State Blueprint Spring Level Name
+ [ 97] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: commons-configuration (1.9.0.1)
+ [ 98] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: commons-beanutils (1.8.3.1)
+ [ 99] [Active ] [ ] [ ] [ 80] Commons JXPath (1.3)
+ [ 100] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: xmlresolver (1.2.0.5)
+ [ 101] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: commons-collections (3.2.1.3)
+ [ 102] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: jdom (1.1.0.4)
+ [ 103] [Active ] [ ] [ ] [ 80] Commons Codec (1.7.0)
+ [ 104] [Active ] [ ] [ ] [ 80] Commons Lang (2.6)
+ [ 105] [Active ] [ ] [ ] [ 80] Commons Digester (1.8.1)
+ [ 106] [Active ] [ ] [ ] [ 80] Commons JEXL (2.1.1)
+ [ 107] [Active ] [ ] [ ] [ 80] dnsjava (2.1.1)
+ [ 108] [Active ] [ ] [ ] [ 80] Apache ServiceMix :: Bundles :: junit (4.11.0.1)
+ [ 109] [Active ] [ ] [ ] [ 80] Apache James :: Server :: DNS Service :: Library (3.0.0.beta5-SNAPSHOT)
+ [ 110] [Active ] [ ] [ ] [ 80] Apache James :: Server :: DNS Service :: API (3.0.0.beta5-SNAPSHOT)
+ [ 111] [Active ] [ ] [ ] [ 80] Apache James :: Mailet API (2.5.1.SNAPSHOT)
+ [ 112] [Active ] [ ] [ ] [ 80] Geronimo JavaMail 1.4 :: Mail (1.8.3)
+ [ 113] [Active ] [ ] [Started] [ 80] Apache James :: Server :: DNS Service :: Implementation (3.0.0.beta5-SNAPSHOT)
+ [ 114] [Active ] [ ] [ ] [ 80] Apache James :: Server :: Lifecycle API (3.0.0.beta5-SNAPSHOT)
+~~~
+
+If necessary, you can check the logs with **log:display**. You can also dynamically change the logging level via
+**log:set**. These are all Karaf related things and you should check them out http://karaf.apache.org/manual/latest-2.3.x/commands/commands.html
+
+
+
+
+
Modified: james/server/trunk/karaf/distribution/src/main/filtered-resources/etc/org.apache.karaf.features.cfg
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/distribution/src/main/filtered-resources/etc/org.apache.karaf.features.cfg?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/karaf/distribution/src/main/filtered-resources/etc/org.apache.karaf.features.cfg (original)
+++ james/server/trunk/karaf/distribution/src/main/filtered-resources/etc/org.apache.karaf.features.cfg Thu Feb 7 11:15:16 2013
@@ -25,4 +25,4 @@ featuresRepositories=mvn:org.apache.jame
#
# Comma separated list of features to install at startup
#
-featuresBoot=config,ssh,management,kar,war
+featuresBoot=config,ssh,management,kar,spring-dm,war
Modified: james/server/trunk/karaf/features/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/features/pom.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/karaf/features/pom.xml (original)
+++ james/server/trunk/karaf/features/pom.xml Thu Feb 7 11:15:16 2013
@@ -20,6 +20,7 @@
<mime4j.version>0.7.2</mime4j.version>
<jutf7.version>1.0.0</jutf7.version>
<commons-dbcp-bundle.version>1.4_3</commons-dbcp-bundle.version>
+ <commons-configuration-osgi.version>1.9_1</commons-configuration-osgi.version>
</properties>
<build>
@@ -67,12 +68,6 @@
<!--</executions>-->
<!--</plugin>-->
- <!--
- TODO: karaf-tooling project makes things easier - need to inspect !
- deploy the feature.xml file in maven repo, install in karaf with:
- features:addurl mvn:com.axemblr.provisionr/provisionr-features/0.0.1-SNAPSHOT/xml/features
- features:install <feature-name>
- -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Modified: james/server/trunk/karaf/features/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/features/src/main/resources/features.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/karaf/features/src/main/resources/features.xml (original)
+++ james/server/trunk/karaf/features/src/main/resources/features.xml Thu Feb 7 11:15:16 2013
@@ -10,9 +10,14 @@
<!-- james 3.0-beta5 features -->
<feature name="james-server-lifecycle-api" version="${project.version}">
+<<<<<<< HEAD
<bundle>mvn:org.apache.james/james-server-lifecycle-api/${project.version}</bundle>
<feature version="${commons-configuration-osgi.version}">commons-configuration</feature>
<bundle>mvn:org.slf4j/slf4j-api/${slf4j.version}</bundle>
+=======
+ <bundle dependency="true">mvn:org.apache.james/james-server-lifecycle-api/${project.version}</bundle>
+ <feature version="${commons-configuration-osgi.version}">commons-configuration</feature>
+>>>>>>> karafs
</feature>
<feature name="james-server-filesystem-api" version="${project.version}">
@@ -92,7 +97,13 @@
</feature>
<feature name="james-server-dnsservice-dnsjava" version="${project.version}">
+<<<<<<< HEAD
<feature version="${commons-configuration-osgi.version}">commons-configuration</feature>
+=======
+ <feature>commons-configuration</feature>
+ <feature>dnsjava-2.1.1</feature>
+ <feature>james-server-dnsservice-library</feature>
+>>>>>>> karafs
<bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-api/${project.version}</bundle>
<bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-dnsjava/${project.version}</bundle>
<bundle dependency="true">mvn:org.apache.james/apache-mailet-api/${mailet.version}</bundle>
@@ -103,10 +114,17 @@
</feature>
<feature name="james-server-dnsservice-library" version="${project.version}">
+<<<<<<< HEAD
<bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-library/${project.version}</bundle>
<bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-api/${project.version}</bundle>
<bundle dependency="true">mvn:org.apache.james/apache-mailet-api/${mailet.version}</bundle>
<bundle dependency="true">mvn:org.slf4j/slf4j-api/${slf4j.version}</bundle>
+=======
+ <feature>dnsjava-2.1.1</feature>
+ <bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-library/${project.version}</bundle>
+ <bundle dependency="true">mvn:org.apache.james/james-server-dnsservice-api/${project.version}</bundle>
+ <bundle dependency="true">mvn:org.apache.james/apache-mailet-api/${mailet.version}</bundle>
+>>>>>>> karafs
<bundle dependency="true">
mvn:org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/${geronimo-javamail.version}
</bundle>
@@ -278,7 +296,6 @@
<feature version="${commons-configuration-osgi.version}">commons-configuration</feature>
<bundle>mvn:commons-io/commons-io/${commons-io.version}</bundle>
<bundle>mvn:org.apache.james.protocols/protocols-netty/${protocols.version}</bundle>
- <bundle>mvn:org.slf4j/slf4j-api/${slf4j.version}</bundle>
<bundle>mvn:io.netty/netty/${netty.version}</bundle>
<bundle>mvn:org.apache.geronimo.specs/geronimo-annotation_1.1_spec/${geronimo-annotation-spec.version}</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jutf7/1.0.0_0-SNAPSHOT</bundle>
@@ -325,15 +342,14 @@
<bundle>mvn:org.apache.geronimo.javamail/geronimo-javamail_1.4_mail/${geronimo-javamail.version}</bundle>
<bundle>mvn:org.apache.geronimo.specs/geronimo-annotation_1.1_spec/${geronimo-annotation-spec.version}</bundle>
<bundle>mvn:io.netty/netty/${netty.version}</bundle>
- <bundle>mvn:org.slf4j/slf4j-api/${slf4j.version}</bundle>
</feature>
<feature name="commons-configuration" version="${commons-configuration-osgi.version}">
<bundle>
- mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-configuration/${commons-configuration-osgi.version}
+ mvn:org.apache.servicemix.bundles/org.apache.servicemmix.bundles.commons-configuration/${commons-configuration-osgi.version}
</bundle>
+ <feature>war</feature>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-beanutils/1.8.3_1</bundle>
- <!--<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-jxpath/1.2_5</bundle>-->
<bundle>mvn:commons-jxpath/commons-jxpath/1.3</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_5</bundle>
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-collections/3.2.1_3</bundle>
Modified: james/server/trunk/karaf/integration/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/integration/pom.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/karaf/integration/pom.xml (original)
+++ james/server/trunk/karaf/integration/pom.xml Thu Feb 7 11:15:16 2013
@@ -16,6 +16,17 @@
<name>Apache James :: Karaf :: Intetgration tests</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-dnsservice-dnsjava</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+
<!-- Pax-Exam dependencies -->
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
Modified: james/server/trunk/karaf/integration/src/test/java/org/apache/james/karaf/karaf/KarafFeatureInstallTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/karaf/integration/src/test/java/org/apache/james/karaf/karaf/KarafFeatureInstallTest.java?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/karaf/integration/src/test/java/org/apache/james/karaf/karaf/KarafFeatureInstallTest.java (original)
+++ james/server/trunk/karaf/integration/src/test/java/org/apache/james/karaf/karaf/KarafFeatureInstallTest.java Thu Feb 7 11:15:16 2013
@@ -1,12 +1,17 @@
package org.apache.james.karaf.karaf;
+import com.google.common.base.Stopwatch;
+import org.apache.james.dnsservice.api.DNSService;
import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeaturesService;
+import org.apache.karaf.tooling.exam.options.KarafDistributionConfigurationFilePutOption;
import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.keepRuntimeFolder;
import static org.apache.karaf.tooling.exam.options.KarafDistributionOption.logLevel;
import org.apache.karaf.tooling.exam.options.LogLevelOption;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -17,16 +22,19 @@ import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.ExamReactorStrategy;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import java.io.File;
import java.net.URI;
+import java.util.concurrent.TimeUnit;
/**
* Apache James Karaf deployment test.
@@ -35,62 +43,124 @@ import java.net.URI;
@ExamReactorStrategy(AllConfinedStagedReactorFactory.class)
public class KarafFeatureInstallTest {
- private static final Logger LOG = LoggerFactory.getLogger(KarafFeatureInstallTest.class);
- @Inject
- private FeaturesService features;
-
- @Inject
- BundleContext bundleContext;
-
- private String featuresVersion;
-
- @Configuration
- public static Option[] configuration() throws Exception {
- MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf")
- .artifactId("apache-karaf")
- .version("2.3.0")
- .type("tar.gz");
-
- String jamesFeaturesVersion = MavenUtils.getArtifactVersion("org.apache.james.karaf", "james-karaf-features");
-
- return new Option[]{
- karafDistributionConfiguration().frameworkUrl(karafUrl).karafVersion("2.3.0").name("Apache Karaf")
- .unpackDirectory(new File("target/exam")),
- logLevel(LogLevelOption.LogLevel.INFO),
- // use system property to provide project version for tests
- systemProperty("james-karaf-features").value(jamesFeaturesVersion)
- };
- }
-
- @Before
- public void setUp() {
- featuresVersion = System.getProperty("james-karaf-features");
- }
-
- @Test
- public void shouldInstallAllFeatures() throws Exception {
- String url = maven("org.apache.james.karaf", "james-karaf-features")
- .version(featuresVersion)
- .classifier("features")
- .type("xml")
- .getURL();
-
- features.addRepository(new URI(url));
- features.installFeature("apache-james-mime4j");
- features.installFeature("commons-configuration");
-
- assertInstalled("apache-james-mime4j");
- assertInstalled("commons-configuration");
-
- for (Bundle bundle : bundleContext.getBundles()) {
- LOG.info("***** bundle {} is {}", bundle.getSymbolicName(), bundle.getState());
- assertEquals("Bundle " + bundle.getSymbolicName() + " is not active",
- Bundle.ACTIVE, bundle.getState());
- }
- }
-
- private void assertInstalled(String featureName) throws Exception {
- Feature feature = features.getFeature(featureName);
- assertTrue("Feature " + featureName + " should be installed", features.isInstalled(feature));
- }
+ private static final Logger LOG = LoggerFactory.getLogger(KarafFeatureInstallTest.class);
+ @Inject
+ private FeaturesService features;
+
+ @Inject
+ BundleContext bundleContext;
+
+ private String featuresVersion;
+
+ @Configuration
+ public static Option[] configuration() throws Exception {
+ MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf")
+ .artifactId("apache-karaf")
+ .version("2.3.0")
+ .type("tar.gz");
+
+ String jamesFeaturesVersion = MavenUtils.getArtifactVersion("org.apache.james.karaf", "james-karaf-features");
+
+ return new Option[]{
+ karafDistributionConfiguration().frameworkUrl(karafUrl).karafVersion("2.3.0").name("Apache Karaf")
+ .unpackDirectory(new File("target/exam")),
+ logLevel(LogLevelOption.LogLevel.INFO),
+ new KarafDistributionConfigurationFilePutOption("etc/custom.properties",
+ "org.osgi.framework.system.packages.extra",
+ "sun.net.spi.nameservice"),
+ keepRuntimeFolder(),
+ new MavenArtifactProvisionOption().groupId("com.google.guava").artifactId("guava").versionAsInProject(),
+ // use system property to provide project version for tests
+ systemProperty("james-karaf-features").value(jamesFeaturesVersion)
+ };
+ }
+
+ @Before
+ public void setUp() {
+ featuresVersion = System.getProperty("james-karaf-features");
+ }
+
+ @Test
+ public void testInstallCommonsConfigurationFeature() throws Exception {
+ addJamesFeaturesRepository();
+ features.installFeature("commons-configuration");
+ assertInstalled("commons-configuration");
+ assertBundlesAreActive();
+ }
+
+ @Test
+ public void testInstallApacheMime4jFeature() throws Exception {
+ addJamesFeaturesRepository();
+ features.installFeature("apache-james-mime4j");
+ assertInstalled("apache-james-mime4j");
+ assertBundlesAreActive();
+ }
+
+ @Test
+ public void testInstallJamesDnsServiceDnsJava() throws Exception {
+ addJamesFeaturesRepository();
+ features.installFeature("james-server-dnsservice-dnsjava");
+ assertInstalled("james-server-dnsservice-dnsjava");
+ assertBundlesAreActive();
+ assertOSGiServiceStartsIn(DNSService.class, 30000);
+ }
+
+ private void assertInstalled(String featureName) throws Exception {
+ Feature feature = features.getFeature(featureName);
+ assertTrue("Feature " + featureName + " should be installed", features.isInstalled(feature));
+ }
+
+ private void assertBundlesAreActive() {
+ for (Bundle bundle : bundleContext.getBundles()) {
+ LOG.info("***** bundle {} is {}", bundle.getSymbolicName(), bundle.getState());
+ assertEquals("Bundle " + bundle.getSymbolicName() + " is not active",
+ Bundle.ACTIVE, bundle.getState());
+ }
+ }
+
+ private void addJamesFeaturesRepository() throws Exception {
+ String url = maven("org.apache.james.karaf", "james-karaf-features")
+ .version(featuresVersion)
+ .classifier("features")
+ .type("xml")
+ .getURL();
+
+ features.addRepository(new URI(url));
+ features.installFeature("spring-dm");
+ features.installFeature("war");
+ }
+
+ private void assertOSGiServiceStartsIn(Class clazz, int timeoutInMilliseconds) throws InterruptedException {
+ final ServiceTracker tracker = new ServiceTracker(bundleContext, clazz, null);
+ tracker.open(true);
+ try {
+ final Stopwatch stopwatch = new Stopwatch().start();
+ final int expectedCount = 1;
+
+ while (true) {
+ Object[] services = tracker.getServices();
+ if (services == null || services.length < expectedCount) {
+ final int actualCount = (services == null) ? 0 : services.length;
+ if (stopwatch.elapsedMillis() > timeoutInMilliseconds) {
+ fail(String.format("Expected to find %d services of type %s. Found only %d in %d milliseconds",
+ expectedCount, clazz.getCanonicalName(), actualCount, timeoutInMilliseconds));
+ }
+
+ LOG.info(String.format("Found %d services implementing %s. Trying again in 1s.",
+ actualCount, clazz.getCanonicalName()));
+ TimeUnit.SECONDS.sleep(1);
+
+ } else if (services.length > expectedCount) {
+ fail(String.format("Expected to find %d services implementing %s. Found %d (more than expected).",
+ expectedCount, clazz.getCanonicalName(), services.length));
+
+ } else if (services.length == expectedCount) {
+ break; /* done - the test was successful */
+ }
+ }
+
+ } finally {
+ tracker.close();
+ }
+ }
}
Modified: james/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/pom.xml?rev=1443412&r1=1443411&r2=1443412&view=diff
==============================================================================
--- james/server/trunk/pom.xml (original)
+++ james/server/trunk/pom.xml Thu Feb 7 11:15:16 2013
@@ -27,7 +27,7 @@
<parent>
<artifactId>james-project</artifactId>
<groupId>org.apache.james</groupId>
- <version>1.8.2-SNAPSHOT</version>
+ <version>1.8.2</version>
<relativePath/>
</parent>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org