Return-Path: Delivered-To: apmail-ws-tuscany-commits-archive@locus.apache.org Received: (qmail 74334 invoked from network); 3 Apr 2008 15:33:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 15:33:41 -0000 Received: (qmail 30082 invoked by uid 500); 3 Apr 2008 15:33:39 -0000 Delivered-To: apmail-ws-tuscany-commits-archive@ws.apache.org Received: (qmail 30066 invoked by uid 500); 3 Apr 2008 15:33:39 -0000 Mailing-List: contact tuscany-commits-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tuscany-dev@ws.apache.org Delivered-To: mailing list tuscany-commits@ws.apache.org Received: (qmail 29799 invoked by uid 99); 3 Apr 2008 15:33:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 08:33:38 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 15:32:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5D6711A983E; Thu, 3 Apr 2008 08:33:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r644365 - /incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java Date: Thu, 03 Apr 2008 15:33:14 -0000 To: tuscany-commits@ws.apache.org From: mcombellack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080403153315.5D6711A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mcombellack Date: Thu Apr 3 08:33:13 2008 New Revision: 644365 URL: http://svn.apache.org/viewvc?rev=644365&view=rev Log: SDE-2194 Added test case to ensure that the exception thrown when there is a duplicate method on a @Remotable interface contains both the class name and the method name Modified: incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java Modified: incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java?rev=644365&r1=644364&r2=644365&view=diff ============================================================================== --- incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java (original) +++ incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java Thu Apr 3 08:33:13 2008 @@ -22,14 +22,19 @@ import java.util.ArrayList; import java.util.List; +import junit.framework.Assert; import junit.framework.TestCase; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.Interface; +import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.OverloadedOperationException; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; +import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.osoa.sca.annotations.Remotable; /** @@ -177,6 +182,47 @@ // Return the created operation return operation; } + + /** + * Test case that validates that a @Remotable interface with Overloaded operations + * is detected. + * + * This test case is for TUSCANY-2194 + */ + public void testDuplicateOpeartionOnRemotableInterface() + { + JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(); + JavaInterfaceIntrospectorImpl introspector = new JavaInterfaceIntrospectorImpl(javaFactory); + JavaInterfaceImpl javaInterface = new JavaInterfaceImpl(); + + try { + introspector.introspectInterface(javaInterface, DuplicateMethodOnRemotableInterface.class); + Assert.fail("Should have thrown an exception as @Remotable interface has overloaded methods"); + } catch (OverloadedOperationException ex) { + // As expected + // Make sure that the class and method names are in the exception + String exMsg = ex.toString(); + Assert.assertTrue("Method name missing from exception", exMsg.indexOf("aDuplicateMethod") != -1); + Assert.assertTrue("Class name missing from exception", + exMsg.indexOf(DuplicateMethodOnRemotableInterface.class.getName()) != -1); + } catch (InvalidInterfaceException ex) { + // Should have thrown OverloadedOperationException + Assert.fail("Should have thrown an OverloadedOperationException but threw " + ex); + } + } + + + /** + * Sample @Remotable interface that has an overloaded operation which is not + * allowed according to the SCA Assembly Specification. + */ + @Remotable + private interface DuplicateMethodOnRemotableInterface { + void aNonDuplicateMethod(); + void aDuplicateMethod(); + void aDuplicateMethod(String aParam); + } + /** * Sample interface needed for the unit tests --------------------------------------------------------------------- To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org For additional commands, e-mail: tuscany-commits-help@ws.apache.org