directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcon...@apache.org
Subject svn commit: r476568 - in /directory/sandbox/jconlon/osgi-services: ./ logging-service-integration-test/ logging-service-integration-test/src/ logging-service-integration-test/src/main/ logging-service-integration-test/src/main/java/ logging-service-int...
Date Sat, 18 Nov 2006 17:20:51 GMT
Author: jconlon
Date: Sat Nov 18 09:20:50 2006
New Revision: 476568

URL: http://svn.apache.org/viewvc?view=rev&rev=476568
Log:
adding osgi integration tests for logging-service

Added:
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/   (with props)
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/README
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/pom.xml
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/main/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/main/java/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/main/resources/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/LogServiceBundleTest.java
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/
    directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/MANIFEST.MF
Modified:
    directory/sandbox/jconlon/osgi-services/pom.xml

Propchange: directory/sandbox/jconlon/osgi-services/logging-service-integration-test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Nov 18 09:20:50 2006
@@ -0,0 +1,5 @@
+target
+.settings
+.wtpmodules
+.classpath
+.project

Added: directory/sandbox/jconlon/osgi-services/logging-service-integration-test/README
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/logging-service-integration-test/README?view=auto&rev=476568
==============================================================================
--- directory/sandbox/jconlon/osgi-services/logging-service-integration-test/README (added)
+++ directory/sandbox/jconlon/osgi-services/logging-service-integration-test/README Sat Nov
18 09:20:50 2006
@@ -0,0 +1,14 @@
+Note on running the logging-service-integration-test.
+====================================================
+The normal convention for configuring log4j with the
+logging-service bundle is to place a log4j.properties
+file in the conf directory. If this convention is 
+followed the spring-osgi based integration tests in
+this project will encounter a classloading conflict
+and fail to load the configuration.  This issue is 
+only problem with the test suite and is not the case
+for production usage of the logging-service bundle.
+
+To workaround do not use a log4j.properties file and
+allow the bundle to do a basic configuration as the
+default. 

Added: directory/sandbox/jconlon/osgi-services/logging-service-integration-test/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/logging-service-integration-test/pom.xml?view=auto&rev=476568
==============================================================================
--- directory/sandbox/jconlon/osgi-services/logging-service-integration-test/pom.xml (added)
+++ directory/sandbox/jconlon/osgi-services/logging-service-integration-test/pom.xml Sat Nov
18 09:20:50 2006
@@ -0,0 +1,189 @@
+<?xml version="1.0"?>
+<project>
+	<modelVersion>4.0.0</modelVersion>
+<!--
+	<parent>
+		<groupId>org.apache.directory.osgi.services</groupId>
+		<artifactId>build</artifactId>
+		<version>1.0.6-SNAPSHOT</version>
+	</parent>
+	-->
+	<groupId>org.apache.directory.osgi.services</groupId>
+	<version>1.0.6-SNAPSHOT</version>
+
+	<description>
+        OSGi integration tests for the logging-service. 
+        </description>
+	
+	<artifactId>logging-service-integration-test</artifactId>
+	
+	<name>${pom.artifactId} suite</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>javax.servlet</artifactId>
+			<version>0.8.0-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+			<version>0.8.0-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.osgi.services</groupId>
+			<artifactId>logging-service</artifactId>
+			<version>1.0.6-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.directory.osgi.commons</groupId>
+			<artifactId>commons-collections-osgi</artifactId>
+			<version>3.2</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.osgi</groupId>
+			<artifactId>org.springframework.osgi.test</artifactId>
+			<version>1.0-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.osgi</groupId>
+			<artifactId>spring-core</artifactId>
+			<version>2.1-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.osgi</groupId>
+			<artifactId>spring-context</artifactId>
+			<version>2.1-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.osgi</groupId>
+			<artifactId>spring-beans</artifactId>
+			<version>2.1-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		
+
+	</dependencies>
+
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+      <!-- run tests during the integration-test phase, not the normal test phase -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skip>true</skip>
+				</configuration>
+				<executions>
+					<execution>
+						<id>default</id>
+						<phase>test</phase>
+						<goals></goals>
+					</execution>
+					<execution>
+						<id>integration-test</id>
+						<phase>integration-test</phase>
+						<goals>
+							<goal>test</goal>
+						</goals>
+						<configuration>
+							<skip>false</skip>
+							<forkMode>pertest</forkMode>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+	<profiles>
+		<profile>
+			<id>equinox</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<dependencies>
+				<dependency>
+					<groupId>org.eclipse.equinox</groupId>
+					<artifactId>org.eclipse.osgi</artifactId>
+					<version>3.2.0</version>
+					<type>jar</type>
+					<scope>provided</scope>
+				</dependency>
+			</dependencies>
+			<properties>
+				<osgi.test.platform>equinox</osgi.test.platform>
+			</properties>
+		</profile>
+		<profile>
+			<id>knopflerfish</id>
+			<dependencies>
+				<dependency>
+					<groupId>org.knopflerfish</groupId>
+					<artifactId>framework</artifactId>
+					<version>2.0.1</version>
+					<type>jar</type>
+					<scope>provided</scope>
+				</dependency>
+			</dependencies>
+			<properties>
+				<osgi.test.platform>knopflerfish</osgi.test.platform>
+			</properties>
+		</profile>
+		<profile>
+			<id>felix</id>
+			<dependencies>
+				<dependency>
+					<groupId>org.apache.felix</groupId>
+					<artifactId>org.apache.felix.framework</artifactId>
+					<version>0.8.0-SNAPSHOT</version>
+					<type>jar</type>
+					<scope>provided</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.apache.felix</groupId>
+					<artifactId>org.apache.felix.main</artifactId>
+					<version>0.8.0-SNAPSHOT</version>
+					<type>jar</type>
+					<scope>provided</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.apache.felix</groupId>
+					<artifactId>org.osgi.core</artifactId>
+					<version>0.8.0-SNAPSHOT</version>
+					<type>jar</type>
+					<scope>runtime</scope>
+				</dependency>
+			</dependencies>
+			<properties>
+				<osgi.test.platform>felix</osgi.test.platform>
+		<!-- <org.osgi.vendor.framework>org.apache.felix.framework</org.osgi.vendor.framework>
 -->
+			</properties>
+		</profile>
+	</profiles>
+</project>
\ No newline at end of file

Added: directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/LogServiceBundleTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/LogServiceBundleTest.java?view=auto&rev=476568
==============================================================================
--- directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/LogServiceBundleTest.java
(added)
+++ directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/java/org/apache/directory/osgi/services/logging/test/LogServiceBundleTest.java
Sat Nov 18 09:20:50 2006
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2006 the original author or authors.
+ * 
+ * Licensed 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.
+ */
+package org.apache.directory.osgi.services.logging.test;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.osgi.test.ConfigurableBundleCreatorTests;
+
+
+
+/**
+ * Starts up an OSGi environment (equinox, knopflerfish, or felix according to
+ * the profile selected) and installs the simple service bundle and the bundles
+ * it depends on. The test classes in this project will be turned into a virtual
+ * bundle which is also installed and the tests are then run inside the OSGi
+ * runtime.
+ * 
+ * The tests have access to a BundleContext, which we use to test that the
+ * LogService was indeed published as an OSGi service.
+ * 
+ * 
+ */
+public class LogServiceBundleTest extends
+        ConfigurableBundleCreatorTests {
+    /** the log for this class */
+    
+    LogService logService;
+
+    
+    /**
+     * The manifest to use for the "virtual bundle" created out of the test
+     * classes and resources in this project
+     * 
+     * This is actually the boilerplate manifest with one additional
+     * import-package added. We should provide a simpler customization point for
+     * such use cases that doesn't require duplication of the entire manifest...
+     */
+    protected String getManifestLocation() {
+        return "classpath:org/apache/directory/osgi/services/logging/test/MANIFEST.MF";
+    }
+
+    /**
+     * The location of the packaged OSGi bundles to be installed for this test.
+     * Values are Spring resource paths. The bundles we want to use are part of
+     * the same multi-project maven build as this project is. Hence we use the
+     * localMavenArtifact helper method to find the bundles produced by the
+     * package phase of the maven build (these tests will run after the
+     * packaging phase, in the integration-test phase).
+     * 
+     * JUnit, commons-logging, spring-core and the spring OSGi test bundle are
+     * automatically included so do not need to be specified here.
+     */
+    protected String[] getBundleLocations() {
+        return new String[] {
+            localMavenArtifact("org.springframework.osgi", "aopalliance.osgi","1.0-SNAPSHOT"),
+            localMavenArtifact("org.springframework.osgi", "spring-context", "2.1-SNAPSHOT"),
+            localMavenArtifact("org.springframework.osgi", "spring-beans","2.1-SNAPSHOT"),
+            localMavenArtifact("org.springframework.osgi", "spring-osgi-core","1.0-SNAPSHOT"),
+            localMavenArtifact("org.springframework.osgi", "spring-aop","2.1-SNAPSHOT"),
+            localMavenArtifact("org.apache.directory.osgi.commons","jzlib-osgi", "1.0.7"),
+            localMavenArtifact("org.apache.felix", "javax.servlet", "0.8.0-SNAPSHOT"),
+            localMavenArtifact("org.apache.felix","org.osgi.compendium", "0.8.0-SNAPSHOT"),
+            localMavenArtifact("org.apache.directory.osgi.services","logging-service", "1.0.6-SNAPSHOT")
+        };
+    }
+
+    /**
+     * The superclass provides us access to the root bundle context via the
+     * 'getBundleContext' operation
+     */
+    public void testOSGiStartedOk() {
+        BundleContext bundleContext = getBundleContext();
+        assertNotNull(bundleContext);
+        
+        assertEquals(17,bundleContext.getBundles().length);
+    }
+
+    /**
+     * The LogService should have been exported as an OSGi service, which we
+     * can verify using the OSGi service APIs.
+     * 
+     * In a Spring bundle, using osgi:reference is a much easier way to get a
+     * reference to a published service.
+     * 
+     */
+    public void testLogService() {
+        BundleContext context = getBundleContext();
+        ServiceReference ref = context.getServiceReference(LogService.class
+                .getName());
+        assertNotNull("Service Reference is null", ref);
+        
+        try {
+            logService = (LogService) context.getService(ref);
+            assertNotNull("Cannot find the service", logService);
+            logService.log(LogService.LOG_WARNING,"Found LogService. ");
+            Bundle[] bundles = context.getBundles();
+            logService.log(LogService.LOG_DEBUG, "Loaded bundles:");
+            for (Bundle bundle : bundles) {
+                logService.log(LogService.LOG_DEBUG, bundle.getSymbolicName());
+            }
+        } finally {
+            context.ungetService(ref);
+        }
+       Logger log = LoggerFactory
+       .getLogger(LogServiceBundleTest.class);;
+      
+      log.info("A slf4j logger works too.");
+  }
+    
+    
+  
+ 
+  
+ 
+}

Added: directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/MANIFEST.MF?view=auto&rev=476568
==============================================================================
--- directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/MANIFEST.MF
(added)
+++ directory/sandbox/jconlon/osgi-services/logging-service-integration-test/src/test/resources/org/apache/directory/osgi/services/logging/test/MANIFEST.MF
Sat Nov 18 09:20:50 2006
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-Name: simple-service-integration-tests
+Bundle-SymbolicName: org.springframework.osgi.samples.simpleservice.test
+Bundle-Vendor: Spring Framework
+Bundle-Activator: org.springframework.osgi.test.JUnitTestActivator
+Import-Package: junit.framework,
+ org.osgi.framework;specification-version="1.3.0",
+ org.springframework.core.io;specification-version="2.1.0",
+ org.springframework.osgi.test,
+ org.springframework.osgi.test.runner,
+ org.osgi.service.log,
+ org.slf4j,
+ org.apache.log4j
+ 
+ 
+      

Modified: directory/sandbox/jconlon/osgi-services/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/jconlon/osgi-services/pom.xml?view=diff&rev=476568&r1=476567&r2=476568
==============================================================================
--- directory/sandbox/jconlon/osgi-services/pom.xml (original)
+++ directory/sandbox/jconlon/osgi-services/pom.xml Sat Nov 18 09:20:50 2006
@@ -18,6 +18,7 @@
   
   <modules>
     <module>logging-service</module>
+    <module>logging-service-integration-test</module>
   </modules>
   
 </project>



Mime
View raw message