[jboss-cvs] JBossAS SVN: r88755 - in projects/jboss-osgi/trunk/testsuite/trailblazer: scripts and 14 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 12:17:20 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-12 12:17:20 -0400 (Tue, 12 May 2009)
New Revision: 88755

Added:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ShoppingMallImpl.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd
Removed:
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java
Modified:
   projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
   projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd
   projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd
Log:
Add paypal payment to trailblazer

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml	2009-05-12 16:17:20 UTC (rev 88755)
@@ -17,9 +17,6 @@
   <!-- Properties -->
   <properties>
     <trailblazer.java.path>https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer</trailblazer.java.path>
-    <climbingstore.java>${trailblazer.java.path}/shop/sports/ClimbingStore.java</climbingstore.java>
-    <shoppingmall.java>${trailblazer.java.path}/ShoppingMall.java</shoppingmall.java>
-    <shop.java>${trailblazer.java.path}/Shop.java</shop.java>
     <userguide.html>http://jbmuc.dyndns.org:8280/hudson/job/jbossosgi-jdk16/ws/jboss-osgi/build/distribution/target/auto-install-dest/docs/userguide/html</userguide.html>
   </properties>
 

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml	2009-05-12 16:17:20 UTC (rev 88755)
@@ -49,6 +49,9 @@
     <!-- pay-creditcard -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-pay-creditcard.jar" files="${tests.resources.dir}/trailblazer/pay-creditcard.bnd" />
   	
+    <!-- pay-paypal -->
+    <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-pay-paypal.jar" files="${tests.resources.dir}/trailblazer/pay-paypal.bnd" />
+  	
     <!-- shop-sports -->
     <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-shop-sports.jar" files="${tests.resources.dir}/trailblazer/shop-sports.bnd" />
   	

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,17 +0,0 @@
-package org.jboss.test.osgi.trailblazer;
-
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface AuditService
-{
-   int getTotalPurchases();
-
-   void purchaseProduct(Product product);
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,14 +0,0 @@
-package org.jboss.test.osgi.trailblazer;
-
-import java.util.Collection;
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface PaymentService
-{
-   Collection<String> listPaymentTypes();
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,41 +0,0 @@
-package org.jboss.test.osgi.trailblazer;
-
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-/**
- * A {@link Shop} represents and individual shop implementation.
- * <p/> 
- * The trailblazer supports multiple shops. Each shop maintains a collection of
- * {@link Products}s and a {@link PaymentService}
- * <p/>
- * Shops can get registered and unregistered at any time. 
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface Shop
-{
-   /**
-    * Get the name of the shop
-    */
-   String getName();
-   
-   /**
-    * Get the product list
-    * @return an empty collection if there are no products
-    */
-   Collection<Product> getProductList();
-   
-   /**
-    * Get a product by name
-    * @return null if the product does not exist
-    */
-   Product getProductByName(String name);
-   
-   /**
-    * Get the associated payment service. 
-    */
-   PaymentService getPaymentService();
-}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,29 +0,0 @@
-package org.jboss.test.osgi.trailblazer;
-
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.types.Product;
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public interface ShoppingMall
-{
-   /**
-    * Get the collection of currently registered shops. 
-    */
-   Collection<Shop> getShops();
-
-   /**
-    * Get a shop by name. 
-    */
-   Shop getShopByName(String shopName);
-   
-   /**
-    * Purchase a product
-    */
-   void purchaseProduct(Product product);
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/audit/AuditService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,17 @@
+package org.jboss.test.osgi.trailblazer.audit;
+
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface AuditService
+{
+   int getTotalPurchases();
+
+   void purchaseProduct(Product product);
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -35,7 +35,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpService;
@@ -110,7 +110,7 @@
          else if (path.startsWith("/clear"))
          {
             reqHandler.actionClearProducts(req, res);
-            reqHandler.renderCartPage(req, res);
+            res.sendRedirect(req.getServletPath() + "/cart");
          }
          else if (path.startsWith("/checkout"))
          {
@@ -185,9 +185,12 @@
       
       String notesPath = "notes" + path;
       
-      String paramShop = req.getParameter("shop");
-      if (paramShop != null)
-         notesPath += "-" + paramShop;
+      if (path.equals("/list"))
+      {
+         String paramShop = req.getParameter("shop");
+         if (paramShop != null)
+            notesPath += "-" + paramShop;
+      }
       
       notesPath = notesPath.toLowerCase() + ".html";
       

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -31,9 +31,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.jboss.test.osgi.trailblazer.PaymentService;
-import org.jboss.test.osgi.trailblazer.Shop;
-import org.jboss.test.osgi.trailblazer.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.jboss.test.osgi.trailblazer.types.Product;
 
 /**
@@ -68,7 +68,7 @@
       }
       else
       {
-         out.println("<p>No active shops, please try later.</p>");
+         out.println("No active shops, please try later.");
       }
    }
 
@@ -93,6 +93,17 @@
          out.println("</tr>");
       }
       out.println("</table>");
+      out.println("<p/>");
+      
+      PaymentService payService = shop.getPaymentService();
+      if (payService != null)
+      {
+         out.println("Supported payments: ");
+         for (String type : payService.listPaymentTypes())
+         {
+            out.println(type + "&nbsp;");
+         }
+      }
    }
 
    public void renderCartPage(HttpServletRequest req, HttpServletResponse res) throws IOException
@@ -105,7 +116,7 @@
       Set<Shop> shops = shoppingCart.getShops();
       if (shops.size() == 0)
       {
-         out.println("<p>Your shopping cart is empty</p>");
+         out.println("Your shopping cart is empty");
          return;
       }
 
@@ -145,7 +156,7 @@
          }
          else
          {
-            out.println("<p>Payment service not available, please try later.</p>");
+            out.println("Payment service not available, please try later.");
          }
       }
    }
@@ -154,7 +165,7 @@
    {
       PrintWriter out = res.getWriter();
       Shop shop = getShopFromRequestParam(req);
-      out.println("<p>Thanks for shopping with " + shop.getName() + "</p>");
+      out.println("Thanks for shopping with " + shop.getName());
    }
 
    public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -32,7 +32,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.jboss.test.osgi.trailblazer.types.Product;
 
 /**

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.trailblazer.mall;
-
-//$Id$
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.ShoppingMall;
-import org.jboss.test.osgi.trailblazer.frontend.HttpRenderServlet;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.http.HttpService;
-import org.osgi.service.log.LogService;
-
-/**
- * A bundle activator that registers the {@link HttpRenderServlet} with the {@link HttpService}
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public class ServiceActivator implements BundleActivator
-{
-   private LogService log;
-   private ServiceRegistration registration;
-   
-   public void start(BundleContext context)
-   {
-      this.log = new LogServiceTracker(context);
-      
-      log.log(LogService.LOG_INFO, "Register ShoppingMallService");
-      ShoppingMallImpl mallService = new ShoppingMallImpl(context);
-      registration = context.registerService(ShoppingMall.class.getName(), mallService, null);
-   }
-
-   public void stop(BundleContext context)
-   {
-      if (registration  != null)
-      {
-         log.log(LogService.LOG_INFO, "Unregister ShoppingMallService");
-         registration.unregister();
-         registration = null;
-      }
-   }
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMall.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,30 @@
+package org.jboss.test.osgi.trailblazer.mall;
+
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.shop.Shop;
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface ShoppingMall
+{
+   /**
+    * Get the collection of currently registered shops. 
+    */
+   Collection<Shop> getShops();
+
+   /**
+    * Get a shop by name. 
+    */
+   Shop getShopByName(String shopName);
+   
+   /**
+    * Purchase a product
+    */
+   void purchaseProduct(Product product);
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.trailblazer.mall;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.AuditService;
-import org.jboss.test.osgi.trailblazer.PaymentService;
-import org.jboss.test.osgi.trailblazer.Shop;
-import org.jboss.test.osgi.trailblazer.ShoppingMall;
-import org.jboss.test.osgi.trailblazer.frontend.HttpRenderServlet;
-import org.jboss.test.osgi.trailblazer.types.Product;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpService;
-
-/**
- * A bundle activator that registers the {@link HttpRenderServlet} with the {@link HttpService}
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public class ShoppingMallImpl implements ShoppingMall
-{
-   private BundleContext context;
-   
-   public ShoppingMallImpl(BundleContext context)
-   {
-      this.context = context;
-   }
-
-   public Shop getShopByName(String shopName)
-   {
-      Shop shop = null;
-      for (Shop aux : getShops())
-      {
-         if (aux.getName().equals(shopName))
-         {
-            shop = aux;
-            break;
-         }
-      }
-      return shop;
-   }
-
-   public Collection<Shop> getShops()
-   {
-      Collection<Shop> shops = new ArrayList<Shop>();
-      try
-      {
-         ServiceReference[] shoprefs = context.getServiceReferences(Shop.class.getName(), null);
-         if (shoprefs != null)
-         {
-            for(ServiceReference sref : shoprefs)
-            {
-               shops.add((Shop)context.getService(sref));
-            }
-         }
-      }
-      catch (InvalidSyntaxException ex)
-      {
-         // ignore, because we don't have a filter
-      }
-      return shops;
-   }
-
-   public void purchaseProduct(Product product)
-   {
-      Shop shop = product.getShop();
-      PaymentService paymentService = shop.getPaymentService();
-      if (paymentService == null)
-         throw new IllegalStateException("Payment service not available");
-      
-      ServiceReference sref = context.getServiceReference(AuditService.class.getName());
-      if (sref != null)
-      {
-         AuditService auditService = (AuditService)context.getService(sref);
-         auditService.purchaseProduct(product);
-      }
-   }
-   
-}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ServiceActivator.java (from rev 88719, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ServiceActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer.mall.internal;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.frontend.HttpRenderServlet;
+import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+
+/**
+ * A bundle activator that registers the {@link HttpRenderServlet} with the {@link HttpService}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+   private LogService log;
+   private ServiceRegistration registration;
+   
+   public void start(BundleContext context)
+   {
+      this.log = new LogServiceTracker(context);
+      
+      log.log(LogService.LOG_INFO, "Register ShoppingMallService");
+      ShoppingMallImpl mallService = new ShoppingMallImpl(context);
+      registration = context.registerService(ShoppingMall.class.getName(), mallService, null);
+   }
+
+   public void stop(BundleContext context)
+   {
+      if (registration  != null)
+      {
+         log.log(LogService.LOG_INFO, "Unregister ShoppingMallService");
+         registration.unregister();
+         registration = null;
+      }
+   }
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ShoppingMallImpl.java (from rev 88719, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ShoppingMallImpl.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/internal/ShoppingMallImpl.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer.mall.internal;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.audit.AuditService;
+import org.jboss.test.osgi.trailblazer.mall.ShoppingMall;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
+import org.jboss.test.osgi.trailblazer.types.Product;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An implementation of {@link ShoppingMall}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class ShoppingMallImpl implements ShoppingMall
+{
+   private BundleContext context;
+   
+   public ShoppingMallImpl(BundleContext context)
+   {
+      this.context = context;
+   }
+
+   public Shop getShopByName(String shopName)
+   {
+      Shop shop = null;
+      for (Shop aux : getShops())
+      {
+         if (aux.getName().equals(shopName))
+         {
+            shop = aux;
+            break;
+         }
+      }
+      return shop;
+   }
+
+   public Collection<Shop> getShops()
+   {
+      Collection<Shop> shops = new ArrayList<Shop>();
+      try
+      {
+         ServiceReference[] shoprefs = context.getServiceReferences(Shop.class.getName(), null);
+         if (shoprefs != null)
+         {
+            for(ServiceReference sref : shoprefs)
+            {
+               shops.add((Shop)context.getService(sref));
+            }
+         }
+      }
+      catch (InvalidSyntaxException ex)
+      {
+         // ignore, because we don't have a filter
+      }
+      return shops;
+   }
+
+   public void purchaseProduct(Product product)
+   {
+      Shop shop = product.getShop();
+      PaymentService paymentService = shop.getPaymentService();
+      if (paymentService == null)
+         throw new IllegalStateException("Payment service not available");
+      
+      ServiceReference sref = context.getServiceReference(AuditService.class.getName());
+      if (sref != null)
+      {
+         AuditService auditService = (AuditService)context.getService(sref);
+         auditService.purchaseProduct(product);
+      }
+   }
+   
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/PaymentService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,14 @@
+package org.jboss.test.osgi.trailblazer.pay;
+
+import java.util.Collection;
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface PaymentService
+{
+   Collection<String> listPaymentTypes();
+}
\ No newline at end of file

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,24 @@
+package org.jboss.test.osgi.trailblazer.pay.creditcard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class CreditCardService implements PaymentService
+{
+   public Collection<String> listPaymentTypes()
+   {
+      ArrayList<String> list = new ArrayList<String>();
+      list.add("Visa");
+      list.add("MasterCard");
+      return list;
+   }
+}
\ No newline at end of file

Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,24 +0,0 @@
-package org.jboss.test.osgi.trailblazer.pay.creditcard;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.jboss.test.osgi.trailblazer.PaymentService;
-
-
-/**
- * [TODO]
- * 
- * @author thomas.diesler at jboss.com
- * @since 10-May-2009
- */
-public class CreditCardServiceImpl implements PaymentService
-{
-   public Collection<String> listPaymentTypes()
-   {
-      ArrayList<String> list = new ArrayList<String>();
-      list.add("Visa");
-      list.add("MasterCard");
-      return list;
-   }
-}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -23,8 +23,10 @@
 
 //$Id$
 
+import java.util.Hashtable;
+
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.PaymentService;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -42,19 +44,23 @@
    private LogService log;
    private ServiceRegistration serviceReg;
    
+   @SuppressWarnings("unchecked")
    public void start(BundleContext context)
    {
       this.log = new LogServiceTracker(context);
       
-      log.log(LogService.LOG_INFO, "Register the PaymentService");
-      serviceReg = context.registerService(PaymentService.class.getName(), new CreditCardServiceImpl(), null);
+      Hashtable props = new Hashtable();
+      props.put("type", "credit");
+      
+      serviceReg = context.registerService(PaymentService.class.getName(), new CreditCardService(), props);
+      log.log(LogService.LOG_INFO, "Register the CreditCardService");
    }
 
    public void stop(BundleContext context)
    {
       if (serviceReg != null)
       {
-         log.log(LogService.LOG_INFO, "Unregister the PaymentService");
+         log.log(LogService.LOG_INFO, "Unregister the CreditCardService");
          serviceReg.unregister();
          serviceReg = null;
       }

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,23 @@
+package org.jboss.test.osgi.trailblazer.pay.paypal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class PayPalService implements PaymentService
+{
+   public Collection<String> listPaymentTypes()
+   {
+      ArrayList<String> list = new ArrayList<String>();
+      list.add("PayPal");
+      return list;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/PayPalService.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.trailblazer.pay.paypal;
+
+//$Id$
+
+import java.util.Hashtable;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.log.LogService;
+
+
+/**
+ * [TODO]
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+   private LogService log;
+   private ServiceRegistration serviceReg;
+   
+   @SuppressWarnings("unchecked")
+   public void start(BundleContext context)
+   {
+      this.log = new LogServiceTracker(context);
+      
+      Hashtable props = new Hashtable();
+      props.put("type", "paypal");
+      
+      serviceReg = context.registerService(PaymentService.class.getName(), new PayPalService(), props);
+      log.log(LogService.LOG_INFO, "Register the PayPalService");
+   }
+
+   public void stop(BundleContext context)
+   {
+      if (serviceReg != null)
+      {
+         log.log(LogService.LOG_INFO, "Unregister the PayPalService");
+         serviceReg.unregister();
+         serviceReg = null;
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/paypal/ServiceActivator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/Shop.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,42 @@
+package org.jboss.test.osgi.trailblazer.shop;
+
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+/**
+ * A {@link Shop} represents and individual shop implementation.
+ * <p/> 
+ * The trailblazer supports multiple shops. Each shop maintains a collection of
+ * {@link Products}s and a {@link PaymentService}
+ * <p/>
+ * Shops can get registered and unregistered at any time. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 10-May-2009
+ */
+public interface Shop
+{
+   /**
+    * Get the name of the shop
+    */
+   String getName();
+   
+   /**
+    * Get the product list
+    * @return an empty collection if there are no products
+    */
+   Collection<Product> getProductList();
+   
+   /**
+    * Get a product by name
+    * @return null if the product does not exist
+    */
+   Product getProductByName(String name);
+   
+   /**
+    * Get the associated payment service. 
+    */
+   PaymentService getPaymentService();
+}
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -28,10 +28,11 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import org.jboss.test.osgi.trailblazer.PaymentService;
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.jboss.test.osgi.trailblazer.types.Product;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 
 /**
@@ -69,16 +70,24 @@
    {
       return products.get(name);
    }
-
-   private void add(Product p)
-   {
-      products.put(p.getName(), p);
-   }
    
    public PaymentService getPaymentService()
    {
-      ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
+      ServiceReference[] srefs;
+      try
+      {
+         srefs = context.getServiceReferences(PaymentService.class.getName(), "(type=paypal)");
+      }
+      catch (InvalidSyntaxException ex)
+      {
+         throw new IllegalArgumentException(ex);
+      }
+      ServiceReference sref = srefs != null && srefs.length > 0 ? srefs[0] : null;
       return sref != null ? (PaymentService)context.getService(sref) : null;
    }
 
+   private void add(Product p)
+   {
+      products.put(p.getName(), p);
+   }
 }

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -33,10 +33,11 @@
 import javax.naming.NamingException;
 
 import org.jboss.osgi.jndi.NamingService;
-import org.jboss.test.osgi.trailblazer.PaymentService;
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.pay.PaymentService;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.jboss.test.osgi.trailblazer.types.Product;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 
 /**
@@ -80,7 +81,16 @@
    
    public PaymentService getPaymentService()
    {
-      ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
+      ServiceReference[] srefs;
+      try
+      {
+         srefs = context.getServiceReferences(PaymentService.class.getName(), "(type=credit)");
+      }
+      catch (InvalidSyntaxException ex)
+      {
+         throw new IllegalArgumentException(ex);
+      }
+      ServiceReference sref = srefs != null && srefs.length > 0 ? srefs[0] : null;
       return sref != null ? (PaymentService)context.getService(sref) : null;
    }
    

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java	2009-05-12 16:17:20 UTC (rev 88755)
@@ -23,7 +23,7 @@
 
 import java.io.Serializable;
 
-import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.shop.Shop;
 
 //$Id$
 

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,10 +1,11 @@
 <b>This is the home page of the OSGi Trailblazer application.</b>
+<p/>
 
-<p/>
 It uses an imaginary shopping mall to demonstrate usage and best practices 
 in <a href='http://www.osgi.org'>OSGi</a> general and of some of it's more advanced features
 defined by the <a href='http://www.osgi.org/EEG/HomePage'>OSGi Enterprise Expert Group</a>.
 <p/>
+
 In this version it covers the usage of 
 <ul>
 	<li>Service registration</li> 
@@ -19,19 +20,28 @@
 	<li>Distributed OSGi</li> 
 </ul> 
 
-The application works such that the <a href='${shoppingmall.java}'>ShoppingMall</a> dynamically discovers
-<a href='${shop.java}'>Shop</a> instance from the OSGi Registry.<br/> 
-Shops can come and go at any time.
+The <a href='${trailblazer.java.path}/ShoppingMall.java'>ShoppingMall</a> application dynamically discovers
+<a href='${trailblazer.java.path}/Shop.java'>Shop</a> instance from the OSGi Registry. 
+
+Each shop is associated with a <a href='${trailblazer.java.path}/PaymentService.java'>PaymentService</a>. Shops define specific 
+requirements on payment services. The ShoppingMall itself is rendered in HTML through the OSGi 
+compendium provided <a href='http://www.osgi.org/javadoc/r4v41/org/osgi/service/http/HttpService.html'>HttpService</a>.
 <p/>
+ 
+Successful product purchases are passed through the <a href='${trailblazer.java.path}/AuditService.java'>AuditService</a> that is 
+exposed through <a href='http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement'>JMX</a>.
+<p/>
+
 The individual Shops maintain their respective product lists using various technics available 
 in <a href='http://www.osgi.org/EEG/HomePage'>OSGi EE</a>.
 <p/>
+
 For comments, bugs or suggestion please go to the <a href='http://www.jboss.org/community/wiki/JBossOSGi'>JBossOSGi</a> 
 <a href='http://www.jboss.org/index.html?module=bb&op=viewforum&f=257'>User Forum</a>
-or file an issue in <a href='https://jira.jboss.org/jira/browse/JBOSGI'>Jira</a>.  
+or file an issue in <a href='https://jira.jboss.org/jira/browse/JBOSGI'>JIRA</a>.  
 <p/>
+
 Please click on the individual shops to read more.
 <p/>
 
-
 -enjoy
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,13 +1,17 @@
 <b>The ClimbingStore is a specific implementation of the Shop service.</b>
+<p/>
 
+The <a href='${trailblazer.java.path}/shop/sports/ClimbingStore.java'>ClimbingStore</a> uses 
+<a href='http://java.sun.com/products/jndi'>JNDI</a> to maintain it's product list.
 <p/>
-The <a href='${climbingstore.java}'>ClimbingStore</a> uses <a href='http://java.sun.com/products/jndi'>JNDI</a> to maintain it's product list.
-<p/>
+
 The current implementation uses the <a href='http://www.jboss.org/community/wiki/JBossOSGi'>JBossOSGi</a> 
 <a href='${userguide.html}/ChapProvidedBundles.html'>NamingService</a>. Future versions will use propper OSGi JNDI integration (RFP-84).
 <p/>
+
 <b>TODOs</b>
 <p/>
+
 <small>
 <a href='https://jira.jboss.org/jira/browse/JBOSGI-81'>[JBOSGI-81]</a> - Provide propper JNDI integration (RFP-84)<br/>
 <a href='https://jira.jboss.org/jira/browse/JBOSGI-82'>[JBOSGI-82]</a> - Remove the requirement to set the context classloader for JNDI access<br/>

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,18 +1,26 @@
 # bnd build -classpath target/test-classes -output target/test-libs/trailblazer-frontend.jar src/test/resources/trailblazer/frontend.bnd
 
 Bundle-SymbolicName: trailblazer-frontend
+
 Bundle-Activator: org.jboss.test.osgi.trailblazer.frontend.ServiceActivator
+
 Private-Package: org.jboss.test.osgi.trailblazer.frontend
+
+Export-Package:	\
+	org.jboss.test.osgi.trailblazer.audit, \
+	org.jboss.test.osgi.trailblazer.mall, \
+	org.jboss.test.osgi.trailblazer.pay, \
+	org.jboss.test.osgi.trailblazer.shop, \
+	org.jboss.test.osgi.trailblazer.types
+
 Import-Package: \
 	javax.servlet*, \
 	org.osgi.framework, \
 	org.osgi.service.http, \
 	org.osgi.service.log, \
 	org.osgi.util.tracker, \
-	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer, \
-	org.jboss.test.osgi.trailblazer.types 
-
+	org.jboss.osgi.common.log
+	
 Include-Resource: \
 	style/osgishop.css=../META-INF/style/osgishop.css, \
 	notes=../META-INF/notes
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -1,6 +1,18 @@
 # bnd build -classpath target/test-classes -output target/test-libs/trailblazer-mall.jar src/test/resources/trailblazer/mall.bnd
 
 Bundle-SymbolicName: trailblazer-mall
-Bundle-Activator: org.jboss.test.osgi.trailblazer.mall.ServiceActivator
-Private-Package: org.jboss.test.osgi.trailblazer.mall 
-Export-Package: org.jboss.test.osgi.trailblazer, org.jboss.test.osgi.trailblazer.types 
+
+Bundle-Activator: org.jboss.test.osgi.trailblazer.mall.internal.ServiceActivator
+
+Private-Package: org.jboss.test.osgi.trailblazer.mall.internal
+
+Import-Package: \
+	org.osgi.framework, \
+	org.osgi.service.log, \
+	org.jboss.osgi.common.log, \
+	org.jboss.test.osgi.trailblazer.audit, \
+	org.jboss.test.osgi.trailblazer.mall, \
+	org.jboss.test.osgi.trailblazer.pay, \
+	org.jboss.test.osgi.trailblazer.shop, \
+	org.jboss.test.osgi.trailblazer.types
+	
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -2,10 +2,11 @@
 
 Bundle-SymbolicName: trailblazer-payment-creditcard
 Bundle-Activator: org.jboss.test.osgi.trailblazer.pay.creditcard.ServiceActivator
+
 Private-Package: org.jboss.test.osgi.trailblazer.pay.creditcard
+
 Import-Package: \
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer, \
-	org.jboss.test.osgi.trailblazer.types 
+	org.jboss.test.osgi.trailblazer.pay

Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd	                        (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-paypal.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -0,0 +1,12 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-payment-paypal.jar src/test/resources/trailblazer/payment-paypal.bnd
+
+Bundle-SymbolicName: trailblazer-payment-paypal
+Bundle-Activator: org.jboss.test.osgi.trailblazer.pay.paypal.ServiceActivator
+
+Private-Package: org.jboss.test.osgi.trailblazer.pay.paypal
+
+Import-Package: \
+	org.osgi.framework, \
+	org.osgi.service.log, \
+	org.jboss.osgi.common.log, \
+	org.jboss.test.osgi.trailblazer.pay

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -2,10 +2,13 @@
 
 Bundle-SymbolicName: trailblazer-shop-pets
 Bundle-Activator: org.jboss.test.osgi.trailblazer.shop.pets.ServiceActivator
+
 Private-Package: org.jboss.test.osgi.trailblazer.shop.pets
+
 Import-Package: \
 	org.osgi.framework, \
 	org.osgi.service.log, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer, \
-	org.jboss.test.osgi.trailblazer.types 
+	org.jboss.test.osgi.trailblazer.pay, \
+	org.jboss.test.osgi.trailblazer.shop, \
+	org.jboss.test.osgi.trailblazer.types

Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd	2009-05-12 16:05:02 UTC (rev 88754)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd	2009-05-12 16:17:20 UTC (rev 88755)
@@ -2,12 +2,15 @@
 
 Bundle-SymbolicName: trailblazer-shop-sports
 Bundle-Activator: org.jboss.test.osgi.trailblazer.shop.sports.ServiceActivator
+
 Private-Package: org.jboss.test.osgi.trailblazer.shop.sports
+
 Import-Package: \
 	javax.naming, \
-	org.jboss.osgi.jndi, \
 	org.osgi.framework, \
 	org.osgi.service.log, \
+	org.jboss.osgi.jndi, \
 	org.jboss.osgi.common.log, \
-	org.jboss.test.osgi.trailblazer, \
-	org.jboss.test.osgi.trailblazer.types 
+	org.jboss.test.osgi.trailblazer.pay, \
+	org.jboss.test.osgi.trailblazer.shop, \
+	org.jboss.test.osgi.trailblazer.types




More information about the jboss-cvs-commits mailing list