You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2013/02/14 16:40:04 UTC

svn commit: r1446244 - in /felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/ipojo/ s...

Author: clement
Date: Thu Feb 14 15:40:03 2013
New Revision: 1446244

URL: http://svn.apache.org/r1446244
Log:
Migrate some core tests (bad configuration) to pax exam 3

Added:
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/pom.xml
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/resources/
    felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/pom.xml?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/pom.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/pom.xml Thu Feb 14 15:40:03 2013
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.ipojo.runtime.core-it</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.felix</groupId>
+    <artifactId>ipojo-core-bad-configuration-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <name>${project.artifactId}</name>
+
+    <properties>
+        <exam.version>3.0.0</exam.version>
+        <url.version>1.5.1</url.version>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-native</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>${exam.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.url</groupId>
+            <artifactId>pax-url-aether</artifactId>
+            <version>${url.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>4.2.0</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>0.9.6</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>0.9.6</version>
+            <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.9</version>
+            <scope>test</scope>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.ops4j.pax.tinybundles</groupId>
+            <artifactId>tinybundles</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.ipojo</artifactId>
+            <version>1.9.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
+            <version>1.9.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ow2.chameleon.testing</groupId>
+            <artifactId>osgi-helpers</artifactId>
+            <version>0.6.0</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ow2.chameleon.testing</groupId>
+            <artifactId>tinybundles-ipojo</artifactId>
+            <version>0.3.0</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.5.1</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+                <version>1.2</version>
+                <executions>
+                    <execution>
+                        <id>generate-config</id>
+                        <goals>
+                            <goal>generate-depends-file</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>
\ No newline at end of file

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,21 @@
+package org.apache.felix.ipojo.runtime.bad.components;
+
+public class BadConstructors {
+    
+    public BadConstructors() {
+        throw new Error("BAD");
+    }
+    
+    public BadConstructors(int i) {
+        // DO NOTHING
+    }
+    
+    public static BadConstructors createBad() {
+        throw new RuntimeException("BAD");
+    }
+    
+    public static BadConstructors createBad2(int o) {
+        return new BadConstructors(o);
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,68 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.components;
+
+import org.apache.felix.ipojo.runtime.bad.services.CheckService;
+import org.apache.felix.ipojo.runtime.bad.services.FooService;
+
+import java.util.Properties;
+
+public class CallbackCheckService extends ParentClass implements CheckService {
+
+    int i = 0;
+
+    FooService fs;
+
+    public static CallbackCheckService singleton;
+
+    public static int count = 0;
+
+    private static CallbackCheckService singleton() {
+        if (singleton == null) {
+            count++;
+            singleton = new CallbackCheckService();
+        }
+        return singleton;
+    }
+
+    public static CallbackCheckService several() {
+        count++;
+        return new CallbackCheckService();
+    }
+
+    private void start() {
+        i++;
+    }
+
+    protected void stop() {
+        i++;
+    }
+
+    public boolean check() {
+        return fs.foo();
+    }
+
+    public Properties getProps() {
+        Properties p = new Properties();
+        p.put("int", new Integer(i));
+        p.put("count", new Integer(count));
+        return p;
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,51 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.components;
+
+import org.apache.felix.ipojo.runtime.bad.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+public abstract class CheckProviderParentClass {
+    
+    int simpleU = 0;
+    int objectU = 0;
+    int refU = 0;
+    int bothU = 0;
+    
+    
+    public void bothUnbind(FooService o, ServiceReference sr) {
+        if(sr != null && o != null && o instanceof FooService) { bothU++; }
+    }
+    
+    public void refUnbind(ServiceReference sr) {
+        if(sr != null) { refU++; }
+    }
+    
+    public void objectUnbind(FooService o) {
+        if(o != null && o instanceof FooService) { objectU++; }
+        else {
+            System.err.println("Unbind null : " + o);
+        }
+    }
+    
+    public void voidUnbind() {
+        simpleU++;
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,83 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.components;
+
+import org.apache.felix.ipojo.runtime.bad.services.CheckService;
+import org.apache.felix.ipojo.runtime.bad.services.FooService;
+import org.osgi.framework.ServiceReference;
+
+import java.util.Properties;
+
+public class CheckServiceProvider extends CheckProviderParentClass implements CheckService {
+    
+	FooService fs;
+	
+	int simpleB = 0;
+	int objectB = 0;
+	int refB = 0;
+	int bothB = 0;
+
+	public boolean check() {
+		return fs.foo();
+	}
+
+	public Properties getProps() {
+		Properties props = new Properties();
+		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));
+		if (fs != null) {
+		    props.put("result", new Boolean(fs.foo()));
+		    props.put("boolean", new Boolean(fs.getBoolean()));
+		    props.put("int", new Integer(fs.getInt()));
+		    props.put("long", new Long(fs.getLong()));
+		    props.put("double", new Double(fs.getDouble()));
+		    if(fs.getObject() != null) { props.put("object", fs.getObject()); }
+		}
+        props.put("static", CheckService.foo);
+        props.put("class", CheckService.class.getName());
+		return props;
+	}
+	
+	private void voidBind() {
+		simpleB++;
+	}
+	
+	protected void objectBind(FooService o) {
+	    if (o == null) {
+	        System.err.println("Bind receive null !!! ");
+	        return;
+	    }
+		if(o != null && o instanceof FooService) { objectB++; }
+	}
+	
+	public void refBind(ServiceReference sr) {
+		if(sr != null) { refB++; }
+	}
+	
+    public void bothBind(FooService o, ServiceReference sr) {
+	    if(sr != null && o != null && o instanceof FooService) { bothB++; }
+	}
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,49 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.components;
+
+import org.apache.felix.ipojo.runtime.bad.services.CheckService;
+
+import java.util.Properties;
+
+public class LifecycleControllerTest implements CheckService {
+    
+    private boolean m_state = true;
+    private String m_conf;
+    
+    public void setConf(String newConf) {
+        if (newConf.equals("foo")) {
+            m_state = true;
+        } else {
+            m_state = false;
+        }
+    }
+
+    public boolean check() {
+        return m_state;
+    }
+
+    public Properties getProps() {
+       Properties props = new Properties();
+       props.put("conf", m_conf);
+       props.put("state", new Boolean(m_state));
+       return props;
+    }
+}
+

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,51 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.components;
+
+public class ParentClass {
+    
+    public void parentStart() {
+        
+    }
+    
+    public void parentStop() {
+        
+    }
+	
+	protected String[] strings;
+	
+	protected String string;
+	
+	protected int upStrings;
+	
+	protected int upString;
+	
+	public void updateStrings(String[] bb) {
+        strings = bb;
+        upStrings++;
+    }
+    
+    public void updateString(String bb) {
+        string = bb;
+        upString++;
+    }
+	
+	
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,29 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.services;
+
+import java.util.Properties;
+
+public interface BarService {
+	
+	public boolean bar();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,31 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.services;
+
+import java.util.Properties;
+
+public interface CheckService {
+    
+    public static final String foo = "foo";
+	
+	public boolean check();
+	
+	public Properties getProps();
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,39 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.services;
+
+import java.util.Properties;
+
+public interface FooService {
+
+	boolean foo();
+	
+	Properties fooProps();
+	
+	Boolean getObject();
+	
+	boolean getBoolean();
+	
+	int getInt();
+	
+	long getLong();
+	
+	double getDouble();
+	
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml Thu Feb 14 15:40:03 2013
@@ -0,0 +1,52 @@
+<ipojo>
+	<!-- No XSD as this file violates the format -->
+	<component
+		className="org.apache.felix.ipojo.runtime.bad.components.CallbackCheckService"
+		name="BAD-CallbackCheckService" architecture="true">
+		<requires field="fs" />
+		<provides />
+		<callback transition="validate" method="start" />
+		<callback transition="invalidate" method="stop" />
+	</component>
+	
+	<component
+		classname="org.apache.felix.ipojo.runtime.bad.components.LifecycleControllerTest"
+		name="BAD-lcTest">
+		<provides />
+		<controller field="m_state" />
+		<properties>
+			<property name="conf" field="m_conf" method="setConf" />
+		</properties>
+	</component>
+	
+	<component
+		className="org.apache.felix.ipojo.runtime.bad.components.CheckServiceProvider"
+		name="BAD-BothCheckServiceProvider" architecture="true">
+		<requires field="fs">
+			<callback type="bind" method="bothBind" />
+			<callback type="unbind" method="bothUnbind" />
+		</requires>
+		<provides />
+	</component>
+	
+	<!-- Bad constructors -->
+	<component 
+		className="org.apache.felix.ipojo.runtime.bad.components.BadConstructors"
+		name="BAD-BadConstructor"
+		immediate="true"
+	/>
+	
+	<component
+		className="org.apache.felix.ipojo.runtime.bad.components.BadConstructors"
+		factory-method="createBad"
+		name="BAD-BadFactory"
+		immediate="true"
+	/>
+	
+	<component
+		className="org.apache.felix.ipojo.runtime.bad.components.BadConstructors"
+		factory-method="createBad2"
+		name="BAD-BadFactory2"
+		immediate="true"
+	/>
+</ipojo>

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,146 @@
+package org.apache.felix.ipojo.runtime.bad.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.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 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 MalformedURLException {
+        Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
+        root.setLevel(Level.INFO);
+
+        return options(
+                ipojoBundles(),
+                junitBundles(),
+                testedBundle(),
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+        );
+    }
+
+    @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 CompositeOption ipojoBundles() {
+        return new DefaultCompositeOption(
+                mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
+                mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").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<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
+        List<File> services = new ArrayList<File>();
+        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");
+        }
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,140 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.test;
+
+import org.apache.felix.ipojo.*;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class TestBadFactories extends Common {
+
+    private Element getElementFactoryWithNoClassName() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("name", "noclassname"));
+        return elem;
+    }
+
+    private Element getElementHandlerFactoryWithNoClassName() {
+        Element elem = new Element("handler", "");
+        elem.addAttribute(new Attribute("name", "noclassname"));
+        return elem;
+    }
+
+    private Element getElementHandlerFactoryWithNoName() {
+        Element elem = new Element("handler", "");
+        elem.addAttribute(new Attribute("className", "noclassname"));
+        return elem;
+    }
+
+    @Test
+    public void testBadFactory() {
+        try {
+            new ComponentFactory(osgiHelper.getContext(), getElementFactoryWithNoClassName());
+            fail("A factory with no class name must be rejected");
+        } catch (ConfigurationException e) {
+            // OK.
+        }
+    }
+
+    @Test
+    public void testBadHandlerFactory1() {
+        try {
+            new HandlerManagerFactory(osgiHelper.getContext(), getElementHandlerFactoryWithNoClassName());
+            fail("An handler factory with no class name must be rejected");
+        } catch (ConfigurationException e) {
+            // OK.
+        }
+    }
+
+    @Test
+    public void testBadHandlerFactory2() {
+        try {
+            new HandlerManagerFactory(osgiHelper.getContext(), getElementHandlerFactoryWithNoName());
+            fail("An handler factory with no name must be rejected");
+        } catch (ConfigurationException e) {
+            // OK.
+        }
+    }
+
+    @Test
+    public void testCreationOnBadConstructor() {
+        Factory factory = ipojoHelper.getFactory("BAD-BadConstructor");
+        ComponentInstance ci;
+        try {
+            // Change in Felix-966, now throws a runtime exception
+            ci = factory.createComponentInstance(null);
+            //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+            ci.dispose();
+            fail("Exception expected");
+        } catch (Throwable e) {
+            //fail("Exception unexpected : " + e.getMessage());
+            // OK
+        }
+    }
+
+    @Test
+    public void testCreationOnBadFactory() {
+        Factory factory = ipojoHelper.getFactory("BAD-BadFactory");
+        ComponentInstance ci;
+        try {
+            // Change in Felix-966, now throw a runtime exception
+            ci = factory.createComponentInstance(null);
+            //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+            ci.dispose();
+            fail("Exception expected");
+        } catch (Throwable e) {
+            //fail("Exception unexpected : " + e.getMessage());
+            //OK
+        }
+    }
+
+    @Test
+    public void testCreationOnBadFactory2() {
+        Factory factory = ipojoHelper.getFactory("BAD-BadFactory2");
+        ComponentInstance ci;
+        try {
+            // Change in Felix-966, now throw a runtime exception
+            ci = factory.createComponentInstance(null);
+            //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState());
+            ci.dispose();
+            fail("Exception expected");
+        } catch (Throwable e) {
+            //fail("Exception unexpected : " + e.getMessage());
+            //Ok
+        }
+    }
+
+    @Test
+    public void testNoManipulationMetadata() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService"));
+        try {
+            ComponentFactory fact = new ComponentFactory(osgiHelper.getContext(), elem);
+            fact.stop();
+            fail("A factory with no manipulation metadata must be rejected");
+        } catch (ConfigurationException e) {
+            // OK.
+        }
+    }
+
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,261 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.test;
+
+import org.apache.felix.ipojo.*;
+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 java.util.Properties;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestBadLFCCallback extends Common {
+
+    private String clazz = "org.apache.felix.ipojo.runtime.bad.components.CallbackCheckService";
+    private String type = "BAD-CallbackCheckService";
+    private Element manipulation;
+    private Properties props;
+
+    @Before
+    public void setUp() {
+        manipulation = getManipulationForComponent();
+        props = new Properties();
+        props.put("instance.name", "BAD");
+    }
+
+
+    private Element getNothing() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getNoTransition() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        callback.addAttribute(new Attribute("method", "start"));
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getNoMethod() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        callback.addAttribute(new Attribute("transition", "validate"));
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadMethod() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        callback.addAttribute(new Attribute("transition", "validate"));
+        callback.addAttribute(new Attribute("method", "start_")); // Missing method.
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadMethod2() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        callback.addAttribute(new Attribute("transition", "invalidate"));
+        callback.addAttribute(new Attribute("method", "stop_")); // Missing method.
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadTransition() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("callback", "");
+        callback.addAttribute(new Attribute("method", "start"));
+        callback.addAttribute(new Attribute("transition", "validate_"));
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getManipulationForComponent() {
+        String header = testedBundle.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, type);
+        assertNotNull("Check manipulation metadata not null for " + type, manip);
+        return manip;
+    }
+
+    private Element getManipulationForComponent(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].getElements("manipulation")[0];
+            }
+            if (comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) {
+                return comps[i].getElements("manipulation")[0];
+            }
+        }
+        return null;
+    }
+
+    @Test
+    public void testNothing() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNothing());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A lifecycle callback with a missing method and transition must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoTransition() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoTransition());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A lifecycle callback with a missing transition must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoMethod() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoMethod());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A lifecycle callback with a missing method must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadMethod() {
+        try {
+            ComponentFactory cf = new ComponentFactory(testedBundle.getBundleContext(), getBadMethod());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            if (ci.isStarted()) {
+                fail("A lifecycle callback with a bad method must be rejected (instance stills valid)" + cf);
+            }
+            ci.dispose();
+            cf.stop();
+        } catch (ConfigurationException e) {
+            //The check does not happen in the configure method.
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadMethod2() {
+        try {
+            ComponentFactory cf = new ComponentFactory(testedBundle.getBundleContext(), getBadMethod2());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.stop();
+            if (ci.isStarted()) {
+                fail("A lifecycle callback with a bad method must be rejected (instance stills valid)" + cf);
+            }
+            ci.dispose();
+            cf.stop();
+        } catch (ConfigurationException e) {
+            //The check does not happen in the configure method.
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadTransition() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadTransition());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A lifecycle callback with a bad transition must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,105 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.test;
+
+import org.apache.felix.ipojo.ComponentFactory;
+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.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestBadLFCController extends Common {
+
+    private String clazz = "org.apache.felix.ipojo.test.scenarios.component.LifecycleControllerTest";
+
+    private Element getNoFieldController() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element controller = new Element("controller", "");
+        elem.addElement(controller);
+        return elem;
+    }
+
+    private Element getBadFieldController() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element controller = new Element("controller", "");
+        controller.addAttribute(new Attribute("field", "controller")); // Missing field
+        elem.addElement(controller);
+        elem.addElement(getManipulationForComponent("BAD-lcTest"));
+        return elem;
+    }
+
+    private Element getManipulationForComponent(String comp_name) {
+        String header = testedBundle.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 getManipulationForComponent(Element metadata, String comp_name) {
+        Element[] comps = metadata.getElements("component");
+        for (Element comp : comps) {
+            if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) {
+                return comp.getElements("manipulation")[0];
+            }
+        }
+        return null;
+    }
+
+    @Test
+    public void testNoField() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoFieldController());
+            cf.start();
+            cf.stop();
+            fail("A lifecycle controller with a missing field must be rejected " + cf);
+        } catch (Exception e) {
+            // OK
+        }
+    }
+
+    @Test
+    public void testBadField() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFieldController());
+            cf.start();
+            cf.stop();
+            fail("A lifecycle controller with a bad field must be rejected " + cf);
+        } catch (Exception e) {
+            // OK
+        }
+    }
+
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java?rev=1446244&view=auto
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java (added)
+++ felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java Thu Feb 14 15:40:03 2013
@@ -0,0 +1,254 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * 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.bad.test;
+
+import org.apache.felix.ipojo.*;
+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.apache.felix.ipojo.runtime.bad.services.BarService;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Properties;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class TestBadServiceDependencies extends Common {
+
+    private String clazz = "org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider";
+    private String type = "BAD-BothCheckServiceProvider";
+    private Element manipulation;
+    private Properties props;
+
+    @Before
+    public void setUp() {
+        manipulation = getManipulationForComponent();
+        props = new Properties();
+        props.put("instance.name", "BAD");
+    }
+
+
+    private Element getNothing() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getNoField() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        callback.addAttribute(new Attribute("filter", "(foo=bar)"));
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadField() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        callback.addAttribute(new Attribute("field", "BAD_FIELD")); // missing field.
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadFilter() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        callback.addAttribute(new Attribute("field", "fs"));
+        callback.addAttribute(new Attribute("filter", "(foo=bar)&(bar=foo)")); // Incorrect filter
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadFrom() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        callback.addAttribute(new Attribute("field", "fs"));
+        callback.addAttribute(new Attribute("from", "ba(d&_")); // Incorrect from
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getBadType() {
+        Element elem = new Element("component", "");
+        elem.addAttribute(new Attribute("classname", clazz));
+
+        Element callback = new Element("requires", "");
+        callback.addAttribute(new Attribute("field", "fs"));
+        callback.addAttribute(new Attribute("interface", BarService.class.getName()));
+        elem.addElement(callback);
+        elem.addElement(manipulation);
+        return elem;
+    }
+
+    private Element getManipulationForComponent() {
+        String header = testedBundle.getHeaders().get("iPOJO-Components");
+        Element elem = null;
+        try {
+            elem = ManifestMetadataParser.parse(header);
+        } catch (ParseException e) {
+            fail("Parse Exception when parsing iPOJO-Component");
+        }
+
+        assertNotNull("Check elem not null", elem);
+
+        Element manip = getManipulationForComponent(elem, type);
+        assertNotNull("Check manipulation metadata not null for " + type, manip);
+        return manip;
+    }
+
+    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;
+    }
+
+    @Test
+    public void testNothing() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNothing());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with neither field and method must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testNoField() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoField());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with neither field and method must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadField() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadField());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with a bad field must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadFilter() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFilter());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with a bad filter must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            //OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadFrom() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFrom());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with a bad from must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            //OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testBadType() {
+        try {
+            ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadType());
+            cf.start();
+            ComponentInstance ci = cf.createComponentInstance(props);
+            ci.dispose();
+            cf.stop();
+            fail("A service requirement with a bad type must be rejected " + cf);
+        } catch (ConfigurationException e) {
+            // OK
+        } catch (UnacceptableConfiguration e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        } catch (MissingHandlerException e) {
+            fail("Unexpected exception when creating an instance : " + e.getMessage());
+        }
+    }
+}

Added: felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/src/it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties?rev=1446244&view=auto
==============================================================================
    (empty)