You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/27 16:51:10 UTC
svn commit: r1450816 [1/7] - in /felix/trunk/ipojo/handler/eventadmin: ./
doc/ eventadmin-handler-it/ eventadmin-handler-it/src/
eventadmin-handler-it/src/it/ eventadmin-handler-it/src/it/event-admin-it/
eventadmin-handler-it/src/it/event-admin-it/src/...
Author: clement
Date: Wed Feb 27 15:51:08 2013
New Revision: 1450816
URL: http://svn.apache.org/r1450816
Log:
FELIX-3903 - Restructuration of the event admin handler project and migration of the tests to pax exam 3
Added:
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/ (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/ (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ipojo-event-admin-integration-test.iml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/SimpleTest.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/DEPENDENCIES
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/LICENSE
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/NOTICE
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/changelog.txt
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers.html
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/apache.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/button.html
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/button_data/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/button_data/2009-europe-125x125.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/feed-icon-32x32.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/footer.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/ga.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/handler-arch.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/header.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/hoverIntent.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/information.gif (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/ipojo.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/jquery-1.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/linkext7.gif (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/logo.png (with props)
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushCSharp.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushDelphi.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushJScript.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushJava.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushPhp.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushPython.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushShell.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushSql.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushVb.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shBrushXml.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/shCore.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/site.css
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/superfish.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/doc/event-admin-handlers_files/supersubs.js
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/obr.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/pom.xml
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/
felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd
Removed:
felix/trunk/ipojo/handler/eventadmin/doc/
felix/trunk/ipojo/handler/eventadmin/metadata.xml
felix/trunk/ipojo/handler/eventadmin/obr.xml
felix/trunk/ipojo/handler/eventadmin/src/
Modified:
felix/trunk/ipojo/handler/eventadmin/ (props changed)
felix/trunk/ipojo/handler/eventadmin/pom.xml
Propchange: felix/trunk/ipojo/handler/eventadmin/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Feb 27 15:51:08 2013
@@ -8,3 +8,5 @@ bin
.classpath
.project
org.apache.felix.ipojo.handler.eventadmin.iml
+*.iml
+.idea
Propchange: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Feb 27 15:51:08 2013
@@ -0,0 +1,3 @@
+target
+.idea
+*.iml
Propchange: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Feb 27 15:51:08 2013
@@ -0,0 +1,3 @@
+target
+.idea
+*.iml
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml Wed Feb 27 15:51:08 2013
@@ -0,0 +1,344 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <groupId>org.apache.felix</groupId>
+ <name>Apache Felix iPOJO Event Admin Handler - Integration Test</name>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+
+ <properties>
+ <exam.version>3.0.0</exam.version>
+ <url.version>1.5.1</url.version>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin</artifactId>
+ <version>${project.version}</version>
+ <!--
+ The event admin handler depends on an older version of the compendium and core, to avoid issue during
+ tests, we must exclude those artifacts and trust the framework to provide the right / compatible
+ version
+ -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>1.8.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-native</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-aether</artifactId>
+ <version>${url.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>0.9.20</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>0.9.20</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.ops4j.pax.tinybundles</groupId>
+ <artifactId>tinybundles</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>osgi-helpers</artifactId>
+ <version>0.6.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.ow2.chameleon.testing</groupId>
+ <artifactId>tinybundles-ipojo</artifactId>
+ <version>0.3.0</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-wrap</artifactId>
+ <version>1.5.2</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-config</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>test</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>regular</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/regular</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>test-all</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ <configuration>
+ <streamLogs>true</streamLogs>
+ <goals>
+ <goal>clean</goal>
+ <goal>test</goal>
+ </goals>
+ <cloneClean>true</cloneClean>
+ </configuration>
+ <executions>
+ <execution>
+ <id>equinox-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>equinox</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/equinox-native</cloneProjectsTo>
+
+ </configuration>
+ </execution>
+ <execution>
+ <id>felix-native</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <profiles>
+ <profile>felix</profile>
+ </profiles>
+ <cloneProjectsTo>${project.build.directory}/felix-native</cloneProjectsTo>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>knopflerfish</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>knopflerfish</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>knopflerfish</pax.exam.framework>
+ </properties>
+ <repositories>
+ <repository>
+ <id>knopflerfish-releases</id>
+ <url>http://www.knopflerfish.org/maven2</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.knopflerfish</groupId>
+ <artifactId>framework</artifactId>
+ <version>5.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>equinox</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>equinox</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>equinox</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.8.1.v20120830-144521</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>felix</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>pax.exam.framework</name>
+ <value>felix</value>
+ </property>
+ </activation>
+ <properties>
+ <pax.exam.framework>felix</pax.exam.framework>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ </profiles>
+</project>
Propchange: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Feb 27 15:51:08 2013
@@ -0,0 +1,3 @@
+target
+*.iml
+.idea
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ipojo-event-admin-integration-test.iml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ipojo-event-admin-integration-test.iml?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ipojo-event-admin-integration-test.iml (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/ipojo-event-admin-integration-test.iml Wed Feb 27 15:51:08 2013
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.handler.eventadmin:@project.version@" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-container-native:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam:3.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-lang:1.3.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-store:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.5.11" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-io:1.2.3" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-monitors:1.3.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-util-property:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-spi:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-spi:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.guava:guava:12.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.tinybundles:tinybundles:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: biz.aQute:bndlib:1.43.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.glassfish.main.common:scattered-archive-api:3.1.2.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-core:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-lifecycle:1.6.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-tracker:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.base:ops4j-base-net:1.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-link:1.5.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.url:pax-url-commons:1.5.1" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-property:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-classpath:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-optional-jcl:1.5.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-junit4:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.exam:pax-exam-link-mvn:3.0.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-aether:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.pax.url:pax-url-maven-commons:1.5.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-xml:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ops4j.base:ops4j-base-util-collections:1.3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.aether:aether-connector-wagon:1.13.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-utils:3.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.2.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.0.3" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-aether-provider:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-model-builder:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven:maven-repository-metadata:3.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-file:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-shared:1.0-beta-7" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-container-default:1.5.5" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.xbean:xbean-reflect:3.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: com.google.collections:google-collections:1.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-logging:commons-logging:1.0.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.framework:4.2.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-core:0.9.6" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: ch.qos.logback:logback-classic:0.9.6" level="project" />
+ <orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.5" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo:1.8.6" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.osgi:org.osgi.compendium:4.0.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.metadata:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.manipulator:1.8.6" level="project" />
+ <orderEntry type="library" name="Maven: asm:asm-all:3.3.1" level="project" />
+ <orderEntry type="library" name="Maven: org.apache.felix:org.apache.felix.ipojo.annotations:1.8.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apache.felix:org.apache.felix.configadmin:1.6.0" level="project" />
+ <orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.ow2.chameleon.testing:osgi-helpers:0.6.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ow2.chameleon.testing:tinybundles-ipojo:0.3.0" level="project" />
+ <orderEntry type="library" name="Maven: xerces:xercesImpl:2.4.0" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.url:pax-url-wrap:1.5.2" level="project" />
+ <orderEntry type="library" name="Maven: org.ops4j.pax.swissbox:pax-swissbox-bnd:1.5.0" level="project" />
+ </component>
+</module>
+
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml Wed Feb 27 15:51:08 2013
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.handler.eventadmin-it</artifactId>
+ <version>1.9.0-SNAPSHOT</version>
+ <relativePath>../../../pom.xml</relativePath>
+ </parent>
+
+
+ <artifactId>ipojo-event-admin-integration-test</artifactId>
+ <name>${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of an event vendor that directly uses the Event Admin service
+ * to post (asynchronously) raw events.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AsyncEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The Event Admin service reference.
+ */
+ private EventAdmin m_ea;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public AsyncEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ rawEvent.put("food", donut);
+ m_ea.postEvent(new Event("food/donuts", rawEvent));
+ return donut;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+/**
+ * Donut representation.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Donut {
+
+ /**
+ * All possible donut flavours.
+ */
+ public static final String[] FLAVOURS = { "unflavoured", "icing sugar",
+ "chocolate", "toffee", "strawberry", "apple" };
+
+ /**
+ * The vendor's unique donut identifier.
+ */
+ private final long m_id;
+
+ /**
+ * The name of this donut's vendor.
+ */
+ private final String m_vendorName;
+
+ /**
+ * The m_flavour of this donut.
+ */
+ private final String m_flavour;
+
+ /**
+ * Create a new donut.
+ *
+ * @param id
+ * the vendor's unique donut identifier
+ * @param vendorName
+ * the name of this donut's vendor
+ * @param flavour
+ * the m_flavour of this donut
+ */
+ public Donut(long id, String vendorName, String flavour) {
+ this.m_id = id;
+ this.m_vendorName = vendorName;
+ this.m_flavour = flavour;
+ }
+
+ /**
+ * Get the vendor's unique identifier of this donut.
+ *
+ * @return the id
+ */
+ public long getId() {
+ return m_id;
+ }
+
+ /**
+ * Get the vendor name of this donut.
+ *
+ * @return the name
+ */
+ public String getVendorName() {
+ return m_vendorName;
+ }
+
+ /**
+ * Get the flavour of this donut.
+ *
+ * @return the flavour
+ */
+ public String getFlavour() {
+ return m_flavour;
+ }
+
+ /**
+ * Return the string representation of this donut.
+ *
+ * @return this donut as a String
+ */
+ public String toString() {
+ return m_id + " " + m_flavour + " (" + m_vendorName + ")";
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+/**
+ * Specification of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface DonutConsumer {
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut
+ * the received donut
+ */
+ void receiveDonut(Donut donut);
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event
+ * the received event
+ */
+ void receiveEvent(Event event);
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ void clearDonuts();
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ Donut getDonut();
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ Donut[] getAllDonuts();
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ Donut waitForDonut();
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ int getNumberOfDonuts();
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,194 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see Homer Simpson
+ */
+public class DonutConsumerImpl implements DonutConsumer {
+
+
+ /**
+ * The time that is normally necessary to cause a blacklist from the event
+ * admin service.
+ */
+ public static final long BLACK_LIST_TIME = 5000L;
+ /**
+ * The name of the donut consumer.
+ */
+ private String m_name;
+ /**
+ * The list of eaten donuts.
+ */
+ private List m_donuts = new ArrayList();
+ /**
+ * Is this consumer a slow eater ?
+ */
+ private boolean m_isSlow;
+
+ /**
+ * Utility method that causes the current thread to sleep.
+ *
+ * @param millis the number of milliseconds to wait
+ */
+ public static void sleep(long millis) {
+ long past = System.currentTimeMillis();
+ long future = past + millis;
+ long now = past;
+ while (now < future) {
+ try {
+ Thread.sleep(future - now);
+ } catch (Exception e) {
+ }
+ now = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Process incoming donuts. This method is called by the receiveDonut
+ * callback.
+ *
+ * @param donut the received donut
+ */
+ private void doReceiveDonut(Donut donut) {
+ synchronized (m_donuts) {
+ m_donuts.add(donut);
+ m_donuts.notify();
+ }
+ }
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut the received donut
+ */
+ public void receiveDonut(Donut donut) {
+ final Donut myDonut = donut;
+ if (m_isSlow) {
+ new Thread(new Runnable() {
+ public void run() {
+ sleep(BLACK_LIST_TIME);
+ doReceiveDonut(myDonut);
+ }
+ }, m_name + " eating " + donut).start();
+ } else {
+ doReceiveDonut(donut);
+ }
+ }
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event the received event
+ */
+ public void receiveEvent(Event event) {
+ Object thing = event.getProperty("food");
+ if (Donut.class.isInstance(thing)) {
+ receiveDonut((Donut) thing);
+ } else {
+ // Nothing.
+ }
+ }
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ public void clearDonuts() {
+ synchronized (m_donuts) {
+ m_donuts.clear();
+ }
+ }
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ public Donut getDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ if (!m_donuts.isEmpty()) {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ public Donut[] getAllDonuts() {
+ Donut[] donuts = new Donut[0];
+ synchronized (m_donuts) {
+ donuts = (Donut[]) m_donuts.toArray(donuts);
+ m_donuts.clear();
+ }
+ return donuts;
+ }
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ public Donut waitForDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ while (donut == null) {
+ if (m_donuts.isEmpty()) {
+ try {
+ m_donuts.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ public int getNumberOfDonuts() {
+ int length;
+ synchronized (m_donuts) {
+ length = m_donuts.size();
+ }
+ return length;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.apache.felix.ipojo.handlers.event.publisher.Publisher;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of a donut vendor that send raw events instead of sending
+ * Donut objects.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class DonutEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The event publisher of the donut vendor.
+ */
+ private Publisher m_publisher;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public DonutEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ String flavour = Donut.FLAVOURS[m_random.nextInt(Donut.FLAVOURS.length)];
+ Donut donut = new Donut(m_serial++, m_name, flavour);
+ rawEvent.put("food", donut);
+ rawEvent.put("flavour", flavour);
+ m_publisher.send(rawEvent);
+ return donut;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+/**
+ * Specification of a donut vendor.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ *
+ */
+public interface DonutProvider {
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ Donut sellDonut();
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.apache.felix.ipojo.handlers.event.publisher.Publisher;
+
+import java.util.Random;
+
+/**
+ * The standard implementation of a donut vendor.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ *
+ */
+public class DonutProviderImpl implements DonutProvider {
+
+
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+
+ /**
+ * The donut publisher of the vendor.
+ */
+ private Publisher m_publisher;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public DonutProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ m_publisher.sendData(donut);
+ System.err.println("[" + this.getClass().getSimpleName() + ":"
+ + m_name + "] Selling donut " + donut);
+ return donut;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,199 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of a donut consumer.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see Homer Simpson
+ */
+public class EventConsumerImpl implements DonutConsumer, EventHandler {
+
+ /**
+ * The name of the donut consumer.
+ */
+ private String m_name;
+ /**
+ * The list of eaten donuts.
+ */
+ private List m_donuts = new ArrayList();
+ /**
+ * Is this consumer a slow eater ?
+ */
+ private boolean m_isSlow;
+
+ /**
+ * Utility method that causes the current thread to sleep.
+ *
+ * @param millis the number of milliseconds to wait
+ */
+ public static void sleep(long millis) {
+ long past = System.currentTimeMillis();
+ long future = past + millis;
+ long now = past;
+ while (now < future) {
+ try {
+ Thread.sleep(future - now);
+ } catch (Exception e) {
+ }
+ now = System.currentTimeMillis();
+ }
+ }
+
+ /**
+ * Process incoming donuts. This method is called by the receiveDonut
+ * callback.
+ *
+ * @param donut the received donut
+ */
+ private void doReceiveDonut(Donut donut) {
+ synchronized (m_donuts) {
+ m_donuts.add(donut);
+ m_donuts.notify();
+ }
+ }
+
+ /**
+ * Donut receiver callback. This method is called when a donut is received
+ * on the listened topic.
+ *
+ * @param donut the received donut
+ */
+ public void receiveDonut(Donut donut) {
+ final Donut myDonut = donut;
+ if (m_isSlow) {
+ new Thread(new Runnable() {
+ public void run() {
+ sleep(DonutConsumerImpl.BLACK_LIST_TIME);
+ doReceiveDonut(myDonut);
+ }
+ }, m_name + " eating " + donut).start();
+ } else {
+ doReceiveDonut(donut);
+ }
+ }
+
+ /**
+ * Event donut receiver callback. This method is called when an event is
+ * received on the listened topic.
+ *
+ * @param event the received event
+ */
+ public void receiveEvent(Event event) {
+ Object thing = event.getProperty("food");
+ if (Donut.class.isInstance(thing)) {
+ receiveDonut((Donut) thing);
+ } else {
+ // Nothing to do.
+ }
+ }
+
+ /**
+ * Event receiver callback. This method is called by the event admin service
+ * when a event is received.
+ *
+ * @param event the received event
+ */
+ public void handleEvent(Event event) {
+ receiveEvent(event);
+ }
+
+ /**
+ * Clear the eaten donuts list. (Useful before tests)
+ */
+ public void clearDonuts() {
+ synchronized (m_donuts) {
+ m_donuts.clear();
+ }
+ }
+
+ /**
+ * Get the first received donut and remove it from the eaten donut list.
+ *
+ * @return the first received donut or null if no donut is available
+ */
+ public Donut getDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ if (!m_donuts.isEmpty()) {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Get the whole list of eaten donuts.
+ *
+ * @return the array containing all eaten donuts
+ */
+ public Donut[] getAllDonuts() {
+ Donut[] donuts = new Donut[0];
+ synchronized (m_donuts) {
+ donuts = (Donut[]) m_donuts.toArray(donuts);
+ m_donuts.clear();
+ }
+ return donuts;
+ }
+
+ /**
+ * Get the first donut if available or wait for an incoming donut. The
+ * returned donut is removed from the eaten donut list.
+ *
+ * @return the first available donut.
+ */
+ public Donut waitForDonut() {
+ Donut donut = null;
+ synchronized (m_donuts) {
+ while (donut == null) {
+ if (m_donuts.isEmpty()) {
+ try {
+ m_donuts.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ donut = (Donut) m_donuts.remove(0);
+ }
+ }
+ }
+ return donut;
+ }
+
+ /**
+ * Return the size of the eaten donut list.
+ *
+ * @return the size of the eaten donut list
+ */
+ public int getNumberOfDonuts() {
+ int length;
+ synchronized (m_donuts) {
+ length = m_donuts.size();
+ }
+ return length;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+
+/**
+ * Specification of an event tracker.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface EventTracker {
+
+ /**
+ * Clear the received events list. (Useful before tests)
+ */
+ void clearEvents();
+
+ /**
+ * Get the first received event and remove it from the events list.
+ *
+ * @return the first received event or null if no event is available
+ */
+ Event getEvent();
+
+ /**
+ * Get the whole list of received events.
+ *
+ * @return the array containing all received events
+ */
+ Event[] getAllEvents();
+
+ /**
+ * Get the first event if available or wait for an incoming event. The
+ * returned event is removed from the eaten event list.
+ *
+ * @return the first available event.
+ */
+ Event waitForEvent();
+
+ /**
+ * Return the size of the events list.
+ *
+ * @return the size of the events list
+ */
+ int getNumberOfEvents();
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementation of an event tracker.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class EventTrackerImpl implements EventTracker, EventHandler {
+
+ /**
+ * The name of the event tracker.
+ */
+ private String m_name;
+ /**
+ * The list of received events
+ */
+ private List m_events = new ArrayList();
+
+ /**
+ * Return the string representation of a given event.
+ *
+ * @return the string representation of a given event
+ */
+ public static String eventToString(Event e) {
+ StringBuilder buf = new StringBuilder();
+ buf.append("[" + e.getTopic() + "] {");
+
+ String[] properties = e.getPropertyNames();
+ int n = properties.length - 1;
+ for (int i = 0; i <= n; i++) {
+ String name = properties[i];
+ buf.append(name + "=" + e.getProperty(name));
+ if (i != n)
+ buf.append(", ");
+ }
+ buf.append("}");
+ return buf.toString();
+ }
+
+ /**
+ * Event receiver callback. This method is called by the event admin service
+ * when a event is received.
+ *
+ * @param event the received event
+ */
+ public void handleEvent(Event event) {
+ synchronized (m_events) {
+ m_events.add(event);
+ m_events.notify();
+ }
+ }
+
+ /**
+ * Clear the received events list. (Useful before tests)
+ */
+ public void clearEvents() {
+ synchronized (m_events) {
+ m_events.clear();
+ }
+ }
+
+ /**
+ * Get the first received event and remove it from the events list.
+ *
+ * @return the first received event or null if no event is available
+ */
+ public Event getEvent() {
+ Event event = null;
+ synchronized (m_events) {
+ if (!m_events.isEmpty()) {
+ event = (Event) m_events.remove(0);
+ }
+ }
+ return event;
+ }
+
+ /**
+ * Get the whole list of received events.
+ *
+ * @return the array containing all received events
+ */
+ public Event[] getAllEvents() {
+ Event[] events = new Event[0];
+ synchronized (m_events) {
+ events = (Event[]) m_events.toArray(events);
+ m_events.clear();
+ }
+ return events;
+ }
+
+ /**
+ * Get the first event if available or wait for an incoming event. The
+ * returned event is removed from the eaten event list.
+ *
+ * @return the first available event.
+ */
+ public Event waitForEvent() {
+ Event event = null;
+ synchronized (m_events) {
+ while (event == null) {
+ if (m_events.isEmpty()) {
+ try {
+ m_events.wait();
+ } catch (InterruptedException e) {
+ // Thanks Checkstyle to forbid empty catch statements
+ // ;-(
+ }
+ } else {
+ event = (Event) m_events.remove(0);
+ }
+ }
+ }
+ return event;
+ }
+
+ /**
+ * Return the size of the events list.
+ *
+ * @return the size of the events list
+ */
+ public int getNumberOfEvents() {
+ int length;
+ synchronized (m_events) {
+ length = m_events.size();
+ }
+ return length;
+ }
+}
Added: felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java?rev=1450816&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java (added)
+++ felix/trunk/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java Wed Feb 27 15:51:08 2013
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+package org.apache.felix.ipojo.handler.eventadmin.test.donut;
+
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Random;
+
+/**
+ * Implementation of an event vendor that directly uses the Event Admin service
+ * to send (synchronously) raw events.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SyncEventProviderImpl implements DonutProvider {
+
+ /**
+ * The donut current serial number.
+ */
+ private long m_serial = 0L;
+ /**
+ * The name of the donut vendor.
+ */
+ private String m_name;
+ /**
+ * A random generator.
+ */
+ private Random m_random;
+ /**
+ * The Event Admin service reference.
+ */
+ private EventAdmin m_ea;
+
+ /**
+ * Construct a new donut provider. The initial serial number is randomly
+ * generated.
+ */
+ public SyncEventProviderImpl() {
+ m_random = new Random(System.currentTimeMillis());
+ }
+
+ /**
+ * Sell a donut with a random flavour.
+ *
+ * @return the sold donut
+ */
+ public Donut sellDonut() {
+ Dictionary rawEvent = new Hashtable();
+ Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random
+ .nextInt(Donut.FLAVOURS.length)]);
+ rawEvent.put("food", donut);
+ m_ea.sendEvent(new Event("food/donuts", rawEvent));
+ return donut;
+ }
+}