Fix the issue Felix-697
Check the unicity of method flag field.
Add the tests case provided by Loris in the test suite.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@693520 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/tests/manipulator/manipulation/pom.xml b/ipojo/tests/manipulator/manipulation/pom.xml
index ff3dc39..84e16c1 100644
--- a/ipojo/tests/manipulator/manipulation/pom.xml
+++ b/ipojo/tests/manipulator/manipulation/pom.xml
@@ -93,8 +93,8 @@
 				<groupId>org.apache.maven.plugins</groupId>

 				<artifactId>maven-compiler-plugin</artifactId>

 				<configuration>

-					<source>1.4</source>

-					<target>1.4</target>

+					<source>1.5</source>

+					<target>1.5</target>

 				</configuration>

 			</plugin>

 		</plugins>

diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java
new file mode 100644
index 0000000..005dc0c
--- /dev/null
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/component/PlopImpl.java
@@ -0,0 +1,11 @@
+package org.apache.felix.ipojo.test.scenarios.component;
+
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.Plop;
+//TODO this test requires source compatibility 1.5
+public class PlopImpl implements Plop {
+
+    public String getPlop() {
+        return "plop";
+    }
+
+}
diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java
new file mode 100644
index 0000000..439135c
--- /dev/null
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/DuplicateMethod.java
@@ -0,0 +1,22 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation;
+
+import org.apache.felix.ipojo.ComponentInstance;
+import org.apache.felix.ipojo.junit4osgi.OSGiTestCase;
+import org.apache.felix.ipojo.test.scenarios.manipulation.service.Plop;
+import org.apache.felix.ipojo.test.scenarios.util.Utils;
+import org.osgi.framework.ServiceReference;
+
+public class DuplicateMethod extends OSGiTestCase {
+    
+    
+    public void testDuplicateMethod() {
+        ComponentInstance instance = Utils.getComponentInstanceByName(context, "plopimpl", "plop");
+        ServiceReference ref = Utils.getServiceReferenceByName(context, Plop.class.getName(), "plop");
+        assertNotNull("Check plop", ref);
+        Plop plop = (Plop) context.getService(ref);
+        Object o = plop.getPlop();
+        assertEquals("Check result", "plop", o);
+        context.ungetService(ref);
+        instance.dispose();
+    }
+}
diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
index 5258e1b..cb5f92d 100644
--- a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/ManipulationTestSuite.java
@@ -35,6 +35,7 @@
         ots.addTestSuite(ExceptionTest.class);

         ots.addTestSuite(POJOCreation.class);

         ots.addTestSuite(NestedClassesTests.class);

+        ots.addTestSuite(DuplicateMethod.class);

 		return ots;

 	}

 

diff --git a/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java
new file mode 100644
index 0000000..1bb177c
--- /dev/null
+++ b/ipojo/tests/manipulator/manipulation/src/main/java/org/apache/felix/ipojo/test/scenarios/manipulation/service/Plop.java
@@ -0,0 +1,7 @@
+package org.apache.felix.ipojo.test.scenarios.manipulation.service;
+
+public interface Plop {
+    
+   Object getPlop();
+
+}
diff --git a/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml b/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml
index 81053f8..0a467ea 100644
--- a/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml
+++ b/ipojo/tests/manipulator/manipulation/src/main/resources/metadata.xml
@@ -115,4 +115,9 @@
 			<property field="publicInt"/>

 		</provides>

 	</component>

+	

+	<!-- Check duplicate method issue -->

+	<component classname="org.apache.felix.ipojo.test.scenarios.component.PlopImpl" name="plopimpl">

+		<provides></provides>

+	</component>

 </ipojo>