JBoss-OSGI SVN: r88755 - in projects/jboss-osgi/trunk/testsuite/trailblazer: scripts and 14 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)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/testsui...</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/bui...</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(a)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(a)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(a)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(a)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(a)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 + " ");
+ }
+ }
}
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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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
17 years, 2 months
JBoss-OSGI SVN: r88719 - in projects/jboss-osgi/trunk/testsuite/trailblazer: scripts and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-12 09:54:30 -0400 (Tue, 12 May 2009)
New Revision: 88719
Added:
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/
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/mall.bnd
Removed:
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd
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/ServiceActivator.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/resources/META-INF/style/osgishop.css
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
Log:
Add trailblazer documentation
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml 2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml 2009-05-12 13:54:30 UTC (rev 88719)
@@ -16,6 +16,11 @@
<!-- Properties -->
<properties>
+ <trailblazer.java.path>https://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/trunk/testsui...</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/bui...</userguide.html>
</properties>
<!-- Build -->
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 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml 2009-05-12 13:54:30 UTC (rev 88719)
@@ -43,8 +43,8 @@
<!-- frontend -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-frontend.jar" files="${tests.resources.dir}/trailblazer/frontend.bnd" />
- <!-- main -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-main.jar" files="${tests.resources.dir}/trailblazer/main.bnd" />
+ <!-- mall -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-mall.jar" files="${tests.resources.dir}/trailblazer/mall.bnd" />
<!-- 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" />
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 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java 2009-05-12 13:54:30 UTC (rev 88719)
@@ -23,8 +23,11 @@
//$Id$
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
+import java.net.URL;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -52,10 +55,12 @@
{
private LogService log;
+ private BundleContext context;
private ShoppingMall mallService;
public HttpRenderServlet(BundleContext context)
{
+ this.context = context;
this.log = new LogServiceTracker(context);
ServiceTracker tracker = new ServiceTracker(context, ShoppingMall.class.getName(), null)
@@ -100,7 +105,7 @@
else if (path.startsWith("/buy"))
{
reqHandler.actionAddToCart(req, res);
- reqHandler.renderCartPage(req, res);
+ res.sendRedirect(req.getServletPath() + "/cart");
}
else if (path.startsWith("/clear"))
{
@@ -111,12 +116,16 @@
{
reqHandler.actionCheckout(req, res);
reqHandler.actionClearProducts(req, res);
- reqHandler.renderConfirmPage(req, res);
+ res.sendRedirect(req.getServletPath() + "/confirm?" + req.getQueryString());
}
else if (path.startsWith("/cart"))
{
reqHandler.renderCartPage(req, res);
}
+ else if (path.startsWith("/confirm"))
+ {
+ reqHandler.renderConfirmPage(req, res);
+ }
else
{
reqHandler.renderHomePage(req, res);
@@ -144,13 +153,59 @@
out.println("<a href='" + req.getServletPath() + "'>home</a>");
out.println("<a href='" + req.getServletPath() + "/cart'>cart</a>");
out.println("<p/>");
+ out.println("<table><tr valign='top'><td width='400'>");
}
private void renderFooter(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
+
+ out.println("</td><td>");
+
+ renderNotes(req, res);
+
+ out.println("</td></tr>");
+ out.println("</table>");
out.println("</body>");
out.println("</html>");
}
+ private void renderNotes(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ String path = req.getPathInfo();
+ if (path == null)
+ path = "/";
+
+ if (path.equals("/"))
+ path = "/home";
+
+ out.println("<div class='notes'>");
+
+ String notesPath = "notes" + path;
+
+ String paramShop = req.getParameter("shop");
+ if (paramShop != null)
+ notesPath += "-" + paramShop;
+
+ notesPath = notesPath.toLowerCase() + ".html";
+
+ URL htmlRes = context.getBundle().getResource(notesPath);
+ if (htmlRes != null)
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader(htmlRes.openStream()));
+ String line = br.readLine();
+ while (line != null)
+ {
+ out.println(line);
+ line = br.readLine();
+ }
+ }
+ else
+ {
+ out.println("Cannot find: " + notesPath);
+ }
+ out.println("</div>");
+ }
}
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 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java 2009-05-12 13:54:30 UTC (rev 88719)
@@ -154,7 +154,7 @@
{
PrintWriter out = res.getWriter();
Shop shop = getShopFromRequestParam(req);
- out.println("<p>Thanks for shopping with <b>" + shop.getName() + "</b></p>");
+ out.println("<p>Thanks for shopping with " + shop.getName() + "</p>");
}
public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java 2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java 2009-05-12 13:54:30 UTC (rev 88719)
@@ -62,6 +62,7 @@
HttpRenderServlet servlet = new HttpRenderServlet(context);
httpService.registerServlet(CONTEXT_PATH, servlet, null, null);
httpService.registerResources(CONTEXT_PATH + "/style", "/style", null);
+ httpService.registerResources(CONTEXT_PATH + "/notes", "/notes", null);
}
catch (Exception ex)
{
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main)
Modified: 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/main/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ServiceActivator.java 2009-05-12 13:54:30 UTC (rev 88719)
@@ -19,7 +19,7 @@
* 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.main;
+package org.jboss.test.osgi.trailblazer.mall;
//$Id$
Modified: 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/main/ShoppingMallImpl.java 2009-05-11 21:38:26 UTC (rev 88675)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/mall/ShoppingMallImpl.java 2009-05-12 13:54:30 UTC (rev 88719)
@@ -19,7 +19,7 @@
* 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.main;
+package org.jboss.test.osgi.trailblazer.mall;
//$Id$
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/home.html 2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,37 @@
+<b>This is the home page of the OSGi Trailblazer application.</b>
+
+<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>
+ <li>Access to the naming and directory service (JNDI)</li>
+ <li>Access to the managment service (JMX)</li>
+</ul>
+
+Future versions will be expanded to cover
+<ul>
+ <li>Component wiring and injection (Blueprint Service)</li>
+ <li>Access to the persistence service (JPA)</li>
+ <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.
+<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>.
+<p/>
+Please click on the individual shops to read more.
+<p/>
+
+
+-enjoy
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/notes/list-climbingstore.html 2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,15 @@
+<b>The ClimbingStore is a specific implementation of the Shop service.</b>
+
+<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/>
+</small>
+
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css 2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css 2009-05-12 13:54:30 UTC (rev 88719)
@@ -1,38 +1,34 @@
-p {
+body {
font-family: Helvetica,Arial,sans-serif;
font-size: 14;
}
+div.notes {
+ color : gray;
+ font-size: 12;
+}
+
th {
- font-family: Helvetica,Arial,sans-serif;
font-weight: bold;
- font-size: 14;
}
td {
- font-family: Helvetica,Arial,sans-serif;
- font-size: 14;
}
a {
- font-family: Helvetica,Arial,sans-serif;
- font-size: 14;
}
h1 {
- font-family: Helvetica,Arial,sans-serif;
font-weight: bold;
font-size: 20;
}
h2 {
- font-family: Helvetica,Arial,sans-serif;
font-weight: bold;
font-size: 18;
}
h3 {
- font-family: Helvetica,Arial,sans-serif;
font-weight: bold;
font-size: 16;
}
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 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd 2009-05-12 13:54:30 UTC (rev 88719)
@@ -13,4 +13,6 @@
org.jboss.test.osgi.trailblazer, \
org.jboss.test.osgi.trailblazer.types
-Include-Resource: style/osgishop.css=../META-INF/style/osgishop.css
\ No newline at end of file
+Include-Resource: \
+ style/osgishop.css=../META-INF/style/osgishop.css, \
+ notes=../META-INF/notes
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd 2009-05-12 13:49:49 UTC (rev 88718)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd 2009-05-12 13:54:30 UTC (rev 88719)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-main.jar src/test/resources/trailblazer/main.bnd
-
-Bundle-SymbolicName: trailblazer-main
-Bundle-Activator: org.jboss.test.osgi.trailblazer.main.ServiceActivator
-Private-Package: org.jboss.test.osgi.trailblazer.main
-Export-Package: org.jboss.test.osgi.trailblazer, org.jboss.test.osgi.trailblazer.types
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd (from rev 88675, projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/mall.bnd 2009-05-12 13:54:30 UTC (rev 88719)
@@ -0,0 +1,6 @@
+# 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
17 years, 2 months
JBoss-OSGI SVN: r88713 - in projects/jboss-osgi/trunk/testsuite/trailblazer/src/test: resources and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-12 06:14:00 -0400 (Tue, 12 May 2009)
New Revision: 88713
Added:
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css
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/RequestHandler.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
Log:
Add stylesheet to trailblazer
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 10:05:43 UTC (rev 88712)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java 2009-05-12 10:14:00 UTC (rev 88713)
@@ -134,13 +134,23 @@
private void renderHeader(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
+
+ out.println("<html>");
+ out.println("<head>");
+ out.println("<link rel='stylesheet' href='" + req.getServletPath() + "/style/osgishop.css' type='text/css'>");
+ out.println("</head>");
+ out.println("<body>");
+
out.println("<a href='" + req.getServletPath() + "'>home</a>");
out.println("<a href='" + req.getServletPath() + "/cart'>cart</a>");
out.println("<p/>");
}
- private void renderFooter(HttpServletRequest req, HttpServletResponse res)
+ private void renderFooter(HttpServletRequest req, HttpServletResponse res) throws IOException
{
+ PrintWriter out = res.getWriter();
+ out.println("</body>");
+ out.println("</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 10:05:43 UTC (rev 88712)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java 2009-05-12 10:14:00 UTC (rev 88713)
@@ -68,7 +68,7 @@
}
else
{
- out.println("No active shops, please try later.");
+ out.println("<p>No active shops, please try later.</p>");
}
}
@@ -95,13 +95,6 @@
out.println("</table>");
}
- public void renderConfirmPage(HttpServletRequest req, HttpServletResponse res) throws IOException
- {
- PrintWriter out = res.getWriter();
- Shop shop = getShopFromRequestParam(req);
- out.println("Thanks for shopping with " + shop.getName());
- }
-
public void renderCartPage(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
@@ -112,7 +105,7 @@
Set<Shop> shops = shoppingCart.getShops();
if (shops.size() == 0)
{
- out.println("Your shopping cart is empty");
+ out.println("<p>Your shopping cart is empty</p>");
return;
}
@@ -121,7 +114,7 @@
Integer total = new Integer(0);
String shopName = shop.getName();
- out.println("<h4><a href='" + req.getServletPath() + "/list?shop=" + shopName + "'>" + shopName + "</a></h4>");
+ out.println("<h3><a href='" + req.getServletPath() + "/list?shop=" + shopName + "'>" + shopName + "</a></h3>");
out.println("<table>");
out.println("<tr><th>Product</th><th>Price</th></tr>");
for (Product p : shoppingCart.getProductsByShop(shop))
@@ -152,11 +145,18 @@
}
else
{
- out.println("Payment service not available, please try later.");
+ out.println("<p>Payment service not available, please try later.</p>");
}
}
}
+ public void renderConfirmPage(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+ Shop shop = getShopFromRequestParam(req);
+ out.println("<p>Thanks for shopping with <b>" + shop.getName() + "</b></p>");
+ }
+
public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)
{
Shop shopService = getShopFromRequestParam(req);
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java 2009-05-12 10:05:43 UTC (rev 88712)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java 2009-05-12 10:14:00 UTC (rev 88713)
@@ -61,6 +61,7 @@
log.log(LogService.LOG_INFO, "Register " + CONTEXT_PATH);
HttpRenderServlet servlet = new HttpRenderServlet(context);
httpService.registerServlet(CONTEXT_PATH, servlet, null, null);
+ httpService.registerResources(CONTEXT_PATH + "/style", "/style", null);
}
catch (Exception ex)
{
Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/META-INF/style/osgishop.css 2009-05-12 10:14:00 UTC (rev 88713)
@@ -0,0 +1,39 @@
+p {
+ font-family: Helvetica,Arial,sans-serif;
+ font-size: 14;
+}
+
+th {
+ font-family: Helvetica,Arial,sans-serif;
+ font-weight: bold;
+ font-size: 14;
+}
+
+td {
+ font-family: Helvetica,Arial,sans-serif;
+ font-size: 14;
+}
+
+a {
+ font-family: Helvetica,Arial,sans-serif;
+ font-size: 14;
+}
+
+h1 {
+ font-family: Helvetica,Arial,sans-serif;
+ font-weight: bold;
+ font-size: 20;
+}
+
+h2 {
+ font-family: Helvetica,Arial,sans-serif;
+ font-weight: bold;
+ font-size: 18;
+}
+
+h3 {
+ font-family: Helvetica,Arial,sans-serif;
+ font-weight: bold;
+ font-size: 16;
+}
+
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 10:05:43 UTC (rev 88712)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd 2009-05-12 10:14:00 UTC (rev 88713)
@@ -13,3 +13,4 @@
org.jboss.test.osgi.trailblazer, \
org.jboss.test.osgi.trailblazer.types
+Include-Resource: style/osgishop.css=../META-INF/style/osgishop.css
\ No newline at end of file
17 years, 2 months
JBoss-OSGI SVN: r88709 - in projects/jboss-osgi/trunk: testsuite and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-12 04:57:28 -0400 (Tue, 12 May 2009)
New Revision: 88709
Added:
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java
Removed:
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/
Modified:
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/pom.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/shop/sports/ClimbingStore.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/trailblazer/shop-sports.bnd
Log:
Trailblazer sports store uses NamingService
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-12 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -36,18 +36,18 @@
import org.osgi.service.log.LogService;
/**
- * A Service Activator that activates the JNP Server
+ * Start/Stop the {@link NamingServer}
*
* @author thomas.diesler(a)jboss.com
* @since 24-Apr-2009
*/
-public class JNPServer
+public class JNPServer
{
private LogService log;
private Main namingMain;
private Naming namingServer;
- public JNPServer(BundleContext context, String jndiHost, int jndiPort, int jndiRmiPort)
+ public JNPServer(BundleContext context, String jndiHost, int jndiPort, int jndiRmiPort)
{
this.log = new LogServiceTracker(context);
Added: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -0,0 +1,83 @@
+/*
+ * 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.osgi.jndi.internal;
+
+//$Id$
+
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.naming.NamingContextFactory;
+import org.jboss.osgi.jndi.NamingService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A {@link ServiceFactory} for the {@link NamingService}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class NamingServiceFactory implements ServiceFactory
+{
+ private String jndiHost, jndiPort;
+
+ public NamingServiceFactory(String jndiHost, String jndiPort)
+ {
+ this.jndiHost = jndiHost;
+ this.jndiPort = jndiPort;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getService(Bundle bundle, ServiceRegistration registration)
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", NamingContextFactory.class.getName());
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
+
+ InitialContext iniCtx = new InitialContext(env);
+ return new NamingServiceImpl(iniCtx);
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot get the InitialContext", ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ {
+ // nothing to do
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-12 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -23,52 +23,28 @@
//$Id$
-import java.util.Hashtable;
-
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.osgi.jndi.NamingService;
/**
- * A Service Activator that activates the JNP Server
+ * An implementation of the {@link NamingService}
*
* @author thomas.diesler(a)jboss.com
* @since 24-Apr-2009
*/
public class NamingServiceImpl implements NamingService
{
- private String jndiHost, jndiPort;
private InitialContext initialContext;
-
- public NamingServiceImpl(String jndiHost, String jndiPort)
+
+ public NamingServiceImpl(InitialContext initialContext)
{
- this.jndiHost = jndiHost;
- this.jndiPort = jndiPort;
+ this.initialContext = initialContext;
}
- @SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
- if (initialContext == null)
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- Hashtable env = new Hashtable();
- env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
- env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
-
- initialContext = new InitialContext(env);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
return initialContext;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-12 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -63,7 +63,7 @@
jnpServer = new JNPServer(context, jndiHost, Integer.parseInt(jndiPort), Integer.parseInt(jndiRmiPort));
jnpServer.start();
- context.registerService(NamingService.class.getName(), new NamingServiceImpl(jndiHost, jndiPort), null);
+ context.registerService(NamingService.class.getName(), new NamingServiceFactory(jndiHost, jndiPort), null);
log.log(LogService.LOG_DEBUG, "NamingService registered");
}
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-12 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-12 08:57:28 UTC (rev 88709)
@@ -16,6 +16,7 @@
<modules>
<module>example</module>
+ <module>trailblazer</module>
<module>functional</module>
</modules>
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 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -88,8 +88,6 @@
if (path == null)
path = "/";
- log.log(LogService.LOG_INFO, "doGet "+ path);
-
renderHeader(req, res);
if (mallService != null)
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 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -68,7 +68,7 @@
}
else
{
- out.println("No active shops available, please try later.");
+ out.println("No active shops, please try later.");
}
}
@@ -98,7 +98,8 @@
public void renderConfirmPage(HttpServletRequest req, HttpServletResponse res) throws IOException
{
PrintWriter out = res.getWriter();
- out.println("Thanks for shopping with us");
+ Shop shop = getShopFromRequestParam(req);
+ out.println("Thanks for shopping with " + shop.getName());
}
public void renderCartPage(HttpServletRequest req, HttpServletResponse res) throws IOException
@@ -154,8 +155,6 @@
out.println("Payment service not available, please try later.");
}
}
- out.println("<p/>");
-
}
public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)
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 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -23,21 +23,24 @@
//$Id$
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+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.types.Product;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-
-
/**
- * [TODO]
+ * this climbing store uses JNDI to bind product information.
*
* @author thomas.diesler(a)jboss.com
* @since 10-May-2009
@@ -45,17 +48,29 @@
public class ClimbingStore implements Shop
{
private BundleContext context;
- private Map<String, Product> products = new LinkedHashMap<String, Product>();
public ClimbingStore(BundleContext context)
{
this.context = context;
- add(new Product(this, "Shoes", 9500));
- add(new Product(this, "Chalk", 150));
- add(new Product(this, "Harness", 7500));
- add(new Product(this, "Rope", 13500));
- add(new Product(this, "Pants", 7500));
- add(new Product(this, "Shirt", 3500));
+
+ NamingService namingService = getNamingService(context);
+ try
+ {
+ Context ctx = namingService.getInitialContext();
+ ctx = ctx.createSubcontext("shop");
+ ctx = ctx.createSubcontext("climbing");
+ ctx = ctx.createSubcontext("products");
+ add(ctx, new Product(null, "Shoes", 9500));
+ add(ctx, new Product(null, "Chalk", 150));
+ add(ctx, new Product(null, "Harness", 7500));
+ add(ctx, new Product(null, "Rope", 13500));
+ add(ctx, new Product(null, "Pants", 7500));
+ add(ctx, new Product(null, "Shirt", 3500));
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot bind products", ex);
+ }
}
public String getName()
@@ -63,25 +78,72 @@
return "ClimbingStore";
}
+ public PaymentService getPaymentService()
+ {
+ ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
+ return sref != null ? (PaymentService)context.getService(sref) : null;
+ }
+
public Collection<Product> getProductList()
{
- return Collections.unmodifiableCollection(products.values());
+ Collection<Product> products = new ArrayList<Product>();
+ try
+ {
+ NamingService namingService = getNamingService(context);
+ InitialContext iniCtx = namingService.getInitialContext();
+
+ NamingEnumeration<NameClassPair> list = iniCtx.list("shop/climbing/products");
+ while (list.hasMoreElements())
+ {
+ NameClassPair pair = list.nextElement();
+ String name = pair.getName();
+ products.add(getProductByName(name));
+ }
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot lookup products", ex);
+ }
+ return products;
}
public Product getProductByName(String name)
{
- return products.get(name);
+ Product product;
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ NamingService namingService = getNamingService(context);
+ InitialContext iniCtx = namingService.getInitialContext();
+ product = (Product)iniCtx.lookup("shop/climbing/products/" + name);
+ product.setShop(this);
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot lookup product: " + name, ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ return product;
}
- private void add(Product p)
+ private void add(Context ctx, Product p) throws NamingException
{
- products.put(p.getName(), p);
+ ctx.bind(p.getName(), p);
}
-
- public PaymentService getPaymentService()
+
+ private NamingService getNamingService(BundleContext context)
{
- ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
- return sref != null ? (PaymentService)context.getService(sref) : null;
+ ServiceReference sref = context.getServiceReference(NamingService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot access the NamingService");
+
+ NamingService namingService = (NamingService)context.getService(sref);
+ return namingService;
}
-
}
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 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java 2009-05-12 08:57:28 UTC (rev 88709)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.osgi.trailblazer.types;
+import java.io.Serializable;
+
import org.jboss.test.osgi.trailblazer.Shop;
//$Id$
@@ -32,8 +34,10 @@
* @author thomas.diesler(a)jboss.com
* @since 10-May-2009
*/
-public class Product
+public class Product implements Serializable
{
+ private static final long serialVersionUID = 1L;
+
private String name;
private Integer price;
private Shop shop;
@@ -45,11 +49,23 @@
this.price = price;
}
+ public Product(String name, Integer price)
+ {
+ this.name = name;
+ this.price = price;
+ }
+
public Shop getShop()
{
return shop;
}
+
+ public void setShop(Shop shop)
+ {
+ this.shop = shop;
+ }
+
public String getName()
{
return name;
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 08:49:18 UTC (rev 88708)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd 2009-05-12 08:57:28 UTC (rev 88709)
@@ -4,6 +4,8 @@
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.common.log, \
17 years, 2 months
JBoss-OSGI SVN: r88675 - in projects/jboss-osgi/trunk/testsuite: trailblazer and 18 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-11 17:38:26 -0400 (Mon, 11 May 2009)
New Revision: 88675
Added:
projects/jboss-osgi/trunk/testsuite/trailblazer/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/
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/frontend/
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/ServiceActivator.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/main/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ShoppingMallImpl.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/
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/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/
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/
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/
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/jboss-osgi-framework.properties
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.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
Removed:
projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/assembly-examples-zip.xml
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/http/bundle/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jmx/bundle/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jndi/bundle/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/log/bundle/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/http/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jmx/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jndi/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/log/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/mcservice/
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/example-http.bnd
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/message.txt
Modified:
projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
Log:
Trailblazer initial cut
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer (from rev 88577, projects/jboss-osgi/trunk/testsuite/example)
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer
___________________________________________________________________
Name: svn:ignore
+ target
felix-cache
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml 2009-05-11 21:38:26 UTC (rev 88675)
@@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi - Testsuite Examples</name>
+ <name>JBossOSGi - Testsuite Trailblazer</name>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testsuite-example</artifactId>
+ <artifactId>jboss-osgi-testsuite-trailblazer</artifactId>
<packaging>jar</packaging>
<parent>
@@ -39,19 +39,6 @@
</descriptors>
</configuration>
</execution>
- <execution>
- <id>examples</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-examples-zip.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
</executions>
</plugin>
<plugin>
@@ -73,43 +60,9 @@
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>target/${project.artifactId}-${project.version}.zip</file>
- <type>zip</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
- <!-- Repositories -->
- <repositories>
- <!--
- Also define the JBoss Repository here because
- the examples are distributed standalone
- -->
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
- </repositories>
-
<!-- Profiles -->
<profiles>
</profiles>
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/antrun-test-jars.xml 2009-05-11 21:38:26 UTC (rev 88675)
@@ -40,26 +40,21 @@
<target name="build-test-jars" depends="init" description="Build the test deployments">
- <!-- Please add alphabetically -->
-
- <!-- http -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-http.jar" files="${tests.resources.dir}/http/example-http.bnd" />
-
- <!-- jmx -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-jmx.jar" files="${tests.resources.dir}/jmx/example-jmx.bnd" />
-
- <!-- jndi -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-jndi.jar" files="${tests.resources.dir}/jndi/example-jndi.bnd" />
-
- <!-- log -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-log.jar" files="${tests.resources.dir}/log/example-log.bnd" />
+ <!-- frontend -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-frontend.jar" files="${tests.resources.dir}/trailblazer/frontend.bnd" />
- <!-- mcservice -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleA.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleA.bnd" />
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleB.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleB.bnd" />
+ <!-- main -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-main.jar" files="${tests.resources.dir}/trailblazer/main.bnd" />
- <!-- Please add alphabetically -->
-
+ <!-- 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" />
+
+ <!-- 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" />
+
+ <!-- shop-pets -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/trailblazer-shop-pets.jar" files="${tests.resources.dir}/trailblazer/shop-pets.bnd" />
+
</target>
</project>
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/assembly-examples-zip.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-examples-zip.xml 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/scripts/assembly-examples-zip.xml 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,19 +0,0 @@
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
- <id>examples</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <fileSets>
- <fileSet>
- <directory></directory>
- <outputDirectory>example</outputDirectory>
- <includes>
- <include>scripts/**</include>
- <include>src/**</include>
- <include>pom.xml</include>
- </includes>
- </fileSet>
- </fileSets>
-</assembly>
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,114 +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.example.http;
-
-//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.ConfigAdminCapability;
-import org.jboss.osgi.spi.testing.HttpCapability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-
-import junit.framework.Test;
-
-/**
- * A test that deployes a bundle that containes a HttpServlet which
- * is registered through the OSGi HttpService
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class HttpServiceTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
- private static AbstractBundle testBundle;
-
- public static Test suite()
- {
- OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new ConfigAdminCapability());
- runtime.addCapability(new HttpCapability());
-
- Thread.sleep(500);
-
- testBundle = runtime.installBundle("example-http.jar");
- testBundle.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- testBundle.uninstall();
- runtime.shutdown();
- super.tearDown();
- }
- };
- return testSetup;
- }
-
- public void testServletAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
- }
-
- public void testServletInitProps() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
- }
-
- public void testServletBundleContext() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
- }
-
- public void testServletStartLevel() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
- }
-
- public void testResourceAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,97 +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.example.jmx;
-
-//$Id: JMXTestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler(a)jboss.com $
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.JMXCapability;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.example.jmx.bundle.FooMBean;
-
-/**
- * A test that deployes a bundle that registeres an MBean
- *
- * @author thomas.diesler(a)jboss.com
- * @since 12-Feb-2009
- */
-public class JMXTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
- private static AbstractBundle bundle;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- runtime.addCapability(new JMXCapability());
-
- bundle = runtime.installBundle("example-jmx.jar");
- bundle.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- bundle.uninstall();
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testMBeanAccess() throws Exception
- {
- ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, runtime.getMBeanServer());
- assertEquals("hello", foo.echo("hello"));
- }
-
- public void testRMIAdaptor() throws Exception
- {
- // Lookup the MBeanServerConnection
- InitialContext iniCtx = runtime.getInitialContext();
- MBeanServerConnection rmiAdaptor = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
-
- // Access the MBean through the MBeanServerConnection
- ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, rmiAdaptor);
- assertEquals("hello", foo.echo("hello"));
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,94 +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.example.jndi;
-
-//$Id: JNDITestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler(a)jboss.com $
-
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.osgi.framework.Bundle;
-
-/**
- * A test that deployes a bundle that binds a String to JNDI
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class JNDITestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testJNDIAccess() throws Exception
- {
- AbstractBundle bundle = runtime.installBundle("example-jndi.jar");
- bundle.start();
-
- assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
-
- InitialContext iniCtx = runtime.getInitialContext();
- String lookup = (String)iniCtx.lookup("test/Foo");
- assertEquals("JNDI bound String expected", "Bar", lookup);
-
- // Uninstall should unbind the object
- bundle.uninstall();
-
- try
- {
- iniCtx.lookup("test/Foo");
- fail("NameNotFoundException expected");
- }
- catch (NameNotFoundException ex)
- {
- // expected
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,86 +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.example.log;
-
-//$Id: LogServiceTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import java.util.List;
-
-import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.jboss.osgi.spi.logging.LogEntryFilter;
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.osgi.framework.Bundle;
-import org.osgi.service.log.LogEntry;
-import org.osgi.service.log.LogService;
-
-/**
- * This example demonstrates the usage of the {@link LogService}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Apr-2009
- */
-public class LogServiceTestCase extends OSGiTest
-{
- private LogEntryCache logEntryCache;
- private OSGiRuntime runtime;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- runtime = getDefaultRuntime();
- logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
- runtime.startLogEntryTracking(logEntryCache);
- }
-
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.shutdown();
- super.tearDown();
- }
-
- public void testLogEntryFilter() throws Exception
- {
- // Install and start the test bundle
- AbstractBundle bundleA = runtime.installBundle("example-log.jar");
- bundleA.start();
-
- // Verify that the bundle is active
- assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundleA.getState());
-
- // Wait a little for the asynchronous log entry to arrive
- Thread.sleep(200);
-
- // Uninstall the test bundle
- bundleA.uninstall();
-
- // Verify the received log entries
- List<LogEntry> entries = logEntryCache.getLog();
- assertEquals("Number of entries", 1, entries.size());
- assertEquals("[ServiceA] new Service", entries.get(0).getMessage());
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,125 +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.example.microcontainer;
-
-//$Id$
-
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
-import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
-
-import java.util.List;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.osgi.spi.testing.JMXCapability;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.MicrocontainerCapability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-
-/**
- * A test that checks whether the MicrocontainerService can be accessed
- *
- * @author thomas.diesler(a)jboss.com
- * @since 12-Feb-2009
- */
-public class MicrocontainerTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- runtime.addCapability(new JMXCapability());
- runtime.addCapability(new MicrocontainerCapability());
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testServiceAccess() throws Exception
- {
- MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
- List<String> registeredBeans = mcService.getRegisteredBeans();
- assertTrue("BundleContext registered with MC", registeredBeans.contains(BEAN_SYSTEM_BUNDLE_CONTEXT));
- assertTrue("MBeanServer registered with MC", registeredBeans.contains(BEAN_MBEAN_SERVER));
- assertTrue("Kernel registered with MC", registeredBeans.contains(BEAN_KERNEL));
- }
-
- /**
- * Test whether the bundle can be deployed through the MicrocontainerServiceMBean
- */
- public void testBundleDeployment() throws Exception
- {
- MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
- mcService.deploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
-
- ManagedFrameworkMBean frameworkMBean = runtime.getMBeanProxy(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK);
- Set<ObjectName> bundles = frameworkMBean.getBundles();
- assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=example-mcservice-bundleA") > 0);
-
- mcService.undeploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
-}
-
- public void testBeansDeployment() throws Exception
- {
- MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
- mcService.deploy(getTestArchiveURL("example-mcservice-bundleB.jar"));
-
- ManagedFrameworkMBean frameworkMBean = runtime.getMBeanProxy(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK);
- Set<ObjectName> bundles = frameworkMBean.getBundles();
- assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=example-mcservice-bundleB") > 0);
-
- // Check whether the bean is registered
- List<String> registeredBeans = mcService.getRegisteredBeans();
- assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
-
- mcService.undeploy(getTestArchiveURL("example-mcservice-bundleB.jar"));
-
- // Check whether the bean is unregistered
- registeredBeans = mcService.getRegisteredBeans();
- assertFalse("SomeBean unregistered", registeredBeans.contains("SomeBean"));
- }
-}
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,17 @@
+package org.jboss.test.osgi.trailblazer;
+
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public interface AuditService
+{
+ int getTotalPurchases();
+
+ void purchaseProduct(Product product);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/AuditService.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/PaymentService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,14 @@
+package org.jboss.test.osgi.trailblazer;
+
+import java.util.Collection;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public interface PaymentService
+{
+ Collection<String> listPaymentTypes();
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/PaymentService.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/Shop.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,41 @@
+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(a)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
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/Shop.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/ShoppingMall.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,29 @@
+package org.jboss.test.osgi.trailblazer;
+
+import java.util.Collection;
+
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)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
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/ShoppingMall.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/frontend/HttpRenderServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,148 @@
+/*
+ * 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.frontend;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.ShoppingMall;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+/**
+ * A servlet that gets registered with the {@link HttpService} to
+ * render an implementation of the {@link ShoppingMall}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+@SuppressWarnings("serial")
+public class HttpRenderServlet extends HttpServlet
+{
+ private LogService log;
+
+ private ShoppingMall mallService;
+
+ public HttpRenderServlet(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+
+ ServiceTracker tracker = new ServiceTracker(context, ShoppingMall.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ log.log(LogService.LOG_INFO, "ShoppingMallService added");
+ mallService = (ShoppingMall)super.addingService(reference);
+ return mallService;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ super.removedService(reference, service);
+ log.log(LogService.LOG_INFO, "ShoppingMallService removed");
+ mallService = null;
+ }
+ };
+ tracker.open();
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ String path = req.getPathInfo();
+ if (path == null)
+ path = "/";
+
+ log.log(LogService.LOG_INFO, "doGet "+ path);
+
+ renderHeader(req, res);
+
+ if (mallService != null)
+ {
+ RequestHandler reqHandler = new RequestHandler(mallService);
+ if (path.startsWith("/list"))
+ {
+ reqHandler.renderListPage(req, res);
+ }
+ else if (path.startsWith("/buy"))
+ {
+ reqHandler.actionAddToCart(req, res);
+ reqHandler.renderCartPage(req, res);
+ }
+ else if (path.startsWith("/clear"))
+ {
+ reqHandler.actionClearProducts(req, res);
+ reqHandler.renderCartPage(req, res);
+ }
+ else if (path.startsWith("/checkout"))
+ {
+ reqHandler.actionCheckout(req, res);
+ reqHandler.actionClearProducts(req, res);
+ reqHandler.renderConfirmPage(req, res);
+ }
+ else if (path.startsWith("/cart"))
+ {
+ reqHandler.renderCartPage(req, res);
+ }
+ else
+ {
+ reqHandler.renderHomePage(req, res);
+ }
+ }
+ else
+ {
+ out.println("No mall service available, please try later.");
+ }
+ renderFooter(req, res);
+
+ out.close();
+ }
+
+ private void renderHeader(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+ out.println("<a href='" + req.getServletPath() + "'>home</a>");
+ out.println("<a href='" + req.getServletPath() + "/cart'>cart</a>");
+ out.println("<p/>");
+ }
+
+ private void renderFooter(HttpServletRequest req, HttpServletResponse res)
+ {
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/HttpRenderServlet.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/frontend/RequestHandler.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,198 @@
+/*
+ * 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.frontend;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Set;
+
+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.types.Product;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class RequestHandler
+{
+ private ShoppingMall mallService;
+
+ public RequestHandler(ShoppingMall mallService)
+ {
+ this.mallService = mallService;
+ }
+
+ public void renderHomePage(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+ out.println("<h1>Welcome to the Mall</h1>");
+
+ Collection<Shop> activeShops = mallService.getShops();
+ if (activeShops.size() > 0)
+ {
+ for (Shop shop : activeShops)
+ {
+ String shopName = shop.getName();
+ out.println("<a href='" + req.getServletPath() + "/list?shop=" + shopName + "'>" + shopName + "</a>");
+ out.println("<br>");
+ }
+ }
+ else
+ {
+ out.println("No active shops available, please try later.");
+ }
+ }
+
+ public void renderListPage(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ Shop shop = getShopFromRequestParam(req);
+
+ out.println("<h2>" + shop.getName() + "</h2");
+
+ out.println("<table>");
+ out.println("<tr><th>Product</th><th>Price</th></tr>");
+ for (Product p : shop.getProductList())
+ {
+ StringBuffer price = new StringBuffer(p.getPrice().toString());
+ price.insert(price.length() - 2, ".");
+
+ out.println("<tr>");
+ out.println("<td>" + p.getName() + "</td><td>" + price + "</td>");
+ out.println("<td><a href='" + req.getServletPath() + "/buy?shop=" + shop.getName() + "&name=" + p.getName() + "'>buy</a></td>");
+ out.println("</tr>");
+ }
+ out.println("</table>");
+ }
+
+ public void renderConfirmPage(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+ out.println("Thanks for shopping with us");
+ }
+
+ public void renderCartPage(HttpServletRequest req, HttpServletResponse res) throws IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ out.println("<h2>Shopping Cart</h2>");
+
+ ShoppingCart shoppingCart = ShoppingCart.getShoppingCart(req);
+ Set<Shop> shops = shoppingCart.getShops();
+ if (shops.size() == 0)
+ {
+ out.println("Your shopping cart is empty");
+ return;
+ }
+
+ for (Shop shop : shops)
+ {
+ Integer total = new Integer(0);
+
+ String shopName = shop.getName();
+ out.println("<h4><a href='" + req.getServletPath() + "/list?shop=" + shopName + "'>" + shopName + "</a></h4>");
+ out.println("<table>");
+ out.println("<tr><th>Product</th><th>Price</th></tr>");
+ for (Product p : shoppingCart.getProductsByShop(shop))
+ {
+ StringBuffer price = new StringBuffer(p.getPrice().toString());
+ price.insert(price.length() - 2, ".");
+ out.println("<tr>");
+ out.println("<td>" + p.getName() + "</td><td>" + price + "</td>");
+ out.println("</tr>");
+
+ total += p.getPrice();
+ }
+
+ StringBuffer totalStr = new StringBuffer(total.toString());
+ totalStr.insert(totalStr.length() - 2, ".");
+ out.println("<tr><td>Total</td><th>" + totalStr + "</th></tr>");
+ out.println("</table>");
+ out.println("<p/>");
+
+ PaymentService payService = shop.getPaymentService();
+ if (payService != null)
+ {
+ out.println("<a href='" + req.getServletPath() + "/clear?shop=" + shopName + "'>Clear<a/> products or pay using: ");
+ for (String type : payService.listPaymentTypes())
+ {
+ out.println("<a href='" + req.getServletPath() + "/checkout?shop=" + shopName + "&pay=" + type + "'>" + type + "</a> ");
+ }
+ }
+ else
+ {
+ out.println("Payment service not available, please try later.");
+ }
+ }
+ out.println("<p/>");
+
+ }
+
+ public void actionAddToCart(HttpServletRequest req, HttpServletResponse res)
+ {
+ Shop shopService = getShopFromRequestParam(req);
+ String name = req.getParameter("name");
+ Product prod = shopService.getProductByName(name);
+ if (prod == null)
+ throw new IllegalArgumentException("Invalid product name: " + name);
+
+ ShoppingCart shoppingCart = ShoppingCart.getShoppingCart(req);
+ shoppingCart.addToCart(prod);
+ }
+
+ public void actionCheckout(HttpServletRequest req, HttpServletResponse res)
+ {
+ Shop shop = getShopFromRequestParam(req);
+ ShoppingCart shoppingCart = ShoppingCart.getShoppingCart(req);
+ for (Product prod : shoppingCart.getProductsByShop(shop))
+ {
+ mallService.purchaseProduct(prod);
+ }
+ }
+
+ public void actionClearProducts(HttpServletRequest req, HttpServletResponse res)
+ {
+ Shop shop = getShopFromRequestParam(req);
+ ShoppingCart shoppingCart = ShoppingCart.getShoppingCart(req);
+ shoppingCart.clearProductsByShop(shop);
+ }
+
+ private Shop getShopFromRequestParam(HttpServletRequest req)
+ {
+ String shopName = req.getParameter("shop");
+ Shop shop = mallService.getShopByName(shopName);
+ if (shop == null)
+ throw new IllegalArgumentException("Invalid request for shop: " + shopName);
+ return shop;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/RequestHandler.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/frontend/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,94 @@
+/*
+ * 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.frontend;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * A bundle activator that uses the {@link ServiceTracker}
+ * to registers the {@link HttpRenderServlet} with the {@link HttpService}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private static final String CONTEXT_PATH = "/osgishop";
+
+ private HttpService httpService;
+ private LogService log;
+
+ public void start(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+
+ log.log(LogService.LOG_INFO, "Start HttpService tracking");
+ ServiceTracker tracker = new ServiceTracker(context, HttpService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ httpService = (HttpService)super.addingService(reference);
+ try
+ {
+ log.log(LogService.LOG_INFO, "Register " + CONTEXT_PATH);
+ HttpRenderServlet servlet = new HttpRenderServlet(context);
+ httpService.registerServlet(CONTEXT_PATH, servlet, null, null);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register: " + CONTEXT_PATH, ex);
+ }
+ return httpService;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ super.removedService(reference, service);
+
+ log.log(LogService.LOG_INFO, "Unregister " + CONTEXT_PATH);
+ httpService.unregister(CONTEXT_PATH);
+ httpService = null;
+ }
+ };
+ tracker.open();
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (httpService != null)
+ {
+ log.log(LogService.LOG_INFO, "Unregister " + CONTEXT_PATH);
+ httpService.unregister(CONTEXT_PATH);
+ httpService = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ServiceActivator.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/frontend/ShoppingCart.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,91 @@
+/*
+ * 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.frontend;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.test.osgi.trailblazer.Shop;
+import org.jboss.test.osgi.trailblazer.types.Product;
+
+/**
+ * A basic implementation of a shopping cart that is maintained in the user session
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ShoppingCart
+{
+ private Map<Shop, List<Product>> content = new HashMap<Shop, List<Product>>();
+
+ // Hide ctor
+ private ShoppingCart()
+ {
+ }
+
+ static ShoppingCart getShoppingCart(HttpServletRequest req)
+ {
+ HttpSession session = req.getSession(true);
+ ShoppingCart content = (ShoppingCart)session.getAttribute("cart");
+ if (content == null)
+ {
+ content = new ShoppingCart();
+ session.setAttribute("cart", content);
+ }
+ return content;
+ }
+
+ Set<Shop> getShops()
+ {
+ return content.keySet();
+ }
+
+ List<Product> getProductsByShop(Shop shop)
+ {
+ List<Product> products = content.get(shop);
+ if (products == null)
+ {
+ products = new ArrayList<Product>();
+ content.put(shop, products);
+ }
+ return products;
+ }
+
+ void clearProductsByShop(Shop shop)
+ {
+ content.remove(shop);
+ }
+
+ void addToCart(Product product)
+ {
+ List<Product> products = getProductsByShop(product.getShop());
+ products.add(product);
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/frontend/ShoppingCart.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/main/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -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.main;
+
+//$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(a)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
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ServiceActivator.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/main/ShoppingMallImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ShoppingMallImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ShoppingMallImpl.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,105 @@
+/*
+ * 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.main;
+
+//$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(a)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
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/main/ShoppingMallImpl.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/creditcard/CreditCardServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -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.PaymentService;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)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
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/CreditCardServiceImpl.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/creditcard/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/pay/creditcard/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,62 @@
+/*
+ * 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.creditcard;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.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(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private LogService log;
+ private ServiceRegistration serviceReg;
+
+ 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);
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (serviceReg != null)
+ {
+ log.log(LogService.LOG_INFO, "Unregister the PaymentService");
+ 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/creditcard/ServiceActivator.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/shop/pets/PetStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,84 @@
+/*
+ * 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.shop.pets;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.Collections;
+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.types.Product;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class PetStore implements Shop
+{
+ private BundleContext context;
+ private Map<String, Product> products = new LinkedHashMap<String, Product>();
+
+ public PetStore(BundleContext context)
+ {
+ this.context = context;
+ add(new Product(this, "Cat", 7500));
+ add(new Product(this, "Dog", 9500));
+ add(new Product(this, "Hamster", 500));
+ add(new Product(this, "Bird", 1500));
+ add(new Product(this, "Snail", 27500));
+ }
+
+ public String getName()
+ {
+ return "PetStore";
+ }
+
+ public Collection<Product> getProductList()
+ {
+ return Collections.unmodifiableCollection(products.values());
+ }
+
+ public Product getProductByName(String name)
+ {
+ return products.get(name);
+ }
+
+ private void add(Product p)
+ {
+ products.put(p.getName(), p);
+ }
+
+ public PaymentService getPaymentService()
+ {
+ ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
+ return sref != null ? (PaymentService)context.getService(sref) : null;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/PetStore.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/shop/pets/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/pets/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,62 @@
+/*
+ * 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.shop.pets;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.Shop;
+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(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private LogService log;
+ private ServiceRegistration serviceReg;
+
+ public void start(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+
+ log.log(LogService.LOG_INFO, "Register the PetStore");
+ serviceReg = context.registerService(Shop.class.getName(), new PetStore(context), null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (serviceReg != null)
+ {
+ log.log(LogService.LOG_INFO, "Unregister the PetStore");
+ 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/shop/pets/ServiceActivator.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/shop/sports/ClimbingStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,87 @@
+/*
+ * 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.shop.sports;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.Collections;
+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.types.Product;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ClimbingStore implements Shop
+{
+ private BundleContext context;
+ private Map<String, Product> products = new LinkedHashMap<String, Product>();
+
+ public ClimbingStore(BundleContext context)
+ {
+ this.context = context;
+ add(new Product(this, "Shoes", 9500));
+ add(new Product(this, "Chalk", 150));
+ add(new Product(this, "Harness", 7500));
+ add(new Product(this, "Rope", 13500));
+ add(new Product(this, "Pants", 7500));
+ add(new Product(this, "Shirt", 3500));
+ }
+
+ public String getName()
+ {
+ return "ClimbingStore";
+ }
+
+ public Collection<Product> getProductList()
+ {
+ return Collections.unmodifiableCollection(products.values());
+ }
+
+ public Product getProductByName(String name)
+ {
+ return products.get(name);
+ }
+
+ private void add(Product p)
+ {
+ products.put(p.getName(), p);
+ }
+
+ public PaymentService getPaymentService()
+ {
+ ServiceReference sref = context.getServiceReference(PaymentService.class.getName());
+ return sref != null ? (PaymentService)context.getService(sref) : null;
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.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/shop/sports/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ServiceActivator.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,62 @@
+/*
+ * 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.shop.sports;
+
+//$Id$
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.test.osgi.trailblazer.Shop;
+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(a)jboss.com
+ * @since 10-May-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private LogService log;
+ private ServiceRegistration serviceReg;
+
+ public void start(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+
+ log.log(LogService.LOG_INFO, "Register the ClimbingStore");
+ serviceReg = context.registerService(Shop.class.getName(), new ClimbingStore(context), null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (serviceReg != null)
+ {
+ log.log(LogService.LOG_INFO, "Unregister the ClimbingStore");
+ 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/shop/sports/ServiceActivator.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/types/Product.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,62 @@
+/*
+ * 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.types;
+
+import org.jboss.test.osgi.trailblazer.Shop;
+
+//$Id$
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 10-May-2009
+ */
+public class Product
+{
+ private String name;
+ private Integer price;
+ private Shop shop;
+
+ public Product(Shop shop, String name, Integer price)
+ {
+ this.shop = shop;
+ this.name = name;
+ this.price = price;
+ }
+
+ public Shop getShop()
+ {
+ return shop;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Integer getPrice()
+ {
+ return price;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/types/Product.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-felix.properties 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,51 +0,0 @@
-#
-# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
-#
-# $Id$
-#
-
-# The OSGiFramework implementation
-org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
-
-# Properties to configure the Framework
-org.osgi.framework.storage=${basedir}/target/osgi-store
-org.osgi.framework.storage.clean=onFirstInit
-
-# Framework bootdelegation
-org.osgi.framework.bootdelegation=org.osgi.service.log
-
-# Extra System Packages
-org.osgi.framework.system.packages.extra=\
- org.jboss.logging, \
- org.jboss.net.protocol, \
- org.jboss.osgi.spi, \
- org.jboss.osgi.spi.logging, \
- org.jboss.osgi.spi.management, \
- org.jboss.virtual, \
- org.jboss.virtual.plugins.registry, \
- org.jboss.virtual.plugins.context.jar, \
- org.jboss.virtual.plugins.vfs.helpers, \
- org.jboss.virtual.protocol, \
- org.osgi.framework;version\=1.4, \
- org.apache.log4j, \
- org.jboss.util, \
- org.jboss.util.id, \
- org.jboss.util.threadpool, \
- org.jboss.util.propertyeditor
-
-# These are needed by jboss-remoting
-# org.apache.log4j, \
-# org.jboss.util, \
-# org.jboss.util.id, \
-# org.jboss.util.threadpool, \
-# org.jboss.util.propertyeditor
-
-# Bundles that need to be installed with the Framework automatically
-org.jboss.osgi.spi.framework.autoInstall=\
- file://${test.archive.directory}/bundles/org.osgi.compendium.jar
-
-# Bundles that need to be started automatically
-org.jboss.osgi.spi.framework.autoStart=\
- file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-framework.properties (from rev 88577, projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/jboss-osgi-framework.properties 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,51 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.net.protocol, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.logging, \
+ org.jboss.osgi.spi.management, \
+ org.jboss.virtual, \
+ org.jboss.virtual.plugins.registry, \
+ org.jboss.virtual.plugins.context.jar, \
+ org.jboss.virtual.plugins.vfs.helpers, \
+ org.jboss.virtual.protocol, \
+ org.osgi.framework;version\=1.4, \
+ org.apache.log4j, \
+ org.jboss.util, \
+ org.jboss.util.id, \
+ org.jboss.util.threadpool, \
+ org.jboss.util.propertyeditor
+
+# These are needed by jboss-remoting
+# org.apache.log4j, \
+# org.jboss.util, \
+# org.jboss.util.id, \
+# org.jboss.util.threadpool, \
+# org.jboss.util.propertyeditor
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer (from rev 88577, projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http)
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/example-http.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http/example-http.bnd 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/example-http.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/example/example-http.jar src/test/resources/example/http/example-http.bnd
-
-Bundle-SymbolicName: example-http
-Bundle-Activator: org.jboss.test.osgi.example.http.bundle.ServiceActivator
-Export-Package: org.jboss.test.osgi.example.http.bundle
-Include-Resource: res/message.txt=message.txt
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd (from rev 88577, projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http/example-http.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/frontend.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,15 @@
+# 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
+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
+
Added: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/main.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-main.jar src/test/resources/trailblazer/main.bnd
+
+Bundle-SymbolicName: trailblazer-main
+Bundle-Activator: org.jboss.test.osgi.trailblazer.main.ServiceActivator
+Private-Package: org.jboss.test.osgi.trailblazer.main
+Export-Package: org.jboss.test.osgi.trailblazer, org.jboss.test.osgi.trailblazer.types
Deleted: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/message.txt
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http/message.txt 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/message.txt 2009-05-11 21:38:26 UTC (rev 88675)
@@ -1 +0,0 @@
-Hello from Resource
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/pay-creditcard.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,11 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-payment-creditcard.jar src/test/resources/trailblazer/payment-creditcard.bnd
+
+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
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-pets.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,11 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-shop-pets.jar src/test/resources/trailblazer/shop-pets.bnd
+
+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
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/resources/trailblazer/shop-sports.bnd 2009-05-11 21:38:26 UTC (rev 88675)
@@ -0,0 +1,11 @@
+# bnd build -classpath target/test-classes -output target/test-libs/trailblazer-shop-sports.jar src/test/resources/trailblazer/shop-sports.bnd
+
+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: \
+ org.osgi.framework, \
+ org.osgi.service.log, \
+ org.jboss.osgi.common.log, \
+ org.jboss.test.osgi.trailblazer, \
+ org.jboss.test.osgi.trailblazer.types
17 years, 2 months
JBoss-OSGI SVN: r88578 - projects/jboss-osgi/trunk/testsuite.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-09 13:57:34 -0400 (Sat, 09 May 2009)
New Revision: 88578
Modified:
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Temporarily disable remote log against runtime (fails in hudson)
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-09 13:25:16 UTC (rev 88577)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-09 17:57:34 UTC (rev 88578)
@@ -354,7 +354,7 @@
<!-- Exclude tests that require jboss access -->
<exclude>org/jboss/test/osgi/jbossas/**</exclude>
<!-- Temporarily disable remote log against runtime (fails in hudson) -->
- <exclude>org/jboss/test/osgi/example/log/**</exclude>
+ <exclude>org/jboss/test/osgi/example/log/LogServiceTestCase.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -362,29 +362,6 @@
</build>
</profile>
- <!--
- Name: remote-testing
- Descr: Setup for remote integration testing
- -->
- <profile>
- <id>remote-testing</id>
- <activation>
- <property>
- <name>target.container</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
</profiles>
</project>
17 years, 2 months
JBoss-OSGI SVN: r88569 - in projects/jboss-osgi/trunk/testsuite: functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36 and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 19:35:03 -0400 (Fri, 08 May 2009)
New Revision: 88569
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/
Modified:
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Temporarily disable remote log against runtime (fails in hudson)
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 23:19:53 UTC (rev 88568)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 23:35:03 UTC (rev 88569)
@@ -353,6 +353,8 @@
<excludes>
<!-- Exclude tests that require jboss access -->
<exclude>org/jboss/test/osgi/jbossas/**</exclude>
+ <!-- Temporarily disable remote log against runtime (fails in hudson) -->
+ <exclude>org/jboss/test/osgi/example/log/**</exclude>
</excludes>
</configuration>
</plugin>
17 years, 2 months
JBoss-OSGI SVN: r88568 - projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 19:19:53 -0400 (Fri, 08 May 2009)
New Revision: 88568
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
Log:
Uninstall bundleA
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-08 23:18:57 UTC (rev 88567)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-08 23:19:53 UTC (rev 88568)
@@ -61,6 +61,8 @@
assertEquals("No Sub Bundle", 1, relevant.size());
assertEquals("jbosgi37-bundleA", relevant.get(0));
+
+ bundleA.uninstall();
}
finally
{
17 years, 2 months
JBoss-OSGI SVN: r88566 - in projects/jboss-osgi/trunk: runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 19:11:24 -0400 (Fri, 08 May 2009)
New Revision: 88566
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/logging/ExportedPackageHelper.java
Removed:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/ExportedPackageHelper.java
Modified:
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
Log:
Move ExportedPackageHelper to spi.logging
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -31,7 +31,7 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.spi.Constants;
-import org.jboss.osgi.spi.framework.ExportedPackageHelper;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -35,8 +35,8 @@
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.FrameworkException;
-import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -32,8 +32,8 @@
import org.apache.felix.framework.Felix;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.FrameworkException;
-import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -34,8 +34,8 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.FrameworkException;
-import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.logging.ExportedPackageHelper;
import org.knopflerfish.framework.Framework;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/ExportedPackageHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/ExportedPackageHelper.java 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/ExportedPackageHelper.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -1,81 +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.osgi.spi.framework;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * A helper the logs the exported packages for a bundle.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public final class ExportedPackageHelper
-{
- // Provide logging
- final Logger log = Logger.getLogger(ExportedPackageHelper.class);
-
- private PackageAdmin packageAdmin;
-
- public ExportedPackageHelper(BundleContext context)
- {
- ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
- packageAdmin = (PackageAdmin)context.getService(sref);
- }
-
- public boolean resolveBundle(Bundle bundle)
- {
- return packageAdmin.resolveBundles(new Bundle[] { bundle });
- }
-
- public boolean resolveBundles(Bundle[] bundles)
- {
- return packageAdmin.resolveBundles(bundles);
- }
-
- /*
- * * Log the list of exported packages
- */
- public void logExportedPackages(Bundle bundle)
- {
- log.debug("Exported-Packages: " + bundle.getSymbolicName());
-
- List<String> packages = new ArrayList<String>();
- for (ExportedPackage exp : packageAdmin.getExportedPackages(bundle))
- packages.add(" " + exp.getName() + ";version=" + exp.getVersion());
-
- Collections.sort(packages);
- for (String exp : packages)
- log.debug(exp);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/logging/ExportedPackageHelper.java (from rev 88424, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/ExportedPackageHelper.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/logging/ExportedPackageHelper.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/logging/ExportedPackageHelper.java 2009-05-08 23:11:24 UTC (rev 88566)
@@ -0,0 +1,81 @@
+/*
+ * 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.osgi.spi.logging;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * A helper the logs the exported packages for a bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public final class ExportedPackageHelper
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(ExportedPackageHelper.class);
+
+ private PackageAdmin packageAdmin;
+
+ public ExportedPackageHelper(BundleContext context)
+ {
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ packageAdmin = (PackageAdmin)context.getService(sref);
+ }
+
+ public boolean resolveBundle(Bundle bundle)
+ {
+ return packageAdmin.resolveBundles(new Bundle[] { bundle });
+ }
+
+ public boolean resolveBundles(Bundle[] bundles)
+ {
+ return packageAdmin.resolveBundles(bundles);
+ }
+
+ /*
+ * * Log the list of exported packages
+ */
+ public void logExportedPackages(Bundle bundle)
+ {
+ log.debug("Exported-Packages: " + bundle.getSymbolicName());
+
+ List<String> packages = new ArrayList<String>();
+ for (ExportedPackage exp : packageAdmin.getExportedPackages(bundle))
+ packages.add(" " + exp.getName() + ";version=" + exp.getVersion());
+
+ Collections.sort(packages);
+ for (String exp : packages)
+ log.debug(exp);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 22:53:15 UTC (rev 88565)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 23:11:24 UTC (rev 88566)
@@ -16,7 +16,6 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
- org.apache.log4j, \
org.jboss.logging, \
org.jboss.net.protocol, \
org.jboss.osgi.spi, \
17 years, 2 months
JBoss-OSGI SVN: r88565 - in projects/jboss-osgi/trunk: build/hudson/hudson-home and 9 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 18:53:15 -0400 (Fri, 08 May 2009)
New Revision: 88565
Removed:
projects/jboss-osgi/trunk/bundle/common/src/main/java/org/jboss/osgi/common/StringConstants.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/
Modified:
projects/jboss-osgi/trunk/build/hudson/hudson-home/config.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Log:
Fix Equinox,Knopflerfish startup. 'org.osgi.framework.system.packages.extra' seems not to work
Modified: projects/jboss-osgi/trunk/build/hudson/hudson-home/config.xml
===================================================================
--- projects/jboss-osgi/trunk/build/hudson/hudson-home/config.xml 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/build/hudson/hudson-home/config.xml 2009-05-08 22:53:15 UTC (rev 88565)
@@ -10,7 +10,6 @@
<tr align="left"><th>Bind Addr</th><td>@jboss.bind.address@</td></tr>
<tr align="left"><th>JavaDoc</th><td>
<a href='job/jbossosgi-jdk16/ws/jboss-osgi/spi/target/apidocs/index.html'>SPI</a>
-<a href='job/jbossosgi-jdk16/ws/jboss-osgi/runtime/testing/target/apidocs/index.html'>Testing</a>
</td></tr>
<tr align="left"><th>Userguide</th><td>
<a href='job/jbossosgi-jdk16/ws/jboss-osgi/build/distribution/target/auto-install-dest/docs/userguide/pdf/JBossOSGi - Userguide.pdf'>PDF</a>
Deleted: projects/jboss-osgi/trunk/bundle/common/src/main/java/org/jboss/osgi/common/StringConstants.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/common/src/main/java/org/jboss/osgi/common/StringConstants.java 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/bundle/common/src/main/java/org/jboss/osgi/common/StringConstants.java 2009-05-08 22:53:15 UTC (rev 88565)
@@ -1,113 +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.osgi.common;
-
-//$Id$
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleEvent;
-import org.osgi.service.log.LogService;
-
-/**
- * String representation for common OSGi Constants
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public abstract class StringConstants
-{
- /**
- * Return the string representation of a {@link Bundle} state
- */
- public static String bundleState(int bundleState)
- {
- String retState = "[" + bundleState + "]";
- if (Bundle.UNINSTALLED == bundleState)
- retState = "UNINSTALLED";
- else if (Bundle.INSTALLED == bundleState)
- retState = "INSTALLED";
- else if (Bundle.RESOLVED == bundleState)
- retState = "RESOLVED";
- else if (Bundle.STARTING == bundleState)
- retState = "STARTING";
- else if (Bundle.STOPPING == bundleState)
- retState = "STOPPING";
- else if (Bundle.ACTIVE == bundleState)
- retState = "ACTIVE";
- return retState;
- }
-
- /**
- * Return the string representation of a {@link BundleEvent} type
- */
- public static String bundleEvent(int eventType)
- {
- String retType = "[" + eventType + "]";
- if (BundleEvent.INSTALLED == eventType)
- retType = "INSTALLED";
- else if (BundleEvent.LAZY_ACTIVATION == eventType)
- retType = "LAZY_ACTIVATION";
- else if (BundleEvent.RESOLVED == eventType)
- retType = "RESOLVED";
- else if (BundleEvent.STARTING == eventType)
- retType = "STARTING";
- else if (BundleEvent.STARTED == eventType)
- retType = "STARTED";
- else if (BundleEvent.STOPPING == eventType)
- retType = "STOPPING";
- else if (BundleEvent.STOPPED == eventType)
- retType = "STOPPED";
- else if (BundleEvent.UNINSTALLED == eventType)
- retType = "UNINSTALLED";
- else if (BundleEvent.UNRESOLVED == eventType)
- retType = "UNRESOLVED";
- else if (BundleEvent.UPDATED == eventType)
- retType = "UPDATED";
- return retType;
- }
-
- /**
- * Return the string representation of a {@link LogService} level
- */
- public static String logLevel(int level)
- {
- String logLevel;
- switch (level)
- {
- case LogService.LOG_DEBUG:
- logLevel = "DEBUG";
- break;
- case LogService.LOG_INFO:
- logLevel = "INFO";
- break;
- case LogService.LOG_WARNING:
- logLevel = "WARN";
- break;
- case LogService.LOG_ERROR:
- logLevel = "ERROR";
- break;
- default:
- logLevel = "Level=" + level;
- }
- return logLevel;
- }
-}
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-08 22:53:15 UTC (rev 88565)
@@ -48,7 +48,7 @@
<version.felix.metatype>1.0.2</version.felix.metatype>
<version.felix.osgi.core>1.2.0</version.felix.osgi.core>
<version.felix.webconsole>1.2.8</version.felix.webconsole>
- <version.izpack>4.3.0</version.izpack>
+ <version.izpack>4.2.0</version.izpack>
<version.javax.servlet>2.4</version.javax.servlet>
<version.jaxb.bundle>2.1.10-SNAPSHOT</version.jaxb.bundle>
<version.jbossas>5.0.1.GA</version.jbossas>
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-05-08 22:53:15 UTC (rev 88565)
@@ -31,6 +31,7 @@
import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.osgi.spi.Constants;
+import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -94,10 +95,12 @@
private void simpleStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
{
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
try
{
bundle.start();
log.info("Started: " + bundle);
+ packageHelper.logExportedPackages(bundle);
}
catch (BundleException e)
{
@@ -107,6 +110,8 @@
private void deferredStart(DeploymentUnit unit, Bundle bundle) throws DeploymentException
{
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(systemContext);
+
// Get the required dependency on the PackageAdmin service
if (packageAdmin == null)
{
@@ -136,6 +141,7 @@
try
{
auxBundle.start();
+ packageHelper.logExportedPackages(bundle);
log.info("Started: " + bundle);
}
catch (BundleException e)
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
@@ -35,6 +35,7 @@
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.FrameworkException;
+import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -123,31 +124,26 @@
FrameworkProperties.setProperty(LocationManager.PROP_INSTALL_AREA, userHome + "/equinox");
}
- // Init & Start the Framework
+ // Init the Framework
framework = new Framework(new FrameworkAdaptorImpl());
- framework.launch();
}
- private void assertFrameworkCreate()
+ public void start()
{
- if (framework == null)
- create();
- }
-
- private void assertFrameworkStart()
- {
assertFrameworkCreate();
- if ((framework.getBundle(0).getState() & Bundle.ACTIVE) == 0)
- start();
- }
-
- public void start()
- {
+
+ // Start the Framework
+ framework.launch();
+
// Get system bundle context
BundleContext context = getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
+ // Log the the framework packages
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(context);
+ packageHelper.logExportedPackages(getBundle());
+
Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
@@ -178,6 +174,7 @@
{
Bundle bundle = autoBundles.get(bundleURL);
bundle.start();
+ packageHelper.logExportedPackages(bundle);
log.info("Started bundle: " + bundle.getSymbolicName());
}
catch (BundleException ex)
@@ -194,4 +191,17 @@
framework.shutdown();
}
}
+
+ private void assertFrameworkCreate()
+ {
+ if (framework == null)
+ create();
+ }
+
+ private void assertFrameworkStart()
+ {
+ assertFrameworkCreate();
+ if ((framework.getBundle(0).getState() & Bundle.ACTIVE) == 0)
+ start();
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 22:53:15 UTC (rev 88565)
@@ -1,7 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ $Id$
+-->
+
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!--
+ ********************************
+ * *
+ * Framework *
+ * *
+ ********************************
+ -->
+
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.framework.EquinoxIntegration">
<property name="properties">
@@ -12,14 +24,17 @@
<entry><key>osgi.install.area</key><value>${jboss.server.data.dir}/equinox</value></entry>
<entry><key>felix.cm.dir</key><value>${jboss.server.data.dir}/osgi-configadmin</value></entry>
<entry>
- <key>org.osgi.framework.system.packages.extra</key>
+ <key>org.osgi.framework.system.packages</key>
<value>
+ javax.management,
+ javax.xml.parsers,
org.jboss.logging,
org.jboss.osgi.spi.service,
org.jboss.osgi.spi.management,
org.osgi.framework; version=1.4,
org.osgi.service.packageadmin; version=1.2,
org.osgi.service.startlevel; version=1.1,
+ org.xml.sax
</value>
</entry>
<!--
@@ -27,25 +42,62 @@
If set to 'false' bundles must be deployed in the order that is required to start them.
-->
<entry><key>org.jboss.osgi.deferred.start</key><value>true</value></entry>
+ <!--
+ Setup remote logging
+ -->
+ <entry><key>org.jboss.osgi.service.remote.log.sender</key><value>true</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
</map>
</property>
</bean>
<!-- The Framework Management -->
<bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
- <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
- <!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
- <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
- <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- A Service that gives access to the Microcontainer -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.internal.MicrocontainerServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
+ <!-- A Service that gives access to JNDI -->
+ <bean name="jboss.osgi:service=Naming" class="org.jboss.osgi.jndi.internal.NamingServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ </bean>
+
+ <!-- A Service that gives access to the MBeanServer -->
+ <bean name="jboss.osgi:service=Management" class="org.jboss.osgi.jmx.internal.ManagementServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * Deployers *
+ * *
+ ********************************
+ -->
+
<!-- The OSGi MetaData Deployer -->
<bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
+ <!-- The OSGi Bundle Structure Deployer -->
+ <bean name="jboss.osgi:service=BundleStructureDeployer" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
<!-- The OSGi Bundle Deployer -->
<bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
@@ -132,6 +132,10 @@
if (context == null)
throw new FrameworkException("Cannot obtain system context");
+ // Log the the framework packages
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(context);
+ packageHelper.logExportedPackages(getBundle());
+
Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
@@ -157,7 +161,6 @@
}
// Start autoStart bundles
- ExportedPackageHelper packageHelper = new ExportedPackageHelper(context);
for (URL bundleURL : autoStart)
{
try
@@ -177,19 +180,6 @@
}
}
- private void assertFrameworkCreate()
- {
- if (framework == null)
- create();
- }
-
- private void assertFrameworkStart()
- {
- assertFrameworkCreate();
- if ((framework.getState() & Bundle.ACTIVE) == 0)
- start();
- }
-
public void stop()
{
if (framework != null)
@@ -211,4 +201,17 @@
}
}
}
+
+ private void assertFrameworkCreate()
+ {
+ if (framework == null)
+ create();
+ }
+
+ private void assertFrameworkStart()
+ {
+ assertFrameworkCreate();
+ if ((framework.getState() & Bundle.ACTIVE) == 0)
+ start();
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-08 22:53:15 UTC (rev 88565)
@@ -34,6 +34,7 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.FrameworkException;
+import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.knopflerfish.framework.Framework;
import org.osgi.framework.Bundle;
@@ -146,11 +147,10 @@
PrintStream sysErr = System.err;
System.setErr(new PrintStream(new ByteArrayOutputStream()));
- // Init & Start the Framework
+ // Init the Framework
try
{
framework = new Framework(null);
- framework.launch(0);
}
catch (RuntimeException rte)
{
@@ -169,11 +169,31 @@
public void start()
{
+ assertFrameworkCreate();
+
+ // Start the Framework
+ try
+ {
+ framework.launch(0);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new FrameworkException("Cannot start system bundle", ex);
+ }
+
// Get system bundle context
BundleContext context = getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
+ // Log the the framework packages
+ ExportedPackageHelper packageHelper = new ExportedPackageHelper(context);
+ packageHelper.logExportedPackages(getBundle());
+
Map<URL, Bundle> autoBundles = new HashMap<URL, Bundle>();
// Add the autoStart bundles to autoInstall
@@ -204,6 +224,7 @@
{
Bundle bundle = autoBundles.get(bundleURL);
bundle.start();
+ packageHelper.logExportedPackages(bundle);
log.info("Started bundle: " + bundle.getSymbolicName());
}
catch (BundleException ex)
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 22:53:15 UTC (rev 88565)
@@ -1,7 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ $Id$
+-->
+
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!--
+ ********************************
+ * *
+ * Framework *
+ * *
+ ********************************
+ -->
+
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.knopflerfish.framework.KnopflerfishIntegration">
<property name="properties">
@@ -11,14 +23,17 @@
<entry><key>org.osgi.framework.dir</key><value>${jboss.server.data.dir}/knopflerfish</value></entry>
<entry><key>felix.cm.dir</key><value>${jboss.server.data.dir}/osgi-configadmin</value></entry>
<entry>
- <key>org.osgi.framework.system.packages.extra</key>
+ <key>org.osgi.framework.system.packages</key>
<value>
+ javax.management,
+ javax.xml.parsers,
org.jboss.logging,
org.jboss.osgi.spi.service,
org.jboss.osgi.spi.management,
org.osgi.framework; version=1.4,
org.osgi.service.packageadmin; version=1.2,
org.osgi.service.startlevel; version=1.1,
+ org.xml.sax
</value>
</entry>
<!--
@@ -26,22 +41,56 @@
If set to 'false' bundles must be deployed in the order that is required to start them.
-->
<entry><key>org.jboss.osgi.deferred.start</key><value>true</value></entry>
+ <!--
+ Setup remote logging
+ -->
+ <entry><key>org.jboss.osgi.service.remote.log.sender</key><value>true</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
+ <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
</map>
</property>
</bean>
<!-- The Framework Management -->
<bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
- <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
- <!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
- <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
- <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- A Service that gives access to the Microcontainer -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.internal.MicrocontainerServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
+ <!-- A Service that gives access to JNDI -->
+ <bean name="jboss.osgi:service=Naming" class="org.jboss.osgi.jndi.internal.NamingServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ </bean>
+
+ <!-- A Service that gives access to the MBeanServer -->
+ <bean name="jboss.osgi:service=Management" class="org.jboss.osgi.jmx.internal.ManagementServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * Deployers *
+ * *
+ ********************************
+ -->
+
<!-- The OSGi MetaData Deployer -->
<bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 22:30:54 UTC (rev 88564)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 22:53:15 UTC (rev 88565)
@@ -16,7 +16,6 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
- org.apache.log4j, \
org.jboss.logging, \
org.jboss.net.protocol, \
org.jboss.osgi.spi, \
17 years, 2 months