[jboss-cvs] JBossAS SVN: r89355 - in projects/jboss-osgi/projects/bundles: blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context and 15 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 25 03:58:25 EDT 2009


Author: thomas.diesler at jboss.com
Date: 2009-05-25 03:58:25 -0400 (Mon, 25 May 2009)
New Revision: 89355

Added:
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintException.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanA.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanB.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/
   projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/basic-service.xml
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/
   projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java
Log:
Add blueprint integration test module

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintException.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintException.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintException.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,51 @@
+/*
+ * 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.blueprint;
+
+//$Id$
+
+/**
+ * The Blueprint implementation throws this exception on various 
+ * error conditions. 
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintException extends RuntimeException 
+{
+   private static final long serialVersionUID = 1L;
+   
+   public BlueprintException(String message, Throwable cause)
+   {
+      super(message, cause);
+   }
+
+   public BlueprintException(String message)
+   {
+      super(message);
+   }
+
+   public BlueprintException(Throwable cause)
+   {
+      super(cause);
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintException.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -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.osgi.blueprint.context;
+
+//$Id$
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.context.BlueprintContext;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+
+/**
+ * BlueprintContext providing access to the components, service exports, and
+ * service references of a bundle using blueprint services.
+ * 
+ * For details see {@link BlueprintContext}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-May-2009
+ */
+public class BlueprintContextImpl implements BlueprintContext
+{
+   private Blueprint blueprintMetadata;
+   
+   public BlueprintContextImpl(Blueprint blueprintMetadata)
+   {
+      this.blueprintMetadata = blueprintMetadata;
+   }
+   
+   public Collection getBeanComponentsMetadata()
+   {
+      throw new NotImplementedException();
+   }
+
+   public BundleContext getBundleContext()
+   {
+      throw new NotImplementedException();
+   }
+
+   public Object getComponent(String name)
+   {
+      throw new NotImplementedException();
+   }
+
+   public ComponentMetadata getComponentMetadata(String name)
+   {
+      throw new NotImplementedException();
+   }
+
+   public Set getComponentNames()
+   {
+      throw new NotImplementedException();
+   }
+
+   public Collection getExportedServicesMetadata()
+   {
+      throw new NotImplementedException();
+   }
+
+   public Collection getReferencedServicesMetadata()
+   {
+      throw new NotImplementedException();
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/context/BlueprintContextImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,56 @@
+/*
+ * 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.blueprint.extender;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleListener;
+
+/**
+ * The Blueprint activator registeres the {@link BlueprintExtender} 
+ * as {@link BundleListener}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintActivator implements BundleActivator
+{
+   private BlueprintExtender extender;
+   
+   public void start(BundleContext context) throws Exception
+   {
+      extender = new BlueprintExtender(context);
+      context.addBundleListener(extender);
+   }
+
+   public void stop(BundleContext context) throws Exception
+   {
+      if (extender != null)
+      {
+         context.removeBundleListener(extender);
+         extender.stop();
+         extender = null;
+      }
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,125 @@
+/*
+ * 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.blueprint.extender;
+
+//$Id$
+
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.jboss.osgi.blueprint.context.BlueprintContextImpl;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.service.blueprint.context.BlueprintContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * The Blueprint extender
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintExtender implements BundleListener
+{
+   private static final String HEADER_BUNDLE_BLUEPRINT = "Bundle-Blueprint";
+
+   private LogService log;
+   
+   // A 
+   // private Map<String, Blueprint> compDefRegistry = new HashMap<String, Blueprint>(); 
+
+   public BlueprintExtender(BundleContext context)
+   {
+      this.log = new LogServiceTracker(context);
+   }
+
+   @SuppressWarnings("unchecked")
+   public void bundleChanged(BundleEvent event)
+   {
+      Bundle bundle = event.getBundle();
+      Blueprint bpMetadata = null;
+      
+      if (event.getType() == BundleEvent.STARTED)
+      {
+         // If a Bundle-Blueprint manifest header is defined, then this header contains a list of paths. 
+         // If this header is not defined, then resources ending in .xml in the bundle’s
+         // OSGI-INF/blueprint directory must be used. These are the resources that
+         // would be found by calling the Bundle findEntries("OSGI-INF/blueprint", "*.xml", false) method.
+
+         String descriptorPaths = (String)bundle.getHeaders().get(HEADER_BUNDLE_BLUEPRINT);
+         if (descriptorPaths != null)
+         {
+            log.log(LogService.LOG_INFO, HEADER_BUNDLE_BLUEPRINT + ": " + descriptorPaths + " in bundle: " + bundle);
+            String[] descritors = descriptorPaths.split(", ");
+            
+            for (String descriptor : descritors)
+            {
+               Blueprint aux = processDescriptor(bundle, descriptor);
+               bpMetadata = aux.merge(bpMetadata);
+            }
+         }
+
+         Enumeration foundEntries = bundle.findEntries("OSGI-INF/blueprint", "*.xml", false);
+         if (foundEntries != null)
+         {
+            while (foundEntries.hasMoreElements())
+            {
+               URL nextEntry = (URL)foundEntries.nextElement();
+               Blueprint aux = processDescriptor(bundle, nextEntry);
+               bpMetadata = aux.merge(bpMetadata);
+            }
+         }
+      }
+      
+      // Register the BlueprintContext
+      if (bpMetadata != null)
+      {
+         BlueprintContext bpContext = new BlueprintContextImpl(bpMetadata);
+         bundle.getBundleContext().registerService(BlueprintContext.class.getName(), bpContext, null);
+      }
+   }
+
+   /**
+    * Stop the BlueprintExtender
+    */
+   public void stop()
+   {
+      // currently does nothing
+   }
+   
+   private Blueprint processDescriptor(Bundle bundle, String descriptor)
+   {
+      URL descriptorURL = bundle.getResource(descriptor);
+      return processDescriptor(bundle, descriptorURL);
+   }
+
+   private Blueprint processDescriptor(Bundle bundle, URL descriptorURL)
+   {
+      Blueprint blueprint = new BlueprintParser().parse(descriptorURL);
+      return blueprint;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,59 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+
+/**
+ * Blueprint parser tests
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BasicBeansParserTestCase extends OSGiTest
+{
+   public void testBasicBeans() throws Exception
+   {
+      URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
+      Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+      
+      List<ComponentMetadataImpl> compList = blueprint.getComponents();
+      assertTrue(compList.size() > 0);
+      
+      BeanMetadata beanA = (BeanMetadata)compList.get(0);
+      assertEquals(BeanA.class.getName(), beanA.getClassName());
+      assertEquals("beanA", beanA.getId());
+      
+      BeanMetadata beanB = (BeanMetadata)compList.get(1);
+      assertEquals(BeanB.class.getName(), beanB.getClassName());
+      assertEquals("beanB", beanB.getId());
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,63 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import java.math.BigInteger;
+import java.net.URL;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Availability;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.spi.testing.OSGiTest;
+
+/**
+ * Blueprint parser tests
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BasicRootParserTestCase extends OSGiTest
+{
+   public void testBlueprintDefaultAttributes() throws Exception
+   {
+      URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
+      Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+      
+      // assert default attributes
+      assertEquals(Availability.MANDATORY, blueprint.getDefaultAvailability());
+      assertEquals(new BigInteger("300000"), blueprint.getDefaultTimeout());
+      assertEquals(Boolean.FALSE, blueprint.isDefaultLazyInit());
+      assertNull(blueprint.getDefaultInitMethod());
+      assertNull(blueprint.getDefaultDestroyMethod());
+   }
+
+   public void testBlueprintDescription() throws Exception
+   {
+      URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
+      Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+      
+      // assert description
+      assertEquals("some text", blueprint.getDescription());
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,70 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+
+/**
+ * Blueprint parser tests
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BasicServiceParserTestCase extends OSGiTest
+{
+   public void testBasicBeans() throws Exception
+   {
+      URL xmlURL = getResourceURL("parser/blueprint-basic-service.xml");
+      Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+      
+      List<ComponentMetadataImpl> compList = blueprint.getComponents();
+      assertTrue(compList.size() > 0);
+      
+      BeanMetadata beanA = (BeanMetadata)compList.get(0);
+      assertEquals(BeanA.class.getName(), beanA.getClassName());
+      assertEquals("beanA", beanA.getId());
+      
+      ServiceMetadata serviceA = (ServiceMetadata)compList.get(1);
+      assertEquals("serviceA", serviceA.getId());
+      
+      List<String> intfsA = serviceA.getInterfaceNames();
+      assertTrue(intfsA.size() > 0);
+      assertEquals(ServiceA.class.getName(), intfsA.get(0));
+      
+      ServiceMetadata serviceB = (ServiceMetadata)compList.get(2);
+      assertEquals("serviceB", serviceB.getId());
+      
+      List<String> intfsB = serviceB.getInterfaceNames();
+      assertTrue(intfsB.size() > 0);
+      assertEquals(ServiceB.class.getName(), intfsB.get(0));
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanA.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanA.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanA.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,45 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic bean
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BeanA 
+{
+   private BeanB beanB;
+
+   public BeanB getBeanB()
+   {
+      return beanB;
+   }
+
+   public void setBeanB(BeanB beanB)
+   {
+      this.beanB = beanB;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanA.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanB.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanB.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanB.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,45 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic bean
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class BeanB 
+{
+   private BeanA beanA;
+
+   public BeanA getBeanA()
+   {
+      return beanA;
+   }
+
+   public void setBeanA(BeanA beanA)
+   {
+      this.beanA = beanA;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BeanB.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,34 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic service
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceA 
+{
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceA.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,34 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+/**
+ * A basic service
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public interface ServiceB 
+{
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/ServiceB.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/basic-service.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/basic-service.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/basic-service.xml	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,14 @@
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd schema/blueprint.xsd">
+  
+  <bean id="beanA" class="org.jboss.test.osgi.blueprint.context.BeanA">
+  </bean>
+  
+  <service id="serviceA" ref="beanA" interface="org.jboss.test.osgi.blueprint.context.ServiceA">
+  </service>
+  
+  <service id="serviceB" interface="org.jboss.test.osgi.blueprint.context.ServiceB">
+    <bean class="org.jboss.test.osgi.blueprint.context.BeanB"/>
+  </service>
+  
+</blueprint>
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/blueprint/trunk/testsuite/src/test/resources/context/OSGI-INF/blueprint/basic-service.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java	2009-05-25 07:58:25 UTC (rev 89355)
@@ -0,0 +1,49 @@
+/*
+ * 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.jbossxb.internal;
+
+//$Id$
+
+import org.apache.xerces.xs.XSImplementation;
+import org.jboss.xb.binding.Util;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleListener;
+
+/**
+ * The Blueprint activator registeres the {@link BlueprintExtender} 
+ * as {@link BundleListener}
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 13-May-2009
+ */
+public class Activator implements BundleActivator
+{
+   public void start(BundleContext context) throws Exception
+   {
+      XSImplementation implementation = Util.getXSImplementation();
+   }
+
+   public void stop(BundleContext context) throws Exception
+   {
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jbossxb/trunk/src/main/java/org/jboss/osgi/jbossxb/internal/Activator.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-cvs-commits mailing list