You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by mc...@apache.org on 2008/04/04 13:25:39 UTC
svn commit: r644682 -
/incubator/tuscany/java/sca/itest/osgi-implementation/src/test/java/supplychain/factory/FactoryTestCase.java
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