diff --git a/README.md b/README.md
index bc69ae4388..084350bd57 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,6 @@ Several projects provide extra features to an OSGi runtime.
- **gogo** `/gogo` - A command line shell, runtime and set of base commands for interacting with and introspecting an OSGi framework.
- **health checks** `/healthcheck/*` - An extensible framework to monitor the status of the OSGi container at runtime. (contains **systemready**)
- **inventory** `/inventory` - Provides some mechanisms to get the current state of the system and therefore provides an inventory of the system.
-- **ipojo** `/ipojo` - A *service component runtime* aiming to simplify OSGi application development.
- **jaas support** `/jaas` - Bundle to simplify JAAS usage within OSGi environment.
- **logback** `/logback` - A simple integration of the OSGi R7 Log (1.4) service to Logback backend.
- **OSGi metrics** `/metrics/osgi` - Collecting and publishing metrics related to OSGi applications
diff --git a/ipojo/.gitignore b/ipojo/.gitignore
deleted file mode 100644
index 68cde20656..0000000000
--- a/ipojo/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.project
-.settings
-.classpath
-target
\ No newline at end of file
diff --git a/ipojo/arch/changelog.txt b/ipojo/arch/changelog.txt
deleted file mode 100644
index b180064a95..0000000000
--- a/ipojo/arch/changelog.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Changes from the 1.4.0 to 1.6.0
--------------------------------
-** Improvement
- * [FELIX-1427] - Service injection with Smart Proxies
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Improvement
- * Update parent pom
- * [FELIX-996] - Arch -factory command always prints out one component factory
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-797] - Composite Architecture contains duplicate instances
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-673] - Provide OBR description to iPOJO bundles
-
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/arch/obr.xml b/ipojo/arch/obr.xml
deleted file mode 100644
index 8832ddf9ed..0000000000
--- a/ipojo/arch/obr.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
- Import Service org.apache.felix.ipojo.architecture.Architecture
- Import Service org.apache.felix.ipojo.Factory
- Import Service org.apache.felix.ipojo.HandlerFactory
- Requires Handler
-
\ No newline at end of file
diff --git a/ipojo/arch/pom.xml b/ipojo/arch/pom.xml
deleted file mode 100644
index 49eef09828..0000000000
--- a/ipojo/arch/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../pom/pom.xml
-
- 4.0.0
- bundle
- Apache Felix iPOJO Arch Command
- org.apache.felix.ipojo.arch
- 1.7.0-SNAPSHOT
-
- Arch command to collect and print information about iPOJO instances.
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.9.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.shell
- 1.0.2
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
- true
-
-
- Apache Felix iPOJO Arch Command
- ${project.artifactId}
- The Apache Software Foundation
- iPOJO Arch command for Felix
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html
-
- org.apache.felix.ipojo.arch
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.8.0
-
-
-
- ipojo-bundle
-
-
- true
-
-
-
-
-
-
-
-
-
-
- ]]>
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
-
diff --git a/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/arch/src/main/appended-resources/META-INF/NOTICE b/ipojo/arch/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
deleted file mode 100644
index 4010b7d1bc..0000000000
--- a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * 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.arch;
-
-import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.util.List;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.IPojoFactory;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.architecture.InstanceDescription;
-import org.apache.felix.shell.Command;
-
-/**
- * Implementation of the arch command printing the actual architecture.
- * @author Felix Project Team
- */
-public class ArchCommandImpl implements Command {
-
- /** List of arch services. */
- private Architecture[] m_archs;
-
- /** Factory services. */
- private Factory[] m_factories;
-
- /** Handler Factories. */
- private HandlerFactory[] m_handlers;
-
- /**
- * Get the command name.
- * @return the command name (arch)
- * @see org.apache.felix.shell.Command#getName()
- */
- public String getName() {
- return "arch";
- }
-
- /**
- * Gets help message.
- * @return the command usage.
- * @see org.apache.felix.shell.Command#getUsage()
- */
- public String getUsage() {
- return "arch [-factories] [-instances] [-handlers] [-factory factory_name] [-instance instance_name]";
- }
-
- /**
- * Gets a small description.
- * @return get a description.
- * @see org.apache.felix.shell.Command#getShortDescription()
- */
- public String getShortDescription() {
- return "Architecture command : display the architecture";
- }
-
- /**
- * Executes the arch command.
- * @param line : command line
- * @param out : the default output stream
- * @param err : the error output stream
- * @see org.apache.felix.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream)
- */
- public void execute(String line, PrintStream out, PrintStream err) {
- String line2 = line.substring("arch".length()).trim();
-
- if (line2.equalsIgnoreCase("-instances") || line2.length() == 0) {
- printInstances(out);
- return;
- }
-
- if (line2.equalsIgnoreCase("-factories")) {
- printFactories(out);
- return;
- }
-
- if (line2.startsWith("-factory")) {
- String name = line2.substring("-factory".length()).trim();
- printFactory(name, out, err);
- return;
- }
-
- if (line2.startsWith("-instance")) {
- String name = line2.substring("-instance".length()).trim();
- printInstance(name, out, err);
- return;
- }
-
- if (line2.startsWith("-handlers")) {
- printHandlers(out);
- return;
- }
-
- if (line2.startsWith("-stats")) {
- printStats(out);
- return;
- }
-
- err.println(getUsage());
- }
-
- /**
- * Prints the statistics.
- * @param out the out
- */
- private void printStats(PrintStream out) {
- try {
- Field field = IPojoFactory.class.getDeclaredField("INSTANCE_NAME");
- field.setAccessible(true); // The field is not accessible.
- List names = (List) field.get(null);
- out.println("Number of living instances : " + names.size());
- out.println("Created instances : " + names);
- } catch (SecurityException e) {
- out.println("Cannot compute stats : " + e.getMessage());
- } catch (IllegalArgumentException e) {
- out.println("Cannot compute stats : " + e.getMessage());
- } catch (IllegalAccessException e) {
- out.println("Cannot compute stats : " + e.getMessage());
- } catch (NoSuchFieldException e) {
- out.println("Cannot compute stats : " + e.getMessage());
- }
-
- }
-
- /**
- * Prints instance list.
- * @param out : default print stream
- */
- private void printInstances(PrintStream out) {
- for (int i = 0; i < m_archs.length; i++) {
- InstanceDescription instance = m_archs[i].getInstanceDescription();
- if (instance.getState() == ComponentInstance.VALID) {
- out.println("Instance " + instance.getName() + " -> valid");
- }
- if (instance.getState() == ComponentInstance.INVALID) {
- out.println("Instance " + instance.getName() + " -> invalid");
- }
- if (instance.getState() == ComponentInstance.STOPPED) {
- out.println("Instance " + instance.getName() + " -> stopped");
- }
- }
- }
-
- /**
- * Prints instance description.
- * @param name : instance name
- * @param out : default print stream
- * @param err : error print stream (if the instance is not found)
- */
- private void printInstance(String name, PrintStream out, PrintStream err) {
- for (int i = 0; i < m_archs.length; i++) {
- InstanceDescription instance = m_archs[i].getInstanceDescription();
- if (instance.getName().equalsIgnoreCase(name)) {
- out.println(instance.getDescription());
- return;
- }
- }
- err.println("Instance " + name + " not found");
- }
-
- /**
- * Prints factories.
- * @param out : output stream
- */
- private void printFactories(PrintStream out) {
- for (int i = 0; i < m_factories.length; i++) {
- if (m_factories[i].getMissingHandlers().size() == 0) {
- out.println("Factory " + m_factories[i].getName() + " (VALID)");
- } else {
- out.println("Factory " + m_factories[i].getName() + " (INVALID : " + m_factories[i].getMissingHandlers() + ")");
- }
- }
- }
-
- /**
- * Prints factory description.
- * @param name : factory name
- * @param out : default print stream
- * @param err : error print stream (if the factory is not found)
- */
- private void printFactory(String name, PrintStream out, PrintStream err) {
- boolean found = false;
- for (int i = 0; i < m_factories.length; i++) {
- if (m_factories[i].getName().equalsIgnoreCase(name)) {
- // Skip a line if already found
- if (found) {
- out.println();
- }
- out.println(m_factories[i].getDescription());
- found = true;
- }
- }
- if (! found) {
- err.println("Factory " + name + " not found");
- }
- }
-
- /**
- * Prints the list of available handlers (and validity).
- * @param out : default print stream
- */
- private void printHandlers(PrintStream out) {
- for (int i = 0; i < m_handlers.length; i++) {
- String name = m_handlers[i].getHandlerName();
- if ("composite".equals(m_handlers[i].getType())) {
- name = name + " [composite]";
- }
- if (m_handlers[i].getMissingHandlers().size() == 0) {
- out.println("Handler " + name + " (VALID)");
- } else {
- out.println("Handler " + name + " (INVALID : " + m_handlers[i].getMissingHandlers() + ")");
- }
- }
- }
-}
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml b/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml
deleted file mode 100755
index cf0967d31e..0000000000
--- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- bundle
-
- iPOJO Foo Service
-
- org.apache.felix.ipojo.log.foo
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
-
- org.apache.felix.ipojo.foo
-
-
- org.apache.felix.ipojo.foo.impl
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
-
-
-
- ipojo-bundle
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java
deleted file mode 100755
index 1bd0b9ff17..0000000000
--- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.foo;
-
-/**
- * A service interface doing mostly nothing.
- */
-public interface FooService {
-
- public void foo();
-
-}
diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java
deleted file mode 100755
index 2817fe4d45..0000000000
--- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.foo.impl;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.foo.FooService;
-
-
-@Component
-@Provides
-@Instantiate(name = "ipojo.foo.provider")
-/**
- * A very simple implementation of the FooService.
- */
-public class FooServiceImpl implements FooService {
-
- public void foo() {
- System.out.println("Foo");
- }
-
-
-}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml
deleted file mode 100755
index bbe35d94f6..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- bundle
- iPOJO Log Handler Consumer
- org.apache.felix.ipojo.log.consumer
- A bundle using the log handler
-
-
-
- ${project.groupId}
- org.apache.felix.ipojo.log.foo
- ${project.version}
- provided
-
-
- ${project.groupId}
- org.apache.felix.ipojo.log.handler
- ${project.version}
- provided
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
-
- org.apache.felix.ipojo.log.handler.example
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
-
-
-
- ipojo-bundle
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java
deleted file mode 100755
index e6c1e3e50a..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.felix.ipojo.log.handler.example;
-
-
-import org.apache.felix.ipojo.annotations.*;
-import org.apache.felix.ipojo.foo.FooService;
-import org.apache.felix.ipojo.log.handler.Log;
-
-@Component(immediate = true)
-@Log(level = Log.Level.INFO) // We configure the handler.
-@Instantiate(name = "my.simple.consumer")
-public class SimpleComponent {
-
- @Requires
- FooService fs;
-
- @Validate
- public void starting() {
- System.out.println("Starting...");
- fs.foo();
- }
-
- @Invalidate
- public void stopping() {
- System.out.println("Stopping...");
- }
-}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml
deleted file mode 100644
index c1a58f79cb..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- loghandler-tutorial-felix
- Log-Handler-In-Felix
-
- pom
-
-
-
- org.apache.felix
- org.apache.felix.log
- 1.0.1
-
-
-
-
- ${project.groupId}
- org.apache.felix.ipojo.log.foo
- ${project.version}
-
-
- ${project.groupId}
- org.apache.felix.ipojo.log.handler
- ${project.version}
-
-
- ${project.groupId}
- org.apache.felix.ipojo.log.consumer
- ${project.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.7
-
-
-
- unpack-felix
- package
-
- unpack-dependencies
-
-
- org.apache.felix.main.distribution
- ${project.build.directory}
-
-
-
-
- copy-bundles
- package
-
- copy-dependencies
-
-
-
- org.apache.felix.ipojo.log.foo,
- org.apache.felix.ipojo.log.handler,
- org.apache.felix.ipojo.log.consumer,
- org.apache.felix.log,org.apache.felix.ipojo,
- org.apache.felix.ipojo.arch.gogo
-
- ${project.build.directory}/felix-framework-${felix.version}/bundle
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml
deleted file mode 100755
index fbf2e214f6..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- bundle
- iPOJO Log Handler
- org.apache.felix.ipojo.log.handler
- A handler logging messages in an OSGi Log Service
-
-
-
- org.osgi
- org.osgi.core
- 4.2.0
- provided
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
- provided
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
-
- org.apache.felix.ipojo.log.handler
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
-
-
-
- ipojo-bundle
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java
deleted file mode 100644
index f9aa1db613..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.log.handler;
-
-/**
- * The annotation used to configure the LogHandler.
- */
-public @interface Log {
-
- public enum Level {
- INFO, ERROR, WARNING
- }
-
- /**
- * @return the log level
- */
- Level level();
-}
diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java
deleted file mode 100755
index 9b5609bde7..0000000000
--- a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.log.handler;
-
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.annotations.Handler;
-import org.apache.felix.ipojo.annotations.Requires;
-import org.apache.felix.ipojo.metadata.Element;
-import org.osgi.service.log.LogService;
-
-import java.util.Dictionary;
-
-// Declare a handler.
-@Handler(name = "Log", namespace = LogHandler.NAMESPACE)
-public class LogHandler extends PrimitiveHandler {
-
- public static final String NAMESPACE = "org.apache.felix.ipojo.log.handler";
-
- // Handlers are iPOJO components, so can use service dependencies
- @Requires(optional = true, nullable = false)
- LogService log;
- private InstanceManager instanceManager;
- private int logLevel;
-
- /**
- * Parses the component's metadata to retrieve the log level in which we log messages.
- *
- * @param metadata component's metadata
- * @param configuration instance configuration (unused in this example)
- * @throws ConfigurationException the configuration is inconsistent
- */
- @Override
- public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
- // First parse the metadata to check if the log handler logLevel
-
- // Get all Namespace:log element from the metadata
- Element[] log_elements = metadata.getElements("log", NAMESPACE);
-
- // If an element match, parse the logLevel attribute of the first found element
- if (log_elements[0].containsAttribute("level")) {
- String l = log_elements[0].getAttribute("level");
- if (l.equalsIgnoreCase("info")) {
- logLevel = LogService.LOG_INFO;
- } else if (l.equalsIgnoreCase("error")) {
- logLevel = LogService.LOG_ERROR;
- } else if (l.equalsIgnoreCase("warning")) {
- logLevel = LogService.LOG_WARNING;
- }
- }
-
- instanceManager = getInstanceManager();
- }
-
- /**
- * The instance is starting.
- */
- public void start() {
- if (log != null) {
- log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is starting");
- }
- }
-
- /**
- * The instance is stopping.
- */
- public void stop() {
- if (log != null) {
- log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is stopping");
- }
- }
-
- /**
- * Logging messages when the instance state is changing
- *
- * @param state the new state
- */
- public void stateChanged(int state) {
- if (log != null) {
- if (state == InstanceManager.VALID) {
- System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes valid");
- log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes valid");
- }
- if (state == InstanceManager.INVALID) {
- System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes invalid");
- log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes invalid");
- }
- }
- }
-}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml
deleted file mode 100755
index e9094f8d01..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- bundle
- iPOJO Property Handler Consumer
- org.apache.felix.ipojo.properties.consumer
- A bundle using the properties handler
-
-
-
- ${project.groupId}
- org.apache.felix.ipojo.properties.handler
- ${project.version}
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
-
- org.apache.felix.ipojo.handler.props.example
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
-
-
-
- ipojo-bundle
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml
deleted file mode 100755
index 29f7aa15e4..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
deleted file mode 100755
index e75aa2df43..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.properties.example;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Invalidate;
-import org.apache.felix.ipojo.annotations.Validate;
-import org.apache.felix.ipojo.handler.properties.Properties;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-@Component(immediate = true, name = "PropertiesTester")
-@Properties(file = "props/my-properties.properties")
-@Instantiate
-public class PropertiesTester {
-
- // These two fields will be injected.
- private String property1;
- private String property2;
-
- /**
- * Starting method.
- * This method will be called when the instance starts.
- */
- @Validate
- public void start() {
- System.out.println("PropertiesTester is starting ...");
- // Read the injected properties.
- System.out.println("Property 1 : " + property1);
- System.out.println("Property 2 : " + property2);
-
- // Update the properties.
- updateProperties();
- }
-
- /**
- * Stopping method.
- * This method will be called when the instance stops.
- */
- @Invalidate
- public void stop() {
- System.out.println("PropertiesTester is stopping ...");
- System.out.println("Property 1 : " + property1);
- System.out.println("Property 2 : " + property2);
- }
-
- /**
- * This method just updates managed properties.
- * It appends the current date to the actual property value.
- */
- private void updateProperties() {
- System.out.println("Update properties");
- Date date = new Date();
- DateFormat df = DateFormat.getDateTimeInstance();
- // The properties will be updated in the property file
- property1 = property1 + " - " + df.format(date);
- property2 = property2 + " - " + df.format(date);
- }
-
-}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml
deleted file mode 100644
index a646b6bb58..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- Property-Handler-In-Felix
- 1.9.0-SNAPSHOT
-
- pom
-
-
-
-
- ${project.groupId}
- org.apache.felix.ipojo.properties.handler
- ${project.version}
-
-
- ${project.groupId}
- org.apache.felix.ipojo.properties.consumer
- ${project.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.7
-
-
-
- unpack-felix
- package
-
- unpack-dependencies
-
-
- org.apache.felix.main.distribution
- ${project.build.directory}
-
-
-
-
- copy-bundles
- package
-
- copy-dependencies
-
-
-
- org.apache.felix.ipojo.properties.handler,
- org.apache.felix.ipojo.properties.consumer,
- org.apache.felix.ipojo,
- org.apache.felix.ipojo.arch.gogo
-
- ${project.build.directory}/felix-framework-${felix.version}/bundle
-
-
-
-
-
-
-
-
- maven-resources-plugin
- 2.6
-
-
- copy-resources
- package
-
- copy-resources
-
-
-
- ${project.build.directory}/felix-framework-${felix.version}/props
-
-
-
- src/main/resources/props
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties
deleted file mode 100644
index 8ebd943ecc..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-
-property1:"aaa"
-property2:"bbb"
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties
deleted file mode 100644
index 195278e50b..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-
-property1:"ccc"
-property2:"ddd"
\ No newline at end of file
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml
deleted file mode 100755
index 4261fcbb86..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
-
- bundle
- iPOJO Properties Handler
- org.apache.felix.ipojo.properties.handler
- A handler loading a property file
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
-
- org.apache.felix.ipojo.handler.properties
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
-
-
-
- ipojo-bundle
-
-
-
-
-
-
-
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java
deleted file mode 100755
index 8a0f49b091..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.properties;
-
-/**
- * The Properties annotation.
- * This annotation may be used in POJO class to used the Property handler.
- * @author Felix Project Team
- */
-public @interface Properties {
-
- /**
- * Returns the property file used by the handler.
- */
- String file();
-
-}
diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
deleted file mode 100755
index 08efa3cdb4..0000000000
--- a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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.properties;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.annotations.Handler;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.metadata.Attribute;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.FieldMetadata;
-import org.apache.felix.ipojo.parser.PojoMetadata;
-
-/**
- * This handler load a properties file containing property value.
- * The handler injects this values inside fields. When stopped the handler stores updated value inside the file. The
- * properties file contains
field-name : field-value
(field-value are strings)
- *
- * Instances can override file locations by setting the {@literal properties.file} property.
- *
- * @author Felix Project Team
- */
-@Handler(name="properties", namespace = PropertiesHandler.NAMESPACE)
-public class PropertiesHandler extends PrimitiveHandler {
-
- /**
- * The Handler namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.handler.properties";
-
- /**
- * The loaded properties.
- */
- private Properties m_properties = new Properties();
-
- /**
- * The properties file location, configured in the component's metadata.
- */
- private String m_file;
-
- /**
- * This method is the first to be invoked.
- * This method aims to configure the handler. It receives the component type metadata and the instance
- * configuration. The method parses given metadata and registers fields to inject.
- *
- * Step 3 : when the instance configuration contains the properties.file property, it overrides the properties file location.
- *
- * @param metadata : component type metadata
- * @param configuration : instance description
- * @throws ConfigurationException : the configuration of the handler has failed.
- */
- @SuppressWarnings("unchecked")
- public void configure(Element metadata, Dictionary configuration) throws ConfigurationException {
- // Parse metadata to get
-
- // Get all elements to configure the handler
- Element[] elem = metadata.getElements("properties", NAMESPACE);
-
- switch (elem.length) {
- case 0:
- // No matching element in metadata, throw a configuration error.
- // It actually happen only if you force the handler to be plugged.
- throw new ConfigurationException("No properties found");
- case 1:
- // One 'properties' found, get attributes.
- m_file = elem[0].getAttribute("file");
- if (m_file == null) {
- // if file is null, throw a configuration error.
- throw new ConfigurationException("Malformed properties element : file attribute must be set");
- }
- break;
- default:
- // To simplify we handle only one properties element.
- throw new ConfigurationException("Only one properties element is supported");
- }
-
- // Look if the instance overrides file location :
- String instanceFile = (String) configuration.get("properties.file");
- if (instanceFile != null) {
- m_file = instanceFile;
- }
-
- // Load properties
- try {
- loadProperties();
- } catch (IOException e) {
- throw new ConfigurationException("Error when reading the " + m_file + " file : " + e.getMessage());
- }
-
- // Register fields
- // By convention, properties file entry are field name, so look for each property to get field list.
-
- //First get Pojo Metadata metadata :
- PojoMetadata pojoMeta = getPojoMetadata();
- Enumeration e = m_properties.keys();
- while (e.hasMoreElements()) {
- String field = (String) e.nextElement();
- FieldMetadata fm = pojoMeta.getField(field);
-
- if (fm == null) { // The field does not exist
- throw new ConfigurationException("The field " + field + " is declared in the properties file but does not exist in the pojo");
- }
-
- // Then check that the field is a String field
- if (!fm.getFieldType().equals(String.class.getName())) {
- throw new ConfigurationException("The field " + field + " exists in the pojo, but is not a String");
- }
-
- // All checks are ok, register the interceptor.
- getInstanceManager().register(fm, this);
- }
-
- // Finally register the field to listen
- }
-
- /**
- * This method is called when the instance start (after the configure method). We just print stored properties.
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public void start() {
- // The properties are already loaded (in the configure method), just print values.
- m_properties.list(System.out);
- }
-
- /**
- * This method is called when the instance stops. We save the properties to not lost the instance state and clear the stored properties.
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public void stop() {
- try {
- saveProperties();
- } catch (IOException e) {
- error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
- }
- m_properties = null;
- }
-
- /**
- * This method is called at each time the pojo 'get' a listened field. The method return the stored value.
- * @param pojo : pojo object getting the field
- * @param field : field name.
- * @param o : previous value.
- * @return the stored value.
- */
- public Object onGet(Object pojo, String field, Object o) {
- // When the pojo requires a value for a managed field, this method is invoked.
- // So, we have just to return the stored value.
- return m_properties.get(field);
- }
-
- /**
- * This method is called at each time the pojo 'set' a listened field. This method updates the local properties.
- * @param pojo : pojo object setting the field
- * @param field : field name
- * @param newvalue : new value
- */
- public void onSet(Object pojo, String field, Object newvalue) {
- // When the pojo set a value to a managed field, this method is invoked.
- // So, we update the stored value.
- m_properties.put(field, newvalue);
- }
-
- /**
- * Step 2 : state properties when the instance becomes invalid.
- * @param newState : the instance state
- * @see org.apache.felix.ipojo.Handler#stateChanged(int)
- */
- public void stateChanged(int newState) {
- // This method is invoked each times that the instance state changed.
-
- // If the new state is invalid, save the properties.
- if (newState == ComponentInstance.INVALID) {
- // Reload properties
- try {
- saveProperties();
- } catch (IOException e) {
- error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger
- }
- }
- }
-
- /**
- * Step 5 : dynamic reconfiguration. This method is call when the instance is reconfigured externally. The given property contains property value.
- * @param dict : new properties
- * @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary)
- */
- @SuppressWarnings("unchecked")
- public synchronized void reconfigure(Dictionary dict) {
- // For each property, look if a new value is contained in the new configuration.
- Enumeration e = m_properties.keys();
- while (e.hasMoreElements()) {
- String field = (String) e.nextElement();
- String value = (String) dict.get(field);
- // If the dictionary contains a value, update the stored value.
- if (value != null) {
- m_properties.put(field, value);
- }
- }
- }
-
- /**
- * Returns handler description.
- * @return the handler description.
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- public HandlerDescription getDescription() {
- return new Description(this);
- }
-
- /**
- * Helper method just loading the properties.
- * @throws IOException : the file cannot be read.
- */
- private void loadProperties() throws IOException {
- // Load the properties file from file system
- File file = new File(m_file);
- InputStream is = new FileInputStream(file);
- m_properties.load(is);
- }
-
- /**
- * Helper method writing properties.
- * @throws IOException : the file cannot be written.
- */
- private void saveProperties() throws IOException {
- // Store the file, modified the last modification date.
- File file = new File(m_file);
- OutputStream os = new FileOutputStream(file);
- m_properties.store(os, "");
- }
-
- /**
- * Step 3 : The handler will participate to the instance architecture.
- * This class describing the handler.
- */
- private class Description extends HandlerDescription {
-
- /**
- * Instantiates a new description.
- * @param h the h
- */
- public Description(PrimitiveHandler h) {
- super(h);
- }
-
- /**
- * This method must return the Element describing the handler. The description of this handler contains the list of properties with attached
- * value.
- * @return the description of the handler.
- * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
- */
- @SuppressWarnings("unchecked")
- public Element getHandlerInfo() {
- Element elem = super.getHandlerInfo(); // This method must be called to get the root description element.
- Enumeration e = m_properties.keys();
- while (e.hasMoreElements()) {
- String field = (String) e.nextElement();
- Element prop = new Element("property", ""); // Create an element for the actual property.
- // Add two attribute (the field and the value).
- prop.addAttribute(new Attribute("field", field));
- prop.addAttribute(new Attribute("value", (String) m_properties.get(field)));
- elem.addElement(prop); // Attach the current element to the root element.
- }
- return elem;
- }
-
- }
-}
diff --git a/ipojo/distributions/handler-tutorial/pom.xml b/ipojo/distributions/handler-tutorial/pom.xml
deleted file mode 100644
index 6454332f8e..0000000000
--- a/ipojo/distributions/handler-tutorial/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.felix
- ipojo-handler-tutorial
- 1.10.2-SNAPSHOT
-
- pom
-
-
- Build the handlers form the tutorial and distributions to test them
-
-
-
-
- org.apache.felix
- org.apache.felix.main.distribution
- zip
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
- org.apache.felix
- org.apache.felix.ipojo.gogo
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
-
-
-
-
-
- FooService-And-Impl
- Log-Handler
- Log-Handler-Consumer
- Log-Handler-In-Felix
-
-
- Property-Handler
- Property-Handler-Consumer
- Property-Handler-In-Felix
-
-
-
- 4.2.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.1
-
-
- org.apache.felix
- org.apache.felix.ipojo.gogo
- 1.10.1
-
-
- org.apache.felix
- org.apache.felix.main.distribution
- 4.2.1
- zip
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.10.1
-
-
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.8.6
-
-
- maven-assembly-plugin
- 2.4
-
-
-
-
-
-
- maven-assembly-plugin
-
-
- project
-
- true
-
-
-
-
- single
-
- package
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml b/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml
deleted file mode 100644
index b578c5b7bc..0000000000
--- a/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.distributions
- 1.10.2-SNAPSHOT
-
-
- ipojo-webconsole-quicktart
-
- pom
-
-
- Build a distribution of Felix including iPOJO, and a working web console
-
-
-
-
- org.apache.felix
- org.apache.felix.main.distribution
- zip
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.gogo
-
-
- org.apache.felix
- org.apache.felix.gogo.runtime
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.webconsole
- 1.7.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.webconsole
- 4.9.10
-
-
- org.apache.felix
- org.apache.felix.webconsole.plugins.packageadmin
- 1.0.0
-
-
- org.apache.felix
- org.apache.felix.webconsole.plugins.memoryusage
- 1.0.2
-
-
- org.apache.felix
- org.apache.felix.http.jetty
- 2.2.0
-
-
- javax.servlet
- com.springsource.javax.servlet
- 2.4.0
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
- commons-io
- commons-io
- 2.14.0
-
-
- commons-fileupload
- commons-fileupload
- 1.6.0
-
-
-
-
-
-
- ow2.releases
- http://repository.ow2.org/nexus/content/groups/public/
-
-
-
- com.springsource.repository.libraries.external
- SpringSource Enterprise Bundle Repository - External Library Releases
- http://repository.springsource.com/maven/bundles/external
-
-
-
-
-
-
- maven-assembly-plugin
-
-
- src/main/assembly/distribution.xml
-
- true
-
-
-
-
- single
-
- package
-
-
-
-
-
-
diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml b/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml
deleted file mode 100644
index 20e8bf1a83..0000000000
--- a/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
- distribution
-
-
- zip
- tar.gz
-
-
-
-
-
-
- *:org.apache.felix.main.distribution:*
-
- true
- .
-
-
- **/doc/**
-
-
-
-
-
-
- *:org.apache.felix.*:jar
- javax.servlet:com.springsource.javax.servlet:*
- org.osgi:org.osgi.compendium:*
- org.json:org.ow2.chameleon.commons.json:*
- commons-io:commons-io:*
- commons-fileupload:*:*
-
- false
- ./felix-framework-${felix.version}/bundle
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/distributions/pom.xml b/ipojo/distributions/pom.xml
deleted file mode 100644
index d331399346..0000000000
--- a/ipojo/distributions/pom.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.felix
- org.apache.felix.ipojo.distributions
- 1.10.2-SNAPSHOT
-
- pom
-
-
- This project build distributions for the web site, it does not intend to be released, just built.
-
-
-
- ipojo-webconsole-quicktart
- handler-tutorial
-
-
-
- 4.2.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.1
-
-
- org.apache.felix
- org.apache.felix.ipojo.gogo
- 1.10.1
-
-
- org.apache.felix
- org.apache.felix.main.distribution
- 4.2.1
- zip
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.10.1
-
-
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.10.0
-
-
- maven-assembly-plugin
- 2.4
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/changelog.txt b/ipojo/handler/eventadmin/changelog.txt
deleted file mode 100644
index dec38256c1..0000000000
--- a/ipojo/handler/eventadmin/changelog.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Changes from the 1.6.0 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler
-
-** Improvement
- * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions
- * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision
- * [FELIX-2711] - The event admin handler should provides a Handler Description
-
-Changes from the 1.4.0 to 1.6.0
--------------------------------
-** Bug
- * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Improvement
- * Update parent pom
-
- Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-794] - Event Admin handler reject correctly formed topics
-
-** Improvement
- * [FELIX-795] - Improve metadata and manipulator performance
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-Version 1.0.0
--------------
- * Initial release
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
deleted file mode 100644
index 7fb30add40..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml
+++ /dev/null
@@ -1,378 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../../pom/pom.xml
-
-
- 4.0.0
- pom
- Apache Felix iPOJO Event Admin Handler - Integration Test
- org.apache.felix.ipojo.handler.eventadmin-it
- 1.9.0-SNAPSHOT
-
-
- 3.0.0
- 1.5.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.eventadmin
- ${project.version}
-
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.2-SNAPSHOT
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
-
- ch.qos.logback
- logback-core
- 1.5.25
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.2-SNAPSHOT
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.2
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
-
-
-
-
-
-
-
-
- test
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- regular
-
- run
-
-
-
- felix
-
- ${project.build.directory}/regular
-
-
-
-
-
-
-
-
-
- test-all
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- equinox-native
-
- run
-
-
-
- equinox
-
- ${project.build.directory}/equinox-native
-
-
-
-
- felix-native
-
- run
-
-
-
- felix
-
- ${project.build.directory}/felix-native
-
-
-
-
-
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- http://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- 5.2.0
- test
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- 3.8.1.v20120830-144521
- test
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
-
-
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
deleted file mode 100644
index c5ef57b80a..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.eventadmin-it
- 1.9.0-SNAPSHOT
- ../../../pom.xml
-
-
-
- ipojo-event-admin-integration-test
- ${project.artifactId}
-
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
deleted file mode 100644
index d6ea1efff0..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
deleted file mode 100644
index 5c0e4f3f84..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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 + ")";
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
deleted file mode 100644
index c13d87bea5..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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();
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
deleted file mode 100644
index 956b6db1cc..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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 Felix Project Team
- * @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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
deleted file mode 100644
index 612b72adfa..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
deleted file mode 100644
index a098ee7004..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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 Felix Project Team
- *
- */
-public interface DonutProvider {
-
- /**
- * Sell a donut with a random flavour.
- *
- * @return the sold donut
- */
- Donut sellDonut();
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
deleted file mode 100644
index 2f708bac04..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 Felix Project Team
- *
- */
-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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
deleted file mode 100644
index 4b6ba7f281..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * 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 Felix Project Team
- * @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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
deleted file mode 100644
index b61b530183..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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();
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
deleted file mode 100644
index 64f08b48ed..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
deleted file mode 100644
index bf519aef94..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 Felix Project Team
- */
-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;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml
deleted file mode 100644
index fb8639e850..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,199 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java
deleted file mode 100644
index cb93526359..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-public class Common extends BaseTest {
-
- @Override
- protected Option[] getCustomOptions() {
- return new Option[]{
- eventadmin()
- };
- }
-
- public CompositeOption eventadmin() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"),
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin").versionAsInProject());
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.handler.eventadmin.test.donut");
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java
deleted file mode 100644
index d5eb9914ae..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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;
-
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
-import org.osgi.framework.BundleContext;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-
-/**
- * Useful variables used for the tests of the Event Admin Handler.
- *
- * @author Felix Project Team
- */
-public class EahTestUtils {
-
- /**
- * Enable debug messages ?
- */
- public static final boolean TRACE = false;
- /**
- * The number of tests to execute.
- */
- public static final int NUMBER_OF_TESTS = 50;
- /**
- * The time that is normally necessary to cause a blacklist from the event
- * admin service.
- */
- public static final long BLACK_LIST_TIME = 5000L;
- /**
- * The long amount of time.
- */
- public static final long A_LONG_TIME = 1000L;
- /**
- * The bundle context.
- */
- private BundleContext m_context;
- /**
- * The iPOJO Helper.
- */
- private IPOJOHelper m_ipojoHelper;
-
- /**
- * Construct a new Event Admin Handler Tests utility instance.
- */
- public EahTestUtils(BundleContext context, IPOJOHelper ipojoHelper) {
- m_ipojoHelper = ipojoHelper;
- m_context = context;
- }
-
- /**
- * 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;
- if (TRACE) {
- System.err.println("Sleeping for " + millis + "ms");
- }
- while (now < future) {
- try {
- Thread.sleep(future - now);
- } catch (Exception e) {
- }
- now = System.currentTimeMillis();
- }
- }
-
- /**
- * Return the index of the given donut flavour in the flavour array.
- *
- * @return the index of the given flavour or -1 if not found
- */
- public static int flavourIndex(String flavour) {
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- if (Donut.FLAVOURS[i].equals(flavour))
- return i;
- }
- return -1;
- }
-
- /**
- * Return the (asynchronous) donut provider factory.
- *
- * @return the (asynchronous) donut provider factory
- */
- public Factory getDonutProviderFactory() {
- return m_ipojoHelper.getFactory("donut-provider");
- }
-
- /**
- * Return the (asynchronous) donut provider using publishes factory.
- *
- * @return the (asynchronous) donut provider using publishes factory
- */
- public Factory getDonutProviderUsingPublishesFactory() {
- return m_ipojoHelper.getFactory("donut-provider-publishes");
- }
-
- /**
- * Return the synchronous donut provider factory.
- *
- * @return the synchronous donut provider factory
- */
- public Factory getSynchronousDonutProviderFactory() {
- return m_ipojoHelper.getFactory(
- "synchronous-donut-provider");
- }
-
- /**
- * Return the synchronous donut provider factory using
- * dataKey
- *
- * @return the synchronous donut provider factory
- */
- public Factory getSynchronousDonutProvider2Factory() {
- return m_ipojoHelper.getFactory(
- "synchronous-donut-provider-2");
- }
-
- /**
- * Return the (asynchronous) donut event provider factory.
- *
- * @return the (asynchronous) donut event provider factory
- */
- public Factory getDonutEventProviderFactory() {
- return m_ipojoHelper.getFactory(
- "donut-event-provider");
- }
-
- /**
- * Return the synchronous donut event provider factory.
- *
- * @return the synchronous donut event provider factory
- */
- public Factory getSynchronousDonutEventProviderFactory() {
- return m_ipojoHelper.getFactory(
- "synchronous-donut-event-provider");
- }
-
- /**
- * Return the event provider factory.
- *
- * @return the event provider factory
- */
- public Factory getEventProviderFactory() {
- return m_ipojoHelper.getFactory("event-provider");
- }
-
- /**
- * Return the synchronous event provider factory.
- *
- * @return the synchronous event provider factory
- */
- public Factory getSynchronousEventProviderFactory() {
- return m_ipojoHelper.getFactory(
- "synchronous-event-provider");
- }
-
- /**
- * Return the donut consumer factory.
- *
- * @return the donut consumer factory
- */
- public Factory getDonutConsumerFactory() {
- return m_ipojoHelper.getFactory("donut-consumer");
- }
-
- /**
- * Return the donut consumer factory using dataKey
- * and dataType.
- *
- * @return the donut consumer factory
- */
- public Factory getDonutConsumer2Factory() {
- return m_ipojoHelper.getFactory("donut-consumer-2");
- }
-
- /**
- * Return the donut event consumer factory.
- *
- * @return the donut event consumer factory
- */
- public Factory getDonutEventConsumerFactory() {
- return m_ipojoHelper.getFactory(
- "donut-event-consumer");
- }
-
- /**
- * Return the event consumer factory.
- *
- * @return the event consumer factory
- */
- public Factory getEventConsumerFactory() {
- return m_ipojoHelper.getFactory("event-consumer");
- }
-
- /**
- * Return the event tracker.
- *
- * @return the event consumer factory
- */
- public Factory getEventTrackerFactory() {
- return m_ipojoHelper.getFactory("event-tracker");
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java
deleted file mode 100644
index c000435a0f..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java
+++ /dev/null
@@ -1,958 +0,0 @@
-/*
- * 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;
-
-import org.apache.felix.ipojo.*;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
-import org.apache.felix.ipojo.metadata.Attribute;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Test the good behaviour of the EventAdminHandler.
- *
- * @author Felix Project Team
- */
-public class TestBadConfigurations extends Common {
-
- /**
- * The namespace of the Event admin handler.
- */
- private static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
- /**
- * The utility class instance.
- */
- public EahTestUtils m_utils;
- /**
- * The available components.
- */
- private Element[] m_components;
- /**
- * The description of a component that uses an event publisher.
- */
- private Element m_provider;
- /**
- * The event publisher description.
- */
- private Element m_publisher;
- /**
- * The name attribute of the event publisher.
- */
- private Attribute m_publisherName;
- /**
- * The field attribute of the event publisher.
- */
- private Attribute m_publisherField;
- /**
- * The topics attribute of the event publisher.
- */
- private Attribute m_publisherTopics;
- /**
- * The data-key attribute of the event publisher.
- */
- private Attribute m_publisherDataKey;
- /**
- * The synchronous attribute of the event publisher.
- */
- private Attribute m_publisherSynchronous;
- /**
- * The description of a component that uses an event subscriber.
- */
- private Element m_consumer;
- /**
- * The event subscriber description.
- */
- private Element m_subscriber;
- /**
- * The name attribute of the event subscriber.
- */
- private Attribute m_subscriberName;
- /**
- * The callback attribute of the event subscriber.
- */
- private Attribute m_subscriberCallback;
- /**
- * The topics attribute of the event subscriber.
- */
- private Attribute m_subscriberTopics;
- /**
- * The data-key attribute of the event subscriber.
- */
- private Attribute m_subscriberDataKey;
- /**
- * The data-type attribute of the event subscriber.
- */
- private Attribute m_subscriberDataType;
-
- private Element getManipulationForComponent(String compName) {
- for (int i = 0; i < m_components.length; i++) {
- if (m_components[i].containsAttribute("name")
- && m_components[i].getAttribute("name").equals(compName)) {
- return m_components[i].getElements("manipulation")[0];
- }
- }
- return null;
- }
-
- /**
- * Initialization before test cases.
- *
- * Create all the instances
- */
- @Before
- public void setUp() {
- m_utils = new EahTestUtils(bc, ipojoHelper);
- /**
- * Get the list of available components.
- */
- try {
- String header = (String) getTestBundle().getHeaders().get(
- "iPOJO-Components");
- m_components = ManifestMetadataParser.parseHeaderMetadata(header)
- .getElements("component");
- } catch (ParseException e) {
- fail("Parse Exception when parsing iPOJO-Component");
- }
-
- /**
- * Initialize the standard publishing component (based on the
- * asynchronous donut provider).
- */
- m_provider = new Element("component", "");
- m_provider.addAttribute(new Attribute("className",
- "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl"));
- m_provider.addAttribute(new Attribute("name",
- "standard donut provider for bad tests"));
-
- // The provided service of the publisher
- Element providesDonutProvider = new Element("provides", "");
- providesDonutProvider.addAttribute(new Attribute("interface",
- "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider"));
- Element providesDonutProviderProperty = new Element("property", "");
- providesDonutProviderProperty
- .addAttribute(new Attribute("name", "name"));
- providesDonutProviderProperty.addAttribute(new Attribute("field",
- "m_name"));
- providesDonutProviderProperty.addAttribute(new Attribute("value",
- "Unknown donut vendor"));
- providesDonutProvider.addElement(providesDonutProviderProperty);
- m_provider.addElement(providesDonutProvider);
-
- // The event publisher, corresponding to the following description :
- //
- m_publisher = new Element("publisher", NAMESPACE);
- m_publisherName = new Attribute("name", "donut-publisher");
- m_publisherField = new Attribute("field", "m_publisher");
- m_publisherTopics = new Attribute("topics", "food/donuts");
- m_publisherDataKey = new Attribute("data-key", "food");
- m_publisherSynchronous = new Attribute("synchronous", "false");
- m_publisher.addAttribute(m_publisherName);
- m_publisher.addAttribute(m_publisherField);
- m_publisher.addAttribute(m_publisherTopics);
- m_publisher.addAttribute(m_publisherDataKey);
- m_publisher.addAttribute(m_publisherSynchronous);
- m_provider.addElement(m_publisher);
-
- m_provider.addElement(getManipulationForComponent("donut-provider"));
-
- /**
- * Initialize the standard subscribing component (based on the donut
- * consumer).
- */
- m_consumer = new Element("component", "");
- m_consumer.addAttribute(new Attribute("className",
- "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl"));
- m_consumer.addAttribute(new Attribute("name",
- "standard donut consumer for bad tests"));
-
- // The provided service of the publisher
- Element providesDonutConsumer = new Element("provides", "");
- providesDonutConsumer.addAttribute(new Attribute("interface",
- "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer"));
- Element providesDonutConsumerNameProperty = new Element("property", "");
- providesDonutConsumerNameProperty.addAttribute(new Attribute("name",
- "name"));
- providesDonutConsumerNameProperty.addAttribute(new Attribute("field",
- "m_name"));
- providesDonutConsumerNameProperty.addAttribute(new Attribute("value",
- "Unknown donut consumer"));
- providesDonutConsumer.addElement(providesDonutConsumerNameProperty);
- Element providesDonutConsumerSlowProperty = new Element("property", "");
- providesDonutConsumerSlowProperty.addAttribute(new Attribute("name",
- "slow"));
- providesDonutConsumerSlowProperty.addAttribute(new Attribute("field",
- "m_isSlow"));
- providesDonutConsumerSlowProperty.addAttribute(new Attribute("value",
- "false"));
- providesDonutConsumer.addElement(providesDonutConsumerSlowProperty);
- m_consumer.addElement(providesDonutConsumer);
-
- // The event publisher, corresponding to the following description :
- //
- m_subscriber = new Element("subscriber", NAMESPACE);
- m_subscriberName = new Attribute("name", "donut-subscriber");
- m_subscriberCallback = new Attribute("callback", "receiveDonut");
- m_subscriberTopics = new Attribute("topics", "food/donuts");
- m_subscriberDataKey = new Attribute("data-key", "food");
- m_subscriberDataType = new Attribute("data-type",
- "org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut");
- m_subscriber.addAttribute(m_subscriberName);
- m_subscriber.addAttribute(m_subscriberCallback);
- m_subscriber.addAttribute(m_subscriberTopics);
- m_subscriber.addAttribute(m_subscriberDataKey);
- m_subscriber.addAttribute(m_subscriberDataType);
- m_consumer.addElement(m_subscriber);
-
- m_consumer.addElement(getManipulationForComponent("donut-consumer"));
- }
-
- /**
- * Test the base configuration is correct to be sure the bad tests will fail
- * because of they are really bad, and not because of an other application
- * error.
- *
- * This test simply create a provider and a consumer instance, send one
- * event and check it is received.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testGoodConfig()
- throws ConfigurationException, UnacceptableConfiguration,
- MissingHandlerException {
- /**
- * Create the provider and the consumer instances.
- */
- Dictionary properties = new Hashtable();
-
- // Provider
- ComponentFactory providerFactory = new ComponentFactory(bc,
- m_provider);
- providerFactory.start();
- properties.put("instance.name", "Emperor of donuts");
- ComponentInstance providerInstance = providerFactory
- .createComponentInstance(properties);
- ServiceReference providerService = ipojoHelper
- .getServiceReferenceByName(DonutProvider.class
- .getName(), providerInstance.getInstanceName());
- DonutProvider provider = (DonutProvider) bc
- .getService(providerService);
-
- // The consumer
- properties = new Hashtable();
- ComponentFactory consumerFactory = new ComponentFactory(bc,
- m_consumer);
- consumerFactory.start();
- properties.put("instance.name", "Homer Simpson");
- properties.put("slow", "false");
- ComponentInstance consumerInstance = consumerFactory
- .createComponentInstance(properties);
- ServiceReference consumerService = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), consumerInstance.getInstanceName());
- DonutConsumer consumer = (DonutConsumer) bc
- .getService(consumerService);
-
- /**
- * Test the normal behaviour of the instances.
- */
- consumer.clearDonuts();
- Donut sentDonut = provider.sellDonut();
- Donut receivedDonut = consumer.waitForDonut();
- assertEquals("The received donut must be the same as the sent one.",
- sentDonut, receivedDonut);
-
- /**
- * Destroy component's instances.
- */
- bc.ungetService(providerService);
- providerInstance.dispose();
- bc.ungetService(consumerService);
- consumerInstance.dispose();
- providerFactory.stop();
- consumerFactory.stop();
- }
-
- /**
- * Try to create a publisher with no name.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithoutName()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher
- m_publisher.removeAttribute(m_publisherName);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when no name is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.addAttribute(m_publisherName);
- }
- }
-
- /**
- * Try to create a publisher with no field.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithoutField()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher
- m_publisher.removeAttribute(m_publisherField);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when no field is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.addAttribute(m_publisherField);
- }
- }
-
- /**
- * Try to create a publisher with an unexisting field.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithUnexistingField()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher and replace with an
- // unexisting field name
- m_publisher.removeAttribute(m_publisherField);
- Attribute unexistingField = new Attribute("field", "m_unexistingField");
- m_publisher.addAttribute(unexistingField);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when an unexisting field is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.removeAttribute(unexistingField);
- m_publisher.addAttribute(m_publisherField);
- }
- }
-
- /**
- * Try to create a publisher with a bad typed field.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithBadTypedField()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher and replace with an
- // bad typed field name
- m_publisher.removeAttribute(m_publisherField);
- Attribute badTypedField = new Attribute("field", "m_name");
- m_publisher.addAttribute(badTypedField);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when an bad typed field is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.removeAttribute(badTypedField);
- m_publisher.addAttribute(m_publisherField);
- }
- }
-
- /**
- * Try to create a publisher instance without topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithoutTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the publisher
- m_publisher.removeAttribute(m_publisherTopics);
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- fact.start();
-
- // Try to create an instance without specified topics
- Dictionary conf = new Hashtable();
- conf.put("instance.name", "provider without topics");
-
- ComponentInstance instance;
- try {
- instance = fact.createComponentInstance(conf);
- // Should not be executed
- instance.dispose();
- fail("The factory must not create instance without specified topics.");
- } catch (ConfigurationException e) {
- // OK
- } finally {
- fact.stop();
- // Restore the original state of the publisher
- m_publisher.addAttribute(m_publisherTopics);
- }
- }
-
- /**
- * Try to create a publisher with malformed topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithMalformedTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the publisher and replace with a
- // malformed one
- m_publisher.removeAttribute(m_publisherTopics);
- Attribute malformedTopics = new Attribute("topics",
- "| |\\| \\/ /-\\ |_ | |)");
- m_publisher.addAttribute(malformedTopics);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when invalid topics are specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.removeAttribute(malformedTopics);
- m_publisher.addAttribute(m_publisherTopics);
- }
- }
-
- /**
- * Try to create a publisher with a pattern topic (ending with '*') instead of a fixed topic.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithPatternTopic()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the publisher and replace with a
- // malformed one
- m_publisher.removeAttribute(m_publisherTopics);
- Attribute malformedTopics = new Attribute("topics",
- "a/pattern/topic/*");
- m_publisher.addAttribute(malformedTopics);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when invalid topics are specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_publisher.removeAttribute(malformedTopics);
- m_publisher.addAttribute(m_publisherTopics);
- }
- }
-
- /**
- * Try to create a publisher with malformed instance topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testPublisherWithMalformedInstanceTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the publisher and replace with a
- // malformed one
- m_publisher.removeAttribute(m_publisherTopics);
- ComponentFactory fact = new ComponentFactory(bc, m_provider);
- fact.start();
-
- // Try to create an instance with malformed specified topics
- Dictionary conf = new Hashtable();
- conf.put("instance.name", "provider with malformed topics");
- Dictionary topics = new Hashtable();
- topics.put("donut-publisher", "| |\\| \\/ /-\\ |_ | |)");
- conf.put("event.topics", topics);
-
- ComponentInstance instance;
- try {
- instance = fact.createComponentInstance(conf);
- // Should not be executed
- instance.dispose();
- fail("The factory must not create instance with invalid specified topics.");
- } catch (ConfigurationException e) {
- // OK
- } finally {
- fact.stop();
- // Restore the original state of the publisher
- m_publisher.addAttribute(m_publisherTopics);
- }
- }
-
- /**
- * Try to create a subscriber with no name.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithoutName()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher
- m_subscriber.removeAttribute(m_subscriberName);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when no name is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_subscriber.addAttribute(m_subscriberName);
- }
- }
-
- /**
- * Try to create a subscriber with no callback.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithoutCallback()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the name attribute of the publisher
- m_subscriber.removeAttribute(m_subscriberCallback);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when no callback is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the publisher
- m_subscriber.addAttribute(m_subscriberCallback);
- }
- }
-
- /**
- * Try to create a subscriber instance without topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithoutTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the subscriber
- m_subscriber.removeAttribute(m_subscriberTopics);
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- fact.start();
-
- // Try to create an instance without specified topics
- Dictionary conf = new Hashtable();
- conf.put("instance.name", "consumer without topics");
- conf.put("slow", "false");
-
- ComponentInstance instance;
- try {
- instance = fact.createComponentInstance(conf);
- // Should not be executed
- instance.dispose();
- fail("The factory must not create instance without specified topics.");
- } catch (ConfigurationException e) {
- // OK
- } finally {
- fact.stop();
- // Restore the original state of the subscriber
- m_subscriber.addAttribute(m_subscriberTopics);
- }
- }
-
- /**
- * Try to create a subscriber with malformed topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithMalformedTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the subscriber and replace with a
- // malformed one
- m_subscriber.removeAttribute(m_subscriberTopics);
- Attribute malformedTopics = new Attribute("topics",
- "| |\\| \\/ /-\\ |_ | |)");
- m_subscriber.addAttribute(malformedTopics);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when invalid topics are specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the subscriber
- m_subscriber.removeAttribute(malformedTopics);
- m_subscriber.addAttribute(m_subscriberTopics);
- }
- }
-
- /**
- * Try to create a subscriber with malformed instance topics.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithMalformedInstanceTopics()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the topics attribute of the subscriber and replace with a
- // malformed one
- m_subscriber.removeAttribute(m_subscriberTopics);
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- fact.start();
-
- // Try to create an instance with malformed specified topics
- Dictionary conf = new Hashtable();
- conf.put("instance.name", "consumer with malformed topics");
- Dictionary topics = new Hashtable();
- topics.put("donut-subscriber", "| |\\| \\/ /-\\ |_ | |)");
- conf.put("event.topics", topics);
-
- ComponentInstance instance;
- try {
- instance = fact.createComponentInstance(conf);
- // Should not be executed
- instance.dispose();
- fail("The factory must not create instance with invalid specified topics.");
- } catch (ConfigurationException e) {
- // OK
- } finally {
- fact.stop();
- // Restore the original state of the subscriber
- m_subscriber.addAttribute(m_subscriberTopics);
- }
- }
-
- /**
- * Try to create a subscriber with unknown data type.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithUnknownDataType()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the data-type attribute of the subscriber and replace with a
- // malformed one
- m_subscriber.removeAttribute(m_subscriberDataType);
- Attribute unknownType = new Attribute("data-type", "org.unknown.Clazz");
- m_subscriber.addAttribute(unknownType);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when unknown data type is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the subscriber
- m_subscriber.removeAttribute(unknownType);
- m_subscriber.addAttribute(m_subscriberDataType);
- }
- }
-
- /**
- * Try to create a subscriber with a data type that does not match with the
- * callback parameter type.
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- */
- @Test
- public void testSubscriberWithUnappropriatedDataType()
- throws ConfigurationException, MissingHandlerException,
- UnacceptableConfiguration {
-
- // Remove the data-type attribute of the subscriber and replace with a
- // malformed one
- m_subscriber.removeAttribute(m_subscriberDataType);
- Attribute unknownType = new Attribute("data-type", "java.lang.String");
- m_subscriber.addAttribute(unknownType);
-
- // Create and try to start the factory
- ComponentFactory fact = new ComponentFactory(bc, m_consumer);
- try {
- fact.start();
- // Should not be executed
- fact.stop();
- fail("The factory must not start when unappropriated data type is specified.");
- } catch (IllegalStateException e) {
- // OK
- } finally {
- // Restore the original state of the subscriber
- m_subscriber.removeAttribute(unknownType);
- m_subscriber.addAttribute(m_subscriberDataType);
- }
- }
-
- // DEBUG
- public void dumpElement(String message, Element root) {
- System.err.println(message + "\n" + dumpElement(0, root));
- }
-
- // DEBUG
- private String dumpElement(int level, Element element) {
- StringBuilder sb = new StringBuilder();
- // Enter tag
- for (int i = 0; i < level; i++) {
- sb.append(" ");
- }
- sb.append('<');
- sb.append(element.getName());
- Attribute[] attributes = element.getAttributes();
- for (int i = 0; i < attributes.length; i++) {
- Attribute attribute = attributes[i];
- sb.append(' ');
- sb.append(attribute.getName());
- sb.append('=');
- sb.append(attribute.getValue());
- }
- sb.append(">\n");
- // Children
- Element[] elements = element.getElements();
- for (int i = 0; i < elements.length; i++) {
- sb.append(dumpElement(level + 1, elements[i]));
- }
- // Exit tag
- for (int i = 0; i < level; i++) {
- sb.append(" ");
- }
- sb.append("" + element.getName() + ">\n");
- return sb.toString();
- }
-
- /**
- * Creates a subscriber listening on a pattern topic (ending with '*').
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened.
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened.
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened.
- */
- @Test
- public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- Dictionary properties = new Hashtable();
- Dictionary topics = new Hashtable();
-
- // Create the donut consumer instance, listening on a pattern topic
- properties.put("instance.name", "subscriber with pattern topic");
- topics.put("donut-subscriber", "a/pattern/topic/*rf");
- properties.put("event.topics", topics);
- ComponentInstance instance = null;
- try {
- instance = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
-
- // Should not been executed
- instance.dispose();
- fail("An invalid topic scope was accepted)");
-
- } catch (ConfigurationException e) {
- // Nothing to do
- }
-
- properties = new Hashtable();
- topics = new Hashtable();
-
- // Create the donut consumer instance, listening on a pattern topic
- properties.put("instance.name", "subscriber with pattern topic");
- topics.put("donut-subscriber", "a/pattern/*topic/rf");
- properties.put("event.topics", topics);
-
- try {
- instance = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
- instance.dispose();
- fail("An invalid topic scope was accepted (2)");
- } catch (ConfigurationException e) {
- // Nothing to do
- }
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java
deleted file mode 100644
index f9fb155b17..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * 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;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.MissingHandlerException;
-import org.apache.felix.ipojo.UnacceptableConfiguration;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-
-import java.util.*;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test the good behaviour of the EventAdminHandler.
- *
- * @author Felix Project Team
- */
-public class TestEventAdminHandler extends Common {
-
- /**
- * The number of providers to test.
- */
- private static final int NUMBER_OF_PROVIDERS = 6;
- /**
- * The number of providers using the event admin handler to test.
- */
- private static final int NUMBER_OF_EAH_PROVIDERS = 4;
- /**
- * The number of consumers to test.
- */
- private static final int NUMBER_OF_CONSUMERS = 6;
- /**
- * The number of synchronous providers to test.
- */
- private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
- /**
- * The number of slow consumers to test.
- */
- private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
- /**
- * The list of topics to test.
- */
- private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
- "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
- /**
- * The utility class instance.
- */
- public EahTestUtils m_utils;
- /**
- * The providers' instances.
- */
- private ComponentInstance[] m_providersInstances;
- /**
- * The providers' service references.
- */
- private ServiceReference[] m_providersServices;
- /**
- * The providers' services.
- */
- private DonutProvider[] m_providers;
- /**
- * The synchronous providers' services.
- */
- private DonutProvider[] m_synchronousProviders;
- /**
- * The instances of providers that uses the event admin handler.
- */
- private ComponentInstance[] m_eahProvidersInstances;
- /**
- * The services of the providers that uses the event admin handler.
- */
- private DonutProvider[] m_eahProviders;
- /**
- * The synchronous donut event provider service.
- */
- private DonutProvider m_synchronousDonutEventProvider;
- /**
- * The consumers' instances.
- */
- private ComponentInstance[] m_consumersInstances;
- /**
- * The consumers' service references.
- */
- private ServiceReference[] m_consumersServices;
- /**
- * The consumers' services.
- */
- private DonutConsumer[] m_consumers;
- /**
- * The slow consumers' services.
- */
- private DonutConsumer[] m_quickConsumers;
- /**
- * The event tracker' instances.
- */
- private ComponentInstance m_eventTrackerInstance;
- /**
- * The event tracker' service references.
- */
- private ServiceReference m_eventTrackerService;
- /**
- * The event tracker service.
- */
- private EventTracker m_eventTracker;
- /**
- * The filtered consumers' instances.
- */
- private ComponentInstance[] m_filteredConsumersInstances;
- /**
- * The filtered consumers' service references.
- */
- private ServiceReference[] m_filteredConsumersServices;
- /**
- * The filtered consumers' services.
- */
- private DonutConsumer[] m_filteredConsumers;
- /**
- * The providers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsProvidersInstances;
- /**
- * The providers' service references with specified topics.
- */
- private ServiceReference[] m_topicsProvidersServices;
- /**
- * The providers' service with specified topics.
- */
- private DonutProvider[] m_topicsProviders;
- /**
- * The provider that send donuts on the "foo" topic.
- */
- private DonutProvider m_fooProvider;
- /**
- * The provider that send donuts on the "bar" topic.
- */
- private DonutProvider m_barProvider;
- /**
- * The provider that send donuts on the "nut" topic.
- */
- private DonutProvider m_nutProvider;
- /**
- * The provider that send donuts on the "foo,bar" topics.
- */
- private DonutProvider m_fooBarProvider;
- /**
- * The provider that send donuts on the "bar,nut" topics.
- */
- private DonutProvider m_barNutProvider;
- /**
- * The provider that send donuts on the "foo,nut" topics.
- */
- private DonutProvider m_fooNutProvider;
- /**
- * The provider that send donuts on the "foo,bar,nut" topics.
- */
- private DonutProvider m_fooBarNutProvider;
- /**
- * The consumers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsConsumersInstances;
- /**
- * The consumers' service references with specified topics.
- */
- private ServiceReference[] m_topicsConsumersServices;
- /**
- * The consumers' service references with specified topics.
- */
- private DonutConsumer[] m_topicsConsumers;
- /**
- * The consumer that receive donuts on the "foo" topic.
- */
- private DonutConsumer m_fooConsumer;
- /**
- * The consumer that receive donuts on the "bar" topic.
- */
- private DonutConsumer m_barConsumer;
- /**
- * The consumer that receive donuts on the "nut" topic.
- */
- private DonutConsumer m_nutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar" topics.
- */
- private DonutConsumer m_fooBarConsumer;
- /**
- * The consumer that receive donuts on the "bar,nut" topics.
- */
- private DonutConsumer m_barNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,nut" topics.
- */
- private DonutConsumer m_fooNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar,nut" topics.
- */
- private DonutConsumer m_fooBarNutConsumer;
-
- /**
- * Initialization before test cases.
- *
- * Create all the instances
- *
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- */
- @Before
- public void setUp()
- throws UnacceptableConfiguration, MissingHandlerException,
- ConfigurationException {
-
- m_utils = new EahTestUtils(bc, ipojoHelper);
- Dictionary properties = new Hashtable();
-
- // All the providers
- m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
- m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
- m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
- m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
- m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
- m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
- m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
-
- // Create the (asynchronous) donut provider
- properties.put("instance.name", "asynchronous donut provider");
- m_providersInstances[0] = m_utils.getDonutProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut provider");
- m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous donut event provider");
- m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut event provider");
- m_providersInstances[3] = m_utils
- .getSynchronousDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous event provider");
- m_providersInstances[4] = m_utils.getEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous event provider");
- m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutProvider.class.getName(),
- m_providersInstances[i].getInstanceName());
- m_providers[i] = (DonutProvider) bc
- .getService(m_providersServices[i]);
- }
- m_synchronousProviders[0] = m_providers[1];
- m_synchronousProviders[1] = m_providers[3];
- m_synchronousProviders[2] = m_providers[5];
- m_eahProviders[0] = m_providers[0];
- m_eahProviders[1] = m_providers[1];
- m_eahProviders[2] = m_providers[2];
- m_eahProviders[3] = m_providers[3];
- m_eahProvidersInstances[0] = m_providersInstances[0];
- m_eahProvidersInstances[1] = m_providersInstances[1];
- m_eahProvidersInstances[2] = m_providersInstances[2];
- m_eahProvidersInstances[3] = m_providersInstances[3];
- m_synchronousDonutEventProvider = m_providers[3];
-
- // All the consumers
- m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
- m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
- m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
- m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
- m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
- m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
- m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
- m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
-
- // Create the (quick) donut consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut consumer");
- m_consumersInstances[0] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the (quick) donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut event consumer");
- m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the (quick) event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick event consumer");
- m_consumersInstances[2] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow donut consumer
- properties = new Hashtable();
- properties.put("slow", Boolean.TRUE);
- properties.put("instance.name", "slow donut consumer");
- m_consumersInstances[3] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow donut event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[5] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutConsumer.class.getName(),
- m_consumersInstances[i].getInstanceName());
- m_consumers[i] = (DonutConsumer) bc
- .getService(m_consumersServices[i]);
- }
- m_quickConsumers[0] = m_consumers[0];
- m_quickConsumers[1] = m_consumers[1];
- m_quickConsumers[2] = m_consumers[2];
-
- // Create the event tracker
- properties = new Hashtable();
- properties.put("instance.name", "event tracker");
- m_eventTrackerInstance = m_utils.getEventTrackerFactory()
- .createComponentInstance(properties);
- m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
- EventTracker.class.getName(), m_eventTrackerInstance
- .getInstanceName());
- m_eventTracker = (EventTracker) bc
- .getService(m_eventTrackerService);
-
- // Create the filtered consumer
- Dictionary filter = new Hashtable();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- String flavour = Donut.FLAVOURS[i];
- properties = new Hashtable();
- filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
- properties.put("instance.name", flavour + " donut consumer");
- properties.put("event.filter", filter);
- m_filteredConsumersInstances[i] = m_utils
- .getDonutEventConsumerFactory().createComponentInstance(
- properties);
- m_filteredConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(
- DonutConsumer.class
- .getName(), m_filteredConsumersInstances[i]
- .getInstanceName());
- m_filteredConsumers[i] = (DonutConsumer) bc
- .getService(m_filteredConsumersServices[i]);
- }
-
- // Create the providers and consumers selling and receiving donuts on
- // specific topics
- Dictionary topics = new Hashtable();
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- String topicsString = TOPICS_LIST[i];
- properties = new Hashtable();
- // Create provider
- topics.put("donut-publisher", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut provider");
- m_topicsProvidersInstances[i] = m_utils
- .getSynchronousDonutProviderFactory()
- .createComponentInstance(properties);
- m_topicsProvidersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutProvider.class
- .getName(), m_topicsProvidersInstances[i]
- .getInstanceName());
- m_topicsProviders[i] = (DonutProvider) bc
- .getService(m_topicsProvidersServices[i]);
-
- // Create consumer
- properties = new Hashtable();
- topics.put("donut-subscriber", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut consumer");
-
- m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
- m_topicsConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), m_topicsConsumersInstances[i]
- .getInstanceName());
- m_topicsConsumers[i] = (DonutConsumer) bc
- .getService(m_topicsConsumersServices[i]);
- topics.remove("donut-subscriber");
- }
-
- m_fooProvider = m_topicsProviders[0];
- m_barProvider = m_topicsProviders[1];
- m_nutProvider = m_topicsProviders[2];
- m_fooBarProvider = m_topicsProviders[3];
- m_barNutProvider = m_topicsProviders[4];
- m_fooNutProvider = m_topicsProviders[5];
- m_fooBarNutProvider = m_topicsProviders[6];
- m_fooConsumer = m_topicsConsumers[0];
- m_barConsumer = m_topicsConsumers[1];
- m_nutConsumer = m_topicsConsumers[2];
- m_fooBarConsumer = m_topicsConsumers[3];
- m_barNutConsumer = m_topicsConsumers[4];
- m_fooNutConsumer = m_topicsConsumers[5];
- m_fooBarNutConsumer = m_topicsConsumers[6];
-
- }
-
- /**
- * Creates a subscriber listening on a pattern topic (ending with '*').
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened.
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened.
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened.
- */
- @Test
- public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- Dictionary properties = new Hashtable();
- Dictionary topics = new Hashtable();
-
- // Create the donut consumer instance, listening on a pattern topic
- properties.put("instance.name", "subscriber with pattern topic");
- topics.put("donut-subscriber", "a/pattern/topic/*");
- properties.put("event.topics", topics);
-
- ComponentInstance instance = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
- instance.dispose();
- }
-
- /**
- * Test the event handler reliability by sending events with all kinds of
- * publisher and check they are received by all kinds of subscriber.
- */
- @Test
- public void testReliability() {
-
- // Flush donut list for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumers[i].clearDonuts();
- }
-
- // Send a lot of donut with each provider
- List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
- * EahTestUtils.NUMBER_OF_TESTS);
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- sentDonuts.add(m_providers[i].sellDonut());
- }
- }
-
- // Wait a respectable amount of time
- EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
- + EahTestUtils.A_LONG_TIME);
-
- // Collect all received donuts for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts.",
- sentDonuts.size(), receivedDonuts.size());
- assertTrue("The receiver must have eaten all sent donuts.",
- receivedDonuts.containsAll(sentDonuts));
- }
- }
-
- /**
- * Test the synchronism of event sending for the component.
- *
- * This test consists to send synchronously a big amount of donuts and to
- * check immediately if it has been received (by all quick consumers).
- */
- @Test
- public void testSynchronism() {
-
- // Flush donut list for quick consumers
- for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
- m_quickConsumers[i].clearDonuts();
- }
-
- // Send a lot of donuts and check they are immediately received.
- Donut sentDonut;
- Donut receivedDonut;
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
- sentDonut = m_synchronousProviders[j].sellDonut();
- for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
- receivedDonut = m_quickConsumers[k].getDonut();
- assertEquals(
- "The donut must have been received immediately and be the be the same as the sent one.",
- sentDonut, receivedDonut);
- }
- }
- }
- }
-
- /**
- * Test that the received events contains the instance name of the sender.
- */
- @Test
- public void testInstanceName() {
-
- // Flush event list of the event tracker
- m_eventTracker.clearEvents();
-
- // Send donuts and check the sender instance name
- Event receivedEvent;
- for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
- m_eahProviders[i].sellDonut();
- receivedEvent = m_eventTracker.waitForEvent();
- assertEquals(
- "The instance name property of the received message must be the same as the sender instance name.",
- m_eahProvidersInstances[i].getInstanceName(), receivedEvent
- .getProperty("publisher.instance.name"));
- }
- }
-
- /**
- * Test the event filtering.
- *
- * This test send donuts with different flavours. Each filtered consumer
- * must receive only a certain kind of donut. Of course, all donuts must
- * have been received too.
- */
- @Test
- public void testFilters() {
-
- // The sent donuts, sorted by flavour
- List[] sentDonuts = new List[Donut.FLAVOURS.length];
-
- // Flush donut list for each filtered consumer
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- m_filteredConsumers[i].clearDonuts();
- sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
- / Donut.FLAVOURS.length);
- }
-
- // Send donuts
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- Donut donut = m_synchronousDonutEventProvider.sellDonut();
- sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
- .add(donut);
- }
-
- // Check the received donuts
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
- sentDonuts[i].size(), receivedDonuts.length);
- assertTrue(
- "The receiver must have eaten all sent donuts matching the wanted flavour.",
- Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
- }
-
- }
-
- /**
- * Test the event topic.
- *
- * This test send donuts on several topics. Each consumer (who listens to
- * one or several topics) must receive donuts sent on his specifics topics.
- */
- @Test
- public void testTopics() {
-
- // The sent donuts, sorted by topic
- int foos = 0;
- int bars = 0;
- int nuts = 0;
-
- // Flush consumers
- m_fooConsumer.clearDonuts();
- m_barConsumer.clearDonuts();
- m_nutConsumer.clearDonuts();
- m_fooBarConsumer.clearDonuts();
- m_barNutConsumer.clearDonuts();
- m_fooNutConsumer.clearDonuts();
- m_fooBarNutConsumer.clearDonuts();
-
- // Send donuts
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- m_fooProvider.sellDonut();
- foos++;
-
- m_barProvider.sellDonut();
- bars++;
-
- m_nutProvider.sellDonut();
- nuts++;
-
- m_fooBarProvider.sellDonut();
- foos++;
- bars++;
-
- m_barNutProvider.sellDonut();
- bars++;
- nuts++;
-
- m_fooNutProvider.sellDonut();
- foos++;
- nuts++;
-
- m_fooBarNutProvider.sellDonut();
- foos++;
- bars++;
- nuts++;
- }
-
- // Check received donuts
- assertEquals("The number of received donuts must be correct.", foos,
- m_fooConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars,
- m_barConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", nuts,
- m_nutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars, m_fooBarConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars
- + nuts, m_barNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + nuts, m_fooNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
-
- }
-
- /**
- * Finalization after test cases.
- *
- * Release all services references and destroy instances.
- */
- @After
- public void tearDown() {
- int index;
- for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
- bc.ungetService(m_providersServices[index]);
- m_providersInstances[index].dispose();
- }
- for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
- bc.ungetService(m_consumersServices[index]);
- m_consumersInstances[index].dispose();
- }
- bc.ungetService(m_eventTrackerService);
- m_eventTrackerInstance.dispose();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- bc.ungetService(m_filteredConsumersServices[i]);
- m_filteredConsumersInstances[i].dispose();
- }
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- bc.ungetService(m_topicsProvidersServices[i]);
- m_topicsProvidersInstances[i].dispose();
- bc.ungetService(m_topicsConsumersServices[i]);
- m_topicsConsumersInstances[i].dispose();
- }
-
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java
deleted file mode 100644
index ba28e47e36..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
- * 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;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.MissingHandlerException;
-import org.apache.felix.ipojo.UnacceptableConfiguration;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-
-import java.util.*;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test the good behaviour of the EventAdminHandler.
- *
- * @author Felix Project Team
- */
-public class TestEventAdminHandlerWithNewAttributes extends Common {
-
- /**
- * The number of providers to test.
- */
- private static final int NUMBER_OF_PROVIDERS = 6;
- /**
- * The number of providers using the event admin handler to test.
- */
- private static final int NUMBER_OF_EAH_PROVIDERS = 4;
- /**
- * The number of consumers to test.
- */
- private static final int NUMBER_OF_CONSUMERS = 6;
- /**
- * The number of synchronous providers to test.
- */
- private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
- /**
- * The number of slow consumers to test.
- */
- private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
- /**
- * The list of topics to test.
- */
- private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
- "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
- /**
- * The utility class instance.
- */
- public EahTestUtils m_utils;
- /**
- * The providers' instances.
- */
- private ComponentInstance[] m_providersInstances;
- /**
- * The providers' service references.
- */
- private ServiceReference[] m_providersServices;
- /**
- * The providers' services.
- */
- private DonutProvider[] m_providers;
- /**
- * The synchronous providers' services.
- */
- private DonutProvider[] m_synchronousProviders;
- /**
- * The instances of providers that uses the event admin handler.
- */
- private ComponentInstance[] m_eahProvidersInstances;
- /**
- * The services of the providers that uses the event admin handler.
- */
- private DonutProvider[] m_eahProviders;
- /**
- * The synchronous donut event provider service.
- */
- private DonutProvider m_synchronousDonutEventProvider;
- /**
- * The consumers' instances.
- */
- private ComponentInstance[] m_consumersInstances;
- /**
- * The consumers' service references.
- */
- private ServiceReference[] m_consumersServices;
- /**
- * The consumers' services.
- */
- private DonutConsumer[] m_consumers;
- /**
- * The slow consumers' services.
- */
- private DonutConsumer[] m_quickConsumers;
- /**
- * The event tracker' instances.
- */
- private ComponentInstance m_eventTrackerInstance;
- /**
- * The event tracker' service references.
- */
- private ServiceReference m_eventTrackerService;
- /**
- * The event tracker service.
- */
- private EventTracker m_eventTracker;
- /**
- * The filtered consumers' instances.
- */
- private ComponentInstance[] m_filteredConsumersInstances;
- /**
- * The filtered consumers' service references.
- */
- private ServiceReference[] m_filteredConsumersServices;
- /**
- * The filtered consumers' services.
- */
- private DonutConsumer[] m_filteredConsumers;
- /**
- * The providers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsProvidersInstances;
- /**
- * The providers' service references with specified topics.
- */
- private ServiceReference[] m_topicsProvidersServices;
- /**
- * The providers' service with specified topics.
- */
- private DonutProvider[] m_topicsProviders;
- /**
- * The provider that send donuts on the "foo" topic.
- */
- private DonutProvider m_fooProvider;
- /**
- * The provider that send donuts on the "bar" topic.
- */
- private DonutProvider m_barProvider;
- /**
- * The provider that send donuts on the "nut" topic.
- */
- private DonutProvider m_nutProvider;
- /**
- * The provider that send donuts on the "foo,bar" topics.
- */
- private DonutProvider m_fooBarProvider;
- /**
- * The provider that send donuts on the "bar,nut" topics.
- */
- private DonutProvider m_barNutProvider;
- /**
- * The provider that send donuts on the "foo,nut" topics.
- */
- private DonutProvider m_fooNutProvider;
- /**
- * The provider that send donuts on the "foo,bar,nut" topics.
- */
- private DonutProvider m_fooBarNutProvider;
- /**
- * The consumers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsConsumersInstances;
- /**
- * The consumers' service references with specified topics.
- */
- private ServiceReference[] m_topicsConsumersServices;
- /**
- * The consumers' service references with specified topics.
- */
- private DonutConsumer[] m_topicsConsumers;
- /**
- * The consumer that receive donuts on the "foo" topic.
- */
- private DonutConsumer m_fooConsumer;
- /**
- * The consumer that receive donuts on the "bar" topic.
- */
- private DonutConsumer m_barConsumer;
- /**
- * The consumer that receive donuts on the "nut" topic.
- */
- private DonutConsumer m_nutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar" topics.
- */
- private DonutConsumer m_fooBarConsumer;
- /**
- * The consumer that receive donuts on the "bar,nut" topics.
- */
- private DonutConsumer m_barNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,nut" topics.
- */
- private DonutConsumer m_fooNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar,nut" topics.
- */
- private DonutConsumer m_fooBarNutConsumer;
-
- /**
- * Initialization before test cases.
- *
- * Create all the instances
- *
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- */
- @Before
- public void setUp()
- throws UnacceptableConfiguration, MissingHandlerException,
- ConfigurationException {
-
- m_utils = new EahTestUtils(bc, ipojoHelper);
- Dictionary properties = new Hashtable();
-
- // All the providers
- m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
- m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
- m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
- m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
- m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
- m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
- m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
-
- // Create the (asynchronous) donut provider
- properties.put("instance.name", "asynchronous donut provider");
- m_providersInstances[0] = m_utils.getDonutProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut provider");
- m_providersInstances[1] = m_utils.getSynchronousDonutProvider2Factory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous donut event provider");
- m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut event provider");
- m_providersInstances[3] = m_utils
- .getSynchronousDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous event provider");
- m_providersInstances[4] = m_utils.getEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous event provider");
- m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutProvider.class.getName(),
- m_providersInstances[i].getInstanceName());
- m_providers[i] = (DonutProvider) bc
- .getService(m_providersServices[i]);
- }
- m_synchronousProviders[0] = m_providers[1];
- m_synchronousProviders[1] = m_providers[3];
- m_synchronousProviders[2] = m_providers[5];
- m_eahProviders[0] = m_providers[0];
- m_eahProviders[1] = m_providers[1];
- m_eahProviders[2] = m_providers[2];
- m_eahProviders[3] = m_providers[3];
- m_eahProvidersInstances[0] = m_providersInstances[0];
- m_eahProvidersInstances[1] = m_providersInstances[1];
- m_eahProvidersInstances[2] = m_providersInstances[2];
- m_eahProvidersInstances[3] = m_providersInstances[3];
- m_synchronousDonutEventProvider = m_providers[3];
-
- // All the consumers
- m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
- m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
- m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
- m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
-
- m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
- m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
- m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
- m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
-
- // Create the (quick) donut consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut consumer");
- m_consumersInstances[0] = m_utils.getDonutConsumer2Factory()
- .createComponentInstance(properties);
-
- // Create the (quick) donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut event consumer");
- m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the (quick) event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick event consumer");
- m_consumersInstances[2] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow donut consumer
- properties = new Hashtable();
- properties.put("slow", Boolean.TRUE);
- properties.put("instance.name", "slow donut consumer");
- m_consumersInstances[3] = m_utils.getDonutConsumer2Factory()
- .createComponentInstance(properties);
-
- // Create the slow donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow donut event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[5] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutConsumer.class.getName(),
- m_consumersInstances[i].getInstanceName());
- m_consumers[i] = (DonutConsumer) bc
- .getService(m_consumersServices[i]);
- }
- m_quickConsumers[0] = m_consumers[0];
- m_quickConsumers[1] = m_consumers[1];
- m_quickConsumers[2] = m_consumers[2];
-
- // Create the event tracker
- properties = new Hashtable();
- properties.put("instance.name", "event tracker");
- m_eventTrackerInstance = m_utils.getEventTrackerFactory()
- .createComponentInstance(properties);
- m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
- EventTracker.class.getName(), m_eventTrackerInstance
- .getInstanceName());
- m_eventTracker = (EventTracker) bc
- .getService(m_eventTrackerService);
-
- // Create the filtered consumer
- Dictionary filter = new Hashtable();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- String flavour = Donut.FLAVOURS[i];
- properties = new Hashtable();
- filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
- properties.put("instance.name", flavour + " donut consumer");
- properties.put("event.filter", filter);
- m_filteredConsumersInstances[i] = m_utils
- .getDonutEventConsumerFactory().createComponentInstance(
- properties);
- m_filteredConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), m_filteredConsumersInstances[i]
- .getInstanceName());
- m_filteredConsumers[i] = (DonutConsumer) bc
- .getService(m_filteredConsumersServices[i]);
- }
-
- // Create the providers and consumers selling and receiving donuts on
- // specific topics
- Dictionary topics = new Hashtable();
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- String topicsString = TOPICS_LIST[i];
- properties = new Hashtable();
- // Create provider
- topics.put("donut-publisher", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut provider");
- m_topicsProvidersInstances[i] = m_utils
- .getSynchronousDonutProviderFactory()
- .createComponentInstance(properties);
- m_topicsProvidersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutProvider.class
- .getName(), m_topicsProvidersInstances[i]
- .getInstanceName());
- m_topicsProviders[i] = (DonutProvider) bc
- .getService(m_topicsProvidersServices[i]);
-
- // Create consumer
- properties = new Hashtable();
- topics.put("donut-subscriber", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut consumer");
-
- m_topicsConsumersInstances[i] = m_utils.getDonutConsumer2Factory()
- .createComponentInstance(properties);
- m_topicsConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), m_topicsConsumersInstances[i]
- .getInstanceName());
- m_topicsConsumers[i] = (DonutConsumer) bc
- .getService(m_topicsConsumersServices[i]);
- topics.remove("donut-subscriber");
- }
-
- m_fooProvider = m_topicsProviders[0];
- m_barProvider = m_topicsProviders[1];
- m_nutProvider = m_topicsProviders[2];
- m_fooBarProvider = m_topicsProviders[3];
- m_barNutProvider = m_topicsProviders[4];
- m_fooNutProvider = m_topicsProviders[5];
- m_fooBarNutProvider = m_topicsProviders[6];
- m_fooConsumer = m_topicsConsumers[0];
- m_barConsumer = m_topicsConsumers[1];
- m_nutConsumer = m_topicsConsumers[2];
- m_fooBarConsumer = m_topicsConsumers[3];
- m_barNutConsumer = m_topicsConsumers[4];
- m_fooNutConsumer = m_topicsConsumers[5];
- m_fooBarNutConsumer = m_topicsConsumers[6];
-
- }
-
- /**
- * Creates a subscriber listening on a pattern topic (ending with '*').
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened.
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened.
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened.
- */
- @Test
- public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- Dictionary properties = new Hashtable();
- Dictionary topics = new Hashtable();
-
- // Create the donut consumer instance, listening on a pattern topic
- properties.put("instance.name", "subscriber with pattern topic");
- topics.put("donut-subscriber", "a/pattern/topic/*");
- properties.put("event.topics", topics);
-
- ComponentInstance instance = m_utils.getDonutConsumer2Factory()
- .createComponentInstance(properties);
- instance.dispose();
- }
-
- /**
- * Test the event handler reliability by sending events with all kinds of
- * publisher and check they are received by all kinds of subscriber.
- */
- @Test
- public void testReliability() {
-
- // Flush donut list for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumers[i].clearDonuts();
- }
-
- // Send a lot of donut with each provider
- List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
- * EahTestUtils.NUMBER_OF_TESTS);
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- sentDonuts.add(m_providers[i].sellDonut());
- }
- }
-
- // Wait a respectable amount of time
- EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
- + EahTestUtils.A_LONG_TIME);
-
- // Collect all received donuts for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts.",
- sentDonuts.size(), receivedDonuts.size());
- assertTrue("The receiver must have eaten all sent donuts.",
- receivedDonuts.containsAll(sentDonuts));
- }
- }
-
- /**
- * Test the synchronism of event sending for the component.
- *
- * This test consists to send synchronously a big amount of donuts and to
- * check immediately if it has been received (by all quick consumers).
- */
- @Test
- public void testSynchronism() {
-
- // Flush donut list for quick consumers
- for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
- m_quickConsumers[i].clearDonuts();
- }
-
- // Send a lot of donuts and check they are immediately received.
- Donut sentDonut;
- Donut receivedDonut;
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
- sentDonut = m_synchronousProviders[j].sellDonut();
- for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
- receivedDonut = m_quickConsumers[k].getDonut();
- assertEquals(
- "The donut must have been received immediately and be the be the same as the sent one.",
- sentDonut, receivedDonut);
- }
- }
- }
- }
-
- /**
- * Test that the received events contains the instance name of the sender.
- */
- @Test
- public void testInstanceName() {
-
- // Flush event list of the event tracker
- m_eventTracker.clearEvents();
-
- // Send donuts and check the sender instance name
- Event receivedEvent;
- for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
- m_eahProviders[i].sellDonut();
- receivedEvent = m_eventTracker.waitForEvent();
- assertEquals(
- "The instance name property of the received message must be the same as the sender instance name.",
- m_eahProvidersInstances[i].getInstanceName(), receivedEvent
- .getProperty("publisher.instance.name"));
- }
- }
-
- /**
- * Test the event filtering.
- *
- * This test send donuts with different flavours. Each filtered consumer
- * must receive only a certain kind of donut. Of course, all donuts must
- * have been received too.
- */
- @Test
- public void testFilters() {
-
- // The sent donuts, sorted by flavour
- List[] sentDonuts = new List[Donut.FLAVOURS.length];
-
- // Flush donut list for each filtered consumer
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- m_filteredConsumers[i].clearDonuts();
- sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
- / Donut.FLAVOURS.length);
- }
-
- // Send donuts
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- Donut donut = m_synchronousDonutEventProvider.sellDonut();
- sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
- .add(donut);
- }
-
- // Check the received donuts
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
- sentDonuts[i].size(), receivedDonuts.length);
- assertTrue(
- "The receiver must have eaten all sent donuts matching the wanted flavour.",
- Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
- }
-
- }
-
- /**
- * Test the event topic.
- *
- * This test send donuts on several topics. Each consumer (who listens to
- * one or several topics) must receive donuts sent on his specifics topics.
- */
- @Test
- public void testTopics() {
-
- // The sent donuts, sorted by topic
- int foos = 0;
- int bars = 0;
- int nuts = 0;
-
- // Flush consumers
- m_fooConsumer.clearDonuts();
- m_barConsumer.clearDonuts();
- m_nutConsumer.clearDonuts();
- m_fooBarConsumer.clearDonuts();
- m_barNutConsumer.clearDonuts();
- m_fooNutConsumer.clearDonuts();
- m_fooBarNutConsumer.clearDonuts();
-
- // Send donuts
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- m_fooProvider.sellDonut();
- foos++;
-
- m_barProvider.sellDonut();
- bars++;
-
- m_nutProvider.sellDonut();
- nuts++;
-
- m_fooBarProvider.sellDonut();
- foos++;
- bars++;
-
- m_barNutProvider.sellDonut();
- bars++;
- nuts++;
-
- m_fooNutProvider.sellDonut();
- foos++;
- nuts++;
-
- m_fooBarNutProvider.sellDonut();
- foos++;
- bars++;
- nuts++;
- }
-
- // Check received donuts
- assertEquals("The number of received donuts must be correct.", foos,
- m_fooConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars,
- m_barConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", nuts,
- m_nutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars, m_fooBarConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars
- + nuts, m_barNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + nuts, m_fooNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
-
- }
-
- /**
- * Finalization after test cases.
- *
- * Release all services references and destroy instances.
- */
- @After
- public void tearDown() {
- int index;
- for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
- bc.ungetService(m_providersServices[index]);
- m_providersInstances[index].dispose();
- }
- for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
- bc.ungetService(m_consumersServices[index]);
- m_consumersInstances[index].dispose();
- }
- bc.ungetService(m_eventTrackerService);
- m_eventTrackerInstance.dispose();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- bc.ungetService(m_filteredConsumersServices[i]);
- m_filteredConsumersInstances[i].dispose();
- }
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- bc.ungetService(m_topicsProvidersServices[i]);
- m_topicsProvidersInstances[i].dispose();
- bc.ungetService(m_topicsConsumersServices[i]);
- m_topicsConsumersInstances[i].dispose();
- }
-
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java
deleted file mode 100644
index 2bb7a1e858..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * 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;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.MissingHandlerException;
-import org.apache.felix.ipojo.UnacceptableConfiguration;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider;
-import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.event.Event;
-
-import java.util.*;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test the good behaviour of the EventAdminHandler.
- *
- * @author Felix Project Team
- */
-public class TestPublisher extends Common {
-
- /**
- * The number of providers to test.
- */
- private static final int NUMBER_OF_PROVIDERS = 6;
- /**
- * The number of providers using the event admin handler to test.
- */
- private static final int NUMBER_OF_EAH_PROVIDERS = 4;
- /**
- * The number of consumers to test.
- */
- private static final int NUMBER_OF_CONSUMERS = 6;
- /**
- * The number of synchronous providers to test.
- */
- private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3;
- /**
- * The number of slow consumers to test.
- */
- private static final int NUMBER_OF_QUICK_CONSUMERS = 3;
- /**
- * The list of topics to test.
- */
- private static final String[] TOPICS_LIST = {"foo", "bar", "nut",
- "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"};
- /**
- * The utility class instance.
- */
- public EahTestUtils m_utils;
- /**
- * The providers' instances.
- */
- private ComponentInstance[] m_providersInstances;
- /**
- * The providers' service references.
- */
- private ServiceReference[] m_providersServices;
- /**
- * The providers' services.
- */
- private DonutProvider[] m_providers;
- /**
- * The synchronous providers' services.
- */
- private DonutProvider[] m_synchronousProviders;
- /**
- * The instances of providers that uses the event admin handler.
- */
- private ComponentInstance[] m_eahProvidersInstances;
- /**
- * The services of the providers that uses the event admin handler.
- */
- private DonutProvider[] m_eahProviders;
- /**
- * The synchronous donut event provider service.
- */
- private DonutProvider m_synchronousDonutEventProvider;
- /**
- * The consumers' instances.
- */
- private ComponentInstance[] m_consumersInstances;
- /**
- * The consumers' service references.
- */
- private ServiceReference[] m_consumersServices;
- /**
- * The consumers' services.
- */
- private DonutConsumer[] m_consumers;
- /**
- * The slow consumers' services.
- */
- private DonutConsumer[] m_quickConsumers;
- /**
- * The event tracker' instances.
- */
- private ComponentInstance m_eventTrackerInstance;
- /**
- * The event tracker' service references.
- */
- private ServiceReference m_eventTrackerService;
- /**
- * The event tracker service.
- */
- private EventTracker m_eventTracker;
- /**
- * The filtered consumers' instances.
- */
- private ComponentInstance[] m_filteredConsumersInstances;
- /**
- * The filtered consumers' service references.
- */
- private ServiceReference[] m_filteredConsumersServices;
- /**
- * The filtered consumers' services.
- */
- private DonutConsumer[] m_filteredConsumers;
- /**
- * The providers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsProvidersInstances;
- /**
- * The providers' service references with specified topics.
- */
- private ServiceReference[] m_topicsProvidersServices;
- /**
- * The providers' service with specified topics.
- */
- private DonutProvider[] m_topicsProviders;
- /**
- * The provider that send donuts on the "foo" topic.
- */
- private DonutProvider m_fooProvider;
- /**
- * The provider that send donuts on the "bar" topic.
- */
- private DonutProvider m_barProvider;
- /**
- * The provider that send donuts on the "nut" topic.
- */
- private DonutProvider m_nutProvider;
- /**
- * The provider that send donuts on the "foo,bar" topics.
- */
- private DonutProvider m_fooBarProvider;
- /**
- * The provider that send donuts on the "bar,nut" topics.
- */
- private DonutProvider m_barNutProvider;
- /**
- * The provider that send donuts on the "foo,nut" topics.
- */
- private DonutProvider m_fooNutProvider;
- /**
- * The provider that send donuts on the "foo,bar,nut" topics.
- */
- private DonutProvider m_fooBarNutProvider;
- /**
- * The consumers' instances with specified topics.
- */
- private ComponentInstance[] m_topicsConsumersInstances;
- /**
- * The consumers' service references with specified topics.
- */
- private ServiceReference[] m_topicsConsumersServices;
- /**
- * The consumers' service references with specified topics.
- */
- private DonutConsumer[] m_topicsConsumers;
- /**
- * The consumer that receive donuts on the "foo" topic.
- */
- private DonutConsumer m_fooConsumer;
- /**
- * The consumer that receive donuts on the "bar" topic.
- */
- private DonutConsumer m_barConsumer;
- /**
- * The consumer that receive donuts on the "nut" topic.
- */
- private DonutConsumer m_nutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar" topics.
- */
- private DonutConsumer m_fooBarConsumer;
- /**
- * The consumer that receive donuts on the "bar,nut" topics.
- */
- private DonutConsumer m_barNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,nut" topics.
- */
- private DonutConsumer m_fooNutConsumer;
- /**
- * The consumer that receive donuts on the "foo,bar,nut" topics.
- */
- private DonutConsumer m_fooBarNutConsumer;
-
- /**
- * Initialization before test cases.
- *
- * Create all the instances
- *
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened
- */
- @Before
- public void setUp()
- throws UnacceptableConfiguration, MissingHandlerException,
- ConfigurationException {
-
- m_utils = new EahTestUtils(bc, ipojoHelper);
- Dictionary properties = new Hashtable();
-
- // All the providers
- m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS];
- m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS];
- m_providers = new DonutProvider[NUMBER_OF_PROVIDERS];
- m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS];
- m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS];
- m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS];
- m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsProviders = new DonutProvider[TOPICS_LIST.length];
-
- // Create the (asynchronous) donut provider
- properties.put("instance.name", "asynchronous donut provider");
- m_providersInstances[0] = m_utils.getDonutProviderUsingPublishesFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut provider");
- m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous donut event provider");
- m_providersInstances[2] = m_utils.getDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous donut event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous donut event provider");
- m_providersInstances[3] = m_utils
- .getSynchronousDonutEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the (asynchronous) event provider
- properties = new Hashtable();
- properties.put("instance.name", "asynchronous event provider");
- m_providersInstances[4] = m_utils.getEventProviderFactory()
- .createComponentInstance(properties);
-
- // Create the synchronous event provider
- properties = new Hashtable();
- properties.put("instance.name", "synchronous event provider");
- m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- m_providersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutProvider.class.getName(),
- m_providersInstances[i].getInstanceName());
- m_providers[i] = (DonutProvider) bc
- .getService(m_providersServices[i]);
- }
- m_synchronousProviders[0] = m_providers[1];
- m_synchronousProviders[1] = m_providers[3];
- m_synchronousProviders[2] = m_providers[5];
- m_eahProviders[0] = m_providers[0];
- m_eahProviders[1] = m_providers[1];
- m_eahProviders[2] = m_providers[2];
- m_eahProviders[3] = m_providers[3];
- m_eahProvidersInstances[0] = m_providersInstances[0];
- m_eahProvidersInstances[1] = m_providersInstances[1];
- m_eahProvidersInstances[2] = m_providersInstances[2];
- m_eahProvidersInstances[3] = m_providersInstances[3];
- m_synchronousDonutEventProvider = m_providers[3];
-
- // All the consumers
- m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS];
- m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS];
- m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS];
- m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS];
- m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length];
- m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length];
- m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length];
- m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length];
- m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length];
- m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length];
-
- // Create the (quick) donut consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut consumer");
- m_consumersInstances[0] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the (quick) donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick donut event consumer");
- m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the (quick) event consumer
- properties = new Hashtable();
- properties.put("instance.name", "quick event consumer");
- m_consumersInstances[2] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow donut consumer
- properties = new Hashtable();
- properties.put("slow", Boolean.TRUE);
- properties.put("instance.name", "slow donut consumer");
- m_consumersInstances[3] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow donut event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow donut event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Create the slow event consumer
- properties = new Hashtable();
- properties.put("instance.name", "slow event consumer");
- properties.put("slow", Boolean.TRUE);
- m_consumersInstances[5] = m_utils.getEventConsumerFactory()
- .createComponentInstance(properties);
-
- // Get all the services references
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumersServices[i] = ipojoHelper.getServiceReferenceByName(
- DonutConsumer.class.getName(),
- m_consumersInstances[i].getInstanceName());
- m_consumers[i] = (DonutConsumer) bc
- .getService(m_consumersServices[i]);
- }
- m_quickConsumers[0] = m_consumers[0];
- m_quickConsumers[1] = m_consumers[1];
- m_quickConsumers[2] = m_consumers[2];
-
- // Create the event tracker
- properties = new Hashtable();
- properties.put("instance.name", "event tracker");
- m_eventTrackerInstance = m_utils.getEventTrackerFactory()
- .createComponentInstance(properties);
- m_eventTrackerService = ipojoHelper.getServiceReferenceByName(
- EventTracker.class.getName(), m_eventTrackerInstance
- .getInstanceName());
- m_eventTracker = (EventTracker) bc
- .getService(m_eventTrackerService);
-
- // Create the filtered consumer
- Dictionary filter = new Hashtable();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- String flavour = Donut.FLAVOURS[i];
- properties = new Hashtable();
- filter.put("donut-event-subscriber", "(flavour=" + flavour + ")");
- properties.put("instance.name", flavour + " donut consumer");
- properties.put("event.filter", filter);
- m_filteredConsumersInstances[i] = m_utils
- .getDonutEventConsumerFactory().createComponentInstance(
- properties);
- m_filteredConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), m_filteredConsumersInstances[i]
- .getInstanceName());
- m_filteredConsumers[i] = (DonutConsumer) bc
- .getService(m_filteredConsumersServices[i]);
- }
-
- // Create the providers and consumers selling and receiving donuts on
- // specific topics
- Dictionary topics = new Hashtable();
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- String topicsString = TOPICS_LIST[i];
- properties = new Hashtable();
- // Create provider
- topics.put("donut-publisher", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut provider");
- m_topicsProvidersInstances[i] = m_utils
- .getSynchronousDonutProviderFactory()
- .createComponentInstance(properties);
- m_topicsProvidersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutProvider.class
- .getName(), m_topicsProvidersInstances[i]
- .getInstanceName());
- m_topicsProviders[i] = (DonutProvider) bc
- .getService(m_topicsProvidersServices[i]);
-
- // Create consumer
- properties = new Hashtable();
- topics.put("donut-subscriber", topicsString);
- properties.put("event.topics", topics);
- properties.put("instance.name", topicsString + " donut consumer");
-
- m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
- m_topicsConsumersServices[i] = ipojoHelper
- .getServiceReferenceByName(DonutConsumer.class
- .getName(), m_topicsConsumersInstances[i]
- .getInstanceName());
- m_topicsConsumers[i] = (DonutConsumer) bc
- .getService(m_topicsConsumersServices[i]);
- topics.remove("donut-subscriber");
- }
-
- m_fooProvider = m_topicsProviders[0];
- m_barProvider = m_topicsProviders[1];
- m_nutProvider = m_topicsProviders[2];
- m_fooBarProvider = m_topicsProviders[3];
- m_barNutProvider = m_topicsProviders[4];
- m_fooNutProvider = m_topicsProviders[5];
- m_fooBarNutProvider = m_topicsProviders[6];
- m_fooConsumer = m_topicsConsumers[0];
- m_barConsumer = m_topicsConsumers[1];
- m_nutConsumer = m_topicsConsumers[2];
- m_fooBarConsumer = m_topicsConsumers[3];
- m_barNutConsumer = m_topicsConsumers[4];
- m_fooNutConsumer = m_topicsConsumers[5];
- m_fooBarNutConsumer = m_topicsConsumers[6];
-
- }
-
- /**
- * Creates a subscriber listening on a pattern topic (ending with '*').
- *
- * @throws org.apache.felix.ipojo.ConfigurationException
- * something bad happened.
- * @throws org.apache.felix.ipojo.MissingHandlerException
- * something bad happened.
- * @throws org.apache.felix.ipojo.UnacceptableConfiguration
- * something bad happened.
- */
- @Test
- public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- Dictionary properties = new Hashtable();
- Dictionary topics = new Hashtable();
-
- // Create the donut consumer instance, listening on a pattern topic
- properties.put("instance.name", "subscriber with pattern topic");
- topics.put("donut-subscriber", "a/pattern/topic/*");
- properties.put("event.topics", topics);
-
- ComponentInstance instance = m_utils.getDonutConsumerFactory()
- .createComponentInstance(properties);
- instance.dispose();
- }
-
- /**
- * Test the event handler reliability by sending events with all kinds of
- * publisher and check they are received by all kinds of subscriber.
- */
- @Test
- public void testReliability() {
-
- // Flush donut list for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- m_consumers[i].clearDonuts();
- }
-
- // Send a lot of donut with each provider
- List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS
- * EahTestUtils.NUMBER_OF_TESTS);
- for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) {
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- sentDonuts.add(m_providers[i].sellDonut());
- }
- }
-
- // Wait a respectable amount of time
- EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME
- + EahTestUtils.A_LONG_TIME);
-
- // Collect all received donuts for each consumer
- for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) {
- List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts());
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts.",
- sentDonuts.size(), receivedDonuts.size());
- assertTrue("The receiver must have eaten all sent donuts.",
- receivedDonuts.containsAll(sentDonuts));
- }
- }
-
- /**
- * Test the synchronism of event sending for the component.
- *
- * This test consists to send synchronously a big amount of donuts and to
- * check immediately if it has been received (by all quick consumers).
- */
- @Test
- public void testSynchronism() {
-
- // Flush donut list for quick consumers
- for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) {
- m_quickConsumers[i].clearDonuts();
- }
-
- // Send a lot of donuts and check they are immediately received.
- Donut sentDonut;
- Donut receivedDonut;
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) {
- sentDonut = m_synchronousProviders[j].sellDonut();
- for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) {
- receivedDonut = m_quickConsumers[k].getDonut();
- assertEquals(
- "The donut must have been received immediately and be the be the same as the sent one.",
- sentDonut, receivedDonut);
- }
- }
- }
- }
-
- /**
- * Test that the received events contains the instance name of the sender.
- */
- @Test
- public void testInstanceName() {
-
- // Flush event list of the event tracker
- m_eventTracker.clearEvents();
-
- // Send donuts and check the sender instance name
- Event receivedEvent;
- for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) {
- m_eahProviders[i].sellDonut();
- receivedEvent = m_eventTracker.waitForEvent();
- assertEquals(
- "The instance name property of the received message must be the same as the sender instance name.",
- m_eahProvidersInstances[i].getInstanceName(), receivedEvent
- .getProperty("publisher.instance.name"));
- }
- }
-
- /**
- * Test the event filtering.
- *
- * This test send donuts with different flavours. Each filtered consumer
- * must receive only a certain kind of donut. Of course, all donuts must
- * have been received too.
- */
- @Test
- public void testFilters() {
-
- // The sent donuts, sorted by flavour
- List[] sentDonuts = new List[Donut.FLAVOURS.length];
-
- // Flush donut list for each filtered consumer
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- m_filteredConsumers[i].clearDonuts();
- sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS
- / Donut.FLAVOURS.length);
- }
-
- // Send donuts
- for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) {
- Donut donut = m_synchronousDonutEventProvider.sellDonut();
- sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())]
- .add(donut);
- }
-
- // Check the received donuts
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts();
- assertEquals(
- "The number of received donuts must be the same as the number of sent donuts with the matching flavour.",
- sentDonuts[i].size(), receivedDonuts.length);
- assertTrue(
- "The receiver must have eaten all sent donuts matching the wanted flavour.",
- Arrays.asList(receivedDonuts).containsAll(sentDonuts[i]));
- }
-
- }
-
- /**
- * Test the event topic.
- *
- * This test send donuts on several topics. Each consumer (who listens to
- * one or several topics) must receive donuts sent on his specifics topics.
- */
- @Test
- public void testTopics() {
-
- // The sent donuts, sorted by topic
- int foos = 0;
- int bars = 0;
- int nuts = 0;
-
- // Flush consumers
- m_fooConsumer.clearDonuts();
- m_barConsumer.clearDonuts();
- m_nutConsumer.clearDonuts();
- m_fooBarConsumer.clearDonuts();
- m_barNutConsumer.clearDonuts();
- m_fooNutConsumer.clearDonuts();
- m_fooBarNutConsumer.clearDonuts();
-
- // Send donuts
- for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) {
- m_fooProvider.sellDonut();
- foos++;
-
- m_barProvider.sellDonut();
- bars++;
-
- m_nutProvider.sellDonut();
- nuts++;
-
- m_fooBarProvider.sellDonut();
- foos++;
- bars++;
-
- m_barNutProvider.sellDonut();
- bars++;
- nuts++;
-
- m_fooNutProvider.sellDonut();
- foos++;
- nuts++;
-
- m_fooBarNutProvider.sellDonut();
- foos++;
- bars++;
- nuts++;
- }
-
- // Check received donuts
- assertEquals("The number of received donuts must be correct.", foos,
- m_fooConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars,
- m_barConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", nuts,
- m_nutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars, m_fooBarConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", bars
- + nuts, m_barNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + nuts, m_fooNutConsumer.getAllDonuts().length);
- assertEquals("The number of received donuts must be correct.", foos
- + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length);
-
- }
-
- /**
- * Finalization after test cases.
- *
- * Release all services references and destroy instances.
- */
- @After
- public void tearDown() {
- int index;
- for (index = 0; index < NUMBER_OF_PROVIDERS; index++) {
- bc.ungetService(m_providersServices[index]);
- m_providersInstances[index].dispose();
- }
- for (index = 0; index < NUMBER_OF_CONSUMERS; index++) {
- bc.ungetService(m_consumersServices[index]);
- m_consumersInstances[index].dispose();
- }
- bc.ungetService(m_eventTrackerService);
- m_eventTrackerInstance.dispose();
- for (int i = 0; i < Donut.FLAVOURS.length; i++) {
- bc.ungetService(m_filteredConsumersServices[i]);
- m_filteredConsumersInstances[i].dispose();
- }
- for (int i = 0; i < TOPICS_LIST.length; i++) {
- bc.ungetService(m_topicsProvidersServices[i]);
- m_topicsProvidersInstances[i].dispose();
- bc.ungetService(m_topicsConsumersServices[i]);
- m_topicsConsumersInstances[i].dispose();
- }
-
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt b/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt
deleted file mode 100644
index dec38256c1..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-Changes from the 1.6.0 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler
-
-** Improvement
- * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions
- * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision
- * [FELIX-2711] - The event admin handler should provides a Handler Description
-
-Changes from the 1.4.0 to 1.6.0
--------------------------------
-** Bug
- * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Improvement
- * Update parent pom
-
- Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-794] - Event Admin handler reject correctly formed topics
-
-** Improvement
- * [FELIX-795] - Improve metadata and manipulator performance
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-Version 1.0.0
--------------
- * Initial release
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml
deleted file mode 100644
index 69b340bf5d..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/obr.xml b/ipojo/handler/eventadmin/eventadmin-handler/obr.xml
deleted file mode 100644
index 4e53bb3885..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/obr.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Import Event Admin service
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler/pom.xml
deleted file mode 100644
index 873e87d59b..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/pom.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../../pom/pom.xml
-
- 4.0.0
- bundle
- Apache Felix iPOJO Event Admin Handler
- org.apache.felix.ipojo.handler.eventadmin
- 1.9.0-SNAPSHOT
-
-
- iPOJO extension to easily interact with the OSGi Event Admin.
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.0
-
-
- org.osgi
- org.osgi.core
- 4.2.0
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
- true
-
-
- org.apache.felix.ipojo.handlers.event*;version="1.2.0"
- ${project.name}
- ${project.artifactId}
- iPOJO Event Admin Handlers
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html
-
- The Apache Software Foundation
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.10.0
-
-
-
- ipojo-bundle
-
-
- metadata.xml
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
-
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
deleted file mode 100644
index c46dacfb8d..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.handlers.event;
-
-import org.apache.felix.ipojo.parser.ParseUtils;
-
-/**
- * Utility methods.
- *
- * @author Felix Project Team
- */
-public class EventUtil {
-
- /**
- * The separator between topics.
- */
- public static final String TOPIC_SEPARATOR = ",";
-
- /**
- * The separator between topics.
- */
- public static final String TOPIC_TOKEN_SEPARATOR = "/";
-
- /**
- * The topic token alphabet.
- */
- private static final String TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
-
- /**
- * Tests that the given topic match with the given topic pattern.
- *
- * @param topic the topic to test
- * @param topicPattern the topic pattern
- * @return true if it matches.
- */
- public static final boolean matches(String topic, String topicPattern) {
- if (topicPattern.equals("*")) {
- return true;
- }
- int star;
- if ((star = topicPattern.indexOf("*")) > 0) {
- return topic.startsWith(topicPattern.substring(0, star - 1));
- } else {
- return topic.equals(topicPattern);
- }
- }
-
- /**
- * Tests that the given topic match with the given topic patterns.
- *
- * @param topic the topic to test
- * @param topicPatterns the topic patterns
- * @return true if it matches.
- */
- public static final boolean matches(String topic, String[] topicPatterns) {
- int n = topicPatterns.length;
- for (int i = 0; i < n; i++) {
- if (matches(topic, topicPatterns[i])) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Check the given topic scope is valid.
- *
- * topicScope ::= "*" | ( topic "/*" ? )
- *
- * @param topicScope the topic scope to check.
- *
- * @return {@code true} if the given topic scope is valid, {@code false}
- * otherwise.
- */
- public static final boolean isValidTopicScope(String topicScope) {
- if (topicScope.equals("*")) {
- // Wildcard character only accepted.
- return true;
- }
-
- // Remove trailing "/*" if present, to check the topic radix.
- String topicWithoutWildcard;
- if (topicScope.endsWith("/*")) {
- topicWithoutWildcard = topicScope.substring(0,
- topicScope.length() - 2);
- } else {
- topicWithoutWildcard = topicScope;
- }
-
- // Validate the topic radix.
- return isValidTopic(topicWithoutWildcard);
- }
-
- /**
- * Check the given topic is valid.
- *
- * topic ::= token ( �/� token ) *
- *
- * @param topic the topic to check.
- *
- * @return {@code true} if the given topic is valid, {@code false}
- * otherwise.
- */
- public static final boolean isValidTopic(String topic) {
- if (topic.startsWith(TOPIC_TOKEN_SEPARATOR)
- || topic.endsWith(TOPIC_TOKEN_SEPARATOR)) {
- // A topic cannot start nor end with '/'.
- return false;
- }
-
- String[] tokens = ParseUtils.split(topic, TOPIC_TOKEN_SEPARATOR);
- if (tokens.length < 1) {
- // A topic must contain at least one token.
- return false;
- }
-
- // Check each token is valid.
- for (int i = 0; i < tokens.length; i++) {
- String token = tokens[i];
- if (!isValidToken(token)) {
- return false;
- }
- }
-
- // The topic is valid.
- return true;
- }
-
- /**
- * Check the given token is valid.
- *
- * token ::= ( alphanum | "_" | "-" )+
- *
- * @param token the token to check.
- *
- * @return {@code true} if the given topic token is valid, {@code false}
- * otherwise.
- */
- private static boolean isValidToken(String token) {
- int length = token.length();
- if (length < 1) {
- // Token must contain at least one character.
- return false;
- }
-
- for (int i = 0; i < length; i++) {
- // Each character in the token must belong to the token alphabet.
- if (TOKEN_ALPHABET.indexOf(token.charAt(i)) == -1) {
- return false;
- }
- }
-
- // The token is valid.
- return true;
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
deleted file mode 100644
index 162972641d..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.architecture.PropertyDescription;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.FieldMetadata;
-import org.osgi.service.event.EventAdmin;
-
-/**
- * Event Publisher Handler.
- *
- * @author Felix Project Team
- */
-public class EventAdminPublisherHandler extends PrimitiveHandler {
-
- /**
- * The handler Namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
-
- /**
- * The names of instance configuration properties.
- */
- public static final String TOPICS_PROPERTY = "event.topics";
-
- /**
- * The prefix for logged messages.
- */
- private static final String LOG_PREFIX = "EVENT ADMIN PUBLISHER HANDLER : ";
-
- /**
- * The instance manager.
- */
- private InstanceManager m_manager;
-
- /**
- * The current EventAdmin service.
- */
- private EventAdmin m_ea;
-
- /**
- * The publishers accessible by their fields.
- */
- private Map m_publishersByField = new Hashtable();
-
- /**
- * The handler description
- */
- private EventAdminPublisherHandlerDescription m_description;
-
- /**
- * Initializes the component type.
- *
- * @param cd the component type description to populate
- * @param metadata the component type metadata
- * @throws ConfigurationException if the given metadata is incorrect.
- * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(
- * org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)
- */
- public void initializeComponentFactory(ComponentTypeDescription cd,
- Element metadata)
- throws ConfigurationException {
-
- // Update the current component description
- Dictionary dict = new Properties();
- PropertyDescription pd = new PropertyDescription(TOPICS_PROPERTY,
- Dictionary.class.getName(), dict.toString());
- cd.addProperty(pd);
-
- // Get Metadata publishers
- Element[] publishers = metadata.getElements("publisher", NAMESPACE);
-
- // if publisher is null, look for 'publishes' elements
- if (publishers == null || publishers.length == 0) {
- publishers = metadata.getElements("publishes", NAMESPACE);
- }
-
- if (publishers != null) {
-
- // Maps used to check name and field are unique
- Set nameSet = new HashSet();
- Set fieldSet = new HashSet();
-
- // Check all publishers are well formed
- for (int i = 0; i < publishers.length; i++) {
-
- // Check the publisher configuration is correct by creating an
- // unused publisher metadata
- EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata(
- publishers[i]);
- String name = publisherMetadata.getName();
- info(LOG_PREFIX + "Checking publisher " + name);
-
- // Check field existence and type
- String field = publisherMetadata.getField();
- FieldMetadata fieldMetadata = getPojoMetadata()
- .getField(publisherMetadata.getField(),
- Publisher.class.getName());
- if (fieldMetadata == null) {
- throw new ConfigurationException(
- "Field not found in the component : "
- + Publisher.class.getName() + " " + field);
- }
-
- // Check name and field are unique
- if (nameSet.contains(name)) {
- throw new ConfigurationException(
- "A publisher with the same name already exists : "
- + name);
- } else if (fieldSet.contains(field)) {
- throw new ConfigurationException("The field " + field
- + " is already associated to a publisher");
- }
- nameSet.add(name);
- fieldSet.add(field);
- }
- } else {
- info(LOG_PREFIX + "No publisher to check");
- }
- }
-
- /**
- * Constructor.
- *
- * @param metadata the component type metadata
- * @param conf the instance configuration
- * @throws ConfigurationException if one event publication is not correct
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
- */
- public void configure(Element metadata, Dictionary conf)
- throws ConfigurationException {
-
- // Store the component manager
- m_manager = getInstanceManager();
-
- // Get the topics instance configuration
- Dictionary instanceTopics = (Dictionary) conf.get(TOPICS_PROPERTY);
-
- // Get Metadata publishers
- Element[] publishers = metadata.getElements("publisher", NAMESPACE);
-
- // if publisher is null, look for 'publishes' elements
- if (publishers == null || publishers.length == 0) {
- publishers = metadata.getElements("publishes", NAMESPACE);
- }
-
- if (publishers != null) {
- // then check publishers are well formed and fill the publishers'
- // map
- for (int i = 0; i < publishers.length; i++) {
-
- // Extract the publisher configuration
- EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata(
- publishers[i]);
- String name = publisherMetadata.getName();
- info(LOG_PREFIX + "Configuring publisher " + name);
-
- // Get the topic instance configuration if redefined
- String topicsString = (instanceTopics != null) ? (String) instanceTopics
- .get(name)
- : null;
- if (topicsString != null) {
- publisherMetadata.setTopics(topicsString);
- }
-
- // Check the publisher is correctly configured
- publisherMetadata.check();
-
- // Create the associated Publisher and insert it in the
- // publisher map
- Publisher publisher = new PublisherImpl(this, publisherMetadata
- .getTopics(), publisherMetadata.isSynchronous(),
- publisherMetadata.getDataKey(), m_manager
- .getInstanceName());
- m_publishersByField
- .put(publisherMetadata.getField(), publisher);
-
- // Register the callback that return the publisher
- // reference when the specified field is read by the
- // POJO.
- FieldMetadata fieldMetadata = getPojoMetadata()
- .getField(publisherMetadata.getField(),
- Publisher.class.getName());
- m_manager.register(fieldMetadata, this);
-
- }
- } else {
- info(LOG_PREFIX + "No publisher to configure");
- }
-
- setValidity(true);
-
- debug(LOG_PREFIX+ "Setup description....");
- m_description = new EventAdminPublisherHandlerDescription(this, m_publishersByField.values()); // Initialize the description.
-
- }
-
- /**
- * Starts the handler instance.
- *
- * This method does nothing.
- */
- public void start() {
- }
-
- /**
- * Stops the handler instance.
- *
- * This method does nothing.
- */
- public void stop() {
- }
-
- /**
- * Field interceptor callback. This method is called when the component
- * attempt to one of its Publisher field.
- *
- * @param pojo the accessed field
- * @param fieldName the name of the accessed field
- * @param value the value of the field (useless here)
- *
- * @return the Publisher associated with the accessed field's name
- */
- public Object onGet(Object pojo, String fieldName, Object value) {
- // Retrieve the publisher associated to the given field name
- Publisher pub = (Publisher) m_publishersByField.get(fieldName);
- if (pub == null) {
- error(LOG_PREFIX + "No publisher associated to the field "
- + fieldName);
- }
- return pub;
- }
-
- /**
- * This method is called by managed publishers to obtain the current
- * EventAdmin service.
- *
- * @return the current EventAdmin service.
- */
- public EventAdmin getEventAdminService() {
- return m_ea;
- }
-
- /**
- * Gets the handler description
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- public HandlerDescription getDescription() {
- return m_description;
- }
-
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java
deleted file mode 100644
index 3069766396..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.metadata.Attribute;
-import org.apache.felix.ipojo.metadata.Element;
-
-/**
- * Handler Description for Event Admin Publisher.
- *
- * @author Felix Project Team
- */
-public class EventAdminPublisherHandlerDescription extends HandlerDescription {
-
- /**
- * The list of publishers.
- */
- List/**/ m_publishersDescriptions;
-
- // FIXME : Add listener interface for
- // : onServiceArrival, onServiceDeparture, onServiceBound, onServiceUnbound
- // : methods.
-
- /**
- * Creates the {@link EventAdminPublisherHandlerDescription}.
- * @param handler the handler
- * @param publishers the list of publishers
- */
- public EventAdminPublisherHandlerDescription(Handler handler, Collection/**/ publishers) {
- super(handler);
-
- m_publishersDescriptions = new ArrayList/**/();
- if (publishers != null) {
- Iterator iterator = publishers.iterator();
- while (iterator.hasNext()){
- Publisher p = (Publisher) iterator.next();
- m_publishersDescriptions.add(new PublisherDescription(p));
- }
- }
-
- }
-
- /**
- * Gets the publisher descriptions.
- * @return the descriptions.
- */
- public PublisherDescription[] getPublisherDescriptions() {
- return (PublisherDescription[])
- m_publishersDescriptions.toArray(new PublisherDescription[m_publishersDescriptions.size()]);
- }
-
- /**
- * Gets the handler description.
- * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
- */
- public Element getHandlerInfo() {
- Element root = super.getHandlerInfo();
- for (int i = 0; i < m_publishersDescriptions.size(); i++) {
- PublisherDescription p = (PublisherDescription) m_publishersDescriptions.get(i);
- Element publisher = new Element("Publisher", "");
- publisher.addAttribute(new Attribute("name", p.getName()));
- publisher.addAttribute(new Attribute("synchronous", String.valueOf(p.isSynchronous())));
- publisher.addAttribute(new Attribute("data_key", p.getDataKey()));
- Element topics = new Element("Topics", "");
- if (p.getTopics() != null) {
- for (int j = 0; j < p.getTopics().length; j++) {
- String topic = p.getTopics()[j];
- Element e_topic = new Element("topic","");
- topics.addElement(e_topic);
- e_topic.addAttribute(new Attribute("name",topic));
- }
- }
- publisher.addElement(topics);
- root.addElement(publisher);
- }
- return root;
- }
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
deleted file mode 100644
index 224117efcb..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.handlers.event.EventUtil;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ParseUtils;
-
-/**
- * Represent a publisher.
- *
- * @author Felix Project Team
- */
-class EventAdminPublisherMetadata {
-
- // Names of metadata attributes
-
- /**
- * The name attribute in the component metadata.
- */
- public static final String NAME_ATTRIBUTE = "name";
-
- /**
- * The field attribute in the component metadata.
- */
- public static final String FIELD_ATTRIBUTE = "field";
-
- /**
- * The topics attribute in the component metadata.
- */
- public static final String TOPICS_ATTRIBUTE = "topics";
-
- /**
- * The synchronous attribute in the component metadata.
- */
- public static final String SYNCHRONOUS_ATTRIBUTE = "synchronous";
-
- /**
- * The data key attribute in the component metadata.
- */
- public static final String DATA_KEY_ATTRIBUTE = "data-key";
-
- // Default values
-
- /**
- * The data key attribute's default value.
- */
- public static final String DEFAULT_DATA_KEY_VALUE = "user.data";
-
- /**
- * The synchronous attribute's default value.
- */
- public static final boolean DEFAULT_SYNCHRONOUS_VALUE = false;
-
- /**
- * The name which acts as an identifier.
- */
- private final String m_name;
-
- /**
- * The name of the field representing the publisher in the component.
- */
- private final String m_field;
-
- /**
- * Topics to which events are sent.
- */
- private String[] m_topics;
-
- /**
- * Events sending mode.
- */
- private final boolean m_synchronous;
-
- /**
- * The key where user data are stored in the event dictionary.
- */
- private final String m_dataKey;
-
- /**
- * Constructs a publisher from its metadata description.
- *
- * @param publisher the publisher metadata description.
- * @throws ConfigurationException if the configuration of the component or
- * the instance is invalid.
- */
- public EventAdminPublisherMetadata(Element publisher)
- throws ConfigurationException {
-
- /**
- * Setup required attributes
- */
-
- // NAME_ATTRIBUTE
- if (publisher.containsAttribute(NAME_ATTRIBUTE)) {
- m_name = publisher.getAttribute(NAME_ATTRIBUTE);
- } else {
- throw new ConfigurationException(
- "Missing required attribute in component configuration : "
- + NAME_ATTRIBUTE);
- }
-
- // FIELD_ATTRIBUTE
- if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {
- m_field = publisher.getAttribute(FIELD_ATTRIBUTE);
- } else {
- throw new ConfigurationException(
- "Missing required attribute in component configuration : "
- + FIELD_ATTRIBUTE);
- }
-
- // TOPICS_ATTRIBUTE
- if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {
- setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE));
- } else {
- m_topics = null;
- // Nothing to do if TOPICS_ATTRIBUTE is not present as it can be
- // overridden in the instance configuration.
- }
-
- /**
- * Setup optional attributes
- */
-
- // SYNCHRONOUS_ATTRIBUTE
- if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {
- m_synchronous = "true".equalsIgnoreCase(publisher
- .getAttribute(SYNCHRONOUS_ATTRIBUTE));
- } else {
- m_synchronous = DEFAULT_SYNCHRONOUS_VALUE;
- }
-
- // DATA_KEY_ATTRIBUTE
- if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
- m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
- } else if (publisher.containsAttribute("data_key")) {
- // XML Case
- m_dataKey = publisher.getAttribute("data_key");
- } else if (publisher.containsAttribute("dataKey")) {
- // Annotation case.
- m_dataKey = publisher.getAttribute("dataKey");
- } else {
- m_dataKey = DEFAULT_DATA_KEY_VALUE;
- }
- }
-
- /**
- * Sets the topics attribute of the publisher.
- *
- * @param topicsString the comma separated list of the topics on which
- * events are sent
- * @throws ConfigurationException the specified topic string is malformed
- */
- public void setTopics(String topicsString) throws ConfigurationException {
- String[] newTopics = ParseUtils.split(topicsString,
- EventUtil.TOPIC_SEPARATOR);
- // Check each topic is valid
- for (int i = 0; i < newTopics.length; i++) {
- String topic = newTopics[i];
- if (!EventUtil.isValidTopic(topic)) {
- throw new ConfigurationException("Invalid topic : \"" + topic
- + "\".");
- }
- }
- m_topics = newTopics;
- }
-
- /**
- * Checks that the required instance configurable attributes are all set.
- *
- * @throws ConfigurationException if a required attribute is missing
- */
- public void check() throws ConfigurationException {
- if (m_topics == null || m_topics.length == 0) {
- throw new ConfigurationException(
- "Missing required attribute in component or instance configuration : "
- + TOPICS_ATTRIBUTE);
- }
- }
-
- /**
- * Gets the name attribute of the publisher.
- *
- * @return the name
- */
- public String getName() {
- return m_name;
- }
-
- /**
- * Gets the field attribute of the publisher.
- *
- * @return the field
- */
- public String getField() {
- return m_field;
- }
-
- /**
- * Gets the topics attribute of the publisher.
- *
- * @return the topics
- */
- public String[] getTopics() {
- return m_topics;
- }
-
- /**
- * Gets the synchronous attribute of the publisher.
- *
- * @return the synchronous mode
- */
- public boolean isSynchronous() {
- return m_synchronous;
- }
-
- /**
- * Gets the dataKey attribute of the publisher.
- *
- * @return the data key
- */
- public String getDataKey() {
- return m_dataKey;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
deleted file mode 100644
index 7b25196536..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-import java.util.Dictionary;
-
-/**
- * An Publisher is the interface between the EventAdminPublisherHandler and a
- * component instance. The POJO can send event through the handler by calling a
- * {@code send} method.
- *
- * @author Felix Project Team
- */
-public interface Publisher {
-
- /**
- * Sends an event with the specified content.
- *
- * @param content the content of the event
- */
- void send(Dictionary content);
-
- /**
- * Sends a data event.
- *
- * @param o the data to send
- */
- void sendData(Object o);
-
- /**
- * Gets the published topics.
- * @return the list of topics.
- */
- String[] getTopics();
-
- /**
- * Checks is the publisher send data synchronously.
- * @return true if the publisher is synchronous.
- */
- boolean isSynchronous();
-
- /**
- * Gets the data key if used.
- * @return the data key or null
- */
- String getDataKey();
-
- /**
- * Gets the publisher name if any.
- * @return the publisher name
- */
- String getName();
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java
deleted file mode 100644
index c25f37b2d6..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-/**
- * Publisher Description.
- *
- * @author Felix Project Team
- */
-public class PublisherDescription {
-
- /**
- * The described publisher
- */
- private Publisher m_publisher;
-
- /**
- * Creates a {@link PublisherDescription} based
- * on the given {@link Publisher}
- * @param p the publisher
- */
- public PublisherDescription(Publisher p) {
- m_publisher = p;
- }
-
-
- /**
- * Gets the topic list.
- * @return the list of published topics
- */
- public String[] getTopics() {
- return m_publisher.getTopics();
- }
-
- /**
- * Checks if the publisher is synchronous.
- * @return true if the publisher is synchronous
- */
- public boolean isSynchronous() {
- return m_publisher.isSynchronous();
- }
-
- /**
- * Gets the data key if used.
- * @return the data key
- */
- public String getDataKey() {
- return m_publisher.getDataKey();
- }
-
- /**
- * Gets the publisher name if any.
- * @return the publisher name
- */
- public String getName() {
- return m_publisher.getName();
- }
-
-
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
deleted file mode 100644
index 1cdcc894d4..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.handlers.event.publisher;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.event.Event;
-
-/**
- * The PublisherImpl class is the implementation of the Publisher object used by
- * components to send events.
- *
- * @author Felix Project Team
- */
-public class PublisherImpl implements Publisher {
-
- /**
- * The key where the component instance name is stored.
- */
- public static final String INSTANCE_NAME_PROPERTY = "publisher.instance.name";
-
- /**
- * The managing handler.
- */
- private EventAdminPublisherHandler m_handler;
-
- /**
- * The topics of sent events.
- */
- private final String[] m_topics;
-
- /**
- * The sending mode of events.
- */
- private final boolean m_synchronous;
-
- /**
- * The key, in the content of the event, where user data are stored.
- */
- private final String m_dataKey;
-
- /**
- * The name of the component instance using this publisher.
- */
- private final String m_instanceName;
-
- /**
- * Constructs an Publisher with given parameters.
- *
- * @param handler the handler that will manage this publisher
- * @param topics the topics on which events are sent
- * @param synchronous the sending mode of events
- * @param dataKey The key, in the content of the event, where user data are
- * stored (may be {@code null})
- * @param instanceName the name of the instance creating this publisher.
- */
- public PublisherImpl(EventAdminPublisherHandler handler, String[] topics,
- boolean synchronous, String dataKey, String instanceName) {
-
- // Initialize the publisher's fields
- m_handler = handler;
- m_topics = topics;
- m_synchronous = synchronous;
- m_dataKey = dataKey;
- m_instanceName = instanceName;
- }
-
- /**
- * Sends an event with the specified content.
- *
- * @param content the content of the event
- */
- public void send(Dictionary content) {
- // Add instance information in the event
- content.put(INSTANCE_NAME_PROPERTY, m_instanceName);
- // We sent the event on each topic
- for (int i = 0; i < m_topics.length; i++) {
- // Create an event with the given topic and content
- Event e = new Event(m_topics[i], content);
- // Send the event, depending on the sending mode
- if (!m_synchronous) {
- m_handler.getEventAdminService().postEvent(e); // Asynchronous
- } else {
- m_handler.getEventAdminService().sendEvent(e); // Synchronous
- }
- }
- }
-
- /**
- * Sends a data event.
- *
- * @param object the data to send
- */
- public void sendData(Object object) {
- // Construct the content of the event with the given object
- Dictionary content = new Hashtable();
- content.put(m_dataKey, object);
- send(content);
- }
-
- /**
- * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getTopics()
- */
- public String[] getTopics() {
- return m_topics;
- }
-
- /**
- * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#isSynchronous()
- */
- public boolean isSynchronous() {
- return m_synchronous;
- }
-
- /**
- * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getDataKey()
- */
- public String getDataKey() {
- return m_dataKey;
- }
-
- /**
- * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getName()
- */
- public String getName() {
- return m_instanceName;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
deleted file mode 100644
index edbd7a3466..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * 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.handlers.event.subscriber;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.architecture.ComponentTypeDescription;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.architecture.PropertyDescription;
-import org.apache.felix.ipojo.handlers.event.EventUtil;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.parser.PojoMetadata;
-import org.apache.felix.ipojo.util.Callback;
-import org.osgi.framework.Filter;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventHandler;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Event Subscriber Handler.
- *
- * @author Felix Project Team
- */
-public class EventAdminSubscriberHandler extends PrimitiveHandler implements
- EventHandler {
-
- /**
- * The handler namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
-
- // Names of instance configuration properties.
-
- /**
- * The event's topics instance configuration property.
- */
- public static final String TOPICS_PROPERTY = "event.topics";
-
- /**
- * The event's filter instance configuration property.
- */
- public static final String FILTER_PROPERTY = "event.filter";
-
- /**
- * The prefix for logged messages.
- */
- private static final String LOG_PREFIX = "EVENT ADMIN SUBSCRIBER HANDLER : ";
-
- /**
- * The instance manager.
- */
- private InstanceManager m_manager;
-
- /**
- * The list of subscriber accessible by name.
- */
- private final Map m_subscribersByName = new HashMap();
-
- /**
- * The list of callbacks accessible by subscribers' names.
- */
- private final Map m_callbacksByName = new Hashtable();
-
- /**
- * The iPOJO properties representing all the topics.
- * Immutable.
- */
- private String[] m_topics;
-
- /**
- * Listening to received events ?
- */
- private boolean m_isListening;
-
- /**
- * The handler description
- */
- private EventAdminSubscriberHandlerDescription m_description;
-
- /**
- * Initializes the component type.
- *
- * @param cd component type description to populate.
- * @param metadata component type metadata.
- * @throws ConfigurationException if the metadata are incorrect.
- * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(
- * org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)
- */
- public void initializeComponentFactory(ComponentTypeDescription cd,
- Element metadata)
- throws ConfigurationException {
-
- // Update the current component description
- Dictionary dict = new Properties();
- cd.addProperty(new PropertyDescription(TOPICS_PROPERTY,
- Dictionary.class.getName(), dict.toString()));
- dict = new Properties();
- cd.addProperty(new PropertyDescription(FILTER_PROPERTY,
- Dictionary.class.getName(), dict.toString()));
-
- // Get Metadata subscribers
- Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);
- if (subscribers != null) {
-
- // Maps used to check name and field are unique
- Set nameSet = new HashSet();
- Set callbackSet = new HashSet();
-
- // Check all subscribers are well formed
- for (int i = 0; i < subscribers.length; i++) {
-
- // Check the subscriber configuration is correct by creating an
- // unused subscriber metadata
- EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata(
- getFactory().getBundleContext(), subscribers[i]);
-
- String name = subscriberMetadata.getName();
- info(LOG_PREFIX + "Checking subscriber " + name);
-
- // Determine the event callback prototype
- PojoMetadata pojoMetadata = getPojoMetadata();
- String callbackType;
- if (subscriberMetadata.getDataKey() == null) {
- callbackType = Event.class.getName();
- } else {
- callbackType = subscriberMetadata.getDataType().getName();
- }
-
- // Check the event callback method is present
- MethodMetadata methodMetadata = pojoMetadata.getMethod(
- subscriberMetadata.getCallback(),
- new String[] { callbackType });
- String callbackSignature = subscriberMetadata.getCallback()
- + "(" + callbackType + ")";
- if (methodMetadata == null) {
- throw new ConfigurationException(
- "Cannot find callback method " + callbackSignature);
- }
-
- // Warn if the same callback is used by several subscribers
- if (callbackSet.contains(callbackSignature)) {
- warn("The callback method is already used by another subscriber : "
- + callbackSignature);
- } else {
- callbackSet.add(callbackSignature);
- }
-
- // Check name is unique
- if (nameSet.contains(name)) {
- throw new ConfigurationException(
- "A subscriber with the same name already exists : "
- + name);
- }
- nameSet.add(name);
- }
-
- m_description = new EventAdminSubscriberHandlerDescription(this,
- subscribers);
-
- } else {
- info(LOG_PREFIX + "No subscriber to check");
- }
- }
-
- /**
- * Constructor.
- *
- * @param metadata the omponent type metadata
- * @param conf the instance configuration
- * @throws ConfigurationException if one event subscription is not correct
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
- */
- public void configure(Element metadata, Dictionary conf)
- throws ConfigurationException {
-
- // Store the component manager
- m_manager = getInstanceManager();
-
- // Get the topics and filter instance configuration
- Dictionary instanceTopics = (Dictionary) conf.get(TOPICS_PROPERTY);
- Dictionary instanceFilter = (Dictionary) conf.get(FILTER_PROPERTY);
-
- // Get Metadata subscribers
- Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);
-
- // The topics to listen
- Set topics = new TreeSet();
-
- if (subscribers != null) {
-
- // Configure all subscribers
- for (int i = 0; i < subscribers.length; i++) {
-
- // Extract the subscriber configuration
- EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata(
- m_manager.getContext(), subscribers[i]);
- String name = subscriberMetadata.getName();
- info(LOG_PREFIX + "Configuring subscriber " + name);
-
- // Get the topics instance configuration if redefined
- String topicsString = (instanceTopics != null) ? (String) instanceTopics.get(name) : null;
- if (topicsString != null) {
- subscriberMetadata.setTopics(topicsString);
- }
-
- // Get the filter instance configuration if redefined
- String filterString = (instanceFilter != null) ? (String) instanceFilter.get(name) : null;
- if (filterString != null) {
- subscriberMetadata.setFilter(filterString);
- }
-
- // Check the publisher is correctly configured
- subscriberMetadata.check();
-
- // Add this subscriber's topics to the global list
- String[] subscriberTopics = subscriberMetadata.getTopics();
- for (int j = 0; j < subscriberTopics.length; j++) {
- topics.add(subscriberTopics[j]);
- }
-
- // Determine the event callback prototype
- PojoMetadata pojoMetadata = getPojoMetadata();
- String callbackType;
- if (subscriberMetadata.getDataKey() == null) {
- callbackType = Event.class.getName();
- } else {
- callbackType = subscriberMetadata.getDataType().getName();
- }
-
- // Create the specified callback and register it
- MethodMetadata methodMetadata = pojoMetadata.getMethod(
- subscriberMetadata.getCallback(),
- new String[] { callbackType });
- Callback callback = new Callback(methodMetadata, m_manager);
- m_callbacksByName.put(name, callback);
-
- // Add the subscriber list gloal map
- m_subscribersByName.put(name, subscriberMetadata);
- }
-
- // Construct the global topic list
- m_topics = new String[topics.size()];
- int i = 0;
- for (Iterator iterator = topics.iterator(); iterator.hasNext();) {
- String tmp = (String) iterator.next();
- m_topics[i++] = tmp;
- }
-
- m_description = new EventAdminSubscriberHandlerDescription(this,
- subscribers);
-
- } else {
- info(LOG_PREFIX + "No subscriber to configure");
- }
- }
-
- /**
- * Handler start method.
- *
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public synchronized void start() {
- m_isListening = true;
- }
-
- /**
- * Handler stop method.
- *
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public synchronized void stop() {
- m_isListening = false;
- }
-
- /**
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- public HandlerDescription getDescription() {
- return m_description;
- }
-
- /***************************************************************************
- * OSGi EventHandler callback
- **************************************************************************/
-
- /**
- * Receives an event. The event is dispatch to attached subscribers.
- *
- * @param event the received event.
- * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
- */
- public void handleEvent(final Event event) {
- EventAdminSubscriberMetadata subscriberMetadata = null;
- // Retrieve the event's topic
- String topic = event.getTopic();
-
- // For each subscribers
- Collection subscribers = m_subscribersByName.values();
- for (Iterator i = subscribers.iterator(); i.hasNext();) {
- subscriberMetadata = (EventAdminSubscriberMetadata) i.next();
-
- // Stack confinement
- boolean isListening = false;
-
- Object callbackParam = null;
- Callback callback = null;
-
- synchronized (this) {
- isListening = m_isListening;
- }
-
- // Check if the subscriber's topic and filter match
- Filter filter = subscriberMetadata.getFilter();
-
- if (EventUtil.matches(topic, subscriberMetadata.getTopics())
- && (filter == null || event.matches(filter))) {
-
- String name = subscriberMetadata.getName();
- callback = (Callback) m_callbacksByName.get(name);
-
- try {
- // Depending on the subscriber type...
- callbackParam = getCallbackParameter(event,
- subscriberMetadata);
- } catch (ClassCastException e) {
- // Ignore the data event if type doesn't match
- warn(LOG_PREFIX + "Ignoring data event : Bad data type", e);
- } catch (NoSuchFieldException e) {
- // Ignore events without data field for data events
- // subscriber
- warn(LOG_PREFIX + "Ignoring data event : No data", e);
- }
- }
-
-
- // Run the callback (final check to avoid
- // NullPointerExceptions)
- if (isListening && callback != null && callbackParam != null) {
- try {
- callback.call(new Object[] { callbackParam });
- } catch (InvocationTargetException e) {
- error(LOG_PREFIX
- + "The callback has thrown an exception",
- e.getTargetException());
- } catch (Exception e) {
- error(LOG_PREFIX
- + "Unexpected exception when calling callback",
- e);
- }
- }
-
- }
- }
-
- /**
- * Computes the callback parameter.
- * @param event the event
- * @param subscriberMetadata the subscribe metadata
- * @param dataKey the data key
- * @return the parameter of the callback
- * @throws ClassCastException the data class does not match the found value.
- * @throws NoSuchFieldException the datakey is not present in the event.
- */
- private Object getCallbackParameter(final Event event,
- final EventAdminSubscriberMetadata subscriberMetadata
- ) throws ClassCastException,NoSuchFieldException {
- String dataKey = subscriberMetadata.getDataKey();
- if (dataKey == null) {
- // Generic event subscriber : pass the event to the
- // registered callback
- return event;
- } else {
- // Check for a data key in the event
- boolean dataKeyPresent = false;
- String[] properties = event.getPropertyNames();
- for (int j = 0; j < properties.length && !dataKeyPresent; j++) {
- if (dataKey.equals(properties[j])) {
- dataKeyPresent = true;
- }
- }
-
- if (dataKeyPresent) {
- // Data event : check type compatibility and
- // pass the given object to the registered
- // callback
- Object data = event.getProperty(dataKey);
- Class dataType = subscriberMetadata.getDataType();
- Class dataClazz = data.getClass();
- if (dataType.isAssignableFrom(dataClazz)) {
- return data;
- } else {
- throw new ClassCastException("Cannot convert " + dataClazz.getName() + " to "
- + dataType.getName());
- }
- } else {
- throw new java.lang.NoSuchFieldException(dataKey);
- }
-
- }
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java
deleted file mode 100644
index 1f9e41f34f..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.handlers.event.subscriber;
-
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.metadata.Element;
-
-/**
- * Event Admin Subscriber Handler Description.
- *
- * @author Felix Project Team
- */
-public class EventAdminSubscriberHandlerDescription extends HandlerDescription {
-
- /**
- * List of subscribers.
- */
- private Element[] m_subscribersDescriptions;
-
- /**
- * Creates a {@link EventAdminSubscriberHandlerDescription}
- * @param handler the handler
- * @param subscribers the subscribers
- */
- public EventAdminSubscriberHandlerDescription(Handler handler, Element[] subscribers) {
- super(handler);
- m_subscribersDescriptions = subscribers;
- }
-
- /**
- * Gets the handler info.
- * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo()
- */
- public Element getHandlerInfo() {
- Element root = super.getHandlerInfo();
- if (m_subscribersDescriptions != null) {
- for (int i = 0; i < m_subscribersDescriptions.length; i++) {
- Element description = m_subscribersDescriptions[i];
- root.addElement(description);
- }
- }
- return root;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
deleted file mode 100644
index 3d9f0a5e12..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * 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.handlers.event.subscriber;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.handlers.event.EventUtil;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ParseUtils;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-
-/**
- * Represent an subscriber.
- *
- * @author Felix Project Team
- */
-class EventAdminSubscriberMetadata {
-
- // Names of metadata attributes
-
- /**
- * The name attribute in the component metadata.
- */
- public static final String NAME_ATTRIBUTE = "name";
-
- /**
- * The callback attribute in the component metadata.
- */
- public static final String CALLBACK_ATTRIBUTE = "callback";
-
- /**
- * The topics attribute in the component metadata.
- */
- public static final String TOPICS_ATTRIBUTE = "topics";
-
- /**
- * The data key attribute in the component metadata.
- */
- public static final String DATA_KEY_ATTRIBUTE = "data-key";
-
- /**
- * The data type attribute in the component metadata.
- */
- public static final String DATA_TYPE_ATTRIBUTE = "data-type";
-
- /**
- * The filter attribute in the component metadata.
- */
- public static final String FILTER_ATTRIBUTE = "filter";
-
- // Default values
-
- /**
- * The data type atttribute's default value.
- */
- public static final Class DEFAULT_DATA_TYPE_VALUE = java.lang.Object.class;
-
- /**
- * The name which acts as an identifier.
- */
- private final String m_name;
-
- /**
- * Name of the callback method.
- */
- private final String m_callback;
-
- /**
- * Listened topics.
- */
- private String[] m_topics;
-
- /**
- * The key where user data are stored in the event dictionary.
- */
- private String m_dataKey;
-
- /**
- * The type of received data.
- */
- private final Class m_dataType;
-
- /**
- * Event filter.
- */
- private Filter m_filter;
-
- /**
- * The context of the bundle.
- */
- private final BundleContext m_bundleContext;
-
- /**
- * Constructor.
- *
- * @param bundleContext the bundle context of the managed instance.
- * @param subscriber the subscriber metadata.
- * @throws ConfigurationException if the configuration of the component or
- * the instance is invalid.
- */
- public EventAdminSubscriberMetadata(BundleContext bundleContext,
- Element subscriber) throws ConfigurationException {
- m_bundleContext = bundleContext;
-
- /**
- * Setup required attributes
- */
-
- // NAME_ATTRIBUTE
- if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {
- m_name = subscriber.getAttribute(NAME_ATTRIBUTE);
- } else {
- throw new ConfigurationException(
- "Missing required attribute in component configuration : "
- + NAME_ATTRIBUTE);
- }
-
- // CALLBACK_ATTRIBUTE
- if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
- m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
- } else if (subscriber.containsAttribute("method")) {
- m_callback = subscriber.getAttribute("method");
- } else {
- throw new ConfigurationException(
- "Missing required attribute in component configuration : "
- + CALLBACK_ATTRIBUTE);
- }
-
- // TOPICS_ATTRIBUTE
- if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {
- setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE));
- } else {
- m_topics = null;
- // Nothing to do if TOPICS_ATTRIBUTE is not present as it can be
- // overridden in the instance configuration.
- }
-
- /**
- * Setup optional attributes
- */
-
- // DATA_KEY_ATTRIBUTE
- m_dataKey = subscriber.getAttribute(DATA_KEY_ATTRIBUTE);
- if (m_dataKey == null) { // Alternative configurations (data_key and dataKey)
- // XML
- m_dataKey = subscriber.getAttribute("data_key");
- if (m_dataKey == null) {
- // Annotation
- m_dataKey = subscriber.getAttribute("dataKey");
- }
- }
-
- String t = subscriber.getAttribute(DATA_TYPE_ATTRIBUTE);
- if (t == null) { // Alternative configurations
- // XML
- t = subscriber.getAttribute("data_type");
- if (t == null) {
- /// Annotation
- t = subscriber.getAttribute("dataType");
- }
- }
-
- if (t != null) {
- // Check that the data-key attribute is set.
- if (m_dataKey == null) {
- throw new ConfigurationException(
- "Missing attribute in component configuration : "
- + DATA_KEY_ATTRIBUTE);
- }
- Class type;
- try {
- type = m_bundleContext.getBundle().loadClass(t);
- } catch (ClassNotFoundException e) {
- throw new ConfigurationException("Data type class not found : "
- + t);
- }
- m_dataType = type;
- } else {
- m_dataType = DEFAULT_DATA_TYPE_VALUE;
- }
-
- // FILTER_ATTRIBUTE
- if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {
- setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE));
- }
- }
-
- /**
- * Sets the topics attribute of the subscriber.
- *
- * @param topicsString the comma separated list of the topics to listen
- * @throws ConfigurationException if the specified topic list is malformed
- */
- public void setTopics(String topicsString) throws ConfigurationException {
- String[] newTopics = ParseUtils.split(topicsString,
- EventUtil.TOPIC_SEPARATOR);
- // Check each topic is valid
- for (int i = 0; i < newTopics.length; i++) {
- String topicScope = newTopics[i];
- if (!EventUtil.isValidTopicScope(topicScope)) {
- throw new ConfigurationException("Invalid topic scope : \""
- + topicScope + "\".");
- }
- }
- m_topics = newTopics;
- }
-
- /**
- * Sets the filter attribute of the subscriber.
- *
- * @param filterString the string representation of the event filter
- * @throws ConfigurationException if the LDAP filter is malformed
- */
- public void setFilter(String filterString) throws ConfigurationException {
- try {
- m_filter = m_bundleContext.createFilter(filterString);
- } catch (InvalidSyntaxException e) {
- throw new ConfigurationException("Invalid filter syntax");
- }
- }
-
- /**
- * Checks that the required instance configurable attributes are all set.
- *
- * @throws ConfigurationException if a required attribute is missing
- */
- public void check() throws ConfigurationException {
- if (m_topics == null || m_topics.length == 0) {
- throw new ConfigurationException(
- "Missing required attribute in component or instance configuration : "
- + TOPICS_ATTRIBUTE);
- }
- }
-
- /**
- * Gets the name attribute of the subscriber.
- *
- * @return the name
- */
- public String getName() {
- return m_name;
- }
-
- /**
- * Gets the topics attribute of the subscriber.
- *
- * @return the topics
- */
- public String[] getTopics() {
- return m_topics;
- }
-
- /**
- * Gets the callback attribute of the subscriber.
- *
- * @return the callback
- */
- public String getCallback() {
- return m_callback;
- }
-
- /**
- * Gets the data key attribute of the subscriber.
- *
- * @return the dataKey
- */
- public String getDataKey() {
- return m_dataKey;
- }
-
- /**
- * Gets the data type attribute of the subscriber.
- *
- * @return the dataType
- */
- public Class getDataType() {
- return m_dataType;
- }
-
- /**
- * Gets the filter attribute of the subscriber.
- *
- * @return the filter
- */
- public Filter getFilter() {
- return m_filter;
- }
-}
diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd b/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd
deleted file mode 100644
index b9c8271d50..0000000000
--- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
- Description of an event publisher.
-
-
-
- The name of the event publisher, acting as a unique identifier.
-The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher".
-
-
-
- The name of the POJO field associated to this event publisher.
-Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending.
-
-
-
- The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events.
-
-
- Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher.
-The default value of this attribute is "false".
-
-
-
- The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key.
-The default value of this attribute is user.data.
-
-
-
-
- Description of an event subscriber.
-
-
-
- The name of the event subscriber, acting as a unique identifier.
-
-
- The name of the POJO's method that will be called each time an event is received.
-This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes.
-
-
-
- The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method.
-
-
- The event filter is used to filter incoming events before sending them to the callback.
-The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered.
-
-
-
- The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary.
-If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event.
-This attribute is generally used with the data-typeattribute to specify the received object type.
-If an event is received and it does not contain such a key, it is ignored (with a warning message).
-
-
-
- This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects.
-It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception.
-Data events that are not corresponding to the specified type will be ignored (with a warning message).
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/pom.xml b/ipojo/handler/eventadmin/pom.xml
deleted file mode 100644
index c8f5604a30..0000000000
--- a/ipojo/handler/eventadmin/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- org.apache.felix.ipojo.handler.event-admin-handler-project
- 1.9.0-SNAPSHOT
- Apache Felix iPOJO Event Admin Handler Project
- pom
-
-
- eventadmin-handler
- eventadmin-handler-it
-
-
-
diff --git a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/extender/changelog.txt b/ipojo/handler/extender/changelog.txt
deleted file mode 100644
index 6c7810ac63..0000000000
--- a/ipojo/handler/extender/changelog.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1025] - iPOJO Extender Handler hold a lock during its initialization
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Bug
- * [FELIX-613] - Extender pattern handler issue when bundles are leaving
-
-** Improvement
- * [FELIX-673] - Provide OBR description to iPOJO bundles
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/handler/extender/metadata.xml b/ipojo/handler/extender/metadata.xml
deleted file mode 100644
index 68c4aa0479..0000000000
--- a/ipojo/handler/extender/metadata.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/extender/obr.xml b/ipojo/handler/extender/obr.xml
deleted file mode 100644
index 34b8e0e9f5..0000000000
--- a/ipojo/handler/extender/obr.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/extender/pom.xml b/ipojo/handler/extender/pom.xml
deleted file mode 100644
index cb8dc5ef1e..0000000000
--- a/ipojo/handler/extender/pom.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- bundle
- Apache Felix iPOJO Extender Pattern Handler
- org.apache.felix.ipojo.handler.extender
- 1.5.0-SNAPSHOT
-
-
- iPOJO extension to implement an extender pattern (host).
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/extender-pattern-handler.html
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.6
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- The Apache Software Foundation
- iPOJO Extender Pattern Handler
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/extender-pattern-handler.html
-
- org.apache.felix.ipojo.handler.extender
-
- ${project.artifactId}
- ${project.name}
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.8.6
-
-
-
- ipojo-bundle
-
-
- metadata.xml
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
diff --git a/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/extender/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/extender/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java
deleted file mode 100644
index 2f39ccc1db..0000000000
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.extender;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.SynchronousBundleListener;
-
-/**
- * This is a very simple bundle tracker utility class that tracks active
- * bundles. The tracker must be given a bundle context upon creation,
- * which it uses to listen for bundle events. The bundle tracker must be
- * opened to track objects and closed when it is no longer needed. This
- * class is abstract, which means in order to use it you must create a
- * subclass of it. Subclasses must implement the addedBundle()
- * and removedBundle() methods, which can be used to perform some
- * custom action upon the activation or deactivation of bundles. Since this
- * tracker is quite simple, its concurrency control approach is also
- * simplistic. This means that subclasses should take great care to ensure
- * that their addedBundle() and removedBundle() methods
- * are very simple and do not do anything to change the state of any bundles.
- * @author Felix Project Team
- **/
-public abstract class BundleTracker {
- /**
- * Set of tracked bundles.
- */
- final Set m_bundleSet = new HashSet();
-
- /**
- * Bundle context.
- */
- final BundleContext m_context;
-
- /**
- * Synchronous bundle listener.
- */
- final SynchronousBundleListener m_listener;
-
- /**
- * Flag indicating if the tracking is open.
- */
- boolean m_open;
-
- /**
- * Constructs a bundle tracker object that will use the specified
- * bundle context.
- * @param context the bundle context to use to track bundles.
- **/
- public BundleTracker(BundleContext context) {
- m_context = context;
- m_listener = new SynchronousBundleListener() {
- public void bundleChanged(BundleEvent evt) {
- synchronized (BundleTracker.this) {
- if (!m_open) { return; }
-
- if (evt.getType() == BundleEvent.STARTED) {
- if (!m_bundleSet.contains(evt.getBundle())) {
- m_bundleSet.add(evt.getBundle());
- addedBundle(evt.getBundle());
- }
- } else if (evt.getType() == BundleEvent.STOPPED) {
- if (m_bundleSet.contains(evt.getBundle())) {
- m_bundleSet.remove(evt.getBundle());
- removedBundle(evt.getBundle());
- }
- }
- }
- }
- };
- }
-
- /**
- * Returns the current set of active bundles.
- * @return the current set of active bundles.
- **/
- public synchronized Bundle[] getBundles() {
- return (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);
- }
-
- /**
- * Call this method to start the tracking of active bundles.
- **/
- public void open() {
- synchronized (this) {
- if (!m_open) {
- m_open = true;
-
- m_context.addBundleListener(m_listener);
- }
- }
-
- Bundle[] bundles = m_context.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (bundles[i].getState() == Bundle.ACTIVE) {
- if (m_bundleSet.add(bundles[i])) {
- addedBundle(bundles[i]);
- }
- }
- }
- }
-
- /**
- * Call this method to stop the tracking of active bundles.
- **/
- public synchronized void close() {
- if (m_open) {
- m_open = false;
-
- m_context.removeBundleListener(m_listener);
-
- Bundle[] bundles = (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]);
- for (int i = 0; i < bundles.length; i++) {
- if (m_bundleSet.remove(bundles[i])) {
- removedBundle(bundles[i]);
- }
- }
- }
- }
-
- /**
- * Subclasses must implement this method; it can be used to perform
- * actions upon the activation of a bundle. Subclasses should keep
- * this method implementation as simple as possible and should not
- * cause the change in any bundle state to avoid concurrency issues.
- * @param bundle the bundle being added to the active set.
- **/
- protected abstract void addedBundle(Bundle bundle);
-
- /**
- * Subclasses must implement this method; it can be used to perform
- * actions upon the deactivation of a bundle. Subclasses should keep
- * this method implementation as simple as possible and should not
- * cause the change in any bundle state to avoid concurrency issues.
- * @param bundle the bundle being removed from the active set.
- **/
- protected abstract void removedBundle(Bundle bundle);
-}
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java
deleted file mode 100644
index 5d0186936d..0000000000
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.extender;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.util.Callback;
-import org.osgi.framework.Bundle;
-
-/**
- * Track and manage extensions.
- * @author Felix Project Team
- */
-public class ExtenderManager extends BundleTracker {
-
- /**
- * Looked extension.
- */
- private String m_extension;
-
- /**
- * OnArrival method.
- */
- private Callback m_onArrival;
-
- /**
- * OnDeparture method.
- */
- private Callback m_onDeparture;
-
- /**
- * Attached handler.
- */
- private PrimitiveHandler m_handler;
-
- /**
- * Set of managed bundles.
- */
- private Set m_bundles = new HashSet();
-
- /**
- * Constructor.
- * @param handler the attached handler.
- * @param extension the looked extension.
- * @param bind the onArrival method
- * @param unbind the onDeparture method.
- */
- public ExtenderManager(ExtenderModelHandler handler, String extension, String bind, String unbind) {
- super(handler.getInstanceManager().getContext());
- m_handler = handler;
- m_onArrival = new Callback(bind, new Class[] {Bundle.class, String.class}, false, m_handler.getInstanceManager());
- m_onDeparture = new Callback(unbind, new Class[] {Bundle.class}, false, m_handler.getInstanceManager());
- m_extension = extension;
- }
-
-
- /**
- * A bundle arrives.
- * Checks if the bundle match with the looked extension, if so call the arrival callback.
- * @param bundle the arriving bundle.
- * @see org.apache.felix.ipojo.handler.extender.BundleTracker#addedBundle(org.osgi.framework.Bundle)
- */
- protected void addedBundle(Bundle bundle) {
- Dictionary headers = bundle.getHeaders();
- String header = (String) headers.get(m_extension);
- if (header != null) {
- synchronized (this) {
- m_bundles.add(bundle);
- }
- try { // Call the callback outside the synchronized block.
- m_onArrival.call(new Object[] {bundle, header});
- } catch (NoSuchMethodException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);
- m_handler.getInstanceManager().stop();
- } catch (IllegalAccessException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be called", e);
- m_handler.getInstanceManager().stop();
- } catch (InvocationTargetException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException());
- m_handler.getInstanceManager().stop();
- }
- }
- }
-
- /**
- * A bundle is stopping.
- * Check if the bundle was managed, if so call the remove departure callback.
- * @param bundle the leaving bundle.
- * @see org.apache.felix.ipojo.handler.extender.BundleTracker#removedBundle(org.osgi.framework.Bundle)
- */
- protected void removedBundle(Bundle bundle) {
- boolean contained;
- synchronized (this) {
- contained = m_bundles.remove(bundle); // Stack confinement
- }
-
- if (contained) {
- try {
- m_onDeparture.call(new Object[] {bundle});
- } catch (NoSuchMethodException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);
- m_handler.getInstanceManager().stop();
- } catch (IllegalAccessException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be called", e);
- m_handler.getInstanceManager().stop();
- } catch (InvocationTargetException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());
- m_handler.getInstanceManager().stop();
- }
- }
- }
-
-
-
-}
diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java
deleted file mode 100644
index ec4356d8be..0000000000
--- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.extender;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.metadata.Element;
-
-/**
- * Handler automating extender pattern. The component using this handler is notified
- * when an handler with a special manifest extension is detected, the component is notified.
- * When a managed handler leaves, the component is also notified.
- * @author Felix Project Team
- */
-public class ExtenderModelHandler extends PrimitiveHandler {
-
- /**
- * The handler namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.extender";
-
- /**
- * The extension manager list.
- * Immutable once set.
- */
- private List m_managers = new ArrayList(1);
-
- /**
- * Configures the handler.
- * @param elem the component type element.
- * @param dict the instance configuration.
- * @throws ConfigurationException if the configuration is not valid.
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
- */
- public void configure(Element elem, Dictionary dict) throws ConfigurationException {
- Element[] elems = elem.getElements("extender", NAMESPACE);
- for (int i = 0; i < elems.length; i++) {
- String extension = elems[i].getAttribute("extension");
- String onArrival = elems[i].getAttribute("onArrival");
- String onDeparture = elems[i].getAttribute("onDeparture");
-
- if (extension == null) {
- throw new ConfigurationException("The extender element requires an 'extender' attribute");
- }
- if (onArrival == null || onDeparture == null) {
- throw new ConfigurationException("The extender element requires the 'onArrival' and 'onDeparture' attributes");
- }
-
- ExtenderManager wbm = new ExtenderManager(this, extension, onArrival, onDeparture);
- m_managers.add(wbm);
- }
-
- }
-
- /**
- * Starts the handler.
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public void start() {
- for (int i = 0; i < m_managers.size(); i++) {
- ((ExtenderManager) m_managers.get(i)).open();
- }
- }
-
- /**
- * Stops the handler.
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public void stop() {
- for (int i = 0; i < m_managers.size(); i++) {
- ((ExtenderManager) m_managers.get(i)).close();
- }
- }
-
-}
diff --git a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd b/ipojo/handler/extender/src/main/resources/extender-pattern.xsd
deleted file mode 100644
index 0e2ed9fba7..0000000000
--- a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
- Description of the extender pattern configuration.
-The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked.
-
-
-
- Declaring the method to invoke when a matching bundle arrives
-
-
-
- Declaring the method to invoke when a matching bundle leaves
-
-
-
- Declaring the looked manifest header.
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/changelog.txt b/ipojo/handler/jmx/changelog.txt
deleted file mode 100644
index 87556fcf47..0000000000
--- a/ipojo/handler/jmx/changelog.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Changes from 1.4.0 to 1.6.0
----------------------------
-** Improvement
- * [FELIX-2633] - Rename JMX annotations
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1183] - iPOJO JMX handler doesn't re-throw exceptions
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-828] - iPOJO JMX Handler: the name attribute has not the expected behavior
- * [FELIX-829] - iPOJO JMX Handler: the sub-element should refer to the handler namespace
-
-Version 1.0.0
--------------
- * Initial release
diff --git a/ipojo/handler/jmx/jmx-handler-it/pom.xml b/ipojo/handler/jmx/jmx-handler-it/pom.xml
deleted file mode 100644
index e9148f5cfd..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/pom.xml
+++ /dev/null
@@ -1,389 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
-
- 4.0.0
- pom
- Apache Felix iPOJO JMX Handler - Integration Test
- org.apache.felix.ipojo.handler.jmx-it
- 1.5.0-SNAPSHOT
-
-
- 3.0.0
- 1.5.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.jmx
- ${project.version}
-
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.6
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
-
- ch.qos.logback
- logback-core
- 1.5.25
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.0
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.2
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
-
-
-
-
-
-
-
-
- test
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- regular
-
- run
-
-
-
- felix
-
- ${project.build.directory}/regular
-
-
-
-
-
-
-
-
-
- test-all
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- equinox-native
-
- run
-
-
-
- equinox
-
- ${project.build.directory}/equinox-native
-
-
-
-
- felix-native
-
- run
-
-
-
- felix
-
- ${project.build.directory}/felix-native
-
-
-
- knopflerfish-native
-
- run
-
-
-
- knopflerfish
-
- ${project.build.directory}/knopflerfish-native
-
-
-
-
-
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- http://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- 5.2.0
- test
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- 3.8.1.v20120830-144521
- test
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
-
-
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml
deleted file mode 100644
index d07cbcf529..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.jmx-it
- 1.5.0-SNAPSHOT
- ../../../pom.xml
-
-
-
- ipojo-jmx-integration-test
- ${project.artifactId}
-
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.8.6
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java
deleted file mode 100644
index a99e0975ea..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.jmx.components;
-
-/**
- * Simple component that holds an integer. It is exposed as a MBean.
- *
- * @author Felix Project Team
- */
-public class SimpleManagedComponent {
-
- /**
- * The integer.
- */
- private int m_integer /*= new Random().nextInt()*/;
-
- /**
- * Set the value of the integer.
- * @param newValue the new value
- * @return the old value of the integer.
- */
- @SuppressWarnings("unused")
- private synchronized int setIntegerValue(int newValue) {
- int oldValue = m_integer;
- m_integer = newValue;
- return oldValue;
- }
-
- /**
- * Get the value of the integer.
- * @return the currentvalue of the integer.
- */
- @SuppressWarnings("unused")
- private synchronized int getIntegerValue() {
- return m_integer;
- }
-
-}
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java
deleted file mode 100644
index 96a5f4fef4..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.jmx.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.handlers.jmx.JMXBean;
-import org.apache.felix.ipojo.handlers.jmx.JMXMethod;
-import org.apache.felix.ipojo.handlers.jmx.JMXProperty;
-
-import java.util.Random;
-
-/**
- * Simple component that holds an integer. It is exposed as a MBean. This
- * version uses the brand new annotations of the JMX handler.
- *
- * @author Felix Project Team
- */
-@Component(immediate = true)
-@JMXBean
-public class SimpleManagedComponentAnnotated {
-
- /**
- * The integer.
- */
- @JMXProperty(name = "integer", rights = "r", notification = true)
- private int m_integer = new Random().nextInt();;
-
- /**
- * Set the value of the integer.
- *
- * @param newValue
- * the new value
- * @return the old value of the integer.
- */
- @SuppressWarnings("unused")
- @JMXMethod(description = "Set the value of the integer")
- private synchronized int setIntegerValue(int newValue) {
- int oldValue = m_integer;
- m_integer = newValue;
- return oldValue;
- }
-
- /**
- * Get the value of the integer.
- *
- * @return the currentvalue of the integer.
- */
- @SuppressWarnings("unused")
- @JMXMethod(description = "Get the value of the integer")
- private synchronized int getIntegerValue() {
- return m_integer;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java
deleted file mode 100644
index 5720b679d6..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.jmx.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.handlers.jmx.Config;
-import org.apache.felix.ipojo.handlers.jmx.Method;
-import org.apache.felix.ipojo.handlers.jmx.Property;
-
-import java.util.Random;
-
-
-/**
- * Simple component that holds an integer. It is exposed as a MBean. This
- * version uses the deprecated annotations of the JMX handler.
- *
- * @author Felix Project Team
- */
-@Component(immediate = true)
-@Config
-public class SimpleManagedComponentAnnotatedDeprecated {
-
- /**
- * The integer.
- */
- @Property(name = "integer", rights = "r", notification = true)
- private int m_integer = new Random().nextInt();;
-
- /**
- * Set the value of the integer.
- *
- * @param newValue
- * the new value
- * @return the old value of the integer.
- */
- @SuppressWarnings("unused")
- @Method(description = "Set the value of the integer")
- private synchronized int setIntegerValue(int newValue) {
- int oldValue = m_integer;
- m_integer = newValue;
- return oldValue;
- }
-
- /**
- * Get the value of the integer.
- *
- * @return the currentvalue of the integer.
- */
- @SuppressWarnings("unused")
- @Method(description = "Get the value of the integer")
- private synchronized int getIntegerValue() {
- return m_integer;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml
deleted file mode 100644
index ac908abf71..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java
deleted file mode 100644
index 971fe0c3da..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.jmx.test;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class Common {
-
- @Inject
- BundleContext bc;
-
- OSGiHelper osgiHelper;
- IPOJOHelper ipojoHelper;
-
- Bundle testedBundle;
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.DEBUG);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- testedBundle(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Mockito core does not includes Hamcrest
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets
- // resolved correctly.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation. this property has no effect on the other OSGi implementation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
- @Before
- public void commonSetUp() {
- osgiHelper = new OSGiHelper(bc);
- ipojoHelper = new IPOJOHelper(bc);
-
- testedBundle = osgiHelper.getBundle("test.bundle");
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- }
-
- public static CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // The tested handler
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.jmx").versionAsInProject()
- );
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List services = new ArrayList();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- String export = "";
- for (File file : services) {
- if (export.length() > 0) { export += ", "; }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- //.set(Constants.IMPORT_PACKAGE, "*")
- //.set(Constants.EXPORT_PACKAGE, export) // No export...
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
-
-}
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java
deleted file mode 100644
index 0e52bf6691..0000000000
--- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.jmx.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-import javax.management.*;
-import java.lang.management.ManagementFactory;
-
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
-
-/**
- * Test the good behaviour of the EventAdminHandler.
- *
- * @author Felix Project Team
- */
-public class TestMBean extends Common {
-
- /**
- * The MBean server used to access exposed MBeans.
- */
- private MBeanServer m_server;
-
- /**
- * Initialize test.
- */
- @Before
- public void setUp() {
- m_server = ManagementFactory.getPlatformMBeanServer();
- for (Bundle bundle : bc.getBundles()) {
- System.out.println(bundle.getSymbolicName() + " - " + bundle.getState());
- }
- }
-
- /**
- * Test the MBean exposed by the simple component, defined without
- * annotations and with the brand new JMX handler syntax.
- */
- @Test
- public void testMBeanWithoutAnnotations() throws MalformedObjectNameException, IntrospectionException, InstanceNotFoundException, ListenerNotFoundException, ReflectionException, MBeanException {
- // Create an instance of the component
- ComponentInstance componentInstance = ipojoHelper
- .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent");
- String instanceName = componentInstance.getInstanceName();
- ObjectName objectName = new ObjectName(
- "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent,instance="
- + instanceName);
- doTest(objectName);
- }
-
- /**
- * Test the MBean exposed by the simple component, defined without
- * annotations and with the deprecated JMX handler syntax.
- */
- @Test
- public void testMBeanWithoutAnnotationsDeprecated() throws MalformedObjectNameException, IntrospectionException, InstanceNotFoundException, ListenerNotFoundException, ReflectionException, MBeanException {
- // Create an instance of the component
- ComponentInstance componentInstance = ipojoHelper
- .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentDeprecated");
- String instanceName = componentInstance.getInstanceName();
- ObjectName objectName = new ObjectName(
- "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent,instance="
- + instanceName);
- doTest(objectName);
- }
-
- /**
- * Test the MBean exposed by the simple component, defined with
- * annotations.
- */
- @Test
- public void testMBeanWithAnnotations() throws MalformedObjectNameException, IntrospectionException,
- InstanceNotFoundException, ListenerNotFoundException,
- ReflectionException, MBeanException {
- // Create an instance of the component
- ComponentInstance componentInstance = ipojoHelper
- .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotated");
- String instanceName = componentInstance.getInstanceName();
- ObjectName objectName = new ObjectName(
- "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotated,instance="
- + instanceName);
- doTest(objectName);
- }
-
- /**
- * Test the MBean exposed by the simple component, defined with
- * annotations.
- */
- @Test
- public void testMBeanWithAnnotationsDeprecated() throws MalformedObjectNameException, IntrospectionException,
- InstanceNotFoundException, ListenerNotFoundException,
- ReflectionException, MBeanException {
- // Create an instance of the component
- ComponentInstance componentInstance = ipojoHelper
- .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotatedDeprecated");
- String instanceName = componentInstance.getInstanceName();
- ObjectName objectName = new ObjectName(
- "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotatedDeprecated,instance="
- + instanceName);
- doTest(objectName);
- }
-
- /**
- * Utility method used to test the MBean with the given objectName.
- *
- * @param objectName the objectName of the MBean to test.
- */
- private void doTest(ObjectName objectName) throws IntrospectionException, InstanceNotFoundException, ReflectionException, MBeanException, ListenerNotFoundException {
-
- // Get the MBean from the platform MBean server
-
- MBeanInfo mBeanInfo = m_server.getMBeanInfo(objectName);
- ObjectInstance objectInstance = m_server.getObjectInstance(objectName);
- assertNotNull(mBeanInfo);
- assertNotNull(objectInstance);
- // Check that the property is exposed
- MBeanAttributeInfo[] attributes = mBeanInfo.getAttributes();
- assertEquals(1, attributes.length);
- MBeanAttributeInfo attribute = attributes[0];
- assertEquals("integer", attribute.getName());
- assertEquals("int", attribute.getType());
- assertTrue(attribute.isReadable());
- assertFalse(attribute.isWritable());
- // Check that both methods are exposed
- MBeanOperationInfo[] operations = mBeanInfo.getOperations();
- assertEquals(2, operations.length);
- MBeanOperationInfo getOperation;
- MBeanOperationInfo setOperation;
- // Order is not important
- if (operations[0].getName().equals("getIntegerValue")) {
- getOperation = operations[0];
- setOperation = operations[1];
- } else {
- setOperation = operations[0];
- getOperation = operations[1];
- }
- // Check the 'get' operation
- assertEquals("getIntegerValue", getOperation.getName());
- assertEquals("Get the value of the integer",
- getOperation.getDescription());
- assertEquals("int", getOperation.getReturnType());
- MBeanParameterInfo[] getOperationParams = getOperation.getSignature();
- assertEquals(0, getOperationParams.length);
- // Check the 'set' operation
- assertEquals("setIntegerValue", setOperation.getName());
- assertEquals("Set the value of the integer",
- setOperation.getDescription());
- assertEquals("int", setOperation.getReturnType());
- MBeanParameterInfo[] setOperationParams = setOperation.getSignature();
- assertEquals(1, setOperationParams.length);
- assertEquals("int", setOperationParams[0].getType());
- // Call the methods and test the result, also test notifications
- CustomNotificationListener listener = new CustomNotificationListener();
- m_server.addNotificationListener(objectName, listener, null, null);
- int value1 = 123;
- int value2 = 456;
- m_server.invoke(objectName, "setIntegerValue", new Object[]{value1},
- new String[]{"int"});
- m_server.invoke(objectName, "setIntegerValue", new Object[]{value2},
- new String[]{"int"});
- int result = (Integer) m_server.invoke(objectName, "getIntegerValue",
- new Object[0], new String[0]);
- assertEquals(value2, result);
- m_server.removeNotificationListener(objectName, listener, null, null);
- //assertEquals(2, listener.getCount());
- }
-
- /**
- * Custom listener used to count MBean notifications.
- *
- * @author Felix Project Team
- */
- private class CustomNotificationListener implements NotificationListener {
-
- /**
- * Counter for the notifications.
- */
- private int m_counter = 0;
-
- /**
- * Notified !
- *
- * @param notification the notification
- * @param handback ignored
- */
- public void handleNotification(Notification notification,
- Object handback) {
- m_counter++;
- }
-
- /**
- * Return the notification count of this listener.
- *
- * @return the notification count of this listener.
- */
- public int getCount() {
- return m_counter;
- }
- }
-
-}
diff --git a/ipojo/handler/jmx/jmx-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/jmx-handler-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/jmx/jmx-handler/changelog.txt b/ipojo/handler/jmx/jmx-handler/changelog.txt
deleted file mode 100644
index 87556fcf47..0000000000
--- a/ipojo/handler/jmx/jmx-handler/changelog.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Changes from 1.4.0 to 1.6.0
----------------------------
-** Improvement
- * [FELIX-2633] - Rename JMX annotations
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1183] - iPOJO JMX handler doesn't re-throw exceptions
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-828] - iPOJO JMX Handler: the name attribute has not the expected behavior
- * [FELIX-829] - iPOJO JMX Handler: the sub-element should refer to the handler namespace
-
-Version 1.0.0
--------------
- * Initial release
diff --git a/ipojo/handler/jmx/jmx-handler/metadata.xml b/ipojo/handler/jmx/jmx-handler/metadata.xml
deleted file mode 100644
index 67b6b38900..0000000000
--- a/ipojo/handler/jmx/jmx-handler/metadata.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/jmx-handler/obr.xml b/ipojo/handler/jmx/jmx-handler/obr.xml
deleted file mode 100644
index 310c385099..0000000000
--- a/ipojo/handler/jmx/jmx-handler/obr.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/jmx-handler/pom.xml b/ipojo/handler/jmx/jmx-handler/pom.xml
deleted file mode 100644
index 37636b7759..0000000000
--- a/ipojo/handler/jmx/jmx-handler/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Apache Felix iPOJO JMX Handler
- org.apache.felix.ipojo.handler.jmx
- 1.5.0-SNAPSHOT
-
-
- iPOJO extension to expose instances as MBean inside a MBean Server.
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ipojo-jmx-handler.html
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.6
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
- 2.3.7
-
-
-
- org.apache.felix.ipojo.handlers.jmx
-
-
- org.osgi.framework;version=1.5, *
-
- ${project.name}
- ${project.artifactId}
- The Apache Software Foundation
- iPOJO JMX Handler
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ipojo-jmx-handler.html
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.8.6
-
-
-
- ipojo-bundle
-
-
- metadata.xml
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
deleted file mode 100644
index d2fe8f28dc..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.Attribute;
-import javax.management.AttributeChangeNotification;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.DynamicMBean;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.util.Callback;
-import org.apache.felix.ipojo.util.Logger;
-
-/**
- * This class implements iPOJO DynamicMBean. it builds the dynamic MBean
- *
- * @author Felix Project Team
- */
-public class DynamicMBeanImpl extends NotificationBroadcasterSupport implements
- DynamicMBean {
-
- /**
- * The instance manager. Used to store the InstanceManager instance.
- */
- protected final InstanceManager m_instanceManager;
-
- /**
- * The JmxConfigDFieldMap. Stors the data extracted from metadata.xml.
- */
- private JmxConfigFieldMap m_configMap;
-
- /**
- * The MBeanInfo. The class storing the MBean Informations.
- */
- private MBeanInfo m_mBeanInfo;
-
- /**
- * The class name. Constant storing the name of the class.
- */
- private String m_className = this.getClass().getName();
-
- /**
- * The sequence number. Used to calculate unique id to notification.
- */
- private int m_sequenceNumber;
-
- /**
- * Constructor.
- *
- * @param properties the data extracted from metadat.xml file
- * @param instanceManager the InstanceManager instance
- */
- public DynamicMBeanImpl(JmxConfigFieldMap properties,
- InstanceManager instanceManager) {
- m_configMap = properties;
- m_instanceManager = instanceManager;
- this.buildMBeanInfo();
- }
-
- /**
- * Gets the value of the required attribute.
- *
- * @param arg0 the name of required attribute
- * @throws AttributeNotFoundException if the attribute doesn't exist
- * @throws MBeanException if something bad occures
- * @throws ReflectionException if something bad occures
- * @return the object attribute
- */
- public Object getAttribute(String arg0) throws AttributeNotFoundException,
- MBeanException, ReflectionException {
- PropertyField attribute = m_configMap.getPropertyFromName(arg0);
-
- if (attribute == null) {
- throw new AttributeNotFoundException(arg0 + " not found");
- } else {
- return attribute.getValue();
- }
- }
-
- /**
- * Gets values of required attributes.
- *
- * @param attributeNames the names of the required attributes
- * @return return the list of the attribute
- */
- public AttributeList getAttributes(String[] attributeNames) {
-
- if (attributeNames == null) {
- throw new IllegalArgumentException(
- "attributeNames[] cannot be null");
- }
-
- AttributeList resultList = new AttributeList();
- for (int i = 0; i < attributeNames.length; i++) {
- PropertyField propertyField = (PropertyField) m_configMap
- .getPropertyFromField((String) attributeNames[i]);
-
- if (propertyField != null) {
- resultList.add(new Attribute(attributeNames[i], propertyField
- .getValue()));
- }
- }
- return resultList;
- }
-
- /**
- * Returns the MBean Class builded.
- *
- * @return return MBeanInfo class constructed by buildMBeanInfo
- */
- public MBeanInfo getMBeanInfo() {
- return m_mBeanInfo;
- }
-
- /**
- * Invokes the required method on the targeted POJO.
- *
- * @param operationName the name of the method called
- * @param params the parameters given to the method
- * @param signature the determine which method called
- * @return the object return by the method
- * @throws MBeanException if something bad occures
- * @throws ReflectionException if something bad occures
- */
- public Object invoke(String operationName, Object[] params,
- String[] signature) throws MBeanException, ReflectionException {
-
- MethodField method = m_configMap.getMethodFromName(operationName,
- signature);
- if (method != null) {
- MethodMetadata methodCall = method.getMethod();
- Callback mc = new Callback(methodCall, m_instanceManager);
- try {
- return mc.call(params);
- } catch (NoSuchMethodException e) {
- throw new ReflectionException(e);
- } catch (IllegalAccessException e) {
- throw new ReflectionException(e);
- } catch (InvocationTargetException e) {
- throw new MBeanException(e);
- }
- } else {
- throw new ReflectionException(new NoSuchMethodException(
- operationName), "Cannot find the operation " + operationName
- + " in " + m_className);
- }
- }
-
- /**
- * Changes specified attribute value.
- *
- * @param attribute the attribute with new value to be changed
- * @throws AttributeNotFoundException if the required attribute was not found
- * @throws InvalidAttributeValueException if the value is inccorrect type
- * @throws MBeanException if something bad occures
- * @throws ReflectionException if something bad occures
- */
- public void setAttribute(Attribute attribute)
- throws AttributeNotFoundException, InvalidAttributeValueException,
- MBeanException, ReflectionException {
-
- // Check attribute is not null to avoid NullPointerException later on
- if (attribute == null) {
- throw new RuntimeOperationsException(new IllegalArgumentException(
- "Attribute cannot be null"), "Cannot invoke a setter of "
- + m_className + " with null attribute");
- }
- String name = attribute.getName();
- Object value = attribute.getValue();
-
- if (name == null) {
- throw new RuntimeOperationsException(new IllegalArgumentException(
- "Attribute name cannot be null"),
- "Cannot invoke the setter of " + m_className
- + " with null attribute name");
- }
- // Check for a recognized attribute name and call the corresponding
- // setter
- //
-
- PropertyField propertyField = (PropertyField) m_configMap
- .getPropertyFromName(name);
- if (propertyField == null) {
- // unrecognized attribute name:
- throw new AttributeNotFoundException("Attribute " + name
- + " not found in " + m_className);
- }
- if (!propertyField.isWritable()) {
- throw new InvalidAttributeValueException("Attribute " + name
- + " can not be set");
- }
-
- if (value == null) {
- try {
- m_instanceManager.onSet(null, propertyField.getField(), null);
- } catch (Exception e) {
- throw new InvalidAttributeValueException(
- "Cannot set attribute " + name + " to null");
- }
- } else { // if non null value, make sure it is assignable to the
- // attribute
-// if (true /* TODO type.class.isAssignableFrom(value.getClass()) */) {
- // propertyField.setValue(value);
- // setValue(attributeField.getField(),null);
- m_instanceManager.onSet(null, propertyField.getField(), value);
-// } else {
-// throw new InvalidAttributeValueException(
-// "Cannot set attribute " + name + " to a "
-// + value.getClass().getName()
-// + " object, String expected");
-// }
- }
-
- }
-
- /**
- * Changes all the attributes value.
- *
- * @param attributes the list of attribute value to be changed
- * @return the list of new attribute
- */
- public AttributeList setAttributes(AttributeList attributes) {
-
- // Check attributes is not null to avoid NullPointerException later on
- if (attributes == null) {
- throw new RuntimeOperationsException(new IllegalArgumentException(
- "AttributeList attributes cannot be null"),
- "Cannot invoke a setter of " + m_className);
- }
- AttributeList resultList = new AttributeList();
-
- // if attributeNames is empty, nothing more to do
- if (attributes.isEmpty()) {
- return resultList;
- }
-
- // for each attribute, try to set it and add to the result list if
- // successful
- for (Iterator i = attributes.iterator(); i.hasNext();) {
- Attribute attr = (Attribute) i.next();
- try {
- setAttribute(attr);
- String name = attr.getName();
- Object value = getAttribute(name);
- resultList.add(new Attribute(name, value));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return resultList;
- }
-
- /**
- * Builds the MBean information on initialization. This
- * value doesn't change further.
- */
- private void buildMBeanInfo() {
-
- // generate infos for attributes
- MBeanAttributeInfo[] dAttributes = null;
-
- if (m_configMap == null) {
- return;
- }
-
- String dDescription = m_configMap.getDecription();
-
- if (m_configMap.getProperties() != null) {
- List < MBeanAttributeInfo > lAttributes = null;
- lAttributes = new ArrayList < MBeanAttributeInfo >();
-
- Iterator < PropertyField > iterator = m_configMap.getProperties()
- .iterator();
- while (iterator.hasNext()) {
- PropertyField propertyField = iterator.next();
- lAttributes.add(new MBeanAttributeInfo(propertyField.getName(),
- propertyField.getType(), propertyField.getDescription(),
- propertyField.isReadable(), propertyField.isWritable(),
- false));
- }
- dAttributes = lAttributes
- .toArray(new MBeanAttributeInfo[lAttributes.size()]);
- }
-
- MBeanOperationInfo[] dOperations = null;
- if (m_configMap.getMethods() != null) {
-
- List < MBeanOperationInfo > lOperations = new ArrayList < MBeanOperationInfo >();
-
- Iterator < MethodField[] > iterator = m_configMap.getMethods()
- .iterator();
- while (iterator.hasNext()) {
- MethodField[] method = iterator.next();
- for (int i = 0; i < method.length; i++) {
- lOperations.add(new MBeanOperationInfo(method[i].getName(),
- method[i].getDescription(), method[i].getParams(),
- method[i].getReturnType(), MBeanOperationInfo.UNKNOWN));
- }
- dOperations = lOperations
- .toArray(new MBeanOperationInfo[lOperations.size()]);
- }
- }
-
- MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
- if (m_configMap.getMethods() != null) {
-
- List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >();
-
- Iterator < NotificationField > iterator = m_configMap
- .getNotifications().iterator();
- while (iterator.hasNext()) {
- NotificationField notification = iterator
- .next();
- lNotifications.add(notification.getNotificationInfo());
- }
- dNotification = lNotifications
- .toArray(new MBeanNotificationInfo[lNotifications.size()]);
- }
-
- m_mBeanInfo = new MBeanInfo(this.m_className, dDescription,
- dAttributes, null, // No constructor
- dOperations, dNotification);
- }
-
- /**
- * Gets the notification informations (use by JMX).
- *
- * @return the structure which describe the notifications
- */
- public MBeanNotificationInfo[] getNotificationInfo() {
- MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
- if (m_configMap.getMethods() != null) {
-
- List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >();
-
- Iterator < NotificationField > iterator = m_configMap
- .getNotifications().iterator();
- while (iterator.hasNext()) {
- NotificationField notification = iterator
- .next();
- lNotifications.add(notification.getNotificationInfo());
- }
- dNotification = lNotifications
- .toArray(new MBeanNotificationInfo[lNotifications.size()]);
- }
- return dNotification;
- }
-
- /**
- * Sends a notification to a subscriber.
- *
- * @param msg the msg to send
- * @param attributeName the name of the attribute
- * @param attributeType the type of the attribute
- * @param oldValue the old value of the attribute
- * @param newValue the new value of the attribute
- */
- public void sendNotification(String msg, String attributeName,
- String attributeType, Object oldValue, Object newValue) {
-
- long timeStamp = System.currentTimeMillis();
-
- if ((newValue == null && oldValue == null)
- || (newValue != null && newValue.equals(oldValue))) {
- return;
- }
- m_sequenceNumber++;
- Notification notification = new AttributeChangeNotification(this,
- m_sequenceNumber, timeStamp, msg, attributeName, attributeType,
- oldValue, newValue);
- sendNotification(notification);
- m_instanceManager.getFactory().getLogger().log(Logger.INFO,
- "Notification sent");
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
deleted file mode 100644
index c3c9dd36af..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.util.Callback;
-
-/**
- * This class implements a 'wide' iPOJO DynamicMBean that can perform actions
- * before and after its registration and deregistration.
- *
- * @author Felix Project Team
- */
-public class DynamicMBeanWRegisterImpl extends DynamicMBeanImpl implements
- MBeanRegistration {
-
- /**
- * The preRegister method of MBeanRegistration interface.
- */
- private MethodMetadata m_preRegisterMeth;
- /**
- * The postRegister method of MBeanRegistration interface.
- */
- private MethodMetadata m_postRegisterMeth;
- /**
- * The preDeregister method of MBeanRegistration interface.
- */
- private MethodMetadata m_preDeregisterMeth;
- /**
- * The postDeregister method of MBeanRegistration interface.
- */
- private MethodMetadata m_postDeregisterMeth;
- /**
- * The effective name of the MBean.
- */
- private ObjectName m_objName;
-
- /**
- * Constructs a new DynamicMBeanWRegisterImpl.
- *
- * @param properties the data extracted from the metadata.xml
- * @param instanceManager the instance manager
- * @param preRegisterMeth the method to call before MBean registration
- * @param postRegisterMeth the method to call after MBean registration
- * @param preDeregisterMeth the method to call before MBean deregistration
- * @param postDeregisterMeth the method to call after MBean registration
- */
- public DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties,
- InstanceManager instanceManager, MethodMetadata preRegisterMeth,
- MethodMetadata postRegisterMeth, MethodMetadata preDeregisterMeth,
- MethodMetadata postDeregisterMeth) {
- super(properties, instanceManager);
-
- m_preRegisterMeth = preRegisterMeth;
- m_postRegisterMeth = postRegisterMeth;
- m_preDeregisterMeth = preDeregisterMeth;
- m_postDeregisterMeth = postDeregisterMeth;
- }
-
- /**
- * Returns the MBean name used to register it.
- *
- * @return the MBean name used to register it.
- */
- public ObjectName getObjectName() {
- return m_objName;
- }
-
- /**
- * This method is executed before the MBean registration.
- *
- * @param server the server on which the MBean will be registered
- * @param name the name of the MBean to expose
- * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.
- * @return the name with which the MBean will be registered
- */
- public ObjectName preRegister(MBeanServer server, ObjectName name)
- throws Exception {
- m_objName = (ObjectName) callMethod(m_preRegisterMeth,
- MBeanHandler.PRE_REGISTER_METH_NAME, new Object[] { server, name });
- return m_objName;
- }
-
- /**
- * This method is executed after the MBean registration.
- *
- * @param registrationDone indicates whether or not the MBean has been successfully registered in the MBean server.
- */
- public void postRegister(Boolean registrationDone) {
- callMethod(m_postRegisterMeth, MBeanHandler.POST_REGISTER_METH_NAME,
- new Object[] { registrationDone });
- }
-
- /**
- * This method is before after the MBean deregistration.
- *
- * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException.
- */
- public void preDeregister() throws Exception {
- callMethod(m_preDeregisterMeth, MBeanHandler.PRE_DEREGISTER_METH_NAME,
- null);
- }
-
- /**
- * This method is executed after the MBean deregistration.
- */
- public void postDeregister() {
- callMethod(m_postDeregisterMeth,
- MBeanHandler.POST_DEREGISTER_METH_NAME, null);
- }
-
- /**
- * Private method used to execute a given callback.
- *
- * @param methodMetadata the metadata description of the callback
- * @param methodName the name of the callback
- * @param params the parameters of the callback
- * @return the object eventually returned by the callback, or null if nothing's returned
- */
- private Object callMethod(MethodMetadata methodMetadata, String methodName,
- Object[] params) {
- Callback mc = new Callback(methodMetadata, m_instanceManager);
- try {
- if ((params == null) || (params.length == 0)) {
- return mc.call();
- } else {
- return mc.call(params);
- }
- } catch (NoSuchMethodException e) {
- // should never happen : method exists
- System.err.println("No such method : " + methodName);
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- System.err.println("Illegal Access Exception");
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- System.err.println("Invocation Target Exception");
- e.printStackTrace();
- }
- return null;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
deleted file mode 100644
index a5b19559b4..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.metadata.Attribute;
-import org.apache.felix.ipojo.metadata.Element;
-
-/**
- * Description of the JMX handler.
- *
- * @author Felix Project Team
- */
-public class JMXHandlerDescription extends HandlerDescription {
-
- /**
- * The referenced handler.
- */
- private MBeanHandler m_handler;
-
- /**
- * Constructs a new handler description for the given handler.
- *
- * @param handler the handler to describe
- */
- public JMXHandlerDescription(MBeanHandler handler) {
- super(handler);
- m_handler = handler;
- }
-
- /**
- * Gets handler information.
- *
- * @return the handler information.
- */
- public Element getHandlerInfo() {
- Element elem = super.getHandlerInfo();
- elem.addAttribute(new Attribute("registered", Boolean
- .toString(m_handler.isRegistered())));
- elem.addAttribute(new Attribute("objectName", m_handler
- .getUsedObjectName()));
- if (m_handler.isUsesMOSGi()) {
- String foundStr = null;
-
- if (m_handler.isMOSGiExists()) {
- foundStr = "found";
- } else {
- foundStr = "not_found";
- }
- elem.addAttribute(new Attribute("mosgi", foundStr));
- }
-
- return elem;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
deleted file mode 100644
index 56f436a83d..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * JmxConfigFieldMap : use to store the informations needed to build the Dynamic
- * MBean.
- *
- * @author Felix Project Team
- */
-public class JmxConfigFieldMap {
-
- /**
- * The exposed attributes.
- */
- private Map < String, PropertyField > m_properties = new HashMap < String, PropertyField >();
- /**
- * The exposed methods.
- */
- private Map < String, MethodField[] > m_methods = new HashMap < String, MethodField[] >();
- /**
- * The allowed notifications.
- */
- private Map < String, NotificationField > m_notifications = new HashMap < String, NotificationField >();
- /**
- * The description of the Mbean.
- */
- private String m_description;
-
- /**
- * Constructor.
- */
- public JmxConfigFieldMap() {
-
- }
-
- /**
- * Gets the description of the MBean.
- *
- * @return the description of the MBean
- */
- public String getDecription() {
- return m_description;
- }
-
- /**
- * Sets the description of the MBean.
- *
- * @param description a String which describes the Mbean
- */
- public void setDescription(String description) {
- this.m_description = description;
- }
-
- /**
- * Adds a new attribute exposed in the Mbean.
- *
- * @param name the name of the new property
- * @param propertyField the field which describes the property
- */
- public void addPropertyFromName(String name, PropertyField propertyField) {
- m_properties.put(name, propertyField);
- }
-
- /**
- * Gets all of the properties exposed.
- *
- * @return the collection of all properties
- */
- public Collection < PropertyField > getProperties() {
- if (m_properties != null) {
- return m_properties.values();
- } else {
- return null;
- }
- }
-
- /**
- * Gets the property by the name.
- *
- * @param name the name of the required property
- * @return the field required or null if is not found
- */
- public PropertyField getPropertyFromName(String name) {
- PropertyField prop = m_properties.get(name);
- return prop;
- }
-
- /**
- * Gets the property by the field.
- *
- * @param field the required field
- * @return the property by the field
- */
- public PropertyField getPropertyFromField(String field) {
- PropertyField property = null;
- Iterator < PropertyField > it = m_properties.values().iterator();
- while (it.hasNext()) {
- PropertyField p = it.next();
- if (p.getField().compareTo(field) == 0) {
- if (property != null) {
- System.err.println("a field already exists");
- } else {
- property = p;
- }
- }
- }
- return property;
- }
-
- /**
- * Adds a new method descriptor from its name.
- *
- * @param name the name of the method
- * @param methodField the description of the method
- */
- public void addMethodFromName(String name, MethodField methodField) {
- MethodField[] mf;
- if (!m_methods.containsKey(name)) {
- mf = new MethodField[1];
- mf[0] = methodField;
- } else {
- MethodField[] temp = m_methods.get(name);
- mf = new MethodField[temp.length + 1];
- for (int i = 0; i < temp.length; i++) {
- mf[i] = temp[i];
- }
- mf[temp.length] = methodField;
- }
- m_methods.put(name, mf);
- }
-
- /**
- * Adds new methods descriptors from one name. (the method must have the same name but different signature).
- *
- * @param name the name of the method
- * @param methodsField the description of the methods
- */
- public void addMethodFromName(String name, MethodField[] methodsField) {
- MethodField[] mf;
- if (!m_methods.containsKey(name)) {
- mf = methodsField;
- } else {
- MethodField[] temp = m_methods.get(name);
- mf = new MethodField[temp.length + methodsField.length];
- for (int i = 0; i < temp.length; i++) {
- mf[i] = temp[i];
- }
- for (int i = 0; i < methodsField.length; i++) {
- mf[i + temp.length] = methodsField[i];
- }
- }
- m_methods.put(name, mf);
- }
-
- /**
- * Adds a method from name and erases the older if exists.
- *
- * @param name the name of the method
- * @param methodField the method to be added
- */
- public void overrideMethodFromName(String name, MethodField methodField) {
- MethodField[] mf = new MethodField[1];
- mf[0] = methodField;
- m_methods.put(name, mf);
- }
-
- /**
- * Add methods from name and erases the olders if exists.
- *
- * @param name the name of the method
- * @param methodsField the array of methods to be added
- */
- public void overrideMethodFromName(String name, MethodField[] methodsField) {
- m_methods.put(name, methodsField);
- }
-
- /**
- * Returns the method(s) with the given name.
- *
- * @param name the name of the methods
- * @return the list of methods with the given name
- */
- public MethodField[] getMethodFromName(String name) {
- MethodField[] prop = m_methods.get(name);
- return prop;
- }
-
- /**
- * Gets the method with the good signature.
- *
- * @param operationName the name of the method requiered
- * @param signature the required signature
- * @return the method which the same signature or null if not found
- */
- public MethodField getMethodFromName(String operationName,
- String[] signature) {
- MethodField[] methods = m_methods.get(operationName);
- for (int i = 0; i < methods.length; i++) {
- if (isSameSignature(signature, methods[i].getSignature())) {
- return methods[i];
- }
- }
- return null;
- }
-
- /**
- * Compares two method signature.
- *
- * @param sig1 the first signature
- * @param sig2 the second signature
- * @return true if the signature are similar false otherwise
- */
- private boolean isSameSignature(String[] sig1, String[] sig2) {
- if (sig1.length != sig2.length) {
- return false;
- } else {
- for (int i = 0; i < sig1.length; i++) {
- if (!sig1[i].equals(sig2[i])) {
- return false;
- }
- }
-
- }
- return true;
- }
-
- /**
- * Returns all methods store.
- *
- * @return the collection of methodField[]
- */
- public Collection < MethodField[] > getMethods() {
- if (m_methods != null) {
- return m_methods.values();
- } else {
- return null;
- }
- }
-
- /**
- * Adds a notification.
- *
- * @param name the name of the notification
- * @param notificationField the field involved with the notification.
- */
- public void addNotificationFromName(String name,
- NotificationField notificationField) {
- m_notifications.put(name, notificationField);
- }
-
- /**
- * Returns the notification with the given name.
- *
- * @param name the name of the notification to return
- * @return the notification if it exists, {@code null} otherwise
- */
- public NotificationField getNotificationFromName(String name) {
- NotificationField prop = m_notifications.get(name);
- return prop;
- }
-
- /**
- * Gets all notifications defined.
- *
- * @return the collection of NotificationField
- */
- public Collection < NotificationField > getNotifications() {
- if (m_notifications != null) {
- return m_notifications.values();
- } else {
- return null;
- }
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
deleted file mode 100644
index 2258b0e38d..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.util.*;
-
-import javax.management.MBeanRegistration;
-import javax.management.MBeanServer;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-
-import org.apache.felix.ipojo.FieldInterceptor;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.architecture.HandlerDescription;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.FieldMetadata;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.parser.PojoMetadata;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * This class implements iPOJO Handler. it builds the dynamic MBean from
- * metadata.xml and exposes it to the MBean Server.
- *
- * @author Felix Project Team
- */
-public class MBeanHandler extends PrimitiveHandler {
-
- /**
- * The name of the MBeanRegistration postDeregister method.
- */
- public static final String POST_DEREGISTER_METH_NAME = "postDeregister";
-
- /**
- * The name of the MBeanRegistration preDeregister method.
- */
- public static final String PRE_DEREGISTER_METH_NAME = "preDeregister";
-
- /**
- * The name of the MBeanRegistration postRegister method.
- */
- public static final String POST_REGISTER_METH_NAME = "postRegister";
-
- /**
- * The name of the MBeanRegistration preRegister method.
- */
- public static final String PRE_REGISTER_METH_NAME = "preRegister";
-
- /**
- * The name of the global configuration element.
- */
- private static final String JMX_CONFIG_ELT = "config";
-
- /**
- * The name of the global configuration element.
- */
- private static final String JMX_CONFIG_ALT_ELT = "JmxBean";
-
- /**
- * The name of the component object full name attribute.
- */
- private static final String JMX_OBJ_NAME_ELT = "objectName";
-
- /**
- * The name of the component object name domain attribute.
- */
- private static final String JMX_OBJ_NAME_DOMAIN_ELT = "domain";
-
- /**
- * The name of the component object name attribute.
- */
- private static final String JMX_OBJ_NAME_WO_DOMAIN_ELT = "name";
-
- /**
- * The name of the attribute indicating if the handler uses MOSGi MBean server.
- */
- private static final String JMX_USES_MOSGI_ELT = "usesMOSGi";
-
- /**
- * The name of a method element.
- */
- private static final String JMX_METHOD_ELT = "method";
-
- /**
- * The alternative name of a method element.
- */
- private static final String JMX_METHOD_ELT_ALT = "JmxMethod";
-
- /**
- * The name of the property or method name attribute.
- */
- private static final String JMX_NAME_ELT = "name";
-
- /**
- * The name of a method description attribute.
- */
- private static final String JMX_DESCRIPTION_ELT = "description";
-
- /**
- * The name of a property element.
- */
- private static final String JMX_PROPERTY_ELT = "property";
-
- /**
- * The alternative name of a property element.
- */
- private static final String JMX_PROPERTY_ELT_ALT = "JmxProperty";
-
- /**
- * The name of the field attribute.
- */
- private static final String JMX_FIELD_ELT = "field";
-
- /**
- * The name of the notification attribute.
- */
- private static final String JMX_NOTIFICATION_ELT = "notification";
-
- /**
- * The name of the rights attribute.
- */
- private static final String JMX_RIGHTS_ELT = "rights";
-
- /**
- * The instance manager. Used to store the InstanceManager instance.
- */
- private InstanceManager m_instanceManager;
- /**
- * The service registration. Used to register and unregister the Dynamic MBean.
- */
- private ServiceRegistration m_serviceRegistration;
- /**
- * Stores data when parsing metadata.xml.
- */
- private JmxConfigFieldMap m_jmxConfigFieldMap;
- /**
- * Stores the Dynamic MBean.
- */
- private DynamicMBeanImpl m_MBean;
- /**
- * Constant storing the name of the class.
- */
- private String m_namespace = "org.apache.felix.ipojo.handlers.jmx";
- /**
- * The flag used to inform if we use the MOSGi framework.
- */
- private boolean m_usesMOSGi;
- /**
- * The ObjectName used to register the MBean.
- */
- private ObjectName m_objectName;
- /**
- * The flag used to inform if the MBean is registered.
- */
- private boolean m_registered;
- /**
- * The ObjectName specified in handler configuration. It can be null.
- */
- private String m_completeObjNameElt;
- /**
- * The ObjectName without domain specified in handler configuration. It can be null.
- */
- private String m_objNameWODomainElt;
-
- /**
- * The ObjectName domain specified in handler configuration. It can be null.
- */
- private String m_domainElt;
- /**
- * The flag informing if the POJO implements the MBeanRegistration interface.
- */
- private boolean m_registerCallbacks;
- /**
- * The preRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
- */
- private MethodMetadata m_preRegisterMeth;
- /**
- * The postRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
- */
- private MethodMetadata m_postRegisterMeth;
- /**
- * The preDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
- */
- private MethodMetadata m_preDeregisterMeth;
- /**
- * The postDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface.
- */
- private MethodMetadata m_postDeregisterMeth;
-
- /**
- * Constructs the structure JmxConfigFieldMap and the Dynamic Mbean.
- *
- * @param metadata the component metadata
- * @param dict the instance configuration
- */
- public void configure(Element metadata, Dictionary dict) {
-
- PojoMetadata manipulation = getPojoMetadata();
-
- m_instanceManager = getInstanceManager();
-
- m_jmxConfigFieldMap = new JmxConfigFieldMap();
-
- // Build the hashmap
- Element[] mbeans = metadata.getElements(JMX_CONFIG_ELT, m_namespace);
- if (mbeans == null || mbeans.length == 0) {
- mbeans = metadata.getElements(JMX_CONFIG_ALT_ELT, m_namespace);
- }
-
- if (mbeans.length != 1) {
- error("A component must have exactly one " + JMX_CONFIG_ELT + " or " + JMX_CONFIG_ALT_ELT + " element.");
- error("The JMX handler configuration is ignored.");
- return;
- }
-
- Element mbean = mbeans[0];
-
- // retrieve kind of MBeanServer to use
- m_usesMOSGi = Boolean.parseBoolean(mbean.getAttribute(JMX_USES_MOSGI_ELT));
-
- // retrieve object name
- m_completeObjNameElt = mbean.getAttribute(JMX_OBJ_NAME_ELT);
- m_domainElt = mbean.getAttribute(JMX_OBJ_NAME_DOMAIN_ELT);
- m_objNameWODomainElt = mbean.getAttribute(JMX_OBJ_NAME_WO_DOMAIN_ELT);
-
- // test if Pojo is interested in registration callbacks
- m_registerCallbacks = manipulation
- .isInterfaceImplemented(MBeanRegistration.class.getName());
- if (m_registerCallbacks) {
- // don't need to check that methods exist, the pojo implements
- // MBeanRegistration interface
- String[] preRegisterParams = { MBeanServer.class.getName(),
- ObjectName.class.getName() };
- m_preRegisterMeth = manipulation.getMethod(PRE_REGISTER_METH_NAME,
- preRegisterParams);
-
- String[] postRegisterParams = { Boolean.class.getName() };
- m_postRegisterMeth = manipulation.getMethod(
- POST_REGISTER_METH_NAME, postRegisterParams);
-
- m_preDeregisterMeth = manipulation.getMethod(
- PRE_DEREGISTER_METH_NAME, new String[0]);
-
- m_postDeregisterMeth = manipulation.getMethod(
- POST_DEREGISTER_METH_NAME, new String[0]);
- }
-
- // set property
- Element[] attributes = mbean.getElements(JMX_PROPERTY_ELT, m_namespace);
- Element[] attributesAlt = mbean.getElements(JMX_PROPERTY_ELT_ALT, m_namespace);
- List listOfAttributes = new ArrayList();
- if (attributes != null) {
- listOfAttributes.addAll(Arrays.asList(attributes));
- }
- if (attributesAlt != null) {
- listOfAttributes.addAll(Arrays.asList(attributesAlt));
- }
-
- Element[] attributesOld = mbeans[0].getElements(JMX_PROPERTY_ELT);
- if (attributesOld != null) {
- warn("The JMX property element should use the '" + m_namespace + "' namespace.");
- listOfAttributes.addAll(Arrays.asList(attributesOld));
- }
-
- for (Element attribute : listOfAttributes) {
- boolean notif = false;
- String rights;
- String name;
- String field = attribute.getAttribute(JMX_FIELD_ELT);
-
- if (attribute.containsAttribute(JMX_NAME_ELT)) {
- name = attribute.getAttribute(JMX_NAME_ELT);
- } else {
- name = field;
- }
- if (attribute.containsAttribute(JMX_RIGHTS_ELT)) {
- rights = attribute.getAttribute(JMX_RIGHTS_ELT);
- } else {
- rights = "r";
- }
-
- PropertyField property = new PropertyField(name, field, rights,
- getTypeFromAttributeField(field, manipulation));
-
- if (attribute.containsAttribute(JMX_NOTIFICATION_ELT)) {
- notif = Boolean.parseBoolean(attribute
- .getAttribute(JMX_NOTIFICATION_ELT));
- }
-
- property.setNotifiable(notif);
-
- if (notif) {
- // add the new notifiable property in structure
- NotificationField notification = new NotificationField(
- name, this.getClass().getName() + "." + field, null);
- m_jmxConfigFieldMap.addNotificationFromName(name,
- notification);
- }
- m_jmxConfigFieldMap.addPropertyFromName(name, property);
- getInstanceManager().register(manipulation.getField(field),
- this);
- info("property exposed:" + name + " " + field + ":"
- + getTypeFromAttributeField(field, manipulation) + " "
- + rights + ", Notif=" + notif);
- }
-
- // set methods
- Element[] methods = mbean.getElements(JMX_METHOD_ELT, m_namespace);
- Element[] methodsAlt = mbean.getElements(JMX_METHOD_ELT_ALT, m_namespace);
- List listOfMethods = new ArrayList();
- if (methods != null) {
- listOfMethods.addAll(Arrays.asList(methods));
- }
- if (methodsAlt != null) {
- listOfMethods.addAll(Arrays.asList(methodsAlt));
- }
-
- Element[] methodsOld = mbeans[0].getElements(JMX_PROPERTY_ELT);
- if (methodsOld != null) {
- warn("The JMX method element should use the '" + m_namespace + "' namespace.");
- listOfMethods.addAll(Arrays.asList(methodsOld));
- }
-
- for (Element method : listOfMethods) {
- String name = method.getAttribute(JMX_NAME_ELT);
- if (name == null) {
- name = method.getAttribute("method");
- }
- String description = null;
- if (method.containsAttribute(JMX_DESCRIPTION_ELT)) {
- description = method.getAttribute(JMX_DESCRIPTION_ELT);
- }
-
- MethodField[] meth = getMethodsFromName(name, manipulation,
- description);
-
- for (int j = 0; j < meth.length; j++) {
- m_jmxConfigFieldMap.addMethodFromName(name, meth[j]);
-
- info("method exposed:" + meth[j].getReturnType() + " " + name);
- }
- }
-
- }
-
- /**
- * Registers the Dynamic Mbean.
- */
- public void start() {
- // create the corresponding MBean
- if (m_registerCallbacks) {
- m_MBean = new DynamicMBeanWRegisterImpl(m_jmxConfigFieldMap,
- m_instanceManager, m_preRegisterMeth, m_postRegisterMeth,
- m_preDeregisterMeth, m_postDeregisterMeth);
- } else {
- m_MBean = new DynamicMBeanImpl(m_jmxConfigFieldMap,
- m_instanceManager);
- }
-
- if (m_usesMOSGi) {
- // use whiteboard pattern to register MBean
-
- if (m_serviceRegistration != null) {
- m_serviceRegistration.unregister();
- }
-
- // Register the ManagedService
- BundleContext bundleContext = m_instanceManager.getContext();
- Dictionary properties = new Hashtable();
- try {
- m_objectName = new ObjectName(getObjectNameString());
-
- properties.put("jmxagent.objectName", m_objectName.toString());
-
- m_serviceRegistration = bundleContext.registerService(
- javax.management.DynamicMBean.class.getName(), m_MBean,
- properties);
-
- m_registered = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- try {
- m_objectName = new ObjectName(getObjectNameString());
- ObjectInstance instance = ManagementFactory
- .getPlatformMBeanServer().registerMBean(m_MBean,
- m_objectName);
-
- // we must retrieve object name used to register the MBean.
- // It can have been changed by preRegister method of
- // MBeanRegistration interface.
- if (m_registerCallbacks) {
- m_objectName = instance.getObjectName();
- }
-
- m_registered = true;
- } catch (Exception e) {
- error("Registration of MBean failed.", e);
- }
- }
- }
-
- /**
- * Returns the object name of the exposed component.
- *
- * @return the object name of the exposed component.
- */
- private String getObjectNameString() {
- if (m_completeObjNameElt != null) {
- return m_completeObjNameElt;
- }
-
- String domain;
- if (m_domainElt != null) {
- domain = m_domainElt;
- } else {
- domain = getPackageName(m_instanceManager.getClassName());
- }
-
- String name = "type=" + m_instanceManager.getClassName() + ",instance="
- + m_instanceManager.getInstanceName();
- if (m_objNameWODomainElt != null) {
- name = "name=" + m_objNameWODomainElt;
- }
-
- StringBuffer sb = new StringBuffer();
- if ((domain != null) && (domain.length() > 0)) {
- sb.append(domain + ":");
- }
- sb.append(name);
-
- info("Computed Objectname: " + sb.toString());
-
- return sb.toString();
- }
-
- /**
- * Extracts the package name from of given type.
- *
- * @param className the type name.
- * @return the package name of the given type.
- */
- private String getPackageName(String className) {
- String packageName = "";
-
- int plotIdx = className.lastIndexOf(".");
- if (plotIdx != -1) {
- packageName = className.substring(0, plotIdx);
- }
-
- return packageName;
- }
-
- /**
- * Unregisters the Dynamic Mbean.
- */
- public void stop() {
- if (m_usesMOSGi) {
- if (m_serviceRegistration != null) {
- m_serviceRegistration.unregister();
- }
- } else {
- if (m_objectName != null) {
- try {
- ManagementFactory.getPlatformMBeanServer().unregisterMBean(
- m_objectName);
- } catch (Exception e) {
- error("Unregistration of MBean failed.", e);
- }
- m_objectName = null;
- }
- }
-
- m_MBean = null;
- m_registered = false;
- }
-
- /**
- * Called when a POJO member is modified externally.
- *
- * @param pojo the modified POJO object
- * @param fieldName the name of the modified field
- * @param value the new value of the field
- * @see FieldInterceptor#onSet(Object, String, Object)
- */
- public void onSet(Object pojo, String fieldName, Object value) {
- // Check if the field is a configurable property
-
- PropertyField propertyField = (PropertyField) m_jmxConfigFieldMap
- .getPropertyFromField(fieldName);
- if (propertyField != null) {
- if (propertyField.isNotifiable()) {
- // TODO should send notif only when value has changed to a value
- // different than the last one.
- m_MBean.sendNotification(propertyField.getName() + " changed",
- propertyField.getName(), propertyField.getType(),
- propertyField.getValue(), value);
- }
- propertyField.setValue(value);
- }
- }
-
- /**
- * Called when a POJO member is read by the MBean.
- *
- * @param pojo the read POJO object.
- * @param fieldName the name of the modified field
- * @param value the old value of the field
- * @return the (injected) value of the field
- * @see FieldInterceptor#onGet(Object, String, Object)
- */
- public Object onGet(Object pojo, String fieldName, Object value) {
-
- // Check if the field is a configurable property
- PropertyField propertyField = (PropertyField) m_jmxConfigFieldMap
- .getPropertyFromField(fieldName);
- if (propertyField != null) {
- // Do we have a value to inject ?
- Object v = propertyField.getValue();
- if (v == null) {
- String type = propertyField.getType();
- if ("boolean".equals(type)) { v = Boolean.FALSE; }
- else if ("byte".equals(type)) { v = new Byte((byte) 0); }
- else if ("short".equals(type)) { v = new Short((short) 0); }
- else if ("int".equals(type)) { v = new Integer(0); }
- else if ("long".equals(type)) { v = new Long(0); }
- else if ("float".equals(type)) { v = new Float(0); }
- else if ("double".equals(type)) { v =new Double(0); }
- else if ("char".equals(type)) { v = new Character((char) 0); }
-
- return v;
- }
- m_instanceManager.onSet(pojo, fieldName, propertyField.getValue());
- return propertyField.getValue();
- }
- return value;
- }
-
- /**
- * Gets the type from a field name.
- *
- * @param fieldRequire the name of the required field
- * @param manipulation the metadata extracted from metadata.xml file
- * @return the type of the field or {@code null} if it wasn't found
- */
- private static String getTypeFromAttributeField(String fieldRequire,
- PojoMetadata manipulation) {
-
- FieldMetadata field = manipulation.getField(fieldRequire);
- if (field == null) {
- return null;
- } else {
- return FieldMetadata.getReflectionType(field.getFieldType());
- }
- }
-
- /**
- * Gets all the methods available which get this name.
- *
- * @param methodName the name of the required methods
- * @param manipulation the metadata extract from metadata.xml file
- * @param description the description which appears in JMX console
- * @return the array of methods with the right name
- */
- private MethodField[] getMethodsFromName(String methodName,
- PojoMetadata manipulation, String description) {
-
- MethodMetadata[] methods = manipulation.getMethods(methodName);
- if (methods.length == 0) {
- return null;
- }
-
- MethodField[] ret = new MethodField[methods.length];
-
- if (methods.length == 1) {
- ret[0] = new MethodField(methods[0], description);
- return ret;
- } else {
- for (int i = 0; i < methods.length; i++) {
- ret[i] = new MethodField(methods[i], description);
- }
- return ret;
- }
- }
-
- /**
- * Gets the JMX handler description.
- *
- * @return the JMX handler description.
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- public HandlerDescription getDescription() {
- return new JMXHandlerDescription(this);
- }
-
- /**
- * Returns the objectName used to register the MBean. If the MBean is not registered, return an empty string.
- *
- * @return the objectName used to register the MBean.
- * @see org.apache.felix.ipojo.Handler#getDescription()
- */
- public String getUsedObjectName() {
- if (m_objectName != null) {
- return m_objectName.toString();
- } else {
- return "";
- }
- }
-
- /**
- * Returns true if the MBean is registered.
- *
- * @return true if the MBean is registered.
- */
- public boolean isRegistered() {
- return m_registered;
- }
-
- /**
- * Returns true if the MBean must be registered thanks to white board pattern of MOSGi.
- *
- * @return {@code true} if the MBean must be registered thanks to white board pattern of MOSGi, false otherwise.
- */
- public boolean isUsesMOSGi() {
- return m_usesMOSGi;
- }
-
- /**
- * Returns true if the MOSGi framework is present on the OSGi platform.
- *
- * @return {@code true} if the MOSGi framework is present on the OSGi platform, false otherwise.
- */
- public boolean isMOSGiExists() {
- for (Bundle bundle : m_instanceManager.getContext().getBundles()) {
- String symbolicName = bundle.getSymbolicName();
- if ("org.apache.felix.mosgi.jmx.agent".equals(symbolicName)) {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
deleted file mode 100644
index 6ef5b47276..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import javax.management.MBeanParameterInfo;
-
-import org.apache.felix.ipojo.parser.MethodMetadata;
-
-/**
- * This class builds a method JMX description.
- *
- * @author Felix Project Team
- */
-public class MethodField {
-
- /**
- * Stores the method description.
- */
- private String m_description;
- /**
- * Stores the method properties.
- */
- private MethodMetadata m_method;
-
- /**
- * Constructor.
- *
- * @param method the method properties
- * @param description the method description
- */
- public MethodField(MethodMetadata method, String description) {
- this.m_method = method;
- this.m_description = description;
-
- }
-
- /**
- * Gets the method.
- * @return the method
- */
- public MethodMetadata getMethod() {
- return m_method;
- }
-
- /**
- * Gets the description.
- * @return the description
- */
- public String getDescription() {
- return m_description;
- }
-
- /**
- * Gets the name.
- * @return the name
- */
- public String getName() {
- return m_method.getMethodName();
- }
-
- /**
- * Gets the parameter in JMX format.
- *
- * @return info on JMX format
- */
- public MBeanParameterInfo[] getParams() {
- MBeanParameterInfo[] mbean = new MBeanParameterInfo[m_method
- .getMethodArguments().length];
- for (int i = 0; i < m_method.getMethodArguments().length; i++) {
- mbean[i] = new MBeanParameterInfo("arg" + i, m_method
- .getMethodArguments()[i], null);
- }
- return mbean;
- }
-
- public String[] getSignature() {
- return m_method.getMethodArguments();
- }
-
- public String getReturnType() {
- return m_method.getMethodReturn();
- }
-
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
deleted file mode 100644
index ac541c42b1..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import javax.management.MBeanNotificationInfo;
-
-/**
- * This class builds the notification description structure.
- *
- * @author Felix Project Team
- */
-public class NotificationField {
- /**
- * The name of the notification.
- */
- private String m_name;
- /**
- * The description of the notification.
- */
- private String m_description;
- /**
- * The field of the notification.
- */
- private String m_field;
-
- /**
- * Constructor.
- *
- * @param name the name of the notification
- * @param field the field which send a notification when it is modified
- * @param description the description which appears in JMX console
- */
-
- public NotificationField(String name, String field, String description) {
- this.m_name = name;
- this.m_field = field;
- this.m_description = description;
- }
-
- /**
- * Returns the MBeanNotificationInfo from this class.
- *
- * @return the type of the field or {@code null} if it wasn't found
- */
- public MBeanNotificationInfo getNotificationInfo() {
- String[] notificationTypes = new String[1];
- notificationTypes[0] = m_field;
- MBeanNotificationInfo mbni = new MBeanNotificationInfo(
- notificationTypes, m_name, m_description);
- return mbni;
- }
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java
deleted file mode 100644
index 0712733942..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-/**
- * This class build the notification description structure.
- *
- * @author Felix Project Team
- */
-public class PropertyField {
-
- /**
- * The name of the notification.
- */
- private String m_name;
- /**
- * The name of the notification.
- */
- private String m_field;
- /**
- * The name of the notification.
- */
- private String m_rights;
- /**
- * The name of the notification.
- */
- private String m_type;
- /**
- * The name of the notification.
- */
- private Object m_value;
- /**
- * The name of the notification.
- */
- private boolean m_notification;
-
- /**
- * Constructor.
- *
- * @param name the name of the properety
- * @param field the field which send a notification when it is modified
- * @param rights the rights of the attribute (ie: 'r' or 'w')
- * @param type the type of the attribute
- */
- public PropertyField(String name, String field, String rights, String type) {
- this.setName(name);
- this.setField(field);
- this.m_type = type;
- if (isRightsValid(rights)) {
- this.setRights(rights);
- } else {
- this.setRights("r"); // default rights is read only
- }
- }
-
- /**
- * Returns the field.
- * @return the field
- */
- public String getField() {
- return m_field;
- }
-
- /**
- * Modifies the field.
- * @param field the new field
- */
- public void setField(String field) {
- this.m_field = field;
- }
-
- /**
- * Returns the name.
- * @return the name
- */
- public String getName() {
- return m_name;
- }
-
- /**
- * Modifies the name.
- * @param name the new name
- */
- public void setName(String name) {
- this.m_name = name;
- }
-
- /**
- * Returns the rights.
- * @return the rights
- */
- public String getRights() {
- return m_rights;
- }
-
- /**
- * Modifies the rights.
- * @param rights the new rights
- */
- public void setRights(String rights) {
- this.m_rights = rights;
- }
-
- /**
- * Returns the value.
- * @return the value
- */
- public Object getValue() {
- return m_value;
- }
-
- /**
- * Modifies the value.
- * @param value the new value
- */
- public void setValue(Object value) {
- this.m_value = value;
- }
-
- /**
- * Returns the type.
- * @return the type
- */
- public String getType() {
- return this.m_type;
- }
-
- /**
- * Returns the description.
- * @return the description
- */
- public String getDescription() {
- //TODO Implement this method.
- return null;
- }
-
- /**
- * Returns true if this property field is readable, false otherwise.
- * @return {@code true} if this property field is readable, {@code false} otherwise.
- */
- public boolean isReadable() {
- return this.getRights().equals("r") || this.getRights().equals("w");
- }
-
- /**
- * Returns true if this property field is writable, false otherwise.
- * @return {@code true} if this property field is writable, {@code false} otherwise.
- */
- public boolean isWritable() {
- return this.getRights().equals("w");
- }
-
- /**
- * Returns true if this property field is notifiable, false otherwise.
- * @return {@code true} if this property field is notifiable, {@code false} otherwise.
- */
- public boolean isNotifiable() {
- return this.m_notification;
- }
-
- /**
- * Modify the notifiability of this property field.
- * @param value the new notifiability of this property field.
- */
- public void setNotifiable(boolean value) {
- this.m_notification = value;
- }
-
- /**
- * Is the rights is valid or not ? (ie = 'r' || 'w').
- *
- * @param rights string representing the rights
- * @return boolean : return {@code true} if rights = 'r' or 'w'
- */
- public static boolean isRightsValid(String rights) {
- return rights != null && (rights.equals("r") || rights.equals("w"));
- }
-
-}
diff --git a/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd b/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd
deleted file mode 100644
index 80152e9f9c..0000000000
--- a/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
- Description of a JMX managed component.
-
-
-
-
-
-
- The list of methods to expose.
-
-
-
-
-
-
- The list of attributes to expose.
-
-
-
-
-
-
-
- Determines if the component must be register on the
- MOSGi MBean server or not.
-
-
-
-
-
-
- The complete object name of the managed component.
- The syntax of this attribute must be compliant with
- the ObjectName syntax, detailed in the JMX
- specification. If neither domain nor name attributes
- are specified, the default value is determined by
- the package, the type and the instance name of the
- component. This attribute overrides the domain and
- name attributes.
-
-
-
-
-
-
- The domain of the managed object (i.e., the left
- part of the object name). This attribute must be
- compliant with the domain syntax, as described in
- the JMX specification.
-
-
-
-
-
-
- The name property of the managed object. The value
- of this attribute must comply with the ObjectName
- value syntax, as described in the JMX specification.
-
-
-
-
-
-
-
- Specifies method to carry out operations before
- beeing registered from the MBean server. The
- signature of the specified method must be :
- "ObjectName preRegister(MBeanServer server,
- ObjectName name) throws Exception".
-
-
-
-
-
-
- Specifies method to carry out operations after
- beeing registered from the MBean server. The
- signature of the specified method must be : "void
- postRegister(Boolean registrationDone)".
-
-
-
-
-
-
- Specifies method to carry out operations before
- beeing unregistered from the MBean server. The
- signature of the specified method must be : "void
- preDeregister() throws Exception".
-
-
-
-
-
-
- Specifies method to carry out operations after
- beeing unregistered from the MBean server. The
- signature of the specified method must be :
- "void postDeregister()".
-
-
-
-
-
- Description of an attribute to expose.
-
-
-
- The name of the component's field to expose.
-
-
- The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field.
-
-
- Specify the access permission of the exposed field.
-
-
-
- Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access).
-
-
-
-
-
-
-
-
-
- Enable or disable attribute change notification sending for this property. If set to "true", a notification is sent each time the value of the field changes.
-
-
-
-
- Description of a method to expose.
-
-
-
- The name of the method to expose. If multiple methods have the same name, all of them are exposed.
-
-
-
- The description of the exposed method, as it will appear in JMX.
-
-
\ No newline at end of file
diff --git a/ipojo/handler/jmx/pom.xml b/ipojo/handler/jmx/pom.xml
deleted file mode 100644
index 5329b4be41..0000000000
--- a/ipojo/handler/jmx/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- org.apache.felix.ipojo.handler.jmx-handler-project
- 1.5.0-SNAPSHOT
- Apache Felix iPOJO JMX Handler Project
- pom
-
-
- jmx-handler
- jmx-handler-it
-
-
-
-
-
- src/main/resources
-
-
- .
- META-INF
-
- LICENSE*
- NOTICE*
- DEPENDENCIES*
-
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- make-assembly
- package
-
- single
-
-
-
- project
-
-
- false
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- attach-assemblies
- package
-
- attach-artifact
-
-
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz
-
- project
- tar.gz
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.zip
-
- project
- zip
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/jmx/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/temporal/changelog.txt b/ipojo/handler/temporal/changelog.txt
deleted file mode 100644
index ce0f55b986..0000000000
--- a/ipojo/handler/temporal/changelog.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Changes from the 1.6.2 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2438] - Temporal dependencies should use proxies by default
-
-** Improvement
- * [FELIX-2666] - Rename the temporal handler annotation to avoid collision
-
-Changes from the 1.6.0 to 1.6.2
--------------------------------
-** Improvement
- * [FELIX-2472] - Proxies should throw a runtime exception instead of a null point exception
-
-Changes from the 1.4.2 to 1.6.0
--------------------------------
-** Improvement
- * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-855] - Collection support in iPOJO Temporal Dependencies
- * [FELIX-860] - Temporal Dependency Proxy injection
-
-Changes from 0.8.1 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-625] - Temporal Dependency improvements (onTimeout policies)
- * [FELIX-673] - Provide OBR description to iPOJO bundles
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-
-Version 0.8.1
--------------
- * Initial release
diff --git a/ipojo/handler/temporal/pom.xml b/ipojo/handler/temporal/pom.xml
deleted file mode 100644
index 4e9132b63e..0000000000
--- a/ipojo/handler/temporal/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- org.apache.felix.ipojo.handler.temporal-handler-project
- 1.7.0-SNAPSHOT
- Apache Felix iPOJO Temporal Dependency Handler Project
- pom
-
-
- temporal-dependency-handler
- temporal-dependency-handler-it
-
-
-
-
-
- src/main/resources
-
-
- .
- META-INF
-
- LICENSE*
- NOTICE*
- DEPENDENCIES*
-
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- make-assembly
- package
-
- single
-
-
-
- project
-
-
- false
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- attach-assemblies
- package
-
- attach-artifact
-
-
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz
-
- project
- tar.gz
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.zip
-
- project
- zip
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index f76ce776e5..0000000000
--- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,17 +0,0 @@
-I. Included Third-Party Software
-
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
-- BSD License
-
diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE b/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE
deleted file mode 100644
index c45a1e75aa..0000000000
--- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-APACHE FELIX iPOJO Temporal Handler:
-
-The Apache Felix iPOJO Temporal Handler includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-
-For the ASM component:
-
-Copyright (c) 2000-2005 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 6f2e68f9d5..0000000000
--- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1,4 +0,0 @@
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml
deleted file mode 100644
index 74c5a51c74..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml
+++ /dev/null
@@ -1,390 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../../pom/pom.xml
-
-
- 4.0.0
- pom
- Apache Felix iPOJO Temporal Dependency Handler - Integration Test
- org.apache.felix.ipojo.handler.temporal-it
- 1.7.0-SNAPSHOT
-
-
- 3.0.0
- 1.5.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.temporal
- ${project.version}
-
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.1
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
-
- ch.qos.logback
- logback-core
- 1.5.25
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.1
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.2
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
-
-
-
-
-
-
-
-
- test
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- regular
-
- run
-
-
-
- felix
-
- ${project.build.directory}/regular
-
-
-
-
-
-
-
-
-
- test-all
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- equinox-native
-
- run
-
-
-
- equinox
-
- ${project.build.directory}/equinox-native
-
-
-
-
- felix-native
-
- run
-
-
-
- felix
-
- ${project.build.directory}/felix-native
-
-
-
- knopflerfish-native
-
- run
-
-
-
- knopflerfish
-
- ${project.build.directory}/knopflerfish-native
-
-
-
-
-
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- http://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- 5.2.0
- test
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- 3.8.1.v20120830-144521
- test
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
-
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml
deleted file mode 100644
index af12fda763..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.temporal-it
- 1.7.0-SNAPSHOT
- ../../../pom.xml
-
-
-
- ipojo-temporal-integration-test
- ${project.artifactId}
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.8.6
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java
deleted file mode 100644
index 404ef353e8..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.temporal.components;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class CheckServiceProvider implements CheckService {
-
- /**
- * Temporal dependency.
- */
- private FooService fs;
-
- public boolean check() {
- if (fs != null) {
- return fs.foo();
- }
- return false;
- }
-
- public Properties getProps() {
- if (fs != null) {
- return fs.fooProps();
- }
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java
deleted file mode 100644
index 853fefc17f..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.temporal.components;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-public class CollectionCheckServiceProvider implements CheckService {
-
- /**
- * Temporal dependency.
- */
- private Collection fs;
-
- public boolean check() {
- boolean result = true;
- //Use a local variable to avoid to wait at each access.
- Collection col = fs;
- if (col != null) {
- Iterator it = col.iterator();
- while (it.hasNext()) {
- FooService svc = (FooService) it.next();
- result = result && svc.foo();
- }
- }
- return result;
- }
-
- public Properties getProps() {
- Iterator it = fs.iterator();
- if (it.hasNext()) {
- FooService svc = (FooService) it.next();
- return svc.fooProps();
- }
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java
deleted file mode 100644
index b8c1d28ccf..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.temporal.components;
-
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class FooProvider implements FooService {
-
- public boolean foo() {
- return true;
- }
-
- public Properties fooProps() {
- return null;
- }
-
- public boolean getBoolean() {
- return false;
- }
-
- public double getDouble() {
- return 0;
- }
-
- public int getInt() {
- return 0;
- }
-
- public long getLong() {
- return 0;
- }
-
- public Boolean getObject() {
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java
deleted file mode 100644
index 9affa3f403..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.temporal.components;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class MultipleCheckServiceProvider implements CheckService {
-
- /**
- * Temporal dependency.
- */
- private FooService[] fs;
-
- public boolean check() {
- boolean result = true;
- //Use a local variable to avoid to wait at each access.
- FooService[] array = fs;
- for (int i = 0; array != null && i < array.length; i++) {
- result = result && array[i].foo();
- System.out.println("Result : " + result);
- }
- return result;
- }
-
- public Properties getProps() {
- return fs[0].fooProps();
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java
deleted file mode 100644
index be4d452edd..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.temporal.components;
-
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class NullableFooProvider implements FooService {
-
- public boolean foo() {
- return false;
- }
-
- public Properties fooProps() {
- return null;
- }
-
- public boolean getBoolean() {
- return false;
- }
-
- public double getDouble() {
- return -1;
- }
-
- public int getInt() {
- return -1;
- }
-
- public long getLong() {
- return -1;
- }
-
- public Boolean getObject() {
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java
deleted file mode 100755
index 0a91fbfcaa..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.temporal.components.proxy;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class CheckServiceProviderHelper implements CheckService {
-
- /**
- * injected dependency.
- */
- private FooService fs;
-
- public CheckServiceProviderHelper(FooService svc) {
- fs = svc;
- }
-
- public boolean check() {
- if (fs != null) { // Cannot be null
- try {
- return fs.foo();
- } catch (RuntimeException e) { // Now it's a runtime exception (FELIX-2472)
- // Can throw a RTE for null policy and for time out
- if (e.getMessage().equals("No service available")) {
- // Has detected a null policy.
- System.out.println(e.getMessage());
- return false;
- } else {
- // Timeout
- // Propagate the exception
- throw e;
- }
- }
- }
- return false;
- }
-
- public Properties getProps() {
- if (fs != null) {
- return fs.fooProps();
- }
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java
deleted file mode 100644
index ad0a7d0513..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.temporal.components.proxy;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Properties;
-
-public class CollectionCheckServiceProviderHelper implements CheckService {
-
- /**
- * Injected dependency.
- */
- private Collection fs;
-
- public CollectionCheckServiceProviderHelper(Collection col) {
- fs = col;
- }
-
- public boolean check() {
- boolean result = true;
- //Use a local variable to avoid to wait at each access.
- Collection col = fs;
- if (col != null) {
- Iterator it = col.iterator(); // Get the cached copy
- while (it != null && it.hasNext()) {
- FooService svc = (FooService) it.next();
- result = result && svc.foo();
- }
- }
- return result;
- }
-
- public Properties getProps() {
- Iterator it = fs.iterator();
- if (it.hasNext()) {
- FooService svc = (FooService) it.next();
- return svc.fooProps();
- }
- return null;
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java
deleted file mode 100755
index dcd8240a43..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.temporal.components.proxy;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-
-import java.util.Properties;
-
-public class HelpedCheckServiceProvider implements CheckService {
-
- /**
- * Temporal dependency.
- */
- private FooService fs;
-
- private CheckServiceProviderHelper helper = new CheckServiceProviderHelper(fs);
-
- public boolean check() {
- return helper.check();
- }
-
- public Properties getProps() {
- return helper.getProps();
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java
deleted file mode 100644
index 4d409170e1..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.temporal.components.proxy;
-
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-
-import java.util.Collection;
-import java.util.Properties;
-
-public class HelpedCollectionCheckServiceProvider implements CheckService {
-
- /**
- * Temporal dependency.
- */
- private Collection fs;
-
- private CollectionCheckServiceProviderHelper helper = new CollectionCheckServiceProviderHelper(fs);
-
- public boolean check() {
- return helper.check();
- }
-
- public Properties getProps() {
- return helper.getProps();
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java
deleted file mode 100644
index a1ff6199c8..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.temporal.services;
-
-import java.util.Properties;
-
-public interface BarService {
-
- public boolean bar();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java
deleted file mode 100644
index abc918a4f3..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.temporal.services;
-
-import java.util.Properties;
-
-public interface CheckService {
-
- public static final String foo = "foo";
-
- public boolean check();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java
deleted file mode 100644
index a0cd10eb30..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.temporal.services;
-
-public interface ChildInterface extends ParentInterface1, ParentInterface2 {
-
- public void processChild();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java
deleted file mode 100644
index 91c34375ab..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.temporal.services;
-
-import java.util.Properties;
-
-public interface FooService {
-
- boolean foo();
-
- Properties fooProps();
-
- Boolean getObject();
-
- boolean getBoolean();
-
- int getInt();
-
- long getLong();
-
- double getDouble();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java
deleted file mode 100644
index b7e45fe540..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.temporal.services;
-
-public interface ParentInterface1 extends ParentParentInterface {
-
- public void processParent1();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java
deleted file mode 100644
index fd9af2fc6d..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.temporal.services;
-
-public interface ParentInterface2 {
-
- public void processParent2();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java
deleted file mode 100644
index aa00405f96..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.temporal.services;
-
-public interface ParentParentInterface {
-
- public void processParentParent();
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml
deleted file mode 100644
index 620fee80e7..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java
deleted file mode 100644
index a6b32afbc2..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.ops4j.pax.exam.Option;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-
-/**
- * Bootstrap the test from this project
- */
-public class Common extends BaseTest {
-
- @Override
- protected Option[] getCustomOptions() {
- return new Option[]{
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.temporal")
- .versionAsInProject()
- };
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java
deleted file mode 100644
index 42bc9b3f59..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class DefaultImplementationTest extends Common {
-
- @Test
- public void testDefaultImplementation() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDefaultImplementationWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDefaultImplementationTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDefaultImplementationTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDefaultImplementationMultipleTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDefaultImplementationCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDefaultImplementationProxiedCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnProxiedCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java
deleted file mode 100644
index 0c15b652c0..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class DelayTest extends Common {
-
- @Test
- public void testDelay() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- assertNull("No FooService", osgiHelper.getServiceReference(FooService.class.getName(), null));
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay (" + (end - begin) + ")", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 4000);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 4000);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testDelayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testSetTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testSetTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnProxiedCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java
deleted file mode 100644
index ba65c0a539..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-
-public class DelayedProvider implements Runnable {
-
-
- public static final long DELAY = 1000;
- ComponentInstance instance;
- long delay = DELAY;
- Thread thread;
-
- public DelayedProvider(ComponentInstance ci) {
- instance =ci;
- }
-
- public DelayedProvider(ComponentInstance ci, long time) {
- instance =ci;
- delay = time;
- }
-
- public void start() {
- thread = new Thread(this);
- thread.start();
- }
-
- public void stop() {
- if (thread != null) {
- thread.interrupt();
- }
- }
-
- public void run() {
- System.out.println("Start sleeping for " + delay);
- long begin = System.currentTimeMillis();
- try {
- Thread.sleep(delay);
- long end = System.currentTimeMillis();
- if (end - begin < delay) {
- // Wait for the remaining time
- Thread.sleep(delay - (end - begin));
- }
- } catch (InterruptedException e) {
- System.out.println("Interrupted ...");
- return;
- }
- System.out.println("Wakeup");
- thread = null;
- instance.start();
- System.out.println(instance.getInstanceName() + " started");
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java
deleted file mode 100755
index 1d3303472f..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class EmptyTest extends Common {
-
- @Test
- public void testEmptyArrayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("An empty array was expected ...");
- }
- assertTrue("Check empty array", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testEmptyCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("An empty array was expected ...");
- }
- assertTrue("Check empty array", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testEmptyProxiedCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("An empty array was expected ...");
- }
- assertTrue("Check empty array", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyMultipleCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnProxiedCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyProxiedColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java
deleted file mode 100644
index ddbc70a2e5..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Checks requires.filter, temporal.filter, temporal.from and
- * requires.from attributes.
- */
-public class FilterTest extends Common {
-
- /**
- * Checks temporal.filter with dependency id.
- * The filter is made to get only one provider.
- */
- @Test
- public void testWithTemporalFilters() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-
- Dictionary configuration = new Hashtable();
- String un = "under-1";
- configuration.put("instance.name", un);
- Dictionary filter = new Hashtable();
- filter.put("foo", "(instance.name=provider2)");
- configuration.put("temporal.filters", filter);
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider",
- configuration);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- /**
- * Checks requires.filter with dependency id.
- * The filter is made to get only one provider.
- */
- @Test
- public void testWithRequireFilters() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-
- Dictionary configuration = new Hashtable();
- String un = "under-1";
- configuration.put("instance.name", un);
- Dictionary filter = new Hashtable();
- filter.put("foo", "(instance.name=provider2)");
- configuration.put("requires.filters", filter);
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- /**
- * Checks temporal.from with dependency id.
- * The filter is made to get only one specific provider.
- */
- @Test
- public void testWithTemporalFrom() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-
- Dictionary configuration = new Hashtable();
- String un = "under-1";
- configuration.put("instance.name", un);
- Dictionary filter = new Hashtable();
- filter.put("foo", "provider2");
- configuration.put("temporal.from", filter);
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- /**
- * Checks requires.from with dependency id.
- * The filter is made to get only one specific provider.
- */
- @Test
- public void testWithRequiresFrom() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
-
- Dictionary configuration = new Hashtable();
- String un = "under-1";
- configuration.put("instance.name", un);
- Dictionary filter = new Hashtable();
- filter.put("foo", "provider2");
- configuration.put("requires.from", filter);
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider1.stop();
- provider2.stop();
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java
deleted file mode 100644
index 600de6c99b..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class NoDelayTest extends Common {
-
- @Test
- public void testNoDelay() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un);
- assertNotNull("Check creation", under);
- assertNotNull("Check provider creation", prov);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNoDelayWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un);
- assertNotNull("Check creation", under);
- assertNotNull("Check provider creation", prov);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testMultipleNoDelay() {
- String prov1 = "provider-1";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1);
- String un = "under-2";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- provider1.stop();
- provider1.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testCollectionNoDelay() {
- String prov1 = "provider-1";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1);
- String un = "under-2";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- provider1.stop();
- provider1.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testProxiedCollectionNoDelay() {
- String prov1 = "provider-1";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1);
- String un = "under-2";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedColCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- provider1.stop();
- provider1.dispose();
- under.stop();
- under.dispose();
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java
deleted file mode 100644
index 289ed35a42..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class NullTest extends Common {
-
- @Test
- public void testNull() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A null was expected ...");
- }
- assertFalse("Check null", res); // Return false when the foo service is null.
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A null was expected ...");
- }
- assertFalse("Check null", res); // Return false when the foo service is null.
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullMultipleTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A null was expected ...");
- }
- assertTrue("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testNullCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A null was expected ...");
- }
- assertTrue("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testNullProxiedCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A null was expected ... : " + e.getMessage());
- e.printStackTrace();
- }
- assertTrue("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnProxiedCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java
deleted file mode 100644
index ca3c1d2e56..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class NullableTest extends Common {
-
- @Test
- public void testNullable() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullableTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullableWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullableTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testNullableMultipleTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testNullableCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testNullableProxiedCollectionTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- boolean res = false;
- try {
- res = cs.check();
- } catch (RuntimeException e) {
- fail("A nullable was expected ...");
- }
- assertFalse("Check nullable", res);
-
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- @Test
- public void testDelayOnMultipleDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayOnProxiedCollectionDependency() {
- String prov = "provider";
- ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String prov2 = "provider2";
- ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the providers.
- provider1.stop();
- provider2.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider1, 1500);
- DelayedProvider dp2 = new DelayedProvider(provider2, 100);
- dp.start();
- dp2.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
- System.out.println("delay = " + (end - begin));
- assertTrue("Assert min delay", (end - begin) >= 100);
- assertTrue("Assert max delay", (end - begin) <= 1000);
- dp.stop();
- dp2.stop();
-
- provider1.stop();
- provider2.stop();
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method.
-
- provider1.dispose();
- provider2.dispose();
- under.stop();
- under.dispose();
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java
deleted file mode 100644
index 87d6acf854..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * 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.temporal.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.temporal.services.CheckService;
-import org.apache.felix.ipojo.handler.temporal.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import static org.junit.Assert.*;
-
-public class TemporalTest extends Common {
-
- @Test
- public void testDelay() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- assertNull("No FooService", osgiHelper.getServiceReference(FooService.class.getName(), null));
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
-
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay (" + (end - begin) + ")", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 4000);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 4000);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testDelayTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testDelayTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- long begin = System.currentTimeMillis();
- DelayedProvider dp = new DelayedProvider(provider, 200);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 2", cs.check());
- long end = System.currentTimeMillis();
-
- assertTrue("Assert delay", (end - begin) >= 200);
-
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 3", ref_cs);
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation - 3", cs.check());
-
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- }
-
- @Test
- public void testSetTimeout() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-
- @Test
- public void testSetTimeoutWithProxy() {
- String prov = "provider";
- ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov);
- String un = "under-1";
- ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un);
-
- ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov);
- assertNotNull("Check foo availability", ref_fs);
-
- ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability", ref_cs);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- assertTrue("Check invocation", cs.check());
-
- // Stop the provider.
- provider.stop();
- ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un);
- assertNotNull("Check cs availability - 2", ref_cs);
- DelayedProvider dp = new DelayedProvider(provider, 400);
- dp.start();
- cs = (CheckService) osgiHelper.getServiceObject(ref_cs);
- try {
- cs.check();
- } catch (RuntimeException e) {
- // OK
- dp.stop();
- provider.stop();
- provider.dispose();
- under.stop();
- under.dispose();
- return;
- }
-
- fail("Timeout expected");
- }
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/temporal-dependency-handler-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt b/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt
deleted file mode 100644
index ce0f55b986..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Changes from the 1.6.2 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2438] - Temporal dependencies should use proxies by default
-
-** Improvement
- * [FELIX-2666] - Rename the temporal handler annotation to avoid collision
-
-Changes from the 1.6.0 to 1.6.2
--------------------------------
-** Improvement
- * [FELIX-2472] - Proxies should throw a runtime exception instead of a null point exception
-
-Changes from the 1.4.2 to 1.6.0
--------------------------------
-** Improvement
- * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-855] - Collection support in iPOJO Temporal Dependencies
- * [FELIX-860] - Temporal Dependency Proxy injection
-
-Changes from 0.8.1 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-625] - Temporal Dependency improvements (onTimeout policies)
- * [FELIX-673] - Provide OBR description to iPOJO bundles
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-
-Version 0.8.1
--------------
- * Initial release
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/obr.xml b/ipojo/handler/temporal/temporal-dependency-handler/obr.xml
deleted file mode 100644
index ef50806032..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/obr.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler/pom.xml
deleted file mode 100644
index 166ea07fe7..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../../pom/pom.xml
-
- 4.0.0
- bundle
- org.apache.felix.ipojo.handler.temporal
- 1.7.0-SNAPSHOT
- Apache Felix iPOJO Temporal Service Dependency Handler
-
-
- iPOJO extension to inject temporal service dependencies.
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/temporal-service-dependency.html
-
-
-
-
- org.osgi
- org.osgi.core
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.10.1
-
-
- org.ow2.asm
- asm-all
- 5.0.2
-
-
- org.ow2.asm
- asm-tree
-
-
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.7
- true
-
-
-
- org.apache.felix.ipojo.handler.temporal;-split-package:=merge-first,
- org.objectweb.asm;-split-package:=merge-last
-
- ${project.name}
- ${project.artifactId}
-
- org.apache.felix.ipojo;version=1.10.0,
- !org.objectweb.asm.tree, *
-
- The Apache Software Foundation
- iPOJO Temporal Dependency Handler
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/temporal-service-dependency.html
-
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.10.1
-
-
-
- ipojo-bundle
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index f76ce776e5..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,17 +0,0 @@
-I. Included Third-Party Software
-
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
-- BSD License
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE
deleted file mode 100644
index c45a1e75aa..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-APACHE FELIX iPOJO Temporal Handler:
-
-The Apache Felix iPOJO Temporal Handler includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-
-For the ASM component:
-
-Copyright (c) 2000-2005 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 6f2e68f9d5..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1,4 +0,0 @@
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java
deleted file mode 100644
index a3fcd69aa6..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.temporal;
-
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.Type;
-
-/**
- * Generates proxy class delegating operation invocations thanks to a
- * a temporal dependency.
- * @author Felix Project Team
- */
-public class ProxyGenerator implements Opcodes {
-
- /**
- * The temporal dependency name.
- */
- private static final String DEPENDENCY = "m_dependency";
-
- /**
- * The Temporal Dependency descriptor.
- */
- private static final String DEPENDENCY_DESC = Type.getDescriptor(TemporalDependency.class);
-
- /**
- * Temporal dependency internal class name.
- */
- private static final String TEMPORAL_DEPENDENCY = "org/apache/felix/ipojo/handler/temporal/TemporalDependency";
-
- /**
- * Gets the internal names of the given class objects.
- * @param classes the classes
- * @return the array containing internal names of the given class array.
- */
- private static String[] getInternalClassNames(Class[] classes) {
- final String[] names = new String[classes.length];
- for (int i = 0; i < names.length; i++) {
- names[i] = Type.getInternalName(classes[i]);
- }
- return names;
- }
-
- /**
- * Generates a proxy class.
- * @param spec the proxied service specification
- * @return the byte[] for the generated proxy class.
- */
- public static byte[] dumpProxy(Class spec) {
- ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- String internalClassName = Type.getInternalName(spec); // Specification class internal name.
- String[] itfs = new String[] {internalClassName}; // Implemented interface.
- String className = internalClassName + "$$Proxy"; // Unique name.
- Method[] methods = spec.getMethods(); // Method to delegate
-
- cw.visit(Opcodes.V1_3, Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, className, null, "java/lang/Object", itfs);
- addDependencyField(cw);
- generateConstructor(cw, className);
-
- // For each method, create the delegator code.
- for (int i = 0; i < methods.length; i++) {
- if ((methods[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) {
- generateDelegator(cw, methods[i], className, internalClassName);
- }
- }
-
- cw.visitEnd();
-
- return cw.toByteArray();
-
- }
-
- /**
- * Generates a delegated method.
- * @param cw the class writer
- * @param method the method object to delegate
- * @param className the generated class name
- * @param itfName the internal specification class name
- */
- private static void generateDelegator(ClassWriter cw, Method method,
- String className, String itfName) {
- String methodName = method.getName();
- String desc = Type.getMethodDescriptor(method);
- String[] exceptions = getInternalClassNames(method.getExceptionTypes());
- int modifiers = method.getModifiers()
- & ~(Modifier.ABSTRACT | Modifier.NATIVE | Modifier.SYNCHRONIZED);
- Type[] types = Type.getArgumentTypes(method);
-
- int freeRoom = 1;
- for (int t = 0; t < types.length; t++) {
- freeRoom = freeRoom + types[t].getSize();
- }
-
- MethodVisitor mv = cw.visitMethod(modifiers, methodName, desc, null,
- exceptions);
- mv.visitCode();
-
- mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, className, DEPENDENCY, DEPENDENCY_DESC); // The temporal dependency is on the stack.
- mv.visitMethodInsn(INVOKEVIRTUAL, TEMPORAL_DEPENDENCY, "getService", // Call getService
- "()Ljava/lang/Object;"); // The service object is on the stack.
- int varSvc = freeRoom;
- freeRoom = freeRoom + 1; // Object Reference.
- mv.visitVarInsn(ASTORE, varSvc); // Store the service object.
-
- // Invoke the method on the service object.
- mv.visitVarInsn(ALOAD, varSvc);
- // Push argument on the stack.
- int i = 1; // Arguments. (non static method)
- for (int t = 0; t < types.length; t++) {
- mv.visitVarInsn(types[t].getOpcode(ILOAD), i);
- i = i + types[t].getSize();
- }
- // Invocation
- mv.visitMethodInsn(INVOKEINTERFACE, itfName, methodName, desc);
-
- // Return the result
- Type returnType = Type.getReturnType(desc);
- if (returnType.getSort() != Type.VOID) {
- mv.visitInsn(returnType.getOpcode(IRETURN));
- } else {
- mv.visitInsn(RETURN);
- }
-
- // End of the method.
- mv.visitMaxs(0, 0);
- mv.visitEnd();
- }
-
- /**
- * Generates the constructors. The constructor receives a temporal dependency
- * and set the {@link ProxyGenerator#DEPENDENCY} field.
- * @param cw the class writer
- * @param className the generated class name.
- */
- private static void generateConstructor(ClassWriter cw, String className) {
- MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "", '(' + DEPENDENCY_DESC + ")V", null, null);
- mv.visitCode();
-
- mv.visitVarInsn(ALOAD, 0); // Load this
- mv.visitInsn(DUP); // Dup
- mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V"); // Call super
- mv.visitVarInsn(ALOAD, 1); // Load the argument
- mv.visitFieldInsn(PUTFIELD, className, DEPENDENCY, DEPENDENCY_DESC); // Assign the dependency field
- mv.visitInsn(RETURN); // Return void
-
- mv.visitMaxs(0, 0);
- mv.visitEnd();
- }
-
- /**
- * Adds the temporal dependency field {@link ProxyGenerator#DEPENDENCY}.
- * @param cw the class writer
- */
- private static void addDependencyField(ClassWriter cw) {
- cw.visitField(Opcodes.ACC_FINAL, DEPENDENCY, DEPENDENCY_DESC, null, null);
- cw.visitEnd();
- }
-
-
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java
deleted file mode 100644
index 3369b59a28..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * 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.temporal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.osgi.framework.ServiceReference;
-
-/**
-* Maintains a service object collection.
-* This collection wrap the temporal dependency to be accessible from a
-* {@link Collection}, that can be passed to helper objects (Collaborators).
-*
-* The onTimeout policies are executed when the {@link Collection#iterator()},
-* {@link Collection#toArray(Object[])} and {@link Collection#toArray()} methods
-* are called.
-*
-* The {@link Collection#iterator()} method returns an {@link Iterator} iterating
-* on a cached copy of available service objects. In the case that there are no
-* available services when the timeout is reached, the policies act as follows:
-*
-*
'null' returns a null iterator
-*
'nullable' and default-implementation returns an iterator iterating on one object (the
-* nullable or default-implementation object
-*
'empty' returns an empty iterator.
-*
'no policy' throws runtime exception
-*
-* @author Felix Project Team
-*/
-public class ServiceCollection implements Collection {
-
- /**
- * The wrapped temporal dependencies.
- */
- private TemporalDependency m_dependency;
-
- /**
- * Creates a Service Collection.
- * @param dep the wrapped temporal dependencies
- */
- public ServiceCollection(TemporalDependency dep) {
- m_dependency = dep;
- }
-
- /**
- * Unsupported method.
- * @param o an object
- * @return N/A
- * @see java.util.Collection#add(java.lang.Object)
- */
- public boolean add(Object o) {
- throw new UnsupportedOperationException("Cannot add elements inside this collection");
- }
-
- /**
- * Unsupported method.
- * @param c an object
- * @return N/A
- * @see java.util.Collection#addAll(java.util.Collection)
- */
- public boolean addAll(Collection c) {
- throw new UnsupportedOperationException("Cannot add elements inside this collection");
- }
-
- /**
- * Unsupported method.
- * @see java.util.Collection#clear()
- */
- public void clear() {
- throw new UnsupportedOperationException("Cannot remove elements from this collection");
- }
-
- /**
- * Checks if the wrapped temporal dependencies has always access to the
- * given service object.The method allows knowing if the provider returning the
- * service object has leaved.
- * @param o the service object
- * @return true if the object is still available,
- * false otherwise.
- * @see java.util.Collection#contains(java.lang.Object)
- */
- public boolean contains(Object o) {
- return getAvailableObjects().contains(o);
- }
-
- /**
- * Checks if the wrapped temporal dependencies has always access to the
- * given service objects.The method allows knowing if providers returning the
- * service objects have leaved.
- * @param c the set of service object
- * @return true if the objects are still available,
- * false otherwise.
- * @see java.util.Collection#contains(java.lang.Object)
- */
- public boolean containsAll(Collection c) {
- return getAvailableObjects().containsAll(c);
- }
-
- /**
- * Checks if at least one provider matching with the dependency
- * is available.
- * @return true if one provider or more satisfying the
- * dependency are available. Otherwise, returns false
- * @see java.util.Collection#isEmpty()
- */
- public boolean isEmpty() {
- return m_dependency.getSize() == 0;
- }
-
- /**
- * Helper method creating a list of available service objects.
- * @return the list of available service objects.
- */
- private List getAvailableObjects() {
- List list = new ArrayList();
- ServiceReference[] refs = m_dependency.getServiceReferences();
- if (refs != null) {
- for (int i = 0; i < refs.length; i++) {
- list.add(m_dependency.getService(refs[i]));
- }
- }
- return list;
- }
-
- /**
- * Gets an iterator on the actual list of available service objects.
- * This method applies on timeout policies is no services are
- * available after the timeout.
- * The returned iterator iterates on a cached copy of the service
- * objects.
- * @return a iterator giving access to service objects.
- * @see java.util.Collection#iterator()
- */
- public Iterator iterator() {
- ServiceReference[] refs = m_dependency.getServiceReferences();
- if (refs != null) {
- // Immediate return.
- return new ServiceIterator(refs); // Create the service iterator with the service reference list.
- } else {
- // Begin to wait ...
- long enter = System.currentTimeMillis();
- boolean exhausted = false;
- synchronized (this) {
- while (m_dependency.getServiceReference() == null && !exhausted) {
- try {
- wait(1);
- } catch (InterruptedException e) {
- // We was interrupted ....
- } finally {
- long end = System.currentTimeMillis();
- exhausted = (end - enter) > m_dependency.getTimeout();
- }
- }
- }
- // Check
- if (exhausted) {
- Object oto = m_dependency.onTimeout(); // Throws the RuntimeException
- if (oto == null) { // If null, return null
- return null;
- } else {
- // oto is an instance of collection containing either empty or with only one element
- return new ServiceIterator((Collection) oto);
- }
- } else {
- refs = m_dependency.getServiceReferences();
- return new ServiceIterator(refs);
- }
- }
-
-
- }
-
- /**
- * Unsupported method.
- * @param o a object
- * @return N/A
- * @see java.util.Collection#remove(java.lang.Object)
- */
- public boolean remove(Object o) {
- throw new UnsupportedOperationException("Cannot remove elements from this collection");
- }
-
- /**
- * Unsupported method.
- * @param c a set of objects
- * @return N/A
- * @see java.util.Collection#removeAll(java.util.Collection)
- */
- public boolean removeAll(Collection c) {
- throw new UnsupportedOperationException("Cannot remove elements from this collection");
- }
-
- /**
- *Unsupported method.
- * @param c a set of objects
- * @return N/A
- * @see java.util.Collection#retainAll(java.util.Collection)
- */
- public boolean retainAll(Collection c) {
- throw new UnsupportedOperationException("Cannot remove elements from this collection");
- }
-
- /**
- * Gets the number of available providers.
- * @return the number of matching service providers.
- * @see java.util.Collection#size()
- */
- public int size() {
- return m_dependency.getSize();
- }
-
- /**
- * Returns an array containing available service objects.
- * This method executed on timeout policies if no matching
- * providers when the timeout is reached.
- * @return a array containing available service objects.
- * depending on the timeout policy, this array can also be null,
- * be empty, or can contain only one element (a default-implementation
- * object, or a nullable object).
- * @see java.util.Collection#toArray()
- */
- public Object[] toArray() {
- return toArray(new Object[0]);
- }
-
- /**
- * Returns an array containing available service objects.
- * This method executed on timeout policies if no matching
- * providers when the timeout is reached.
- * @param a the array into which the elements of this collection
- * are to be stored, if it is big enough; otherwise, a new array
- * of the same runtime type is allocated for this purpose.
- * @return a array containing available service objects.
- * depending on the timeout policy, this array can also be null,
- * be empty, or can contain only one element (a default-implementation
- * object, or a nullable object).
- * @see java.util.Collection#toArray(java.lang.Object[])
- */
- public Object[] toArray(Object[] a) {
- Iterator it = iterator(); // Can throw an exception.
- if (it == null) {
- return null;
- }
- // Else we get an iterator.
- List list = new ArrayList(size());
- while (it.hasNext()) {
- list.add(it.next());
- }
- return list.toArray(a);
- }
-
- /**
- * Iterator on a set of service objects.
- * This iterator iterates on a cached copy of service objects.
- */
- private final class ServiceIterator implements Iterator {
-
- /**
- * Underlying iterator.
- */
- private Iterator m_iterator;
-
- /**
- * Creates a Service Iterator iterating
- * on the given set of providers.
- * @param refs the available service providers
- */
- private ServiceIterator(ServiceReference[] refs) {
- List objects = new ArrayList(refs.length);
- for (int i = 0; i < refs.length; i++) {
- objects.add(m_dependency.getService(refs[i]));
- }
- m_iterator = objects.iterator();
- }
-
- /**
- * Creates a Service Iterator iterating
- * on service object contained in the given
- * collection.
- * @param col a collection containing service objects.
- */
- private ServiceIterator(Collection col) {
- m_iterator = col.iterator();
- }
-
- /**
- * Returns true if the iteration has
- * more service objects.
- * @return true if the iterator has more elements.
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return m_iterator.hasNext();
- }
-
- /**
- * Returns the next service objects in the iteration.
- * @return the next service object in the iteration.
- * @see java.util.Iterator#next()
- */
- public Object next() {
- return m_iterator.next();
- }
-
- /**
- * Unsupported operation.
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java
deleted file mode 100644
index 70184c9fa0..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.temporal;
-
-
-/**
- * Object managing thread local copy of required services.
- *
- * @author Felix Project Team
- */
-public class ServiceUsage extends ThreadLocal {
-
- /**
- * Structure contained in the Thread Local.
- */
- public static class Usage {
-
- /**
- * Stack Size.
- */
- int m_stack = 0;
- /**
- * Object to inject.
- */
- Object m_object;
-
- /**
- * Increment the stack level.
- */
- public void inc() {
- m_stack++;
- }
-
- /**
- * Decrement the stack level.
- * @return true if the stack is 0 after the decrement.
- */
- public boolean dec() {
- m_stack--;
- return m_stack == 0;
- }
-
- /**
- * Clear the service object array.
- */
- public void clear() {
- m_object = null;
- }
-
- }
-
- /**
- * Initialize the cached object.
- * @return an empty Usage object.
- * @see java.lang.ThreadLocal#initialValue()
- */
- public Object initialValue() {
- return new Usage();
- }
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
deleted file mode 100644
index 49ea111bc8..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * 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.temporal;
-
-import java.lang.reflect.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.felix.ipojo.FieldInterceptor;
-import org.apache.felix.ipojo.MethodInterceptor;
-import org.apache.felix.ipojo.Nullable;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.handler.temporal.ServiceUsage.Usage;
-import org.apache.felix.ipojo.handlers.dependency.NullableObject;
-import org.apache.felix.ipojo.util.DependencyModel;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Temporal dependency. A temporal dependency waits (block) for the availability
- * of the service. If no provider arrives in the specified among of time, a
- * runtime exception is thrown.
- * @author Felix Project Team
- */
-public class TemporalDependency extends DependencyModel implements
- FieldInterceptor, MethodInterceptor {
-
- /**
- * The timeout.
- */
- private long m_timeout;
-
- /**
- * The default implementation.
- */
- private String m_di;
-
- /**
- * The {@link Nullable} object or Default-Implementation instance if used.
- */
- private Object m_nullableObject;
-
- /**
- * The handler managing this dependency.
- */
- private PrimitiveHandler m_handler;
-
- /**
- * The timeout policy. Null injects null, {@link Nullable} injects a nullable object or
- * an array with a nullable object, Default-Implementation injects an object
- * created from the specified injected implementation or an array with it
- * Empty array inject an empty array (must be an aggregate dependency) No
- * policy (0) throw a runtime exception when the timeout occurs *
- */
- private int m_policy;
-
- /**
- * The dependency is injected as a collection.
- * The field must be of the {@link Collection} type
- */
- private boolean m_collection;
-
- /**
- * Enables the proxy mode.
- */
- private boolean m_proxy;
-
- /**
- * Service Usage (Thread Local).
- */
- private ServiceUsage m_usage;
-
- /**
- * The proxy object.
- * This field is used for scalar proxied temporal dependency.
- */
- private Object m_proxyObject;
-
-
- /**
- * Creates a temporal dependency.
- * @param spec the service specification
- * @param agg is the dependency aggregate ?
- * @param collection the dependency field is a collection
- * @param proxy enable the proxy-mode
- * @param filter the LDAP filter
- * @param context service context
- * @param timeout timeout
- * @param handler Handler managing this dependency
- * @param defaultImpl class used as default-implementation
- * @param policy onTimeout policy
- */
- public TemporalDependency(Class spec, boolean agg, boolean collection, boolean proxy, Filter filter,
- BundleContext context, long timeout, int policy,
- String defaultImpl, TemporalHandler handler) {
- super(spec, agg, true, filter, null,
- DependencyModel.DYNAMIC_BINDING_POLICY, context, handler, handler.getInstanceManager());
- m_di = defaultImpl;
- m_policy = policy;
- m_timeout = timeout;
- m_handler = handler;
- m_collection = collection;
- m_proxy = proxy;
- if (! proxy) { // No proxy => initialize the Thread local.
- m_usage = new ServiceUsage();
- } else if (proxy && ! agg) { // Scalar proxy => Create the proxy.
- ProxyFactory proxyFactory = new ProxyFactory(this.getClass().getClassLoader());
- m_proxyObject = proxyFactory.getProxy(getSpecification(), this);
- }
- }
-
- /**
- * The dependency has been reconfigured.
- * @param arg0 new service references
- * @param arg1 old service references
- * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[],
- * org.osgi.framework.ServiceReference[])
- */
- public void onDependencyReconfiguration(ServiceReference[] arg0,
- ServiceReference[] arg1) {
- throw new UnsupportedOperationException(
- "Reconfiguration not yet supported");
- }
-
- /**
- * A provider arrives.
- * @param ref service reference of the new provider.
- * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference)
- */
- public synchronized void onServiceArrival(ServiceReference ref) {
- // Notify if a thread is waiting.
- notifyAll();
- }
-
- /**
- * A provider leaves.
- * @param arg0 leaving service references.
- * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)
- */
- public void onServiceDeparture(ServiceReference arg0) { }
-
- /**
- * A provider is modified.
- * @param arg0 leaving service references.
- * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference)
- */
- public void onServiceModification(ServiceReference arg0) { }
-
- /**
- * The code require a value of the monitored field. If providers are
- * available, the method return service object(s) immediately. Else, the
- * thread is blocked until an arrival. If no provider arrives during the
- * among of time specified, the method throws a Runtime Exception.
- * @param arg0 POJO instance asking for the service
- * @param arg1 field name
- * @param arg2 previous value
- * @return the object to inject.
- * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public synchronized Object onGet(Object arg0, String arg1, Object arg2) {
- // Check if the Thread local as a value
- if (! m_proxy) {
- Usage usage = (Usage) m_usage.get();
- if (usage.m_stack > 0) {
- return usage.m_object;
- }
- }
-
- ServiceReference[] refs = getServiceReferences();
- if (refs != null) {
- // Immediate return.
- return getServiceObjects(refs);
- } else {
- // Begin to wait ...
- long enter = System.currentTimeMillis();
- boolean exhausted = false;
- synchronized (this) {
- while (getServiceReference() == null && !exhausted) {
- try {
- wait(1);
- } catch (InterruptedException e) {
- // We was interrupted ....
- } finally {
- long end = System.currentTimeMillis();
- exhausted = (end - enter) > m_timeout;
- }
- }
- }
- // Check
- if (exhausted) {
- return onTimeout();
- } else {
- refs = getServiceReferences();
- return getServiceObjects(refs);
- }
- }
- }
-
- /**
- * A POJO method will be invoked.
- * @param pojo : Pojo object
- * @param method : called method
- * @param args : arguments
- * @see org.apache.felix.ipojo.MethodInterceptor#onEntry(java.lang.Object, java.lang.reflect.Member, java.lang.Object[])
- */
- public void onEntry(Object pojo, Member method, Object[] args) {
- if (m_usage != null) {
- Usage usage = (Usage) m_usage.get();
- if (usage.m_stack > 0) {
- usage.inc();
- m_usage.set(usage); // Set the Thread local as value has been modified
- }
- }
- }
-
- /**
- * A POJO method has thrown an error.
- * This method does nothing and wait for the finally.
- * @param pojo : POJO object.
- * @param method : Method object.
- * @param throwable : thrown error
- * @see org.apache.felix.ipojo.MethodInterceptor#onError(java.lang.Object, java.lang.reflect.Member, java.lang.Throwable)
- */
- public void onError(Object pojo, Member method, Throwable throwable) {
- // Nothing to do : wait onFinally
- }
-
- /**
- * A POJO method has returned.
- * @param pojo : POJO object.
- * @param member : Method object.
- * @param returnedObj : returned object (null for void method)
- * @see org.apache.felix.ipojo.MethodInterceptor#onExit(java.lang.Object, java.lang.reflect.Member, java.lang.Object)
- */
- public void onExit(Object pojo, Member member, Object returnedObj) {
- // Nothing to do : wait onFinally
- }
-
- /**
- * A POJO method is finished.
- * @param pojo : POJO object.
- * @param method : Method object.
- * @see org.apache.felix.ipojo.MethodInterceptor#onFinally(java.lang.Object, java.lang.reflect.Member)
- */
- public void onFinally(Object pojo, Member method) {
- if (m_usage != null) {
- Usage usage = (Usage) m_usage.get();
- if (usage.m_stack > 0) {
- if (usage.dec()) {
- // Exit the method flow => Release all objects
- usage.clear();
- m_usage.set(usage); // Set the Thread local as value has been modified
- }
- }
- }
- }
-
- /**
- * Creates and returns object to inject in the dependency.
- * This method handles aggregate, collection and proxy cases.
- * @param refs the available service references
- * @return the object to inject. Can be a 'simple' object, a proxy,
- * a collection or an array.
- */
- private Object getServiceObjects(ServiceReference [] refs) {
- if (m_proxy) {
- if (m_proxyObject == null) { // Not aggregate.
- return new ServiceCollection(this);
- } else {
- return m_proxyObject;
- }
- } else {
- // Initialize the thread local object is not already touched.
- Usage usage = (Usage) m_usage.get();
- if (usage.m_stack == 0) { // uninitialized usage.
- if (isAggregate()) {
- if (m_collection) {
- Collection svc = new ArrayList(refs.length); // Use an array list as collection implementation.
- for (int i = 0; i < refs.length; i++) {
- svc.add(getService(refs[i]));
- }
- usage.m_object = svc;
- } else {
- Object[] svc = (Object[]) Array.newInstance(getSpecification(),
- refs.length);
- for (int i = 0; i < svc.length; i++) {
- svc[i] = getService(refs[i]);
- }
- usage.m_object = svc;
- }
- } else {
- usage.m_object = getService(refs[0]);
- }
- usage.inc(); // Start the caching, so set the stack level to 1
- m_usage.set(usage);
- }
- return usage.m_object;
- }
-
- }
-
- /**
- * Called by the proxy to get a service object to delegate a method.
- * This methods manages the waited time and on timeout policies.
- * @return a service object or a nullable/default-implmentation object.
- */
- public Object getService() {
- ServiceReference ref = getServiceReference();
- if (ref != null) {
- return getService(ref); // Return immediately the service object.
- } else {
- // Begin to wait ...
- long enter = System.currentTimeMillis();
- boolean exhausted = false;
- synchronized (this) {
- while (ref == null && !exhausted) {
- try {
- wait(1);
- } catch (InterruptedException e) {
- // We was interrupted ....
- } finally {
- long end = System.currentTimeMillis();
- exhausted = (end - enter) > m_timeout;
- ref = getServiceReference();
- }
- }
- }
- // Check
- if (exhausted) {
- Object obj = onTimeout(); // Throw the Runtime Exception
- if (obj == null) {
- throw new RuntimeException("No service available"); // Runtime Exception to be consistent with iPOJO Core.
- } else {
- return obj; // Return a nullable or DI
- }
- } else {
- // If not exhausted, ref is not null.
- return getService(ref);
- }
- }
- }
-
- /**
- * Start method. Initializes the nullable object.
- * @see org.apache.felix.ipojo.util.DependencyModel#start()
- */
- public void start() {
- super.start();
- switch (m_policy) {
- case TemporalHandler.NULL:
- m_nullableObject = null;
- break;
- case TemporalHandler.NULLABLE:
- // To load the proxy we use the POJO class loader. Indeed, this
- // classloader imports iPOJO (so can access to Nullable) and has
- // access to the service specification.
- try {
- m_nullableObject = Proxy.newProxyInstance(m_handler
- .getInstanceManager().getClazz().getClassLoader(),
- new Class[] { getSpecification(), Nullable.class },
- new NullableObject()); // NOPMD
- if (isAggregate()) {
- if (m_collection) {
- List list = new ArrayList(1);
- list.add(m_nullableObject);
- m_nullableObject = list;
- } else {
- Object[] array = (Object[]) Array.newInstance(
- getSpecification(), 1);
- array[0] = m_nullableObject;
- m_nullableObject = array;
- }
- }
- } catch (NoClassDefFoundError e) {
- // A NoClassDefFoundError is thrown if the specification
- // uses a
- // class not accessible by the actual instance.
- // It generally comes from a missing import.
- throw new IllegalStateException(
- "Cannot create the Nullable object, a referenced class cannot be loaded: "
- + e.getMessage());
- }
-
- break;
- case TemporalHandler.DEFAULT_IMPLEMENTATION:
- // Create the default-implementation object.
- try {
- Class clazz = m_handler.getInstanceManager().getContext()
- .getBundle().loadClass(m_di);
- m_nullableObject = clazz.newInstance();
- } catch (IllegalAccessException e) {
- throw new IllegalStateException(
- "Cannot load the default-implementation " + m_di
- + " : " + e.getMessage());
- } catch (InstantiationException e) {
- throw new IllegalStateException(
- "Cannot load the default-implementation " + m_di
- + " : " + e.getMessage());
- } catch (ClassNotFoundException e) {
- throw new IllegalStateException(
- "Cannot load the default-implementation " + m_di
- + " : " + e.getMessage());
- }
- if (isAggregate()) {
- if (m_collection) {
- List list = new ArrayList(1);
- list.add(m_nullableObject);
- m_nullableObject = list;
- } else {
- Object[] array = (Object[]) Array.newInstance(
- getSpecification(), 1);
- array[0] = m_nullableObject;
- m_nullableObject = array;
- }
- }
- break;
- case TemporalHandler.EMPTY:
- if (! m_collection) {
- m_nullableObject = Array.newInstance(getSpecification(), 0);
- } else { // Empty collection
- m_nullableObject = new ArrayList(0);
- }
- break;
- default: // Cannot occurs
- break;
- }
- }
-
- /**
- * Stop method. Just releases the reference on the nullable object.
- * @see org.apache.felix.ipojo.util.DependencyModel#stop()
- */
- public void stop() {
- super.stop();
- m_nullableObject = null;
- m_proxyObject = null;
- }
-
- /**
- * The monitored field receives a value. Nothing to do.
- * @param arg0 POJO setting the value.
- * @param arg1 field name
- * @param arg2 received value
- * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void onSet(Object arg0, String arg1, Object arg2) { }
-
- /**
- * Implements the timeout policy according to the specified configuration.
- * @return the object to return when the timeout occurs.
- */
- Object onTimeout() {
- switch (m_policy) {
- case TemporalHandler.NULL:
- case TemporalHandler.NULLABLE:
- case TemporalHandler.DEFAULT_IMPLEMENTATION:
- case TemporalHandler.EMPTY:
- return m_nullableObject;
- default:
- // Throws a runtime exception
- throw new RuntimeException("Service "
- + getSpecification().getName()
- + " unavailable : timeout");
- }
- }
-
- long getTimeout() {
- return m_timeout;
- }
-
- /**
- * Creates proxy object for proxied scalar dependencies.
- */
- private class ProxyFactory extends ClassLoader {
-
- /**
- * Handler classloader, used to load the temporal dependency class.
- */
- private ClassLoader m_handlerCL;
-
- /**
- * Creates the proxy classloader.
- * @param parent the handler classloader.
- */
- public ProxyFactory(ClassLoader parent) {
- this.m_handlerCL = parent;
- }
-
- /**
- * Loads a proxy class generated for the given (interface) class.
- * @param clazz the service specification to proxy
- * @return the Class object of the proxy.
- */
- protected Class getProxyClass(Class clazz) {
- byte[] clz = ProxyGenerator.dumpProxy(clazz); // Generate the proxy.
- return defineClass(clazz.getName() + "$$Proxy", clz, 0, clz.length);
- }
-
- /**
- * Create a proxy object for the given specification. The proxy
- * uses the given temporal dependency to get the service object.
- * @param spec the service specification (interface)
- * @param dep the temporal dependency used to get the service
- * @return the proxy object.
- */
- public Object getProxy(Class spec, TemporalDependency dep) {
- try {
- Class clazz = getProxyClass(getSpecification());
- Constructor constructor = clazz.getConstructor(new Class[] {dep.getClass()}); // The proxy constructor
- return constructor.newInstance(new Object[] {dep});
- } catch (Throwable e) {
- m_handler.error("Cannot create the proxy object", e);
- m_handler.getInstanceManager().stop();
- return null;
- }
- }
-
- /**
- * Loads the given class.
- * This class use the classloader of the specification class
- * or the handler class loader.
- * @param name the class name
- * @return the class object
- * @throws ClassNotFoundException if the class is not found by the two classloaders.
- * @see java.lang.ClassLoader#loadClass(java.lang.String)
- */
- public Class loadClass(String name) throws ClassNotFoundException {
- try {
- return m_handler.getInstanceManager().getContext().getBundle().loadClass(name);
- } catch (ClassNotFoundException e) {
- return m_handlerCL.loadClass(name);
- }
- }
- }
-
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
deleted file mode 100644
index 0056508a76..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * 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.temporal;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.FieldMetadata;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.parser.PojoMetadata;
-import org.apache.felix.ipojo.util.DependencyMetadataHelper;
-import org.apache.felix.ipojo.util.DependencyModel;
-import org.apache.felix.ipojo.util.DependencyStateListener;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-
-import java.util.*;
-
-/**
- * Temporal dependency handler.
- * A temporal dependency waits (block) for the availability of the service.
- * If no provider arrives in the specified among of time, a runtime exception is thrown.
- *
- * @author Felix Project Team
- */
-public class TemporalHandler extends PrimitiveHandler implements DependencyStateListener {
-
- /**
- * Default timeout if not specified.
- */
- public static final int DEFAULT_TIMEOUT = 3000;
- /**
- * No policy.
- */
- public static final int NO_POLICY = 0;
- /**
- * Uses a nullable object.
- */
- public static final int NULLABLE = 1;
- /**
- * Uses a default-implementation object.
- */
- public static final int DEFAULT_IMPLEMENTATION = 2;
- /**
- * Uses an empty array.
- */
- public static final int EMPTY = 3;
- /**
- * Uses {@code null}.
- */
- public static final int NULL = 4;
- /**
- * The handler namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.handler.temporal";
- /**
- * The list of managed dependencies.
- */
- private List/**/ m_dependencies = new ArrayList(1);
-
- /**
- * Start method. Starts managed dependencies.
- *
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public void start() {
- for (int i = 0; i < m_dependencies.size(); i++) {
- ((TemporalDependency) m_dependencies.get(i)).start();
- }
- }
-
- /**
- * Stop method. Stops managed dependencies.
- *
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public void stop() {
- for (int i = 0; i < m_dependencies.size(); i++) {
- ((TemporalDependency) m_dependencies.get(i)).stop();
- }
- m_dependencies.clear();
- }
-
- /**
- * Configure method. Creates managed dependencies.
- *
- * @param meta the component type metadata.
- * @param dictionary the instance configuration.
- * @throws ConfigurationException if the dependency is not configured correctly
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
- */
- public void configure(Element meta, Dictionary dictionary) throws ConfigurationException {
- PojoMetadata manipulation = getFactory().getPojoMetadata();
- Element[] deps = meta.getElements("requires", NAMESPACE);
-
- // Also check with temporal is no requires.
- if (deps == null || deps.length == 0) {
- deps = meta.getElements("temporal", NAMESPACE);
- }
-
- // Get instance filters.
- Dictionary filtersConfiguration = getRequiresFilters(dictionary.get("temporal.filters"));
- if (filtersConfiguration == null || filtersConfiguration.isEmpty()) {
- // Fall back on the Requires handler configuration, if any
- filtersConfiguration = getRequiresFilters(dictionary.get("requires.filters"));
- }
- // Get from filters if any.
- Dictionary fromConfiguration = getRequiresFilters(dictionary.get("temporal.from"));
- if (fromConfiguration == null || fromConfiguration.isEmpty()) {
- // Fall back on the Requires handler configuration, if any
- fromConfiguration = getRequiresFilters(dictionary.get("requires.from"));
- }
-
-
- for (int i = 0; i < deps.length; i++) {
- if (!deps[i].containsAttribute("field") || m_dependencies.contains(deps[i].getAttribute("field"))) {
- error("One temporal dependency must be attached to a field or the field is already used");
- return;
- }
- String field = deps[i].getAttribute("field");
-
- String id = field;
- if (deps[i].containsAttribute("id")) {
- id = deps[i].getAttribute("id");
- }
-
- FieldMetadata fieldmeta = manipulation.getField(field);
- if (fieldmeta == null) {
- error("The field " + field + " does not exist in the class " + getInstanceManager().getClassName());
- return;
- }
-
- boolean agg = false;
- boolean collection = false;
- String spec = fieldmeta.getFieldType();
- if (spec.endsWith("[]")) {
- agg = true;
- spec = spec.substring(0, spec.length() - 2);
- } else if (Collection.class.getName().equals(spec)) {
- agg = true;
- collection = true;
- // Collection detected. Check for the specification attribute
- spec = deps[i].getAttribute("specification");
- if (spec == null) {
- error("A dependency injected inside a Collection must contain the 'specification' attribute");
- }
- }
-
- // Determine the filter
- String fil = deps[i].getAttribute("filter");
- // Override the filter if filter configuration if available in the instance configuration
- if (filtersConfiguration != null && id != null && filtersConfiguration.get(id) != null) {
- fil = (String) filtersConfiguration.get(id);
- }
-
- // Check the from attribute
- String from = deps[i].getAttribute("from");
- if (fromConfiguration != null && id != null && fromConfiguration.get(id) != null) {
- from = (String) fromConfiguration.get(id);
- }
-
- if (from != null) {
- String fromFilter = "(|(instance.name=" + from + ")(service.pid=" + from + "))";
- if (agg) {
- warn("The 'from' attribute is incompatible with aggregate requirements: only one provider will " +
- "match : " + fromFilter);
- }
- if (fil != null) {
- fil = "(&" + fromFilter + fil + ")"; // Append the two filters
- } else {
- fil = fromFilter;
- }
- }
-
- Filter filter = null;
- if (fil != null) {
- try {
- filter = getInstanceManager().getContext().createFilter(fil);
- } catch (InvalidSyntaxException e) {
- throw new ConfigurationException("A requirement filter is invalid : " + filter, e);
- }
- }
-
- String prox = deps[i].getAttribute("proxy");
- // Use proxy by default except for array:
- boolean proxy = prox == null || prox.equals("true");
-
- if (prox == null && proxy) { // Proxy set because of the default.
- if (agg && !collection) { // Aggregate and array
- proxy = false;
- }
- }
-
- if (proxy && agg) {
- if (!collection) {
- error("Proxied aggregate temporal dependencies cannot be an array. Only collections are supported");
- }
- }
-
- long timeout = DEFAULT_TIMEOUT;
- if (deps[i].containsAttribute("timeout")) {
- String to = deps[i].getAttribute("timeout");
- if (to.equalsIgnoreCase("infinite") || to.equalsIgnoreCase("-1")) {
- timeout = Long.MAX_VALUE; // Infinite wait time ...
- } else {
- timeout = new Long(deps[i].getAttribute("timeout")).longValue();
- }
- }
-
- int policy = NO_POLICY;
- String di = null;
- String onTimeout = deps[i].getAttribute("onTimeout");
- if (onTimeout != null) {
- if (onTimeout.equalsIgnoreCase("nullable")) {
- policy = NULLABLE;
- } else if (onTimeout.equalsIgnoreCase("empty-array") || onTimeout.equalsIgnoreCase("empty")) {
- policy = EMPTY;
- if (!agg) {
- // The empty array policy can only be used on aggregate dependencies
- error("Cannot use the empty array policy for " + field + " : non aggregate dependency.");
- }
- } else if (onTimeout.equalsIgnoreCase("null")) {
- policy = NULL;
- } else if (onTimeout.length() > 0) {
- di = onTimeout;
- policy = DEFAULT_IMPLEMENTATION;
- }
- }
-
- Class specification = DependencyMetadataHelper.loadSpecification(spec, getInstanceManager().getContext());
- TemporalDependency dep = new TemporalDependency(specification, agg, collection, proxy, filter, getInstanceManager().getContext(), timeout, policy, di, this);
- m_dependencies.add(dep);
-
- if (!proxy) { // Register method interceptor only if are not a proxy
- MethodMetadata[] methods = manipulation.getMethods();
- for (int k = 0; k < methods.length; k++) {
- getInstanceManager().register(methods[k], dep);
- }
- }
-
- getInstanceManager().register(fieldmeta, dep);
- }
- }
-
- /**
- * Gets the requires filter configuration from the given object.
- * The given object must come from the instance configuration.
- * This method was made to fix FELIX-2688. It supports filter configuration using
- * an array:
- * {"myFirstDep", "(property1=value1)", "mySecondDep", "(property2=value2)"});
- *
- * Copied from DependencyHandler#getRequiresFilters(Object)
- *
- * @param requiresFiltersValue the value contained in the instance
- * configuration.
- * @return the dictionary. If the object in already a dictionary, just returns it,
- * if it's an array, builds the dictionary.
- * @throws ConfigurationException the dictionary cannot be built
- */
- private Dictionary getRequiresFilters(Object requiresFiltersValue)
- throws ConfigurationException {
- if (requiresFiltersValue != null
- && requiresFiltersValue.getClass().isArray()) {
- String[] filtersArray = (String[]) requiresFiltersValue;
- if (filtersArray.length % 2 != 0) {
- throw new ConfigurationException(
- "A requirement filter is invalid : "
- + requiresFiltersValue);
- }
- Dictionary requiresFilters = new Hashtable();
- for (int i = 0; i < filtersArray.length; i += 2) {
- requiresFilters.put(filtersArray[i], filtersArray[i + 1]);
- }
- return requiresFilters;
- }
-
- return (Dictionary) requiresFiltersValue;
- }
-
- /**
- * Nothing to do.
- * A temporal dependency is always valid.
- *
- * @param dependencymodel dependency.
- * @see org.apache.felix.ipojo.util.DependencyStateListener#invalidate(org.apache.felix.ipojo.util.DependencyModel)
- */
- public void invalidate(DependencyModel dependencymodel) {
- }
-
- /**
- * Nothing to do.
- * A temporal dependency is always valid.
- *
- * @param dependencymodel dependency.
- * @see org.apache.felix.ipojo.util.DependencyStateListener#validate(org.apache.felix.ipojo.util.DependencyModel)
- */
- public void validate(DependencyModel dependencymodel) {
- }
-
-
-}
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml b/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml
deleted file mode 100644
index e514b20fdd..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd b/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd
deleted file mode 100644
index 48dbc7fe3a..0000000000
--- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
- Description of a temporal dependency.
-
-
-
- The implementation field supporting the dependency.
-
-
-
- The dependency id
-
-
-
- Filter use to discover matching filter.
-
-
- Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait.
-
-
-
- Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached.
-
-
-
-
- Enables or Disables the proxy injection
-
-
-
-
- Specifies the looked service specification. This attribute is mandatory when injecting in a Collection
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/pom.xml b/ipojo/handler/transaction/pom.xml
deleted file mode 100644
index c526e43a56..0000000000
--- a/ipojo/handler/transaction/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- org.apache.felix.ipojo.handler.transaction-handler-project
- 1.5.0-SNAPSHOT
- Apache Felix iPOJO Transaction Handler Project
- pom
-
-
- transaction-handler
- transaction-handler-it
-
-
-
-
-
- src/main/resources
-
-
- .
- META-INF
-
- LICENSE*
- NOTICE*
- DEPENDENCIES*
-
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- make-assembly
- package
-
- single
-
-
-
- project
-
-
- false
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- attach-assemblies
- package
-
- attach-artifact
-
-
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz
-
- project
- tar.gz
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.zip
-
- project
- zip
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/handler/transaction/transaction-handler-it/pom.xml b/ipojo/handler/transaction/transaction-handler-it/pom.xml
deleted file mode 100644
index f51dc5577c..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/pom.xml
+++ /dev/null
@@ -1,413 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
-
- 4.0.0
- pom
- Apache Felix iPOJO Transaction Handler - Integration Test
- org.apache.felix.ipojo.handler.transaction-it
- 1.5.0-SNAPSHOT
-
-
- 3.0.0
- 1.5.1
-
-
-
-
- ow2.snapshots
- http://repository.ow2.org/nexus/content/repositories/snapshots/
-
-
-
-
-
- org.ow2.chameleon.transaction
- geronimo-transaction-service
- 0.0.1-SNAPSHOT
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.transaction
- ${project.version}
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.6
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
-
- ch.qos.logback
- logback-core
- 1.5.25
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.0
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.2
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
-
-
-
-
-
-
-
-
- test
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- regular
-
- run
-
-
-
- felix
-
- ${project.build.directory}/regular
-
-
-
-
-
-
-
-
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- http://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- 5.2.0
- test
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- 3.8.1.v20120830-144521
- test
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
-
-
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml
deleted file mode 100644
index f118348293..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.transaction-it
- 1.5.0-SNAPSHOT
- ../../../pom.xml
-
-
-
- ipojo-transaction-integration-test
- ${project.artifactId}
-
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.8.6
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java
deleted file mode 100644
index 432f833ac3..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.transaction.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-
-import javax.transaction.Transaction;
-
-@Component
-@org.apache.felix.ipojo.transaction.Transaction(field="transaction")
-public class ComponentUsingAnnotations {
-
- Transaction transaction;
-
-
- @org.apache.felix.ipojo.transaction.Transactional
- public void doSomethingBad() throws NullPointerException {
- }
-
- @org.apache.felix.ipojo.transaction.Transactional(propagation="required")
- public void doSomethingBad2() throws UnsupportedOperationException {
-
- }
-
- @org.apache.felix.ipojo.transaction.Transactional(propagation="supported", norollbackfor= {"java.lang.Exception"})
- public void doSomethingGood() {
-
- }
-
- @org.apache.felix.ipojo.transaction.Transactional(timeout=1000, exceptiononrollback=true)
- public void doSomethingLong() {
-
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java
deleted file mode 100644
index b32ae26959..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.transaction.components;
-
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-
-import javax.transaction.Transaction;
-
-public class FooDelegator implements CheckService {
-
- Transaction transaction;
- Transaction lastCommitted;
- Transaction lastRolledback;
- Transaction current;
- private Foo foo;
- private int commit;
- private int rollback;
-
- public void onCommit(String method) {
- commit++;
- }
-
- public void onRollback(String method, Exception e) {
- rollback++;
- }
-
- public void doSomethingBad() throws NullPointerException {
- current = transaction;
- foo.doSomethingBad();
- }
-
- public void doSomethingBad2() throws UnsupportedOperationException {
- current = transaction;
- foo.doSomethingBad2();
-
- }
-
- public void doSomethingGood() {
- current = transaction;
- foo.doSomethingGood();
- }
-
- public void doSomethingLong() {
- current = transaction;
- foo.doSomethingLong();
- }
-
- public Transaction getCurrentTransaction() {
- return current;
- }
-
- public int getNumberOfCommit() {
- return commit;
- }
-
- public int getNumberOfRollback() {
- return rollback;
- }
-
- public Transaction getLastRolledBack() {
- return lastRolledback;
- }
-
- public Transaction getLastCommitted() {
- return lastCommitted;
- }
-
- public void onRollback(Transaction t) {
- lastRolledback = t;
- rollback++;
- }
-
- public void onCommit(Transaction t) {
- lastCommitted = t;
- commit++;
- }
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java
deleted file mode 100644
index 8ac81461d1..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.transaction.components;
-
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-
-public class FooImpl implements Foo {
-
- public void doSomethingBad() throws NullPointerException {
- throw new NullPointerException("NULL");
- }
-
- public void doSomethingBad2() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Expected exception");
-
- }
-
- public void doSomethingGood() {
- // Good...
- }
-
- public void doSomethingLong() {
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java
deleted file mode 100644
index f2c978f5d4..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.transaction.services;
-
-import javax.transaction.Transaction;
-
-public interface CheckService {
-
- public void doSomethingGood();
-
- public void doSomethingBad() throws NullPointerException;
-
- public void doSomethingBad2() throws UnsupportedOperationException;
-
- public void doSomethingLong();
-
- public int getNumberOfCommit();
-
- public int getNumberOfRollback();
-
- public Transaction getCurrentTransaction();
-
- public Transaction getLastRolledBack();
-
- public Transaction getLastCommitted();
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java
deleted file mode 100644
index 91079799af..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.transaction.services;
-
-public interface Foo {
-
- public void doSomethingGood();
-
- public void doSomethingBad() throws NullPointerException;
-
- public void doSomethingBad2() throws UnsupportedOperationException;
-
- public void doSomethingLong();
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml
deleted file mode 100644
index 97fa837bd9..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml
deleted file mode 100644
index 2bc6421c40..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml
deleted file mode 100644
index b9c74a1d4f..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml
deleted file mode 100644
index bad5164b91..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml
deleted file mode 100644
index 88088541b6..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml
deleted file mode 100644
index f209c65de3..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml
deleted file mode 100644
index 0fcc9e9a8f..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml
deleted file mode 100644
index 7a56e5f2cc..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java
deleted file mode 100644
index 87aa4c1244..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.transaction.test;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-import static org.ops4j.pax.exam.MavenUtils.asInProject;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class Common {
-
- @Inject
- BundleContext context;
- OSGiHelper osgiHelper;
- IPOJOHelper ipojoHelper;
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Mockito core does not includes Hamcrest
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets
- // resolved correctly.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation. this property has no effect on the other OSGi implementation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
- public static CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // The tested handler
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.transaction").versionAsInProject()
- );
- }
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.DEBUG);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- //testedBundle(), // Each test is doing its own deployment.
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN"),
- provision(
- mavenBundle().groupId("org.ow2.chameleon.transaction").artifactId("geronimo-transaction-service").version(asInProject())
- ),
- systemPackage("javax.transaction;version>=1.1.0")
- );
- }
-
- @Before
- public void commonSetUp() {
- osgiHelper = new OSGiHelper(context);
- ipojoHelper = new IPOJOHelper(context);
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List services = new ArrayList();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- String export = "";
- for (File file : services) {
- if (export.length() > 0) {
- export += ", ";
- }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- //.set(Constants.IMPORT_PACKAGE, "*")
- //.set(Constants.EXPORT_PACKAGE, export) // No export...
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java
deleted file mode 100644
index 2e96e299c4..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.handler.transaction.components.ComponentUsingAnnotations;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.apache.felix.ipojo.metadata.Element;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.*;
-import static org.ops4j.pax.exam.MavenUtils.asInProject;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestAnnotations extends Common {
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(TinyBundles.withBnd());
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(ComponentUsingAnnotations.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "TransactionAnnotationTest")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "annotation.xml")));
-
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ),
- repository("http://maven.ow2.org/maven2-snapshot/")
- );
- }
-
- @Test
- public void annotations() {
- Element elem = IPOJOHelper.getMetadata(getBundle(), "org.apache.felix.ipojo.handler.transaction.components.ComponentUsingAnnotations");
- Assert.assertNotNull(elem);
-
- Element tr = elem.getElements("transaction", "org.apache.felix.ipojo.transaction")[0];
- Assert.assertEquals("transaction", tr.getAttribute("field"));
-
- Assert.assertNull(tr.getAttribute("oncommit"));
- Assert.assertNull(tr.getAttribute("onrollback"));
-
- Element[] methods = tr.getElements();
- Assert.assertEquals(4, methods.length);
-
- Element m1 = getElementByMethod(methods, "doSomethingBad");
- Assert.assertNotNull(m1);
-
- Element m2 = getElementByMethod(methods, "doSomethingBad2");
- Assert.assertNotNull(m2);
- Assert.assertEquals("required", m2.getAttribute("propagation"));
-
- Element m3 = getElementByMethod(methods, "doSomethingGood");
- Assert.assertNotNull(m3);
- Assert.assertEquals("supported", m3.getAttribute("propagation"));
- Assert.assertEquals("{java.lang.Exception}", m3.getAttribute("norollbackfor"));
-
- Element m4 = getElementByMethod(methods, "doSomethingLong");
- Assert.assertNotNull(m4);
- Assert.assertEquals("1000", m4.getAttribute("timeout"));
- Assert.assertEquals("true", m4.getAttribute("exceptiononrollback"));
- }
-
- private Element getElementByMethod(Element[] e, String m) {
- for (Element elem : e) {
- if (m.equals(elem.getAttribute("method"))) {
- return elem;
- }
- }
- Assert.fail("Method " + m + " not found");
- return null;
- }
-
- private Bundle getBundle() {
- for (Bundle b : context.getBundles()) {
- System.out.println(b.getSymbolicName());
- if ("TransactionAnnotationTest".equals(b.getSymbolicName())) {
- return b;
- }
- }
- Assert.fail("Cannot find the tested bundle");
- return null;
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java
deleted file mode 100644
index 8f68dc391a..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.MavenUtils.asInProject;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestInstallation extends Common {
-
- public static final File TEST = new File("src/main/resources");
-
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "RequiredTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "requires.xml")));
-
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
- }
-
- @Test
- public void install() throws NotSupportedException, SystemException, IllegalStateException,
- SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException, InvalidSyntaxException {
- Bundle[] bundles = context.getBundles();
- for (Bundle b : bundles) {
- System.out.println("Bundle : " + b.getSymbolicName() + " - " + b.getState());
- Assert.assertTrue(b.getSymbolicName(), b.getState() == Bundle.ACTIVE);
- }
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- // Transaction Service available
- osgiHelper.isServiceAvailable(TransactionManager.class.getName());
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Assert.assertNotNull(tm.getTransaction());
- tm.commit();
-
- tm.begin();
- Assert.assertNotNull(tm.getTransaction());
- tm.rollback();
-
- // Handler exposed
- ServiceReference ref = osgiHelper.getServiceReference(HandlerFactory.class.getName(), "(&(handler.name=transaction)(handler.namespace=org.apache.felix.ipojo.transaction))");
- Assert.assertNotNull(ref);
-
- // Create an install of the components
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference[] refs = context.getAllServiceReferences(CheckService.class.getName(), "(instance.name=" + under.getInstanceName() + ")");
-
-// ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(refs);
-
- ((CheckService) osgiHelper.getServiceObject(refs[0])).doSomethingGood();
- }
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java
deleted file mode 100644
index caf1e59bdb..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestInvalidation extends Common {
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "RequiredTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "requires.xml")));
-
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
- }
-
- @Test
- public void testInvalidation() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- final ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
-
- Thread thread = new Thread(new Runnable() {
- public void run() {
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- prov.dispose();
- }
- });
-
- thread.start();
-
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingLong(); // 5s, so prov should be disposed during this time and under becomes invalid
-
- Assert.assertEquals(ComponentInstance.INVALID, under.getState());
-
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.rollback();
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java
deleted file mode 100644
index 8edec8325b..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-
-public class TestMandatory extends Common {
-
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "MandatoryTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "mandatory.xml")));
-
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
-
- }
-
- @Test(expected = RuntimeException.class)
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); // Fail !
- }
-
- @Test
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
- }
-
- @Test(expected = RuntimeException.class)
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // Fail, RTE thrown before the other exception
- }
-
- @Test(expected = RollbackException.class)
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.commit(); // Throws a rollback exception.
- }
-
- @Test
- public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.rollback();
- }
-
- @Test(expected = RuntimeException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); // Throws a RTE
- }
-
- @Test
- public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-
- @Test(expected = RuntimeException.class)
- public void testOkOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingGood(); // Throws a RTE.
-
- }
-
- @Test
- public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
- @Test(expected = RuntimeException.class)
- public void testExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad(); // Thows a RTE.
-
- }
-
- @Test
- public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- try {
- t.commit(); // Throw a rollback exception.
- } catch (RollbackException e) {
- // Expected
- } catch (Throwable e) {
- Assert.fail(e.getMessage()); // Unexpected
- }
-
- Assert.assertNotNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(1, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastRolledBack());
- }
-
- @Test(expected = RuntimeException.class)
- public void testExpectedExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad2();
-
-
- }
-
- @Test
- public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java
deleted file mode 100644
index d8c6b592ab..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestNever extends Common {
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "NeverTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "never.xml")));
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
- }
-
- @Test
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("never-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood();
- }
-
- @Test(expected = RuntimeException.class)
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("never-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- cs.doSomethingGood(); // Fail
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("never-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // Throws an NPE
- }
-
- @Test
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("never-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad(); // Fail
- Assert.fail("RuntimeException expected");
- } catch (RuntimeException e) {
- // Ok :-)
- }
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.rollback();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("never-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2();
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java
deleted file mode 100644
index b9fdd96980..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-@ExamReactorStrategy(PerClass.class)
-public class TestNotSupported extends Common {
-
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "NotSupportedTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "notsupported.xml")));
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
- }
-
- @Test
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = ((CheckService) osgiHelper.getServiceObject(ref));
- cs.doSomethingGood();
- // No transaction.
- }
-
- @Test
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction(); // Is executed in the transaction despite it's not supported.
- Assert.assertSame(t2, t);
- t.commit();
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad();
- }
-
- @Test
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No impact on the transaction.
-
- t.commit(); // Ok.
- }
-
- @Test
- public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No impact on the transaction.
-
- t.rollback(); // Ok.
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2();
- }
-
- @Test
- public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-
- @Test
- public void testOkOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingGood();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No effect on the transaction
-
- try {
- t.commit(); // Throw a rollback exception.
- } catch (RollbackException e) {
- // Expected
- } catch (Throwable e) {
- Assert.fail(e.getMessage()); // Unexpected
- }
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad2();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java
deleted file mode 100644
index 62212935e0..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestRequires extends Common {
-
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "RequiresTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "requires.xml")));
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
-
- }
-
- @Test
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood();
- }
-
- @Test
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad();
- }
-
- @Test(expected = RollbackException.class)
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.commit(); // Throw a rollback exception.
- }
-
- @Test
- public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.rollback();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2();
- }
-
- @Test
- public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-
- @Test
- public void testOkOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingGood();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad();
-
- Assert.assertNotNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(1, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- try {
- t.commit(); // Throw a rollback exception.
- } catch (RollbackException e) {
- // Expected
- } catch (Throwable e) {
- Assert.fail(e.getMessage()); // Unexpected
- }
-
- Assert.assertNotNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(1, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastRolledBack());
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad2();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java
deleted file mode 100644
index b18733f9ab..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-public class TestRequiresNew extends Common {
-
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "RequiresNewTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "requiresnew.xml")));
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- )
- );
-
-
- }
-
- @Test
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); // Ok
- }
-
- @Test
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertNotSame(t2, t); // Two different transactions
- // Check that t2 is commited => no transaction
- Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus());
- t.commit();
- }
-
- @Test
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- try {
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // throws an exception on rollback
- Assert.fail("Exception expected on rollback");
- } catch (IllegalStateException e) {
- // Ok.
- } catch (Exception e) {
- Assert.fail("IllegalStateException expected on rollback");
- }
- }
-
- @Test
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("IllegalStateException expected"); // throws an exception on rollback
- } catch (Exception e) {
- Assert.assertTrue(e instanceof IllegalStateException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertNotSame(t2, t);
- // Check that t2 is rolledback
- Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus());
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2();
- }
-
- @Test
- public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertNotSame(t2, t);
- Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus());
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java
deleted file mode 100644
index f36c4e6acb..0000000000
--- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * 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.transaction.test;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.handler.transaction.components.FooDelegator;
-import org.apache.felix.ipojo.handler.transaction.components.FooImpl;
-import org.apache.felix.ipojo.handler.transaction.services.CheckService;
-import org.apache.felix.ipojo.handler.transaction.services.Foo;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.transaction.*;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO;
-
-@ExamReactorStrategy(PerClass.class)
-public class TestSupported extends Common {
-
-
- public static final File TEST = new File("src/main/resources");
-
- @Configuration
- public Option[] config() throws IOException {
- Option[] options = super.config();
-
-
- InputStream service = TinyBundles.bundle()
- .add(CheckService.class)
- .add(Foo.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Service")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build();
-
- InputStream fooimpl = TinyBundles.bundle()
- .add(FooImpl.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services")
- .build(withiPOJO(new File(TEST, "foo.xml")));
-
- InputStream test = TinyBundles.bundle()
- .add(FooDelegator.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "SupportedTransactionPropagation")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1")
- .build(withiPOJO(new File(TEST, "supported.xml")));
-
- return OptionUtils.combine(
- options,
- provision(
- service,
- fooimpl,
- test
- ));
- }
-
- @Test
- public void testOkOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = ((CheckService) osgiHelper.getServiceObject(ref));
- cs.doSomethingGood();
- // No transaction.
- }
-
- @Test
- public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad();
- }
-
- @Test(expected = RollbackException.class)
- public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.commit(); // Throw a rollback exception.
- }
-
- @Test
- public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- t.rollback();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransaction() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2();
- }
-
- @Test
- public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
- }
-
- @Test
- public void testOkOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingGood();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- cs.doSomethingGood();
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
- @Test(expected = NullPointerException.class)
- public void testExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad();
- Assert.fail("NullPointerException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof NullPointerException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus());
-
- try {
- t.commit(); // Throw a rollback exception.
- } catch (RollbackException e) {
- // Expected
- } catch (Throwable e) {
- Assert.fail(e.getMessage()); // Unexpected
- }
-
- Assert.assertNotNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(1, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastRolledBack());
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void testExpectedExceptionOutsideTransactionWithCallback() {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
-
- cs.doSomethingBad2();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNull(cs.getLastCommitted());
- Assert.assertEquals(0, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
- }
-
- @Test
- public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException {
- ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl");
- ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb");
-
- Assert.assertEquals(ComponentInstance.VALID, prov.getState());
- Assert.assertEquals(ComponentInstance.VALID, under.getState());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName());
- Assert.assertNotNull(ref);
-
- osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000);
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null);
- tm.begin();
- Transaction t = tm.getTransaction();
- try {
- cs.doSomethingBad2();
- Assert.fail("UnsupportedOperationException expected");
- } catch (Exception e) {
- Assert.assertTrue(e instanceof UnsupportedOperationException);
- }
- Transaction t2 = cs.getCurrentTransaction();
- Assert.assertSame(t2, t);
- Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus());
-
- t.commit();
-
- Assert.assertNull(cs.getLastRolledBack());
- Assert.assertNotNull(cs.getLastCommitted());
- Assert.assertEquals(1, cs.getNumberOfCommit());
- Assert.assertEquals(0, cs.getNumberOfRollback());
-
- Assert.assertSame(t, cs.getLastCommitted());
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/transaction/transaction-handler-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/transaction/transaction-handler/pom.xml b/ipojo/handler/transaction/transaction-handler/pom.xml
deleted file mode 100644
index 9c09988238..0000000000
--- a/ipojo/handler/transaction/transaction-handler/pom.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- org.apache.felix.ipojo.handler.transaction
-
- 1.5.0-SNAPSHOT
- Apache Felix iPOJO Transaction Handler
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 1.4.3
- true
-
-
- ${project.artifactId}
- org.apache.felix.ipojo.transaction
- javax.transaction;version=1.1, *
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.8.4
-
-
-
- ipojo-bundle
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.9.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.ipojo.metadata
- 1.4.0
-
-
- geronimo-spec
- geronimo-spec-jta
- 1.0-M1
-
-
-
diff --git a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java b/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
deleted file mode 100644
index d0eea3f714..0000000000
--- a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * 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.transaction;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.FieldMetadata;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.parser.ParseUtils;
-import org.apache.felix.ipojo.util.Callback;
-
-public class TransactionHandler extends PrimitiveHandler implements Synchronization {
-
- public static final String NAMESPACE= "org.apache.felix.ipojo.transaction";
-
- public static final String NAME= "transaction";
-
- private static final String FIELD_ATTRIBUTE= "field";
-
- private static final String ONCOMMIT_ATTRIBUTE= "oncommit";
-
- private static final String ONROLLBACK_ATTRIBUTE= "onrollback";
-
- private static final String TRANSACTIONAL_ELEMENT = "transactional";
-
- private static final String METHOD_ATTRIBUTE = "method";
-
- private static final String TIMEOUT_ATTRIBUTE = "timeout";
-
- private static final String PROPAGATION_ATTRIBUTE = "propagation";
-
- private static final String EXCEPTIONONROLLBACK_ATTRIBUTE = "exceptiononrollback";
-
- private static final String NOROLLBACKFOR_ATTRIBUTE = "norollbackfor";
-
- public static final int DEFAULT_PROPAGATION = TransactionalMethod.REQUIRES;
-
-
- private TransactionManager m_transactionManager; // Service Dependency
-
- private List m_methods = new ArrayList();
-
- private Callback m_onRollback;
-
- private Callback m_onCommit;
-
- private List m_transactions = new ArrayList();
-
-
- public void configure(Element arg0, Dictionary arg1)
- throws ConfigurationException {
- Element[] elements = arg0.getElements(NAME, NAMESPACE);
- if (elements.length > 1) {
- throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + " cannot be declared several times");
- }
-
- String field = elements[0].getAttribute(FIELD_ATTRIBUTE);
- if (field != null) {
- FieldMetadata meta = getPojoMetadata().getField(field);
- if (meta == null) {
- throw new ConfigurationException("The transaction field does not exist in the pojo class : " + field);
- }
- if (! meta.getFieldType().equals(Transaction.class.getName())) {
- throw new ConfigurationException("The transaction field type must be " + Transaction.class.getName());
- }
- // Register the interceptor
- getInstanceManager().register(meta, this);
-
- }
-
- String oncommit = elements[0].getAttribute(ONCOMMIT_ATTRIBUTE);
- if (oncommit != null) {
- m_onCommit = new Callback(oncommit, new String[] { Transaction.class.getName() }, false, getInstanceManager());
- }
-
- String onrollback = elements[0].getAttribute(ONROLLBACK_ATTRIBUTE);
- if (onrollback != null) {
- m_onRollback = new Callback(onrollback, new String[] { Transaction.class.getName() }, false, getInstanceManager());
- }
-
-
- Element[] sub = elements[0].getElements(TRANSACTIONAL_ELEMENT);
- if (sub == null || sub.length == 0) {
- throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + " must have " + TRANSACTIONAL_ELEMENT + " subelement");
- }
-
- for (int i = 0; i < sub.length; i++) {
- String method = sub[i].getAttribute(METHOD_ATTRIBUTE);
- String to = sub[i].getAttribute(TIMEOUT_ATTRIBUTE);
- String propa = sub[i].getAttribute(PROPAGATION_ATTRIBUTE);
- String nrbf = sub[i].getAttribute(NOROLLBACKFOR_ATTRIBUTE);
- String eorb = sub[i].getAttribute(EXCEPTIONONROLLBACK_ATTRIBUTE);
-
- if (method == null) {
- throw new ConfigurationException("A transactional element must specified the method attribute");
- }
- MethodMetadata meta = this.getPojoMetadata().getMethod(method);
- if (meta == null) {
- throw new ConfigurationException("A transactional method is not in the pojo class : " + method);
- }
-
- int timeout = 0;
- if (to != null) {
- timeout = new Integer(to).intValue();
- }
-
- int propagation = DEFAULT_PROPAGATION;
- if (propa != null) {
- propagation = parsePropagation(propa);
- }
-
- List exceptions = new ArrayList();
- if (nrbf != null) {
- exceptions = (List) ParseUtils.parseArraysAsList(nrbf);
- }
-
- boolean exceptionOnRollback = false;
- if (eorb != null) {
- exceptionOnRollback = new Boolean(eorb).booleanValue();
- }
-
- TransactionalMethod tm = new TransactionalMethod(method, propagation, timeout, exceptions, exceptionOnRollback, this);
- m_methods.add(tm);
- this.getInstanceManager().register(meta, tm);
- }
-
- }
-
- private int parsePropagation(String propa) throws ConfigurationException {
- if (propa.equalsIgnoreCase("requires")) {
- return TransactionalMethod.REQUIRES;
-
- } else if (propa.equalsIgnoreCase("mandatory")){
- return TransactionalMethod.MANDATORY;
-
- } else if (propa.equalsIgnoreCase("notsupported")) {
- return TransactionalMethod.NOT_SUPPORTED;
-
- } else if (propa.equalsIgnoreCase("supported")) {
- return TransactionalMethod.SUPPORTED;
-
- } else if (propa.equalsIgnoreCase("never")) {
- return TransactionalMethod.NEVER;
-
- } else if (propa.equalsIgnoreCase("requiresnew")) {
- return TransactionalMethod.REQUIRES_NEW;
- }
-
- throw new ConfigurationException("Unknown propgation policy : " + propa);
- }
-
- public void start() {
- // Set transaction managers.
- for (TransactionalMethod method : m_methods) {
- method.setTransactionManager(m_transactionManager);
- }
- }
-
- public void stop() {
- // Nothing to do.
- }
-
- public synchronized void bind(TransactionManager tm) {
- for (TransactionalMethod method : m_methods) {
- method.setTransactionManager(tm);
- }
- }
-
- public synchronized void unbind(TransactionManager tm) {
- for (TransactionalMethod method : m_methods) {
- method.setTransactionManager(null);
- }
- }
-
- public void transactionRolledback(Transaction t) {
- if (m_onRollback != null) {
- try {
- m_onRollback.call(new Object[] { t });
- } catch (NoSuchMethodException e1) {
- error("Cannot invoke the onRollback method, method not found",
- e1);
- } catch (IllegalAccessException e1) {
- error(
- "Cannot invoke the onRollback method,cannot access the method",
- e1);
- } catch (InvocationTargetException e1) {
- error(
- "Cannot invoke the onRollback method,the method thrown an exception",
- e1.getTargetException());
- }
- }
- }
-
- public void transactionCommitted(Transaction t) {
- if (m_onRollback != null) {
- try {
- m_onCommit.call(new Object[] { t });
- } catch (NoSuchMethodException e1) {
- error("Cannot invoke the onCommit callback, method not found",
- e1);
- } catch (IllegalAccessException e1) {
- error(
- "Cannot invoke the onCommit callback,cannot access the method",
- e1);
- } catch (InvocationTargetException e1) {
- error(
- "Cannot invoke the onCommit callback,the method thrown an exception",
- e1.getTargetException());
- }
- }
-
- }
-
- public void stateChanged(int newState) {
- if (newState == ComponentInstance.INVALID) {
- // rollback all owned transactions.
- for (int i = 0; i < m_methods.size(); i++) {
- m_methods.get(i).rollbackOwnedTransactions();
- }
-
- for (int i =0; i < m_transactions.size(); i++) {
- try {
- m_transactions.get(i).setRollbackOnly();
- } catch (Exception e) {
- error("Cannot set rollback only on a transaction : " + e.getMessage());
- }
- }
- }
- }
-
- public synchronized Object onGet(Object pojo, String fieldName, Object value) {
- try {
- if (m_transactionManager != null) {
- return m_transactionManager.getTransaction();
- } else {
- return null;
- }
- } catch (SystemException e) {
- error("Cannot get the current transaction, internal error", e);
- return null;
- }
- }
-
- public void afterCompletion(int arg0) {
- try {
- if (m_transactionManager.getTransaction() != null) {
- m_transactions .remove(m_transactionManager.getTransaction());
- if (arg0 == Status.STATUS_ROLLEDBACK) {
- transactionRolledback(m_transactionManager.getTransaction());
- } else if (arg0 == Status.STATUS_COMMITTED) {
- transactionCommitted(m_transactionManager.getTransaction());
- }
- }
- } catch (SystemException e) {
- error("Cannot remove the transaction from the transaction list : " + e.getMessage());
- }
- }
-
- public void beforeCompletion() {
-
- }
-
- public void addTransaction(Transaction transaction) {
- if (m_transactions.contains(transaction)) {
- return;
- }
- try {
- transaction.registerSynchronization(this);
- m_transactions.add(transaction);
- } catch (Exception e) {
- error("Cannot add the transaction to the transaction list : " + e.getMessage());
- }
- }
-
- public List getTransactions() {
- return m_transactions;
- }
-
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java b/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java
deleted file mode 100644
index df06423a44..0000000000
--- a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * 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.transaction;
-
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-import org.apache.felix.ipojo.MethodInterceptor;
-
-public class TransactionalMethod implements MethodInterceptor {
-
- public static final int REQUIRES = 0;
-
- public static final int REQUIRES_NEW = 1;
-
- public static final int MANDATORY = 2;
-
- public static final int SUPPORTED = 3;
-
- public static final int NOT_SUPPORTED = 4;
-
- public static final int NEVER = 5;
-
- private String method;
-
- private int propagation;
-
- private int timeout;
-
- private List exceptions;
-
- private TransactionManager manager;
-
- private Map m_owned = new HashMap();
-
- private boolean exceptionOnRollback;
-
-
- private TransactionHandler handler;
-
- private Transaction suspended;
-
- public TransactionalMethod(String method, int propagation, int timeout, List exception, boolean exceptionOnRollback, TransactionHandler handler) {
- this.method = method;
- this.propagation = propagation;
- this.timeout = timeout;
- this.exceptions = exception;
- this.exceptionOnRollback = exceptionOnRollback;
- this.handler = handler;
- }
-
- public synchronized void setTransactionManager(TransactionManager tm) {
- manager = tm;
- if (manager == null) {
- // Clear stored transactions.
- m_owned.clear();
-
- }
- }
-
-
- public void onEntry() throws SystemException, NotSupportedException {
- TransactionManager manager = null;
- synchronized (this) {
- if (this.manager != null) {
- manager = this.manager; // Stack confinement
- } else {
- return; // Nothing can be done...
- }
- }
-
- Transaction transaction = manager.getTransaction();
- switch (propagation) {
- case REQUIRES:
- // Are we already in a transaction?
- if (transaction == null) {
- // No, create one
- if (timeout > 0) {
- manager.setTransactionTimeout(timeout);
- }
- manager.begin();
- m_owned.put(Thread.currentThread(), manager.getTransaction());
- } else {
- // Add the transaction to the transaction list
- handler.addTransaction(transaction);
- }
- break;
- case MANDATORY:
- if (transaction == null) {
- // Error
- throw new IllegalStateException("The method " + method + " must be called inside a transaction");
- } else {
- // Add the transaction to the transaction list
- handler.addTransaction(transaction);
- }
- break;
- case SUPPORTED:
- // if transaction != null, register the callback, else do nothing
- if (transaction != null) {
- handler.addTransaction(transaction);
- } // Else do nothing.
- break;
- case NOT_SUPPORTED:
- // Do nothing.
- break;
- case NEVER:
- if (transaction != null) {
- throw new IllegalStateException("The method " + method + " must never be called inside a transaction");
- }
- break;
- case REQUIRES_NEW:
- if (transaction == null) {
- // No current transaction, Just creates a new one
- if (timeout > 0) {
- manager.setTransactionTimeout(timeout);
- }
- manager.begin();
- m_owned.put(Thread.currentThread(), manager.getTransaction());
- } else {
- if (suspended == null) {
- suspended = manager.suspend();
- if (timeout > 0) {
- manager.setTransactionTimeout(timeout);
- }
- manager.begin();
- m_owned.put(Thread.currentThread(), manager.getTransaction());
- } else {
- throw new IllegalStateException("The method " + method + " requires to suspend a second times a transaction");
- }
- }
- break;
- default:
- throw new UnsupportedOperationException("Unknown or unsupported propagation policy for " + method + " :" + propagation);
-
- }
- }
-
- public void onExit() throws SecurityException, HeuristicMixedException, HeuristicRollbackException, SystemException, InvalidTransactionException, IllegalStateException {
- switch (propagation) {
- case REQUIRES:
- // Are we the owner of the transaction?
- Transaction transaction = m_owned.get(Thread.currentThread());
- if (transaction != null) { // Owner.
- try {
- transaction.commit(); // Commit the transaction
- m_owned.remove(Thread.currentThread());
- handler.transactionCommitted(transaction); // Manage potential notification.
- } catch ( RollbackException e) {
- m_owned.remove(Thread.currentThread());
- // The transaction was rolledback
- if (exceptionOnRollback) {
- throw new IllegalStateException("The transaction was rolled back : " + e.getMessage());
- }
- handler.transactionRolledback(transaction); // Manage potential notification.
- }
- } // Else wait for commit.
- break;
- case MANDATORY:
- // We are never the owner, so just exits the transaction.
- break;
- case SUPPORTED:
- // Do nothing.
- break;
- case NOT_SUPPORTED:
- // Do nothing.
- break;
- case NEVER:
- // Do nothing.
- break;
- case REQUIRES_NEW:
- // We're necessary the owner.
- transaction = m_owned.get(Thread.currentThread());
- if (transaction == null) {
- throw new RuntimeException("Cannot apply the REQUIRES NEW propagation, we're not the transaction owner!");
- }
- try {
- transaction.commit(); // Commit the transaction
- m_owned.remove(Thread.currentThread());
- handler.transactionCommitted(transaction); // Manage potential notification.
- if (suspended != null) {
- manager.suspend(); // suspend the completed transaction.
- manager.resume(suspended);
- suspended = null;
- }
- } catch ( RollbackException e) { // The transaction was rolledback rather than committed
- m_owned.remove(Thread.currentThread());
- if (suspended != null) {
- manager.suspend(); // suspend the completed transaction.
- manager.resume(suspended); // The resume transaction is not rolledback, they are independent.
- suspended = null;
- }
- // The transaction was rolledback
- if (exceptionOnRollback) {
- throw new IllegalStateException("The transaction was rolled back : " + e.getMessage());
- }
- handler.transactionRolledback(transaction); // Manage potential notification.
- }
- break;
- default:
- throw new UnsupportedOperationException("Unknown or unsupported propagation policy for " + method + " :" + propagation);
-
- }
- }
-
- public void onError(String exception) throws SystemException {
- TransactionManager manager = null;
- synchronized (this) {
- if (this.manager != null) {
- manager = this.manager; // Stack confinement
- } else {
- return; // Nothing can be done...
- }
- }
-
- // is the error something to exclude, and are we inside the transaction (owner or participant)?
- if (! exceptions.contains(exception)) {
- Transaction tr = manager.getTransaction();
- if (m_owned.containsValue(tr) || handler.getTransactions().contains(tr)) {
- // Set the transaction to rollback only
- manager.getTransaction().setRollbackOnly();
- }
- }
- }
-
- public void onEntry(Object o, Member member, Object[] objects) {
- try {
- onEntry();
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage());
- }
-
- }
-
- public void onError(Object o, Member member, Throwable throwable) {
- try {
- throwable.printStackTrace();
-
- onError(throwable.getClass().getName());
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage());
- }
- }
-
- public void onExit(Object o, Member member, Object o1) {
- // Wait for on finally.
- }
-
- public void onFinally(Object o, Member member) {
- try {
- onExit();
- } catch (IllegalStateException e) {
- throw e;
- } catch (Exception e) {
- throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage());
- }
- }
-
- public void rollbackOwnedTransactions() {
- Iterator> entries = m_owned.entrySet().iterator();
- while(entries.hasNext()) {
- Entry entry = entries.next();
- try {
- entry.getValue().rollback();
- } catch (IllegalStateException e) {
- throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage());
- } catch (SystemException e) {
- throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage());
- }
- }
- m_owned.clear();
- }
-
-}
diff --git a/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml b/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml
deleted file mode 100644
index 8b91423259..0000000000
--- a/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/whiteboard/changelog.txt b/ipojo/handler/whiteboard/changelog.txt
deleted file mode 100644
index 01992b4bb1..0000000000
--- a/ipojo/handler/whiteboard/changelog.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Changes from 1.4.0 to 1.6.0
-----------------------------
-** Bug
- * [FELIX-2581] - White Board Pattern onActivate called before @Validate
-
-** Improvement
- * [FELIX-2624] - Support multiple whiteboards using annotations
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-944] - Fix white-board pattern handler symbolic name
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-673] - Provide OBR description to iPOJO bundles
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/handler/whiteboard/pom.xml b/ipojo/handler/whiteboard/pom.xml
deleted file mode 100644
index 7ee3d578b8..0000000000
--- a/ipojo/handler/whiteboard/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../pom/pom.xml
-
- 4.0.0
- org.apache.felix.ipojo.handler.whiteboard-handler-project
- 1.6.1-SNAPSHOT
- Apache Felix iPOJO Whiteboard Handler Project
- pom
-
-
- whiteboard-handler
- whiteboard-handler-it
-
-
-
-
-
- src/main/resources
-
-
- .
- META-INF
-
- LICENSE*
- NOTICE*
- DEPENDENCIES*
-
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- make-assembly
- package
-
- single
-
-
-
- project
-
-
- false
-
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- attach-assemblies
- package
-
- attach-artifact
-
-
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz
-
- project
- tar.gz
-
-
-
- ${project.build.directory}/${project.artifactId}-${project.version}-project.zip
-
- project
- zip
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 5748e9cd4e..0000000000
--- a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,12 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
-
diff --git a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml
deleted file mode 100644
index 0ef84a6ffe..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml
+++ /dev/null
@@ -1,385 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
- ../../../../pom/pom.xml
-
-
- 4.0.0
- pom
- Apache Felix iPOJO Whiteboard Handler - Integration Test
- org.apache.felix.ipojo.handler.whiteboard-it
- 1.6.1-SNAPSHOT
-
-
- 3.0.0
- 1.5.1
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.whiteboard
- ${project.version}
-
-
- org.osgi
- org.osgi.compendium
-
-
- org.osgi
- org.osgi.core
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.6
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
-
- ch.qos.logback
- logback-core
- 1.5.34
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.0
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
-
-
-
- junit
- junit
- 4.13.1
- test
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.2
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 2.5.1
-
- 1.6
- 1.6
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
-
-
-
-
-
-
-
-
- test
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- regular
-
- run
-
-
-
- felix
-
- ${project.build.directory}/regular
-
-
-
-
-
-
-
-
-
- test-all
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 1.8
-
- true
-
- clean
- test
-
- true
-
-
-
- equinox-native
-
- run
-
-
-
- equinox
-
- ${project.build.directory}/equinox-native
-
-
-
-
- felix-native
-
- run
-
-
-
- felix
-
- ${project.build.directory}/felix-native
-
-
-
- knopflerfish-native
-
- run
-
-
-
- knopflerfish
-
- ${project.build.directory}/knopflerfish-native
-
-
-
-
-
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- http://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- 5.2.0
- test
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- 3.8.1.v20120830-144521
- test
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.2.0
- test
-
-
-
-
-
-
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml
deleted file mode 100644
index d9fbae776b..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- 4.0.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.whiteboard-it
- 1.6.1-SNAPSHOT
- ../../../pom.xml
-
-
-
- ipojo-whiteboard-integration-test
- ${project.artifactId}
-
-
-
- org.osgi
- org.osgi.compendium
- 4.2.0
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- 1.8.6
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java
deleted file mode 100644
index 1739528a62..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.whiteboard.components;
-
-import org.apache.felix.ipojo.handler.whiteboard.services.FooService;
-
-public class FooProvider implements FooService {
-
- public String foo;
-
- public void foo() {
- if (foo.equals("foo")) {
- foo = "bar";
- } else {
- foo = "foo";
- }
- }
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java
deleted file mode 100644
index a2c80d2a5e..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.whiteboard.components;
-
-import org.apache.felix.ipojo.handler.whiteboard.services.Observable;
-import org.osgi.framework.ServiceReference;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class FooWhiteBoardPattern implements Observable {
-
- List list = new ArrayList();
- int modifications = 0;
-
- long validate_time = 0;
- long first_arrival_time = 0;
- long first_departure_time = 0;
- long invalidate_time = 0;
-
- public void onArrival(ServiceReference ref) {
- if (first_arrival_time == 0) {
- first_arrival_time = System.currentTimeMillis();
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) { }
- }
- list.add(ref);
- }
-
- public void onDeparture(ServiceReference ref) {
- list.remove(ref);
- if (first_departure_time == 0) {
- first_departure_time = System.currentTimeMillis();
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) { }
- }
- }
-
- public void onModification(ServiceReference ref) {
- modifications = modifications + 1;
- }
-
- public Map getObservations() {
- Map map = new HashMap();
- map.put("list", list);
- map.put("modifications", new Integer(modifications));
- map.put("validate", new Long(validate_time));
- map.put("invalidate", new Long(invalidate_time));
- map.put("arrival", new Long(first_arrival_time));
- map.put("departure", new Long(first_departure_time));
- return map;
- }
-
- public void start() {
- if (validate_time == 0) {
- validate_time = System.currentTimeMillis();
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) { }
- }
- }
-
- public void stop() {
- if (invalidate_time == 0) {
- invalidate_time = System.currentTimeMillis();
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) { }
- }
- }
-
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java
deleted file mode 100644
index 17cc02adbb..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.whiteboard.services;
-
-public interface FooService {
-
- public void foo();
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java
deleted file mode 100644
index 084ebdbbc0..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.whiteboard.services;
-
-import java.util.Map;
-
-public interface Observable {
-
- public Map getObservations();
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml
deleted file mode 100644
index f294aa604a..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java
deleted file mode 100644
index e5c6725023..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.whiteboard.test;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.options.CompositeOption;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.ow2.chameleon.testing.helpers.IPOJOHelper;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-/**
- * Bootstrap the test from this project
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class Common {
-
- @Inject
- BundleContext bc;
-
- OSGiHelper osgiHelper;
- IPOJOHelper ipojoHelper;
-
- Bundle testedBundle;
-
- @Configuration
- public Option[] config() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.DEBUG);
-
- return options(
- cleanCaches(),
- ipojoBundles(),
- junitBundles(),
- testedBundle(),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- public static Option junitAndMockitoBundles() {
- return new DefaultCompositeOption(
- // Repository required to load harmcrest (OSGi-fied version).
- repository("http://repository.springsource.com/maven/bundles/external").id(
- "com.springsource.repository.bundles.external"),
-
- // Hamcrest with a version matching the range expected by Mockito
- mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"),
-
- // Mockito core does not includes Hamcrest
- mavenBundle("org.mockito", "mockito-core", "1.9.5"),
-
- // Objenesis with a version matching the range expected by Mockito
- wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2"))
- .exports("*;version=1.2"),
-
- // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of
- // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets
- // resolved correctly.
- CoreOptions.junitBundles(),
-
- /*
- * Felix has implicit boot delegation enabled by default. It conflicts with Mockito:
- * java.lang.LinkageError: loader constraint violation in interface itable initialization:
- * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc
- * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader
- * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class,
- * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader
- * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface
- * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/
- * proxy/Callback used in the signature
- *
- * So we disable the bootdelegation. this property has no effect on the other OSGi implementation.
- */
- frameworkProperty("felix.bootdelegation.implicit").value("false")
- );
- }
-
- @Before
- public void commonSetUp() {
- osgiHelper = new OSGiHelper(bc);
- ipojoHelper = new IPOJOHelper(bc);
-
- testedBundle = osgiHelper.getBundle("test.bundle");
-
- // Dump OSGi Framework information
- String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR);
- if (vendor == null) {
- vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME);
- }
- String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION);
- System.out.println("OSGi Framework : " + vendor + " - " + version);
- }
-
- @After
- public void commonTearDown() {
- ipojoHelper.dispose();
- osgiHelper.dispose();
- }
-
- public static CompositeOption ipojoBundles() {
- return new DefaultCompositeOption(
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- // The tested handler
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.whiteboard").versionAsInProject()
- );
- }
-
- public Option testedBundle() throws MalformedURLException {
- File out = new File("target/tested/bundle.jar");
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List services = new ArrayList();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getName().endsWith("services") || file.getName().endsWith("service")) {
- services.add(file);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- tested.add(path, file.toURI().toURL());
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- String export = "";
- for (File file : services) {
- if (export.length() > 0) { export += ", "; }
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- export += packageName;
- }
-
- System.out.println("Exported packages : " + export);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
- //.set(Constants.IMPORT_PACKAGE, "*")
- .set(Constants.EXPORT_PACKAGE, export)
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- FileUtils.copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
- public void assertContains(String s, String[] arrays, String object) {
- for (String suspect : arrays) {
- if (object.equals(suspect)) {
- return;
- }
- }
- fail("Assertion failed : " + s);
- }
-
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java
deleted file mode 100644
index ae8e9c251b..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * 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.whiteboard.test;
-
-import org.apache.felix.ipojo.*;
-import org.apache.felix.ipojo.handler.whiteboard.services.FooService;
-import org.apache.felix.ipojo.handler.whiteboard.services.Observable;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.junit.Assert.*;
-
-public class TestWhiteboardPatternHandler extends Common {
-
- Factory provFactory;
- Factory factory, factory2, factory3, factory4;
-
- @Before
- public void setUp() {
- provFactory = ipojoHelper.getFactory("fooprovider");
- factory = ipojoHelper.getFactory("under-providers");
- factory2 = ipojoHelper.getFactory("under-properties");
- factory3 = ipojoHelper.getFactory("under-providers-lifecycle");
- factory4 = ipojoHelper.getFactory("under-providers-2");
- }
-
- @Test
- public void testServiceProviders() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- ComponentInstance ci = factory.createComponentInstance(new Properties());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName());
- assertNotNull("Check Observable availability", ref);
- Observable obs = (Observable) osgiHelper.getServiceObject(ref);
-
- Map map = obs.getObservations();
- assertEquals("Check empty list", ((List) map.get("list")).size(), 0);
-
- Properties p1 = new Properties();
- p1.put("foo", "foo");
- ComponentInstance prov1 = provFactory.createComponentInstance(p1);
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
-
- Properties p2 = new Properties();
- p2.put("foo", "foo");
- ComponentInstance prov2 = provFactory.createComponentInstance(p2);
-
- map = obs.getObservations();
- assertEquals("Check list #2", ((List) map.get("list")).size(), 2);
-
- prov1.stop();
-
- map = obs.getObservations();
- assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov2.stop();
-
- map = obs.getObservations();
- assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0);
-
- prov2.start();
-
- map = obs.getObservations();
- assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov1.start();
-
- map = obs.getObservations();
- assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2);
-
- prov1.dispose();
-
- map = obs.getObservations();
- assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov2.dispose();
-
- map = obs.getObservations();
- assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0);
-
- bc.ungetService(ref);
- ci.dispose();
- }
-
- @Test
- public void testPropertiesProviders() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- ComponentInstance ci = factory2.createComponentInstance(new Properties());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName());
- assertNotNull("Check Observable availability", ref);
- Observable obs = (Observable) osgiHelper.getServiceObject(ref);
-
- Map map = obs.getObservations();
- assertEquals("Check empty list", ((List) map.get("list")).size(), 0);
-
- Properties p1 = new Properties();
- p1.put("foo", "foo");
- ComponentInstance prov1 = provFactory.createComponentInstance(p1);
- ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1.getInstanceName());
- FooService fs1 = (FooService) osgiHelper.getServiceObject(ref1);
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
-
- Properties p2 = new Properties();
- p2.put("foo", "foo");
- ComponentInstance prov2 = provFactory.createComponentInstance(p2);
- ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov2.getInstanceName());
- FooService fs2 = (FooService) osgiHelper.getServiceObject(ref2);
-
- map = obs.getObservations();
- assertEquals("Check list #2", ((List) map.get("list")).size(), 2);
-
- fs1.foo();
-
- map = obs.getObservations();
- assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1);
-
- fs2.foo();
-
- map = obs.getObservations();
- assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0);
-
- fs2.foo();
-
- map = obs.getObservations();
- assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1);
-
- fs1.foo();
-
- map = obs.getObservations();
- assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2);
-
- prov1.dispose();
-
- map = obs.getObservations();
- assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov2.dispose();
-
- map = obs.getObservations();
- assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0);
-
- bc.ungetService(ref1);
- bc.ungetService(ref2);
- bc.ungetService(ref);
- ci.dispose();
- }
-
- @Test
- public void testModifications() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- ComponentInstance ci = factory.createComponentInstance(new Properties());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName());
- assertNotNull("Check Observable availability", ref);
- Observable obs = (Observable) osgiHelper.getServiceObject(ref);
-
- Map map = obs.getObservations();
- assertEquals("Check empty list", ((List) map.get("list")).size(), 0);
-
- Properties p1 = new Properties();
- p1.put("foo", "foo");
- ComponentInstance prov1 = provFactory.createComponentInstance(p1);
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
- assertEquals("Check modification #0", ((Integer) map.get("modifications")).intValue(), 0);
-
- ServiceReference ref2 = osgiHelper.getServiceReference(FooService.class.getName(), null);
- assertNotNull("Check FooService availability", ref2);
-
- FooService fs = (FooService) osgiHelper.getServiceObject(ref2);
- fs.foo();
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
- assertEquals("Check modification #1 (" + map.get("modifications") + ")", ((Integer) map.get("modifications")).intValue(), 1);
-
- fs.foo();
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
- assertEquals("Check modification #2", ((Integer) map.get("modifications")).intValue(), 2);
-
- prov1.dispose();
- map = obs.getObservations();
- assertEquals("Check list #0", ((List) map.get("list")).size(), 0);
- assertEquals("Check modification #2", ((Integer) map.get("modifications")).intValue(), 2);
-
- bc.ungetService(ref);
- bc.ungetService(ref2);
- ci.dispose();
- }
-
- @Test
- public void testLifecycleCompliance() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- // First expose a service.
- Properties p1 = new Properties();
- p1.put("foo", "foo");
- ComponentInstance prov1 = provFactory.createComponentInstance(p1);
-
- ComponentInstance ci = factory3.createComponentInstance(new Properties());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName());
- assertNotNull("Check Observable availability", ref);
- Observable obs = (Observable) osgiHelper.getServiceObject(ref);
-
- Map map = obs.getObservations();
- // Check time
- Long validate = (Long) map.get("validate");
- Long arrival = (Long) map.get("arrival");
-
- // Validate must be call before.
- assertTrue(validate + " > " + arrival, validate < arrival);
-
- prov1.dispose();
- ci.dispose();
-
- }
-
- @Test
- public void testServiceProvidersWhiteWhiteboards() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
- ComponentInstance ci = factory4.createComponentInstance(new Properties());
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName());
- assertNotNull("Check Observable availability", ref);
- Observable obs = (Observable) osgiHelper.getServiceObject(ref);
-
- Map map = obs.getObservations();
- assertEquals("Check empty list", ((List) map.get("list")).size(), 0);
-
- Properties p1 = new Properties();
- p1.put("foo", "foo");
- ComponentInstance prov1 = provFactory.createComponentInstance(p1);
-
- map = obs.getObservations();
- assertEquals("Check list #1", ((List) map.get("list")).size(), 1);
-
- Properties p2 = new Properties();
- p2.put("foo", "foo");
- ComponentInstance prov2 = provFactory.createComponentInstance(p2);
-
- map = obs.getObservations();
- assertEquals("Check list #2", ((List) map.get("list")).size(), 2);
-
- prov1.stop();
-
- map = obs.getObservations();
- assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov2.stop();
-
- map = obs.getObservations();
- assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0);
-
- prov2.start();
-
- map = obs.getObservations();
- assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov1.start();
-
- map = obs.getObservations();
- assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2);
-
- prov1.dispose();
-
- map = obs.getObservations();
- assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1);
-
- prov2.dispose();
-
- map = obs.getObservations();
- assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0);
-
- bc.ungetService(ref);
- ci.dispose();
- }
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt b/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt
deleted file mode 100644
index 01992b4bb1..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Changes from 1.4.0 to 1.6.0
-----------------------------
-** Bug
- * [FELIX-2581] - White Board Pattern onActivate called before @Validate
-
-** Improvement
- * [FELIX-2624] - Support multiple whiteboards using annotations
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-944] - Fix white-board pattern handler symbolic name
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-673] - Provide OBR description to iPOJO bundles
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml b/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml
deleted file mode 100644
index 88eec46852..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/obr.xml b/ipojo/handler/whiteboard/whiteboard-handler/obr.xml
deleted file mode 100644
index 2da24fa27a..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/obr.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler/pom.xml
deleted file mode 100644
index e6bf2ed888..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/pom.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Apache Felix iPOJO White Board Pattern Handler
- org.apache.felix.ipojo.handler.whiteboard
- org.apache.felix
- 1.6.1-SNAPSHOT
-
-
- iPOJO extension to easily implement a white-board pattern (host).
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/white-board-pattern-handler.html
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.6.4
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${project.name}
- ${project.artifactId}
- The Apache Software Foundation
- iPOJO White-Board Pattern Handler
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/white-board-pattern-handler.html
-
- org.apache.felix.ipojo.handler.wbp
-
- ${project.name}
-
-
-
-
- org.apache.felix
- maven-ipojo-plugin
- 1.6.0
-
-
-
- ipojo-bundle
-
-
- metadata.xml
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
-
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 1c61161053..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java b/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java
deleted file mode 100644
index 8e0da46f34..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * 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.wbp;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.util.Callback;
-import org.apache.felix.ipojo.util.Tracker;
-import org.apache.felix.ipojo.util.TrackerCustomizer;
-import org.osgi.framework.Filter;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Manage a white board pattern.
- * @author Felix Project Team
- */
-public class WhiteBoardManager implements TrackerCustomizer {
-
- /**
- * The monitored filter.
- */
- private Filter m_filter;
-
- /**
- * The onArrival method.
- */
- private Callback m_onArrival;
-
- /**
- * The onDeparture method.
- */
- private Callback m_onDeparture;
-
- /**
- * The onModify method.
- */
- private Callback m_onModification;
-
- /**
- * The service tracker.
- */
- private Tracker m_tracker;
-
- /**
- * The attached handler.
- */
- private PrimitiveHandler m_handler;
-
- /**
- * Constructor.
- * @param handler the attached handler
- * @param filter the monitored filter
- * @param bind the onArrival method
- * @param unbind the onDeparture method
- * @param modification the onModify method
- */
- public WhiteBoardManager(WhiteBoardPatternHandler handler, Filter filter, String bind, String unbind, String modification) {
- m_handler = handler;
- m_onArrival = new Callback(bind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
- m_onDeparture = new Callback(unbind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
- if (modification != null) {
- m_onModification = new Callback(modification, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager());
- }
- m_filter = filter;
- m_tracker = new Tracker(handler.getInstanceManager().getContext(), m_filter, this);
- }
-
-
-
- /**
- * Opens the tracker.
- */
- public void start() {
- // Calling several times open is no-effect.
- m_tracker.open();
- }
-
- /**
- * Closes the tracker.
- */
- public void stop() {
- m_tracker.close();
- }
-
- /**
- * A new service was added to the tracker.
- * @param arg0 the service reference.
- * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference)
- */
- public void addedService(ServiceReference arg0) {
- try {
- m_onArrival.call(new Object[] {arg0});
- } catch (NoSuchMethodException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e);
- m_handler.getInstanceManager().stop();
- } catch (IllegalAccessException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be invoked", e);
- m_handler.getInstanceManager().stop();
- } catch (InvocationTargetException e) {
- m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e
- .getTargetException());
- }
- }
-
- /**
- * A new service is detected.
- * @param arg0 the service reference
- * @return {@code true} to add the service.
- * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
- */
- public boolean addingService(ServiceReference arg0) {
- return true;
- }
-
- /**
- * An existing service was modified.
- * @param arg0 the service reference
- * @param arg1 the service object (if already get)
- * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object)
- */
- public void modifiedService(ServiceReference arg0, Object arg1) {
- if (m_onModification != null) {
- try {
- m_onModification.call(new Object[] {arg0});
- } catch (NoSuchMethodException e) {
- m_handler.error("The onModification method " + m_onModification.getMethod() + " does not exist in the class", e);
- m_handler.getInstanceManager().stop();
- } catch (IllegalAccessException e) {
- m_handler.error("The onModification method " + m_onModification.getMethod() + " cannot be invoked", e);
- m_handler.getInstanceManager().stop();
- } catch (InvocationTargetException e) {
- m_handler.error("The onModification method " + m_onModification.getMethod() + " has thrown an exception", e.getTargetException());
- }
- }
- }
-
- /**
- * A service disappears.
- * @param arg0 the service reference
- * @param arg1 the service object (if already get)
- * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object)
- */
- public void removedService(ServiceReference arg0, Object arg1) {
- try {
- m_onDeparture.call(new Object[] {arg0});
- } catch (NoSuchMethodException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e);
- m_handler.getInstanceManager().stop();
- } catch (IllegalAccessException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be invoked", e);
- m_handler.getInstanceManager().stop();
- } catch (InvocationTargetException e) {
- m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException());
- }
- }
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java b/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java
deleted file mode 100644
index 70a880e1fd..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.wbp;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.metadata.Element;
-import org.osgi.framework.InvalidSyntaxException;
-
-/**
- * White board pattern handler.
- * This handler aims to automate white board patterns by invoking callback when needed.
- * @author Felix Project Team
- */
-public class WhiteBoardPatternHandler extends PrimitiveHandler {
-
- /**
- * The handler namespace.
- */
- public static final String NAMESPACE = "org.apache.felix.ipojo.whiteboard";
-
- /**
- * The white board pattern to manage. By default just one.
- */
- private List m_managers = new ArrayList(1);
-
- /**
- * Configure method. Parses the metadata to analyze white-board-pattern elements.
- * @param elem the component type description
- * @param dict the instance description
- * @throws ConfigurationException if the description is not valid.
- * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)
- */
- public void configure(Element elem, Dictionary dict) throws ConfigurationException {
-
- // There is two way to configure the handler :
- // - the wbp elements
- // - the whiteboards elements
- Element[] elems = elem.getElements("wbp", NAMESPACE);
-
- if (elems == null || elems.length == 0) {
- // Alternative way
- Element[] whiteboards = elem.getElements("whiteboards", NAMESPACE);
- if (whiteboards == null) {
- throw new ConfigurationException("Cannot configure the whiteboard pattern handler - no suitable configuration found");
- } else {
- elems = whiteboards[0].getElements("wbp", NAMESPACE);
- }
- }
-
- // Last check.
- if (elems == null) {
- throw new ConfigurationException("Cannot configure the whiteboard pattern handler - no suitable configuration found");
- }
-
- for (int i = 0; i < elems.length; i++) {
- String filter = elems[i].getAttribute("filter");
- String onArrival = elems[i].getAttribute("onArrival");
- String onDeparture = elems[i].getAttribute("onDeparture");
- String onModification = elems[i].getAttribute("onModification");
-
- if (filter == null) {
- throw new ConfigurationException("The white board pattern element requires a filter attribute");
- }
- if (onArrival == null || onDeparture == null) {
- throw new ConfigurationException("The white board pattern element requires the onArrival and onDeparture attributes");
- }
-
- try {
- WhiteBoardManager wbm = new WhiteBoardManager(this, getInstanceManager().getContext().createFilter(filter), onArrival, onDeparture, onModification);
- m_managers.add(wbm);
- } catch (InvalidSyntaxException e) {
- throw new ConfigurationException("The filter " + filter + " is invalid : " + e);
- }
- }
-
- }
-
- /**
- * Start method.
- * @see org.apache.felix.ipojo.Handler#start()
- */
- public void start() {
- }
-
-
-
- /**
- * Start managers if we're valid.
- * @see org.apache.felix.ipojo.Handler#stateChanged(int)
- */
- public void stateChanged(int state) {
- if (state == ComponentInstance.VALID) {
- for (int i = 0; i < m_managers.size(); i++) {
- ((WhiteBoardManager) m_managers.get(i)).start();
- }
- }
- }
-
- /**
- * Stop method. Stops managers.
- * @see org.apache.felix.ipojo.Handler#stop()
- */
- public void stop() {
- for (int i = 0; i < m_managers.size(); i++) {
- ((WhiteBoardManager) m_managers.get(i)).stop();
- }
- }
-
-}
diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd b/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd
deleted file mode 100644
index f02afde0a1..0000000000
--- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
- Description of the white-board architecture.
-
-
-
- Declaring the method to invoke when a matching service arrives.
-
-
-
- Declaring the method to invoke when a matching service leaves.
-
-
-
- Method called when an injected service reference is modified but stills valid against the filter.
-
-
-
- Filter use to discover matching filter.
-
-
-
\ No newline at end of file
diff --git a/ipojo/junit4osgi/felix-command/LICENSE b/ipojo/junit4osgi/felix-command/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/ipojo/junit4osgi/felix-command/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/ipojo/junit4osgi/felix-command/NOTICE b/ipojo/junit4osgi/felix-command/NOTICE
deleted file mode 100644
index 96ef392c6f..0000000000
--- a/ipojo/junit4osgi/felix-command/NOTICE
+++ /dev/null
@@ -1,28 +0,0 @@
-Apache Felix iPOJO junit4osgi Felix Command
-Copyright 2008-2009 The Apache Software Foundation
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-II. Used Software
-
-This product uses software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2007).
-Licensed under the Apache License 2.0.
-
-This product uses software developed by
-Junit project (http://junit.org)
-Licensed under Common Public License 1.0.
-
-III. License Summary
-- Apache License 2.0
-- Common Public License 1.0
-
diff --git a/ipojo/junit4osgi/felix-command/doc/changelog.txt b/ipojo/junit4osgi/felix-command/doc/changelog.txt
deleted file mode 100644
index 524e88b133..0000000000
--- a/ipojo/junit4osgi/felix-command/doc/changelog.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Version 1.0.0
--------------
- * Initial release
\ No newline at end of file
diff --git a/ipojo/junit4osgi/felix-command/metadata.xml b/ipojo/junit4osgi/felix-command/metadata.xml
deleted file mode 100644
index b1524c53c2..0000000000
--- a/ipojo/junit4osgi/felix-command/metadata.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/junit4osgi/felix-command/pom.xml b/ipojo/junit4osgi/felix-command/pom.xml
deleted file mode 100644
index 4e9dca1344..0000000000
--- a/ipojo/junit4osgi/felix-command/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Junit4Osgi-Felix-Command
-
- org.apache.felix.ipojo.junit4osgi.felix-command
-
- 1.1.0-SNAPSHOT
-
-
- ${project.groupId}
- org.apache.felix.ipojo.junit4osgi
- 1.1.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.shell
- 1.0.2
-
-
- junit
- junit
- 3.8.1
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.4
- 1.4
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.5
- true
-
-
- Apache Felix iPOJO OSGi Junit Runner - Felix Command
-
- ${project.artifactId}
- org.apache.felix.ipojo.junit4osgi.command
-
- META-INF/LICENSE=LICENSE,
- META-INF/NOTICE=NOTICE
- <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true
-
-
-
-
- org.apache.felix
- bnd-ipojo-plugin
- 1.0.0-SNAPSHOT
-
-
-
-
- org.codehaus.mojo
- rat-maven-plugin
-
- false
- true
- true
-
- doc/*
- maven-eclipse.xml
- .checkstyle
- .externalToolBuilders/*
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
-
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
-
diff --git a/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java b/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java
deleted file mode 100644
index da52feb306..0000000000
--- a/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.junit4osgi.command;
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import junit.framework.TestCase;
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
-import org.apache.felix.shell.Command;
-
-/**
- * Felix shell command. Allow to run tests.
- * @author Felix Project Team
- */
-public class JunitCommand implements Command {
-
- /**
- * OSGi Junit Runner service.
- */
- private OSGiJunitRunner m_runner;
-
- /**
- * Gets the Test names.
- * @param list the list of test
- * @return the list of test names.
- */
- private List getNamesFromTests(List list) {
- List names = new ArrayList(list.size());
- for (int i = 0; i < list.size(); i++) {
- if (list.get(i) instanceof TestCase) {
- names.add(((TestCase) list.get(i)).getName());
- }
- if (list.get(i) instanceof TestSuite) {
- String name = ((TestSuite) list.get(i)).getName();
- if (name == null) {
- name = ((TestSuite) list.get(i)).toString();
- }
- names.add(name);
- }
- }
- return names;
- }
-
- /**
- * Executes the command.
- * @param line the command line
- * @param out the output stream
- * @param err the error stream
- * @see org.apache.felix.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream)
- */
- public void execute(String line, PrintStream out, PrintStream err) {
- line = line.substring(getName().length()).trim();
- List tr = null;
- if (line.equals("all")) {
- if (m_runner.getTests() == null) {
- err.println("No tests to execute");
- return;
- } else {
- out.println("Executing " + getNamesFromTests(m_runner.getTests()));
- tr = m_runner.run();
- }
- } else {
- try {
- Long bundleId = new Long(line);
- if (m_runner.getTests(bundleId.longValue()) == null) {
- err.println("No tests to execute");
- return;
- } else {
- out.println("Executing " + getNamesFromTests(m_runner.getTests(bundleId.longValue())));
- tr = m_runner.run(bundleId.longValue());
- }
- } catch (NumberFormatException e) {
- err.println("Unable to parse id " + line);
- return;
- }
- }
-
- ListIterator it = tr.listIterator();
- while (it.hasNext()) {
- TestResult result = (TestResult) it.next();
- if (result.failureCount() != 0) {
- TestFailure fail = (TestFailure) result.failures().nextElement();
- out.println(fail.trace());
- return;
- }
- }
-
- }
-
- /**
- * Gets the command name.
- * @return "junit"
- * @see org.apache.felix.shell.Command#getName()
- */
- public String getName() {
- return "junit";
- }
-
- /**
- * Gets a small description of the command.
- * @return "launch junit tests"
- * @see org.apache.felix.shell.Command#getShortDescription()
- */
- public String getShortDescription() {
- return "launch junit tests";
- }
-
- /**
- * Gets command usage.
- * @return the command usage.
- * @see org.apache.felix.shell.Command#getUsage()
- */
- public String getUsage() {
- return "junit | junit all";
- }
-
-}
diff --git a/ipojo/junit4osgi/immediate-launcher/LICENSE b/ipojo/junit4osgi/immediate-launcher/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/ipojo/junit4osgi/immediate-launcher/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/ipojo/junit4osgi/immediate-launcher/NOTICE b/ipojo/junit4osgi/immediate-launcher/NOTICE
deleted file mode 100644
index 986cc712d6..0000000000
--- a/ipojo/junit4osgi/immediate-launcher/NOTICE
+++ /dev/null
@@ -1,27 +0,0 @@
-Apache Felix iPOJO junit4osgi Immediate Runner
-Copyright 2008-2009 The Apache Software Foundation
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-II. Used Software
-
-This product uses software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2007).
-Licensed under the Apache License 2.0.
-
-This product uses software developed by
-Junit project (http://junit.org)
-Licensed under Common Public License 1.0.
-
-III. License Summary
-- Apache License 2.0
-- Common Public License 1.0
diff --git a/ipojo/junit4osgi/immediate-launcher/metadata.xml b/ipojo/junit4osgi/immediate-launcher/metadata.xml
deleted file mode 100644
index 9f3da351bb..0000000000
--- a/ipojo/junit4osgi/immediate-launcher/metadata.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/junit4osgi/immediate-launcher/pom.xml b/ipojo/junit4osgi/immediate-launcher/pom.xml
deleted file mode 100644
index 771ddda465..0000000000
--- a/ipojo/junit4osgi/immediate-launcher/pom.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Junit4Osgi-Immediate-Runner
-
- org.apache.felix.ipojo.junit4osgi.immediate-runner
-
- 1.1.0-SNAPSHOT
-
-
- ${project.groupId}
- org.apache.felix.ipojo.junit4osgi
- 1.1.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.shell
- 1.0.2
-
-
- junit
- junit
- 3.8.1
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.5
- true
-
-
- Apache Felix iPOJO OSGi Junit Runner - Immediate Runner
-
- ${project.artifactId}
- org.apache.felix.ipojo.junit4osgi.command
-
- META-INF/LICENSE=LICENSE,
- META-INF/NOTICE=NOTICE
- <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true
-
-
-
-
- org.apache.felix
- bnd-ipojo-plugin
- 1.0.0-SNAPSHOT
-
-
-
-
- org.codehaus.mojo
- rat-maven-plugin
-
- false
- true
- true
-
- doc/*
- maven-eclipse.xml
- .checkstyle
- .externalToolBuilders/*
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
-
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
-
diff --git a/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java b/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java
deleted file mode 100644
index 1cc0a5960c..0000000000
--- a/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.junit4osgi.command;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
-
-/**
- * Junit Immediate runner.
- * Executes test when starts.
- * @author Felix Project Team
- */
-public class ImmediateRunner {
-
- /**
- * OSGi Junit Runner service.
- */
- private OSGiJunitRunner m_runner;
-
- /**
- * Start method.
- */
- public void start() {
- m_runner.run();
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/LICENSE b/ipojo/junit4osgi/junit4osgi/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/ipojo/junit4osgi/junit4osgi/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/ipojo/junit4osgi/junit4osgi/LICENSE.junit b/ipojo/junit4osgi/junit4osgi/LICENSE.junit
deleted file mode 100644
index 4fbc2f92b8..0000000000
--- a/ipojo/junit4osgi/junit4osgi/LICENSE.junit
+++ /dev/null
@@ -1,86 +0,0 @@
-Common Public License - v 1.0
-
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
- a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
- b) in the case of each subsequent Contributor:
-
- i) changes to the Program, and
-
- ii) additions to the Program;
-
- where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
-
-"Contributor" means any person or entity that distributes the Program.
-
-"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
-
-"Program" means the Contributions distributed in accordance with this Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
-
-2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
-
- b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
-
-3. REQUIREMENTS
-
-A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
-
- a) it complies with the terms and conditions of this Agreement; and
-
- b) its license agreement:
-
- i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
-
- ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
-
- iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
-
- iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
-
-When the Program is made available in source code form:
-
- a) it must be made available under this Agreement; and
-
- b) a copy of this Agreement must be included with each copy of the Program.
-
-Contributors may not remove or alter any copyright notices contained within the Program.
-
-Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
-
-If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
-
-This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
\ No newline at end of file
diff --git a/ipojo/junit4osgi/junit4osgi/NOTICE b/ipojo/junit4osgi/junit4osgi/NOTICE
deleted file mode 100644
index d696f410fe..0000000000
--- a/ipojo/junit4osgi/junit4osgi/NOTICE
+++ /dev/null
@@ -1,27 +0,0 @@
-Apache Felix iPOJO junit4osgi Framework
-Copyright 2008-2009 The Apache Software Foundation
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software developed by
-Junit project (http://junit.org)
-Licensed under Common Public License 1.0.
-
-II. Used Software
-
-This product uses software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2007).
-Licensed under the Apache License 2.0.
-
-III. License Summary
-- Apache License 2.0
-- Common Public License 1.0
diff --git a/ipojo/junit4osgi/junit4osgi/doc/changelog.txt b/ipojo/junit4osgi/junit4osgi/doc/changelog.txt
deleted file mode 100644
index 524e88b133..0000000000
--- a/ipojo/junit4osgi/junit4osgi/doc/changelog.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Version 1.0.0
--------------
- * Initial release
\ No newline at end of file
diff --git a/ipojo/junit4osgi/junit4osgi/metadata.xml b/ipojo/junit4osgi/junit4osgi/metadata.xml
deleted file mode 100644
index 045e20cf71..0000000000
--- a/ipojo/junit4osgi/junit4osgi/metadata.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/junit4osgi/junit4osgi/pom.xml b/ipojo/junit4osgi/junit4osgi/pom.xml
deleted file mode 100644
index e086c87fb9..0000000000
--- a/ipojo/junit4osgi/junit4osgi/pom.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Junit4Osgi
- org.apache.felix.ipojo.junit4osgi
- 1.1.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.8.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.metadata
- 1.4.0
-
-
- junit
- junit
- 3.8.1
-
-
- org.osgi
- org.osgi.core
- 4.2.0
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.4
- 1.4
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.5
- true
-
-
-
- Apache Felix iPOJO OSGi Junit Runner
-
-
- ${project.artifactId}
-
-
- org.apache.felix.ipojo.junit4osgi.impl,
- org.apache.felix.ipojo.junit4osgi.test,
-
-
- org.apache.felix.ipojo.junit4osgi,
- org.apache.felix.ipojo.junit4osgi.helpers,
- junit.*
-
- !javax.swing*, *
-
- org.apache.felix.ipojo.junit4osgi.test.TestTestCase,
- org.apache.felix.ipojo.junit4osgi.test.TestOSGiTestCase,
- org.apache.felix.ipojo.junit4osgi.test.TestTestSuite,
- org.apache.felix.ipojo.junit4osgi.test.TestOSGiTestSuite,
-
-
- META-INF/LICENSE=LICENSE,
- META-INF/LICENSE.junit=LICENSE.junit,
- META-INF/NOTICE=NOTICE
-
- <_plugin>
- org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true
-
-
-
-
-
- org.apache.felix
- bnd-ipojo-plugin
- 1.9.0-SNAPSHOT
-
-
-
-
-
- org.codehaus.mojo
- rat-maven-plugin
-
- false
- true
- true
-
- doc/*
- maven-eclipse.xml
- .checkstyle
- .externalToolBuilders/*
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
- error
-
-
-
-
-
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java
deleted file mode 100644
index 9909b6815c..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.junit4osgi;
-
-import org.osgi.framework.BundleContext;
-
-
-/**
- * Helper abstract class.
- * Helper objects aim to facilitate Test writing.
- * @author Felix Project Team
- */
-public abstract class Helper {
-
- /**
- * The bundle context.
- */
- protected BundleContext m_context;
-
- /**
- * The OSGi Test case.
- */
- protected OSGiTestCase m_testcase;
-
- /**
- * Creates a Helper.
- * Registers the helper.
- * Sub-classes must initialize the session.
- * @param tc the OSGi Test Case
- */
- public Helper(OSGiTestCase tc) {
- m_testcase = tc;
- m_context = m_testcase.getBundleContext();
- tc.addHelper(this);
- }
-
- /**
- * Rolls back the session.
- */
- public abstract void dispose();
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java
deleted file mode 100644
index 334e3114ae..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.junit4osgi;
-
-import java.io.PrintStream;
-import java.util.List;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-/**
- * OSGi Junit Runner.
- * @author Felix Project Team
- */
-public interface OSGiJunitRunner {
-
- /**
- * Set the output stream of the runner.
- * @param ps the print stream.
- */
- void setResultPrinter(PrintStream ps);
-
- /**
- * Run the tests.
- * @return the list of TestResult.
- */
- List/**/ run();
-
- /**
- * Run the tests from the given bundle.
- * @param bundleId the bundle id containing the tests.
- * @return the list of the test results.
- */
- List/**/ run(long bundleId);
-
- /**
- * Get the list of available test suites.
- * @return the list of Test objects.
- */
- List/**/ getTests();
-
- /**
- * Get the tests from the given bundle.
- * @param bundleId the bundle id.
- * @return the list of Test contained in the given bundle.
- */
- List/**/ getTests(long bundleId);
-
- /**
- * Run the given test.
- * @param test the test to execute.
- * @return the result.
- */
- TestResult run(Test test);
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java
deleted file mode 100644
index 9599974c48..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java
+++ /dev/null
@@ -1,782 +0,0 @@
-/*
- * 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.junit4osgi;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * OSGi Test Case.
- * Allows the injection of the bundle context.
- *
- * @author Felix Project Team
- */
-public class OSGiTestCase extends TestCase {
-
- /**
- * The bundle context.
- */
- protected BundleContext context;
-
- /**
- * List of get references.
- */
- private List m_references = new ArrayList();
-
- /**
- * List of helpers.
- */
- private List m_helpers = new ArrayList();
-
- /**
- * Gets the Bundle Context.
- * @return the bundle context.
- */
- public BundleContext getContext() {
- return context;
- }
-
- /**
- * Add an helper.
- * This method is called by the {@link Helper#Helper(OSGiTestCase)}
- * method.
- * @param helper the helper object.
- */
- public void addHelper(Helper helper) {
- m_helpers.add(helper);
- }
-
- /**
- * Extends runBare to release (unget) services after the teardown.
- * @throws Throwable when an error occurs.
- * @see junit.framework.TestCase#runBare()
- */
- public void runBare() throws Throwable {
- setUp();
- try {
- runTest();
- } finally {
- tearDown();
- // Stop Helpers
- for (int i = 0; i < m_helpers.size(); i++) {
- ((Helper) m_helpers.get(i)).dispose();
- }
- // Unget services
- for (int i = 0; i < m_references.size(); i++) {
- context.ungetService((ServiceReference) m_references.get(i));
- }
- m_references.clear();
- }
-
- }
-
- public void setBundleContext(BundleContext bc) {
- context = bc;
- }
-
- public BundleContext getBundleContext() {
- return context;
- }
-
- /**
- * Checks that the given string is contained in the given array.
- * @param message the assert point message
- * @param array the String array
- * @param txt the String to search
- */
- public static void assertContains(String message, String[] array, String txt) {
- for (int i = 0; i < array.length; i++) {
- if (array[i].equals(txt)) {
- return;
- }
- }
- fail(formatContainsMessage(message, array, txt));
- }
-
- /**
- * Checks that the given integer is contained in the given array.
- * @param message the assert point message
- * @param array the byte array
- * @param num the number to search
- */
- public static void assertContains(String message, byte[] array, int num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Byte[] bytes = new Byte[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Byte(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Integer(num)));
- }
-
- /**
- * Checks that the given integer is contained in the given array.
- * @param message the assert point message
- * @param array the short array
- * @param num the number to search
- */
- public static void assertContains(String message, short[] array, int num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Short[] bytes = new Short[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Short(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Integer(num)));
- }
-
- /**
- * Checks that the given integer is contained in the given array.
- * @param message the assert point message
- * @param array the integer array
- * @param num the number to search
- */
- public static void assertContains(String message, int[] array, int num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Integer[] bytes = new Integer[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Integer(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Integer(num)));
- }
-
- /**
- * Checks that the given long is contained in the given array.
- * @param message the assert point message
- * @param array the long array
- * @param num the number to search
- */
- public static void assertContains(String message, long[] array, long num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Long[] bytes = new Long[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Long(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Long(num)));
- }
-
- /**
- * Checks that the given float is contained in the given array.
- * @param message the assert point message
- * @param array the float array
- * @param num the number to search
- */
- public static void assertContains(String message, float[] array, float num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Float[] bytes = new Float[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Float(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Float(num)));
- }
-
- /**
- * Checks that the given double is contained in the given array.
- * @param message the assert point message
- * @param array the double array
- * @param num the number to search
- */
- public static void assertContains(String message, double[] array, double num) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == num) {
- return;
- }
- }
- Double[] bytes = new Double[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Double(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Double(num)));
- }
-
- /**
- * Checks that the given character is contained in the given array.
- * @param message the assert point message
- * @param array the character array
- * @param character the character to search
- */
- public static void assertContains(String message, char[] array, char character) {
- for (int i = 0; i < array.length; i++) {
- if (array[i] == character) {
- return;
- }
- }
- Character[] bytes = new Character[array.length];
- for (int i = 0; i < array.length; i++) {
- bytes[i] = new Character(array[i]);
- }
- fail(formatContainsMessage(message, bytes, new Character(character)));
- }
-
- /**
- * Asserts that two doubles are equal. If they are not an
- * AssertionFailedError is thrown with the given message.
- * @param message the assert point message
- * @param expected the expected double
- * @param actual the received double
- */
- public static void assertEquals(String message, double expected,
- double actual) {
- if (expected != actual) {
- fail(formatEqualsMessage(message, new Double(expected), new Double(
- actual)));
- }
- }
-
- /**
- * Asserts that two objects are not equal. If they are an
- * AssertionFailedError is thrown with the given message.
- * @param message the assert point message
- * @param o1 the unexpected object
- * @param o2 the received object
- */
- public static void assertNotEquals(String message, Object o1, Object o2) {
- if (o1.equals(o2)) {
- fail(formatNotEqualsMessage(message, o1, o2));
- }
- }
-
- /**
- * Checks that the given string is contained in the given array.
- * @param string the String to search
- * @param array the String array
- * @return true if the array contains the string
- */
- public static boolean contains(String string, String[] array) {
- for (int i = 0; array != null && i < array.length; i++) {
- if (array[i] != null && array[i].equals(string)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Checks that the given integer is contained in the given array.
- * @param value the number to search
- * @param array the integer array
- * @return true if the array contains the value
- */
- public static boolean contains(int value, int[] array) {
- for (int i = 0; array != null && i < array.length; i++) {
- if (array[i] == value) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Formats a failure message for 'equality' tests.
- * @param message the assertion point message
- * @param expected the expected value
- * @param actual the received value
- * @return the computed message
- */
- private static String formatEqualsMessage(String message, Object expected,
- Object actual) {
- String formatted = "";
- if (message != null) {
- formatted = message + " ";
- }
- return formatted + "expected:<" + expected + "> but was:<" + actual
- + ">";
- }
-
- /**
- * Formats a failure message for 'un-equality' tests.
- * @param message the assertion point message
- * @param o1 the unexpected value
- * @param o2 the received value
- * @return the computed message
- */
- private static String formatNotEqualsMessage(String message, Object o1,
- Object o2) {
- String formatted = "";
- if (message != null) {
- formatted = message + " ";
- }
- return formatted + "o1:<" + o1 + "> is equals to o2:<" + o2 + ">";
- }
-
- /**
- * Formats a failure message for 'contains' tests.
- * @param message the assertion point message
- * @param array the array
- * @param txt the looked value
- * @return the computed message
- */
- private static String formatContainsMessage(String message, Object[] array,
- Object txt) {
- String formatted = "";
- if (message != null) {
- formatted = message + " ";
- }
-
- String arr = null;
- for (int i = 0; i < array.length; i++) {
- if (arr == null) {
- arr = "[" + array[i];
- } else {
- arr += "," + array[i];
- }
- }
- arr += "]";
-
- return formatted + "array:" + arr + " does not contains:<" + txt + ">";
- }
-
- /**
- * Returns the service object of a service provided by the specified bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(Bundle bundle, String itf,
- String filter) {
- ServiceReference ref = getServiceReference(bundle, itf, filter);
- if (ref != null) {
- return bundle.getBundleContext().getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(Bundle bundle, String itf,
- String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = bundle.getBundleContext().getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the specified bundle, offering
- * the specified interface and matching the given filter. If no
- * service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @return true if the service is available, false
- * otherwise.
- */
- public boolean isServiceAvailable(String itf) {
- ServiceReference ref = getServiceReference(itf, null);
- return ref != null;
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param pid the service pid
- * @return true if the service is available, false
- * otherwise.
- */
- public boolean isServiceAvailableByPID(String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of the service provided by the specified
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(Bundle bundle,
- String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(bundle, itf, filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services provided in the
- * specified bundle, offering the specified interface and matching the given
- * filter.
- *
- * @param bundle the bundle from which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the specified bundle,
- * offering the specified interface and matching the given filter.
- * If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(Bundle bundle,
- String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = bundle.getBundleContext().getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service object of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object getServiceObject(String itf, String filter) {
- ServiceReference ref = getServiceReference(itf, filter);
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service object associated with this service reference.
- *
- * @param ref service reference
- * @return the service object.
- */
- public Object getServiceObject(ServiceReference ref) {
- if (ref != null) {
- m_references.add(ref);
- return context.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the local bundle, offering the
- * specified interface and matching the given filter.
- */
- public Object[] getServiceObjects(String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(itf, filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- m_references.add(refs[i]);
- list[i] = context.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf, String filter) {
- return getServiceReference(context.getBundle(), itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided offering the
- * specified interface.
- *
- * @param itf the interface provided by the searched service.
- * @return a service reference provided by the local bundle, offering the
- * specified interface and matching the given filter. If no service
- * is found, {@code null} is returned.
- */
- public ServiceReference getServiceReference(String itf) {
- return getServiceReference(context.getBundle(), itf, null);
- }
-
- /**
- * Returns the service reference of the service provided by the local
- * bundle, offering the specified interface and having the given persistent
- * ID.
- *
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service provided by the local bundle, offering the specified
- * interface and having the given persistent ID.
- */
- public ServiceReference getServiceReferenceByPID(String itf, String pid) {
- return getServiceReferenceByPID(context.getBundle(), itf, pid);
- }
-
- /**
- * Returns the service reference of all the services provided in the local
- * bundle, offering the specified interface and matching the given filter.
- *
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references provided in the local bundle, offering
- * the specified interface and matching the given filter. If no
- * service matches, an empty array is returned.
- */
- public ServiceReference[] getServiceReferences(String itf, String filter) {
- return getServiceReferences(context.getBundle(), itf, filter);
- }
-
- /**
- * Gets the package admin exposed by the framework.
- * Fails if the package admin is not available.
- * @return the package admin service.
- */
- public PackageAdmin getPackageAdmin() {
- PackageAdmin pa = (PackageAdmin) getServiceObject(PackageAdmin.class.getName(), null);
- if (pa == null) {
- fail("No package admin available");
- }
- return pa;
- }
-
- /**
- * Refresh the packages.
- * Fails if the package admin service is not available.
- */
- public void refresh() {
- getPackageAdmin().refreshPackages(null);
- }
-
- /**
- * Waits for a service. Fails on timeout.
- * If timeout is set to 0, it sets the timeout to 10s.
- * @param itf the service interface
- * @param filter the filter
- * @param timeout the timeout
- */
- public void waitForService(String itf, String filter, long timeout) {
- if (timeout == 0) {
- timeout = 10000; // Default 10 secondes.
- }
- ServiceReference[] refs = getServiceReferences(itf, filter);
- long begin = System.currentTimeMillis();
- if (refs.length != 0) {
- return;
- } else {
- while(refs.length == 0) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- long now = System.currentTimeMillis();
-
- if ((now - begin) > timeout) {
- fail("Timeout ... no services matching with the request after " + timeout + "ms");
- }
- refs = getServiceReferences(itf, filter);
- }
- }
- }
-
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @return the installed bundle
- */
- public Bundle installBundle(String url) {
- try {
- return context.installBundle(url);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs a bundle.
- * Fails if the bundle cannot be installed.
- * Be aware that you have to uninstall the bundle yourself.
- * @param url bundle url
- * @param stream input stream containing the bundle
- * @return the installed bundle
- */
- public Bundle installBundle(String url, InputStream stream) {
- try {
- return context.installBundle(url, stream);
- } catch (BundleException e) {
- fail("Cannot install the bundle " + url + " : " + e.getMessage());
- }
- return null; // Can not happen
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url) {
- Bundle bundle = installBundle(url);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Installs and starts a bundle.
- * Fails if the bundle cannot be installed or an error occurs
- * during startup. Be aware that you have to uninstall the bundle
- * yourself.
- * @param url the bundle url
- * @param stream input stream containing the bundle
- * @return the Bundle object.
- */
- public Bundle installAndStart(String url, InputStream stream) {
- Bundle bundle = installBundle(url, stream);
- try {
- bundle.start();
- } catch (BundleException e) {
- fail("Cannot start the bundle " + url + " : " + e.getMessage());
- }
- return bundle;
- }
-
- /**
- * Get the bundle by its id.
- * @param bundleId the bundle id.
- * @return the bundle with the given id.
- */
- public Bundle getBundle(long bundleId) {
- return context.getBundle(bundleId);
- }
-
- /**
- * Gets a bundle by its symbolic name.
- * Fails if no bundle matches.
- * @param name the symbolic name of the bundle
- * @return the bundle object.
- */
- public Bundle getBundle(String name) {
- Bundle[] bundles = context.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- if (name.equals(bundles[i].getSymbolicName())) {
- return bundles[i];
- }
- }
- fail("No bundles with the given symbolic name " + name);
- return null; // should not happen
- }
-
-
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java
deleted file mode 100644
index 581c14a0eb..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.junit4osgi;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * OSGi Test Suite.
- * Allow the injection of the bundle context.
- * @author Felix Project Team
- */
-public class OSGiTestSuite extends TestSuite {
-
- /**
- * The bundle context of the bundle containing
- * the test suite.
- */
- protected BundleContext m_context;
-
- /**
- * Creates a OSGiTestSuite.
- * @param clazz the class
- * @param bc the bundle context
- * @see TestSuite#TestSuite(Class)
- */
- public OSGiTestSuite(Class clazz, BundleContext bc) {
- super(clazz);
- m_context = bc;
- }
-
- /**
- * Creates a OSGiTestSuite.
- * @param bc the bundle context
- * @see TestSuite#TestSuite()
- */
- public OSGiTestSuite(BundleContext bc) {
- super();
- m_context = bc;
- }
-
- /**
- * Creates a OSGiTestSuite.
- * @param name the name
- * @param bc the bundle context
- * @see TestSuite#TestSuite(String)
- */
- public OSGiTestSuite(String name, BundleContext bc) {
- super(name);
- m_context = bc;
- }
-
- /**
- * Creates a OSGiTestSuite.
- * @param clazz the class
- * @param name the name
- * @param bc the bundle context
- * @see TestSuite#TestSuite(Class, String)
- */
- public OSGiTestSuite(Class clazz, String name, BundleContext bc) {
- super(clazz, name);
- m_context = bc;
- }
-
- /**
- * Set the bundle context.
- * @param bc the bundle context to use.
- */
- public void setBundleContext(BundleContext bc) {
- m_context = bc;
- }
-
- /**
- * Adds the tests from the given class to the suite.
- * @param testClass the class to add
- */
- public void addTestSuite(Class testClass) {
- if (OSGiTestCase.class.isAssignableFrom(testClass)) {
- addTest(new OSGiTestSuite(testClass, m_context));
- } else if (TestCase.class.isAssignableFrom(testClass)) {
- addTest(new TestSuite(testClass));
- } else {
- System.out.println("Error : the " + testClass + " is not a valid test class");
- }
- }
-
- /**
- * Executes the given {@link Test} with the
- * given {@link TestResult}.
- * @param test the test
- * @param result the test result.
- * @see junit.framework.TestSuite#runTest(junit.framework.Test, junit.framework.TestResult)
- */
- public void runTest(Test test, TestResult result) {
- if (test instanceof OSGiTestSuite) {
- ((OSGiTestSuite) test).m_context = m_context;
- test.run(result);
- } else if (test instanceof OSGiTestCase) {
- ((OSGiTestCase) test).setBundleContext(m_context);
- test.run(result);
- } else {
- test.run(result);
- }
-
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java
deleted file mode 100644
index 791fcfd39b..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- * 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.junit4osgi.helpers;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.Handler;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.ServiceContext;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.junit4osgi.Helper;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ManagedServiceFactory;
-
-/**
- * iPOJO Helper.
- * This helper helps getting {@link Factory}, and managing
- * {@link ComponentInstance}.
- * @author Felix Project Team
- */
-public class IPOJOHelper extends Helper {
-
- /**
- * The bundle context.
- */
- private BundleContext m_context;
- /**
- * The test case.
- */
- private OSGiTestCase m_testcase;
-
- /**
- * List of instances.
- */
- private List m_instances;
-
- /**
- * Creates a IPOJOHelper.
- * @param tc the OSGi Test Case
- */
- public IPOJOHelper(OSGiTestCase tc) {
- super(tc);
- m_testcase = tc;
- m_context = m_testcase.getBundleContext();
- m_instances = new ArrayList();
- }
-
- /**
- * Disposes created instances.
- * @see org.apache.felix.ipojo.junit4osgi.Helper#dispose()
- */
- public void dispose() {
- for (int i = 0; i < m_instances.size(); i++) {
- ((ComponentInstance) m_instances.get(i)).dispose();
- }
- m_instances.clear();
- }
-
- /**
- * Gets a created instance from the instance name.
- * @param name the instance name.
- * @return the created {@link ComponentInstance} or null
- * if the instance was not created during the session.
- */
- public ComponentInstance getInstanceByName(String name) {
- for (int i = 0; i < m_instances.size(); i++) {
- if (((ComponentInstance) m_instances.get(i)).getInstanceName()
- .equals(name)) {
- return (ComponentInstance) m_instances.get(i);
- }
- }
- return null;
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(bundle, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified bundle ("
- + bundle.getSymbolicName() + ").");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration:"
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(Bundle bundle,
- String factoryName, String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(bundle, factoryName, configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and an empty
- * configuration), from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName) {
-
- // Create the instance configuration
- Properties configuration = new Properties();
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- Dictionary configuration) {
-
- // Retrieve the component factory.
- Factory fact = getFactory(serviceContext, factoryName);
-
- if (fact == null) {
- // Factory not found...
- throw new IllegalArgumentException(
- "Cannot find the component factory (" + factoryName
- + ") in the specified service context.");
- }
-
- try {
- return fact.createComponentInstance(configuration);
- } catch (Exception e) {
- throw new IllegalArgumentException(
- "Cannot create the component instance with the given configuration: "
- + e.getMessage());
- }
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given service context.
- *
- * @param serviceContext the service context in which the component factory
- * service is registered.
- * @param factoryName the name of the component factory, defined in the
- * specified service context.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public static ComponentInstance createComponentInstance(
- ServiceContext serviceContext, String factoryName,
- String instanceName, Dictionary configuration) {
-
- // Add the instance name to the configuration
- configuration.put("instance.name", instanceName);
-
- return createComponentInstance(serviceContext, factoryName,
- configuration);
- }
-
- /**
- * Creates a new component instance with the given name (and empty
- * configuration), from the factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * local bundle.
- * @param instanceName the name of the component instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given configuration, from the
- * factory specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @param configuration the configuration of the component instance to
- * create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with no configuration, from the factory
- * specified in the local bundle.
- *
- * @param factoryName the name of the component factory, in the local
- * bundle.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, (Dictionary) null);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Creates a new component instance with the given name and configuration,
- * from the factory specified in the given bundle.
- *
- * @param factoryName the name of the component factory, defined in the
- * specified bundle.
- * @param instanceName the name of the component instance to create.
- * @param configuration the configuration of the instance to create.
- * @return the newly created component instance.
- */
- public ComponentInstance createComponentInstance(String factoryName,
- String instanceName, Dictionary configuration) {
- ComponentInstance ci = createComponentInstance(m_context.getBundle(),
- factoryName, instanceName, configuration);
- m_instances.add(ci);
- return ci;
- }
-
- /**
- * Returns the component factory with the given name in the local bundle.
- *
- * @param factoryName the name of the factory to retrieve.
- * @return the component factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public Factory getFactory(String factoryName) {
- return getFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the handler factory with the given name in the local bundle.
- *
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the local bundle, or
- * {@code null} if not found.
- */
- public HandlerFactory getHandlerFactory(String factoryName) {
- return getHandlerFactory(m_context.getBundle(), factoryName);
- }
-
- /**
- * Returns the metadata description of the component defined in this bundle.
- *
- * @param component the name of the locally defined component.
- * @return the metadata description of the component with the given name,
- * defined in this given bundle, or {@code null} if not found.
- */
- public Element getMetadata(String component) {
- return getMetadata(m_context.getBundle(), component);
- }
-
- /**
- * Returns the component factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the component factory is defined.
- * @param factoryName the name of the defined factory.
- * @return the component factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static Factory getFactory(Bundle bundle, String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) bundle.getBundleContext().getService(refs[0]);
- }
-
- // Factory not found...
- return null;
-
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the component factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the component factory with the given name, registered in the
- * given service context.
- *
- * @param serviceContext the service context in which the factory service is
- * defined.
- * @param factoryName the name of the factory.
- * @return the component factory with the given name, registered in the
- * given service context.
- */
- public static Factory getFactory(ServiceContext serviceContext,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the component factories services in the service
- // context.
- refs = serviceContext.getServiceReferences(Factory.class.getName(),
- "(factory.name=" + factoryName + ")");
- if (refs != null) {
- return (Factory) serviceContext.getService(refs[0]);
- }
- return null;
-
- } catch (InvalidSyntaxException e) {
- System.err.println("Cannot get the factory " + factoryName + " : "
- + e.getMessage());
- return null;
- }
- }
-
- /**
- * Returns the handler factory with the given name in the given bundle.
- *
- * @param bundle the bundle from which the handler factory is defined.
- * @param factoryName the name of the handler factory to retrieve.
- * @return the handler factory with the given name in the given bundle, or
- * {@code null} if not found.
- */
- public static HandlerFactory getHandlerFactory(Bundle bundle,
- String factoryName) {
- ServiceReference[] refs;
- try {
- // Retrieves the handler factories services in the bundle.
- refs = bundle.getBundleContext().getServiceReferences(
- HandlerFactory.class.getName(),
- "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName
- + ")");
- if (refs != null) {
- return (HandlerFactory) bundle.getBundleContext().getService(
- refs[0]);
- }
-
- // Factory not found...
- return null;
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get the handler factory services: "
- + e.getMessage());
- }
- }
-
- /**
- * Returns the metadata description of the component with the given name,
- * defined in the given bundle.
- *
- * @param bundle the bundle from which the component is defined.
- * @param component the name of the defined component.
- * @return the metadata description of the component with the given name,
- * defined in the given bundle, or {@code null} if not found.
- */
- public static Element getMetadata(Bundle bundle, String component) {
-
- // Retrieves the component description from the bundle's manifest.
- String elem = (String) bundle.getHeaders().get("iPOJO-Components");
- if (elem == null) {
- throw new IllegalArgumentException(
- "Cannot find iPOJO-Components descriptor in the specified bundle ("
- + bundle.getSymbolicName()
- + "). Not an iPOJO bundle.");
- }
-
- // Parses the retrieved description and find the component with the
- // given name.
- try {
- Element element = ManifestMetadataParser.parseHeaderMetadata(elem);
- Element[] childs = element.getElements("component");
- for (int i = 0; i < childs.length; i++) {
- String name = childs[i].getAttribute("name");
- String clazz = childs[i].getAttribute("classname");
- if (name != null && name.equalsIgnoreCase(component)) {
- return childs[i];
- }
- if (clazz.equalsIgnoreCase(component)) {
- return childs[i];
- }
- }
-
- // Component not found...
- return null;
-
- } catch (ParseException e) {
- throw new IllegalStateException(
- "Cannot parse the components from specified bundle ("
- + bundle.getSymbolicName() + "): " + e.getMessage());
- }
- }
-
- /**
- * Returns the service object of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which the service is
- * searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return the service object provided by the specified bundle, offering the
- * specified interface and matching the given filter.
- */
- public static Object getServiceObject(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference ref = getServiceReference(serviceContext, itf, filter);
- if (ref != null) {
- return serviceContext.getService(ref);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the service objects of the services registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return the service objects provided by the specified bundle, offering
- * the specified interface and matching the given filter.
- */
- public static Object[] getServiceObjects(ServiceContext serviceContext,
- String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs != null) {
- Object[] list = new Object[refs.length];
- for (int i = 0; i < refs.length; i++) {
- list[i] = serviceContext.getService(refs[i]);
- }
- return list;
- } else {
- return new Object[0];
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and matching the given
- * filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param filter an additional filter (can be {@code null}).
- * @return a service reference registered in the specified service context,
- * offering the specified interface and matching the given filter.
- * If no service is found, {@code null} is returned.
- */
- public static ServiceReference getServiceReference(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs.length != 0) {
- return refs[0];
- } else {
- // No service found
- return null;
- }
- }
-
- /**
- * Returns the service reference of the service registered in the specified
- * service context, offering the specified interface and having the given
- * persistent ID.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param pid the persistent ID of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given persistent ID.
- */
- public static ServiceReference getServiceReferenceByPID(
- ServiceContext serviceContext, String itf, String pid) {
- String filter = "(" + "service.pid" + "=" + pid + ")";
- ServiceReference[] refs = getServiceReferences(serviceContext, itf,
- filter);
- if (refs == null) {
- return null;
- } else if (refs.length == 1) {
- return refs[0];
- } else {
- throw new IllegalStateException(
- "A service lookup by PID returned several providers ("
- + refs.length + ")" + " for " + itf + " with pid="
- + pid);
- }
- }
-
- /**
- * Returns the service reference of all the services registered in the
- * specified service context, offering the specified interface and matching
- * the given filter.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched services.
- * @param filter an additional filter (can be {@code null}).
- * @return all the service references registered in the specified service
- * context, offering the specified interface and matching the given
- * filter. If no service matches, an empty array is returned.
- */
- public static ServiceReference[] getServiceReferences(
- ServiceContext serviceContext, String itf, String filter) {
- ServiceReference[] refs = null;
- try {
- // Get all the service references
- refs = serviceContext.getServiceReferences(itf, filter);
- } catch (InvalidSyntaxException e) {
- throw new IllegalArgumentException(
- "Cannot get service references: " + e.getMessage());
- }
- if (refs == null) {
- return new ServiceReference[0];
- } else {
- return refs;
- }
- }
-
- /**
- * Returns the service reference of a service registered in the specified
- * service context, offering the specified interface and having the given
- * name.
- *
- * @param serviceContext the service context in which services are searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service registered in the specified service context, offering
- * the specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(
- ServiceContext serviceContext, String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return getServiceReference(serviceContext, itf, filter);
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @return true if the service is available in the service
- * context, false otherwise.
- */
- public static boolean isServiceAvailable(ServiceContext sc, String itf) {
- ServiceReference ref = getServiceReference(sc, itf, null);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param name the service provider name
- * @return true if the service is available in the service
- * context, false otherwise.
- */
- public static boolean isServiceAvailableByName(ServiceContext sc,
- String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(sc, itf, name);
- return ref != null;
- }
-
- /**
- * Checks the availability of a service inside the given service context.
- * @param sc the service context
- * @param itf the service interface to found
- * @param pid the pid of the service
- * @return true if the service is available in the service
- * context, false otherwise.
- */
- public static boolean isServiceAvailableByPID(ServiceContext sc,
- String itf, String pid) {
- ServiceReference ref = getServiceReferenceByPID(sc, itf, pid);
- return ref != null;
- }
-
- /**
- * Returns the service reference of a service provided by the specified
- * bundle, offering the specified interface and having the given name.
- *
- * @param bundle the bundle from which the service is searched.
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public static ServiceReference getServiceReferenceByName(Bundle bundle,
- String itf, String name) {
- String filter = null;
- if (itf.equals(Factory.class.getName())
- || itf.equals(ManagedServiceFactory.class.getName())) {
- filter = "(" + "factory.name" + "=" + name + ")";
- } else if (itf.equals(Architecture.class.getName())) {
- filter = "(" + "architecture.instance" + "=" + name + ")";
- } else {
- filter = "(" + "instance.name" + "=" + name + ")";
- }
- return OSGiTestCase.getServiceReference(bundle, itf, filter);
- }
-
- /**
- * Returns the service reference of a service provided by the local bundle,
- * offering the specified interface and having the given name.
- *
- * @param itf the interface provided by the searched service.
- * @param name the name of the searched service.
- * @return a service provided by the specified bundle, offering the
- * specified interface and having the given name.
- */
- public ServiceReference getServiceReferenceByName(String itf, String name) {
- return getServiceReferenceByName(m_context.getBundle(), itf, name);
- }
-
- /**
- * Checks if the service is available.
- * @param itf the service interface
- * @param name the service provider name
- * @return true if the service is available, false
- * otherwise.
- */
- public boolean isServiceAvailableByName(String itf, String name) {
- ServiceReference ref = getServiceReferenceByName(itf, name);
- return ref != null;
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java
deleted file mode 100644
index 45c928ef21..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * 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.junit4osgi.impl;
-
-import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.apache.felix.ipojo.parser.ParseUtils;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
-
-/**
- * Detect test suite from installed bundles.
- * @author Felix Project Team
- */
-public class JunitExtender implements OSGiJunitRunner {
-
- /**
- * Suite method name.
- */
- public static final String SUITE_METHODNAME = "suite";
-
- /**
- * List of found suites (Bundle-> List of Class).
- */
- private Map/*>*/ m_suites = new HashMap/*>*/();
-
- /**
- * The result printer.
- * By default, prints result on {@link System#out}
- */
- private ResultPrinter m_printer = new ResultPrinter(System.out);
-
- /**
- * The log service used to log messages.
- * If not provided, a default implementation
- * printing messages on the console is used.
- */
- private LogService m_log;
-
- /**
- * A new matching bundle arrives.
- * @param bundle the matching bundle
- * @param header the looked header value
- */
- void onBundleArrival(Bundle bundle, String header) {
- String[] tss = ParseUtils.split(header, ",");
- for (int i = 0; i < tss.length; i++) {
- try {
- if (tss[i].length() != 0) {
- m_log.log(LogService.LOG_INFO, "Loading " + tss[i]);
- Class/* extends Test>*/ clazz = bundle.loadClass(tss[i].trim());
- addTestSuite(bundle, clazz);
- }
- } catch (ClassNotFoundException e) {
- m_log.log(LogService.LOG_ERROR, "The test suite " + tss[i] + " is not in the bundle " + bundle.getBundleId() + " : " + e.getMessage());
- }
- }
- }
-
- /**
- * Adds a test suite.
- * @param bundle the bundle declaring the test suite.
- * @param test the test class.
- */
- private synchronized void addTestSuite(Bundle bundle, Class/* extends Test>*/ test) {
- List/**/ list = (List) m_suites.get(bundle);
- if (list == null) {
- list = new ArrayList/**/();
- list.add(test);
- m_suites.put(bundle, list);
- } else {
- list.add(test);
- }
- }
-
- /**
- * Removes the test suites provided by the given bundles.
- * @param bundle the leaving bundles.
- */
- private synchronized void removeTestSuites(Bundle bundle) {
- List list = (List) m_suites.remove(bundle);
- m_log.log(LogService.LOG_INFO, "Unload test suites " + list);
- }
-
- /**
- * A matching bundle is leaving.
- * @param bundle the leaving bundle.
- */
- void onBundleDeparture(Bundle bundle) {
- removeTestSuites(bundle);
- }
-
- /**
- * Set the result printer.
- * @param pw the stream to use.
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#setResultPrinter(java.io.PrintStream)
- */
- public void setResultPrinter(PrintStream pw) {
- m_printer = new ResultPrinter(pw);
- }
-
- /**
- * Runs tests.
- * @return the list of {@link TestResult}
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run()
- */
- public synchronized List/**/ run() {
- List/**/ results = new ArrayList/**/(m_suites.size());
- Iterator/*>>*/ it = m_suites.entrySet().iterator();
- while (it.hasNext()) {
- Entry/*>*/ entry = (Entry) it.next();
- Bundle bundle = (Bundle) entry.getKey();
- List/**/ list = (List) m_suites.get(bundle);
- for (int i = 0; i < list.size(); i++) {
- Test test = createTestFromClass((Class) list.get(i), bundle);
- TestResult tr = doRun(test);
- results.add(tr);
- }
- }
- return results;
- }
-
- /**
- * Internal methods executing tests.
- * @param test the test to execute
- * @return the result
- */
- private TestResult doRun(Test test) {
- TestResult result = new TestResult();
- result.addListener(m_printer);
- long startTime = System.currentTimeMillis();
-
- test.run(result);
-
- long endTime = System.currentTimeMillis();
- long runTime = endTime - startTime;
- m_printer.print(result, runTime);
-
- return result;
- }
-
- /**
- * Creates a {@link Test} object from the
- * given class from the given bundle.
- * This method creates {@link OSGiTestCase} and
- * {@link OSGiTestSuite} when required.
- * @param clazz the class
- * @param bundle the bundle
- * @return the resulting Test object.
- */
- private Test createTestFromClass(Class/*>*/ clazz, Bundle bundle) {
- Method suiteMethod = null;
- boolean bc = false;
- try {
- suiteMethod = clazz.getMethod(SUITE_METHODNAME, new Class[0]);
- } catch (Exception e) {
- // try to use a suite method receiving a bundle context
- try {
- suiteMethod = clazz.getMethod(SUITE_METHODNAME, new Class[] { BundleContext.class });
- bc = true;
- } catch (Exception e2) {
- // try to extract a test suite automatically
- if (OSGiTestSuite.class.isAssignableFrom(clazz)) {
- OSGiTestSuite ts = new OSGiTestSuite(clazz, getBundleContext(bundle));
- return ts;
- } else if (OSGiTestCase.class.isAssignableFrom(clazz)) {
- OSGiTestSuite ts = new OSGiTestSuite(clazz, getBundleContext(bundle));
- return ts;
- } else {
- return new TestSuite(clazz);
- }
- }
- }
-
- if (!Modifier.isStatic(suiteMethod.getModifiers())) {
- m_log.log(LogService.LOG_ERROR, "Suite() method must be static");
- return null;
- }
- Test test = null;
- try {
- if (bc) {
- test = (Test) suiteMethod.invoke(null, new Object[] { getBundleContext(bundle) }); // static method injection the bundle context
- } else {
- test = (Test) suiteMethod.invoke(null, (Object[]) new Class[0]); // static method
- }
- } catch (InvocationTargetException e) {
- m_log.log(LogService.LOG_ERROR, "Failed to invoke suite():" + e.getTargetException().toString());
- return null;
- } catch (IllegalAccessException e) {
- m_log.log(LogService.LOG_ERROR, "Failed to invoke suite():" + e.toString());
- return null;
- }
-
- return test;
- }
-
- /**
- * Gets the list of {@link Test}.
- * @return the list of {@link Test}
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#getTests()
- */
- public synchronized List/**/ getTests() {
- List/**/ results = new ArrayList/**/();
- Iterator/*>>*/ it = m_suites.entrySet().iterator();
- while (it.hasNext()) {
- Entry/*>*/ entry = (Entry) it.next();
- Bundle bundle = (Bundle) entry.getKey();
- List/**/ list = (List) m_suites.get(bundle);
- for (int i = 0; i < list.size(); i++) {
- Test test = createTestFromClass((Class) list.get(i), bundle);
- results.add(test);
- }
- }
- return results;
- }
-
- /**
- * Runs the given tests.
- * @param test the test to execute
- * @return the result
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run(junit.framework.Test)
- */
- public TestResult run(Test test) {
- return doRun(test);
- }
-
- /**
- * Gets the list of {@link Test} from the bundle (specified
- * by using the bundle id).
- * @param bundleId the bundle id
- * @return the list of {@link Test} declared in this bundle.
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#getTests(long)
- */
- public synchronized List/**/ getTests(long bundleId) {
- Iterator/*>>*/ it = m_suites.entrySet().iterator();
- while (it.hasNext()) {
- Entry/*>*/ entry = (Entry) it.next();
- Bundle bundle = (Bundle) entry.getKey();
- if (bundle.getBundleId() == bundleId) {
- List/**/ results = new ArrayList/**/();
- List/**/ list = (List) m_suites.get(bundle);
- for (int i = 0; i < list.size(); i++) {
- Test test = createTestFromClass((Class) list.get(i), bundle);
- results.add(test);
- }
- return results;
- }
- }
- return null;
- }
-
- /**
- * Runs the tests declared in the bundle
- * (specified by the bundle id).
- * @param bundleId the bundle id
- * @return the List of {@link TestResult}
- * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run(long)
- */
- public synchronized List/**/ run(long bundleId) {
- Iterator/*>>*/ it = m_suites.entrySet().iterator();
- while (it.hasNext()) {
- Entry/*>*/ entry = (Entry) it.next();
- Bundle bundle = (Bundle) entry.getKey();
- if (bundle.getBundleId() == bundleId) {
- List/**/ results = new ArrayList/**/();
- List/**/ list = (List) m_suites.get(bundle);
- for (int i = 0; i < list.size(); i++) {
- Test test = createTestFromClass((Class) list.get(i), bundle);
- TestResult tr = doRun(test);
- results.add(tr);
- }
- return results;
- }
- }
- return null;
- }
-
- /**
- * Stop method.
- * Clears test suites.
- */
- public synchronized void stopping() {
- m_log.log(LogService.LOG_INFO, "Cleaning test suites ...");
- m_suites.clear();
- }
-
- /**
- * Start method.
- */
- public void starting() {
- m_log.log(LogService.LOG_INFO, "Junit Extender starting ...");
- }
-
- /**
- * Helper method analyzing the {@link Bundle} object
- * to get the {@link BundleContext} object.
- * @param bundle the Bundle
- * @return the BundleContext of null if
- * the BundleContext cannot be collected.
- */
- private BundleContext getBundleContext(Bundle bundle) {
- if (bundle == null) { return null; }
-
- // getBundleContext (OSGi 4.1)
- Method meth = null;
- try {
- meth = bundle.getClass().getMethod("getBundleContext", new Class[0]);
- } catch (SecurityException e) {
- // Nothing do to, will try the Equinox method
- } catch (NoSuchMethodException e) {
- // Nothing do to, will try the Equinox method
- }
-
- // try Equinox getContext if not found.
- if (meth == null) {
- try {
- meth = bundle.getClass().getMethod("getContext", new Class[0]);
- } catch (SecurityException e) {
- // Nothing do to, will try field inspection
- } catch (NoSuchMethodException e) {
- // Nothing do to, will try field inspection
- }
- }
-
- if (meth != null) {
- if (! meth.isAccessible()) {
- meth.setAccessible(true);
- }
- try {
- return (BundleContext) meth.invoke(bundle, new Object[0]);
- } catch (IllegalArgumentException e) {
- m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e);
- return null;
- } catch (IllegalAccessException e) {
- m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e);
- return null;
- } catch (InvocationTargetException e) {
- m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e);
- return null;
- }
- }
-
- // Else : Field inspection (KF and Prosyst)
- Field[] fields = bundle.getClass().getDeclaredFields();
- for (int i = 0; i < fields.length; i++) {
- if (BundleContext.class.isAssignableFrom(fields[i].getType())) {
- if (! fields[i].isAccessible()) {
- fields[i].setAccessible(true);
- }
- try {
- return (BundleContext) fields[i].get(bundle);
- } catch (IllegalArgumentException e) {
- m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by reflecting on " + fields[i].getName(), e);
- return null;
- } catch (IllegalAccessException e) {
- m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by reflecting on " + fields[i].getName(), e);
- return null;
- }
- }
- }
- m_log.log(LogService.LOG_ERROR, "Cannot find the BundleContext for " + bundle.getSymbolicName(), null);
- return null;
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java
deleted file mode 100644
index 71afd825c0..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.junit4osgi.impl;
-
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * Log Service default implementation.
- * @author Felix Project Team
- */
-public class LogServiceImpl implements LogService {
-
- /**
- * Creates a message.
- * @param level the log level
- * @param msg the message
- * @param exception the thrown exception
- * @return the computed message
- */
- private String computeLogMessage(int level, String msg, Throwable exception) {
- String message = null;
- switch (level) {
- case LogService.LOG_DEBUG:
- message = "[DEBUG] " + msg;
- break;
- case LogService.LOG_ERROR:
- message = "[ERROR] " + msg;
- break;
- case LogService.LOG_INFO:
- message = "[INFO] " + msg;
- break;
- case LogService.LOG_WARNING:
- message = "[WARNING] " + msg;
- break;
- default:
- break;
- }
-
- if (exception != null) {
- message = message + " : " + exception.getMessage();
- }
-
- return message;
- }
-
- /**
- * Logs a message.
- * @param arg0 the log level
- * @param arg1 the message
- * @see org.osgi.service.log.LogService#log(int, java.lang.String)
- */
- public void log(int arg0, String arg1) {
- System.err.println(computeLogMessage(arg0, arg1, null));
- }
-
- /**
- * Logs a message.
- * @param arg0 the log level
- * @param arg1 the message
- * @param arg2 the thrown exception
- * @see org.osgi.service.log.LogService#log(int, java.lang.String)
- */
- public void log(int arg0, String arg1, Throwable arg2) {
- System.err.println(computeLogMessage(arg0, arg1, arg2));
- }
-
- /**
- * Logs a message.
- * @param arg0 the service reference
- * @param arg1 the log level
- * @param arg2 the message
- * @see org.osgi.service.log.LogService#log(ServiceReference, int, String)
- */
- public void log(ServiceReference arg0, int arg1, String arg2) {
- System.err.println(computeLogMessage(arg1, arg2, null));
- }
-
- /**
- * Logs a message.
- * @param arg0 the service reference
- * @param arg1 the log level
- * @param arg2 the message
- * @param arg3 the thrown exception
- * @see org.osgi.service.log.LogService#log(ServiceReference, int, String, Throwable)
- */
- public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3) {
- System.err.println(computeLogMessage(arg1, arg2, arg3));
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java
deleted file mode 100644
index 906658b34e..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.junit4osgi.impl;
-
-import java.io.PrintStream;
-import java.text.NumberFormat;
-import java.util.Enumeration;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestFailure;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
-import junit.runner.BaseTestRunner;
-
-/**
- * Result Printer.
- * @author Felix Project Team
- */
-public class ResultPrinter implements TestListener {
- /**
- * the writer.
- */
- PrintStream m_fWriter;
-
- /**
- * The column .
- */
- int m_fColumn = 0;
-
- /**
- * Creates a ResultPrinter.
- * @param writer the printer
- */
- public ResultPrinter(PrintStream writer) {
- m_fWriter = writer;
- }
-
- /**
- * Prints the result.
- * @param result the test result
- * @param runTime the test duration
- */
- synchronized void print(TestResult result, long runTime) {
- printHeader(runTime);
- printErrors(result);
- printFailures(result);
- printFooter(result);
- }
-
- /**
- * Prints message wiating for prompt.
- */
- void printWaitPrompt() {
- getWriter().println();
- getWriter().println(" to continue");
- }
-
- /*
- * Internal methods
- */
-
- /**
- * Prints the result header.
- * @param runTime the test execution duration
- */
- protected void printHeader(long runTime) {
- getWriter().println();
- getWriter().println("Time: " + elapsedTimeAsString(runTime));
- }
-
- /**
- * Prints the errors.
- * @param result the test result
- */
- protected void printErrors(TestResult result) {
- printDefects(result.errors(), result.errorCount(), "error");
- }
-
- /**
- * Prints failures.
- * @param result the test result
- */
- protected void printFailures(TestResult result) {
- printDefects(result.failures(), result.failureCount(), "failure");
- }
-
- /**
- * Prints failures.
- * @param booBoos the failures
- * @param count the number of failures
- * @param type the type
- */
- protected void printDefects(Enumeration/**/ booBoos, int count, String type) {
- if (count == 0) {
- return;
- }
-
- if (count == 1) {
- getWriter().println("There was " + count + " " + type + ":");
- } else {
- getWriter().println("There were " + count + " " + type + "s:");
- }
-
- for (int i = 1; booBoos.hasMoreElements(); i++) {
- printDefect((TestFailure) booBoos.nextElement(), i);
- }
- }
-
- /**
- * Prints a failure.
- * @param booBoo the failure
- * @param count the count
- */
- public void printDefect(TestFailure booBoo, int count) { // only public for testing purposes
- printDefectHeader(booBoo, count);
- printDefectTrace(booBoo);
- }
-
- /**
- * Prints defect header.
- * @param booBoo the failure
- * @param count the count
- */
- protected void printDefectHeader(TestFailure booBoo, int count) {
- // I feel like making this a println, then adding a line giving the throwable a chance to print something
- // before we get to the stack trace.
- getWriter().print(count + ") " + booBoo.failedTest());
- }
-
- /**
- * Prints the stack trace.
- * @param booBoo the failure
- */
- protected void printDefectTrace(TestFailure booBoo) {
- getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace()));
- }
-
- /**
- * Prints the footer.
- * @param result the test result.
- */
- protected void printFooter(TestResult result) {
- if (result.wasSuccessful()) {
- getWriter().println();
- getWriter().print("OK");
- getWriter().println(" (" + result.runCount() + " test" + (result.runCount() == 1 ? "" : "s") + ")");
-
- } else {
- getWriter().println();
- getWriter().println("FAILURES!!!");
- getWriter().println("Tests run: " + result.runCount() + ", Failures: " + result.failureCount() + ", Errors: " + result.errorCount());
- }
- getWriter().println();
- }
-
- /**
- * Returns the formatted string of the elapsed time.
- * @param runTime the elapsed time
- * @return the elapsed time.
- */
- protected String elapsedTimeAsString(long runTime) {
- return NumberFormat.getInstance().format((double) runTime / 1000);
- }
-
- public PrintStream getWriter() {
- return m_fWriter;
- }
-
- /**
- * Adds an error.
- * @param test the test in error.
- * @param t the thrown error
- * @see junit.framework.TestListener#addError(Test, Throwable)
- */
- public void addError(Test test, Throwable t) {
- getWriter().print("E");
- }
-
- /**
- * Adds a failure.
- * @param test the failing test.
- * @param t the thrown failure
- * @see junit.framework.TestListener#addFailure(Test, AssertionFailedError)
- */
- public void addFailure(Test test, AssertionFailedError t) {
- getWriter().print("F");
- }
-
- /**
- * A test ends.
- * (do nothing)
- * @param test the ending test
- * @see junit.framework.TestListener#endTest(Test)
- */
- public void endTest(Test test) { }
-
- /**
- * A test starts.
- * @param test the starting test
- * @see junit.framework.TestListener#startTest(Test)
- */
- public void startTest(Test test) {
- getWriter().print(".");
- if (m_fColumn++ >= 40) {
- getWriter().println();
- m_fColumn = 0;
- }
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java
deleted file mode 100644
index 9d59e00f1c..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.junit4osgi.test;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
-
-/**
- * Simple OSGi Test Case.
- * @author Felix Project Team
- */
-public class TestOSGiTestCase extends OSGiTestCase {
-
- /**
- * Test.
- */
- public void test1() {
- System.out.println("Test BC");
- assertNotNull("Test bundle context", getContext());
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java
deleted file mode 100644
index 746a017b26..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.junit4osgi.test;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite;
-import org.osgi.framework.BundleContext;
-
-/**
- * Simple OSGi Test suite.
- * @author Felix Project Team
- */
-public class TestOSGiTestSuite extends TestSuite {
-
- /**
- * Suite method.
- * @param bc the bundle context
- * @return the Test Suite.
- */
- public static Test suite(BundleContext bc) {
- TestSuite ts = new TestSuite();
- ts.setName("Test OSGi suite() method");
- ts.addTestSuite(TestTestCase.class);
- OSGiTestSuite ots = new OSGiTestSuite(TestOSGiTestCase.class, bc);
- ots.setBundleContext(bc);
- ts.addTest(ots);
- return ts;
- }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java
deleted file mode 100644
index c2f0ae4a86..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.junit4osgi.test;
-
-import junit.framework.TestCase;
-
-/**
- * Simple Test Case.
- * @author Felix Project Team
- */
-public class TestTestCase extends TestCase {
-
- /**
- * test1.
- */
- public void test1() { }
-
- /**
- * test2.
- */
- public void test2() { }
-
- /**
- * test3.
- */
- public void test3() { }
-
- /**
- * test4.
- */
- public void test4() { }
-
-}
diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java
deleted file mode 100644
index d559ed927d..0000000000
--- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.junit4osgi.test;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Simple OSGi Test Suite.
- * @author Felix Project Team
- */
-public class TestTestSuite extends TestSuite {
-
- /**
- * Suite method.
- * @return the test suite.
- */
- public static Test suite() {
- TestSuite ts = new TestSuite();
- ts.setName("Test suite() method");
- ts.addTestSuite(TestTestCase.class);
- return ts;
- }
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE b/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE b/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE
deleted file mode 100644
index 657444e8de..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE
+++ /dev/null
@@ -1,31 +0,0 @@
-Apache Felix iPOJO junit4osgi Maven Plugin
-Copyright 2008-2009 The Apache Software Foundation
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-II. Used Software
-
-This product uses software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2007).
-Licensed under the Apache License 2.0.
-
-This product uses software developed by
-Junit project (http://junit.org)
-Licensed under Common Public License 1.0.
-
-This product uses software developed at
-The Codehaus (http://www.codehaus.org)
-Licensed under the Apache License 2.0.
-
-III. License Summary
-- Apache License 2.0
-- Common Public License 1.0
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt b/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt
deleted file mode 100644
index 524e88b133..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Version 1.0.0
--------------
- * Initial release
\ No newline at end of file
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml b/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml
deleted file mode 100644
index 785248c4e3..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- maven-junit4osgi-plugin
- maven-plugin
- 1.1.0-SNAPSHOT
- Junit4OSGi Maven Plugin
-
-
- junit
- junit
- 3.8.1
-
-
- org.apache.felix
- org.apache.felix.framework
- 4.0.3
-
-
- org.apache.maven
- maven-artifact
- 2.0.7
-
-
- org.apache.maven
- maven-project
- 2.0.7
-
-
- org.apache.maven
- maven-model
- 2.0.7
-
-
- org.apache.maven
- maven-plugin-api
- 2.0.7
-
-
- org.apache.felix
- org.apache.felix.ipojo
- 1.9.0-SNAPSHOT
-
-
- org.apache.felix
- org.apache.felix.ipojo.handler.extender
- 1.4.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.junit4osgi
- 1.1.0-SNAPSHOT
-
-
- net.sourceforge.cobertura
- cobertura
- 1.9
-
-
- org.osgi
- org.osgi.core
- 4.2.0
-
-
-
-
-
- org.codehaus.mojo
- rat-maven-plugin
-
- false
- true
- true
-
- doc/*
- maven-eclipse.xml
- .checkstyle
- .externalToolBuilders/*
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
-
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java
deleted file mode 100644
index 35194034f2..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-import java.util.jar.JarFile;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.project.MavenProject;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * Bundle Activator installing bundles in the embedded OSGi.
- * Installed bundles are the junit4osgi framework, the required bundle and the artifact bundle (if enable).
- * Bundles are installed from the local maven repository.
- * @author Felix Project Team
- */
-public class Installer implements BundleActivator {
-
- /**
- * The list of artifact containing bundles for the junit4osgi framework.
- */
- private List m_artifacts;
-
- /**
- * The current maven project.
- */
- private MavenProject m_project;
-
- /**
- * Flag enabling/disabling the deployment of the current
- * project artifact.
- */
- private boolean m_deployCurrent;
-
- /**
- * List of bundle URLs to install.
- */
- private List m_bundles;
-
-
- /**
- * Creates a Installer.
- * @param artifacts the list of artifact containing bundles for the junit4osgi framework.
- * @param bundles the list of bundle URLs to install
- * @param project the current maven project
- * @param deployCurrentArtifact flag enabling/disabling the deployment of the current project artifact
- */
- public Installer(List artifacts, List bundles, MavenProject project, boolean deployCurrentArtifact) {
- this.m_artifacts = artifacts;
- this.m_project = project;
- m_deployCurrent = deployCurrentArtifact;
- this.m_bundles = bundles;
- }
-
- /**
- * Installs and starts the iPOJO bundle.
- * @param context the bundle context.
- * @throws BundleException when the bundle cannot be installed or started correctly
- */
- private void installIPOJO(BundleContext context) throws BundleException {
- String path = getUrlByArtifactId("org.apache.felix.ipojo").toString();
- Bundle bundle = context.installBundle(path);
- bundle.start();
- }
-
- /**
- * Installs and starts the Junit4OSGi bundle.
- * @param context the bundle context.
- * @throws BundleException when the bundle cannot be installed or started correctly
- */
- private void installJunit(BundleContext context) throws BundleException {
- String path = getUrlByArtifactId("org.apache.felix.ipojo.junit4osgi").toString();
- Bundle bundle = context.installBundle(path);
- bundle.start();
- }
-
- /**
- * Installs and starts the iPOJO Extender Handler bundle.
- * @param context the bundle context.
- * @throws BundleException when the bundle cannot be installed or started correctly
- */
- private void installExtender(BundleContext context) throws BundleException {
- String path = getUrlByArtifactId("org.apache.felix.ipojo.handler.extender").toString();
- Bundle bundle = context.installBundle(path);
- bundle.start();
- }
-
- /**
- * Installs and Starts required bundles.
- * @param context the bundle context used to deploy bundles.
- * @throws BundleException when a bundle cannot be installed or started correctly
- */
- private void deployBundles(BundleContext context) throws BundleException {
- for (int i = 0; i < m_bundles.size(); i++) {
- URL url = (URL) m_bundles.get(i);
- Bundle bundle = context.installBundle(url.toString());
- bundle.start();
- }
- }
-
- /**
- * Gets the bundle URL from the artifact list.
- * @param id the dependency id.
- * @return the bundle URL or null if the URL cannot
- * be found.
- */
- private URL getUrlByArtifactId(String id) {
- for (int i = 0; i < m_artifacts.size(); i++) {
- Artifact artifact = (Artifact) m_artifacts.get(i);
- if (artifact.getArtifactId().equals(id)) {
- try {
- return artifact.getFile().toURL();
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
- }
- return null;
- }
-
- /**
- * Deploys the current bundle if enable.
- * @param context the bundle context
- * @throws BundleException when the bundle cannot be installed or started correctly.
- */
- private void deployProjectArtifact(BundleContext context)
- throws BundleException {
- if (!m_deployCurrent) {
- return;
- }
-
- File file = m_project.getArtifact().getFile();
- try {
- if (file.exists()) {
- if (file.getName().endsWith("jar")) {
- JarFile jar = new JarFile(file);
- if (jar.getManifest().getMainAttributes().getValue("Bundle-ManifestVersion") != null) {
- Bundle bundle = context.installBundle(file.toURL().toString());
- bundle.start();
- } else {
- System.err.println("The current artifact " + file.getName() + " is not a valid bundle");
- }
- } else {
- System.err.println("The current artifact " + file.getName() + " is not a Jar file.");
- }
- } else {
- System.err.println("The current artifact " + file.getName() + " does not exist.");
- }
- } catch (Exception e) {
- throw new BundleException("The current project artifact cannot be installed (" + e.getMessage() + ")");
- }
-
-
- }
-
-
- /**
- * Start bundles.
- * @param context the bundle context.
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) {
- try {
- installIPOJO(context);
- installExtender(context);
- installJunit(context);
- deployBundles(context);
- deployProjectArtifact(context);
- } catch (BundleException e) {
- System.err.println("Cannot start the framework : " + e.getMessage());
- return;
- }
- }
-
- /**
- * Stopping methods.
- * @param context the bundle context.
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) {
- // Do nothing.
- }
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java
deleted file mode 100644
index 7bd7c86295..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java
+++ /dev/null
@@ -1,755 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarFile;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestFailure;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
-import org.apache.felix.ipojo.junit4osgi.plugin.log.LogServiceImpl;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Goal starting Felix and executing junit4osgi tests.
- *
- * @goal test
- * @phase integration-test
- * @requiresDependencyResolution runtime
- * @author Felix Project Team
- *
- */
-public class Junit4osgiPlugin extends AbstractMojo {
-
- /**
- * The Maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject m_project;
-
- /**
- * Dependencies of the current plugin.
- * @parameter expression="${plugin.artifacts}"
- */
- private java.util.List m_pluginArtifacts;
-
- /**
- * Base directory where all reports are written to.
- *
- * @parameter expression="${project.build.directory}/surefire-reports"
- */
- private File m_reportsDirectory;
-
- /**
- * Base directory where all reports are written to.
- *
- * @parameter expression="${project.build.directory}"
- */
- private File m_targetDir;
-
- /**
- * Must the current artifact be deployed?
- *
- * @parameter expression="${deployProjectArtifact}" default-value="true"
- */
- private boolean m_deployProjectArtifact;
-
- /**
- * Required bundles.
- *
- * @parameter
- */
- private List bundles;
-
- /**
- * Felix configuration.
- *
- * @parameter
- */
- private Map configuration;
-
- /**
- * Enables / Disables the log service provided by the plugin.
- *
- * @parameter expression="${logService}" default-value="true"
- */
- private boolean m_logEnable;
-
- /**
- * Number of executed test case.
- */
- private int m_total;
-
- /**
- * Number of failing test case.
- */
- private int m_totalFailures;
-
- /**
- * Number of test case in error .
- */
- private int m_totalErrors;
-
- /**
- * Test results in error.
- */
- private List m_errors = new ArrayList();
-
- /**
- * Failing test results.
- */
- private List m_failures = new ArrayList();
-
- /**
- * Test results.
- */
- private List m_results = new ArrayList();
-
- /**
- * Log Service exposed by the plug-in framework.
- */
- private LogServiceImpl m_logService;
-
- /**
- * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you
- * enable it using the "maven.test.skip" property, because maven.test.skip disables both running the
- * tests and compiling the tests. Consider using the skipTests parameter instead.
- *
- * @parameter expression="${maven.test.skip}"
- */
- private boolean skip;
-
- /**
- * Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on
- * occasion.
- *
- * @parameter expression="${maven.test.failure.ignore}"
- */
- private boolean testFailureIgnore;
-
- /**
- * Set this to avoid printing test execution trace on System.out and System.err. This will be written in the
- * reports.
- * @parameter
- */
- private boolean hideOutputs;
-
- /**
- * Felix configuration.
- */
- private Map felixConf;
-
-
- /**
- * Executes the plug-in.
- * @throws MojoFailureException when the test execution failed.
- * @see org.apache.maven.plugin.AbstractMojo#execute()
- */
- public void execute() throws MojoFailureException {
-
- if (skip) {
- getLog().info("Tests are skipped");
- return;
- }
-
-
- List bundles = parseBundleList();
- bundles.addAll(getTestBundle());
-
- List activators = new ArrayList();
- m_logService = new LogServiceImpl();
- if (m_logEnable) { // Starts the log service if enabled
- activators.add(m_logService);
- } else {
- getLog().info("Log Service disabled");
- }
- activators.add(new Installer(m_pluginArtifacts, bundles, m_project, m_deployProjectArtifact));
- felixConf = new HashMap();
- felixConf.put("felix.systembundle.activators", activators);
- felixConf.put("org.osgi.framework.storage.clean", "onFirstInit");
- felixConf.put("ipojo.log.level", "WARNING");
- // Use a boot delagation to share classes between the host and the embedded Felix.
- // The cobertura package is used during code coverage collection
- //felixConf.put("org.osgi.framework.bootdelegation", "net.sourceforge.cobertura.coveragedata");
- felixConf.put("org.osgi.framework.system.packages.extra", "org.osgi.service.log;version=1.3, junit.framework;version=1.3");
-
- //felixConf.put("org.osgi.framework.system.packages.extra", "org.osgi.service.log, junit.framework");
-
- felixConf.put("org.osgi.framework.storage", m_targetDir.getAbsolutePath() + "/felix-cache");
-
- felixConf.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_FRAMEWORK);
-
- if (configuration != null) {
- felixConf.putAll(configuration);
- // Check boot delegation
-// String bd = (String) felixConf.get("org.osgi.framework.bootdelegation");
-//// if (bd.indexOf("junit.framework") == -1) {
-//// bd.concat(", junit.framework");
-//// }
-//// if (bd.indexOf("org.osgi.service.log") == -1) {
-//// bd.concat(", org.osgi.service.log");
-//// }
-// if (bd.indexOf("net.sourceforge.cobertura.coveragedata") == -1) {
-// bd.concat(", net.sourceforge.cobertura.coveragedata");
-// }
- }
-
- System.out.println("");
- System.out.println("-------------------------------------------------------");
- System.out.println(" T E S T S");
- System.out.println("-------------------------------------------------------");
-
- Felix felix = new Felix(felixConf);
- try {
- felix.start();
- } catch (BundleException e) {
- e.printStackTrace();
- }
-
- getLog().info("Felix started - Waiting for stability");
-
- waitForStability(felix.getBundleContext());
-
- getLog().info("Bundle Stability Reached - Waiting for runner service");
-
- Object runner = waitForRunnerService(felix.getBundleContext());
-
- if (runner == null) {
- throw new MojoFailureException("Cannot intialize the testing framework");
- }
-
- getLog().info("Runner Service available");
-
- invokeRun(runner, felix.getBundleContext());
-
- try {
- felix.stop();
- felix.waitForStop(5000);
- // Delete felix-cache
- File cache = new File(m_targetDir.getAbsolutePath() + "/felix-cache");
- cache.delete();
- } catch (Exception e) {
- getLog().error(e);
- }
-
- if (m_totalErrors > 0 || m_totalFailures > 0) {
- if (! testFailureIgnore) {
- throw new MojoFailureException("There are test failures. \n\n"
- + "Please refer to " + m_reportsDirectory.getAbsolutePath()
- + " for the individual test results.");
- } else {
- getLog().warn("There are test failures. \n\n"
- + "Please refer to " + m_reportsDirectory.getAbsolutePath()
- + " for the individual test results.");
- }
- }
-
- }
-
- /**
- * Waits for stability:
- *
- *
all bundles are activated
- *
service count is stable
- *
- * If the stability can't be reached after a specified time,
- * the method throws a {@link MojoFailureException}.
- * @param context the bundle context
- * @throws MojoFailureException when the stability can't be reach after a several attempts.
- */
- private void waitForStability(BundleContext context) throws MojoFailureException {
- // Wait for bundle initialization.
- boolean bundleStability = getBundleStability(context);
- int count = 0;
- while (!bundleStability && count < 500) {
- try {
- Thread.sleep(5);
- } catch (InterruptedException e) {
- // Interrupted
- }
- count++;
- bundleStability = getBundleStability(context);
- }
-
- if (count == 500) {
- getLog().error("Bundle stability isn't reached after 500 tries");
- dumpBundles(context);
- throw new MojoFailureException("Cannot reach the bundle stability");
- }
-
- //DEBUG
- Bundle[] bundles = context.getBundles();
- getLog().debug("Bundles List");
- for (int i = 0; i < bundles.length; i++) {
- getLog().debug(bundles[i].getSymbolicName() + " - " + bundles[i].getVersion() + " - " + bundles[i].getState());
- }
- getLog().debug("--------------");
- // END DEBUG
-
- boolean serviceStability = false;
- count = 0;
- int count1 = 0;
- int count2 = 0;
- while (! serviceStability && count < 500) {
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- count1 = refs.length;
- Thread.sleep(500);
- refs = context.getServiceReferences((String) null, null);
- count2 = refs.length;
- serviceStability = count1 == count2;
- } catch (Exception e) {
- getLog().error(e);
- serviceStability = false;
- // Nothing to do, while recheck the condition
- }
- count++;
- }
-
- if (count == 500) {
- getLog().error("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
- dumpBundles(context);
- throw new MojoFailureException("Cannot reach the service stability");
- }
-
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- getLog().debug("Service List");
- for (int i = 0; i < refs.length; i++) {
- String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS);
- List list = Arrays.asList(itfs);
- if (list.contains("org.apache.felix.ipojo.architecture.Architecture")) {
- getLog().debug(list.toString() + " - " + refs[i].getProperty("architecture.instance"));
- } else {
- getLog().debug(list.toString());
- }
- }
- getLog().debug("--------------");
- } catch (Exception e) {}
-
- }
-
- /**
- * Are bundle stables.
- * @param bc the bundle context
- * @return true if every bundles are activated.
- */
- private boolean getBundleStability(BundleContext bc) {
- boolean stability = true;
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- stability = stability && (bundles[i].getState() == Bundle.ACTIVE);
- }
- return stability;
- }
-
- /**
- * Computes the URL list of bundles to install from
- * the bundles parameter.
- * @return the list of url of bundles to install.
- */
- private List parseBundleList() {
- List toDeploy = new ArrayList();
- if (bundles == null) {
- return toDeploy;
- }
- for (int i = 0; i < bundles.size(); i++) {
- String bundle = (String) bundles.get(i);
- try {
- URL url = new URL(bundle);
- toDeploy.add(url);
- } catch (MalformedURLException e) {
- // Not a valid url,
- getLog().error(bundle + " is not a valid url, bundle ignored");
- }
- }
-
- return toDeploy;
- }
-
- /**
- * Computes the URL list of bundles to install from
- * test scoped dependencies.
- * @return the list of url of bundles to install.
- */
- private List getTestBundle() {
- List toDeploy = new ArrayList();
- Set dependencies = m_project.getDependencyArtifacts();
- for (Iterator artifactIterator = dependencies.iterator(); artifactIterator.hasNext();) {
- Artifact artifact = (Artifact) artifactIterator.next();
- if (artifact.getScope() != null) { // Select not null scope... [Select every bundles with a scope TEST, COMPILE and RUNTIME]
- File file = artifact.getFile();
- try {
- if (file.exists()) {
- if (file.getName().endsWith("jar") && ! file.getName().startsWith("org.apache.felix.ipojo-")) {
- JarFile jar = new JarFile(file);
- if (jar.getManifest().getMainAttributes().getValue("Bundle-ManifestVersion") != null) {
- toDeploy.add(file.toURI().toURL());
- }
- } // else {
-// getLog().info("The artifact " + artifact.getFile().getName() + " is not a Jar file.");
-// }
- } else {
- getLog().info("The artifact " + artifact.getFile().getName() + " does not exist.");
- }
- } catch (Exception e) {
- getLog().error(file + " is not a valid bundle, this artifact is ignored");
- }
- }
- }
- return toDeploy;
- }
-
- /**
- * Waits until the {@link OSGiJunitRunner} service
- * is published.
- * @param bc the bundle context
- * @return the {@link OSGiJunitRunner} service object.
- */
- private Object waitForRunnerService(BundleContext bc) {
- ServiceReference ref = bc.getServiceReference(org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner.class.getName());
- int count = 0;
- while (ref == null && count < 1000) {
- try {
- Thread.sleep(5);
- count++;
- } catch (InterruptedException e) {
- // Nothing to do
- }
- ref = bc.getServiceReference(org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner.class.getName());
- }
- if (ref != null) {
- return bc.getService(ref);
- }
- getLog().error("Junit Runner service unavailable");
-
- dumpServices(bc);
-
- return null;
- }
-
- /**
- * Executes tests by using reflection.
- * @param runner the {@link OSGiJunitRunner} service object
- * @param bc the bundle context
- */
- private void invokeRun(Object runner, BundleContext bc) {
- Method getTest;
-
- try {
- getTest = runner.getClass().getMethod("getTests", new Class[0]);
- List tests = (List) getTest.invoke(runner, new Object[0]);
- Method run = getRunMethod(runner);
- for (int i = 0; i < tests.size(); i++) {
- executeTest(runner, (Test) tests.get(i), run, bc);
- }
- System.out.println("\nResults :");
- if (m_failures.size() > 0) {
- System.out.println("\nFailed tests:");
- for (int i = 0; i < m_failures.size(); i++) {
- TestResult tr = (TestResult) m_failures.get(i);
- Enumeration e = tr.failures();
- while (e.hasMoreElements()) {
- TestFailure tf = (TestFailure) e.nextElement();
- System.out.println(" " + tf.toString());
- }
- }
- }
-
- if (m_failures.size() > 0) {
- System.out.println("\nTests in error:");
- for (int i = 0; i < m_errors.size(); i++) {
- TestResult tr = (TestResult) m_errors.get(i);
- Enumeration e = tr.errors();
- while (e.hasMoreElements()) {
- TestFailure tf = (TestFailure) e.nextElement();
- System.out.println(" " + tf.toString());
- }
- }
- }
-
- System.out.println("\nTests run: " + m_total + ", Failures: " + m_totalFailures + ", Errors:" + m_totalErrors + "\n");
- } catch (Exception e) {
- getLog().error(e);
- }
- }
-
- /**
- * Gets the {@link OSGiJunitRunner#run(long)} method from the
- * {@link OSGiJunitRunner} service object.
- * @param runner the {@link OSGiJunitRunner} service object.
- * @return the Method object for the run method.
- */
- private Method getRunMethod(Object runner) {
- Method[] methods = runner.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals("run")
- && methods[i].getParameterTypes().length == 1
- && ! methods[i].getParameterTypes()[0].equals(Long.TYPE)) {
- return methods[i];
- }
- }
- getLog().error("Cannot find the run method");
- return null;
- }
-
- /**
- * Computes the name of the given test.
- * This method calls the {@link TestCase#getName()}
- * method by reflection. If no success, invokes the
- * {@link Object#toString()} method.
- * @param test the test object.
- * @return the name of the given test.
- */
- private String getTestName(Object test) {
- try {
- Method getName = test.getClass().getMethod("getName", new Class[0]);
- String name = (String) getName.invoke(test, new Object[0]);
- if (name == null) {
- name = test.toString();
- }
- return name;
- } catch (Exception e) {
- getLog().error(e);
- return null;
- }
-
- }
-
- /**
- * Executes the given test.
- * @param runner the {@link OSGiJunitRunner} service object
- * @param test the test to run
- * @param run the {@link OSGiJunitRunner#run(long)} method
- * @param bc the bundle context
- */
- private void executeTest(Object runner, Test test, Method run,
- BundleContext bc) {
- try {
- XMLReport report = new XMLReport();
- String name = getTestName(test);
- System.out.println("Running " + name);
-
- TestResult tr = new TestResult();
- tr.addListener(new ResultListener(report));
- test.run(tr);
- m_results.add(tr);
-
- if (tr.wasSuccessful()) {
- System.out.println("Tests run: "
- + tr.runCount()
- + ", Failures: "
- + tr.failureCount()
- + ", Errors: "
- + tr.errorCount()
- + ", Time elapsed: "
- + report.elapsedTimeAsString(report.m_endTime
- - report.m_endTime) + " sec");
- } else {
- System.out.println("Tests run: "
- + tr.runCount()
- + ", Failures: "
- + tr.failureCount()
- + ", Errors: "
- + tr.errorCount()
- + ", Time elapsed: "
- + report.elapsedTimeAsString(report.m_endTime
- - report.m_endTime) + " sec <<< FAILURE!");
- if (tr.errorCount() > 0) {
- m_errors.add(tr);
- }
- if (tr.failureCount() > 0) {
- m_failures.add(tr);
- }
- }
-
- m_total += tr.runCount();
- m_totalFailures += tr.failureCount();
- m_totalErrors += tr.errorCount();
-
- report.generateReport(test, tr, m_reportsDirectory, bc, felixConf);
-
- } catch (Exception e) {
- getLog().error(e);
- }
-
- }
-
- /**
- * Prints the bundle list.
- * @param bc the bundle context.
- */
- public void dumpBundles(BundleContext bc) {
- getLog().info("Bundles:");
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- getLog().info(bundles[i].getSymbolicName() + " - " + bundles[i].getState());
- }
- }
-
- /**
- * Prints the service list.
- * @param bc the bundle context.
- */
- public void dumpServices(BundleContext bc) {
- getLog().info("Services:");
- ServiceReference[] refs = null;
- try {
- refs = bc.getAllServiceReferences(null, null);
- } catch (InvalidSyntaxException e) {
- e.printStackTrace();
- }
- for (int i = 0; i < refs.length; i++) {
- String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS);
- String bundle = refs[i].getBundle().getSymbolicName();
- getLog().info(bundle + " : " + Arrays.toString(itfs));
- }
- }
-
- public LogServiceImpl getLogService() {
- return m_logService;
- }
-
-
- private class ResultListener implements TestListener {
-
- /**
- * The XML Report.
- */
- private XMLReport m_report;
-
- /**
- * Check if the test has failed or thrown an
- * error.
- */
- private boolean m_abort;
-
- /**
- * Backup of the {@link System#out} stream.
- */
- private PrintStream m_outBackup = System.out;
-
- /**
- * Backup of the {@link System#err} stream.
- */
- private PrintStream m_errBackup = System.err;
-
- /**
- * The output stream used during the test execution.
- */
- private StringOutputStream m_out = new StringOutputStream();
-
- /**
- * The error stream used during the test execution.
- */
- private StringOutputStream m_err = new StringOutputStream();;
-
- /**
- * Creates a ResultListener.
- * @param report the XML report
- */
- public ResultListener(XMLReport report) {
- this.m_report = report;
- }
-
- /**
- * An error occurs during the test execution.
- * @param test the test in error
- * @param throwable the thrown error
- * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
- */
- public void addError(Test test, Throwable throwable) {
- m_report.testError(test, throwable, m_out.toString(), m_err.toString(), getLogService().getLoggedMessages());
- m_abort = true;
- }
-
- /**
- * An failure occurs during the test execution.
- * @param test the failing test
- * @param assertionfailederror the failure
- * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError)
- */
- public void addFailure(Test test,
- AssertionFailedError assertionfailederror) {
- m_report.testFailed(test, assertionfailederror, m_out.toString(), m_err.toString(), getLogService().getLoggedMessages());
- m_abort = true;
-
- }
-
- /**
- * The test ends.
- * @param test the test
- * @see junit.framework.TestListener#endTest(junit.framework.Test)
- */
- public void endTest(Test test) {
- if (!m_abort) {
- m_report.testSucceeded(test);
- }
- System.setErr(m_errBackup);
- System.setOut(m_outBackup);
- getLogService().reset();
- }
-
- /**
- * The test starts.
- * @param test the test
- * @see junit.framework.TestListener#startTest(junit.framework.Test)
- */
- public void startTest(Test test) {
- m_abort = false;
- m_report.testStarting();
- System.setErr(new ReportPrintStream(m_err,m_errBackup, hideOutputs));
- System.setOut(new ReportPrintStream(m_out, m_outBackup, hideOutputs));
- getLogService().enableOutputStream();
- }
-
- }
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java
deleted file mode 100644
index 16ab48b034..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import junit.framework.Test;
-
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Test report.
- * This class is provides the basics to support several output format.
- * @author Felix Project Team
- */
-public class Report {
-
- /**
- * New line constant.
- */
- protected static final String NL = System.getProperty("line.separator");
-
- /**
- * Number of ran tests.
- */
- protected int m_completedCount;
-
- /**
- * Number of errors.
- */
- protected int m_errorsCount;
-
- /**
- * Number of failures.
- */
- protected int m_failuresCount;
-
-
- /**
- * Time at the beginning of the test execution.
- */
- protected long m_startTime;
-
- /**
- * Time at the end of the test execution.
- */
- protected long m_endTime;
-
- /**
- * Failing tests.
- */
- private List m_failureSources = new ArrayList();
-
- /**
- * Tests in error.
- */
- private List m_errorSources = new ArrayList();
-
- /**
- * Double format.
- */
- private NumberFormat m_numberFormat = NumberFormat.getInstance(Locale.US);
-
- /**
- * Gets failing tests.
- * @return the list of failing tests.
- */
- public List getFailureSources() {
- return this.m_failureSources;
- }
-
- /**
- * Gets tests in error.
- * @return the list of test throwing unexpected exceptions
- */
- public List getErrorSources() {
- return this.m_errorSources;
- }
-
- /**
- * Callback called when a test starts.
- */
- public void testStarting() {
- m_startTime = System.currentTimeMillis();
- }
-
- /**
- * Callback called when a test ends successfully.
- */
- public void testSucceeded() {
- endTest();
- }
-
- /**
- * Callback called when a test throws an unexpected error.
- * @param test the test in error.
- */
- public void testError(Test test) {
- ++m_errorsCount;
- m_errorSources.add(test.toString());
- endTest();
- }
-
- /**
- * Callback called when a test fails.
- * @param test the failing test.
- */
- public void testFailed(Test test) {
- ++m_failuresCount;
- m_failureSources.add(test.toString());
- endTest();
- }
-
- /**
- * Callback called when a test ends.
- * This method handles common action when a test ends.
- */
- private void endTest() {
- ++m_completedCount;
-
- m_endTime = System.currentTimeMillis();
-
- if (m_startTime == 0) {
- m_startTime = m_endTime;
- }
- }
-
-
- public int getNumErrors() {
- return m_errorsCount;
- }
-
- public int getNumFailures() {
- return m_failuresCount;
- }
-
- public int getNumTests() {
- return m_completedCount;
- }
-
- /**
- * Reset the report.
- */
- public void reset() {
- m_errorsCount = 0;
-
- m_failuresCount = 0;
-
- m_completedCount = 0;
-
- this.m_failureSources = new ArrayList();
-
- this.m_errorSources = new ArrayList();
-
- }
-
-
- /**
- * Returns the formatted String to display the given double.
- * @param runTime the elapsed time
- * @return the String displaying the elapsed time
- */
- protected String elapsedTimeAsString(long runTime) {
- return m_numberFormat.format((double) runTime / 1000);
- }
-
- /**
- * Returns the stack trace as String.
- * @param test the test
- * @param e the exception
- * @return stack trace as string.
- */
- protected String getStackTrace(Test test, Throwable e) {
-
- if (e == null) {
- return "";
- }
-
- StringWriter w = new StringWriter();
- if (e != null) {
- e.printStackTrace(new PrintWriter(w));
- w.flush();
- }
- String text = w.toString();
- String marker = "at " + test.toString();
-
- String[] lines = StringUtils.split(text, "\n");
- int lastLine = lines.length - 1;
- int causedByLine = -1;
- // skip first
- for (int i = 1; i < lines.length; i++) {
- String line = lines[i].trim();
- if (line.startsWith(marker)) {
- lastLine = i;
- } else if (line.startsWith("Caused by")) {
- causedByLine = i;
- break;
- }
- }
-
- StringBuffer trace = new StringBuffer();
- for (int i = 0; i <= lastLine; i++) {
- trace.append(lines[i]);
- trace.append("\n");
- }
-
- if (causedByLine != -1) {
- for (int i = causedByLine; i < lines.length; i++) {
- trace.append(lines[i]);
- trace.append("\n");
- }
- }
- return trace.toString();
- }
-
-
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java
deleted file mode 100644
index 97e8fd399b..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.OutputStream;
-import java.io.PrintStream;
-
-/**
- * Print stream dispatching on a given one and storing written data
- * in a output stream.
- * @author Felix Project Team
- */
-public class ReportPrintStream extends PrintStream {
-
- private PrintStream m_stream;
-
- private boolean m_duplicate;
-
- public ReportPrintStream(OutputStream out, PrintStream def, boolean hideOutput) {
- super(out);
- m_stream = def;
- m_duplicate = ! hideOutput;
- }
-
- public void println() {
- if (m_duplicate) { m_stream.println(); }
- super.println();
- }
-
-
- public void println(boolean x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(char x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(char[] x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(double x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(float x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(int x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
-
- public void println(long x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(Object x) {
- if (m_duplicate) { m_stream.println(x); }
- super.println(x);
- }
-
-
- public void println(String s) {
- if (m_duplicate) { m_stream.println(s); }
- super.println(s);
- }
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java
deleted file mode 100644
index fa0a1f7bae..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.OutputStream;
-import java.io.Serializable;
-
-/**
- * Provides an OutputStream to an internal String. Internally converts bytes to
- * a Strings and stores them in an internal StringBuffer.
- * @author Felix Project Team
- */
-public class StringOutputStream extends OutputStream implements Serializable {
-
- /**
- * Id.
- */
- private static final long serialVersionUID = -5912060965986156224L;
-
- /**
- * The internal destination StringBuffer.
- */
- protected StringBuffer m_buffer = null;
-
- /**
- * Creates new StringOutputStream, makes a new internal StringBuffer.
- */
- public StringOutputStream() {
- super();
- m_buffer = new StringBuffer();
- }
-
- /**
- * Returns the content of the internal StringBuffer as a String, the result
- * of all writing to this OutputStream.
- *
- * @return returns the content of the internal StringBuffer
- */
- public String toString() {
- return m_buffer.toString();
- }
-
- /**
- * Sets the internal StringBuffer to null.
- */
- public void close() {
- m_buffer = null;
-
- }
-
- /**
- * Writes and appends a byte array to StringOutputStream.
- *
- * @param b the byte array
- * @param off the byte array starting index
- * @param len the number of bytes from byte array to write to the stream
- */
- public void write(byte[] b, int off, int len) {
- if ((off < 0) || (len < 0) || (off + len) > b.length) {
- throw new IndexOutOfBoundsException(
- "StringOutputStream.write: Parameters out of bounds.");
- }
- byte[] bytes = new byte[len];
- for (int i = 0; i < len; i++) {
- bytes[i] = b[off];
- off++;
- }
- m_buffer.append(toCharArray(bytes));
- }
-
- /**
- * Writes and appends a single byte to StringOutputStream.
- *
- * @param b the byte as an int to add
- */
- public void write(int b) {
- m_buffer.append((char) b);
- }
-
- /**
- * Writes and appends a String to StringOutputStream.
- *
- * @param s the String to add
- */
- public void write(String s) {
- m_buffer.append(s);
- }
-
- /**
- * Converts byte array to char array.
- * @param barr input byte array
- * @return the char array corresponding to the
- * given byte array
- */
- public static char[] toCharArray(byte[] barr) {
- if (barr == null) {
- return null;
- }
- char[] carr = new char[barr.length];
- for (int i = 0; i < barr.length; i++) {
- carr[i] = (char) barr[i];
- }
- return carr;
- }
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java
deleted file mode 100644
index 9e2632eb43..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * 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.junit4osgi.plugin;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.Xpp3DomWriter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * This class generates test result as XML files compatible with Surefire.
- * @author Felix Project Team
- */
-public class XMLReport extends Report {
-
- /**
- * List of results.
- */
- private List m_results = new ArrayList();
-
- /**
- * A test ends successfully.
- * @param test the test executed successfully.
- */
- public void testSucceeded(Test test) {
- super.testSucceeded();
-
- long runTime = this.m_endTime - this.m_startTime;
-
- Xpp3Dom testCase = createTestElement(test, runTime);
-
- m_results.add(testCase);
- }
-
- /**
- * A test throws an unexpected errors.
- * @param test the test in error
- * @param e the thrown exception
- * @param out the output messages printed during the test execution
- * @param err the error messages printed during the test execution
- * @param log the messages logged during the test execution
- */
- public void testError(Test test, Throwable e, String out, String err, String log) {
- super.testError(test);
-
- writeTestProblems(test, e, "error", out, err, log);
- }
-
- /**
- * A test fails.
- * @param test the failing test
- * @param e the thrown failure
- * @param out the output messages printed during the test execution
- * @param err the error messages printed during the test execution
- * @param log the messages logged during the test execution
- */
- public void testFailed(Test test, Throwable e, String out, String err, String log) {
- super.testFailed(test);
-
- writeTestProblems(test, e, "failure", out, err, log);
- }
-
- /**
- * Utility method writing failed and in error test result in the report.
- * @param test the test
- * @param e the thrown error
- * @param name type of failure ("error" or "failure")
- * @param out the output messages printed during the test execution
- * @param err the error messages printed during the test execution
- * @param log the messages logged during the test execution
- */
- private void writeTestProblems(Test test, Throwable e, String name, String out, String err, String log) {
-
- long runTime = m_endTime - m_startTime;
-
- Xpp3Dom testCase = createTestElement(test, runTime);
-
- Xpp3Dom element = createElement(testCase, name);
-
- String stackTrace = getStackTrace(test, e);
-
- Throwable t = e;
-
- if (t != null) {
-
- String message = t.getMessage();
-
- if (message != null) {
- element.setAttribute("message", message);
-
- element.setAttribute("type",
- stackTrace.indexOf(":") > -1 ? stackTrace.substring(0,
- stackTrace.indexOf(":")) : stackTrace);
- } else {
- element.setAttribute("type", new StringTokenizer(stackTrace)
- .nextToken());
- }
- }
-
- if (stackTrace != null) {
- element.setValue(stackTrace);
- }
-
- addOutputStreamElement(out, "system-out", testCase);
-
- addOutputStreamElement(err, "system-err", testCase);
-
- if (log != null) {
- addOutputStreamElement(log, "log-service", testCase);
- }
-
- m_results.add(testCase);
- }
-
- /**
- * Generates the XML reports.
- * @param test the test
- * @param tr the test result
- * @param reportsDirectory the directory in which reports are created.
- * @param bc the bundle context (to get installed bundles)
- * @param configuration the Felix configuration
- * @throws Exception when the XML report cannot be generated correctly
- */
- public void generateReport(Test test, TestResult tr, File reportsDirectory,
- BundleContext bc, Map configuration) throws Exception {
- long runTime = this.m_endTime - this.m_startTime;
-
- Xpp3Dom testSuite = createTestSuiteElement(test, runTime);
-
- showProperties(testSuite, bc, configuration);
-
- testSuite.setAttribute("tests", String.valueOf(tr.runCount()));
-
- testSuite.setAttribute("errors", String.valueOf(tr.errorCount()));
-
- testSuite.setAttribute("failures", String.valueOf(tr.failureCount()));
-
- for (Iterator i = m_results.iterator(); i.hasNext();) {
- Xpp3Dom testcase = (Xpp3Dom) i.next();
- testSuite.addChild(testcase);
- }
-
- File reportFile = new File(reportsDirectory, "TEST-"
- + getReportName(test).replace(' ', '_') + ".xml");
-
- File reportDir = reportFile.getParentFile();
-
- reportDir.mkdirs();
-
- PrintWriter writer = null;
-
- try {
- writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
- new FileOutputStream(reportFile), "UTF-8")));
-
- writer.write("" + NL);
-
- Xpp3DomWriter.write(new PrettyPrintXMLWriter(writer), testSuite);
- } catch (UnsupportedEncodingException e) {
- throw new Exception("Unable to use UTF-8 encoding", e);
- } catch (FileNotFoundException e) {
- throw new Exception("Unable to create file: " + e.getMessage(), e);
- } finally {
- IOUtil.close(writer);
- }
- }
-
- /**
- * Creates a XML test case element.
- * @param test the test
- * @param runTime the elapsed time to execute the test.
- * @return the XML element describing the given test.
- */
- private Xpp3Dom createTestElement(Test test, long runTime) {
- Xpp3Dom testCase = new Xpp3Dom("testcase");
- testCase.setAttribute("name", getReportName(test));
- double time = (double) runTime / (double) 1000;
- testCase.setAttribute("time", Double.toString(time));
- testCase.setAttribute("classname", test.getClass().getName());
- return testCase;
- }
-
- /**
- * Creates a XML test suite element.
- * @param test the test
- * @param runTime the elapsed time to execute the test suite.
- * @return the XML element describing the given test suite.
- */
- private Xpp3Dom createTestSuiteElement(Test test, long runTime) {
- Xpp3Dom testCase = new Xpp3Dom("testsuite");
- testCase.setAttribute("name", getReportName(test));
- testCase.setAttribute("time", Long.toString(runTime));
- return testCase;
- }
-
- /**
- * Computes report name.
- * @param test the test
- * @return the report name
- */
- private static String getReportName(Test test) {
- String report = test.toString();
-
- if (report.indexOf("(") > 0) {
- report = report.substring(0, report.indexOf("("));
- }
- return report;
- }
-
- /**
- * Creates an XML element.
- * @param element the parent element
- * @param name the name of the element to create
- * @return the resulting XML tree.
- */
- private Xpp3Dom createElement(Xpp3Dom element, String name) {
- Xpp3Dom component = new Xpp3Dom(name);
-
- element.addChild(component);
-
- return component;
- }
-
- /**
- * Adds system properties to the XML report.
- * This method also adds installed bundles.
- * @param testSuite the XML element.
- * @param bc the bundle context
- * @param configuration the configuration of the underlying OSGi platform
- */
- private void showProperties(Xpp3Dom testSuite, BundleContext bc, Map configuration) {
- Xpp3Dom properties = createElement(testSuite, "properties");
-
- Properties systemProperties = System.getProperties();
-
- if (systemProperties != null) {
- Enumeration propertyKeys = systemProperties.propertyNames();
-
- while (propertyKeys.hasMoreElements()) {
- String key = (String) propertyKeys.nextElement();
-
- String value = systemProperties.getProperty(key);
-
- if (value == null) {
- value = "null";
- }
-
- Xpp3Dom property = createElement(properties, "property");
-
- property.setAttribute("name", key);
-
- property.setAttribute("value", value);
-
- }
- }
-
- if (configuration != null) {
- Iterator it = configuration.keySet().iterator();
-
- while (it.hasNext()) {
- String key = (String) it.next();
-
- Object obj = (Object) configuration.get(key);
- String value = null;
- if (obj == null) {
- value = "null";
- } else if (obj instanceof String) {
- value = (String) obj;
- } else {
- value = obj.toString();
- }
-
- Xpp3Dom property = createElement(properties, "property");
-
- property.setAttribute("name", key);
-
- property.setAttribute("value", value);
-
- }
- }
-
- Xpp3Dom bundle = createElement(properties, "property");
- Bundle[] bundles = bc.getBundles();
- for (int i = 0; i < bundles.length; i++) {
- String sn = bundles[i].getSymbolicName();
- String state = "UNKNOWN";
- switch (bundles[i].getState()) {
- case Bundle.ACTIVE:
- state = "ACTIVE";
- break;
- case Bundle.INSTALLED:
- state = "INSTALLED";
- break;
- case Bundle.RESOLVED:
- state = "RESOLVED";
- break;
- case Bundle.UNINSTALLED:
- state = "UNINSTALLED";
- break;
- default:
- break;
- }
- bundle.setAttribute("name", "bundle-" + sn);
- bundle.setAttribute("value", state);
- }
-
- }
-
- /**
- * Adds messages written during the test execution in the
- * XML tree.
- * @param stdOut the messages
- * @param name the name of the stream (out, error, log)
- * @param testCase the XML tree
- */
- private void addOutputStreamElement(String stdOut, String name,
- Xpp3Dom testCase) {
- if (stdOut != null && stdOut.trim().length() > 0) {
- createElement(testCase, name).setValue(stdOut);
- }
- }
-
-}
diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java
deleted file mode 100644
index bb795ac5bb..0000000000
--- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.junit4osgi.plugin.log;
-
-import org.apache.felix.ipojo.junit4osgi.plugin.StringOutputStream;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * An implementation of the log service to collect logged messages.
- * This service implementation is also {@link BundleActivator} and is
- * activated when the embedded OSGi platform starts.
- * @author Felix Project Team
- */
-public class LogServiceImpl implements LogService, BundleActivator {
-
- /**
- * Default output stream (not collected).
- */
- private StringOutputStream m_defaultStream;
-
- /**
- * Collected output stream.
- */
- private StringOutputStream m_outputStream;
-
- /**
- * Creates the log service object.
- */
- public LogServiceImpl() {
- m_defaultStream = new StringOutputStream();
- }
-
- /**
- * Enables the log messages collection.
- */
- public void enableOutputStream() {
- m_outputStream = new StringOutputStream();
- }
-
- /**
- * Get collected log messages.
- * @return the String containing the logged messages.
- */
- public String getLoggedMessages() {
- return m_outputStream.toString();
- }
-
- /**
- * Re-initializes the collected message list.
- */
- public void reset() {
- m_outputStream = null;
- }
-
- /**
- * Logs a message.
- * @param arg0 the log level
- * @param arg1 the message
- * @see org.osgi.service.log.LogService#log(int, java.lang.String)
- */
- public void log(int arg0, String arg1) {
- write(computeLogMessage(arg0, arg1, null));
- }
-
- /**
- * Logs a message with an attached exception.
- * @param arg0 the log level
- * @param arg1 the message
- * @param arg2 the associated exception
- * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable)
- */
- public void log(int arg0, String arg1, Throwable arg2) {
- write(computeLogMessage(arg0, arg1, arg2));
- }
-
- /**
- * Logs a message raised by the given service reference.
- * @param arg0 the service reference
- * @param arg1 the log level
- * @param arg2 the message
- * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
- */
- public void log(ServiceReference arg0, int arg1, String arg2) {
- write(computeLogMessage(arg1, arg2, null));
- }
-
- /**
- * Logs a message raised by the given service reference
- * associated with an exception.
- * @param arg0 the service reference
- * @param arg1 the log level
- * @param arg2 the message
- * @param arg3 the exception
- * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String)
- */
- public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3) {
- write(computeLogMessage(arg1, arg2, arg3));
- }
-
- /**
- * Computes the string from the message.
- * @param level the log level
- * @param msg the message
- * @param exception the exception (can be null
- * @return the resulting String
- */
- private String computeLogMessage(int level, String msg, Throwable exception) {
- String message = null;
- switch (level) {
- case LogService.LOG_DEBUG:
- message = "[DEBUG] " + msg;
- break;
- case LogService.LOG_ERROR:
- message = "[ERROR] " + msg;
- break;
- case LogService.LOG_INFO:
- message = "[INFO] " + msg;
- break;
- case LogService.LOG_WARNING:
- message = "[WARNING] " + msg;
- break;
- default:
- break;
- }
-
- if (exception != null) {
- message = message + " : " + exception.getMessage() + "\n";
- }
-
- return message;
- }
-
- /**
- * Writes the given message in the adequate output stream.
- * @param log the message
- */
- public void write(String log) {
- if (m_outputStream != null) {
- m_outputStream.write(log);
- } else {
- m_defaultStream.write(log);
- }
- }
-
- /**
- * Stars the log service implementation:
- * Registers the service.
- * @param bc the bundle context.
- * @throws Exception should not happen.
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bc) throws Exception {
- bc.registerService(LogService.class.getName(), this, null);
- }
-
- /**
- * Stops the log service implementation.
- * Does nothing.
- * @param arg0 the bundle context
- * @throws Exception should not happen.
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext arg0) throws Exception {
- // Nothing to do.
-
- }
-
-}
diff --git a/ipojo/junit4osgi/pom.xml b/ipojo/junit4osgi/pom.xml
deleted file mode 100644
index 72457e9499..0000000000
--- a/ipojo/junit4osgi/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- Junit4OSGi
- org.apache.felix
- 1.1.0-SNAPSHOT
- Apache Felix iPOJO Junit4OSGi
- pom
-
-
- junit4osgi
- felix-command
- maven-junit4osgi-plugin
- immediate-launcher
-
-
-
-
- java5
-
- 1.5
-
-
- swing-runner
-
-
-
- java6
-
- 1.6
-
-
- swing-runner
-
-
-
-
diff --git a/ipojo/junit4osgi/swing-runner/LICENSE b/ipojo/junit4osgi/swing-runner/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/ipojo/junit4osgi/swing-runner/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/ipojo/junit4osgi/swing-runner/NOTICE b/ipojo/junit4osgi/swing-runner/NOTICE
deleted file mode 100644
index 18acb796b7..0000000000
--- a/ipojo/junit4osgi/swing-runner/NOTICE
+++ /dev/null
@@ -1,27 +0,0 @@
-Apache Felix iPOJO junit4osgi Swing Runner
-Copyright 2008-2009 The Apache Software Foundation
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-II. Used Software
-
-This product uses software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2007).
-Licensed under the Apache License 2.0.
-
-This product uses software developed by
-Junit project (http://junit.org)
-Licensed under Common Public License 1.0.
-
-III. License Summary
-- Apache License 2.0
-- Common Public License 1.0
diff --git a/ipojo/junit4osgi/swing-runner/doc/changelog.txt b/ipojo/junit4osgi/swing-runner/doc/changelog.txt
deleted file mode 100644
index 524e88b133..0000000000
--- a/ipojo/junit4osgi/swing-runner/doc/changelog.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Version 1.0.0
--------------
- * Initial release
\ No newline at end of file
diff --git a/ipojo/junit4osgi/swing-runner/metadata.xml b/ipojo/junit4osgi/swing-runner/metadata.xml
deleted file mode 100644
index 958bfc48b9..0000000000
--- a/ipojo/junit4osgi/swing-runner/metadata.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/junit4osgi/swing-runner/pom.xml b/ipojo/junit4osgi/swing-runner/pom.xml
deleted file mode 100644
index 0716a0a6e9..0000000000
--- a/ipojo/junit4osgi/swing-runner/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 2.1
-
- 4.0.0
- bundle
- Junit4Osgi-Swing-GUI
- org.apache.felix.ipojo.junit4osgi.swing-gui
- 1.1.0-SNAPSHOT
-
-
- ${project.groupId}
- org.apache.felix.ipojo.junit4osgi
- 1.1.0-SNAPSHOT
-
-
- junit
- junit
- 3.8.1
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 2.3.5
- true
-
-
- Apache Felix iPOJO OSGi Junit Runner - Swing Gui
- ${project.artifactId}
- org.apache.felix.ipojo.junit4osgi.command
-
- org.osgi.framework;version=1.3,*
-
- <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true
-
-
-
-
- org.apache.felix
- bnd-ipojo-plugin
- 1.0.0-SNAPSHOT
-
-
-
-
- org.codehaus.mojo
- rat-maven-plugin
-
- false
- true
- true
-
- doc/*
- maven-eclipse.xml
- .checkstyle
- .externalToolBuilders/*
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
-
-
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
- error
-
-
-
-
-
diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java
deleted file mode 100644
index 3370f1a1ff..0000000000
--- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.junit4osgi.command;
-
-import java.awt.Color;
-import java.awt.Component;
-
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableCellRenderer;
-
-/**
- * Test result renderer.
- * @author Felix Project Team
- */
-public class ResultCellRenderer extends DefaultTableCellRenderer {
-
- /**
- * UUID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Renderer method.
- * @param table the table
- * @param value the value
- * @param isSelected is the cell selected
- * @param hasFocus has the cell the focus
- * @param row the cell row
- * @param column the cell column
- * @return the resulting component
- * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
- */
- public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
- Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-
- ResultTableModel results = (ResultTableModel) table.getModel();
- String status = (String) results.getValueAt(row, column);
- if (status.equals(ResultTableModel.SUCCESS)) {
- c.setForeground(Color.GREEN);
- setToolTipText(results.getMessage(row, column));
- }
- if (status.equals(ResultTableModel.FAILURE)) {
- c.setForeground(Color.ORANGE);
- setToolTipText(results.getMessage(row, column));
- }
- if (status.equals(ResultTableModel.ERROR)) {
- c.setForeground(Color.RED);
- setToolTipText(results.getMessage(row, column));
- }
-
- return c;
- }
-}
diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java
deleted file mode 100644
index bf457ba383..0000000000
--- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * 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.junit4osgi.command;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.table.AbstractTableModel;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-/**
- * Result Table Model.
- * Store the results of executed tests.
- * @author Felix Project Team
- */
-public class ResultTableModel extends AbstractTableModel {
-
- /**
- * Success String.
- */
- public static final String SUCCESS = "success";
-
- /**
- * Failure String.
- */
- public static final String FAILURE = "failure";
-
- /**
- * Error String.
- */
- public static final String ERROR = "error";
-
- /**
- * UUDI.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * List of results.
- */
- private List m_results = new ArrayList();
-
- public int getRowCount() {
- return m_results.size();
- }
-
- public int getColumnCount() {
- return 2;
- }
-
- /**
- * Adds a failing test.
- * @param t the test
- * @param e the assertion error
- */
- public void addTest(Test t, AssertionFailedError e) {
- TestRecord rec = new TestRecord(t, e);
- m_results.add(rec);
- fireTableDataChanged();
- }
-
- /**
- * Adds a test in error.
- * @param t the test
- * @param e the thrown error
- */
- public void addTest(Test t, Throwable e) {
- TestRecord rec = new TestRecord(t, e);
- m_results.add(rec);
- fireTableDataChanged();
- }
-
- /**
- * Adds a sucessfull test.
- * @param t the test
- */
- public void addTest(Test t) {
- if (!contains(t)) {
- TestRecord rec = new TestRecord(t);
- m_results.add(rec);
- fireTableDataChanged();
- }
- }
-
- public int getTestCount() {
- return m_results.size();
- }
-
- /**
- * Gets the number of success.
- * @return the number of success
- */
- public int getSucess() {
- int count = 0;
- for (TestRecord test : m_results) {
- if (test.m_wasSucessFull) {
- count++;
- }
- }
- return count;
- }
-
- /**
- * Gets the number of errors.
- * @return the number of errors
- */
- public int getErrors() {
- int count = 0;
- for (TestRecord test : m_results) {
- if (test.m_error != null) {
- count++;
- }
- }
- return count;
- }
-
- /**
- * Gets the number of failures.
- * @return the number of failures
- */
- public int getFailures() {
- int count = 0;
- for (TestRecord test : m_results) {
- if (test.m_failure != null) {
- count++;
- }
- }
- return count;
- }
-
-
- /**
- * Does the result list contains the given test.
- * @param t the test
- * @return true if the list contains the test.
- */
- private boolean contains(Test t) {
- for (TestRecord test : m_results) {
- if (test.m_test.equals(t)) { return true; }
- }
- return false;
- }
-
- /**
- * Clear the list.
- */
- public void clear() {
- m_results.clear();
- fireTableDataChanged();
- }
-
- /**
- * Get the Object placed in the JTable.
- * @param rowIndex the row
- * @param columnIndex the column
- * @return the object
- * @see javax.swing.table.TableModel#getValueAt(int, int)
- */
- public Object getValueAt(int rowIndex, int columnIndex) {
- if (columnIndex == 0) { return m_results.get(rowIndex).m_test; }
- if (columnIndex == 1) {
- TestRecord tr = m_results.get(rowIndex);
- if (tr.m_wasSucessFull) { return SUCCESS; }
- if (tr.m_failure != null) { return FAILURE; }
- if (tr.m_error != null) { return ERROR; }
- }
- return null;
- }
-
- /**
- * Gets column names.
- * @param column the column
- * @return the column name
- * @see javax.swing.table.AbstractTableModel#getColumnName(int)
- */
- public String getColumnName(int column) {
- if (column == 0) { return "Test"; }
-
- if (column == 1) { return "Status"; }
-
- return null;
- }
-
- /**
- * Gets the message.
- * @param row the row
- * @param column the column
- * @return the message for this cell
- */
- public String getMessage(int row, int column) {
- if (row == -1) { return null; }
- TestRecord rec = m_results.get(row);
- if (rec.m_wasSucessFull) { return "The test " + rec.m_test + " was executed sucessfully."; }
- if (rec.m_failure != null) { return "The test " + rec.m_test + " has failed : \n" + rec.m_failure.getMessage(); }
- if (rec.m_error != null) {
- String message = "The test " + rec.m_test + " has thrown an error : \n" + rec.m_error.getMessage();
- StringWriter sw = new StringWriter();
- rec.m_error.printStackTrace(new PrintWriter(sw));
- message += "\n" + sw.toString();
- return message;
- }
- return "";
- }
-
- private class TestRecord {
- /**
- * Was the test successful?
- */
- private boolean m_wasSucessFull;
-
- /**
- * The test.
- */
- private Test m_test;
-
- /**
- * The failure.
- */
- private AssertionFailedError m_failure;
-
- /**
- * The error.
- */
- private Throwable m_error;
-
- /**
- * Creates a TestRecord.
- * @param t the test
- * @param e the failure
- */
- public TestRecord(Test t, AssertionFailedError e) {
- m_test = t;
- m_wasSucessFull = false;
- m_failure = e;
- }
-
- /**
- * Creates a TestRecord.
- * @param t the test
- * @param e the error
- */
- public TestRecord(Test t, Throwable e) {
- m_test = t;
- m_wasSucessFull = false;
- m_error = e;
- }
-
- /**
- * Creates a TestRecord.
- * @param t the test
- */
- public TestRecord(Test t) {
- m_test = t;
- m_wasSucessFull = true;
- }
- }
-
-}
diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form
deleted file mode 100644
index d7fc05038d..0000000000
--- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form
+++ /dev/null
@@ -1,317 +0,0 @@
-
-
-
diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java
deleted file mode 100644
index ed5133debb..0000000000
--- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java
+++ /dev/null
@@ -1,543 +0,0 @@
-package org.apache.felix.ipojo.junit4osgi.command;
-/*
- * 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.
- */
-
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestResult;
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-import javax.swing.*;
-import javax.swing.table.TableColumn;
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Swing Runner for Junit4Osgi.
- *
- * @author Felix Project Team
- */
-public class SwingRunner extends javax.swing.JFrame implements BundleListener {
-
- /**
- * UUID.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Bundle context (to register the bundle listener).
- */
- private BundleContext m_context;
-
- /**
- * OSGi Junit Runner Service.
- */
- private OSGiJunitRunner m_runner;
-
- /**
- * State variable describing if we are executing tests.
- */
- private boolean m_running = false;
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton btnSearch;
- private javax.swing.JButton m_allButton;
- private javax.swing.JButton m_executeButton;
- private javax.swing.JLabel m_executedResults;
- private javax.swing.JScrollPane m_message;
- private javax.swing.JTextArea m_messageArea;
- private javax.swing.JButton m_ok;
- private javax.swing.JProgressBar m_progress;
- private javax.swing.JDialog m_resultDialog;
- private javax.swing.JScrollPane m_resultScroll;
- private javax.swing.JTable m_resultTable;
- private javax.swing.JPanel m_statusBar;
- private javax.swing.JList m_suiteList;
- private javax.swing.JScrollPane m_suiteScroll;
- private javax.swing.JTextField txtSearchTest;
- // End of variables declaration//GEN-END:variables
-
-
- public SwingRunner(BundleContext bc) {
- m_running = false;
- m_context = bc;
- }
-
-
- private void internalInitComponents() {
- initComponents();
- }
-
-
-
- /**
- * Start method.
- */
- public void start() {
- internalInitComponents();
- setVisible(true);
- m_resultDialog.setVisible(false);
- refreshSuites();
- m_context.addBundleListener(this);
- m_executedResults.setText(" \t No executed tests");
- m_progress.setIndeterminate(false);
- m_progress.setMaximum(100);
- m_progress.setValue(100);
-
- TableColumn column = null;
- for (int i = 0; i < m_resultTable.getColumnCount(); i++) {
- column = m_resultTable.getColumnModel().getColumn(i);
- if (i == 0) {
- column.setPreferredWidth(350); // first column is bigger
- } else {
- column.setPreferredWidth(50);
- column.setCellRenderer(new ResultCellRenderer());
- }
- }
- }
-
-
-
- /**
- * Stop method.
- */
- public void stop() {
- m_context.removeBundleListener(this);
- dispose();
- }
-
-
- /**
- * Refresh the list of available test suites.
- */
- @SuppressWarnings("unchecked")
- private void refreshSuites() {
-
- String textToSearch = txtSearchTest.getText();
- List tests = m_runner.getTests();
-
- TestListModel lm = (TestListModel) m_suiteList.getModel();
- lm.clear();
-
- for (Test test : tests) {
- String testName = test.toString();
- if (textToSearch != null && !textToSearch.trim().equals("")) {
- if (testName.toLowerCase().indexOf(textToSearch.toLowerCase()) != -1) {
-
- lm.addTest(test);
- }
- } else {
- // found all
- lm.addTest(test);
-
- }
- }
-
- //getInstanceManager().onExit(this, "refreshSuites", null);
- }
-
- /**
- * This method is called from within the constructor to
- * initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- m_resultDialog = new javax.swing.JDialog();
- m_message = new javax.swing.JScrollPane();
- m_messageArea = new javax.swing.JTextArea();
- m_ok = new javax.swing.JButton();
- m_statusBar = new javax.swing.JPanel();
- m_progress = new javax.swing.JProgressBar();
- m_executeButton = new javax.swing.JButton();
- m_allButton = new javax.swing.JButton();
- m_suiteScroll = new javax.swing.JScrollPane();
- m_suiteList = new javax.swing.JList();
- m_resultScroll = new javax.swing.JScrollPane();
- m_resultTable = new javax.swing.JTable();
- m_executedResults = new javax.swing.JLabel();
- txtSearchTest = new javax.swing.JTextField();
- btnSearch = new javax.swing.JButton();
-
- m_resultDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
- m_resultDialog.setMinimumSize(new java.awt.Dimension(1024, 600));
- m_resultDialog.addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosed(java.awt.event.WindowEvent evt) {
- onDialogClosed(evt);
- }
-
- public void windowClosing(java.awt.event.WindowEvent evt) {
- onDialogClosed(evt);
- }
- });
-
- m_message.setBorder(null);
- m_message.setMinimumSize(new java.awt.Dimension(300, 202));
- m_message.setPreferredSize(new java.awt.Dimension(300, 202));
-
- m_messageArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Panel.background"));
- m_messageArea.setColumns(20);
- m_messageArea.setEditable(false);
- m_messageArea.setLineWrap(true);
- m_messageArea.setRows(5);
- m_messageArea.setWrapStyleWord(true);
- m_messageArea.setMinimumSize(new java.awt.Dimension(300, 250));
- m_messageArea.setPreferredSize(new java.awt.Dimension(250, 200));
- m_message.setViewportView(m_messageArea);
-
- m_resultDialog.getContentPane().add(m_message, java.awt.BorderLayout.CENTER);
-
- m_ok.setText("Ok");
- m_ok.setPreferredSize(new java.awt.Dimension(120, 23));
- m_ok.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- okActionPerformed(evt);
- }
- });
- m_resultDialog.getContentPane().add(m_ok, java.awt.BorderLayout.SOUTH);
-
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- setTitle("Junit Runner");
- setMinimumSize(null);
-
- m_progress.setIndeterminate(true);
- m_progress.setMinimumSize(null);
- m_progress.setPreferredSize(null);
-
- javax.swing.GroupLayout m_statusBarLayout = new javax.swing.GroupLayout(m_statusBar);
- m_statusBar.setLayout(m_statusBarLayout);
- m_statusBarLayout.setHorizontalGroup(
- m_statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(m_progress, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE)
- );
- m_statusBarLayout.setVerticalGroup(
- m_statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(m_statusBarLayout.createSequentialGroup()
- .addComponent(m_progress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
-
- m_executeButton.setText("Execute");
- m_executeButton.setMaximumSize(new java.awt.Dimension(90, 23));
- m_executeButton.setMinimumSize(new java.awt.Dimension(90, 23));
- m_executeButton.setPreferredSize(new java.awt.Dimension(100, 23));
- m_executeButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- executeButtonActionPerformed(evt);
- }
- });
-
- m_allButton.setText("Select All");
- m_allButton.setMaximumSize(new java.awt.Dimension(90, 23));
- m_allButton.setMinimumSize(new java.awt.Dimension(90, 23));
- m_allButton.setPreferredSize(new java.awt.Dimension(100, 23));
- m_allButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- allButtonActionPerformed(evt);
- }
- });
-
- m_suiteScroll.setAutoscrolls(true);
-
- m_suiteList.setModel(new TestListModel());
- m_suiteList.setMaximumSize(null);
- m_suiteList.setMinimumSize(null);
- m_suiteList.setPreferredSize(null);
- m_suiteScroll.setViewportView(m_suiteList);
-
- m_resultScroll.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
-
- m_resultTable.setAutoCreateRowSorter(true);
- m_resultTable.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
- m_resultTable.setModel(new ResultTableModel());
- m_resultTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
- m_resultTable.setMaximumSize(null);
- m_resultTable.setMinimumSize(null);
- m_resultTable.setPreferredSize(null);
- m_resultTable.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- resultTableMouseClicked(evt);
- }
- });
- m_resultScroll.setViewportView(m_resultTable);
-
- m_executedResults.setText("aaaaaaaaaaaaaaa");
- m_executedResults.setPreferredSize(null);
-
- btnSearch.setText("Search");
- btnSearch.setMaximumSize(new java.awt.Dimension(90, 23));
- btnSearch.setMinimumSize(new java.awt.Dimension(90, 23));
- btnSearch.setPreferredSize(new java.awt.Dimension(100, 23));
- btnSearch.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnSearchActionPerformed(evt);
- }
- });
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(m_resultScroll, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(m_statusBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(m_executedResults, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(txtSearchTest, javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(m_suiteScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(m_executeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(m_allButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnSearch, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtSearchTest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(m_allButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(m_executeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(m_suiteScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(m_resultScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(m_executedResults, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(m_statusBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- );
-
- pack();
- }// //GEN-END:initComponents
-
-
- /**
- * Execute button action.
- *
- * @param evt : event.
- */
- private void executeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_executeButtonActionPerformed
- if (m_running) {
- return;
- }
- // Collect selected test.
- int[] indices = m_suiteList.getSelectedIndices();
- List list = new ArrayList(indices.length);
- TestListModel model = (TestListModel) m_suiteList.getModel();
- for (int i = 0; i < indices.length; i++) {
- list.add(model.getTestElementAt(indices[i]));
- }
- setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- executeTest(list);
- }//GEN-LAST:event_m_executeButtonActionPerformed
-
- /**
- * All button action.
- *
- * @param evt : event.
- */
- private void allButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_allButtonActionPerformed
- int max = m_suiteList.getModel().getSize();
- int[] indices = new int[max];
- for (int i = 0; i < max; i++) {
- indices[i] = i;
- }
- m_suiteList.setSelectedIndices(indices);
- }//GEN-LAST:event_m_allButtonActionPerformed
-
- /**
- * Listener on table click.
- *
- * @param evt : event.
- */
- private void resultTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_m_resultTableMouseClicked
- Point p = evt.getPoint();
- int row = m_resultTable.rowAtPoint(p);
- int col = m_resultTable.columnAtPoint(p);
- ResultTableModel model = (ResultTableModel) m_resultTable.getModel();
- String message = model.getMessage(row, col);
- if (message != null) {
- setEnabled(false);
- m_resultDialog.setTitle("Test Report");
- m_messageArea.setText(message);
- m_resultDialog.setVisible(true);
- }
- }//GEN-LAST:event_m_resultTableMouseClicked
-
- /**
- * Ok button action.
- *
- * @param evt : event.
- */
- private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_okActionPerformed
- m_resultDialog.setVisible(false);
- setEnabled(true);
- }//GEN-LAST:event_m_okActionPerformed
-
- /**
- * Listener when the test report is closed.
- *
- * @param evt : event.
- */
- private void onDialogClosed(java.awt.event.WindowEvent evt) {
- m_resultDialog.setVisible(false);
- setEnabled(true);
- }
-
-
- private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {
- refreshSuites();
-
- }
-
- /**
- * Execute method.
- *
- * @param list : list of test to execute.
- */
- private void executeTest(final List list) {
- Runnable thread = new Runnable() {
- public void run() {
- ResultTableModel model = (ResultTableModel) m_resultTable.getModel();
- m_running = true;
- m_executeButton.setText("Running...");
- m_progress.setIndeterminate(true);
- model.clear();
- for (int i = 0; i < list.size(); i++) {
- TestResult tr = new TestResult();
- tr.addListener(new MyTestListener());
- list.get(i).run(tr);
- }
- m_running = false;
- m_progress.setIndeterminate(false);
- m_progress.setMaximum(100);
- m_progress.setValue(100);
- m_executeButton.setText("Execute");
- computeExecutedTest();
- setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
-
- };
- new Thread(thread).start();
- }
-
- /**
- * Compute executed tests.
- * (Status bar message)
- */
- private void computeExecutedTest() {
- ResultTableModel results = (ResultTableModel) m_resultTable.getModel();
- String m = " \t ";
- m += results.getTestCount() + " tests executed / ";
- m += results.getSucess() + " success / ";
- m += results.getFailures() + " failures / ";
- m += results.getErrors() + " errors ";
- m_executedResults.setText(m);
- }
-
- private class MyTestListener implements junit.framework.TestListener {
- /**
- * Table model.
- */
- ResultTableModel m_model = (ResultTableModel) m_resultTable.getModel();
-
- /**
- * Add an error.
- *
- * @param arg0 : test which throws an error.
- * @param arg1 : thrown exception.
- * @see junit.framework.TestListener#addError(junit.framework.Test, Throwable)
- */
- public void addError(Test arg0, Throwable arg1) {
- m_model.addTest(arg0, arg1);
- adjustScroll();
- }
-
- /**
- * Add a failure.
- *
- * @param arg0 : failing test.
- * @param arg1 : thrown failure.
- * @see junit.framework.TestListener#addError(junit.framework.Test, Throwable)
- */
- public void addFailure(Test arg0, AssertionFailedError arg1) {
- m_model.addTest(arg0, arg1);
- adjustScroll();
- }
-
- /**
- * End of a test.
- *
- * @param arg0 : test.
- * @see junit.framework.TestListener#endTest(junit.framework.Test)
- */
- public void endTest(Test arg0) {
- m_model.addTest(arg0);
- adjustScroll();
- }
-
- /**
- * Start of a test.
- *
- * @param arg0 : test.
- * @see junit.framework.TestListener#startTest(junit.framework.Test)
- */
- public void startTest(Test arg0) {
- // Nothing to do here.
- }
-
- /**
- * Adjust the scrolling bar of the result table.
- */
- private void adjustScroll() {
- JScrollBar bar = m_resultScroll.getVerticalScrollBar();
- if ((bar != null) && (bar.isVisible())) {
- bar.setValue(Integer.MAX_VALUE);
- }
- }
-
- }
-
-
- public void bundleChanged(BundleEvent bundleevent) {
- refreshSuites();
-
- }
-
-}
\ No newline at end of file
diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java
deleted file mode 100644
index 3232dade1c..0000000000
--- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.junit4osgi.command;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.AbstractListModel;
-import junit.framework.Test;
-
-/**
- * Test Suite list model.
- * @author Felix Project Team
- */
-public class TestListModel extends AbstractListModel {
-
- /**
- * Id.
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * List of {@link TestRecord}.
- */
- private List m_list = new ArrayList();
-
- /**
- * Gets the element placed at the given index.
- * @param index the index
- * @return the element placed at the given index
- * or null if no element at this index
- * @see javax.swing.ListModel#getElementAt(int)
- */
- public Object getElementAt(int index) {
- if (index >= m_list.size()) {
- return null;
- } else {
- return m_list.get(index).m_name;
- }
- }
-
- /**
- * Gets the test object placed at the given index.
- * @param index the index
- * @return the test object placed at the given index
- */
- public Test getTestElementAt(int index) {
- return m_list.get(index).m_test;
- }
-
- /**
- * Adds a test.
- * @param test the test to add
- */
- public void addTest(Test test) {
- synchronized (this) {
- TestRecord tr = new TestRecord();
- tr.m_test = test;
- tr.m_name = test.toString();
- m_list.add(tr);
- }
- fireContentsChanged(this, m_list.size() - 1, m_list.size() - 1);
- }
-
- /**
- * Removes a test.
- * @param test the test to remove
- */
- public void removeTest(Test test) {
- int index = 1;
- synchronized (this) {
- for (TestRecord t : m_list) {
- if (t.m_test.equals(test)) {
- index = m_list.indexOf(t);
- m_list.remove(t);
- return;
- }
- }
- }
-
- if (index != -1) {
- fireContentsChanged(this, index, index);
- }
- }
-
- /**
- * Clears the list.
- */
- public void clear() {
- m_list.clear();
- }
-
- private class TestRecord {
- /**
- * The test.
- */
- public Test m_test;
-
- /**
- * The test name.
- */
- public String m_name;
- }
-
- /**
- * Gets the list size.
- * @return the list size.
- * @see javax.swing.ListModel#getSize()
- */
- public int getSize() {
- return m_list.size();
- }
-
-}
diff --git a/ipojo/manipulator/annotations/changelog.txt b/ipojo/manipulator/annotations/changelog.txt
deleted file mode 100644
index fec2deaa24..0000000000
--- a/ipojo/manipulator/annotations/changelog.txt
+++ /dev/null
@@ -1,225 +0,0 @@
-Changes from the 1.12.0 to 1.12.1
----------------------------------
-
-** Bug
- * [FELIX-4612] - @PostRegistration is not being called
- * [FELIX-4620] - Warning should be removed when @Configuration is used
- * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)
- * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level'
-
-Changes from the 1.11.2 to 1.12.0
----------------------------------
-
-** Improvement
- * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies
-
-** New Feature
- * [FELIX-4476] - Java 8 Support
-
-** Sub-task
- * [FELIX-4508] - Update to ASM 5.0.2
- * [FELIX-4509] - Change the frame computation strategy
-
-Changes from the 1.11.1 to 1.11.2
----------------------------------
-
-** Bug
- * [FELIX-4453] - Introduce manipulator BOM (Bill of Material)
-
-** Improvement
- * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes
-
-Changes from the 1.11.0 to 1.11.1
----------------------------------
-
-** Bug
- * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied
- * [FELIX-4347] - should ignore inner classes that are assigned to static fields
-
-Changes from the 1.10.1 to 1.11.0
----------------------------------
-
-** Bug
- * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging
- * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation
- * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style)
-
-** Improvement
- * [FELIX-4112] - Add meta annotations for handler description
- * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation
-
-** Task
- * [FELIX-4134] - Move integration-tests to the reactor
- * [FELIX-4151] - Fix mistakes in the javadoc tags
- * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x
- * [FELIX-4156] - Fix versions of maven plugins
- * [FELIX-4270] - Bump iPOJO package version to 1.11.0
-
-** Sub-task
- * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation
- * [FELIX-4254] - Specify the method id of methods from inner class
- * [FELIX-4255] - Extend the inner class manipulation to allow method interception
- * [FELIX-4256] - Avoid manipulation native and static methods from inner classes
-
-Changes from the 1.10.0 to 1.10.1
----------------------------------
-
-** Bug
- * [FELIX-4077] - Fix documentation urls in maven projects
- * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations
- * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern
- * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute
-
-** Improvement
- * [FELIX-4094] - Recognize add/remove method naming pattern
-
-** New Feature
- * [FELIX-4095] - Add CDI-like @Stereotype
-
-** Task
- * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project
- * [FELIX-4103] - Skip deployment of it-tests
- * [FELIX-4104] - Do not run integration-tests in the default build
-
-Changes from 1.8.6 to 1.10.0
-----------------------------
-
-** Bug
- * [FELIX-3451] - "instance.name" attribute not recognized
- * [FELIX-3843] - ClassCastException when listing service properties of a non-ComponentFactory Factory service
- * [FELIX-3895] - iPOJO instance is not shown (with the "arch" commands) if constructor is failing
- * [FELIX-3896] - Null reference are injected with @Bind(optional=false) method on iPOJO components
- * [FELIX-3918] - iPOJO Logger cannot be dynamically configured on Equinox and KF
- * [FELIX-3919] - iPOJO Proxies strategy cannot be configured dynamically on Equinox and KF
- * [FELIX-3920] - Creation Strategy does not work on KF3
- * [FELIX-3974] - Properties cannot be set as immutable using annotations
- * [FELIX-3995] - Missing options in Bind annotation
- * [FELIX-4041] - Properties starting with . should not be propagated
- * [FELIX-4048] - @Requires handler does not fail when no specification can be found
- * [FELIX-4053] - Avoid @StaticServiceProperty to be used on classes
- * [FELIX-4054] - Use current factory version to generate instance name if required
-
-** Improvement
- * [FELIX-3860] - factories and instances iPOJO gogo commands should show the "public=false" instances/factories
- * [FELIX-3932] - Allow dependency filter's to get context-source variables
- * [FELIX-4040] - Implement config admin support to handle binding location properly
- * [FELIX-4045] - Chain Exceptions when possible
-
-** New Feature
- * [FELIX-4034] - Instance configuration DSL
-
-** Task
- * [FELIX-3892] - Upgrade runtime codebase to Java 5
- * [FELIX-3903] - Migrate tests to pax exam 3
- * [FELIX-3921] - Update pom to latest Felix's parent
- * [FELIX-3948] - Define a new extender model
- * [FELIX-3978] - Check that we don't use java 6+ API
-
-** Wish
- * [FELIX-3926] - Provide metadata for the Extender namespace
-
-Changes from the 1.8.4 to 1.8.6
--------------------------------
-
-** Bug
- * [FELIX-3742] - Implementing class fails to load unless super interface's (interface extended by implemented interface) package is imported.
- * [FELIX-3789] - Deadlock due to synchronization on INSTANCE_NAME
- * [FELIX-3819] - The export directive of iPOJO is wrong
-
-Changes from the 1.8.2 to 1.8.4
---------------------------------
-
-** Bug
- * [FELIX-3451] - "instance.name" attribute not recognized
- * [FELIX-3500] - InstanceManager concurrency issue: "A methodID cannot be associated with a method from the POJO class"
- * [FELIX-3501] - IPojo FactoryStateListener doesn't get notified while stopping factory
- * [FELIX-3545] - Memory leak when unregistering a component used by an aggregate dependency with an unbind callback
- * [FELIX-3548] - Concurrent access during startup
- * [FELIX-3567] - iPOJO Configuration Handler should not reuse the dictionary object from the configuration admin
- * [FELIX-3576] - iPOJO fails when using constructor injection and expecting BundleContext in ctor
- * [FELIX-3599] - Problem with 'subservice action="instantiate"' in ipojo composite
- * [FELIX-3621] - Two dimensional array as argument to a method in a component
- * [FELIX-3672] - Potential Concurrent Modification Exception when a bundle is stopped
-
-** Improvement
- * [FELIX-3560] - Extensions to IPojo's Factory and ComponentInstance documentation for custom handlers
-
-Changes from the 1.8.0 to 1.8.2
--------------------------------
-** Improvement
- * [FELIX-3380] - minor javadoc corrections in @Temporal annotation
-
-Changes from the 1.6.4 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2568] - Rename Transactionnal to Transactional
-
-** Improvement
- * [FELIX-1428] - Constructor injection of Configuration properties
- * [FELIX-2620] - Change iPojo annotation parameters to follow java naming conventions
- * [FELIX-2621] - Rename annotations to remove collisions
- * [FELIX-2622] - Support static service properties that are not mirrored into fields
- * [FELIX-2624] - Support multiple whiteboards using annotations
- * [FELIX-2630] - Rename @Component attributes to follow the java naming conventions
- * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions
- * [FELIX-2633] - Rename JMX annotations
- * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision
- * [FELIX-2666] - Rename the temporal handler annotation to avoid collision
- * [FELIX-2742] - Constructor injection of service dependencies
-
-Changes from the 1.6.2 to 1.6.4
--------------------------------
-** Improvement
- * [FELIX-2420] - Enum support for @Property annotation
- * [FELIX-2461] - Allow specifying the targeted service interface in the @ServiceController
-
-Changes from the 1.6.0 to 1.6.2
--------------------------------
-** Improvement
- * [FELIX-2296] - Access to ServiceReference in iPOJO service.
-
-Changes from the 1.4.0 to 1.6.0
--------------------------------
-** Bug
- * [FELIX-1557] - Cosmetic change of the Bundle-Name and Bundle-SymbolicName in iPOJO annotations.
-
-** Improvement
- * [FELIX-1426] - Service injection with Dynamic Proxies
- * [FELIX-1427] - Service injection with Smart Proxies
- * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified
-
-** New Feature
- * [FELIX-2132] - Provides a way to control service exposition from the implementation class
-
-** Wish
- * [FELIX-1940] - Add @Instance annotation to declare instances without metadata.xml
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1319] - Issue in the metadata overriding analysis in iPOJO annotations
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-825] - Provide annotation for iPojo JMX Handler
- * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers
-
-** Bug
- * [FELIX-867] - iPOJO @ServiceProperty can target method
- * [FELIX-868] - iPOJO @Component don't support factory methods
-
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Improvement
- * [FELIX-627] - Temporal dependency annotation
-
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/manipulator/annotations/pom.xml b/ipojo/manipulator/annotations/pom.xml
deleted file mode 100644
index 895618e757..0000000000
--- a/ipojo/manipulator/annotations/pom.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 8
-
- 4.0.0
- org.apache.felix.ipojo.annotations
- 1.13.1-SNAPSHOT
- Apache Felix iPOJO Annotations
-
-
- iPOJO Annotation pack. contained annotations are used to define iPOJO component type.
-
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/how-to-use-ipojo-annotations.html
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 8
- 8
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
- -Xdoclint:none
-
-
-
-
-
diff --git a/ipojo/manipulator/annotations/src/main/appended-resources/NOTICE b/ipojo/manipulator/annotations/src/main/appended-resources/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java
deleted file mode 100644
index 51042e9092..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.Comparator;
-
-/**
- * This annotation declares a bind method.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Bind {
-
- /**
- * Set the dependency filter.
- * Default : no filter
- */
- String filter() default "";
-
- /**
- * Set if the dependency is an aggregate dependency.
- * Default : false
- */
- boolean aggregate() default false;
-
- /**
- * Set if the dependency is optional.
- * Default : false
- */
- boolean optional() default false;
-
- /**
- * Set the required specification.
- * Default : no specification, will be deduced.
- */
- Class specification() default Object.class;
-
- /**
- * Set the dependency id.
- * Default : empty
- */
- String id() default "";
-
- /**
- * Set the binding policy.
- * Acceptable policies are dynamic, static and dynamic-priority.
- * Default: dynamic.
- */
- BindingPolicy policy() default BindingPolicy.DYNAMIC;
-
- /**
- * Set the comparator.
- * The indicated class must implement {@link Comparator}
- */
- Class extends Comparator> comparator() default Comparator.class;
-
- /**
- * Set the from attribute.
- */
- String from() default "";
-
- /**
- * Set to true if the service dependency is injected
- * as a proxy.
- * Default: true
- */
- boolean proxy() default true;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java
deleted file mode 100644
index 6b8670118c..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.annotations;
-
-/**
-* Binding policies supported by iPOJO.
-*/
-public enum BindingPolicy {
- DYNAMIC,
- STATIC,
- DYNAMIC_PRIORITY;
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
deleted file mode 100644
index a38245dfa8..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Declares a component type (needed to create instances of the component).
- * This annotation is mandatory to declares an iPOJO component.
- *
- * Its usual to find it on top of class definition:
- *
- * {@code @Component}
- * public class MyComponent {
- * // ...
- * }
- *
- *
- * But, it is also possible to have it associated to a
- * {@linkplain org.apache.felix.ipojo.annotations.Stereotype stereotyped} annotation definition:
- *
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Component {
-
- /**
- * Set if the component type is public.
- * @see #publicFactory()
- * @deprecated renamed to publicFactory.
- */
- boolean public_factory() default true;
-
- /**
- * Set if the component type is public or private (defaults to public).
- * A private factory does not expose a {@code Factory} service.
- * Only instances declared in the same bundle are created.
- *
- * Default : {@literal true}
- */
- boolean architecture() default true;
-
- /**
- * Set if the component is immediate.
- * By default, iPOJO tries to be as lazy as possible and will create the POJO instance at the last possible time.
- * Notice this setting is only effective when the component provides a service ({@linkplain org.apache.felix.ipojo.annotations.Provides @Provides}).
- *
- * default: {@literal true}
- */
- boolean propagation() default true;
-
- /**
- * Set the Managed Service PID for Configuration Admin.
- * default no PID (i.e. the managed service will not be exposed).
- *
- */
- String managedservice() default "";
-
- /**
- * Set the factory-method, if the pojo has to be created
- * from a static method. The specified method must be a static
- * method and return a pojo object.
- * By default, iPOJO uses the 'regular' constructor.
- * @see #factoryMethod()
- * @deprecated now is called factoryMethod.
- */
- String factory_method() default "";
-
- /**
- * Set the factory-method, if the pojo has to be created
- * from a static method. The specified method must be a static
- * method and return a pojo object.
- * By default, iPOJO uses the 'regular' constructor.
- *
- * {@code @Component(factoryMethod = "createInstance")}
- * public class MyComponent {
- * // ...
- * public static MyComponent createInstance() {
- * return new MyComponent("some static configuration");
- * }
- * }
- *
- */
- String factoryMethod() default "";
-
- /**
- * Set the version of the component type.
- *
- */
- String version() default "";
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java
deleted file mode 100644
index 383583de16..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Injects the bundle context object.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.FIELD})
-public @interface Context {
-
- /**
- * Sets which bundle context object needs to be injected.
- */
- public Source value() default Source.COMPONENT;
-
- /**
- * Lists the different injectable bundle context.
- */
- public enum Source {
- /**
- * The bundle context from the bundle declaring the component. Generally,
- * it's the bundle containing the implementation class.
- */
- COMPONENT,
-
- /**
- * The bundle context from the bundle declaring the instance.
- */
- INSTANCE
- }
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java
deleted file mode 100644
index babcf013fe..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a lifecycle controller.
- *
- *
-
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface Controller {
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java
deleted file mode 100644
index b3fa77774d..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a handler.
- * This annotation is mandatory to declares an iPOJO handler.
- *
-
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Handler {
-
- /**
- * Name of the handler (required).
- */
- String name();
-
- /**
- * Namespace of the handler (required).
- */
- String namespace();
-
- /**
- * Start-level of the handler.
- * Default: 1.
- */
- int level() default 1;
-
- /**
- * Enable / Disable the architecture exposition.
- * Default : {@literal false}
- */
- boolean architecture() default false;
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java
deleted file mode 100644
index f18f4c4ca1..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A @{@link HandlerBinding} bind its annotated type to a given handler.
- *
- * The handler name is specified as parameter using the {@literal 'namespace:name'} format (qualified name).
- *
- *
- * // Namespace and name will be inferred from the annotation's package name.
- * @HandlerBinding()
- * public @interface Foo {}
- *
- * // No namespace declared, default will be used ('org.apache.felix.ipojo')
- * @HandlerBinding("foo")
- * public @interface Foo {}
- *
- * // Namespace will be 'com.acme' and name: 'foo'
- * @HandlerBinding("com.acme:foo")
- * public @interface Foo {}
- *
- * // Provided namespace and value (for the name) will be used
- * @HandlerBinding(namespace = "com.acme", value = "foo")
- * public @interface Foo {}
- *
- *
- * @author Felix Project Team
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface HandlerBinding {
- String DEFAULT = "#";
-
- /**
- * Defines the handler's namespace. Must be used in correlation with the {@literal value} attribute.
- *
- * @HandlerBinding(namespace = "com.acme", value = "foo")
- * public @interface Foo {}
- *
- */
- String namespace() default DEFAULT;
-
- /**
- * When used without the {@literal namespace} attribute, defines both the namespace + name
- * of a handler in a short notation (if no namespace can be found in the parameter - no ':' separator - fallback
- * on iPOJO's default namespace):
- *
- *
- *
- * When used with the {@literal namespace} attribute, holds the name of the handler (without
- * its namespace part):
- *
- *
- * @HandlerBinding(namesapce = "com.acme", value = "foo")
- * public @interface Foo {}
- *
- */
- String value() default DEFAULT;
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java
deleted file mode 100644
index 1191d47704..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used to configure a handler through XML (as in {@literal metadata.xml}).
- *
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface HandlerDeclaration {
-
- /**
- * The content of this attribute represents the XML
- * that would be used in the metadata.xml.
- * It must be a root XML Element, namespaces are allowed and so for child elements.
- */
- String value();
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java
deleted file mode 100644
index ceb4171770..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A @{@link Ignore} annotation mark its annotated type to be ignored by the iPOJO manipulator.
- * This is handy when the annotation could be recognized as a "custom annotation handler" (contains {@literal ".ipojo."}
- * or {@literal ".handler."} in its package name) but in fact is not a handler annotation at all.
- *
- *
- *
- * @author Felix Project Team
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface Ignore {}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java
deleted file mode 100644
index 87d9201519..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used to create an 'empty' instance of the
- * current component type.
- *
- * Notice that all mandatory properties should have a default value, otherwise
- * configuration is declared unacceptable and the instance creation fails.
- *
- *
- */
- String name() default "";
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java
deleted file mode 100644
index 0dfac8c84f..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares an invalidate callback.
- *
- *
- * {@code @Invalidate}
- * public void stop() {
- * // Code executed when instances are becoming invalid
- * }
- *
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Invalidate {
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java
deleted file mode 100644
index ea8bd5a7dd..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.Comparator;
-
-/**
- * This annotation declares a modify method.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Modified {
-
- /**
- * Set the dependency filter.
- * Default : no filter
- */
- String filter() default "";
-
- /**
- * Set if the dependency is an aggregate dependency.
- * Default : false
- */
- boolean aggregate() default false;
-
-
- /**
- * Set if the dependency is optional.
- * Default : false
- */
- boolean optional() default false;
-
- /**
- * Set the required specification.
- * Default : empty (try to discover).
- */
- String specification() default "";
-
- /**
- * Set the dependency id.
- * Default : empty.
- */
- String id() default "";
-
- /**
- * Set the binding policy.
- * Acceptable policies are dynamic, static and dynamic-priority.
- * Default: dynamic.
- */
- BindingPolicy policy() default BindingPolicy.DYNAMIC;
-
- /**
- * Set the comparator.
- * The indicated class must implement {@link Comparator}
- */
- Class extends Comparator> comparator() default Comparator.class;
-
- /**
- * Set the from attribute.
- */
- String from() default "";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java
deleted file mode 100644
index 0319439cff..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-/**
- * Declares a method to be notified after service registration is effective.
- *
- *
- * {@code @PostRegistration}
- * public void registered(ServiceReference> reference) {
- * // Called after the service publication
- * }
- *
- * @author Felix Project Team
- * @see org.apache.felix.ipojo.annotations.Provides
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface PostRegistration {
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java
deleted file mode 100644
index 50f70408c6..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-/**
- * Declares a method to be notified after service un-registration is effective.
- *
- *
- * {@code @PostUnregistration}
- * public void unregistered(ServiceReference> reference) {
- * // Called after the service un-publication
- * }
- *
- * @author Felix Project Team
- * @see org.apache.felix.ipojo.annotations.Provides
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface PostUnregistration {
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java
deleted file mode 100644
index 9af34cb7f8..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a component property.
- * It can target both fields and methods.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
-public @interface Property {
-
- /**
- * Set property name.
- * Default : empty
- */
- String name() default "";
-
- /**
- * Set property value.
- * Default : empty
- */
- String value() default "";
-
- /**
- * Is the property mandatory?
- * Default: false
- */
- boolean mandatory() default false;
-
- /**
- * Is the property immutable?
- * Default: false
- */
- boolean immutable() default false;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java
deleted file mode 100644
index d0f06eef8d..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares that the component instances will provide a service.
- *
- *
- * {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
- * {@code @Provides}
- * public class MyComponent implements Service {
- * // ...
- * }
- *
- * @author Felix Project Team
-*/
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Provides {
-
- /**
- * Set the provided specifications.
- * It can be used to force the exposed service to use an implementation class
- * (not an interface) as specification.
- * Default : all implemented interfaces
- *
- *
- */
- Class[] specifications() default { };
-
- /**
- * Set the service object creation strategy.
- * Multiple values are possible: {@literal SINGLETON}, {@literal SERVICE},
- * {@literal METHOD}, {@literal INSTANCE} or the strategy fully qualified class name:
- *
- *
{@literal SINGLETON}: Default strategy
- *
{@literal SERVICE}: OSGi Service Factory style, 1 POJO instance per consumer bundle
- *
{@literal METHOD}: Delegates the creation to the factory-method of the component, method will be called every time the service reference is get.
- *
{@literal INSTANCE}: Creates one service object per requiring instance
- *
Any other value is interpreted as the qualified name of a {@code CreationStrategy} implementation
- *
- */
- String strategy() default "SINGLETON";
-
- /**
- * Allows adding static properties to the service.
- * Nested properties are static service properties, so must contain the name,
- * value and type as they are not attached to a field (cannot discover type through
- * introspection).
- * The array contains {@link StaticServiceProperty} elements.
- * Default : No service properties
-
- *
- * {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
- * {@code @Provides}(
- * properties = {
- * {@code @StaticServiceProperty}(name = "size", type = "int", value = "5"),
- * {@code @StaticServiceProperty}(name = "name", type = "java.lang.String", value = "OSGi")
- * }
- * )
- * public class MyComponent implements Service {
- * // ...
- * }
- *
-
- */
- StaticServiceProperty[] properties() default {};
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java
deleted file mode 100644
index 254016d187..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Target;
-import java.util.Comparator;
-
-/**
- * This annotation declares a service requirement.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE})
-@Inherited
-public @interface Requires {
-
- /**
- * Set the LDAP filter of the dependency.
- * Default : no filter
- */
- String filter() default "";
-
- /**
- * Set if the dependency is optional.
- * Default : false
- */
- boolean optional() default false;
-
- /**
- * Set the dependency id.
- * Default : empty
- */
- String id() default "";
-
- /**
- * Enable / Disable nullable pattern.
- * Default : true
- */
- boolean nullable() default true;
-
- /**
- * Set the default-implementation to use if the dependency is optional,
- * and no providers are available.
- * The class must implement the required service interface.
- * Default : no default-implementation
- */
- Class defaultimplementation() default Class.class;
-
- /**
- * Set the exception to throw when the service is not available. This attribute can only be used for optional
- * dependencies. It must be a subclass of {@link RuntimeException}.
- * Default: no exception.
- */
- Class extends RuntimeException> exception() default RuntimeException.class;
-
- /**
- * Set the binding policy.
- * Acceptable policy are dynamic, static and dynamic-priority.
- * Default: dynamic.
- */
- BindingPolicy policy() default BindingPolicy.DYNAMIC;
-
- /**
- * Set the comparator.
- * The indicated class must implement {@link Comparator}
- */
- Class comparator() default Comparator.class;
-
- /**
- * Set the from attribute.
- */
- String from() default "";
-
- /**
- * Set the required service specification.
- * This attribute is required for Collection field.
- */
- Class specification() default Object.class;
-
- /**
- * Set to true if the service dependency is injected
- * as a proxy.
- * Default: true
- */
- boolean proxy() default true;
-
-
- /**
- * Set the time to wait before applying the 'no service available' action.
- * This attribute is only valid for optional dependencies.
- * The time is set in milliseconds.
- * Default: no timeout
- */
- int timeout() default -1;
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
deleted file mode 100644
index 61e539e402..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a service controller.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface ServiceController {
-
- /**
- * Sets the initial value of the controller.
- */
- boolean value() default true;
-
-
- /**
- * Sets the targeted specification.
- * If not set, target all specifications.
- */
- Class specification() default Object.class;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
deleted file mode 100644
index 5ce5f394e6..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a service property.
- * It can target both fields and methods.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface ServiceProperty {
-
- /**
- * Set the property name.
- * Default : empty
- */
- String name() default "";
-
- /**
- * Set the property value.
- * Default : empty
- */
- String value() default "";
-
- /**
- * Is the property mandatory?
- * Default: false
- */
- boolean mandatory() default false;
-
- /**
- * Is the service property immutable ?
- * An immutable property MUST have a value
- * Default {@literal false}
- */
- boolean immutable() default false;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java
deleted file mode 100644
index 969725d8c8..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.annotations;
-
-
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a static service property.
- * @author Felix Project Team
- */
-@Target({})
-public @interface StaticServiceProperty {
-
- /**
- * Set the property name.
- * This name is mandatory for static properties.
- */
- String name();
-
- /**
- * Set the property value.
- * Default : empty
- */
- String value() default "";
-
- /**
- * Is the property mandatory?
- * Default: false
- */
- boolean mandatory() default false;
-
- /**
- * Set the type.
- * This value is required only for static properties.
- */
- String type();
-
- /**
- * Is the property immutable ?
- * An immutable property MUST have a value
- * Default: {@literal false}
- */
- boolean immutable() default false;
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java
deleted file mode 100644
index efb8369388..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * In many systems, use of architectural patterns produces a set of recurring roles. A stereotype allows a
- * framework developer to identify such a role and declare some common metadata for objects with that role
- * in a central place.
- *
- * A stereotype is an annotation, annotated with {@literal @Stereotype}, that captures several other annotations.
- *
- * For example, the following stereotype defines a @PseudoSingletonComponent annotation, that will act,
- * when applied on a component, just like if @Component and @Instantiate where directly applied on the target component.
- *
- *
- * @author Felix Project Team
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface Stereotype {
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java
deleted file mode 100644
index ae716204c3..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.util.Comparator;
-
-/**
- * This annotation declares an unbind method.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Unbind {
-
- /**
- * Set the dependency filter.
- * Default : no filter
- */
- String filter() default "";
-
- /**
- * Set if the dependency is an aggregate dependency.
- * Default : false
- */
- boolean aggregate() default false;
-
-
- /**
- * Set if the dependency is optional.
- * Default : false
- */
- boolean optional() default false;
-
- /**
- * Set the required specification.
- * Default : empty (try to discover).
- */
- Class specification() default Object.class;
-
- /**
- * Set the dependency id.
- * Default : empty.
- */
- String id() default "";
-
- /**
- * Set the binding policy.
- * Acceptable policy are dynamic, static and dynamic-priority.
- * Default: dynamic.
- */
- BindingPolicy policy() default BindingPolicy.DYNAMIC;
-
- /**
- * Set the comparator.
- * The indicated class must implement {@link Comparator}
- */
- Class extends Comparator> comparator() default Comparator.class;
-
- /**
- * Set the from attribute.
- */
- String from() default "";
-
- /**
- * Set to true if the service dependency is injected
- * as a proxy.
- * Default: true
- */
- boolean proxy() default true;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java
deleted file mode 100644
index 5fa92709c9..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares an updated callback.
- * Updated callback are called after a reconfiguration.
- *
- * Methods annotated with {@code @Updated} must have one of the 2 following signatures:
- *
- * {@code @Updated}
- * public void updated() {
- * // The instance was reconfigured
- * }
- *
- *
- *
- * {@code @Updated}
- * public void updated(Dictionary conf) {
- * // The instance was reconfigured, conf is the new configuration.
- * }
- *
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Updated {
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java
deleted file mode 100644
index 3a6517e9d2..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * This annotation declares a validate callback.
- *
- *
- * {@code @Validate}
- * public void start() {
- * // Code executed when instances are becoming valid
- * }
- *
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Validate {
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java
deleted file mode 100644
index 587710abe4..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.extender;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Extender pattern Handler annotation.
- * Allows configuring an extender pattern.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Extender {
-
- /**
- * Sets the looked Manifest entry.
- */
- String extension();
-
- /**
- * Sets the on service arrival callback.
- */
- String onArrival();
-
- /**
- * Sets the on service departure callback.
- */
- String onDeparture();
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java
deleted file mode 100644
index 3e9e03a5c9..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.temporal;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Temporal dependency annotation.
- * Allows specifying a temporal dependency.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- * @deprecated replaced by {@link Temporal}
- */
-@Target(ElementType.FIELD)
-@Deprecated
-public @interface Requires {
-
- /**
- * Set the LDAP filter of the dependency.
- * Default : no filter
- */
- String filter() default "";
-
- /**
- * Timeout of the dependency.
- * Default : true
- */
- long timeout() default 3000;
-
- /**
- * Set the on timeout action.
- * Supports null, nullable, empty, and default-implementation.
- * In this latter case, you must specify the qualified class name
- * of the default-implementation (instead of default-implementation).
- * Default: no action (i.e throws a runtime exception)
- */
- String onTimeout() default "";
-
- /**
- * Set the service specification (for Collection fields).
- * This attribute is mandatory for Collections.
- */
- String specification() default "";
-
- /**
- * Inject a proxy instead of the real object.
- * This allows passing this reference to collaborators.
- * Default: false
- */
- boolean proxy() default false;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java
deleted file mode 100644
index 52496a5ab1..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.temporal;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Temporal dependency annotation.
- * Allows specifying a temporal dependency.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- *
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface Temporal {
-
- /**
- * Set the dependency id.
- * Default: empty, will use the field name.
- */
- String id() default "";
-
- /**
- * Set the LDAP filter of the dependency.
- * Default: no filter
- */
- String filter() default "";
-
- /**
- * Timeout of the dependency.
- * Default: 3000 ms.
- */
- long timeout() default 3000;
-
- /**
- * Set the on timeout action.
- * Supports null, nullable, empty, and default-implementation.
- * In this latter case, you must specify the qualified class name
- * of the default-implementation (instead of default-implementation).
- * Default: no action (i.e throws a runtime exception)
- */
- String onTimeout() default "";
-
- /**
- * Set the service specification (for Collection fields).
- * This attribute is mandatory for Collections.
- */
- String specification() default "";
-
- /**
- * Inject a proxy instead of the real object.
- * This allows passing this reference to collaborators.
- * Default: false
- */
- boolean proxy() default false;
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java
deleted file mode 100644
index 466d6f059f..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.handlers.event;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-/**
- * Event Admin Publisher handler.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- * @deprecated replaced by Publishes
- */
-@Target(ElementType.FIELD)
-public @interface Publisher {
-
- /**
- * Sets the publisher name.
- */
- String name();
-
- /**
- * Sets topics on which event are sent.
- * The topics are separated by a ',' such as in
- * "foo, bar".
- * Default : no topics (configured in the instance configuration)
- */
- String topics() default "";
-
- /**
- * Enables/Disables synchronous sending.
- * Default : false (asynchronous)
- */
- boolean synchronous() default false;
-
- /**
- * Sets the data key in which the data is
- * put.
- * Default : user.data
- * @deprecated replaced by dataKey
- */
- String data_key() default "user.data";
-
- /**
- * Sets the data key in which the data is
- * put.
- * Default : user.data
- */
- String dataKey() default "user.data";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java
deleted file mode 100644
index eea2f80fd6..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.handlers.event;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-/**
- * Event Admin Publisher handler.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface Publishes {
-
- /**
- * Sets the publisher name.
- */
- String name();
-
- /**
- * Sets topics on which event are sent.
- * The topics are separated by a ',' such as in
- * "foo, bar".
- * Default : no topics (configured in the instance configuration)
- */
- String topics() default "";
-
- /**
- * Enables/Disables synchronous sending.
- * Default : false (asynchronous)
- */
- boolean synchronous() default false;
-
- /**
- * Sets the data key in which the data is
- * put.
- * Default : user.data
- */
- String dataKey() default "user.data";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java
deleted file mode 100644
index 2418944b48..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.handlers.event;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-
-/**
- * Event Admin Subscriber handler.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Subscriber {
-
- /**
- * Sets the subscriber name.
- */
- String name();
-
- /**
- * Sets topics on which event are received.
- * The topics are separated by a ',' such as in
- * "foo, bar".
- * Default : no topics (configured in the instance configuration)
- */
- String topics() default "";
-
- /**
- * Sets the data key in which the data is
- * stored.
- * Default : no key
- * @deprecated replaced by dataKey
- */
- String data_key() default "";
-
- /**
- * Sets the data type (type of the received data).
- * Default : no type.
- * @deprecated replaced by dataType
- */
- String data_type() default "";
-
- /**
- * Sets the data key in which the data is
- * stored.
- * Default : no key
- */
- String dataKey() default "";
-
- /**
- * Sets the data type (type of the received data).
- * Default : no type.
- */
- String dataType() default "";
-
-
- /**
- * Sets the event filter. Only event matching with the
- * specified LDAP filter are received.
- * default : no filter;
- */
- String filter() default "";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java
deleted file mode 100644
index 9a0d5e9be6..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Handler annotation.
- * Allows exposing the instances as a JMX MBean.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- * @deprecated replaced by {@link JMXBean}
- */
-@Target(ElementType.TYPE)
-public @interface Config {
-
- /**
- * Enables or Disables MOSGi usage.
- * If MOSGi is used, MBeans are exposed with the MOSGi mechanism.
- * Otherwise the MBean Platform Server is used.
- * Default : false
- */
- boolean usesMOSGi() default false;
-
- /**
- * Sets the MBean object name.
- * Default : 'package-name:factory-name:instance-name'.
- */
- String objectname() default "";
-
- /**
- * Sets the MBean domain.
- * Default : 'package-name'
- */
- String domain() default "";
-
- /**
- * Sets the MBean name.
- * Default : 'instance-name'
- */
- String name() default "";
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java
deleted file mode 100644
index b07abfb478..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Handler annotation.
- * Allows exposing the instances as a JMX MBean.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface JMXBean {
-
- /**
- * Enables or Disables MOSGi usage.
- * If MOSGi is used, MBeans are exposed with the MOSGi mechanism.
- * Otherwise the MBean Platform Server is used.
- * Default : false
- */
- boolean usesMOSGi() default false;
-
- /**
- * Sets the MBean object name.
- * Default : 'package-name:factory-name:instance-name'.
- */
- String objectname() default "";
-
- /**
- * Sets the MBean domain.
- * Default : 'package-name'
- */
- String domain() default "";
-
- /**
- * Sets the MBean name.
- * Default : 'instance-name'
- */
- String name() default "";
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java
deleted file mode 100644
index 3f957fe4f1..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Method annotation.
- * Allows exposing methods in the MBean.
- * This annotation must be used only if the {@link Config} annotation
- * is used.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface JMXMethod {
-
- /**
- * Gets the method description.
- * Default : no description
- */
- String description() default "";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java
deleted file mode 100644
index 069878db25..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Property annotation.
- * Allows exposing properties in the MBean.
- * This annotation must be used only if the {@link Config} annotation
- * is used.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
-public @interface JMXProperty {
-
- /**
- * Sets the property name.
- */
- String name();
-
- /**
- * Sets the access permission.
- * Possible values are 'r' (default) or 'w'.
- * 'w' implies read and write access.
- */
- String rights() default "r";
-
- /**
- * Enables notification on the current property.
- * Notifications are disable by default.
- */
- boolean notification() default false;
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java
deleted file mode 100644
index 4fb0cd1902..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Method annotation.
- * Allows exposing methods in the MBean.
- * This annotation must be used only if the {@link Config} annotation
- * is used.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- * @deprecated replaced by {@link JMXMethod}
- */
-@Target(ElementType.METHOD)
-public @interface Method {
-
- /**
- * Gets the method description.
- * Default : no description
- */
- String description() default "";
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java
deleted file mode 100644
index 6de9e83310..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.handlers.jmx;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * JMX Property annotation.
- * Allows exposing properties in the MBean.
- * This annotation must be used only if the {@link Config} annotation
- * is used.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- * @deprecated replaced by {@link JMXProperty}
- */
-@Target(ElementType.FIELD)
-public @interface Property {
-
- /**
- * Sets the property name.
- */
- String name();
-
- /**
- * Sets the access permission.
- * Possible values are 'r' (default) or 'w'.
- * 'w' implies read and write access.
- */
- String rights() default "r";
-
- /**
- * Enables notification on the current property.
- * Notifications are disable by default.
- */
- boolean notification() default false;
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java
deleted file mode 100644
index 98603234a6..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.transaction;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Transaction Handler annotation.
- * Allows the declaration of transactionnal methods
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Transaction {
-
- /**
- * Sets the Transaction field. The specified field must be of the type
- * Transaction.
- */
- String field() default "";
-
- /**
- * Sets the method called when a transaction is committed.
- */
- String oncommit() default "";
-
- /**
- * Sets the method called when a transaction is rolled back.
- */
- String onrollback() default "";
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java
deleted file mode 100644
index f89133d958..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.transaction;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Transactionnal Method annotation.
- * Allows the declaration of transactionnal method.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
-public @interface Transactional {
-
- /**
- * Sets the transaction timeout.
- */
- long timeout() default 0;;
-
- /**
- * Sets the transaction propagation policy.
- * Supported values are : requires mandatory, notsupported, never, requiresnew.
- */
- String propagation() default "requires";
-
- /**
- * Sets the exceptions that do not rollback the current transaction.
- */
- String[] norollbackfor() default { };
-
- /**
- * Sets if the transaction rollback throws an exception.
- */
- boolean exceptiononrollback() default false;
-
-
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java
deleted file mode 100644
index 4c66f5e0db..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.whiteboard;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Whiteboard pattern Handler annotation.
- * Allows configuring a whiteboard pattern.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Wbp {
-
- /**
- * Sets the whiteboard pattern filter.
- */
- String filter();
-
- /**
- * Sets the on service arrival callback.
- */
- String onArrival();
-
- /**
- * Sets the on service departure callback.
- */
- String onDeparture();
-
- /**
- * Sets the on service modification callback.
- * Default : no callback.
- */
- String onModification() default "";
-}
diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java
deleted file mode 100644
index 995bd1cba3..0000000000
--- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.whiteboard;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Whiteboard pattern Handler annotation.
- * Allows configuring several whiteboard patterns.
- * Be aware that despite is it provided in the annotations jar,
- * it refers to an external handler.
- * @author Felix Project Team
- */
-@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE})
-public @interface Whiteboards {
-
- /**
- * Whiteboards list.
- */
- Wbp[] whiteboards() default {};
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt b/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt
deleted file mode 100644
index aed77eee2c..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-Changes from the 1.12.0 to 1.12.1
----------------------------------
-
-** Bug
- * [FELIX-4612] - @PostRegistration is not being called
- * [FELIX-4620] - Warning should be removed when @Configuration is used
- * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)
- * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level'
-
-Changes from the 1.11.2 to 1.12.0
----------------------------------
-
-** Improvement
- * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies
-
-** New Feature
- * [FELIX-4476] - Java 8 Support
-
-** Sub-task
- * [FELIX-4508] - Update to ASM 5.0.2
- * [FELIX-4509] - Change the frame computation strategy
-
-Changes from the 1.11.1 to 1.11.2
----------------------------------
-
-** Bug
- * [FELIX-4453] - Introduce manipulator BOM (Bill of Material)
-
-** Improvement
- * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes
-
-Changes from the 1.11.0 to 1.11.1
----------------------------------
-
-** Bug
- * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied
- * [FELIX-4347] - should ignore inner classes that are assigned to static fields
-
-Changes from the 1.10.1 to 1.11.0
----------------------------------
-
-** Bug
- * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging
- * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation
- * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style)
-
-** Improvement
- * [FELIX-4112] - Add meta annotations for handler description
- * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation
-
-** Task
- * [FELIX-4134] - Move integration-tests to the reactor
- * [FELIX-4151] - Fix mistakes in the javadoc tags
- * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x
- * [FELIX-4156] - Fix versions of maven plugins
- * [FELIX-4270] - Bump iPOJO package version to 1.11.0
-
-** Sub-task
- * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation
- * [FELIX-4254] - Specify the method id of methods from inner class
- * [FELIX-4255] - Extend the inner class manipulation to allow method interception
- * [FELIX-4256] - Avoid manipulation native and static methods from inner classes
-
-Changes from the 1.10.0 to 1.10.1
----------------------------------
-
-** Bug
- * [FELIX-4077] - Fix documentation urls in maven projects
- * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations
- * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern
- * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute
-
-** Improvement
- * [FELIX-4094] - Recognize add/remove method naming pattern
-
-** New Feature
- * [FELIX-4095] - Add CDI-like @Stereotype
-
-** Task
- * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project
- * [FELIX-4103] - Skip deployment of it-tests
- * [FELIX-4104] - Do not run integration-tests in the default build
-
-Changes from the 1.8.6 to 1.10.0
---------------------------------
-
-** Bug
- * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin
- * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly
- * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin
- * [FELIX-3974] - Properties cannot be set as immutable using annotations
- * [FELIX-3995] - Missing options in Bind annotation
- * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree
- * [FELIX-4046] - Inner class manipulation fails with expanded frames
- * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name
-
-** Improvement
- * [FELIX-3286] - Update POM to use the new parent
- * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support.
- * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support
- * [FELIX-3837] - PojoizationPlugin should be more extensible
- * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration
- * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation
-
-** New Feature
- * [FELIX-3699] - Allow annotations to handle custom component definitions.
- * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles
-
-** Task
- * [FELIX-3903] - Migrate tests to pax exam 3
- * [FELIX-3921] - Update pom to latest Felix's parent
- * [FELIX-3976] - Move the online manipulator out of the core bundle
-
-Changes from the 1.8.4 to 1.8.6
--------------------------------
-
-** Bug
- * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST
- * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account.
- * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata
- * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames
- * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable
- * [FELIX-3574] - IPojo bytecode manipulation looses method argument names
- * [FELIX-3621] - Two dimensional array as argument to a method in a component
-
-Changes from the 1.8.2 to 1.8.4
--------------------------------
-
-** Bug
- * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException
- * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7
- * [FELIX-3389] - Bnd iPOJO Plugin ignores annotated components
- * [FELIX-3391] - Unexpected warning when using bnd-ipojo-plugin
-
-Changes in the 1.8.2
---------------------
-
-** Bug
- * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files
- * [FELIX-3012] - "Duplicate name&signature" problem
- * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter
- * [FELIX-3145] - VerifyError on Java 7
- * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest
-
-** Improvement
- * [FELIX-3017] - The manipulator should return the original class if it's already manipulated
- * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator
- * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities
- * [FELIX-3080] - Implement a BND plugin for iPOJO
- * [FELIX-3131] - Elements and attributes should conserve the insertion order
- * [FELIX-3204] - @Temporal should handle instantiation-time properties
- * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible
\ No newline at end of file
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/pom.xml b/ipojo/manipulator/bnd-ipojo-plugin/pom.xml
deleted file mode 100644
index 784803ffad..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.felix
- felix-parent
- 8
-
-
- bnd-ipojo-plugin
- 1.13.1-SNAPSHOT
- Apache Felix iPOJO Bnd Plugin
-
-
-
- biz.aQute.bnd
- bndlib
- 2.1.0
- provided
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
-
-
- org.mockito
- mockito-all
- 1.8.5
- test
-
-
- junit
- junit
- 4.13.2
- test
-
-
-
-
-
-
- org.apache.felix
- ipojo-manipulator-bom
- ${project.version}
- pom
- import
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 8
- 8
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.MF
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 0c8ef3954b..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-II. Used Third-Party Software
-
-This product uses software developed by Peter Kriens
-(http://www.aqute.biz/Code/Bnd)
-Copyright 2006-2011 aQute, All rights reserved
-Licensed under the Apache License 2.0.
-
-III. Overall License Summary
-- Apache License 2.0
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 8b13789179..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
deleted file mode 100644
index f555b21ee7..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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.bnd;
-
-import static java.lang.String.format;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.apache.felix.ipojo.manipulator.ResourceStore;
-import org.apache.felix.ipojo.manipulator.ResourceVisitor;
-import org.apache.felix.ipojo.manipulator.render.MetadataRenderer;
-import org.apache.felix.ipojo.manipulator.util.Constants;
-import org.apache.felix.ipojo.manipulator.util.Metadatas;
-import org.apache.felix.ipojo.manipulator.util.Streams;
-import org.apache.felix.ipojo.metadata.Element;
-
-import aQute.bnd.header.Attrs;
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Clazz;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.service.reporter.Reporter;
-
-public class BndJarResourceStore implements ResourceStore {
-
- private Analyzer m_analyzer;
- private Reporter m_reporter;
-
- private MetadataRenderer m_renderer = new MetadataRenderer();
-
- private List m_metadata;
- private boolean m_includeEmbedComponents;
-
- public BndJarResourceStore(Analyzer analyzer, Reporter reporter) {
- m_metadata = new ArrayList();
- m_analyzer = analyzer;
- m_reporter = reporter;
- }
-
- public byte[] read(String path) throws IOException {
-
- // Find the resource either in the global jar or in one of the embed dependencies
- Resource resource = m_analyzer.getJar().getResource(path);
- if (resource == null) {
- Jar embed = findJar(path);
- if (embed == null) {
- throw new IOException(format("Cannot find resource %s in jar and classpath", path));
- }
- resource = embed.getResource(path);
- }
- InputStream is = null;
- try {
- is = resource.openInputStream();
- } catch (Exception e) {
- throw new IOException("Cannot read " + path);
- }
- return Streams.readBytes(is);
- }
-
- public void accept(ResourceVisitor visitor) {
-
- try {
- // Collect all annotated classes
- Collection classes = m_analyzer.getClasses("",
- Clazz.QUERY.CLASSANNOTATIONS.name());
-
- classes = filter(classes);
-
- // Iterates over discovered resources
- for (Clazz clazz : classes) {
- visitor.visit(clazz.getAbsolutePath());
- }
- } catch (Exception e) {
- m_reporter.error("Cannot find iPOJO annotated types: " + e.getMessage());
- }
- }
-
- private Collection filter(Collection classes) throws Exception {
- Set manipulable = new HashSet();
- for (Clazz clazz : classes) {
-
- // If it is in the main jar, simply use it
- if (m_analyzer.getJar().getResource(clazz.getAbsolutePath()) != null) {
- manipulable.add(clazz);
- continue;
- }
-
- if (m_includeEmbedComponents) {
- // Otherwise ...
- // Try to see if it is in an embed dependencies
- Jar jar = findJar(clazz.getAbsolutePath());
- if (jar == null) {
- m_reporter.error("Resource for class %s not found in classpath", clazz.getFQN());
- continue;
- }
-
- // Is it a Bundle ?
- if (jar.getBsn() != null) {
- // OSGi Bundle case
-
- // Check if the bundle was manipulated before
- Attributes attr = jar.getManifest().getMainAttributes();
- if (Manifests.getComponents(attr) != null) {
- // Bundle has been previously manipulated
- // TODO We should ignore the resource since it was already manipulated
- // TODO But we should also merge its IPOJO-Components header
- } else {
- // Bundle was not manipulated
- manipulable.add(clazz);
- }
-
- } else {
- // Simple Jar file with iPOJO annotations
- m_reporter.warning("Class %s found in a non-Bundle archive %s", clazz.getFQN(), jar.getName());
- continue;
- }
- } else {
- m_reporter.warning("Embed components are excluded, Component %s will not be manipulated", clazz.getFQN());
- }
- }
- return manipulable;
- }
-
- private Jar findJar(String path) {
- for (Jar jar : m_analyzer.getClasspath()) {
- if (jar.getResource(path) != null) {
- return jar;
- }
- }
- return null;
- }
-
- public void open() throws IOException {
- // nothing to do
- }
-
- public void writeMetadata(Element metadata) {
- m_metadata.add(metadata);
-
- // Find referred packages and add them into Bnd
- for (String referred : Metadatas.findReferredPackages(metadata)) {
- if (!m_analyzer.getReferred().containsFQN(referred)) {
- // The given package is not referred ATM
- m_analyzer.getReferred().put(m_analyzer.getPackageRef(referred),
- new Attrs());
- }
- }
-
- // IPOJO-Components will be written during the close method.
- }
-
- public void write(String resourcePath, byte[] resource) throws IOException {
- Jar jar = m_analyzer.getJar();
- jar.putResource(resourcePath, new ByteArrayResource(resource));
- }
-
- public void close() throws IOException {
-
- // Write the iPOJO header (including manipulation metadata)
- StringBuilder builder = new StringBuilder();
-
- if (m_includeEmbedComponents) {
- // Incorporate metadata of embed dependencies (if any)
- for (Jar jar : m_analyzer.getClasspath()) {
- try {
- Manifest manifest = jar.getManifest();
- Attributes main = manifest.getMainAttributes();
- String components = Manifests.getComponents(main);
- if (components != null) {
- m_reporter.trace("Merging components from %s", jar.getName());
- builder.append(components);
- }
- } catch (Exception e) {
- m_reporter.warning("Cannot open MANIFEST of %s", jar.getName());
- }
- }
- }
-
- for (Element metadata : m_metadata) {
- builder.append(m_renderer.render(metadata));
- }
-
- if (builder.length() != 0) {
- m_analyzer.setProperty("IPOJO-Components", builder.toString());
- }
-
- // Add some mandatory imported packages
- Attrs version = new Attrs();
- version.put("version:Version", Constants.getPackageImportClause());
-
- if (!m_analyzer.getReferred().containsFQN("org.apache.felix.ipojo")) {
- m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.apache.felix.ipojo"),
- version);
- }
- if (!m_analyzer.getReferred().containsFQN("org.apache.felix.ipojo.architecture")) {
- m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.apache.felix.ipojo.architecture"),
- version);
- }
- if (!m_analyzer.getReferred().containsFQN("org.osgi.service.cm")) {
- Attrs cm = new Attrs();
- cm.put("version:Version", "1.2");
- m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.osgi.service.cm"),
- cm);
- }
- if (!m_analyzer.getReferred().containsFQN("org.osgi.service.log")) {
- Attrs log = new Attrs();
- log.put("version:Version", "1.3");
- m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.osgi.service.log"),
- log);
- }
-
-
- }
-
- public void setIncludeEmbedComponents(boolean excludeEmbedComponents) {
- m_includeEmbedComponents = excludeEmbedComponents;
- }
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
deleted file mode 100644
index 085d63aaeb..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.bnd;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.felix.ipojo.manipulator.reporter.EmptyReporter;
-
-import aQute.service.reporter.Reporter;
-
-/**
- * A {@code BndReporter} knows how to wrap a Bnd Reporter into an iPOJO Reporter.
- *
- * @author Felix Project Team
- */
-public class BndReporter extends EmptyReporter {
-
- /**
- * Bnd reporter.
- */
- private Reporter m_reporter;
-
- /**
- * Errors which occur during the manipulation.
- */
- private List m_errors = new ArrayList();
-
- /**
- * Warnings which occur during the manipulation.
- */
- private List m_warnings = new ArrayList();
-
- public BndReporter(Reporter reporter) {
- m_reporter = reporter;
- }
-
- public List getErrors() {
- return m_errors;
- }
-
- public List getWarnings() {
- return m_warnings;
- }
-
- @Override
- public void trace(String message, Object... args) {
- m_reporter.trace(message, args);
- }
-
- @Override
- public void info(String message, Object... args) {
- m_reporter.trace(message, args);
- }
-
- @Override
- public void warn(String message, Object... args) {
- m_reporter.warning(message, args);
- m_warnings.add(String.format(message, args));
- }
-
- @Override
- public void error(String message, Object... args) {
- m_reporter.error(message, args);
- m_errors.add(String.format(message, args));
- }
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
deleted file mode 100644
index e2ee7fc9c3..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.bnd;
-
-
-import aQute.bnd.osgi.AbstractResource;
-
-/**
- * A {@code ByteArrayResource} is ...
- *
- * @author Felix Project Team
- */
-public class ByteArrayResource extends AbstractResource {
-
- private byte[] m_content;
-
- public ByteArrayResource(byte[] content) {
- super(System.currentTimeMillis());
- m_content = content;
- }
-
- @Override
- protected byte[] getBytes() throws Exception {
- return m_content;
- }
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java
deleted file mode 100644
index 4d267ca7bd..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.bnd;
-
-import java.util.jar.Attributes;
-
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Jar;
-
-/**
- * A {@code Manifests} is a utility class for extracting data from Bundle's Manifest.
- *
- * @author Felix Project Team
- */
-public class Manifests {
- private Manifests() {}
-
- public static String getComponents(Attributes main) {
- String value = main.getValue("iPOJO-Components");
- if (value == null) {
- value = main.getValue("IPOJO-Components");
- }
-
- return value;
- }
-
- public static boolean hasEmbedComponents(Analyzer analyzer) throws Exception {
- for (Jar jar : analyzer.getClasspath()) {
- // Check if the bundle was manipulated before
- Attributes attr = jar.getManifest().getMainAttributes();
- if (getComponents(attr) != null) {
- return true;
- }
- }
- return false;
- }
-
-
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
deleted file mode 100644
index 09dc02a5b5..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.bnd;
-
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.bnd.service.AnalyzerPlugin;
-import aQute.bnd.service.Plugin;
-import aQute.service.reporter.Reporter;
-import org.apache.felix.ipojo.manipulator.ManipulationVisitor;
-import org.apache.felix.ipojo.manipulator.Pojoization;
-import org.apache.felix.ipojo.manipulator.ResourceStore;
-import org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider;
-import org.apache.felix.ipojo.manipulator.metadata.CacheableMetadataProvider;
-import org.apache.felix.ipojo.manipulator.metadata.CompositeMetadataProvider;
-import org.apache.felix.ipojo.manipulator.metadata.FileMetadataProvider;
-import org.apache.felix.ipojo.manipulator.util.Classpath;
-import org.apache.felix.ipojo.manipulator.visitor.check.CheckFieldConsistencyVisitor;
-import org.apache.felix.ipojo.manipulator.visitor.writer.ManipulatedResourcesWriter;
-import org.apache.felix.ipojo.metadata.Element;
-
-import java.io.File;
-import java.util.*;
-
-/**
- * A {@code BndIpojoPlugin} is ...
- *
- * @author Felix Project Team
- */
-public class PojoizationPlugin implements Plugin, AnalyzerPlugin {
-
- private static final String PROPERTY_METADATA = "metadata";
- private static final String PROPERTY_USE_LOCAL_SCHEMAS = "use-local-schemas";
- private static final String PROPERTY_INCLUDE_EMBED_BUNDLES = "include-embed-bundles";
-
- private static final String DEFAULT_METADATA = "META-INF/metadata.xml";
- private static final boolean DEFAULT_USE_LOCAL_SCHEMAS = false;
- private static final boolean DEFAULT_INCLUDE_EMBED_BUNDLES = false;
-
- private String m_metadata = DEFAULT_METADATA;
- private boolean m_useLocalSchemas = DEFAULT_USE_LOCAL_SCHEMAS;
- private boolean m_includeEmbedBundles = DEFAULT_INCLUDE_EMBED_BUNDLES;
-
- private Reporter m_reporter;
-
- public void setProperties(Map configuration) {
-
- // Use metadata file if any
- if (configuration.containsKey(PROPERTY_METADATA)) {
- m_metadata = configuration.get(PROPERTY_METADATA);
- }
-
- // Use local schemas ?
- if (configuration.containsKey(PROPERTY_USE_LOCAL_SCHEMAS)) {
- m_useLocalSchemas = true;
- }
-
- // Process embed bundles ?
- if (configuration.containsKey(PROPERTY_INCLUDE_EMBED_BUNDLES)) {
- m_includeEmbedBundles = true;
- }
- }
-
- public void setReporter(Reporter reporter) {
- m_reporter = reporter;
- }
-
- public boolean analyzeJar(Analyzer analyzer) throws Exception {
-
- long start = System.currentTimeMillis();
-
- // Wraps the Bnd Reporter
- BndReporter reporter = new BndReporter(this.m_reporter);
-
- // Build ResourceStore
- BndJarResourceStore store = new BndJarResourceStore(analyzer, this.m_reporter);
- store.setIncludeEmbedComponents(m_includeEmbedBundles);
-
- CompositeMetadataProvider provider = buildMetadataProvider(analyzer, reporter, store);
-
- // Quick exit
- CacheableMetadataProvider cache = new CacheableMetadataProvider(provider);
- if (cache.getMetadatas().isEmpty() && !hasEmbedComponents(analyzer)) {
- return false;
- }
-
- // Compute the classpath to build the classloader.
- List jars = analyzer.getClasspath();
- Jar jar = analyzer.getJar();
-
- Set paths = new LinkedHashSet();
- if (jar != null && jar.getSource() != null) {
- paths.add(jar.getSource().getAbsolutePath());
- }
- for (Jar j : jars) {
- if (j.getSource() != null) {
- paths.add(j.getSource().getAbsolutePath());
- }
- }
- Classpath cp = new Classpath(paths);
- manipulateComponents(reporter, store, cache, cp.createClassLoader());
-
- int nbComponents = findElements(cache.getMetadatas(), "component").size();
- int nbHandlers = findElements(cache.getMetadatas(), "handler").size();
- this.m_reporter.trace("iPOJO manipulation performed performed in %s ms (%d components, %d handlers).",
- (System.currentTimeMillis() - start),
- nbComponents,
- nbHandlers);
- // Return true if a new run should be performed after the analyze
- return false;
- }
-
- protected void manipulateComponents(BndReporter reporter, BndJarResourceStore store,
- CacheableMetadataProvider cache, ClassLoader classLoader) {
- Pojoization pojoization = new Pojoization(reporter);
- pojoization.disableAnnotationProcessing();
- if (m_useLocalSchemas) {
- pojoization.setUseLocalXSD();
- }
-
- pojoization.pojoization(store, cache, createVisitor(store, reporter), classLoader);
- }
-
- protected CompositeMetadataProvider buildMetadataProvider(Analyzer analyzer, BndReporter reporter, BndJarResourceStore store) {
- // Build MetadataProvider
- CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter);
-
- File file = new File(m_metadata);
- if (file.exists()) {
- // Absolute file system resource
- FileMetadataProvider fmp = new FileMetadataProvider(file, reporter);
- fmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
- provider.addMetadataProvider(fmp);
- } else {
- // In archive resource
- Resource resource = analyzer.getJar().getResource(m_metadata);
- if (resource != null) {
- ResourceMetadataProvider rmp = new ResourceMetadataProvider(resource, reporter);
- rmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
- provider.addMetadataProvider(rmp);
- }
- }
- provider.addMetadataProvider(new AnnotationMetadataProvider(store, reporter));
- return provider;
- }
-
- private boolean hasEmbedComponents(Analyzer analyzer) throws Exception {
- // We want to process components from embed jars ?
- return m_includeEmbedBundles && Manifests.hasEmbedComponents(analyzer);
-
- }
-
- private List findElements(List metadatas, String name) {
- List found = new ArrayList();
- for (Element element : metadatas) {
- if (name.equalsIgnoreCase(element.getName())) {
- found.add(element);
- }
- }
- return found;
- }
-
- protected ManipulationVisitor createVisitor(ResourceStore store, BndReporter reporter) {
- ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter();
- writer.setReporter(reporter);
- writer.setResourceStore(store);
-
- CheckFieldConsistencyVisitor checkFieldConsistencyVisitor = new CheckFieldConsistencyVisitor(writer);
- checkFieldConsistencyVisitor.setReporter(reporter);
- return checkFieldConsistencyVisitor;
- }
-
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java
deleted file mode 100644
index e696b602ce..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.bnd;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.felix.ipojo.manipulator.MetadataProvider;
-import org.apache.felix.ipojo.manipulator.Reporter;
-import org.apache.felix.ipojo.manipulator.metadata.StreamMetadataProvider;
-import org.apache.felix.ipojo.metadata.Element;
-
-import aQute.bnd.osgi.Resource;
-
-/**
- * A {@code ResourceMetadataProvider} is ...
- *
- * @author Felix Project Team
- */
-public class ResourceMetadataProvider implements MetadataProvider {
-
- private Resource m_resource;
-
- private List m_cached;
-
- private boolean m_validateUsingLocalSchemas = false;
-
- private Reporter m_reporter;
-
- public ResourceMetadataProvider(Resource resource, Reporter reporter) {
- m_resource = resource;
- m_reporter = reporter;
- }
-
- public void setValidateUsingLocalSchemas(boolean validateUsingLocalSchemas) {
- this.m_validateUsingLocalSchemas = validateUsingLocalSchemas;
- }
-
- public List getMetadatas() throws IOException {
- if (m_cached == null) {
- m_cached = new ArrayList();
- InputStream stream = null;
- try {
- stream = m_resource.openInputStream();
- } catch (Exception e) {
- m_reporter.error("%s", e.getMessage());
- throw new IOException("Cannot read metadata", e);
- }
- StreamMetadataProvider provider = new StreamMetadataProvider(stream, m_reporter);
- provider.setValidateUsingLocalSchemas(m_validateUsingLocalSchemas);
- m_cached.addAll(provider.getMetadatas());
- }
-
- return m_cached;
- }
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java
deleted file mode 100644
index 3a425fdd5d..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.bnd;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mockito.Matchers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
-
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Clazz;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.bnd.osgi.URLResource;
-import aQute.service.reporter.Reporter;
-import junit.framework.TestCase;
-
-/**
- * Checks the Resource Store from the BND plugin.
- */
-public class BndJarResourceStoreTestCase extends TestCase {
- @Mock
- private Reporter reporter;
-
- @Spy
- private Analyzer analyzer = new Analyzer();
-
- @Spy
- private Jar dot = new Jar("root.jar");
-
- @Spy
- private Jar embed = new Jar("embed.jar");
-
- @Override
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- public void testAnalysisWithOnlyEmbedComponents() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
- props.put("include-embed-bundles", "true");
-
- Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF"));
- doReturn(dot).when(analyzer).getJar();
- doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
- analyzer.setClasspath(new Jar[] {embed});
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }",
- analyzer.getProperty("IPOJO-Components"));
- }
-
- public void testAnalysisWithExcludedEmbedComponents() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
-
- Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF"));
- doReturn(dot).when(analyzer).getJar();
- doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
- analyzer.setClasspath(new Jar[] {embed});
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertNull(analyzer.getProperty("IPOJO-Components"));
- }
-
-
- public void testAnalysisWithBothLocalAndEmbedComponents() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
- props.put("include-embed-bundles", "true");
-
- Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF"));
- Resource resource2 = new URLResource(getClass().getResource("/metadata-components-only.xml"));
- doReturn(dot).when(analyzer).getJar();
- doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
- doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));
- analyzer.setClasspath(new Jar[]{embed});
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }",
- analyzer.getProperty("IPOJO-Components"));
- assertContains("component { $class=\"com.acme.Thermometer\" }",
- analyzer.getProperty("IPOJO-Components"));
- }
-
-
- public void testAnalysisWithLocallyDefinedComponentAndEmbedResource() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
- props.put("include-embed-bundles", "true");
- String path = EmptyComponent.class.getName().replace('.', '/').concat(".class");
-
- Resource resource2 = new URLResource(getClass().getResource("/metadata-test-component.xml"));
- doReturn(dot).when(analyzer).getJar();
- doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));
-
- Collection classes = new ArrayList();
- Resource typeResource = new URLResource(getClass().getResource("EmptyComponent.class"));
- Clazz clazz = new Clazz(analyzer, path, typeResource);
- clazz.parseClassFile();
- classes.add(clazz);
- doReturn(classes).when(analyzer).getClasses(Matchers.anyVararg());
-
- Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST-EMPTY.MF"));
- doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
- doReturn(typeResource).when(embed).getResource(path);
- doReturn("aaa").when(embed).getBsn();
-
- analyzer.setClasspath(new Jar[] {embed});
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertContains("component { $classname=\"org.apache.felix.ipojo.bnd.EmptyComponent\" manipulation { $classname=\"org.apache.felix.ipojo.bnd.EmptyComponent\" method { $name=\"$init\" }}}",
- analyzer.getProperty("IPOJO-Components"));
- verify(dot).putResource(eq(path), any(Resource.class));
- }
-
- private void assertContains(String expected, String actual) {
- System.out.println("Actual: " + actual);
- assertTrue(actual.contains(expected));
- }
-
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java
deleted file mode 100644
index 6ea32e5dc5..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.bnd;
-
-/**
-* Created with IntelliJ IDEA.
-* User: guillaume
-* Date: 07/01/13
-* Time: 11:31
-* To change this template use File | Settings | File Templates.
-*/
-public class EmptyComponent {
-
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java
deleted file mode 100644
index 97837ad033..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.bnd;
-
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
-
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.bnd.osgi.URLResource;
-import aQute.service.reporter.Reporter;
-import junit.framework.TestCase;
-
-public class PojoizationPluginTestCase extends TestCase {
-
- @Mock
- private Reporter reporter;
-
- @Spy
- private Analyzer analyzer = new Analyzer();
-
- @Spy
- private Jar jar = new Jar("mock.jar");
-
- @Override
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- public void testAnalysisWithComponentOnlyMetadataXml() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
-
- Resource resource = new URLResource(getClass().getResource("/metadata-components-only.xml"));
- doReturn(jar).when(analyzer).getJar();
- doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertEquals("component { $class=\"com.acme.Thermometer\" }",
- analyzer.getProperty("IPOJO-Components"));
- }
-
- public void testAnalysisWithInstanceOnlyMetadataXml() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
-
- Resource resource = new URLResource(getClass().getResource("/metadata-instances-only.xml"));
- doReturn(jar).when(analyzer).getJar();
- doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertEquals("instance { $component=\"com.acme.Thermometer\" }",
- analyzer.getProperty("IPOJO-Components"));
- }
-
- public void testAnalysisWithComponentsAndInstancesMetadataXml() throws Exception {
- PojoizationPlugin plugin = new PojoizationPlugin();
-
- Map props = new HashMap();
-
- Resource resource = new URLResource(getClass().getResource("/metadata-components-and-instances.xml"));
- doReturn(jar).when(analyzer).getJar();
- doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
-
- plugin.setReporter(reporter);
- plugin.setProperties(props);
-
- plugin.analyzeJar(analyzer);
-
- assertEquals("component { $class=\"com.acme.Thermometer\" }" +
- "instance { $component=\"com.acme.Thermometer\" }" +
- "instance { $component=\"com.acme.Thermometer\" }",
- analyzer.getProperty("IPOJO-Components"));
- }
-}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF
deleted file mode 100644
index bc04d39327..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF
+++ /dev/null
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Embed
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.apache.felix.ipojo.test
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF
deleted file mode 100644
index b19fc3ec29..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-Manifest-Version: 1.0
-Bundle-Name: Embed
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.apache.felix.ipojo.test
-IPOJO-Components: instance { $component="org.apache.felix.ipojo.IPOJOU
- RLHandler" }component { $immediate="true" $classname="org.apache.feli
- x.ipojo.IPOJOURLHandler" $public="false" callback { $transition="inva
- lidate" $method="stop" }provides { property { $mandatory="false" $nam
- e="url.handler.protocol" $value="ipojo" $type="java.lang.String" }}ma
- nipulation { $super="org.osgi.service.url.AbstractURLStreamHandlerSer
- vice" field { $name="m_context" $type="org.osgi.framework.BundleConte
- xt" }field { $name="m_temp" $type="java.io.File" }method { $arguments
- ="{org.osgi.framework.BundleContext}" $name="$init" }method { $name="
- stop" }method { $arguments="{java.net.URL}" $name="openConnection" $r
- eturn="java.net.URLConnection" }method { $arguments="{java.net.URL,ja
- va.io.File}" $name="save" }method { $arguments="{java.io.InputStream,
- java.io.File}" $name="save" }method { $arguments="{java.util.jar.JarF
- ile}" $name="findMetadata" $return="java.io.File" }interface { $name=
- "org.osgi.service.url.URLStreamHandlerService" }}}
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml
deleted file mode 100644
index 3b1473e0fa..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml
deleted file mode 100644
index 466d6fba29..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml
deleted file mode 100644
index 870c6ed782..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml
deleted file mode 100644
index 8df4c4c045..0000000000
--- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
diff --git a/ipojo/manipulator/changelog.txt b/ipojo/manipulator/changelog.txt
deleted file mode 100644
index 382b8ca231..0000000000
--- a/ipojo/manipulator/changelog.txt
+++ /dev/null
@@ -1,158 +0,0 @@
-Changes from the 1.12.1 to 1.13.0
----------------------------------
-
-** Improvement
- * [FELIX-6502] - iPojo Java 11+ support
-
-Changes from the 1.12.0 to 1.12.1
----------------------------------
-
-** Bug
- * [FELIX-4612] - @PostRegistration is not being called
- * [FELIX-4620] - Warning should be removed when @Configuration is used
- * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)
- * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level'
-
-Changes from the 1.11.2 to 1.12.0
----------------------------------
-
-** Improvement
- * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies
-
-** New Feature
- * [FELIX-4476] - Java 8 Support
-
-** Sub-task
- * [FELIX-4508] - Update to ASM 5.0.2
- * [FELIX-4509] - Change the frame computation strategy
-
-Changes from the 1.11.1 to 1.11.2
----------------------------------
-
-** Bug
- * [FELIX-4453] - Introduce manipulator BOM (Bill of Material)
-
-** Improvement
- * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes
-
-Changes from the 1.11.0 to 1.11.1
----------------------------------
-
-** Bug
- * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied
- * [FELIX-4347] - should ignore inner classes that are assigned to static fields
-
-Changes from the 1.10.1 to 1.11.0
----------------------------------
-
-** Bug
- * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging
- * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation
- * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style)
-
-** Improvement
- * [FELIX-4112] - Add meta annotations for handler description
- * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation
-
-** Task
- * [FELIX-4134] - Move integration-tests to the reactor
- * [FELIX-4151] - Fix mistakes in the javadoc tags
- * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x
- * [FELIX-4156] - Fix versions of maven plugins
- * [FELIX-4270] - Bump iPOJO package version to 1.11.0
-
-** Sub-task
- * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation
- * [FELIX-4254] - Specify the method id of methods from inner class
- * [FELIX-4255] - Extend the inner class manipulation to allow method interception
- * [FELIX-4256] - Avoid manipulation native and static methods from inner classes
-
-Changes from the 1.10.0 to 1.10.1
----------------------------------
-
-** Bug
- * [FELIX-4077] - Fix documentation urls in maven projects
- * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations
- * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern
- * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute
-
-** Improvement
- * [FELIX-4094] - Recognize add/remove method naming pattern
-
-** New Feature
- * [FELIX-4095] - Add CDI-like @Stereotype
-
-** Task
- * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project
- * [FELIX-4103] - Skip deployment of it-tests
- * [FELIX-4104] - Do not run integration-tests in the default build
-
-
-Changes from the 1.8.6 to 1.10.0
---------------------------------
-
-** Bug
- * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin
- * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly
- * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin
- * [FELIX-3974] - Properties cannot be set as immutable using annotations
- * [FELIX-3995] - Missing options in Bind annotation
- * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree
- * [FELIX-4046] - Inner class manipulation fails with expanded frames
- * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name
-
-** Improvement
- * [FELIX-3286] - Update POM to use the new parent
- * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support.
- * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support
- * [FELIX-3837] - PojoizationPlugin should be more extensible
- * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration
- * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation
-
-** New Feature
- * [FELIX-3699] - Allow annotations to handle custom component definitions.
- * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles
-
-** Task
- * [FELIX-3903] - Migrate tests to pax exam 3
- * [FELIX-3921] - Update pom to latest Felix's parent
- * [FELIX-3976] - Move the online manipulator out of the core bundle
-
-Changes from the 1.8.4 to 1.8.6
--------------------------------
-
-** Bug
- * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST
- * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account.
- * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata
- * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames
- * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable
- * [FELIX-3574] - IPojo bytecode manipulation looses method argument names
- * [FELIX-3621] - Two dimensional array as argument to a method in a component
-
-
-Changes from the 1.8.2 to 1.8.4
--------------------------------
-
-** Bug
- * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException
- * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7
-
-Changes in the 1.8.2
---------------------
-
-** Bug
- * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files
- * [FELIX-3012] - "Duplicate name&signature" problem
- * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter
- * [FELIX-3145] - VerifyError on Java 7
- * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest
-
-** Improvement
- * [FELIX-3017] - The manipulator should return the original class if it's already manipulated
- * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator
- * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities
- * [FELIX-3080] - Implement a BND plugin for iPOJO
- * [FELIX-3131] - Elements and attributes should conserve the insertion order
- * [FELIX-3204] - @Temporal should handle instantiation-time properties
- * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible
diff --git a/ipojo/manipulator/ipojo-ant-task/changelog.txt b/ipojo/manipulator/ipojo-ant-task/changelog.txt
deleted file mode 100644
index 17553472cc..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/changelog.txt
+++ /dev/null
@@ -1,197 +0,0 @@
-Changes from the 1.12.0 to 1.12.1
----------------------------------
-
-** Bug
- * [FELIX-4612] - @PostRegistration is not being called
- * [FELIX-4620] - Warning should be removed when @Configuration is used
- * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)
- * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level'
-
-Changes from the 1.11.2 to 1.12.0
----------------------------------
-
-** Improvement
- * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies
-
-** New Feature
- * [FELIX-4476] - Java 8 Support
-
-** Sub-task
- * [FELIX-4508] - Update to ASM 5.0.2
- * [FELIX-4509] - Change the frame computation strategy
-
-Changes from the 1.11.1 to 1.11.2
----------------------------------
-
-** Bug
- * [FELIX-4453] - Introduce manipulator BOM (Bill of Material)
-
-** Improvement
- * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes
-
-Changes from the 1.11.0 to 1.11.1
----------------------------------
-
-** Bug
- * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied
- * [FELIX-4347] - should ignore inner classes that are assigned to static fields
-
-Changes from the 1.10.1 to 1.11.0
----------------------------------
-
-** Bug
- * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging
- * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation
- * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style)
-
-** Improvement
- * [FELIX-4112] - Add meta annotations for handler description
- * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation
-
-** Task
- * [FELIX-4134] - Move integration-tests to the reactor
- * [FELIX-4151] - Fix mistakes in the javadoc tags
- * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x
- * [FELIX-4156] - Fix versions of maven plugins
- * [FELIX-4270] - Bump iPOJO package version to 1.11.0
-
-** Sub-task
- * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation
- * [FELIX-4254] - Specify the method id of methods from inner class
- * [FELIX-4255] - Extend the inner class manipulation to allow method interception
- * [FELIX-4256] - Avoid manipulation native and static methods from inner classes
-
-Changes from the 1.10.0 to 1.10.1
----------------------------------
-
-** Bug
- * [FELIX-4077] - Fix documentation urls in maven projects
- * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations
- * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern
- * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute
-
-** Improvement
- * [FELIX-4094] - Recognize add/remove method naming pattern
-
-** New Feature
- * [FELIX-4095] - Add CDI-like @Stereotype
-
-** Task
- * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project
- * [FELIX-4103] - Skip deployment of it-tests
- * [FELIX-4104] - Do not run integration-tests in the default build
-
-Changes from the 1.8.6 to 1.10.0
---------------------------------
-
-** Bug
- * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin
- * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly
- * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin
- * [FELIX-3974] - Properties cannot be set as immutable using annotations
- * [FELIX-3995] - Missing options in Bind annotation
- * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree
- * [FELIX-4046] - Inner class manipulation fails with expanded frames
- * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name
-
-** Improvement
- * [FELIX-3286] - Update POM to use the new parent
- * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support.
- * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support
- * [FELIX-3837] - PojoizationPlugin should be more extensible
- * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration
- * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation
-
-** New Feature
- * [FELIX-3699] - Allow annotations to handle custom component definitions.
- * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles
-
-** Task
- * [FELIX-3903] - Migrate tests to pax exam 3
- * [FELIX-3921] - Update pom to latest Felix's parent
- * [FELIX-3976] - Move the online manipulator out of the core bundle
-
-Changes from the 1.8.4 to 1.8.6
--------------------------------
-
-** Bug
- * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST
- * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account.
- * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata
- * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames
- * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable
- * [FELIX-3574] - IPojo bytecode manipulation looses method argument names
- * [FELIX-3621] - Two dimensional array as argument to a method in a component
-
-Changes from the 1.8.2 to 1.8.4
--------------------------------
-
-** Bug
- * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException
- * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7
-
-Changes from the 1.8.0 to 1.8.2
--------------------------------
-
-** Bug
- * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files
- * [FELIX-3012] - "Duplicate name&signature" problem
- * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter
- * [FELIX-3145] - VerifyError on Java 7
- * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest
-
-** Improvement
- * [FELIX-3017] - The manipulator should return the original class if it's already manipulated
- * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator
- * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities
- * [FELIX-3080] - Implement a BND plugin for iPOJO
- * [FELIX-3131] - Elements and attributes should conserve the insertion order
- * [FELIX-3204] - @Temporal should handle instantiation-time properties
- * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible
-
-Changes from the 1.6.0 to 1.8.0
--------------------------------
-** Improvement
- * [FELIX-2755] - Allow the manipulator and the different front end to use several metadata files
-
-Changes from the 1.4.2 to 1.6.0
--------------------------------
-** Bug
- * [FELIX-1411] - Issue on windows to find components inside bundle
-
-** Improvement
- * [FELIX-1427] - Service injection with Smart Proxies
- * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified
-
-
-Changes from the 1.4.0 to 1.4.2
--------------------------------
-** Bug
- * [FELIX-1411] - Issue on windows to find components inside bundle
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1302] - Manipulator never ignore annotations
-
-** Improvement
- * Update parent pom
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Improvement
- * [FELIX-813] - Resolve XML-Schemas locally rather than from Internet
-
-Changes from 0.8.1 to 1.0.0
----------------------------
-** Bug
- * Update contained Xerces packages to support XML-Schemas
-
-** Improvement
- * Embed the latest manipulator
-
-Version 0.8.1
--------------
- * Initial release
diff --git a/ipojo/manipulator/ipojo-ant-task/pom.xml b/ipojo/manipulator/ipojo-ant-task/pom.xml
deleted file mode 100644
index 98fb59d9f5..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/pom.xml
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 8
-
- 4.0.0
- org.apache.felix.ipojo.ant
- 1.13.1-SNAPSHOT
- bundle
- Apache Felix iPOJO Ant Task
-
-
- Ant task to package iPOJO-powered bundles.
-
-
-
- [1.12.1,2.0.0)
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.metadata
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator
-
-
- xerces
- xercesImpl
- 2.12.2
-
-
- ant
- ant
- 1.6.5
-
-
- commons-cli
- commons-cli
- 1.2
-
-
-
-
-
-
- org.apache.felix
- ipojo-manipulator-bom
- ${project.version}
- pom
- import
-
-
-
-
-
-
-
- src/main/resources
- true
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 5.1.9
- true
-
-
- iPOJO Ant Task
- ${project.artifactId}
- The Apache Software Foundation
- iPOJO Ant Task
-
- http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-ant-task.html
-
-
- org.apache.felix.ipojo.metadata,
- org.apache.felix.ipojo.manipulator*,
- org.apache.felix.ipojo.xml.parser,
- org.apache.felix.ipojo.manipulation*,
- org.apache.felix.ipojo.annotations*,
- org.objectweb.asm.util;-split-package:=merge-first,
- org.objectweb.asm;-split-package:=merge-first,
- org.objectweb.asm.commons;-split-package:=merge-first,
- org.objectweb.asm.tree*;-split-package:=merge-first,
- org.apache.xerces.parsers, org.apache.xerces.xni*,
- org.apache.xerces.impl*, org.apache.xerces.util.*,
- org.apache.xerces.dom.*, org.apache.xerces.dom3.*,
-
- org.apache.commons.cli
-
- org.apache.felix.ipojo.task
- org.apache.felix.ipojo.task.IPojoc
-
- NONE
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.5
- 1.5
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
- -Xdoclint:none
-
-
-
-
-
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index caa7b23fd9..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
-II. Used Third-Party Software
-
-III. Overall License Summary
-- Apache License 2.0
-- BSD License
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE
deleted file mode 100644
index b42de548c3..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-APACHE FELIX iPOJO Ant Task:
-
-The Apache Felix iPOJO Ant Task includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-
-For the ASM component:
-
-Copyright (c) 2000-2005 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 016e60dffa..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java
deleted file mode 100644
index b99b8521d9..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.task;
-
-import org.apache.felix.ipojo.manipulator.reporter.EmptyReporter;
-import org.apache.tools.ant.Project;
-
-/**
- * An {@code AntReporter} wraps an Ant project (central place for logging in ant
- * into an iPOJO Reporter.
- *
- * @author Felix Project Team
- */
-public class AntReporter extends EmptyReporter {
-
- /**
- * Ant Project (used for log).
- */
- private Project project;
-
- public AntReporter(Project project) {
- this.project = project;
- }
-
- @Override
- public void trace(String message, Object... args) {
- String formatted = String.format(message, getMessageArguments(args));
- project.log(formatted, Project.MSG_DEBUG);
- }
-
- @Override
- public void info(String message, Object... args) {
- String formatted = String.format(message, getMessageArguments(args));
- project.log(formatted, Project.MSG_INFO);
- }
-
- @Override
- public void warn(String message, Object... args) {
- String formatted = String.format(message, getMessageArguments(args));
- project.log(formatted, Project.MSG_WARN);
- getWarnings().add(formatted);
- }
-
- @Override
- public void error(String message, Object... args) {
- String formatted = String.format(message, getMessageArguments(args));
- project.log(formatted, Project.MSG_ERR);
- getErrors().add(formatted);
- }
-
-}
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
deleted file mode 100644
index ddbb0627c6..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * 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.task;
-
-import org.apache.felix.ipojo.manipulator.Pojoization;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.types.Reference;
-
-import java.io.File;
-
-/**
- * iPOJO Ant Task. This Ant task manipulates an input bundle.
- *
- * @author Felix Project Team
- */
-public class IPojoTask extends Task {
-
- /**
- * Metadata file.
- */
- private File m_metadata;
-
- /**
- * Input bundle.
- */
- private File m_input;
-
- /**
- * Output bundle.
- */
- private File m_output;
-
- /**
- * Input directory.
- */
- private File m_directory;
-
- /**
- * Input manifest.
- */
- private File m_manifest;
-
- /**
- * Flag describing if we need to ignore annotation of not.
- */
- private boolean m_ignoreAnnotations = false;
-
-
- /**
- * Flag describing if we need or not use local XSD files
- * (i.e. use the {@link org.apache.felix.ipojo.xml.parser.SchemaResolver} or not).
- * If true the local XSD are not used.
- */
- private boolean m_ignoreLocalXSD = false;
-
- /**
- * The classpath.
- */
- private Path m_classpath;
-
- /**
- * Set the metadata file.
- *
- * @param meta : the metadata file.
- */
- public void setMetadata(File meta) {
- m_metadata = meta;
- }
-
- /**
- * Set the manifest file.
- *
- * @param manifest : the manifest file.
- */
- public void setManifest(File manifest) {
- m_manifest = manifest;
- }
-
- /**
- * Set the input bundle.
- *
- * @param in : the input bundle
- */
- public void setInput(File in) {
- m_input = in;
- }
-
- /**
- * Set the input directory.
- *
- * @param dir : the input directory
- */
- public void setDir(File dir) {
- m_directory = dir;
- }
-
- /**
- * Set the output bundle.
- *
- * @param out : the output bundle
- */
- public void setOutput(File out) {
- m_output = out;
- }
-
- /**
- * Set if we need to ignore annotations or not.
- *
- * @param flag : true if we need to ignore annotations.
- */
- public void setIgnoreAnnotations(boolean flag) {
- m_ignoreAnnotations = flag;
- }
-
- /**
- * Set if we need to use embedded XSD files or not.
- *
- * @param flag : true if we need to ignore embedded XSD files.
- */
- public void setIgnoreEmbeddedSchemas(boolean flag) {
- m_ignoreLocalXSD = flag;
- }
-
- /**
- * Execute the Ant Task.
- *
- * @see org.apache.tools.ant.Task#execute()
- */
- public void execute() {
-
- if (m_input == null && m_directory == null) {
- throw new BuildException("Neither input bundle nor directory specified");
- }
-
- if (m_input != null && !m_input.exists()) {
- throw new BuildException("The input bundle " + m_input.getAbsolutePath() + " does not exist");
- }
-
- if (m_directory != null && !m_directory.exists()) {
- throw new BuildException("The input directory " + m_directory.getAbsolutePath() + " does not exist");
- }
- if (m_directory != null && !m_directory.isDirectory()) {
- throw new BuildException("The input directory " + m_directory.getAbsolutePath() + " is not a directory");
- }
-
-
- if (m_input != null) {
- log("Input bundle file : " + m_input.getAbsolutePath());
- } else {
- log("Input directory : " + m_directory.getAbsolutePath());
- }
-
- if (m_manifest != null) {
- if (m_input != null) {
- throw new BuildException("The manifest location cannot be used when manipulating an existing bundle");
- }
- if (!m_manifest.exists()) {
- throw new BuildException("The manifest file " + m_manifest.getAbsolutePath() + " does not exist");
- }
- }
-
- // Get metadata file
- if (m_metadata == null) {
- m_metadata = new File("./metadata.xml");
- if (!m_metadata.exists()) {
- // Verify if annotations are ignored
- if (m_ignoreAnnotations) {
- log("No metadata file found & annotations ignored : nothing to do");
- return;
- } else {
- log("No metadata file found - trying to use only annotations");
- m_metadata = null;
- }
- } else {
- log("Metadata file : " + m_metadata.getAbsolutePath());
- }
- } else {
- // Metadata file is specified, check existence
- if (!m_metadata.exists()) {
- throw new BuildException("No metadata file found - the file " + m_metadata.getAbsolutePath() + " does not exist");
- } else {
- if (m_metadata.isDirectory()) {
- log("Metadata directory : " + m_metadata.getAbsolutePath());
- } else {
- log("Metadata file : " + m_metadata.getAbsolutePath());
- }
- }
- }
-
- initializeSaxDriver();
-
-
- log("Start manipulation");
-
- if (m_input != null) { // Prepare output file
- if (m_output == null) {
- m_output = new File("./_out.jar");
- }
- if (m_output.exists()) {
- boolean r = m_output.delete();
- if (!r) {
- throw new BuildException("The file " + m_output.getAbsolutePath() + " cannot be deleted");
- }
- }
- }
-
- AntReporter reporter = new AntReporter(getProject());
- Pojoization pojo = new Pojoization(reporter);
- if (m_ignoreAnnotations) {
- pojo.disableAnnotationProcessing();
- }
- if (!m_ignoreLocalXSD) {
- pojo.setUseLocalXSD();
- }
-
- Path classpath = getClasspath();
- classpath.addJavaRuntime();
-
- // Adding the input jar or directory
- if (m_classpath == null) {
- m_classpath = createClasspath();
- }
- Path element = m_classpath.createPath();
- if (m_input != null) {
- element.setLocation(m_input.getAbsoluteFile());
- } else if (m_directory != null) {
- element.setLocation(m_directory.getAbsoluteFile());
- }
- m_classpath.add(element);
-
- ClassLoader loader = getProject().createClassLoader(getClasspath());
- if (m_input != null) {
- pojo.pojoization(m_input, m_output, m_metadata, loader);
- } else {
- pojo.directoryPojoization(m_directory, m_metadata, m_manifest, loader);
- }
- for (int i = 0; i < reporter.getWarnings().size(); i++) {
- log((String) reporter.getWarnings().get(i), Project.MSG_WARN);
- }
- if (reporter.getErrors().size() > 0) {
- throw new BuildException((String) reporter.getErrors().get(0));
- }
-
- if (m_input != null) {
- String out;
- if (m_output.getName().equals("_out.jar")) {
- if (m_input.delete()) {
- if (!m_output.renameTo(m_input)) {
- log("Cannot rename the output jar to " + m_input.getAbsolutePath(), Project.MSG_WARN);
- }
- } else {
- log("Cannot delete the input file : " + m_input.getAbsolutePath(), Project.MSG_WARN);
- }
- out = m_input.getAbsolutePath();
- } else {
- out = m_output.getAbsolutePath();
- }
-
- log("Bundle manipulation - SUCCESS");
- log("Output file : " + out);
- } else {
- log("Manipulation - SUCCESS");
- log("Output files : " + m_directory.getAbsolutePath());
- if (m_manifest != null) {
- log("Manifest : " + m_manifest.getAbsolutePath());
- }
-
- }
-
- }
-
- /**
- * If Ant runs with Java 1.4, we should use the embedded Xerces.
- * To achieve that, we set the org.xml.sax.driver property.
- * Otherwise, the JVM sets the org.xml.sax.driver property.
- */
- private void initializeSaxDriver() {
- String version = (String) System.getProperty("java.vm.version");
- if (version.startsWith("1.4")) {
- System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
- }
- }
-
- /**
- * Set the classpath to be used for this packaging.
- *
- * @param classpath the classpath used for this packaging
- */
- public synchronized void setClasspath(Path classpath) {
- if (m_classpath == null) {
- m_classpath = createClasspath();
- }
- m_classpath.append(classpath);
- }
-
- /**
- * Creates a nested classpath element.
- *
- * @return classpath
- */
- public synchronized Path createClasspath() {
- if (m_classpath == null) {
- m_classpath = new Path(getProject());
- }
- return m_classpath.createPath();
- }
-
- /**
- * Adds to the classpath a reference to
- * a <path> defined elsewhere.
- *
- * @param pathRef the reference to add to the classpath
- */
- public void setClasspathRef(Reference pathRef) {
- createClasspath().setRefid(pathRef);
- }
-
- /**
- * Gets the classpath.
- *
- * @return the classpath
- */
- public Path getClasspath() {
- return m_classpath;
- }
-
-
-}
-
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java
deleted file mode 100644
index 82607429d9..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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.task;
-
-import static java.lang.String.format;
-
-import org.apache.commons.cli.*;
-import org.apache.felix.ipojo.manipulator.Pojoization;
-import org.apache.felix.ipojo.manipulator.util.Constants;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * A command line tools to manipulate iPOJO bundles.
- * It can be used as follow:
- * java -jar this-jar.jar --input the-jar-to-manipulate
- * java -jar this-jar.jar --input the-jar-to-manipulate --output the-output-jar
- * java -jar this-jar.jar --input the-jar-to-manipulate --metadata the-xml-metadata
- */
-public class IPojoc {
-
- /**
- * Input file to be manipulated.
- */
- private File m_input;
-
- /**
- * Output file (temporary or not).
- */
- private File m_output;
-
- /**
- * Metadata file (may be null).
- */
- private File m_metadata;
-
- /**
- * Manipulator.
- */
- private Pojoization m_pojoization;
-
- /**
- * The main entry point
- * @param args the arguments
- */
- public static void main(String[] args) {
- Options options = buildOptions();
- CommandLine cmd = null;
- try {
- cmd = buildCommandLine(args, options);
- if (cmd.hasOption('h')) {
- printHelp(options);
- } else {
- IPojoc compiler = new IPojoc();
- compiler.execute(cmd);
- }
- } catch (MissingOptionException e) {
- for (String opt : (List) e.getMissingOptions()) {
- System.err.println("The '" + opt + "' option is missing");
- }
- printHelp(options);
- } catch (MissingArgumentException e) {
- System.err.println("The option '" + e.getOption() + "' requires an argument");
- printHelp(options);
- } catch (Exception e) {
- System.out.printf("Manipulation failed: %s%n", e.getMessage());
- if ((cmd != null) && cmd.hasOption('X')) {
- e.printStackTrace(System.out);
- } else {
- System.out.printf("Use -X option to print the full stack trace%n");
- }
- }
- }
-
- private static CommandLine buildCommandLine(final String[] args, final Options options) throws ParseException {
- CommandLineParser parser = new GnuParser();
- return parser.parse(options, args);
- }
-
- /**
- * The command line is valid, to processing the command line.
- * @param cmd the command line
- * @throws ParseException
- */
- private void execute(CommandLine cmd) throws Exception {
- System.out.printf("iPOJO Manipulation (%s)%n", Constants.getVersion());
- System.out.println("-----------------------------------------------");
- readInputOption(cmd);
- readOutputOption(cmd);
- readMetadataOption(cmd);
-
- manipulate();
- printStatus();
- }
-
- private void readMetadataOption(final CommandLine cmd) throws Exception {
- // Retrieve the metadata file
- if (cmd.hasOption("m")) {
- m_metadata = (File) cmd.getParsedOptionValue("m");
- if (m_metadata != null && !m_metadata.isFile()) {
- throw new Exception(
- format("The metadata option must be an existing file, '%s' does not exist", cmd.getOptionValue('m'))
- );
- }
- System.out.println("metadata file => " + m_metadata.getAbsolutePath());
- } else {
- System.out.println("metadata file => no metadata file");
- }
- }
-
- private void readOutputOption(final CommandLine cmd) throws Exception {
- // Retrieve output file
- if (cmd.hasOption("o")) {
- try {
- m_output = (File) cmd.getParsedOptionValue("o");
- } catch (ParseException pe) {
- throw new Exception(
- format("The output option must be an existing file, '%s' does not exist", cmd.getOptionValue('o'))
- );
- }
- System.out.println("output file => " + m_output.getAbsolutePath());
- } else {
- // Inline replacement
- // We create a temporary file marked by a __ prefix
- // It will be substituted upon success.
- m_output = new File("__" + m_input.getName());
- System.out.println("output file => " + m_input.getAbsolutePath());
- }
- }
-
- private void readInputOption(final CommandLine cmd) throws Exception {
- // Check that the input file exist
- m_input = (File) cmd.getParsedOptionValue("i");
- if (m_input == null || !m_input.isFile()) {
- throw new Exception(
- format("The input option must be an existing file, '%s' does not exist", cmd.getOptionValue('i'))
- );
- }
- System.out.println("input file => " + m_input.getAbsolutePath());
- }
-
- private void manipulate() {
- m_pojoization = new Pojoization();
- m_pojoization.pojoization(m_input, m_output, m_metadata);
- }
-
- private void printStatus() {
- if (m_pojoization.getErrors().size() != 0) {
- System.err.println("iPOJO Manipulation failed :");
- for (String error : m_pojoization.getErrors()) {
- System.err.println("\t" + error);
- }
- System.exit(-1);
- } else {
- System.err.println("iPOJO Manipulation successfully completed.");
- for (String warning : m_pojoization.getWarnings()) {
- System.err.println(warning);
- }
- cleanup();
- System.exit(0);
- }
- }
-
- /**
- * Upon success, cleanup temporary files.
- */
- private void cleanup() {
- if (m_output.getName().startsWith("__")) {
- m_input.delete();
- m_output.renameTo(m_input);
- }
- }
-
- /**
- * Print help.
- * @param options
- */
- private static void printHelp(final Options options) {
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("java -jar org.apache.felix.ipojo.ant-" + Constants.getVersion() + ".jar", options);
- }
-
- /**
- * Builds the option list
- * @return the options
- */
- public static Options buildOptions() {
- Option input =
- OptionBuilder.withArgName("input file")
- .withLongOpt("input")
- .hasArg()
- .withDescription("the input jar file")
- .isRequired(true)
- .withType(File.class)
- .create('i');
-
- Option output =
- OptionBuilder
- .withLongOpt("output")
- .withArgName("output file")
- .hasArg()
- .withDescription("the output jar file, if not set the manipulation replaces the input file")
- .isRequired(false)
- .withType(File.class)
- .create('o');
-
- Option metadata =
- OptionBuilder
- .withLongOpt("metadata")
- .withArgName("metadata file")
- .hasArg()
- .withDescription("the XML metadata file")
- .isRequired(false)
- .withType(File.class)
- .create('m');
-
- Option verbose = new Option("X", "exception", false, "print exception stack trace in case of error");
-
- Option help =
- OptionBuilder.withLongOpt("help").withDescription("print this message").create('h');
-
- return new Options()
- .addOption(input)
- .addOption(output)
- .addOption(metadata)
- .addOption(verbose)
- .addOption(help);
- }
-}
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties
deleted file mode 100644
index d070319aec..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-# This file define the different constant we use in the manipulator. This file is filtered by Maven.
-manipulator.version=${project.version}
-ipojo.import.packages=${ipojo.import.packages}
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module
deleted file mode 100644
index d3b15f9e2e..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.felix.ipojo.manipulator.metadata.annotation.module.DefaultBindingModule
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd
deleted file mode 100644
index f127dddf8d..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd
deleted file mode 100644
index 3c729c9e05..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd
+++ /dev/null
@@ -1,704 +0,0 @@
-
-
-
- iPOJO Core XML-Schema. This grammars models iPOJO descriptor using core
- features. It provides several extensibility mechanism in order to compose this schema with
- external handlers and other component implementation type such as
- compositions.
-
-
-
-
-
- iPOJO top level element.
-
-
-
-
- The handler declarations.
-
-
-
-
- The instance declarations.
-
-
-
-
- The component type declarations.
-
-
-
-
-
-
-
-
- Description of the handler.
-
-
-
-
-
-
-
-
- The implementation class of the handler. The specified class must
- implement (direcly or not) the "org.apache.felix.ipojo.Handler"
- interface.
-
-
-
-
-
- The name of the handler.
-
-
-
-
- The XML namespace of the handler.
-
-
-
-
- Enables or disables the architecture exposition. By default, the
- architecture is not exposed. This allows handler introspection.
-
-
-
-
-
- The start level of the handler.
-
-
-
-
-
-
-
- Describes an instance of a component.
-
-
-
-
-
-
- The instance props.
-
-
-
-
-
- The name of the instance component type.
-
-
-
-
- The (unique) name of the instance.
-
-
-
-
- The version of the factory to use.
-
-
-
-
-
-
-
- Defines a property of an instance configuration.
-
-
-
-
-
-
- Name of the property. Can be optional if a property is inside a structure.
- The 'instance.name' property has a special semantic as it will be used as the instance
- name.
-
-
-
-
-
- Value of the property. Can be null for property containing other
- props.
-
-
-
-
-
- Type of the property, used to create the adequate object. Supported values
- are list, array, dictionary and map.
-
-
-
-
-
-
-
- Declares an atomic (i.e. primitive) component type.
-
-
-
-
- Describes the method(s) to invoke when the component's state
- changes.
-
-
-
-
-
- Indicates the component provided service(s). By default, all implemented
- interfaces are published.
-
-
-
-
-
- Indicates the service requirements of the component.
-
-
-
-
- Describes the properties of the component.
-
-
-
-
- Lifecycle controller for this component.
-
-
-
-
-
-
- Specifies the name of the component type. This name is used to identify
- the factory attached to this type. If not specified, the factory name is the
- implementation class name.
-
-
-
-
-
- Determines if the component type is public or private. A public factory
- (default) can be used from any bundles.
-
-
-
-
-
- Specifies the implementation class of the component
- type.
-
-
-
-
-
- Enables or disables the architecture exposition. By default, the
- architecture is exposed. This allows instance introspection.
-
-
-
-
-
- Creates the object of the component implementation type as soon as the
- component instance becomes valid. The default value is "true" if the component doesn't
- provide any service, "false" otherwise.
-
-
-
-
-
- Factory method called to create POJO objects instead of the constructor.
- The specified method must be a static method of the implementation class returning an
- instance of this implementation class. The factory method can receive the bundle context
- in argument.
-
-
-
-
-
- Set the version of this component type
-
-
-
-
-
- Description of component services requirements.
-
-
-
-
-
-
- Service requirement method invocation description. Here can be
- specified a bind method called when a service appears and an unbind method called
- when a service disappears.
-
-
-
-
-
-
-
- The interface describing the required service type. This attribute is
- needed only when using aggregate dependencies with field injection and when the type
- of this field is a list, vector, collection and set. This attribute is deprecated, use
- 'specification'.
-
-
-
-
-
-
- The name of the field representing the service dependency in the
- implementation class.
-
-
-
-
-
-
- Enable or disable the Nullable pattern on optional service
- dependencies. By default, Nullable pattern is enabled. If disabled, iPOJO will inject
- null instead of a Nullable object.
-
-
-
-
-
-
- Specifies the default implementation class for an optional service
- dependency. If no providers are found, iPOJO creates an instance of the
- default-implementation (nullary constructor) and injects it. The given class must
- implement the required service interface.
-
-
-
-
-
-
- Specifies the exception to throw for an optional service
- dependency. If no providers are found, iPOJO creates an instance of the
- exception (with either no parameter or a String parameter as constructor argument), and
- throws it. The given class name must extends RuntimeException.
-
-
-
-
-
-
- Specifies the timeout after which the 'no service policy' is executed
- (nullable, null, empty collection, exception...). The value is the time in millisecond to
- wait. -1 is used to indicate an infinite wait, 0 executes the no service policy
- immediately.
-
-
-
-
-
-
- Specific service provider. The dependency can only be fulfilled by the
- component with the matching name, or by the service with a matching
- PID.
-
-
-
-
-
-
- Enables or Disable the proxy injection (on field
- injection)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Dependency callbacks are used to receive notification when service providers
- arrive and leave.
-
-
-
-
- Method to call
-
-
-
-
- Type of callback (bind, unbind, or updated). Bind means that the method
- will be called when a provider arrives. Unbind means that the method will be called when a
- provider leaves. Updated means that a service was modified but is still valid for the
- service dependency.
-
-
-
-
-
-
-
-
-
-
-
-
-
- Lifecycle Callback. Allows a POJO to be notified when the instance becomes
- valid or invalid.
-
-
-
-
- Specifies the method to call on the transition.
-
-
-
-
- Specifies the transition when the callback needs to be
- invoked.
-
-
-
-
- Lifecycle transition state. "validate" means that the component's
- instance was invalid and becomes valid, "invalidate" means that the component's intance
- was valid and becomes invalid.
-
-
-
-
-
-
-
-
-
-
-
- Allows injecting the OSGi bundle context into the component.
-
-
-
-
- Specifies the method receiving the bundle context.
-
-
-
-
- Specifies the field receiving the bundle context.
-
-
-
-
- Specifies the index of the parameter (0-based) receiving the bundle
- context.
-
-
-
-
-
- Specifies the context source.
-
-
-
-
- iPOJO supports two bundle context 'sources': component and instance. Component
- is the bundle context of the bundle declaring the component, while instance is the bundle
- context of the bundle declaring the instance. Obviously, they are the same when the instance
- is declared in the same bundle as the component. By default, it uses 'component'.
-
-
-
-
-
-
-
-
-
-
-
-
- Provided service(s) description.
-
-
-
-
-
- List of service specific props.
-
-
-
-
- Service Controller impacting the current provided
- service
-
-
-
-
-
-
-
- Deprecated attribute, use 'specifications' instead of
- 'interface'
-
-
-
-
-
- The list of service specifications (i.e. interfaces) to expose. By
- default, all interfaces implemented by the component implementation class are
- published.
-
-
-
-
-
- Use 'strategy' instead of 'factory'
-
-
-
-
- POJO creation strategy. By default, the POJO object is created once
- (singleton). If the factory is set to "SERVICE", the creation policy follows the OSGi
- service factory policy (one object object per asking bundle). INSTANCE allows creating one
- different POJO object per asking instance. Finally, a custom strategy can be used by
- specifying the qualified name of the class extending CreationPolicy
-
-
-
-
-
- Defines a callback called after the service registration. The callback takes a
- ServiceReference
- as parameter
-
-
-
-
-
- Defines a callback called after the service unregistration. The callback takes a
- ServiceReference
- as parameter
-
-
-
-
-
-
- Defines a service controller.
-
-
-
- Field of the controller
-
-
-
-
- Intiail value of the controller
-
-
-
-
-
- Defines a component property.
-
-
-
- Field of the property
-
-
-
-
- Setter method of the property. This method is called to inject property
- value.
-
-
-
-
-
- Name of the property.
-
-
-
-
- Default value of the property.
-
-
-
-
- Type of the property.
-
-
-
-
- Set the property as mandatory. A mandatory property MUST receive a value
- either in the component type description or in the instance configuration. Properties are
- optional by default.
-
-
-
-
-
- Set the property as immutable. An immutable property is inherited by the component
- instance but the value cannot be overridden.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- List of component, instance or service props. This field will receive
- the property value.
-
-
-
-
-
- The list of props.
-
-
-
-
-
- Propagation of the component properties to the provided services. If this
- parameter is set to "true", each time properties are reconfigured, they are propagated to
- each service published by the component.
-
-
-
-
-
- Unique identifier used to reconfigure components properties (via Managed
- Services) with the Configuration Admin.
-
-
-
-
-
- Method called when a reconfiguration is done
-
-
-
-
-
-
-
- The specification describing the required service type. This attribute is
- needed only when using aggregate dependencies with field injection and when the type of
- this field is a list, vector, collection and set.
-
-
-
-
-
- Sets the service dependency optionality
-
-
-
-
- Sets the service dependency cardinality.
-
-
-
-
- Sets the binding policy of the dependency. Three policies are supported.
- The dynamic policy supports service providers dynamism. The static policy freezes the
- provider set as soon as the dependency is used. The dynamic-priority policy is an
- extension of the dynamic policy, but providers are ranked.
-
-
-
-
-
-
-
-
-
-
-
-
- The comparator attribute allows specifying the class used to compare
- providers. This class must implemented the java.util.Comparator class and must support the
- comparison of service references.
-
-
-
-
-
- LDAP filter used to filter providers
-
-
-
-
- id of the service dependency. The id allows to identify and to refer to
- this dependency.
-
-
-
-
-
-
-
- Specifies the lifecycle controller of a component, which allows to validate
- or invalidate component instances.
-
-
-
-
- The name of the component lifecycle controller field. The type of the
- specified field must be boolean. Setting the value of the specified field to "true" means
- the validation of the component instance while setting it to "false" means the
- invalidation of the component instance.
-
-
-
-
-
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd
deleted file mode 100644
index d3948e6f9c..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
- Description of an event publisher.
-
-
-
- The name of the event publisher, acting as a unique identifier.
-The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher".
-
-
-
- The name of the POJO field associated to this event publisher.
-Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending.
-
-
-
- The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events.
-
-
- Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher.
-The default value of this attribute is "false".
-
-
-
- The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key.
-The default value of this attribute is user.data.
-
-
-
-
- Description of an event subscriber.
-
-
-
- The name of the event subscriber, acting as a unique identifier.
-
-
- The name of the POJO's method that will be called each time an event is received.
-This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes.
-
-
-
- The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method.
-
-
- The event filter is used to filter incoming events before sending them to the callback.
-The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered.
-
-
-
- The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary.
-If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event.
-This attribute is generally used with the data-typeattribute to specify the received object type.
-If an event is received and it does not contain such a key, it is ignored (with a warning message).
-
-
-
- This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects.
-It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception.
-Data events that are not corresponding to the specified type will be ignored (with a warning message).
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd
deleted file mode 100644
index dc39757e90..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
- Description of the extender pattern configuration.
-The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked.
-
-
-
- Declaring the method to invoke when a matching bundle arrives
-
-
-
- Declaring the method to invoke when a matching bundle leaves
-
-
-
- Declaring the looked manifest header.
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd
deleted file mode 100644
index 09b95090d8..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
- Description of a JMX managed component.
-
-
-
-
-
-
- The list of methods to expose.
-
-
-
-
-
-
- The list of attributes to expose.
-
-
-
-
-
-
-
- Determines if the component must be register on the
- MOSGi MBean server or not.
-
-
-
-
-
-
- The complete object name of the managed component.
- The syntax of this attribute must be compliant with
- the ObjectName syntax, detailed in the JMX
- specification. If neither domain nor name attributes
- are specified, the default value is determined by
- the package, the type and the instance name of the
- component. This attribute overrides the domain and
- name attributes.
-
-
-
-
-
-
- The domain of the managed object (i.e., the left
- part of the object name). This attribute must be
- compliant with the domain syntax, as described in
- the JMX specification.
-
-
-
-
-
-
- The name property of the managed object. The value
- of this attribute must comply with the ObjectName
- value syntax, as described in the JMX specification.
-
-
-
-
-
-
-
- Specifies method to carry out operations before
- beeing registered from the MBean server. The
- signature of the specified method must be :
- "ObjectName preRegister(MBeanServer server,
- ObjectName name) throws Exception".
-
-
-
-
-
-
- Specifies method to carry out operations after
- beeing registered from the MBean server. The
- signature of the specified method must be : "void
- postRegister(Boolean registrationDone)".
-
-
-
-
-
-
- Specifies method to carry out operations before
- beeing unregistered from the MBean server. The
- signature of the specified method must be : "void
- preDeregister() throws Exception".
-
-
-
-
-
-
- Specifies method to carry out operations after
- beeing unregistered from the MBean server. The
- signature of the specified method must be :
- "void postDeregister()".
-
-
-
-
-
- Description of an attribute to expose.
-
-
-
- The name of the component's field to expose.
-
-
- The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field.
-
-
- Specify the access permission of the exposed field.
-
-
-
- Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access).
-
-
-
-
-
-
-
-
-
- Enable or disable attribute change notification sending for this property. If set to "true", a notification is sent each time the value of the field changes.
-
-
-
-
- Description of a method to expose.
-
-
-
- The name of the method to expose. If multiple methods have the same name, all of them are exposed.
-
-
-
- The description of the exposed method, as it will appear in JMX.
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd
deleted file mode 100644
index cecc68bb99..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
- Description of a temporal dependency.
-
-
-
- The implementation field supporting the dependency.
-
-
-
- The dependency id
-
-
-
- Filter use to discover matching filter.
-
-
- Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait.
-
-
-
- Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached.
-
-
-
-
- Enables or Disables the proxy injection
-
-
-
-
- Specifies the looked service specification. This attribute is mandatory when injecting in a Collection
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd
deleted file mode 100644
index 0c8ebb20c2..0000000000
--- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
- Description of the white-board architecture.
-
-
-
- Declaring the method to invoke when a matching service arrives.
-
-
-
- Declaring the method to invoke when a matching service leaves.
-
-
-
- Method called when an injected service reference is modified but stills valid against the filter.
-
-
-
- Filter use to discover matching filter.
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-bom/pom.xml b/ipojo/manipulator/manipulator-bom/pom.xml
deleted file mode 100644
index 226ebd61ca..0000000000
--- a/ipojo/manipulator/manipulator-bom/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
- 4.0.0
-
- org.apache.felix
- felix-parent
- 8
-
-
- ipojo-manipulator-bom
- 1.13.1-SNAPSHOT
- Apache Felix iPOJO Manipulator BOM
- pom
-
-
- 9.6
- 1.6.0
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator
- ${project.version}
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- ${project.version}
-
-
- org.ow2.asm
- asm
- ${asm.version}
-
-
- org.ow2.asm
- asm-commons
- ${asm.version}
-
-
- org.ow2.asm
- asm-util
- ${asm.version}
-
-
- org.apache.felix
- org.apache.felix.ipojo.metadata
- ${metadata.version}
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml
deleted file mode 100644
index 5c2946651a..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator.manipulator-it
- 1.13.1-SNAPSHOT
-
-
- 4.0.0
-
- ipojo-manipulator-creation-test
- Apache Felix iPOJO Manipulator ~ Creation IT
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java
deleted file mode 100644
index 32f39c59e9..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class ASimpleParentClass {
-
- protected String name;
-
- public ASimpleParentClass() {
- name = "hello";
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java
deleted file mode 100644
index bd4893286f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class CallSuperConstructor extends ParentClass {
-
- public CallSuperConstructor() {
- super("test");
- System.out.println("plop");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java
deleted file mode 100644
index d75c223c4f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.osgi.framework.BundleContext;
-
-public class CallSuperConstructorWithBC extends ParentClassWithBC {
-
- public CallSuperConstructorWithBC(BundleContext bc) {
- super("bc", bc, "bundle");
- String message = "plop-bc";
- System.out.println(message);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java
deleted file mode 100644
index 68237badd9..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class CallSuperConstructorWithNew extends ParentClass {
-
- public CallSuperConstructorWithNew() {
- super(new StringBuffer("test"));
- System.out.println("plop");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java
deleted file mode 100644
index 38720d62c0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class CallSuperSuperConstructorWithNew extends ParentClass2 {
-
- public CallSuperSuperConstructorWithNew() {
- super(new String("test"));
- System.out.println("plop");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
deleted file mode 100644
index 01429a226b..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.osgi.framework.BundleContext;
-
-import java.util.Properties;
-
-public class FooProviderType1 implements FooService {
-
- private int m_bar;
- private String m_foo;
-
- private BundleContext m_context;
-
- private static FooProviderType1 singleton;
- private static int count = 0;
-
- private static FooProviderType1 singleton(BundleContext bc) {
- if (singleton == null) {
- count++;
- singleton = new FooProviderType1(bc);
- }
- return singleton;
- }
-
- public static FooProviderType1 several(BundleContext bc) {
- count++;
- return new FooProviderType1(bc);
- }
-
- public FooProviderType1(BundleContext bc) {
- if (bc ==null) {
- throw new RuntimeException("Injected bundle context null");
- }
- m_context = bc;
- }
-
- public boolean foo() {
- return true;
- }
-
- public Properties fooProps() {
- Properties p = new Properties();
- p.put("bar", new Integer(m_bar));
- if(m_foo != null) {
- p.put("foo", m_foo);
- }
- p.put("context", m_context);
-
- p.put("count", new Integer(count));
- return p;
- }
-
- public void testException() throws Exception {
- String a = "foobarbaz";
- throw new Exception("foo"+a);
- }
-
- public void testTry() {
- String a = "foo";
- a.charAt(0);
- }
-
- public void testTry2(String s) {
- String a = "foo";
- a.charAt(0);
- }
-
- private void nexttry(String s) {
- try {
- s += "foo";
- } catch(RuntimeException e) {
-
- }
- }
-
- public boolean getBoolean() { return true; }
-
- public double getDouble() { return 1.0; }
-
- public int getInt() { return 1; }
-
- public long getLong() { return 1; }
-
- public Boolean getObject() { return new Boolean(true); }
-
- /**
- * Custom constructor.
- * @param bar
- * @param foo
- * @param bc
- */
- public FooProviderType1(int bar, String foo, BundleContext bc) {
- m_bar = bar;
- m_foo = foo;
- m_context = bc;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java
deleted file mode 100644
index f932351acc..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-
-import java.util.Properties;
-
-public class NoEmptyConstructor implements CheckService {
-
-
- private String name;
-
- public NoEmptyConstructor(final String n) {
- name = n;
- }
-
- public boolean check() {
- return name != null;
- }
-
- public Properties getProps() {
- Properties props = new Properties();
- if (name == null) {
- props.put("name", "NULL");
- } else {
- props.put("name", name);
- }
- return props;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java
deleted file mode 100644
index 5e8afdae02..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-
-import java.util.Properties;
-
-public class NoEmptyConstructorWithParentClass extends ASimpleParentClass implements CheckService {
-
- public NoEmptyConstructorWithParentClass(final String n) {
- name = n;
- }
-
- public boolean check() {
- return name != null;
- }
-
- public Properties getProps() {
- Properties props = new Properties();
- if (name == null) {
- props.put("name", "NULL");
- } else {
- props.put("name", name);
- }
- return props;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java
deleted file mode 100644
index 6e4fc9edee..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class ParentClass {
-
- private String name;
-
- public ParentClass(final String n) {
- name = n;
- }
-
- public ParentClass(final StringBuffer n) {
- name = n.toString();
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java
deleted file mode 100644
index 6ea05837b0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class ParentClass2 extends SuperParentClass {
-
- public ParentClass2(String n) {
- super(n);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java
deleted file mode 100644
index 10fa7bac4d..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.osgi.framework.BundleContext;
-
-public class ParentClassWithBC {
-
- private BundleContext bc;
-
- public ParentClassWithBC(String foo, BundleContext bc, String bar) {
- this.bc = bc;
- System.out.println(foo + " : " + this.bc + "(" + bar + ")");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java
deleted file mode 100644
index 21b825e5cb..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-
-import java.util.Properties;
-
-public class SeveralConstructors implements CheckService {
-
-
- private String name;
-
- public SeveralConstructors(){
- this("hello world");
- }
-
- public SeveralConstructors(final String n) {
- name = n;
- }
-
- public boolean check() {
- return name != null;
- }
-
- public Properties getProps() {
- Properties props = new Properties();
- props.put("name", name);
- return props;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java
deleted file mode 100644
index 5609a9c5e5..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class SuperParentClass {
-
- private String name;
-
- public SuperParentClass(final String n) {
- System.out.println("Hello from super super !");
- name = n;
- }
-
- public SuperParentClass(final StringBuffer n) {
- name = n.toString();
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
deleted file mode 100644
index b8e2d62bbb..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services.A123;
-
-public interface CheckService2 {
-
- public boolean check();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
deleted file mode 100644
index 523ddf3ff6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface BarService {
-
- public boolean bar();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
deleted file mode 100644
index 7792aaa52c..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface CheckService {
-
- public static final String foo = "foo";
-
- public boolean check();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
deleted file mode 100644
index 67c6d7a2d6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface FooService {
-
- boolean foo();
-
- Properties fooProps();
-
- Boolean getObject();
-
- boolean getBoolean();
-
- int getInt();
-
- long getLong();
-
- double getDouble();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
deleted file mode 100644
index 88a147802b..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface Plop {
-
- Object getPlop();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
deleted file mode 100644
index 419962ef3f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface PrimitiveManipulationTestService {
-
- byte getByte();
- void setByte(byte b);
-
- short getShort();
- void setShort(short s);
-
- int getInt();
- void setInt(int i);
-
- long getLong();
- void setLong(long l);
-
- float getFloat();
- void setFloat(float f);
-
- double getDouble();
- void setDouble(double d);
-
- char getChar();
- void setChar(char c);
-
- boolean getBoolean();
- void setBoolean(boolean b);
-
- // Array types
- byte[] getBytes();
- void setBytes(byte[] bs);
-
- short[] getShorts();
- void setShorts(short[] ss);
-
- int[] getInts();
- void setInts(int is[]);
-
- long[] getLongs();
- void setLongs(long[] ls);
-
- float[] getFloats();
- void setFloats(float[] fs);
-
- double[] getDoubles();
- void setDoubles(double[] ds);
-
- char[] getChars();
- void setChars(char[] cs);
-
- boolean[] getBooleans();
- void setBooleans(boolean[] bs);
-
- // This method has been added to test an issue when autoboxing.
- void setLong(long l, String s);
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml
deleted file mode 100644
index d35922c8d0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
deleted file mode 100644
index 3834a6a53a..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.PrimitiveInstanceDescription;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.runtime.core.components.FooProviderType1;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.*;
-
-/**
- * Check the different method to create POJO object.
- */
-public class TestPOJOCreation extends BaseTest {
-
- private ComponentInstance ci_lazzy;
- private ComponentInstance ci_immediate;
- private ComponentInstance ci_immediate_singleton;
-
- private Architecture lazzyArch;
- private Architecture immeArch;
- private Architecture immeArchSing;
-
-
- private ComponentInstance ci_lazzy_sing;
- private ComponentInstance ci_lazzy_sev;
-
- private Architecture lazzyArchSing;
- private Architecture lazzyArchSev;
- private ComponentInstance ci_lazzy_singM;
- private ComponentInstance ci_lazzy_sevM;
-
- private Architecture lazzyArchSingM;
- private Architecture lazzyArchSevM;
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
- @Before
- public void setUp() {
- String factName = "ManipulationCreation-FooProviderType-1";
- String compName = "FooProvider-1";
- ci_lazzy = ipojoHelper.createComponentInstance(factName, compName);
-
- String factName2 = "ManipulationCreation-ImmediateFooProviderType";
- String compName2 = "FooProvider-2";
- ci_immediate = ipojoHelper.createComponentInstance(factName2, compName2);
-
- String factName3 = "ManipulationCreation-ImmediateFooProviderTypeSingleton";
- String compName3 = "FooProvider-3";
- ci_immediate_singleton = ipojoHelper.createComponentInstance(factName3, compName3);
-
- String factName4 = "ManipulationCreation-FooProviderType-1-Sing";
- String compName4 = "FooProvider-1-Sing";
- ci_lazzy_sing = ipojoHelper.createComponentInstance(factName4, compName4);
-
- String factName5 = "ManipulationCreation-FooProviderType-1-Sev";
- String compName5 = "FooProvider-1-Sev";
- ci_lazzy_sev = ipojoHelper.createComponentInstance(factName5, compName5);
-
- String factName6 = "ManipulationCreation-FooProviderType-1-SingM";
- String compName6 = "FooProvider-1-SingM";
- ci_lazzy_singM = ipojoHelper.createComponentInstance(factName6, compName6);
-
- String factName7 = "ManipulationCreation-FooProviderType-1-SevM";
- String compName7 = "FooProvider-1-SevM";
- ci_lazzy_sevM = ipojoHelper.createComponentInstance(factName7, compName7);
-
- lazzyArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName + ")");
- immeArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName2 + ")");
- immeArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName3 + ")");
- lazzyArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName4 + ")");
- lazzyArchSev = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName5 + ")");
- lazzyArchSingM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName6 + ")");
- lazzyArchSevM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName7 + ")");
- }
-
- public void tearDown() {
- lazzyArch = null;
- immeArch = null;
- immeArchSing = null;
- lazzyArchSing = null;
- lazzyArchSev = null;
- lazzyArchSingM = null;
- lazzyArchSevM = null;
- ipojoHelper.dispose();
- }
-
- /**
- * Check lazy creation.
- */
- @Test
- public void testLazyCreation() {
- assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check lazy and singleton creation.
- */
- @Test
- public void testLazyCreationSingleton() {
- assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check lazy and "several" creation.
- */
- @Test
- public void testLazyCreationSeveral() {
- assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sev.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy_sev.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertTrue("Check the FooService invocation-2", fs2.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check immediate creation.
- */
- @Test
- public void testImmediateCreation() {
- assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check bundle context injection.
- */
- @Test
- public void testBundleContext() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- Properties p = fs.fooProps();
- assertNotNull("Check the bundle context", p.get("context"));
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Test immediate singleton creation.
- */
- @Test
- public void testImmediateSingletonCreation() {
- assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check creation through a factory method.
- * (lazy & singleton creation)
- */
- @Test
- public void testLazyCreationSingletonM() {
- assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_singM.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy_singM.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertTrue("Check the FooService invocation", fs2.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Check creation through a factory method.
- * (lazy & several creation)
- */
- @Test
- public void testLazyCreationSeveralM() {
- assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sevM.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy_sevM.getInstanceName() + " is available", ref);
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation", fs.foo());
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
- FooService fs2 = (FooService) osgiHelper.getServiceObject(ref);
- assertTrue("Check the FooService invocation-2", fs2.foo());
- // Only one object as the getService method is called only once (service factory) despite the policy="method".
- assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length);
- }
-
- /**
- * Test a custom constructor.
- * Not manipulated.
- */
- @Test
- public void testCustomConstuctor() {
- FooService fs = new FooProviderType1(0, "foo", bc);
- Properties props = fs.fooProps();
- assertEquals("Check bar", 0, ((Integer) props.get("bar")).intValue());
- assertEquals("Check foo", "foo", props.get("foo"));
- assertEquals("Check context", bc, props.get("context"));
- }
-
- @Test
- public void testSuperCall() {
- try {
- ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructor");
- } catch (Throwable e) {
- fail(e.getMessage());
- }
- }
-
- @Test
- public void testSuperCallWithNew() {
- try {
- ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithNew");
- } catch (Throwable e) {
- fail(e.getMessage());
- }
- }
-
- @Test
- public void testSuperSuperCallWithNew() {
- try {
- ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperSuperConstructorWithNew");
- } catch (Throwable e) {
- fail(e.getMessage());
- }
- }
-
- @Test
- public void testSuperCallWithBC() {
- try {
- ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithBC");
- } catch (Throwable e) {
- fail(e.getMessage());
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
deleted file mode 100644
index ba5e8150a9..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class TestSeveralConstructor extends BaseTest {
-
- private ComponentInstance ci, ci2, ci3;
-
- @Before
- public void setUp() {
- ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.SeveralConstructors");
- ci2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructor");
- ci3 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructorWithParentClass");
- }
-
- @Test
- public void testSeveralConstructor() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName());
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- assertTrue("Check assignation", cs.check());
- String name = (String) cs.getProps().get("name");
- assertEquals("Check message", "hello world", name);
- //assertNull("Check message", name);
- }
-
- @Test
- public void testNoEmptyConstructor() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci2.getInstanceName());
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- assertFalse("Check assignation", cs.check());
- String name = (String) cs.getProps().get("name");
- assertEquals("Check message", "NULL", name);
- }
-
- @Test
- public void testNoEmptyConstructorWithAParentClass() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci3.getInstanceName());
- CheckService cs = (CheckService) osgiHelper.getServiceObject(ref);
- assertTrue("Check assignation", cs.check()); // super set name to "hello"
- String name = (String) cs.getProps().get("name");
- assertEquals("Check message", "hello", name);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml
deleted file mode 100644
index e25ec3bea0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator.manipulator-it
- 1.13.1-SNAPSHOT
-
-
- 4.0.0
-
- ipojo-manipulator-manipulation-metadata-test
-
- Apache Felix iPOJO Manipulator ~ Metadata IT
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java
deleted file mode 100644
index 9441beeaa0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class Child extends Parent {
-
- public Child(String s) {
- super(s);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java
deleted file mode 100644
index 7eb4dbdf3f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-
-/**
- **
- * A component containing inner classes.
- */
-@Component
-public class ComponentWithInnerClasses{
-
- public String doSomething() {
- MyInnerWithANativeMethod nat = new MyInnerWithANativeMethod();
- MyInnerClass inn = new MyInnerClass();
- Runnable compute = new Runnable() {
-
- public void run() {
- // ...
- }
- };
- return "foo";
- }
-
- private String foo = "foo";
-
- private class MyInnerWithANativeMethod {
-
- public String foo() {
- return ComponentWithInnerClasses.this.foo;
- }
-
- public native void baz();
-
- }
-
- public static class MyStaticInnerClass {
-
- public static String foo() {
- return "foo";
- }
-
- public String bar() {
- return "bar";
- }
-
- public native void baz();
- }
-
- private class MyInnerClass {
- public String foo() {
- return ComponentWithInnerClasses.this.foo;
- }
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java
deleted file mode 100644
index fd0e6deffd..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.BarService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-
-import java.util.Properties;
-
-public class FooBarProviderType1 implements FooService, BarService {
-
- public boolean foo() {
- return true;
- }
-
- public Properties fooProps() {
- return new Properties();
- }
-
- public boolean bar() {
- return true;
- }
-
- public Properties getProps() {
- return new Properties();
- }
-
- public boolean getBoolean() {
- return true;
- }
-
- public double getDouble() {
- return 1.0;
- }
-
- public int getInt() {
- return 1;
- }
-
- public long getLong() {
- return 1;
- }
-
- public Boolean getObject() {
- return new Boolean(true);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
deleted file mode 100644
index 87b7304eb6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.osgi.framework.BundleContext;
-
-import java.util.Properties;
-
-public class FooProviderType1 implements FooService {
-
- private int m_bar;
- private String m_foo;
-
- private BundleContext m_context;
-
- private static FooProviderType1 singleton;
- private static int count = 0;
-
- private static FooProviderType1 singleton(BundleContext bc) {
- if (singleton == null) {
- count++;
- singleton = new FooProviderType1(bc);
- }
- return singleton;
- }
-
- public static FooProviderType1 several(BundleContext bc) {
- count++;
- return new FooProviderType1(bc);
- }
-
- public FooProviderType1(BundleContext bc) {
- if (bc == null) {
- throw new RuntimeException("Injected bundle context null");
- }
- m_context = bc;
- }
-
- public boolean foo() {
- return true;
- }
-
- public Properties fooProps() {
- Properties p = new Properties();
- p.put("bar", new Integer(m_bar));
- if (m_foo != null) {
- p.put("foo", m_foo);
- }
- p.put("context", m_context);
-
- p.put("count", new Integer(count));
- return p;
- }
-
- public void testException() throws Exception {
- String a = "foobarbaz";
- throw new Exception("foo" + a);
- }
-
- public void testTry() {
- String a = "foo";
- a.charAt(0);
- }
-
- public void testTry2(String s) {
- String a = "foo";
- a.charAt(0);
- }
-
- private void nexttry(String s) {
- try {
- s += "foo";
- } catch (RuntimeException e) {
-
- }
- }
-
- public boolean getBoolean() {
- return true;
- }
-
- public double getDouble() {
- return 1.0;
- }
-
- public int getInt() {
- return 1;
- }
-
- public long getLong() {
- return 1;
- }
-
- public Boolean getObject() {
- return new Boolean(true);
- }
-
- /**
- * Custom constructor.
- *
- * @param bar
- * @param foo
- * @param bc
- */
- public FooProviderType1(int bar, String foo, BundleContext bc) {
- m_bar = bar;
- m_foo = foo;
- m_context = bc;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
deleted file mode 100644
index 779fdd6d8a..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-
-import java.util.Properties;
-
-public class FooProviderTypeDyn implements FooService {
-
- private int intProp;
- private String strProp;
- private String[] strAProp;
- private int[] intAProp;
- private boolean boolProp;
-
- public boolean foo() {
- intProp = 3;
- boolProp = true;
- if (strProp.equals("foo")) {
- strProp = "bar";
- } else {
- strProp = "foo";
- }
- strAProp = new String[]{"foo", "bar", "baz"};
- intAProp = new int[]{3, 2, 1};
- return true;
- }
-
- public Properties fooProps() {
- Properties p = new Properties();
- p.put("intProp", new Integer(intProp));
- p.put("boolProp", new Boolean(boolProp));
- p.put("strProp", strProp);
- p.put("strAProp", strAProp);
- p.put("intAProp", intAProp);
- return p;
- }
-
- public boolean getBoolean() {
- return true;
- }
-
- public double getDouble() {
- return 1.0;
- }
-
- public int getInt() {
- return 1;
- }
-
- public long getLong() {
- return 1;
- }
-
- public Boolean getObject() {
- return new Boolean(true);
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java
deleted file mode 100644
index eada5a0aa6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-
-
-public class Manipulation23Tester implements PrimitiveManipulationTestService {
-
- // Integer types
- byte b = 1;
- short s = 1;
- int i = 1;
- long l = 1;
-
- // Floatting types
- double d = 1.1;
- float f = 1.1f;
-
- // Character
- char c = 'a';
-
- // Boolean
- boolean bool = false;
-
- // Integer arrays
- byte[] bs = new byte[]{0, 1, 2};
- short[] ss = new short[]{0, 1, 2};
- int[] is = new int[]{0, 1, 2};
- long[] ls = new long[]{0, 1, 2};
-
- double[] ds = new double[]{0.0, 1.1, 2.2};
- float[] fs = new float[]{0.0f, 1.1f, 2.2f};
-
- char[] cs = new char[]{'a', 'b', 'c'};
-
- boolean[] bools = new boolean[]{false, true, false};
-
- public boolean getBoolean() {
- return bool;
- }
-
- public boolean[] getBooleans() {
- return bools;
- }
-
- public byte getByte() {
- return b;
- }
-
- public byte[] getBytes() {
- return bs;
- }
-
- public char getChar() {
- return c;
- }
-
- public char[] getChars() {
- return cs;
- }
-
- public double getDouble() {
- return d;
- }
-
- public double[] getDoubles() {
- return ds;
- }
-
- public float getFloat() {
- return f;
- }
-
- public float[] getFloats() {
- return fs;
- }
-
- public int getInt() {
- return i;
- }
-
- public int[] getInts() {
- return is;
- }
-
- public long getLong() {
- return l;
- }
-
- public long[] getLongs() {
- return ls;
- }
-
- public short getShort() {
- return s;
- }
-
- public short[] getShorts() {
- return ss;
- }
-
- public void setBoolean(boolean b) {
- this.bool = b;
- }
-
- public void setBooleans(boolean[] bs) {
- this.bools = bs;
- }
-
- public void setByte(byte b) {
- this.b = b;
- }
-
- public void setBytes(byte[] bs) {
- this.bs = bs;
- }
-
- public void setChar(char c) {
- this.c = c;
- }
-
- public void setChars(char[] cs) {
- this.cs = cs;
- }
-
- public void setDouble(double d) {
- this.d = d;
- }
-
- public void setDoubles(double[] ds) {
- this.ds = ds;
- }
-
- public void setFloat(float f) {
- this.f = f;
- }
-
- public void setFloats(float[] fs) {
- this.fs = fs;
- }
-
- public void setInt(int i) {
- this.i = i;
- }
-
- public void setInts(int[] is) {
- this.is = is;
- }
-
- public void setLong(long l) {
- this.l = l;
- }
-
- public void setLongs(long[] ls) {
- this.ls = ls;
- }
-
- public void setShort(short s) {
- this.s = s;
- }
-
- public void setShorts(short[] ss) {
- this.ss = ss;
- }
-
- // This method has been added to test an issue when autoboxing.
- public void setLong(long l, String s) {
- this.l = l;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java
deleted file mode 100644
index 06ecb0635b..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class Multiconstructor {
-
- public Multiconstructor(String s1, String s2) {
- this(s1, s2, -1);
- }
-
- public Multiconstructor(String s1, int s2) {
- this(s1, "" + s2, s2);
- }
-
- public Multiconstructor(String s1, String s2, int i) {
- //...
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java
deleted file mode 100644
index 5956b40147..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.osgi.framework.ServiceReference;
-
-import java.util.Properties;
-
-public class MultipleCheckService implements CheckService {
-
- FooService fs[];
-
- int simpleB = 0;
-
- int objectB = 0;
-
- int refB = 0;
-
- int bothB = 0;
-
- int simpleU = 0;
-
- int objectU = 0;
-
- int refU = 0;
-
- int bothU = 0;
-
- public boolean check() {
- boolean r = fs.length != 0;
- for (int i = 0; i < fs.length; i++) {
- r = r & fs[i].foo();
- }
- return r;
- }
-
- private boolean getBoolean() {
- return check();
- }
-
- private int getInt() {
- int r = 0;
- for (int i = 0; i < fs.length; i++) {
- r = r + fs[i].getInt();
- }
- return r;
- }
-
- private long getLong() {
- long r = 0;
- for (int i = 0; i < fs.length; i++) {
- r = r + fs[i].getLong();
- }
- return r;
- }
-
- private double getDouble() {
- double r = 0.0;
- for (int i = 0; i < fs.length; i++) {
- r = r + fs[i].getInt();
- }
- return r;
- }
-
- protected Object doNothing(Object o, String s) {
- return null;
- }
-
- // private Object getObject() {
- // boolean r = true;
- // for(int i = 0; i < fs.length; i++) {
- // r = r && ((Boolean) fs[i].getObject()).booleanValue();
- // }
- // return new Boolean(r);
- // }
-
- public Properties getProps() {
- Properties props = new Properties();
- props.put("result", new Boolean(check()));
- props.put("voidB", new Integer(simpleB));
- props.put("objectB", new Integer(objectB));
- props.put("refB", new Integer(refB));
- props.put("bothB", new Integer(bothB));
- props.put("voidU", new Integer(simpleU));
- props.put("objectU", new Integer(objectU));
- props.put("refU", new Integer(refU));
- props.put("bothU", new Integer(bothU));
- props.put("boolean", new Boolean(getBoolean()));
- props.put("int", new Integer(getInt()));
- props.put("long", new Long(getLong()));
- props.put("double", new Double(getDouble()));
-
- return props;
- }
-
- public void voidBind() {
- simpleB++;
- }
-
- public void voidUnbind() {
- simpleU++;
- }
-
- public void objectBind(FooService o) {
- if (o != null && o instanceof FooService) {
- objectB++;
- }
- }
-
- public void objectUnbind(FooService o) {
- if (o != null && o instanceof FooService) {
- objectU++;
- }
- }
-
- public void refBind(ServiceReference sr) {
- if (sr != null) {
- refB++;
- }
- }
-
- public void refUnbind(ServiceReference sr) {
- if (sr != null) {
- refU++;
- }
- }
-
- public void bothBind(FooService o, ServiceReference sr) {
- if (o != null && o instanceof FooService && sr != null) {
- bothB++;
- }
- }
-
- public void bothUnbind(FooService o, ServiceReference sr) {
- if (o != null && o instanceof FooService && sr != null) {
- bothU++;
- }
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java
deleted file mode 100644
index 8e721bfea4..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public class Parent {
-
- private String s;
-
- public Parent(String s) {
- this.s = s;
- }
-
- public String getS() {
- return s;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
deleted file mode 100644
index b8e2d62bbb..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services.A123;
-
-public interface CheckService2 {
-
- public boolean check();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
deleted file mode 100644
index 523ddf3ff6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface BarService {
-
- public boolean bar();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
deleted file mode 100644
index 7792aaa52c..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface CheckService {
-
- public static final String foo = "foo";
-
- public boolean check();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
deleted file mode 100644
index 67c6d7a2d6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface FooService {
-
- boolean foo();
-
- Properties fooProps();
-
- Boolean getObject();
-
- boolean getBoolean();
-
- int getInt();
-
- long getLong();
-
- double getDouble();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
deleted file mode 100644
index 88a147802b..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface Plop {
-
- Object getPlop();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
deleted file mode 100644
index 419962ef3f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface PrimitiveManipulationTestService {
-
- byte getByte();
- void setByte(byte b);
-
- short getShort();
- void setShort(short s);
-
- int getInt();
- void setInt(int i);
-
- long getLong();
- void setLong(long l);
-
- float getFloat();
- void setFloat(float f);
-
- double getDouble();
- void setDouble(double d);
-
- char getChar();
- void setChar(char c);
-
- boolean getBoolean();
- void setBoolean(boolean b);
-
- // Array types
- byte[] getBytes();
- void setBytes(byte[] bs);
-
- short[] getShorts();
- void setShorts(short[] ss);
-
- int[] getInts();
- void setInts(int is[]);
-
- long[] getLongs();
- void setLongs(long[] ls);
-
- float[] getFloats();
- void setFloats(float[] fs);
-
- double[] getDoubles();
- void setDoubles(double[] ds);
-
- char[] getChars();
- void setChars(char[] cs);
-
- boolean[] getBooleans();
- void setBooleans(boolean[] bs);
-
- // This method has been added to test an issue when autoboxing.
- void setLong(long l, String s);
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml
deleted file mode 100644
index 207d3148f9..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
deleted file mode 100644
index bdb314c66f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.ManifestMetadataParser;
-import org.apache.felix.ipojo.parser.ParseException;
-import org.apache.felix.ipojo.parser.ParseUtils;
-import org.apache.felix.ipojo.runtime.core.services.BarService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Assert;
-import org.junit.Test;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
-/**
- * Check manipulation metadata written in the manifest.
- */
-public class TestManipulationMetadata extends BaseTest {
-
- @Test
- public void testGetMetadata() {
- String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
- Element elem = null;
- try {
- elem = ManifestMetadataParser.parseHeaderMetadata(header);
- } catch (ParseException e) {
- fail("Parse Exception when parsing iPOJO-Component");
- }
-
- assertNotNull("Check elem not null", elem);
-
-
- Element manip = getManipulationForComponent(elem, "ManipulationMetadata-FooProviderType-1");
- assertNotNull("Check manipulation metadata not null for " + "FooProviderType-1", manip);
- }
-
- @Test
- public void testInterface() {
- String comp_name = "ManipulationMetadata-FooProviderType-1";
- Element manip = getManipulationForComponent(comp_name);
- Element[] itf = manip.getElements("Interface");
- assertEquals("Check interfaces number", itf.length, 1);
- assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName());
- }
-
- @Test
- public void testInterfaces() {
- String comp_name = "ManipulationMetadata-FooBarProviderType-1";
- Element manip = getManipulationForComponent(comp_name);
- Element[] itf = manip.getElements("Interface");
- assertEquals("Check interfaces number", itf.length, 2);
- assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName());
- assertEquals("Check itf name", itf[1].getAttribute("name"), BarService.class.getName());
- }
-
- @Test
- public void testFields() {
- String comp_name = "ManipulationMetadata-FooProviderType-Dyn";
- Element manip = getManipulationForComponent(comp_name);
- Element[] fields = manip.getElements("field");
- assertEquals("Check field count " + fields.length, fields.length, 5);
- /*
- private int intProp;
- private String strProp;
- private String[] strAProp;
- private int[] intAProp;
- private boolean boolProp;
- */
-
- Element field;
-
- field = getFieldFromName(manip, "intProp");
- assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intProp");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
-
- field = getFieldFromName(manip, "strProp");
- assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strProp");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String");
-
- field = getFieldFromName(manip, "strAProp");
- assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strAProp");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String[]");
-
- field = getFieldFromName(manip, "intAProp");
- assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intAProp");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
-
- field = getFieldFromName(manip, "boolProp");
- assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "boolProp");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
- }
-
- @Test
- public void testPrimitivesFields() {
- String comp_name = "ManipulationMetadata-PrimitiveManipulationTester";
- Element manip = getManipulationForComponent(comp_name);
- Element[] fields = manip.getElements("Field");
- assertEquals("Check field count", fields.length, 16);
- /*
- byte b = 1;
- short s = 1;
- int i = 1;
- long l = 1;
- double d = 1.1;
- float f = 1.1f;
- char c = 'a';
- boolean bool = false;
- byte[] bs = new byte[] {0,1,2};
- short[] ss = new short[] {0,1,2};
- int[] is = new int[] {0,1,2};
- long[] ls = new long[] {0,1,2};
- double[] ds = new double[] {0.0, 1.1, 2.2};
- float[] fs = new float[] {0.0f, 1.1f, 2.2f};
- char[] cs = new char[] {'a', 'b', 'c'};
- boolean[] bools = new boolean[] {false, true, false};
- */
- Element field;
-
- field = getFieldFromName(manip, "b");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte");
- field = getFieldFromName(manip, "s");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short");
- field = getFieldFromName(manip, "i");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int");
- field = getFieldFromName(manip, "l");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long");
- field = getFieldFromName(manip, "d");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double");
- field = getFieldFromName(manip, "f");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float");
- field = getFieldFromName(manip, "c");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char");
- field = getFieldFromName(manip, "bool");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean");
-
- field = getFieldFromName(manip, "bs");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte[]");
- field = getFieldFromName(manip, "ss");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short[]");
- field = getFieldFromName(manip, "is");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]");
- field = getFieldFromName(manip, "ls");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long[]");
- field = getFieldFromName(manip, "ds");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double[]");
- field = getFieldFromName(manip, "fs");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float[]");
- field = getFieldFromName(manip, "cs");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char[]");
- field = getFieldFromName(manip, "bools");
- assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean[]");
- }
-
- @Test
- public void testNoArgMethod() {
- String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
- Element manip = getManipulationForComponent(comp_name);
- Element method = getMethodFromName(manip, "check");
- assertFalse("Check no args", method.containsAttribute("arguments"));
- assertEquals("Check return", method.getAttribute("return"), "boolean");
- }
-
- @Test
- public void testOneArgsMethod() {
- String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
- Element manip = getManipulationForComponent(comp_name);
- Element method = getMethodFromName(manip, "refBind");
- assertEquals("Check args", method.getAttribute("arguments"), "{org.osgi.framework.ServiceReference}");
- assertEquals("Check args count", 1, ParseUtils.parseArrays("{org.osgi.framework.ServiceReference}").length);
- assertFalse("Check return", method.containsAttribute("return"));
- }
-
- @Test
- public void testTwoArgsMethod() {
- String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
- Element manip = getManipulationForComponent(comp_name);
- Element method = getMethodFromName(manip, "doNothing");
- assertEquals("Check args", method.getAttribute("arguments"), "{java.lang.Object,java.lang.String}");
- assertEquals("Check args count", 2, ParseUtils.parseArrays("{java.lang.Object,java.lang.String}").length);
- assertEquals("Check return", method.getAttribute("return"), "java.lang.Object");
- }
-
- @Test
- public void testInnerClasses() {
- String comp_name = "org.apache.felix.ipojo.runtime.core.components.ComponentWithInnerClasses";
- Element manipulation = getManipulationForComponent(comp_name);
- Element[] inners = manipulation.getElements("inner");
- assertEquals(inners.length, 3);
-
- Element inner = getInnerClassMetadataByName(inners, "MyInnerWithANativeMethod");
- Assert.assertNotNull(inner);
- Assert.assertNotNull(getMethodByName(inner.getElements("method"), "foo"));
-
- inner = getInnerClassMetadataByName(inners, "MyInnerClass");
- assertNotNull(inner);
- assertNotNull(getMethodByName(inner.getElements("method"), "foo"));
-
- inner = getInnerClassMetadataByName(inners, "1");
- assertNotNull(inner);
- assertNotNull(getMethodByName(inner.getElements("method"), "run"));
- }
-
- private static Element getInnerClassMetadataByName(Element[] inners, String name) {
- for (Element element : inners) {
- if (name.equals(element.getAttribute("name"))) {
- return element;
- }
- }
- return null;
- }
-
- private static Element getMethodByName(Element[] methods, String name) {
- for (Element element : methods) {
- if (name.equals(element.getAttribute("name"))) {
- return element;
- }
- }
- return null;
- }
-
-
- private Element getManipulationForComponent(Element metadata, String comp_name) {
- Element[] comps = metadata.getElements("component");
- for (Element comp : comps) {
- if (comp.containsAttribute("factory") && comp.getAttribute("factory").equals(comp_name)) {
- return comp.getElements("manipulation")[0];
- }
- if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) {
- return comp.getElements("manipulation")[0];
- }
- }
- return null;
- }
-
- private Element getManipulationForComponent(String comp_name) {
- String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
- Element elem = null;
- try {
- elem = ManifestMetadataParser.parseHeaderMetadata(header);
- } catch (ParseException e) {
- fail("Parse Exception when parsing iPOJO-Component");
- }
-
- assertNotNull("Check elem not null", elem);
- Element manip = getManipulationForComponent(elem, comp_name);
- assertNotNull("Check manipulation metadata not null for " + comp_name, manip);
- return manip;
- }
-
- private Element getMethodFromName(Element manip, String name) {
- Element methods[] = manip.getElements("Method");
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].containsAttribute("name") && methods[i].getAttribute("name").equals(name)) {
- return methods[i];
- }
- }
- fail("Method " + name + " not found");
- return null;
- }
-
- private Element getFieldFromName(Element manip, String name) {
- Element fields[] = manip.getElements("Field");
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].containsAttribute("name") && fields[i].getAttribute("name").equals(name)) {
- return fields[i];
- }
- }
- fail("Field " + name + " not found");
- return null;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java
deleted file mode 100644
index 21f3957220..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.metadata.Element;
-import org.apache.felix.ipojo.parser.*;
-import org.apache.felix.ipojo.runtime.core.services.BarService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Before;
-import org.junit.Test;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static org.junit.Assert.*;
-
-public class TestManipulationMetadataAPI extends BaseTest {
-
- PojoMetadata FooProviderType1, FooBarProviderType1, FooProviderTypeDyn, PrimitiveManipulationTester, SimpleMultipleCheckServiceProvider;
-
- @Before
- public void setUp() {
- String comp_name = "ManipulationMetadata-FooProviderType-1";
- FooProviderType1 = getManipulationMetadataForComponent(comp_name);
-
- comp_name = "ManipulationMetadata-FooBarProviderType-1";
- FooBarProviderType1 = getManipulationMetadataForComponent(comp_name);
-
- comp_name = "ManipulationMetadata-FooProviderType-Dyn";
- FooProviderTypeDyn = getManipulationMetadataForComponent(comp_name);
-
- comp_name = "ManipulationMetadata-PrimitiveManipulationTester";
- PrimitiveManipulationTester = getManipulationMetadataForComponent(comp_name);
-
- comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider";
- SimpleMultipleCheckServiceProvider = getManipulationMetadataForComponent(comp_name);
- }
-
- @Test
- public void testGetMetadata() {
- String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
- Element elem = null;
- try {
- elem = ManifestMetadataParser.parseHeaderMetadata(header);
- } catch (ParseException e) {
- fail("Parse Exception when parsing iPOJO-Component");
- }
-
- assertNotNull("Check elem not null", elem);
-
- Element manip = getMetadataForComponent(elem, "ManipulationMetadata-FooProviderType-1");
- assertNotNull("Check manipulation metadata not null for " + "Manipulation-FooProviderType-1", manip);
- PojoMetadata mm;
- try {
- mm = new PojoMetadata(manip);
- assertNotNull("Check mm not null", mm);
- } catch (ConfigurationException e) {
- fail("The creation of pojo metadata has failed");
- }
- }
-
- @Test
- public void testInterface() {
- PojoMetadata manip = FooProviderType1;
-
- String[] itf = manip.getInterfaces();
- assertEquals("Check interfaces number", itf.length, 1);
- assertEquals("Check itf name", itf[0], FooService.class.getName());
-
- assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented(FooService.class.getName()));
- assertFalse("Check Bar Service implementation", manip.isInterfaceImplemented(BarService.class.getName()));
- }
-
- @Test
- public void testInterfaces() {
- PojoMetadata manip = FooBarProviderType1;
- String[] itf = manip.getInterfaces();
- assertEquals("Check interfaces number", itf.length, 2);
- assertEquals("Check itf name", itf[0], FooService.class.getName());
- assertEquals("Check itf name", itf[1], BarService.class.getName());
-
- assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented(FooService.class.getName()));
- assertTrue("Check Bar Service implementation", manip.isInterfaceImplemented(BarService.class.getName()));
- }
-
-// @Test
-// public void testInnerClasses() {
-// String comp_name = "org.apache.felix.ipojo.runtime.core.components.ComponentWithInnerClasses";
-// PojoMetadata metadata = getManipulationMetadataForComponent(comp_name);
-// assertEquals(metadata.getInnerClasses().length, 3);
-// assertNotNull(metadata.getMethodsFromInnerClass("MyInnerWithANativeMethod"));
-// assertNotNull(
-// getMethodMetadata(metadata.getMethodsFromInnerClass("MyInnerWithANativeMethod"),
-// "foo"));
-//
-// assertNotNull(
-// getMethodMetadata(metadata.getMethodsFromInnerClass("MyInnerClass"),
-// "foo"));
-//
-// assertNotNull(
-// getMethodMetadata(metadata.getMethodsFromInnerClass("1"),
-// "run"));
-// }
-
- public static MethodMetadata getMethodMetadata(MethodMetadata[] methods, String name) {
- for (MethodMetadata m : methods) {
- if (m.getMethodName().equals(name)) {
- return m;
- }
- }
- return null;
- }
-
- @Test
- public void testFields() {
- PojoMetadata manip = FooProviderTypeDyn;
-
- FieldMetadata[] fields = manip.getFields();
- assertEquals("Check field count + " + fields.length, fields.length, 5);
- /*
- private int intProp;
- private String strProp;
- private String[] strAProp;
- private int[] intAProp;
- private boolean boolProp;
- */
-
- FieldMetadata field;
-
- field = manip.getField("intProp");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
- assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "int");
-
- field = manip.getField("intProp", "int");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
-
- field = manip.getField("intProp", "long");
- assertNull("Check bad field", field);
-
- field = manip.getField("strProp");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
- assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "java.lang.String");
-
- field = manip.getField("strProp", "String");
- assertNull("Check bad field", field);
-
- field = manip.getField("strProp", "java.lang.String");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String");
-
- field = manip.getField("strAProp");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
- assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[Ljava.lang.String;");
-
- field = manip.getField("strAProp", "java.lang.String[]");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]");
-
- field = manip.getField("strAProp", "String[]");
- assertNull("Check bad field", field);
-
- field = manip.getField("intAProp");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
- assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[I");
-
- field = manip.getField("intAProp", "int[]");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
-
- field = manip.getField("intAProp", "String[]");
- assertNull("Check bad field", field);
-
- field = manip.getField("boolProp");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
- assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "boolean");
-
- field = manip.getField("boolProp", "boolean");
- assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
-
- field = manip.getField("boolProp", "bool");
- assertNull("Check bad field", field);
- }
-
- @Test
- public void testPrimitivesFields() {
- PojoMetadata manip = PrimitiveManipulationTester;
- FieldMetadata[] fields = manip.getFields();
- assertEquals("Check field count", fields.length, 16);
-
- FieldMetadata field;
-
- field = manip.getField("b");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte");
- field = manip.getField("s");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short");
- field = manip.getField("i");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int");
- field = manip.getField("l");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long");
- field = manip.getField("d");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double");
- field = manip.getField("f");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float");
- field = manip.getField("c");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char");
- field = manip.getField("bool");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean");
-
- field = manip.getField("bs");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte[]");
- field = manip.getField("ss");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short[]");
- field = manip.getField("is");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]");
- field = manip.getField("ls");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long[]");
- field = manip.getField("ds");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double[]");
- field = manip.getField("fs");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float[]");
- field = manip.getField("cs");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char[]");
- field = manip.getField("bools");
- assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean[]");
- }
-
- @Test
- public void testNoArgMethod() {
- PojoMetadata manip = SimpleMultipleCheckServiceProvider;
- MethodMetadata method = manip.getMethod("check");
- assertEquals("Check no args", method.getMethodArguments().length, 0);
- assertEquals("Check return", method.getMethodReturn(), "boolean");
-
- method = manip.getMethod("check", new String[0]);
- assertEquals("Check no args", method.getMethodArguments().length, 0);
- assertEquals("Check return", method.getMethodReturn(), "boolean");
- }
-
- @Test
- public void testOneArgsMethod() {
- PojoMetadata manip = SimpleMultipleCheckServiceProvider;
- MethodMetadata method = manip.getMethods("refBind")[0];
- assertEquals("Check args count", method.getMethodArguments().length, 1);
- assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference");
- assertEquals("Check return", method.getMethodReturn(), "void");
-
- method = manip.getMethod("refBind", new String[]{"org.osgi.framework.ServiceReference"});
- assertEquals("Check args count", method.getMethodArguments().length, 1);
- assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference");
- assertEquals("Check return", method.getMethodReturn(), "void");
- }
-
- @Test
- public void testTwoArgsMethod() {
- PojoMetadata manip = SimpleMultipleCheckServiceProvider;
- MethodMetadata method = manip.getMethods("doNothing")[0];
- assertEquals("Check args count", 2, method.getMethodArguments().length);
- assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object");
- assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String");
- assertEquals("Check return", method.getMethodReturn(), "java.lang.Object");
-
- method = manip.getMethod("doNothing", new String[]{"java.lang.Object", "java.lang.String"});
- assertEquals("Check args count", 2, method.getMethodArguments().length);
- assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object");
- assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String");
- assertEquals("Check return", method.getMethodReturn(), "java.lang.Object");
- }
-
- private Element getMetadataForComponent(Element metadata, String comp_name) {
- Element[] comps = metadata.getElements("component");
- for (int i = 0; i < comps.length; i++) {
- if (comps[i].containsAttribute("factory") && comps[i].getAttribute("factory").equals(comp_name)) {
- return comps[i];
- }
- if (comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) {
- return comps[i];
- }
- }
- return null;
- }
-
- private PojoMetadata getManipulationMetadataForComponent(String comp_name) {
- String header = (String) getTestBundle().getHeaders().get("iPOJO-Components");
- Element elem = null;
- try {
- elem = ManifestMetadataParser.parseHeaderMetadata(header);
- } catch (ParseException e) {
- fail("Parse Exception when parsing iPOJO-Component");
- }
-
- assertNotNull("Check elem not null", elem);
-
- Element manip = getMetadataForComponent(elem, comp_name);
- assertNotNull("Check manipulation metadata not null for " + comp_name, manip);
- try {
- return new PojoMetadata(manip);
- } catch (ConfigurationException e) {
- fail("The creation of pojo metadata for " + comp_name + " has failed");
- return null;
- }
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml
deleted file mode 100644
index 2745607012..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator.manipulator-it
- 1.13.1-SNAPSHOT
-
-
- 4.0.0
-
- ipojo-manipulator-manipulation-test
-
- Apache Felix iPOJO Manipulator ~ Manipulation IT
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java
deleted file mode 100644
index 86e52b7bea..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.runtime.core.components.A123;
-
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-
-
-public class Manipulation23Tester implements PrimitiveManipulationTestService {
-
-
- // Integer types
- byte b = 1;
- short s = 1;
- int i = 1;
- long l = 1;
-
- // Floatting types
- double d = 1.1;
- float f = 1.1f;
-
- // Character
- char c = 'a';
-
- // Boolean
- boolean bool = false;
-
- // Integer arrays
- byte[] bs = new byte[]{0, 1, 2};
- short[] ss = new short[]{0, 1, 2};
- int[] is = new int[]{0, 1, 2};
- long[] ls = new long[]{0, 1, 2};
-
- double[] ds = new double[]{0.0, 1.1, 2.2};
- float[] fs = new float[]{0.0f, 1.1f, 2.2f};
-
- char[] cs = new char[]{'a', 'b', 'c'};
-
- boolean[] bools = new boolean[]{false, true, false};
-
- public boolean getBoolean() {
- return bool;
- }
-
- public boolean[] getBooleans() {
- return bools;
- }
-
- public byte getByte() {
- return b;
- }
-
- public byte[] getBytes() {
- return bs;
- }
-
- public char getChar() {
- return c;
- }
-
- public char[] getChars() {
- return cs;
- }
-
- public double getDouble() {
- return d;
- }
-
- public double[] getDoubles() {
- return ds;
- }
-
- public float getFloat() {
- return f;
- }
-
- public float[] getFloats() {
- return fs;
- }
-
- public int getInt() {
- return i;
- }
-
- public int[] getInts() {
- return is;
- }
-
- public long getLong() {
- return l;
- }
-
- public long[] getLongs() {
- return ls;
- }
-
- public short getShort() {
- return s;
- }
-
- public short[] getShorts() {
- return ss;
- }
-
- public void setBoolean(boolean b) {
- this.bool = b;
- }
-
- public void setBooleans(boolean[] bs) {
- this.bools = bs;
- }
-
- public void setByte(byte b) {
- this.b = b;
- }
-
- public void setBytes(byte[] bs) {
- this.bs = bs;
- }
-
- public void setChar(char c) {
- this.c = c;
- }
-
- public void setChars(char[] cs) {
- this.cs = cs;
- }
-
- public void setDouble(double d) {
- this.d = d;
- }
-
- public void setDoubles(double[] ds) {
- this.ds = ds;
- }
-
- public void setFloat(float f) {
- this.f = f;
- }
-
- public void setFloats(float[] fs) {
- this.fs = fs;
- }
-
- public void setInt(int i) {
- this.i = i;
- }
-
- public void setInts(int[] is) {
- this.is = is;
- }
-
- public void setLong(long l) {
- this.l = l;
- }
-
- public void setLongs(long[] ls) {
- this.ls = ls;
- }
-
- public void setShort(short s) {
- this.s = s;
- }
-
- public void setShorts(short[] ss) {
- this.ss = ss;
- }
-
- public void setLong(long l, String s) {
- this.l = l;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java
deleted file mode 100644
index e31d52d26d..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-public class Annotation {
-
- @Marker(name = "marker", type = Marker.Type.BAR,
- sub = @SubMarker(subname = "foo"),
- arrayOfObjects = {"foo", "bar", "baz"},
- arrayOfAnnotations = {@SubMarker(subname = "foo")}
- )
- @SubMarker(subname = "bar")
- @Invisible
- public void doSomething() {
- System.out.println("Foo ...");
- }
-
- @Marker(name = "marker", type = Marker.Type.BAR,
- sub = @SubMarker(subname = "foo"),
- arrayOfObjects = {"foo", "bar", "baz"},
- arrayOfAnnotations = {@SubMarker(subname = "foo")}
- )
- @SubMarker(subname = "bar")
- @Invisible
- public Annotation() {
-
- }
-
- public void doSomethingWithParams(@Marker(name = "marker", type = Marker.Type.BAR,
- sub = @SubMarker(subname = "foo"),
- arrayOfObjects = {"foo", "bar", "baz"},
- arrayOfAnnotations = {@SubMarker(subname = "foo")}) String foo,
- @Invisible String bar,
- @bla @SubMarker(subname = "baz") String baz) {
- System.out.println("Foo ...");
- }
-
- @Retention(RetentionPolicy.RUNTIME)
- @interface bla {
-
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
deleted file mode 100644
index 87b7304eb6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.osgi.framework.BundleContext;
-
-import java.util.Properties;
-
-public class FooProviderType1 implements FooService {
-
- private int m_bar;
- private String m_foo;
-
- private BundleContext m_context;
-
- private static FooProviderType1 singleton;
- private static int count = 0;
-
- private static FooProviderType1 singleton(BundleContext bc) {
- if (singleton == null) {
- count++;
- singleton = new FooProviderType1(bc);
- }
- return singleton;
- }
-
- public static FooProviderType1 several(BundleContext bc) {
- count++;
- return new FooProviderType1(bc);
- }
-
- public FooProviderType1(BundleContext bc) {
- if (bc == null) {
- throw new RuntimeException("Injected bundle context null");
- }
- m_context = bc;
- }
-
- public boolean foo() {
- return true;
- }
-
- public Properties fooProps() {
- Properties p = new Properties();
- p.put("bar", new Integer(m_bar));
- if (m_foo != null) {
- p.put("foo", m_foo);
- }
- p.put("context", m_context);
-
- p.put("count", new Integer(count));
- return p;
- }
-
- public void testException() throws Exception {
- String a = "foobarbaz";
- throw new Exception("foo" + a);
- }
-
- public void testTry() {
- String a = "foo";
- a.charAt(0);
- }
-
- public void testTry2(String s) {
- String a = "foo";
- a.charAt(0);
- }
-
- private void nexttry(String s) {
- try {
- s += "foo";
- } catch (RuntimeException e) {
-
- }
- }
-
- public boolean getBoolean() {
- return true;
- }
-
- public double getDouble() {
- return 1.0;
- }
-
- public int getInt() {
- return 1;
- }
-
- public long getLong() {
- return 1;
- }
-
- public Boolean getObject() {
- return new Boolean(true);
- }
-
- /**
- * Custom constructor.
- *
- * @param bar
- * @param foo
- * @param bc
- */
- public FooProviderType1(int bar, String foo, BundleContext bc) {
- m_bar = bar;
- m_foo = foo;
- m_context = bc;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java
deleted file mode 100644
index b3ae226769..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-
-import java.util.Properties;
-
-public class FooServiceImpl implements FooService {
-
- public boolean foo() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public Properties fooProps() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean getBoolean() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public double getDouble() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public int getInt() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public long getLong() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- public Boolean getObject() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java
deleted file mode 100644
index 85e7c7b8cc..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.runtime.core.handlers.Foo;
-import org.apache.felix.ipojo.runtime.core.handlers.IgnoredFoo;
-import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService;
-
-/**
- * User: guillaume
- * Date: 24/07/13
- * Time: 12:31
- */
-@Component
-@Provides
-@Instantiate
-public class HandlerBindingTestComponent implements HandlerBindingTestService {
-
- @Foo("Bonjour")
- private String greeting;
-
- @Foo("Welcome")
- private String welcome;
-
- @IgnoredFoo("Ignored")
- private String ignored;
-
- @Override
- public String get(final String name) {
- if ("greeting".equals(name)) {
- return greeting;
- }
- if ("welcome".equals(name)) {
- return welcome;
- }
- if ("ignored".equals(name)) {
- return ignored;
- }
- throw new IllegalArgumentException(name + " is not valid");
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java
deleted file mode 100644
index 23ad270191..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.annotations.Stereotype;
-
-/**
- * User: guillaume
- * Date: 03/06/13
- * Time: 11:55
- */
-@Component
-@Instantiate
-@Provides
-@Stereotype
-@Target(ElementType.TYPE)
-public @interface ImmediateComponent {}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java
deleted file mode 100644
index e98f457112..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.apache.felix.ipojo.runtime.core.services.Job;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Callable;
-
-public class InnerClasses implements CheckService {
-
- private String privateObject;
- private int privateInt;
-
- protected String protectedObject;
- protected int protectedInt;
-
- String packageObject;
- int packageInt;
-
- public String publicObject;
- public int publicInt;
-
- private String nonObject = "not-managed";
- private int nonInt = 5;
-
- private static int staticint = 6;
-
- /**
- * A fake service.
- */
- private Runnable runnable;
-
- public boolean check() {
- return true;
- }
-
- private static final Callable callable = new Callable() {
- public Integer call() {
- return 1;
- }
- };
-
- public Properties getProps() {
- Properties props = new Properties();
- props.put("publicInner", new PublicNested().doSomething());
- props.put("packageInner", new PackageNested().doSomething());
- props.put("protectedInner", new ProtectedNested().doSomething());
- props.put("privateInner", new PrivateNested().doSomething());
- props.put("constructorInner", new ConstructorNested().doSomething());
- props.put("staticInner", new StaticNested().doSomething());
- props.put("packageStaticInner", new PackageStaticNested().doSomething());
- try {
- props.put("call", callable.call());
- } catch (Exception e) {
- // Ignore.
- }
-
- Job anonymous = new Job() {
- public Map doSomething() {
- Map map = new HashMap();
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- return map;
- }
- };
-
- props.put("anonymous", anonymous.doSomething());
- props.put("public", new PublicNested());
-
-
- return props;
- }
-
- private class PrivateNested implements Job {
- public Map doSomething() {
- Map map = new HashMap();
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- return map;
- }
- }
-
- public class PublicNested implements Job {
- public Map doSomething() {
- Map map = new HashMap();
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- return map;
- }
- }
-
- class PackageNested implements Job {
- public Map doSomething() {
- Map map = new HashMap();
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- return map;
- }
- }
-
- protected class ProtectedNested implements Job {
- public Map doSomething() {
- Map map = new HashMap();
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- return map;
- }
- }
-
- protected static class StaticNested implements Job {
- private Map map = new HashMap();
-
- public Map doSomething() {
- map.put("static", new Boolean(true));
- map.put("staticint", new Integer(staticint));
- return map;
- }
- }
-
- static class PackageStaticNested implements Job {
- private Map map = new HashMap();
-
- public Map doSomething() {
- map.put("static", new Boolean(true));
- map.put("staticint", new Integer(staticint));
- return map;
- }
- }
-
- protected class ConstructorNested implements Job {
- Map map = new HashMap();
- public ConstructorNested() {
- map.put("publicObject", publicObject);
- map.put("publicInt", new Integer(publicInt));
- map.put("packageObject", packageObject);
- map.put("packageInt", new Integer(packageInt));
- map.put("protectedObject", protectedObject);
- map.put("protectedInt", new Integer(protectedInt));
- map.put("privateObject", privateObject);
- map.put("privateInt", new Integer(privateInt));
- map.put("nonObject", nonObject);
- map.put("nonInt", new Integer(nonInt));
- }
-
- public Map doSomething() {
- return map;
- }
- }
-
-
-}
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java
deleted file mode 100644
index ca9808dd39..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-public @interface Invisible {
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java
deleted file mode 100644
index abaf536ac7..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-
-
-public class Manipulation23Tester implements PrimitiveManipulationTestService {
-
- // Integer types
- byte b = 1;
- short s = 1;
- int i = 1;
- long l = 1;
-
- // Floatting types
- double d = 1.1;
- float f = 1.1f;
-
- // Character
- char c = 'a';
-
- // Boolean
- boolean bool = false;
-
- // Integer arrays
- byte[] bs = new byte[] {0,1,2};
- short[] ss = new short[] {0,1,2};
- int[] is = new int[] {0,1,2};
- long[] ls = new long[] {0,1,2};
-
- double[] ds = new double[] {0.0, 1.1, 2.2};
- float[] fs = new float[] {0.0f, 1.1f, 2.2f};
-
- char[] cs = new char[] {'a', 'b', 'c'};
-
- boolean[] bools = new boolean[] {false, true, false};
-
- public boolean getBoolean() { return bool; }
-
- public boolean[] getBooleans() { return bools; }
-
- public byte getByte() { return b; }
-
- public byte[] getBytes() { return bs; }
-
- public char getChar() { return c; }
-
- public char[] getChars() { return cs; }
-
- public double getDouble() { return d; }
-
- public double[] getDoubles() { return ds; }
-
- public float getFloat() { return f; }
-
- public float[] getFloats() { return fs; }
-
- public int getInt() { return i; }
-
- public int[] getInts() { return is; }
-
- public long getLong() { return l; }
-
- public long[] getLongs() { return ls; }
-
- public short getShort() { return s; }
-
- public short[] getShorts() { return ss; }
-
- public void setBoolean(boolean b) { this.bool = b; }
-
- public void setBooleans(boolean[] bs) { this.bools = bs; }
-
- public void setByte(byte b) { this.b = b; }
-
- public void setBytes(byte[] bs) { this.bs = bs; }
-
- public void setChar(char c) { this.c = c; }
-
- public void setChars(char[] cs) { this.cs = cs; }
-
- public void setDouble(double d) { this.d = d; }
-
- public void setDoubles(double[] ds) { this.ds = ds; }
-
- public void setFloat(float f) { this.f = f; }
-
- public void setFloats(float[] fs) { this.fs = fs; }
-
- public void setInt(int i) { this.i = i; }
-
- public void setInts(int[] is) { this.is = is; }
-
- public void setLong(long l) { this.l = l; }
-
- public void setLongs(long[] ls) { this.ls = ls; }
-
- public void setShort(short s) { this.s = s; }
-
- public void setShorts(short[] ss) {
- this.ss = new short[ss.length];
- for (int i = 0; i < ss.length; i++) {
- this.ss[i] = ss[i];
- }
- }
-
- // This method has been added to test an issue when autoboxing.
- public void setLong(long l, String s) {
- this.l = l;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java
deleted file mode 100644
index c5f6e31247..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Marker {
-
- String name();
-
- String[] arrayOfObjects();
-
- SubMarker sub();
-
- SubMarker[] arrayOfAnnotations();
-
- Type type();
-
- public enum Type {FOO, BAR, BAZ};
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java
deleted file mode 100644
index c28d716135..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.Bind;
-import org.apache.felix.ipojo.annotations.Stereotype;
-
-/**
- * User: guillaume
- * Date: 03/06/13
- * Time: 16:09
- */
-@Bind(
- aggregate = true,
- optional = false
-)
-@Stereotype
-@Target(ElementType.METHOD)
-public @interface MultiBind {}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java
deleted file mode 100644
index 32e9629820..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.Plop;
-
-//TODO this test requires source compatibility 1.5
-public class PlopImpl implements Plop {
-
- public String getPlop() {
- return "plop";
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java
deleted file mode 100644
index 83fd0cd901..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.BazService;
-
-/**
- * User: guillaume
- * Date: 03/06/13
- * Time: 12:22
- */
-@ImmediateComponent
-public class StereotypedBazComponent implements BazService {
- @Override
- public String hello(final String name) {
- return "Hello " + name;
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java
deleted file mode 100644
index 650d63bc6a..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.architecture.Architecture;
-
-/**
- * User: guillaume
- * Date: 03/06/13
- * Time: 12:22
- */
-@Component
-public class StereotypedMultiBind {
-
- @MultiBind
- public void bindArchitecture(Architecture service) {
-
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java
deleted file mode 100644
index 89787f30b3..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-@Retention(RetentionPolicy.RUNTIME)
-public @interface SubMarker {
-
- String subname();
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java
deleted file mode 100644
index a0787e5214..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.apache.felix.ipojo.runtime.core.services.Color;
-
-import java.util.Properties;
-
-/**
- * A component checking switch construct with integer and enumeration.
- */
-public class Switches implements CheckService {
-
- private static enum Stuff {
- FOO,
- BAR
- }
-
- private String switchOnInteger(int i) {
- switch (i) {
- case 0:
- return "0";
- case 1:
- return "1";
- case 2:
- return "2";
- default:
- return "3";
- }
- }
-
- private String switchOnEnum(Color color) {
- switch (color) {
- case RED:
- return "RED";
- case GREEN:
- return "GREEN";
- case BLUE:
- return "BLUE";
- default:
- return "COLOR";
- }
- }
-
- private String switchOnStuff(Stuff stuff) {
- switch (stuff) {
- case FOO : return "foo";
- case BAR : return "bar";
- default: return "";
- }
- }
-
- @Override
- public boolean check() {
- return true;
- }
-
- @Override
- public Properties getProps() {
- Properties properties = new Properties();
- properties.put("switchOnInteger1", switchOnInteger(1));
- properties.put("switchOnInteger4", switchOnInteger(4));
-
- properties.put("switchOnEnumRed", switchOnEnum(Color.RED));
-
- properties.put("switchOnStuffFoo", switchOnStuff(Stuff.FOO));
-
- return properties;
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java
deleted file mode 100644
index ad27a985af..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.runtime.core.components;
-
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-
-import java.util.List;
-import java.util.Properties;
-
-public class TestTypedList implements CheckService {
-
- private List list;
-
- public boolean check() {
- return !list.isEmpty();
- }
-
- public Properties getProps() {
- Properties props = new Properties();
- if (list != null) {
- props.put("list", list);
-
- int i = 0;
- for (FooService fs : list) {
- props.put(i, fs.foo());
- i++;
- }
- }
-
- return props;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java
deleted file mode 100644
index 3971ac20f8..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.runtime.core.components.nativ;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.runtime.core.services.BazService;
-
-/**
- * Component using a native method.
- */
-@Component
-@Provides
-public class NativeComponent implements BazService {
-
- static {
- System.loadLibrary("foo");
- }
-
- /**
- * Provided by the native library.
- * @return foo: Test program of JNI.
- */
- public native String nativeFoo();
-
- @Override
- public String hello(String name) {
- return nativeFoo();
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java
deleted file mode 100644
index 79e93d7a31..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.runtime.core.handlers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.HandlerBinding;
-
-/**
- * User: guillaume
- * Date: 24/07/13
- * Time: 12:10
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.CLASS)
-@HandlerBinding("com.acme:foo")
-public @interface Foo {
- String value();
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java
deleted file mode 100644
index cc86c67fe9..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.runtime.core.handlers;
-
-import java.util.Dictionary;
-
-import org.apache.felix.ipojo.ConfigurationException;
-import org.apache.felix.ipojo.FieldInterceptor;
-import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.annotations.Handler;
-import org.apache.felix.ipojo.metadata.Element;
-
-/**
- * User: guillaume
- * Date: 24/07/13
- * Time: 12:08
- */
-@Handler(namespace = "com.acme", name = "foo")
-public class FooHandler extends PrimitiveHandler {
-
- @Override
- public void configure(final Element metadata, final Dictionary configuration) throws ConfigurationException {
- Element[] elements = metadata.getElements("foo", "com.acme");
- for (Element foo : elements) {
- String value = foo.getAttribute("value");
- String field = foo.getAttribute("field");
-
- this.getInstanceManager().register(getPojoMetadata().getField(field, "java.lang.String"),
- new FixedValueFieldInterceptor(value));
-
- }
-
- }
-
- @Override
- public Object onGet(final Object pojo, final String fieldName, final Object value) {
- return value;
- }
-
- @Override
- public void stop() {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- @Override
- public void start() {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- private static class FixedValueFieldInterceptor implements FieldInterceptor {
- private final String m_value;
-
- public FixedValueFieldInterceptor(final String value) {
- m_value = value;
- }
-
- @Override
- public void onSet(final Object pojo, final String fieldName, final Object value) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- @Override
- public Object onGet(final Object pojo, final String fieldName, final Object value) {
- return m_value;
- }
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java
deleted file mode 100644
index ccbff86ed0..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.handlers;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.HandlerBinding;
-import org.apache.felix.ipojo.annotations.Ignore;
-
-/**
- * User: guillaume
- * Date: 24/07/13
- * Time: 12:10
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.CLASS)
-@Ignore
-public @interface IgnoredFoo {
- String value();
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
deleted file mode 100644
index b8e2d62bbb..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services.A123;
-
-public interface CheckService2 {
-
- public boolean check();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
deleted file mode 100644
index 523ddf3ff6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface BarService {
-
- public boolean bar();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java
deleted file mode 100644
index f2d7c6e730..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-/**
- * User: guillaume
- * Date: 03/06/13
- * Time: 12:23
- */
-public interface BazService {
- String hello(String name);
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
deleted file mode 100644
index 7792aaa52c..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface CheckService {
-
- public static final String foo = "foo";
-
- public boolean check();
-
- public Properties getProps();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java
deleted file mode 100644
index 086b365b91..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-/**
- * An enumeration.
- */
-public enum Color {
-
- RED,
- GREEN,
- BLUE
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
deleted file mode 100644
index 67c6d7a2d6..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Properties;
-
-public interface FooService {
-
- boolean foo();
-
- Properties fooProps();
-
- Boolean getObject();
-
- boolean getBoolean();
-
- int getInt();
-
- long getLong();
-
- double getDouble();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java
deleted file mode 100644
index 120d60b400..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-/**
- * User: guillaume
- * Date: 24/07/13
- * Time: 12:36
- */
-public interface HandlerBindingTestService {
- String get(String name);
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java
deleted file mode 100644
index fdc4b744f8..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-import java.util.Map;
-
-/**
- *
- */
-public interface Job {
- public Map doSomething();
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
deleted file mode 100644
index 88a147802b..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface Plop {
-
- Object getPlop();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
deleted file mode 100644
index 419962ef3f..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.runtime.core.services;
-
-public interface PrimitiveManipulationTestService {
-
- byte getByte();
- void setByte(byte b);
-
- short getShort();
- void setShort(short s);
-
- int getInt();
- void setInt(int i);
-
- long getLong();
- void setLong(long l);
-
- float getFloat();
- void setFloat(float f);
-
- double getDouble();
- void setDouble(double d);
-
- char getChar();
- void setChar(char c);
-
- boolean getBoolean();
- void setBoolean(boolean b);
-
- // Array types
- byte[] getBytes();
- void setBytes(byte[] bs);
-
- short[] getShorts();
- void setShorts(short[] ss);
-
- int[] getInts();
- void setInts(int is[]);
-
- long[] getLongs();
- void setLongs(long[] ls);
-
- float[] getFloats();
- void setFloats(float[] fs);
-
- double[] getDoubles();
- void setDoubles(double[] ds);
-
- char[] getChars();
- void setChars(char[] cs);
-
- boolean[] getBooleans();
- void setBooleans(boolean[] bs);
-
- // This method has been added to test an issue when autoboxing.
- void setLong(long l, String s);
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so
deleted file mode 100644
index e574158167..0000000000
Binary files a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so and /dev/null differ
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so
deleted file mode 100644
index df86ae3262..0000000000
Binary files a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so and /dev/null differ
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib
deleted file mode 100755
index 6c1e780cb8..0000000000
Binary files a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib and /dev/null differ
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml
deleted file mode 100644
index bcb40e18ac..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml
deleted file mode 100644
index 305a55bb77..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml
deleted file mode 100644
index 3144b886d3..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java
deleted file mode 100644
index df3b085ebd..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.runtime.core.components.Marker;
-import org.apache.felix.ipojo.runtime.core.components.SubMarker;
-import org.junit.Before;
-import org.junit.Test;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-public class TestAnnotationProcessing extends BaseTest {
-
- private Class clazz;
-
- @Before
- public void setUp() {
- try {
- clazz = bc.getBundle().
- loadClass("org.apache.felix.ipojo.runtime.core.components.Annotation");
- } catch (ClassNotFoundException e) {
- fail("Cannot load the annotation class : " + e.getMessage());
- }
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
- @Test
- public void testAnnotationOnMethod() {
- Method method = null;
- try {
- method = this.clazz.getMethod("doSomething", new Class[0]);
- } catch (Exception e) {
- fail("Cannot find the doSomething method : " + e.getMessage());
- }
- assertNotNull("Check method existence", method);
-
- java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations();
- assertNotNull("Check annotations size - 1", annotations);
- assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible
-
- /*
- @Marker(name="marker", type=Type.BAR,
- sub=@SubMarker(subname="foo"),
- arrayOfObjects={"foo", "bar", "baz"},
- arrayOfAnnotations= {@SubMarker(subname="foo")}
- )
- @SubMarker(subname="bar")
- @Invisible
- */
-
- Marker marker = getMarkerAnnotation(annotations);
- assertNotNull("Check marker", marker);
-
- assertEquals("Check marker name", "marker", marker.name());
- assertEquals("Check marker type", Marker.Type.BAR, marker.type());
- assertEquals("Check sub marker attribute", "foo", marker.sub().subname());
- assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]);
- assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]);
- assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]);
- assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname());
-
- SubMarker sub = getSubMarkerAnnotation(annotations);
- assertNotNull("Check submarker", sub);
- assertEquals("Check submarker", "bar", sub.subname());
-
- }
-
- @Test
- public void testAnnotationOnConstructor() {
- Constructor method = null;
- try {
- method = clazz.getConstructor(new Class[0]);
- } catch (Exception e) {
- fail("Cannot find the constructor method : " + e.getMessage());
- }
- assertNotNull("Check method existence", method);
-
- java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations();
- assertNotNull("Check annotations size - 1", annotations);
- assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible
-
- /*
- @Marker(name="marker", type=Type.BAR,
- sub=@SubMarker(subname="foo"),
- arrayOfObjects={"foo", "bar", "baz"},
- arrayOfAnnotations= {@SubMarker(subname="foo")}
- )
- @SubMarker(subname="bar")
- @Invisible
- */
-
- Marker marker = getMarkerAnnotation(annotations);
- assertNotNull("Check marker", marker);
-
- assertEquals("Check marker name", "marker", marker.name());
- assertEquals("Check marker type", Marker.Type.BAR, marker.type());
- assertEquals("Check sub marker attribute", "foo", marker.sub().subname());
- assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]);
- assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]);
- assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]);
- assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname());
-
- SubMarker sub = getSubMarkerAnnotation(annotations);
- assertNotNull("Check submarker", sub);
- assertEquals("Check submarker", "bar", sub.subname());
- }
-
- @Test
- public void testParameterAnnotations() {
- Method method = null;
- try {
- method = this.clazz.getMethod("doSomethingWithParams", new Class[]{String.class, String.class, String.class});
- } catch (Exception e) {
- fail("Cannot find the doSomethingWithParams method : " + e.getMessage());
- }
- assertNotNull("Check method existence", method);
-
- java.lang.annotation.Annotation[][] annotations = method.getParameterAnnotations();
- assertNotNull("Check annotations size - 1", annotations);
- assertEquals("Check annotations size - 3", 3, annotations.length);
-
- // Check internals
- // First parameter (foo)
- java.lang.annotation.Annotation[] fooAnns = annotations[0];
- assertEquals("Check fooAnns length", 1, fooAnns.length);
- Marker marker = (Marker) fooAnns[0];
- assertNotNull("Check marker", marker);
- assertEquals("Check marker name", "marker", marker.name());
- assertEquals("Check marker type", Marker.Type.BAR, marker.type());
- assertEquals("Check sub marker attribute", "foo", marker.sub().subname());
- assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]);
- assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]);
- assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]);
- assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname());
-
- // Second parameter (bar), no annotation (invisible)
- java.lang.annotation.Annotation[] barAnns = annotations[1];
- assertEquals("Check barAnns length", 0, barAnns.length);
-
- // Third parameter (baz), two annotations
- java.lang.annotation.Annotation[] bazAnns = annotations[2];
- System.out.println(Arrays.toString(bazAnns));
- assertEquals("Check bazAnns length", 2, bazAnns.length);
- }
-
- private Marker getMarkerAnnotation(java.lang.annotation.Annotation[] annotations) {
- for (int i = 0; i < annotations.length; i++) {
- if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.runtime.core.components.Marker")) {
- return (Marker) annotations[i];
- }
- }
- return null;
- }
-
- private SubMarker getSubMarkerAnnotation(java.lang.annotation.Annotation[] annotations) {
- for (int i = 0; i < annotations.length; i++) {
- if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.runtime.core.components.SubMarker")) {
- return (SubMarker) annotations[i];
- }
- }
- return null;
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java
deleted file mode 100644
index b929a86998..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.runtime.core.services.Plop;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class TestDuplicateMethods extends BaseTest {
-
-
- @Test
- public void testDuplicateMethod() {
- ipojoHelper.createComponentInstance("plopimpl", "plop");
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(Plop.class.getName(), "plop");
- assertNotNull("Check plop", ref);
- Plop plop = (Plop) osgiHelper.getServiceObject(ref);
- Object o = plop.getPlop();
- assertEquals("Check result", "plop", o);
- ipojoHelper.dispose();
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java
deleted file mode 100644
index 1f7ba93084..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.runtime.core.components.FooProviderType1;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-/**
- * Test exception handling. POJO exception must be propagated.
- */
-public class TestExceptionHandling extends BaseTest {
-
- private ComponentInstance ci_lazzy;
-
- private ServiceReference lazzyRef;
- private ServiceReference immRef;
-
- @Before
- public void setUp() {
- String factName = "Manipulation-FooProviderType-1";
- String compName = "FooProvider-1";
- ci_lazzy = ipojoHelper.createComponentInstance(factName, compName);
-
- String factName2 = "Manipulation-ImmediateFooProviderType";
- String compName2 = "FooProvider-2";
- ipojoHelper.createComponentInstance(factName2, compName2);
-
- lazzyRef = osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + compName + ")");
- immRef = osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + compName2 + ")");
-
- assertNotNull("LazzyRef", lazzyRef);
- assertNotNull("ImmRef", immRef);
- }
-
- /**
- * Check that the exception is correctly propagated.
- */
- @Test
- public void testException() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
- FooProviderType1 fs = (FooProviderType1) osgiHelper.getServiceObject(ref);
- try {
- fs.testException();
- fail("The method must returns an exception");
- } catch (Exception e) {
- // OK
- }
- }
-
- /**
- * Check that the exception is correctly catch by the POJO.
- */
- @Test
- public void testTry() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName());
- assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref);
- FooProviderType1 fs = (FooProviderType1) osgiHelper.getServiceObject(ref);
- try {
- fs.testTry();
- } catch (Exception e) {
- fail("The method has returned an exception");
- }
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
deleted file mode 100644
index c7ae3c2664..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.*;
-
-public class TestGenericList extends BaseTest {
-
- ComponentInstance foo1, foo2;
- ComponentInstance checker;
-
- @Before
- public void setUp() {
- foo1 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo1");
- foo2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo2");
- checker = ipojoHelper.createComponentInstance("TypedList", "checker");
- foo1.stop();
- foo2.stop();
- }
-
- @Test
- public void testTypedList() {
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), checker.getInstanceName());
- CheckService check = (CheckService) osgiHelper.getServiceObject(ref);
- assertNotNull("Checker availability", check);
- // Check without providers
- assertFalse("Empty list", check.check());
-
- // Start the first provider
- foo1.start();
- assertTrue("List with one element", check.check());
- Properties props = check.getProps();
- List list = (List) props.get("list");
- assertEquals("Check size - 1", 1, list.size());
-
- // Start the second provider
- foo2.start();
- assertTrue("List with two element", check.check());
- props = check.getProps();
- list = (List) props.get("list");
- assertEquals("Check size - 2", 2, list.size());
-
- // Stop the first one
- foo1.stop();
- assertTrue("List with one element (2)", check.check());
- props = check.getProps();
- list = (List) props.get("list");
- assertEquals("Check size - 3", 1, list.size());
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
deleted file mode 100644
index 63998f0020..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.Pojo;
-import org.apache.felix.ipojo.PrimitiveInstanceDescription;
-import org.apache.felix.ipojo.runtime.core.services.FooService;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static org.junit.Assert.*;
-
-/**
- * Check the getComponentInstance method on a POJO
- */
-public class TestGetComponentInstance extends BaseTest {
-
- /**
- * Check if a pojo can correctly be cast in POJO.
- * Check the getComponentInstance method.
- */
- @Test
- public void testGetComponentInstance() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException {
- String factName = "Manipulation-FooProviderType-1";
- String compName = "FooProvider-1";
- ServiceReference ref = null;
-
- // Get the factory to create a component instance
- Factory fact = ipojoHelper.getFactory(factName);
- assertNotNull("Cannot find the factory FooProvider-1", fact);
-
- Properties props = new Properties();
- props.put("instance.name", compName);
- ComponentInstance ci = null;
- try {
- ci = fact.createComponentInstance(props);
- } catch (Exception e1) {
- fail(e1.getMessage());
- }
-
- assertEquals("Check instance name", compName, ci.getInstanceName());
-
- // Get a FooService provider
- ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), compName);
-
- assertNotNull("FS not available", ref);
-
- // Get foo object
- FooService fs = (FooService) osgiHelper.getServiceObject(ref);
-
- // Cast to POJO
- Pojo pojo = (Pojo) fs;
- Field im = fs.getClass().getDeclaredField("__IM");
- assertNotNull(im);
- im.setAccessible(true);
- assertNotNull(im.get(fs));
-
- Method method = fs.getClass().getMethod("getComponentInstance");
- assertNotNull(method);
-
- // GetComponentInstance
- ComponentInstance instance = pojo.getComponentInstance();
- assertNotNull(instance);
- assertEquals("Check component instance name", instance.getInstanceName(), compName);
- assertEquals("Check component factory name", instance.getFactory().getName(), factName);
- assertNotNull("Instance description not null", instance.getInstanceDescription());
- PrimitiveInstanceDescription id = (PrimitiveInstanceDescription) instance.getInstanceDescription();
- assertTrue("Check instance state", id.getState() == ComponentInstance.VALID);
- assertEquals("Check created pojo count", id.getCreatedObjects().length, 1);
- assertEquals("Check instance description name", id.getName(), compName);
-
- ci.dispose();
-
- // Check that there is no more FooService
- ref = osgiHelper.getServiceReference(FooService.class.getName());
- assertNull("FS available, but component instance stopped", ref);
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java
deleted file mode 100644
index d70ea3342c..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.runtime.core;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.HandlerFactory;
-import org.apache.felix.ipojo.runtime.core.services.BazService;
-import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService;
-import org.junit.Test;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.OptionUtils;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import junit.framework.Assert;
-
-public class TestHandlerBindingAndIgnoreAnnotation extends BaseTest {
-
- public static final String FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.HandlerBindingTestComponent";
-
- @Test
- public void testFooHandlerBinding() {
-
-/*
- HandlerFactory handlerFactory = ipojoHelper.getHandlerFactory("com.acme:foo");
- assertNotNull(handlerFactory);
- assertEquals(Factory.VALID, handlerFactory.getState());
-*/
-
- // verify component's factory is here
- // verify BazService has been published
- // --> verify instance has been created
-
- Factory factory = ipojoHelper.getFactory(FACTORY_NAME);
- assertNotNull(factory);
- assertEquals(Factory.VALID, factory.getState());
-
-
- List services = osgiHelper.getServiceObjects(HandlerBindingTestService.class);
- assertEquals(1, services.size());
-
- HandlerBindingTestService baz = services.get(0);
- assertEquals("Bonjour", baz.get("greeting"));
- assertEquals("Welcome", baz.get("welcome"));
- assertNull(baz.get("ignored"));
- ipojoHelper.dispose();
- }
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
- @Override
- protected Option[] getCustomOptions() {
- return new Option[] {CoreOptions.vmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000")};
- //return new Option[] {CoreOptions.vmOptions("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000")};
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java
deleted file mode 100644
index 5ea6c17b77..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.runtime.core;
-
-import aQute.lib.osgi.Constants;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.BazService;
-import org.junit.Test;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.tinybundles.core.TinyBundle;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-import static org.apache.commons.io.FileUtils.copyInputStreamToFile;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
-
-/**
- * Checks that native methods can still be used in components.
- */
-public class TestNativeMethod extends BaseTest {
-
- private static final String NATIVE_CLAUSE = "" +
- //Mac
- "libs/mac/libfoo.jnilib;osname=MacOSX;osname=MacOS;processor=x86;processor=x86_64;processor=PowerPC," +
- // Linux 32 bits
- "libs/linux64/libfoo.so;processor=x86_64;osname=Linux," +
- // Linux 64 bits
- "libs/linux32/libfoo.so;processor=x86;osname=Linux";
-
- /**
- * We don't deploy the test bundle, a specific one will be built.
- * On KF we still deploy the bundle as the probe bundles needs the components and services.
- */
- @Override
- public boolean deployTestBundle() {
- return isKnopflerfish();
- }
-
- public boolean isKnopflerfish() {
- if (context != null) {
- return super.isKnopflerfish();
- } else {
- String pf = System.getProperty("pax.exam.framework");
- return pf != null && pf.equalsIgnoreCase("knopflerfish");
- }
- }
-
- @Override
- protected Option[] getCustomOptions() {
- // The native bundle cannot be deployed on kf,
- // just skip
- if (isKnopflerfish()) {
- return new Option[0];
- }
- return new Option[] {
- buildBundleWithNativeLibraries()
- };
- }
-
- @Test
- public void testComponentWithNativeMethod() {
- if (isKnopflerfish()) {
- System.out.println("Test not supported on knopflerfish");
- return;
- }
-
- ComponentInstance ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components" +
- ".nativ.NativeComponent");
-
- BazService baz = osgiHelper.getServiceObject(BazService.class, "(instance.name=" + ci.getInstanceName() +")");
- assertEquals("foo: Test program of JNI.", baz.hello(""));
- }
-
-
- public static Option buildBundleWithNativeLibraries() {
- File out = new File("target/tested/test-bundle-with-native.jar");
- if (out.exists()) {
- try {
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- // Ignore it.
- }
- }
-
- TinyBundle tested = TinyBundles.bundle();
-
- // We look inside target/classes to find the class and resources
- File classes = new File("target/classes");
- Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
- List exports = new ArrayList();
- for (File file : files) {
- if (file.isDirectory()) {
- // By convention we export of .services and .service package
- if (file.getAbsolutePath().contains("/services") || file.getAbsolutePath().contains("/service")) {
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- String packageName = path.replace('/', '.');
- exports.add(packageName);
- }
- } else {
- // We need to compute the path
- String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
- try {
- tested.add(path, file.toURI().toURL());
- } catch (MalformedURLException e) {
- // Ignore it.
- }
- System.out.println(file.getName() + " added to " + path);
- }
- }
-
- // Depending on the the order, the probe bundle may already have detected requirements on components.
- String clause = "" +
- "org.apache.felix.ipojo.runtime.core.components, " +
- "org.apache.felix.ipojo.runtime.core.services, " +
- "org.apache.felix.ipojo.runtime.core.services.A123";
- for (String export : exports) {
- if (export.length() > 0) { export += ", "; }
- clause += export;
- }
-
- System.out.println("Exported packages : " + clause);
-
- InputStream inputStream = tested
- .set(Constants.BUNDLE_SYMBOLICNAME, BaseTest.TEST_BUNDLE_SYMBOLIC_NAME + "-with-native")
- .set(Constants.IMPORT_PACKAGE, "*")
- .set(Constants.EXPORT_PACKAGE, clause)
- .set(Constants.BUNDLE_NATIVECODE, NATIVE_CLAUSE)
- .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));
-
- try {
- copyInputStreamToFile(inputStream, out);
- return bundle(out.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot compute the url of the manipulated bundle");
- } catch (IOException e) {
- throw new RuntimeException("Cannot write of the manipulated bundle");
- }
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
deleted file mode 100644
index 37d2774e06..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.components.InnerClasses;
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class TestNestedClasses extends BaseTest {
-
- private ComponentInstance instance;
- private CheckService service;
-
- @Before
- public void setUp() {
- Properties map = new Properties();
- map.put("publicObject", "publicObject");
- map.put("publicInt", new Integer(0));
- map.put("packageObject", "packageObject");
- map.put("packageInt", new Integer(1));
- map.put("protectedObject", "protectedObject");
- map.put("protectedInt", new Integer(2));
- map.put("privateObject", "privateObject");
- map.put("privateInt", new Integer(3));
- map.put("nonObject", "nonObject");
- map.put("nonInt", new Integer(4));
- instance = ipojoHelper.createComponentInstance("inners", map);
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
- assertNotNull("Check service availability", ref);
- service = (CheckService) osgiHelper.getServiceObject(ref);
- }
-
- @After
- public void tearDown() {
- service = null;
- }
-
- @Test
- public void testPrivateInnerClass() {
- Map data = (Map) service.getProps().get("privateInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testProtectedInnerClass() {
- Map data = (Map) service.getProps().get("protectedInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testPackageInnerClass() {
- Map data = (Map) service.getProps().get("packageInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testPublicInnerClass() {
- Map data = (Map) service.getProps().get("publicInner");
- assertNotNull("Check data existence", data);
- System.out.println(data);
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testConstructorInnerClass() {
- Map data = (Map) service.getProps().get("constructorInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testStaticInnerClass() {
- Map data = (Map) service.getProps().get("staticInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check static", new Boolean(true), data.get("static"));
- assertEquals("Check static int", new Integer(6), data.get("staticint"));
-
- }
-
- @Test
- public void testAnonymousClassDeclaredInStaticField() {
- assertEquals(service.getProps().get("call"), 1);
- }
-
- @Test
- public void testPackageStaticInnerClass() {
- Map data = (Map) service.getProps().get("packageStaticInner");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check static", new Boolean(true), data.get("static"));
- assertEquals("Check static int", new Integer(6), data.get("staticint"));
-
- }
-
- @Test
- public void testAnonymousInnerClass() {
- Map data = (Map) service.getProps().get("anonymous");
- assertNotNull("Check data existence", data);
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
-
- }
-
- @Test
- public void testInnerAccess() {
- Map map = (Map) service.getProps();
- assertNotNull("Check map existence", map);
-
- InnerClasses.PublicNested p = (InnerClasses.PublicNested) map.get("public");
- Map data = p.doSomething();
-
- assertEquals("Check public object", "publicObject", data.get("publicObject"));
- assertEquals("Check public int", new Integer(0), data.get("publicInt"));
- assertEquals("Check protected object", "protectedObject", data.get("protectedObject"));
- assertEquals("Check protected int", new Integer(2), data.get("protectedInt"));
- assertEquals("Check package object", "packageObject", data.get("packageObject"));
- assertEquals("Check package int", new Integer(1), data.get("packageInt"));
- assertEquals("Check private object", "privateObject", data.get("privateObject"));
- assertEquals("Check private int", new Integer(3), data.get("privateInt"));
- assertEquals("Check non-managed object", "not-managed", data.get("nonObject"));
- assertEquals("Check non-managed int", new Integer(5), data.get("nonInt"));
- }
-
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
deleted file mode 100644
index 84b659b275..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.*;
-
-/**
- * Check the manipulation of primitive type (boxed and unboxed).
- */
-public class TestPrimitiveTypes extends BaseTest {
-
- PrimitiveManipulationTestService prim;
-
- @Before
- public void setUp() {
- ComponentInstance instance = ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTester");
- assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
- prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(PrimitiveManipulationTestService.class.getName(), "(instance.name=" + instance.getInstanceName() + ")");
- assertNotNull("Check prim availability", prim);
- }
-
- @After
- public void tearDown() {
- prim = null;
- }
-
- @Test
- public void testByte() {
- assertEquals("Check - 1", prim.getByte(), 1);
- prim.setByte((byte) 2);
- assertEquals("Check - 2", prim.getByte(), 2);
- }
-
- @Test
- public void testShort() {
- assertEquals("Check - 1", prim.getShort(), 1);
- prim.setShort((short) 2);
- assertEquals("Check - 2", prim.getShort(), 2);
- }
-
- @Test
- public void testInt() {
- assertEquals("Check - 1", prim.getInt(), 1);
- prim.setInt((int) 2);
- assertEquals("Check - 2", prim.getInt(), 2);
- }
-
- @Test
- public void testLong() {
- assertEquals("Check - 1", prim.getLong(), 1);
- prim.setLong((long) 2);
- assertEquals("Check - 2", prim.getLong(), 2);
- }
-
- @Test
- public void testFloat() {
- assertEquals("Check - 1", prim.getFloat(), 1.1f, 0);
- prim.setFloat(2.2f);
- assertEquals("Check - 2", prim.getFloat(), 2.2f, 0);
- }
-
- @Test
- public void testDouble() {
- assertEquals("Check - 1", prim.getDouble(), 1.1, 0);
- prim.setDouble(2.2);
- assertEquals("Check - 2", prim.getDouble(), 2.2, 0);
- }
-
- @Test
- public void testBoolean() {
- assertFalse("Check - 1", prim.getBoolean());
- prim.setBoolean(true);
- assertTrue("Check - 2", prim.getBoolean());
- }
-
- @Test
- public void testChar() {
- assertEquals("Check - 1", prim.getChar(), 'a');
- prim.setChar('b');
- assertEquals("Check - 2", prim.getChar(), 'b');
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
deleted file mode 100644
index 28cc0e7cf2..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.*;
-
-/**
- * Check the manipulation of primitive type (boxed and unboxed).
- * The targeted implementation contains numbers in the package and class name.
- */
-public class TestPrimitiveTypesWithNumberInNames extends BaseTest {
-
- PrimitiveManipulationTestService prim;
-
- @Before
- public void setUp() {
- ComponentInstance instance =
- ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTesterA");
- assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(),
- instance.getInstanceName());
- assertNotNull("Check prim availability", ref);
- prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(ref);
- }
-
- @After
- public void tearDown() {
- prim = null;
- }
-
- @Test
- public void testByte() {
- assertEquals("Check - 1", prim.getByte(), 1);
- prim.setByte((byte) 2);
- assertEquals("Check - 2", prim.getByte(), 2);
- }
-
- @Test
- public void testShort() {
- assertEquals("Check - 1", prim.getShort(), 1);
- prim.setShort((short) 2);
- assertEquals("Check - 2", prim.getShort(), 2);
- }
-
- @Test
- public void testInt() {
- assertEquals("Check - 1", prim.getInt(), 1);
- prim.setInt((int) 2);
- assertEquals("Check - 2", prim.getInt(), 2);
- }
-
- @Test
- public void testLong() {
- assertEquals("Check - 1", prim.getLong(), 1);
- prim.setLong((long) 2);
- assertEquals("Check - 2", prim.getLong(), 2);
- }
-
- @Test
- public void testFloat() {
- assertEquals("Check - 1", prim.getFloat(), 1.1f, 0);
- prim.setFloat(2.2f);
- assertEquals("Check - 2", prim.getFloat(), 2.2f, 0);
- }
-
- @Test
- public void testDouble() {
- assertEquals("Check - 1", prim.getDouble(), 1.1, 0);
- prim.setDouble(2.2);
- assertEquals("Check - 2", prim.getDouble(), 2.2, 0);
- }
-
- @Test
- public void testBoolean() {
- assertFalse("Check - 1", prim.getBoolean());
- prim.setBoolean(true);
- assertTrue("Check - 2", prim.getBoolean());
- }
-
- @Test
- public void testChar() {
- assertEquals("Check - 1", prim.getChar(), 'a');
- prim.setChar('b');
- assertEquals("Check - 2", prim.getChar(), 'b');
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java
deleted file mode 100644
index c956eda438..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.runtime.core;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.Factory;
-import org.apache.felix.ipojo.runtime.core.services.BazService;
-import org.junit.Test;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import junit.framework.Assert;
-
-public class TestStereotypeAnnotation extends BaseTest {
-
- public static final String BAZ_FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.StereotypedBazComponent";
-
- public static final String MB_FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.StereotypedMultiBind";
-
- @Test
- public void testTypeStereotype() {
-
- // verify component's factory is here
- // verify BazService has been published
- // --> verify instance has been created
-
- Factory factory = ipojoHelper.getFactory(BAZ_FACTORY_NAME);
- Assert.assertNotNull(factory);
- assertEquals(Factory.VALID, factory.getState());
-
-
- List services = osgiHelper.getServiceObjects(BazService.class);
- assertEquals(1, services.size());
-
- BazService baz = services.get(0);
- assertEquals("Hello Guillaume", baz.hello("Guillaume"));
- ipojoHelper.dispose();
- }
-
- @Test
- public void testMethodStereotype() {
-
- // verify component's factory is here
- // verify that the requires handler has been activated
- // verify that a created instance works
-
- Factory factory = ipojoHelper.getFactory(MB_FACTORY_NAME);
- Assert.assertNotNull(factory);
- assertEquals(Factory.VALID, factory.getState());
-
- assertTrue(factory.getRequiredHandlers().contains("org.apache.felix.ipojo:requires"));
-
- ComponentInstance instance = ipojoHelper.createComponentInstance(MB_FACTORY_NAME, "stereotype-multibind-instance");
- assertTrue(ipojoHelper.isInstanceValid(instance));
-
- ipojoHelper.dispose();
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
deleted file mode 100644
index c4c879e656..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.CheckService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.ops4j.pax.exam.ProbeBuilder;
-import org.ops4j.pax.exam.TestProbeBuilder;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class TestSwitches extends BaseTest {
-
- private ComponentInstance instance;
- private CheckService service;
-
- @Before
- public void setUp() {
- instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.Switches");
-
- ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName());
- assertNotNull("Check service availability", ref);
- service = (CheckService) osgiHelper.getServiceObject(ref);
- }
-
- @After
- public void tearDown() {
- service = null;
- }
-
- @ProbeBuilder
- public TestProbeBuilder probe(TestProbeBuilder builder) {
- builder.setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.apache.felix.ipojo, " +
- "org.ow2.chameleon.testing.helpers," +
- "org.apache.felix.ipojo.architecture, org.apache.felix.ipojo.handlers.dependency," +
- "org.apache.felix.ipojo.runtime.core.services, org.apache.felix.ipojo.runtime.core.components");
- builder.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "org.ops4j.pax.exam,org.junit,javax.inject," +
- "org.ops4j.pax.exam.options,junit.framework");
- builder.setHeader("Bundle-ManifestVersion", "2");
- return builder;
- }
-
- @Test
- public void testSwitches() {
- Properties properties = service.getProps();
- assertEquals(properties.get("switchOnInteger1"), "1");
- assertEquals(properties.get("switchOnInteger4"), "3");
-
-
- assertEquals(properties.get("switchOnEnumRed"), "RED");
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
deleted file mode 100644
index 8a6732edc8..0000000000
--- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.runtime.core;
-
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.ow2.chameleon.testing.helpers.BaseTest;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static junit.framework.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class TestTypeBoxing extends BaseTest {
-
- ComponentInstance instance; // Instance under test
-
- PrimitiveManipulationTestService prim;
-
- ServiceReference prim_ref;
-
- @Before
- public void setUp() {
- Properties p1 = new Properties();
- p1.put("instance.name", "primitives");
- instance = ipojoHelper.createComponentInstance("ManipulationPrimitives5-PrimitiveManipulationTester", p1);
- assertTrue("check instance state", instance.getState() == ComponentInstance.VALID);
- prim_ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(), instance.getInstanceName());
- assertNotNull("Check prim availability", prim_ref);
- prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(prim_ref);
- }
-
- @After
- public void tearDown() {
- prim = null;
- }
-
-
- @Test
- public void testLongFromObject() {
- assertEquals("Check - 1", prim.getLong(), 1);
- Long l = new Long(2);
- prim.setLong(l);
- assertEquals("Check - 2", prim.getLong(), 2);
- }
-
- @Test
- public void testLongFromObject2() {
- assertEquals("Check - 1", prim.getLong(), 1);
- Long l = new Long(2);
- prim.setLong(l, "ss");
- assertEquals("Check - 2", prim.getLong(), 2);
- }
-
- @Override
- protected List getExtraExports() {
- return Arrays.asList("org.apache.felix.ipojo.runtime.core.components");
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml
deleted file mode 100644
index 5d5e4ecda5..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator.manipulator-it
- 1.13.1-SNAPSHOT
-
-
- 4.0.0
-
- ipojo-online-manipulator-test
-
- Apache Felix iPOJO Manipulator ~ Online IT
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java
deleted file mode 100644
index 0549286488..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.test.online.components;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Requires;
-import org.apache.felix.ipojo.test.online.services.Hello;
-
-@Component
-public class Consumer {
-
- @Requires
- private Hello hello;
-
- public Consumer() {
- System.out.println(hello.sayHello());
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java
deleted file mode 100644
index 289f3e92e5..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.test.online.components;
-
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.test.online.module.Type;
-import org.apache.felix.ipojo.test.online.services.Hello;
-
-/**
- * User: guillaume
- * Date: 27/02/2014
- * Time: 14:33
- */
-@Type
-@Instantiate
-@Provides
-public class FrenchHelloService implements Hello {
- @Override
- public String sayHello() {
- return "Bonjour";
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java
deleted file mode 100644
index a4cd6d52a7..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.test.online.components;
-
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.test.online.module.Type2;
-import org.apache.felix.ipojo.test.online.services.Hello;
-
-/**
- * User: guillaume
- * Date: 27/02/2014
- * Time: 14:33
- */
-@Type2
-@Instantiate
-@Provides
-public class GermanHelloService implements Hello {
- @Override
- public String sayHello() {
- return "Hallo";
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java
deleted file mode 100644
index d2ef530601..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.test.online.components;
-
-
-import org.apache.felix.ipojo.test.online.services.Hello;
-
-public class MyProvider implements Hello {
-
- public String sayHello() {
- return "Hello";
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java
deleted file mode 100644
index a7c731229c..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.test.online.components;
-
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.annotations.Provides;
-import org.apache.felix.ipojo.test.online.services.Hello;
-
-@Component
-@Provides
-@Instantiate
-public class MyProviderWithAnnotations implements Hello {
-
- public String sayHello() {
- return "Hello";
- }
-
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java
deleted file mode 100644
index 8bf3d804b6..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.test.online.module;
-
-import org.apache.felix.ipojo.manipulator.spi.Module;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * User: guillaume
- * Date: 27/02/2014
- * Time: 14:31
- */
-public class Activator implements BundleActivator {
-
- private ServiceRegistration registration;
-
- @Override
- public void start(final BundleContext context) throws Exception {
- registration = context.registerService(Module.class, new TypeModule(), null);
- }
-
- @Override
- public void stop(final BundleContext context) throws Exception {
- registration.unregister();
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java
deleted file mode 100644
index 2329851f95..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.test.online.module;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Stereotype;
-
-/**
- * Stereotype defined in a Module
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Type {
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java
deleted file mode 100644
index 36992abb48..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.test.online.module;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Stereotype;
-
-/**
- * Annotated stereotype
- */
-@Stereotype
-@Component
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Type2 {
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java
deleted file mode 100644
index 877d163c2d..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.test.online.module;
-
-import java.lang.annotation.Annotation;
-
-import org.apache.felix.ipojo.annotations.Component;
-import org.apache.felix.ipojo.annotations.Instantiate;
-import org.apache.felix.ipojo.manipulator.spi.AnnotationLiteral;
-import org.apache.felix.ipojo.manipulator.spi.AbsBindingModule;
-
-/**
- * User: guillaume
- * Date: 27/02/2014
- * Time: 14:26
- */
-public class TypeModule extends AbsBindingModule {
- @Override
- public void configure() {
- // @Type is equivalent to @Component
- bindStereotype(Type.class)
- .with(new ComponentLiteral());
- }
-
- public static class ComponentLiteral extends AnnotationLiteral implements Component {
-
- public boolean public_factory() {
- return true;
- }
-
- public boolean publicFactory() {
- return true;
- }
-
- public String name() {
- return "";
- }
-
- public boolean architecture() {
- return false;
- }
-
- public boolean immediate() {
- return false;
- }
-
- public boolean propagation() {
- return true;
- }
-
- public String managedservice() {
- return "";
- }
-
- public String factory_method() {
- return "";
- }
-
- public String factoryMethod() {
- return "";
- }
-
- public String version() {
- return "";
- }
- }
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java
deleted file mode 100644
index a58fb1f570..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.test.online.services;
-
-public interface Hello {
-
- public String sayHello();
-
-}
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml
deleted file mode 100644
index a78ad3c345..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml
deleted file mode 100644
index 593779f48b..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java
deleted file mode 100644
index 63b9ebcc09..0000000000
--- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java
+++ /dev/null
@@ -1,593 +0,0 @@
-/*
- * 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.test.online;
-
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import org.apache.felix.ipojo.ComponentInstance;
-import org.apache.felix.ipojo.architecture.Architecture;
-import org.apache.felix.ipojo.architecture.InstanceDescription;
-import org.apache.felix.ipojo.test.online.components.Consumer;
-import org.apache.felix.ipojo.test.online.components.FrenchHelloService;
-import org.apache.felix.ipojo.test.online.components.GermanHelloService;
-import org.apache.felix.ipojo.test.online.components.MyProvider;
-import org.apache.felix.ipojo.test.online.components.MyProviderWithAnnotations;
-import org.apache.felix.ipojo.test.online.module.Activator;
-import org.apache.felix.ipojo.test.online.module.Type;
-import org.apache.felix.ipojo.test.online.module.Type2;
-import org.apache.felix.ipojo.test.online.module.TypeModule;
-import org.apache.felix.ipojo.test.online.services.Hello;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.io.StreamUtils;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.ops4j.pax.tinybundles.core.InnerClassStrategy;
-import org.ops4j.pax.tinybundles.core.TinyBundles;
-import org.osgi.framework.*;
-import org.osgi.service.url.URLStreamHandlerService;
-import org.ow2.chameleon.testing.helpers.OSGiHelper;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import static org.ops4j.pax.exam.CoreOptions.*;
-
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class OnlineManipulatorTest {
-
-
- private static File TMP = new File("target/tmp-bundle");
-
- @Inject
- BundleContext context;
-
- private OSGiHelper helper;
-
-
- @Configuration
- public Option[] configure() throws IOException {
- Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
- root.setLevel(Level.INFO);
-
- String providerWithMetadata = providerWithMetadata();
- String providerWithMetadataInMetaInf = providerWithMetadataInMetaInf();
- String providerWithoutMetadata = providerWithoutMetadata();
- String consumerWithMetadata = consumerWithMetadata();
- String consumerWithoutMetadata = consumerWithoutMetadata();
- String providerUsingModules = providerUsingModules();
- String providerUsingAnnotatedStereotype = providerUsingAnnotatedStereotype();
-
- return options(
- cleanCaches(),
- mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
- mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
- mavenBundle("org.apache.felix","org.apache.felix.ipojo.manipulator.online").versionAsInProject(),
- junitBundles(),
-
- provision(
- TinyBundles.bundle()
- .add(Hello.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build(),
- moduleBundle()
- ),
-
- systemProperty("providerWithMetadata").value(providerWithMetadata),
- systemProperty("providerWithMetadataInMetaInf").value(providerWithMetadataInMetaInf),
- systemProperty("providerWithoutMetadata").value(providerWithoutMetadata),
- systemProperty("providerUsingAnnotations").value(providerUsingAnnotation()),
- systemProperty("consumerWithMetadata").value(consumerWithMetadata),
- systemProperty("consumerWithoutMetadata").value(consumerWithoutMetadata),
- systemProperty("providerUsingModules").value(providerUsingModules),
- systemProperty("providerUsingAnnotatedStereotype").value(providerUsingAnnotatedStereotype),
-
- systemProperty("org.knopflerfish.osgi.registerserviceurlhandler").value("true")
- );
-
- }
-
- private InputStream moduleBundle() {
- return TinyBundles.bundle()
- .add(Activator.class)
- .add(Type.class)
- .add(Type2.class)
- .add(TypeModule.class, InnerClassStrategy.ALL)
- .add(TypeModule.ComponentLiteral.class)
- .set(Constants.BUNDLE_ACTIVATOR, Activator.class.getName())
- .set(Constants.BUNDLE_SYMBOLICNAME, "Manipulator Module")
- .set(Constants.IMPORT_PACKAGE,
- "org.osgi.framework," +
- "org.apache.felix.ipojo.manipulator.spi," +
- "org.apache.felix.ipojo.annotations")
- .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.online.module")
- .build();
- }
-
- @Before
- public void before() {
- helper = new OSGiHelper(context);
- waitForStability(context);
-
- helper.waitForService(URLStreamHandlerService.class, null, 1000);
-
- Assert.assertEquals("Check online manipulator bundle state",
- helper.getBundle("org.apache.felix.ipojo.manipulator.online").getState(),
- Bundle.ACTIVE);
-
- URLStreamHandlerService svc = helper.getServiceObject(URLStreamHandlerService.class, null);
- Assert.assertNotNull("URL Stream handler exported", svc);
- System.out.println(svc);
- }
-
- @After
- public void after() {
- helper.dispose();
- }
-
- private static File getTemporaryFile(String name) throws IOException {
- if (!TMP.exists()) {
- TMP.mkdirs();
- TMP.deleteOnExit();
- }
- File file = File.createTempFile(name, ".jar", TMP);
- //File file = new File(TMP, name + ".jar");
- if (file.exists()) {
- file.delete();
- }
- file.deleteOnExit();
- return file;
- }
-
- @Test
- public void installProviderWithMetadata1() throws Exception {
- String url = context.getProperty("providerWithMetadata");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
-
- assertBundle("Provider");
-
- helper.waitForService(Hello.class.getName(), null, 5000);
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
- }
-
-
- @Test
- public void installProviderWithMetadata2() throws BundleException, InvalidSyntaxException, IOException {
- String url = context.getProperty("providerWithMetadataInMetaInf");
- Assert.assertNotNull(url);
- System.out.println("prefixed url : " + "ipojo:" + url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
- assertBundle("Provider");
- helper.waitForService(Hello.class.getName(), null, 5000);
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
- }
-
- @Test
- public void installProviderWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException {
- String url = context.getProperty("providerWithoutMetadata");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
-
- assertBundle("Provider");
- helper.waitForService(Hello.class.getName(), null, 5000);
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
- }
-
- @Test
- public void installProviderUsingAnnotations() throws BundleException, InvalidSyntaxException, IOException {
- String url = context.getProperty("providerUsingAnnotations");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
-
- assertBundle("Provider-with-annotations");
- helper.waitForService(Hello.class.getName(), null, 5000);
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
- }
-
- @Test
- public void installConsumerWithMetadata() throws BundleException, InvalidSyntaxException, IOException {
- String url = context.getProperty("providerWithoutMetadata");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
- assertBundle("Provider");
-
- String url2 = context.getProperty("consumerWithMetadata");
- Assert.assertNotNull(url);
- Bundle bundle2 = context.installBundle("ipojo:" + url2);
- bundle2.start();
-
- assertBundle("Consumer");
- helper.waitForService(Hello.class.getName(), null, 5000);
- // Wait for activation.
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
- bundle.uninstall();
- bundle2.uninstall();
- }
-
- @Test
- public void installConsumerWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException {
- String url = context.getProperty("providerWithMetadataInMetaInf");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
- assertBundle("Provider");
- helper.waitForService(Hello.class.getName(), null, 5000);
-
- String url2 = context.getProperty("consumerWithoutMetadata");
- Assert.assertNotNull(url);
- Bundle bundle2 = context.installBundle("ipojo:" + url2);
- bundle2.start();
- assertBundle("Consumer");
- // Wait for activation.
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- assertValidity();
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
- bundle2.uninstall();
- }
-
- @Test
- public void testManipulatorModuleRegisteredAsServicesAreLoaded() throws Exception {
-
- String url = context.getProperty("providerUsingModules");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
- assertBundle("ProviderUsingModules");
-
- helper.waitForService(Hello.class.getName(), null, 5000);
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
-
- }
-
- @Test
- public void testAnnotatedStereotypes() throws Exception {
-
- String url = context.getProperty("providerUsingAnnotatedStereotype");
- Assert.assertNotNull(url);
- Bundle bundle = context.installBundle("ipojo:" + url);
- bundle.start();
- assertBundle("ProviderUsingAnnotatedStereotype");
-
- helper.waitForService(Hello.class.getName(), null, 5000);
- Assert.assertNotNull(context.getServiceReference(Hello.class.getName()));
-
- bundle.uninstall();
-
- }
-
- /**
- * Gets a regular bundle containing metadata file
- *
- * @return the url of the bundle
- * @throws java.io.IOException
- */
- public static String providerWithMetadata() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
- .add(MyProvider.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerWithMetadata");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- return out.toURI().toURL().toExternalForm();
- }
-
- /**
- * Gets a regular bundle containing metadata file in the META-INF directory
- *
- * @return the url of the bundle
- * @throws java.io.IOException
- */
- public static String providerWithMetadataInMetaInf() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add("META-INF/metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"))
- .add(MyProvider.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerWithMetadataInMetaInf");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- return out.toURI().toURL().toExternalForm();
- }
-
- /**
- * Gets a provider bundle which does not contain the metadata file.
- *
- * @return the url of the bundle + metadata
- * @throws java.io.IOException
- */
- public static String providerWithoutMetadata() throws IOException {
- InputStream is = TinyBundles.bundle()
- //.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml"))
- .add(MyProvider.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Provider")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerWithoutMetadata");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- String url = out.toURI().toURL().toExternalForm();
-
- return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml");
- }
-
- /**
- * Gets a provider bundle which does not contain the metadata file and using annotations.
- *
- * @return the url of the bundle without metadata
- * @throws java.io.IOException
- */
- public static String providerUsingAnnotation() throws IOException {
- InputStream is = TinyBundles.bundle()
- //.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml"))
- .add(MyProviderWithAnnotations.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Provider-with-annotations")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerUsingAnnotations");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- String url = out.toURI().toURL().toExternalForm();
-
- return url;
- }
-
- /**
- * Gets a consumer bundle using annotation containing the instance
- * declaration in the metadata.
- *
- * @return the url of the bundle
- * @throws java.io.IOException
- */
- public static String consumerWithMetadata() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml"))
- .add(Consumer.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("consumerWithMetadata");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- return out.toURI().toURL().toExternalForm();
- }
-
- /**
- * Gets a consumer bundle using annotation containing the instance
- * declaration in the metadata.
- *
- * @return the url of the bundle
- * @throws java.io.IOException
- */
- public static String providerUsingModules() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add(FrenchHelloService.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderUsingModules")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerUsingModules");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- return out.toURI().toURL().toExternalForm();
- }
-
- public static String providerUsingAnnotatedStereotype() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add(GermanHelloService.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderUsingAnnotatedStereotype")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("providerUsingAnnotatedStereotype");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- return out.toURI().toURL().toExternalForm();
- }
-
- /**
- * Gets a consumer bundle using annotation that does not contain
- * metadata
- *
- * @return the url of the bundle + metadata
- * @throws java.io.IOException
- */
- public static String consumerWithoutMetadata() throws IOException {
- InputStream is = TinyBundles.bundle()
- .add(Consumer.class)
- .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer")
- .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services")
- .build();
-
- File out = getTemporaryFile("consumerWithoutMetadata");
- StreamUtils.copyStream(is, new FileOutputStream(out), true);
- String url = out.toURI().toURL().toExternalForm();
-
- return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml");
- }
-
-
- public void dumpServices() throws InvalidSyntaxException {
- ServiceReference[] refs = context.getAllServiceReferences(null, null);
- System.out.println(" === Services === ");
- for (ServiceReference ref : refs) {
- String[] itf = (String[]) ref.getProperty(Constants.OBJECTCLASS);
- System.out.println(itf[0]);
- }
- System.out.println("====");
- }
-
- public void dumpBundles() throws InvalidSyntaxException {
- Bundle[] bundles = context.getBundles();
- System.out.println(" === Bundles === ");
- for (Bundle bundle : bundles) {
- String sn = bundle.getSymbolicName();
- System.out.println(sn);
- }
- System.out.println("====");
- }
-
- private void assertBundle(String sn) {
- for (Bundle bundle : context.getBundles()) {
- if (bundle.getSymbolicName().equals(sn)
- && bundle.getState() == Bundle.ACTIVE) {
- return;
- }
-
- }
- Assert.fail("Cannot find the bundle " + sn);
- }
-
- private void assertValidity() {
- try {
- ServiceReference[] refs = context.getServiceReferences(Architecture.class.getName(), null);
- Assert.assertNotNull(refs);
- for (ServiceReference ref : refs) {
- InstanceDescription id = ((Architecture) context.getService(ref)).getInstanceDescription();
- int state = id.getState();
- Assert.assertEquals("State of " + id.getName(), ComponentInstance.VALID, state);
- }
- } catch (InvalidSyntaxException e) {
- Assert.fail(e.getMessage());
- }
-
- }
-
- /**
- * Waits for stability:
- *
- *
all bundles are activated
- *
service count is stable
- *
- * If the stability can't be reached after a specified time,
- * the method throws a {@link IllegalStateException}.
- *
- * @param context the bundle context
- * @throws IllegalStateException when the stability can't be reach after a several attempts.
- */
- private void waitForStability(BundleContext context) throws IllegalStateException {
- // Wait for bundle initialization.
- boolean bundleStability = getBundleStability(context);
- int count = 0;
- while (!bundleStability && count < 500) {
- try {
- Thread.sleep(200);
- } catch (InterruptedException e) {
- // Interrupted
- }
- count++;
- bundleStability = getBundleStability(context);
- }
-
- if (count == 500) {
- System.err.println("Bundle stability isn't reached after 500 tries");
- throw new IllegalStateException("Cannot reach the bundle stability");
- }
-
- boolean serviceStability = false;
- count = 0;
- int count1 = 0;
- int count2 = 0;
- while (!serviceStability && count < 500) {
- try {
- ServiceReference[] refs = context.getServiceReferences((String) null, null);
- count1 = refs.length;
- Thread.sleep(1000);
- refs = context.getServiceReferences((String) null, null);
- count2 = refs.length;
- serviceStability = count1 == count2;
- } catch (Exception e) {
- System.err.println(e);
- serviceStability = false;
- // Nothing to do, while recheck the condition
- }
- count++;
- }
-
- if (count == 500) {
- System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2);
- throw new IllegalStateException("Cannot reach the service stability");
- }
- }
-
- /**
- * Are bundle stables.
- *
- * @param bc the bundle context
- * @return true if every bundles are activated.
- */
- private boolean getBundleStability(BundleContext bc) {
- boolean stability = true;
- Bundle[] bundles = bc.getBundles();
- for (Bundle bundle : bundles) {
- stability = stability && (bundle.getState() == Bundle.ACTIVE);
- }
- return stability;
- }
-
-
-}
diff --git a/ipojo/manipulator/manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/pom.xml
deleted file mode 100644
index 536f0124dd..0000000000
--- a/ipojo/manipulator/manipulator-it/pom.xml
+++ /dev/null
@@ -1,413 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 8
-
-
- 4.0.0
- org.apache.felix.ipojo.manipulator.manipulator-it
- 1.13.1-SNAPSHOT
- Apache Felix iPOJO Manipulator ~ Integration Tests
- pom
-
-
-
- true
-
- 3.0.3
- 1.5.2
-
- 4.4.0
- 3.9.0.v20130529-1710
- 6.0.2
-
-
-
- ipojo-manipulator-manipulation-test
- ipojo-manipulator-creation-test
- ipojo-manipulator-manipulation-metadata-test
- online-manipulator-it
-
-
-
-
-
- org.apache.felix
- ipojo-manipulator-bom
- ${project.version}
- pom
- import
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.8
- 1.8
-
-
-
-
- org.apache.servicemix.tooling
- depends-maven-plugin
- 1.5.0
-
-
- generate-config
-
- generate-depends-file
-
-
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- **/*.iml
- src/it/**/target/**
-
-
-
-
-
- maven-deploy-plugin
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- ${skipTestExecution}
-
-
- ${TIME_FACTOR}
-
- ${pax.exam.framework}
-
-
-
-
-
-
-
-
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- ${exam.version}
- test
-
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${url.version}
- test
-
-
-
- ch.qos.logback
- logback-core
- 1.5.25
- test
-
-
-
- ch.qos.logback
- logback-classic
- 1.3.12
- test
-
-
-
- junit
- junit
- 4.13.2
- test
-
-
-
- org.mockito
- mockito-all
- 1.9.5
-
-
-
- org.ops4j.pax.tinybundles
- tinybundles
- 1.0.0
-
-
-
- xerces
- xercesImpl
- 2.12.2
-
-
-
-
- org.ow2.chameleon.testing
- tinybundles-ipojo
- 0.3.0
- test
-
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator
-
-
-
- org.apache.felix
- org.apache.felix.ipojo
-
-
-
- 1.12.0
- provided
-
-
-
- org.apache.felix
- org.apache.felix.ipojo.manipulator.online
- ${project.version}
- provided
-
-
-
-
-
- org.apache.felix
- org.apache.felix.configadmin
- 1.6.0
- test
-
-
-
- commons-io
- commons-io
- 2.14.0
-
-
-
- org.ow2.chameleon.testing
- osgi-helpers
- 0.6.1
- test
-
-
- org.osgi
- org.osgi.core
-
-
- org.slf4j
- slf4j-api
-
-
-
-
-
- org.apache.felix
- org.apache.felix.log
- 1.0.1
-
-
- org.osgi
- org.osgi.core
-
-
-
-
-
- org.ops4j.pax.url
- pax-url-wrap
- 1.5.2
-
-
-
- org.easytesting
- fest-assert
- 1.4
-
-
-
-
-
- default
-
- true
-
-
- none
-
-
-
- org.osgi
- org.osgi.compendium
- 4.3.0
-
-
- org.osgi
- org.osgi.core
- 4.3.1
-
-
-
-
- knopflerfish
-
- false
-
- pax.exam.framework
- knopflerfish
-
-
-
- knopflerfish
-
-
-
- knopflerfish-releases
- https://www.knopflerfish.org/maven2
-
-
-
-
- org.knopflerfish
- framework
- ${knoperflerfish.version}
- test
-
-
-
- org.osgi
- org.osgi.core
- 4.3.1
-
-
-
-
-
- equinox
-
- false
-
- pax.exam.framework
- equinox
-
-
-
- equinox
-
-
-
- org.osgi
- org.osgi.compendium
- 4.3.0
-
-
- org.eclipse.tycho
- org.eclipse.osgi
- ${equinox.version}
- test
-
-
-
- org.osgi
- org.osgi.core
- 4.3.1
-
-
-
-
-
- felix
-
- false
-
- pax.exam.framework
- felix
-
-
-
- felix
-
-
-
- org.apache.felix
- org.apache.felix.framework
- ${felix.version}
-
-
-
-
-
- test
-
- false
-
-
-
-
diff --git a/ipojo/manipulator/manipulator-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/manipulator-it/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/ipojo/manipulator/manipulator/changelog.txt b/ipojo/manipulator/manipulator/changelog.txt
deleted file mode 100644
index a78c45c0a9..0000000000
--- a/ipojo/manipulator/manipulator/changelog.txt
+++ /dev/null
@@ -1,249 +0,0 @@
-Changes from the 1.12.0 to 1.12.1
----------------------------------
-
-** Bug
- * [FELIX-4612] - @PostRegistration is not being called
- * [FELIX-4620] - Warning should be removed when @Configuration is used
- * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)
- * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level'
-
-Changes from the 1.11.2 to 1.12.0
----------------------------------
-
-** Improvement
- * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies
-
-** New Feature
- * [FELIX-4476] - Java 8 Support
-
-** Sub-task
- * [FELIX-4508] - Update to ASM 5.0.2
- * [FELIX-4509] - Change the frame computation strategy
-
-Changes from the 1.11.1 to 1.11.2
----------------------------------
-
-** Bug
- * [FELIX-4453] - Introduce manipulator BOM (Bill of Material)
-
-** Improvement
- * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes
-
-Changes from the 1.11.0 to 1.11.1
----------------------------------
-
-** Bug
- * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied
- * [FELIX-4347] - should ignore inner classes that are assigned to static fields
-
-Changes from the 1.10.1 to 1.11.0
----------------------------------
-
-** Bug
- * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging
- * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation
- * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style)
-
-** Improvement
- * [FELIX-4112] - Add meta annotations for handler description
- * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation
-
-** Task
- * [FELIX-4134] - Move integration-tests to the reactor
- * [FELIX-4151] - Fix mistakes in the javadoc tags
- * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x
- * [FELIX-4156] - Fix versions of maven plugins
- * [FELIX-4270] - Bump iPOJO package version to 1.11.0
-
-** Sub-task
- * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation
- * [FELIX-4254] - Specify the method id of methods from inner class
- * [FELIX-4255] - Extend the inner class manipulation to allow method interception
- * [FELIX-4256] - Avoid manipulation native and static methods from inner classes
-
-Changes from the 1.10.0 to 1.10.1
----------------------------------
-
-** Bug
- * [FELIX-4077] - Fix documentation urls in maven projects
- * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations
- * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern
- * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute
-
-** Improvement
- * [FELIX-4094] - Recognize add/remove method naming pattern
-
-** New Feature
- * [FELIX-4095] - Add CDI-like @Stereotype
-
-** Task
- * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project
- * [FELIX-4103] - Skip deployment of it-tests
- * [FELIX-4104] - Do not run integration-tests in the default build
-
-Changes from the 1.8.6 to 1.10.0
---------------------------------
-
-** Bug
- * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin
- * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly
- * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin
- * [FELIX-3974] - Properties cannot be set as immutable using annotations
- * [FELIX-3995] - Missing options in Bind annotation
- * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree
- * [FELIX-4046] - Inner class manipulation fails with expanded frames
- * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name
-
-** Improvement
- * [FELIX-3286] - Update POM to use the new parent
- * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support.
- * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support
- * [FELIX-3837] - PojoizationPlugin should be more extensible
- * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration
- * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation
-
-** New Feature
- * [FELIX-3699] - Allow annotations to handle custom component definitions.
- * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles
-
-** Task
- * [FELIX-3903] - Migrate tests to pax exam 3
- * [FELIX-3921] - Update pom to latest Felix's parent
- * [FELIX-3976] - Move the online manipulator out of the core bundle
-
-Changes from the 1.8.4 to 1.8.6
--------------------------------
-
-** Bug
- * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST
- * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account.
- * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata
- * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames
- * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable
- * [FELIX-3574] - IPojo bytecode manipulation looses method argument names
- * [FELIX-3621] - Two dimensional array as argument to a method in a component
-
-Changes from the 1.8.2 to 1.8.4
--------------------------------
-
-** Bug
- * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException
- * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7
- * [FELIX-3389] - Bnd iPOJO Plugin ignores annotated components
- * [FELIX-3391] - Unexpected warning when using bnd-ipojo-plugin
-
-** Improvement
- * [FELIX-3384] - Ensure maven-ipojo-plugin is thread-safe for parallel maven builds
-
-Changes from the 1.8.0 to 1.8.2
--------------------------------
-
-** Bug
- * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files
- * [FELIX-3012] - "Duplicate name&signature" problem
- * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter
- * [FELIX-3145] - VerifyError on Java 7
- * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest
-
-** Improvement
- * [FELIX-3017] - The manipulator should return the original class if it's already manipulated
- * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator
- * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities
- * [FELIX-3080] - Implement a BND plugin for iPOJO
- * [FELIX-3131] - Elements and attributes should conserve the insertion order
- * [FELIX-3204] - @Temporal should handle instantiation-time properties
- * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible
-
-Changes from the 1.6.4 to 1.8.0
--------------------------------
-** Bug
- * [FELIX-2779] - iPOJO manipulator badly supports custom annotation attributes of type Class
- * [FELIX-2664] - Native methods should not be manipulated
-
-** Improvement
- * [FELIX-1424] - Constructor Injection
- * [FELIX-1428] - Constructor injection of Configuration properties
- * [FELIX-2620] - Change iPojo annotation parameters to follow java naming conventions
- * [FELIX-2621] - Rename annotations to remove collisions
- * [FELIX-2622] - Support static service properties that are not mirrored into fields
- * [FELIX-2630] - Rename @Component attributes to follow the java naming conventions
- * [FELIX-2732] - [iPOJO] Service modified callback should define a default method name
- * [FELIX-2742] - Constructor injection of service dependencies
- * [FELIX-2743] - Modify Pojoization to be more easily customizable
- * [FELIX-2755] - Allow the manipulator and the different front end to use several metadata files
-
-Changes from the 1.6.2 to 1.6.4
--------------------------------
-** Bug
- * [FELIX-2430] - IPOJO manipulation (ant task) results in invalid classes throwing java.lang.VerifyError at runtime in InstanceManager
-
-** Improvement
- * [FELIX-2420] - Enum support for @Property annotation
- * [FELIX-2461] - Allow specifying the targeted service interface in the @ServiceController
- * [FELIX-2485] - Improve the performance of the manipulator on large files
- * [FELIX-2542] - Annotations on methods parameters are not moved on public methods after manipulation
-
-Changes from the 1.6.0 to 1.6.2
--------------------------------
-** Improvement
- * [FELIX-2296] - Access to ServiceReference in iPOJO service.
-
-Changes from the 1.4.2 to 1.6.0
--------------------------------
-** Improvement
- * [FELIX-1427] - Service injection with Smart Proxies
- * [FELIX-1646] - Add @Handler annotation to declare handlers without metadata.xml
- * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified
-
-** Wish
- * [FELIX-1940] - Add @Instance annotation to declare instances without metadata.xml
-
-
-Changes from the 1.4.0 to 1.4.2
--------------------------------
-** Bug
- * [FELIX-1411] - Issue on windows to find components inside bundle
- * [FELIX-1518] - iPOJO manipulator is really slow even when annotation are ignored
-
-
-Changes from 1.2.0 to 1.4.0
----------------------------
-** Bug
- * [FELIX-1302] - Manipulator never ignore annotations
- * [FELIX-1319] - Issue in the metadata overiding analysis in iPOJO annotations
-
-** Improvement
- * Update parent pom
- * [FELIX-943] - Allow iPOJO manipulator to manipulate directories
-
-
-Changes from 1.0.0 to 1.2.0
----------------------------
-** Bug
- * [FELIX-788] - Failed to create object that extends super class with BundleContext argument
-
-** Improvement
- * [FELIX-813] - Resolve XML-Schemas locally rather than from Internet
- * [FELIX-830] - Simplify the "id/parent" resolution to compute the metadata hierarchy during annotation processing
- * [FELIX-846] - Enhance the iPojo maven plugin to take metadata from pom.
- * [FELIX-876] - Specification auto import is not supported for simple component types
-
-
-Changes from 0.8.0 to 1.0.0
----------------------------
-** Bug
- * [FELIX-649] - "Expecting to find object/array on stack" Error when asking for instance of an iPOJO component
- * [FELIX-697] - Generation of a duplicated field when using generics
- * [FELIX-739] - iPOJO and annotations support when manipulating
- * [FELIX-751] - Wrong access for setter methods
-
-** Improvement
- * [FELIX-655] - Add a 'from' attribute in the service dependencies
- * [FELIX-678] - Improve missing fields detection during the packaging process
- * [FELIX-687] - Support inner and nested classes
- * [FELIX-716] - Provide XML schemas for iPOJO descriptors
-
-
-Version 0.8.0
--------------
- * Initial release
diff --git a/ipojo/manipulator/manipulator/pom.xml b/ipojo/manipulator/manipulator/pom.xml
deleted file mode 100644
index 4df86442de..0000000000
--- a/ipojo/manipulator/manipulator/pom.xml
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
- org.apache.felix
- felix-parent
- 8
-
- 4.0.0
- bundle
- org.apache.felix.ipojo.manipulator
- 1.13.1-SNAPSHOT
- Apache Felix iPOJO Manipulator
-
-
- iPOJO bytecode manipulator. This manipulator is used to instrument java classes in order to be managed by iPOJO.
-
-
-
- [1.12.1,2.0.0)
- 9.6
-
-
-
-
- org.ow2.asm
- asm
- ${asm.version}
-
-
- org.ow2.asm
- asm-tree
- ${asm.version}
-
-
- org.ow2.asm
- asm-commons
- ${asm.version}
-
-
- org.ow2.asm
- asm-util
- ${asm.version}
-
-
- org.apache.felix
- org.apache.felix.ipojo.metadata
- 1.6.0
-
-
- org.apache.felix
- org.apache.felix.ipojo.annotations
- ${project.version}
-
-
- org.mockito
- mockito-all
- 1.9.5
- test
-
-
- org.osgi
- org.osgi.core
- 4.2.0
- test
-
-
- commons-io
- commons-io
- 2.14.0
- test
-
-
- org.easytesting
- fest-assert
- 1.4
- test
-
-
-
-
- commons-codec
- commons-codec
- 1.13
- test
-
-
-
- junit
- junit
- 4.13.2
- test
-
-
-
-
-
- src/main/resources
- true
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
- 5.1.9
- true
-
-
- iPOJO Manipulator
- ${project.artifactId}
- The Apache Software Foundation
- iPOJO Manipulator
- org.apache.felix.ipojo.manipulator.*
-
- org.apache.felix.ipojo.manipulation,
- org.apache.felix.ipojo.xml.parser, org.objectweb.asm,
- org.objectweb.asm.commons, org.objectweb.asm.tree
-
-
- NONE
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
-
- false
- warning
- http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 8
- 8
-
-
-
-
- org.apache.rat
- apache-rat-plugin
-
-
- verify
-
- check
-
-
-
-
-
-
- src/**
-
-
- src/main/appended-resources/**
- src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module
-
- src/test/resources/MANIFEST.MF
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
- -Xdoclint:none
-
-
-
-
-
diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index caa7b23fd9..0000000000
--- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,11 +0,0 @@
-I. Included Third-Party Software
-
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
-
-II. Used Third-Party Software
-
-III. Overall License Summary
-- Apache License 2.0
-- BSD License
diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE
deleted file mode 100644
index 9a2eac1d14..0000000000
--- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-APACHE FELIX iPOJO Manipulator:
-
-The Apache Felix iPOJO Manipulator includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-
-For the ASM component:
-
-Copyright (c) 2000-2005 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE
deleted file mode 100644
index 016e60dffa..0000000000
--- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE
+++ /dev/null
@@ -1,3 +0,0 @@
-This product includes software developed at
-Copyright (c) 2000-2005 INRIA, France Telecom
-Licensed under BSD License.
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
deleted file mode 100644
index 4e3646de38..0000000000
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * 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.manipulation;
-
-import org.objectweb.asm.*;
-
-import java.util.*;
-
-/**
- * Checks that a POJO is already manipulated or not.
- * Moreover it allows to get manipulation data about this class.
- *
- * @author Felix Project Team
- */
-public class ClassChecker extends ClassVisitor implements Opcodes {
-
- /**
- * True if the class is already manipulated.
- */
- private boolean m_isAlreadyManipulated = false;
-
- /**
- * Interfaces implemented by the component.
- */
- private List m_itfs = new ArrayList();
-
- /**
- * Field map [field name, type] discovered in the component class.
- */
- private Map m_fields = new TreeMap();
-
- /**
- * Collection of final fields
- */
- private Set m_finalFields=new HashSet<>();
-
- /**
- * Method List of method descriptor discovered in the component class.
- */
- private List m_methods = new ArrayList();
-
- /**
- * Super class if not java.lang.Object.
- */
- private String m_superClass;
-
- /**
- * Class name.
- */
- private String m_className;
-
- /**
- * List of visited inner class owned by the implementation class.
- */
- private Map> m_inners = new LinkedHashMap>();
-
- /**
- * Class Version.
- * Used to determine the frame format.
- */
- private int m_classVersion;
-
- public ClassChecker() {
- super(Opcodes.ASM9);
- }
-
- /**
- * Check if the _cm field already exists.
- * Update the field list.
- *
- * @param access : access of the field
- * @param name : name of the field
- * @param desc : description of the field
- * @param signature : signature of the field
- * @param value : value of the field (for static field only)
- * @return the field visitor
- * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
- */
- public FieldVisitor visitField(int access, String name, String desc,
- String signature, Object value) {
- if (name.equals(ClassManipulator.IM_FIELD)
- && desc.equals("Lorg/apache/felix/ipojo/InstanceManager;")) {
- m_isAlreadyManipulated = true;
- } else if (name.startsWith("class$")) { // Does not add class$* field generated by 'x.class'
- return null;
- } else if ((access & ACC_STATIC) == ACC_STATIC) {
- return null;
- }
-
- if (isManipulatedField(name)) {
- return null;
- }
-
- Type type = Type.getType(desc);
- if (type.getSort() == Type.ARRAY) {
- if (type.getInternalName().startsWith("L")) {
- String internalType = type.getInternalName().substring(1);
- String nameType = internalType.replace('/', '.');
- m_fields.put(name, nameType + "[]");
- } else {
- String nameType = type.getClassName().substring(0,
- type.getClassName().length() - 2);
- m_fields.put(name, nameType + "[]");
- }
- } else {
- m_fields.put(name, type.getClassName());
- }
- if ((access & ACC_FINAL) == ACC_FINAL) {
- m_finalFields.add(name);
- }
-
- return null;
- }
-
- private boolean isManipulatedField(String name) {
- return ((ClassManipulator.IM_FIELD.equals(name))
- || (name.startsWith(ClassManipulator.FIELD_FLAG_PREFIX))
- || (name.startsWith(ClassManipulator.METHOD_FLAG_PREFIX)));
- }
-
- /**
- * Add the inner class to the list of inner class to manipulate.
- * The method checks that the inner class is really owned by the implementation class.
- *
- * @param name inner class qualified name
- * @param outerName outer class name (may be null for anonymous class)
- * @param innerName inner class simple (i.e. short) name
- * @param access inner class visibility
- * @see org.objectweb.asm.ClassVisitor#visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int)
- */
- public void visitInnerClass(String name, String outerName, String innerName, int access) {
- if (m_className.equals(outerName) || outerName == null) { // Anonymous classes does not have an outer class.
- // Do not include inner static class
- if (!((access & ACC_STATIC) == ACC_STATIC)) {
- m_inners.put(name, new ArrayList());
- }
- }
- }
-
-
- /**
- * Check if the class was already manipulated.
- *
- * @return true if the class is already manipulated.
- */
- public boolean isAlreadyManipulated() {
- return m_isAlreadyManipulated;
- }
-
- /**
- * Gets the extracted class version
- *
- * @return the class version.
- */
- public int getClassVersion() {
- return m_classVersion;
- }
-
- /**
- * Visit the class.
- * Update the implemented interface list.
- *
- * @param version : version of the class
- * @param access : access of the class
- * @param name : name of the class
- * @param signature : signature of the class
- * @param superName : super class of the class
- * @param interfaces : implemented interfaces.
- * @see org.objectweb.asm.ClassVisitor#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
- */
- public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
-
- m_classVersion = version;
-
- if (!superName.equals("java/lang/Object")) {
- m_superClass = superName.replace('/', '.');
- }
-
- for (String anInterface : interfaces) {
- if (!anInterface.equals("org/apache/felix/ipojo/Pojo")) {
- m_itfs.add(anInterface.replace('/', '.'));
- }
- }
-
- m_className = name;
- }
-
- /**
- * Visit a method.
- * Update the method list (except if it init or clinit.
- *
- * @param access - the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
- * @param name - the method's name.
- * @param desc - the method's descriptor (see Type).
- * @param signature - the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.
- * @param exceptions - the internal names of the method's exception classes (see getInternalName). May be null.
- * @return nothing.
- * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
- */
- public MethodVisitor visitMethod(int access, String name, String desc,
- String signature, String[] exceptions) {
- if (!name.equals("")) {
-
- if (name.equals("")) {
- if (!isGeneratedConstructor(name, desc)) {
- final MethodDescriptor md = new MethodDescriptor("$init", desc, (access & ACC_STATIC) == ACC_STATIC);
- m_methods.add(md);
- return new MethodInfoCollector(md);
- }
- } else {
- // no constructors.
- if (!isGeneratedMethod(name, desc)) {
- final MethodDescriptor md = new MethodDescriptor(name, desc, (access & ACC_STATIC) == ACC_STATIC);
- m_methods.add(md);
- return new MethodInfoCollector(md);
- }
- }
-
- }
-
- if (name.equals("")) {
- return new InnerClassAssignedToStaticFieldDetector();
- }
-
- return null;
- }
-
- public static boolean isGeneratedConstructor(String name, String desc) {
- return ("".equals(name) && isFirstArgumentInstanceManager(desc));
- }
-
- public static boolean isFirstArgumentInstanceManager(String desc) {
- Type[] types = Type.getArgumentTypes(desc);
- return types != null && (types.length >= 1)
- && Type.getType("Lorg/apache/felix/ipojo/InstanceManager;").equals(types[0]);
- }
-
- public static boolean isGeneratedMethod(String name, String desc) {
- return isGetterMethod(name, desc)
- || isSetterMethod(name, desc)
- || isSetInstanceManagerMethod(name)
- || isGetComponentInstanceMethod(name, desc)
- || isManipulatedMethod(name);
- }
-
- private static boolean isGetterMethod(String name, String desc) {
- // TYPE __getXXX()
- Type[] arguments = Type.getArgumentTypes(desc);
- return (name.startsWith("__get")
- && (arguments.length == 0)
- && !Type.VOID_TYPE.equals(Type.getReturnType(desc)));
- }
-
- private static boolean isSetterMethod(String name, String desc) {
- // void __setXXX(TYPE)
- Type[] arguments = Type.getArgumentTypes(desc);
- return (name.startsWith("__set")
- && (arguments.length == 1)
- && Type.VOID_TYPE.equals(Type.getReturnType(desc)));
- }
-
- private static boolean isSetInstanceManagerMethod(String name) {
- return name.startsWith("_setInstanceManager");
- }
-
- private static boolean isGetComponentInstanceMethod(String name, String desc) {
- return (name.startsWith("getComponentInstance")
- && Type.getType("Lorg/apache/felix/ipojo/ComponentInstance;").equals(Type.getReturnType(desc)));
- }
-
- private static boolean isManipulatedMethod(String name) {
- return (name.startsWith(ClassManipulator.PREFIX));
- }
-
- /**
- * Get collected interfaces.
- *
- * @return the interfaces implemented by the component class.
- */
- public List getInterfaces() {
- return m_itfs;
- }
-
- /**
- * Get collected fields.
- *
- * @return the field map [field_name, type].
- */
- public Map getFields() {
- return m_fields;
- }
-
- public Set getFinalFields(){
- return m_finalFields;
- }
- /**
- * Get collected methods.
- *
- * @return the method list of [method, signature].
- */
- public List getMethods() {
- return m_methods;
- }
-
- public String getSuperClass() {
- return m_superClass;
- }
-
- public Collection getInnerClasses() {
- return m_inners.keySet();
- }
-
- public Map> getInnerClassesAndMethods() {
- return m_inners;
- }
-
- public String getClassName() {
- return m_className;
- }
-
- /**
- * This class collects annotations in a method.
- * This class creates an {@link AnnotationDescriptor}
- * if an annotation is found during the visit.
- * It also collects local variables definition.
- *
- * @author Felix Project Team
- */
- private final class MethodInfoCollector extends MethodVisitor {
- /**
- * The method descriptor of the visited method.
- */
- private MethodDescriptor m_method;
-
- /**
- * Creates an annotation collector.
- *
- * @param md the method descriptor of the visited method.
- */
- private MethodInfoCollector(MethodDescriptor md) {
- super(Opcodes.ASM9);
- m_method = md;
- }
-
- /**
- * Visits an annotation.
- * This class checks the visibility. If the annotation is visible,
- * creates the {@link AnnotationDescriptor} corresponding to this annotation
- * to visit this annotation. This {@link AnnotationDescriptor} is added to
- * the {@link MethodDescriptor} of the visited method.
- *
- * @param name the name of the annotation
- * @param visible is the annotation visible at runtime
- * @return the {@link AnnotationDescriptor} to visit this annotation or
- * null if the annotation is not visible.
- * @see org.objectweb.asm.MethodVisitor#visitAnnotation(java.lang.String, boolean)
- */
- public AnnotationVisitor visitAnnotation(String name, boolean visible) {
- if (visible) {
- AnnotationDescriptor ann = new AnnotationDescriptor(name, true);
- m_method.addAnnotation(ann);
- return ann;
- }
- return null;
- }
-
- public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) {
- m_method.addLocalVariable(name, desc, signature, index);
- }
-
- public void visitEnd() {
- m_method.end();
- }
-
- public AnnotationVisitor visitParameterAnnotation(int id,
- String name, boolean visible) {
- if (visible) {
- AnnotationDescriptor ann = new AnnotationDescriptor(name, true);
- m_method.addParameterAnnotation(id, ann);
- return ann;
- }
-
- /*
- * It is harmless to keep injected parameter annotations on original constructor
- * for correct property resolution in case of re-manipulation
- */
- if (m_method.getName().equals("$init")) {
- AnnotationDescriptor ann = new AnnotationDescriptor(name, false);
- m_method.addParameterAnnotation(id, ann);
- return ann;
- }
-
- return null;
- }
-
-
- }
-
- /**
- * Describes a method or constructor annotation.
- * This allows creating a copy of the annotations found in the original class
- * to move them on inserted method. This class implements an
- * {@link AnnotationVisitor} in order to create the copy.
- * This class contains a visit method re-injecting the
- * annotation in the generated method.
- *
- * @author Felix Project Team
- */
- public class AnnotationDescriptor extends AnnotationVisitor {
- /**
- * The name of the annotation.
- */
- private String m_name;
- /**
- * Is the annotation visible at runtime?
- */
- private boolean m_visible;
- /**
- * The description of the annotation.
- * This attribute is set only for nested annotations.
- */
- private String m_desc;
- /**
- * The list of 'simple' attributes.
- */
- private List m_simples = new ArrayList(0);
- /**
- * The list of attribute containing an
- * enumeration value.
- */
- private List m_enums = new ArrayList(0);
- /**
- * The list of attribute which are
- * annotations.
- */
- private List m_nested = new ArrayList(0);
- /**
- * The list of attribute which are
- * arrays.
- */
- private List m_arrays = new ArrayList(0);
-
-
- /**
- * Creates an annotation descriptor.
- * This constructor is used for 'root' annotations.
- *
- * @param name the name of the annotation
- * @param visible the visibility of the annotation at runtime
- */
- public AnnotationDescriptor(String name, boolean visible) {
- super(Opcodes.ASM9);
- m_name = name;
- m_visible = visible;
- }
-
- /**
- * Creates an annotation descriptor.
- * This constructor is used for nested annotations.
- *
- * @param name the name of the annotation
- * @param desc the descriptor of the annotation
- */
- public AnnotationDescriptor(String name, String desc) {
- super(Opcodes.ASM9);
- m_name = name;
- m_visible = true;
- m_desc = desc;
- }
-
-
- /**
- * Visits a simple attribute.
- *
- * @param arg0 the attribute name
- * @param arg1 the attribute value
- * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
- */
- public void visit(String arg0, Object arg1) {
- m_simples.add(new SimpleAttribute(arg0, arg1));
- }
-
-
- /**
- * Visits a nested annotation.
- *
- * @param arg0 the attribute name
- * @param arg1 the annotation descriptor
- * @return the annotation visitor parsing the nested annotation
- * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(java.lang.String, java.lang.String)
- */
- public AnnotationVisitor visitAnnotation(String arg0, String arg1) {
- AnnotationDescriptor ad = new AnnotationDescriptor(arg0, arg1);
- m_nested.add(ad);
- return ad;
- }
-
-
- /**
- * Visits an array attribute.
- *
- * @param arg0 the name of the attribute
- * @return the annotation visitor parsing the content of the array,
- * uses a specific {@link ArrayAttribute} to parse this array
- * @see org.objectweb.asm.AnnotationVisitor#visitArray(java.lang.String)
- */
- public AnnotationVisitor visitArray(String arg0) {
- ArrayAttribute aa = new ArrayAttribute(arg0);
- m_arrays.add(aa);
- return aa;
- }
-
-
- /**
- * End of the visit.
- *
- * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
- */
- public void visitEnd() {
- }
-
-
- /**
- * Visits an enumeration attribute.
- *
- * @param arg0 the attribute name
- * @param arg1 the enumeration descriptor
- * @param arg2 the attribute value
- * @see org.objectweb.asm.AnnotationVisitor#visitEnum(java.lang.String, java.lang.String, java.lang.String)
- */
- public void visitEnum(String arg0, String arg1, String arg2) {
- m_enums.add(new EnumAttribute(arg0, arg1, arg2));
- }
-
- /**
- * Methods allowing to recreate the visited (stored) annotation
- * into the destination method.
- * This method recreate the annotations itself and any other
- * attributes.
- *
- * @param mv the method visitor visiting the destination method.
- */
- public void visitAnnotation(MethodVisitor mv) {
- AnnotationVisitor av = mv.visitAnnotation(m_name, m_visible);
- for (SimpleAttribute simple : m_simples) {
- simple.visit(av);
- }
- for (EnumAttribute en : m_enums) {
- en.visit(av);
- }
- for (AnnotationDescriptor nested : m_nested) {
- nested.visit(av);
- }
- for (ArrayAttribute array : m_arrays) {
- array.visit(av);
- }
- av.visitEnd();
- }
-
- /**
- * Methods allowing to recreate the visited (stored) parameter annotations
- * into the destination method.
- * This method recreate the annotations itself and any other
- * attributes.
- *
- * @param id the paramter id
- * @param mv the method visitor visiting the destination method.
- */
- public void visitParameterAnnotation(int id, MethodVisitor mv) {
- AnnotationVisitor av = mv.visitParameterAnnotation(id, m_name, m_visible);
- for (SimpleAttribute simple : m_simples) {
- simple.visit(av);
- }
- for (EnumAttribute en : m_enums) {
- en.visit(av);
- }
- for (AnnotationDescriptor nested : m_nested) {
- nested.visit(av);
- }
- for (ArrayAttribute array : m_arrays) {
- array.visit(av);
- }
- av.visitEnd();
- }
-
- /**
- * Method allowing to recreate the visited (stored) annotation
- * into the destination annotation. This method is used only
- * for nested annotation.
- *
- * @param mv the annotation visitor to populate with the stored
- * annotation
- */
- public void visit(AnnotationVisitor mv) {
- AnnotationVisitor av = mv.visitAnnotation(m_name, m_desc);
- for (SimpleAttribute simple : m_simples) {
- simple.visit(av);
- }
- for (EnumAttribute enu : m_enums) {
- enu.visit(av);
- }
- for (AnnotationDescriptor nested : m_nested) {
- nested.visit(av);
- }
- for (ArrayAttribute array : m_arrays) {
- array.visit(av);
- }
- av.visitEnd();
- }
-
-
- }
-
- /**
- * Describes an array attribute.
- * This class is able to visit an annotation array attribute, and to
- * recreate this array on another annotation.
- *
- * @author Felix Project Team
- */
- public class ArrayAttribute extends AnnotationVisitor {
- /**
- * The name of the attribute.
- */
- private String m_name;
- /**
- * The content of the parsed array.
- */
- private List