Return-Path: Delivered-To: apmail-ws-tuscany-commits-archive@locus.apache.org Received: (qmail 70920 invoked from network); 4 Apr 2008 11:26:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2008 11:26:03 -0000 Received: (qmail 34404 invoked by uid 500); 4 Apr 2008 11:26:03 -0000 Delivered-To: apmail-ws-tuscany-commits-archive@ws.apache.org Received: (qmail 34382 invoked by uid 500); 4 Apr 2008 11:26:03 -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 34373 invoked by uid 99); 4 Apr 2008 11:26:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2008 04:26:03 -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; Fri, 04 Apr 2008 11:25:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 74CCD1A9832; Fri, 4 Apr 2008 04:25:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r644682 - /incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java Date: Fri, 04 Apr 2008 11:25:39 -0000 To: tuscany-commits@ws.apache.org From: mcombellack@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080404112540.74CCD1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mcombellack Date: Fri Apr 4 04:25:36 2008 New Revision: 644682 URL: http://svn.apache.org/viewvc?rev=644682&view=rev Log: TUSCANY-2198 Added extra code to allow @OneWay notifyShipment() methods to complete Modified: incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java Modified: incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java?rev=644682&r1=644681&r2=644682&view=diff ============================================================================== --- incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java (original) +++ incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java Fri Apr 4 04:25:36 2008 @@ -24,6 +24,11 @@ * OSGi test program - declarative with scopes other than composites which use OSGi service factories */ public class FactoryTestCase extends SupplyChainTestCase { + /** + * This constant defines the time period (in milliseconds) for which we are prepared to wait for + * the @OneWay notifyShipment() callback to run. + */ + private static final long MAX_WAIT_TIME_FOR_CALLBACK = 10000; public FactoryTestCase() { super("factory-test.composite", "factory"); @@ -39,14 +44,30 @@ System.out.println("Main thread " + Thread.currentThread()); customer.purchaseBooks(); + waitForOrderShipmentNotification(); // TUSCANY-2198 notifyShipment() callback is @OneWay assertFalse(customer.hasOutstandingOrders()); customer.purchaseGames(); + waitForOrderShipmentNotification(); // TUSCANY-2198 notifyShipment() callback is @OneWay assertFalse(customer.hasOutstandingOrders()); Thread.sleep(2000); System.out.println("Test complete"); } - + + /** + * Since the notifyShipment() callback on the Customer is @OneWay, we need to allow + * some time for it to complete as it is runs asynchronously. + * + * This is for TUSCANY-2198 + */ + private void waitForOrderShipmentNotification() throws InterruptedException { + long startTime = System.currentTimeMillis(); + while (customer.hasOutstandingOrders() + && System.currentTimeMillis() - startTime < MAX_WAIT_TIME_FOR_CALLBACK) { + System.out.println("."); + Thread.sleep(100); + } + } } --------------------------------------------------------------------- To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org For additional commands, e-mail: tuscany-commits-help@ws.apache.org