[jboss-cvs] JBossAS SVN: r60790 - in projects/microcontainer/trunk: dependency/src/main/org/jboss/dependency/plugins and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 22 05:56:29 EST 2007
Author: alesj
Date: 2007-02-22 05:56:29 -0500 (Thu, 22 Feb 2007)
New Revision: 60790
Added:
projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScope.java
projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScopeFactory.java
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassLoaderTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ScopingTestCase.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedFromAppBeanImpl.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1BeanImpl.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1ObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2BeanImpl.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2ObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment3ObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment4ObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromAppBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromBootBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithBeanAware.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromAppBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromBootBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractBeanMetaDataTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassloaderTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingDeploymentTest.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java
Modified:
projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/Controller.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/InstallAction.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ScopedKernelController.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java
projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java
projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleObjectWithBean.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
Log:
Scoping controller - adding Scope lookup in PreInstallAction.
Constructing new Kernel for ScopingController.
Additional BeanMetaData test - BeanMD as ValueMD.
Scoping tests.
Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScope.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScope.java (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScope.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.metadata.plugins.scope;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.metadata.spi.scope.ScopeFactoryLookup;
+
+/**
+ * Application scope annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at ScopeFactoryLookup(ApplicationScopeFactory.class)
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.TYPE})
+public @interface ApplicationScope
+{
+ String value();
+}
Added: projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScopeFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScopeFactory.java (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/metadata/plugins/scope/ApplicationScopeFactory.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.metadata.plugins.scope;
+
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeFactory;
+
+/**
+ * Factory for creating Application scope key
+ * from ApplicationScope annotation.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ApplicationScopeFactory implements ScopeFactory<ApplicationScope>
+{
+ public Scope create(ApplicationScope annotation)
+ {
+ return new Scope(CommonLevels.APPLICATION, annotation.value());
+ }
+}
Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/plugins/AbstractController.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -22,7 +22,6 @@
package org.jboss.dependency.plugins;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -64,7 +63,7 @@
protected Set<ControllerContext> installing = CollectionsFactory.createCopyOnWriteSet();
/** The child controllers */
- protected Set<Controller> childControllers = CollectionsFactory.createCopyOnWriteSet();
+ protected Set<AbstractController> childControllers = CollectionsFactory.createCopyOnWriteSet();
/** Whether an on demand context has been enabled */
protected boolean onDemandEnabled = true;
@@ -112,17 +111,37 @@
}
}
- public Set<Controller> getControllers()
+ public void addControllerContext(ControllerContext context)
{
- return childControllers;
+ Object name = context.getName();
+ if (allContexts.containsKey(name) == false)
+ allContexts.put(name, context);
+ else
+ log.warn("Unable to put/return context to allContexts, name already exists: " + context);
}
+ public void removeControllerContext(ControllerContext context)
+ {
+ allContexts.remove(context.getName());
+ }
+
+ public Set<AbstractController> getControllers()
+ {
+ return childControllers;
+ }
+
// no need for locking - we are already locked
- public void addController(Controller controller)
+
+ public boolean addController(AbstractController controller)
{
- childControllers.add(controller);
+ return childControllers.add(controller);
}
+ public boolean removeController(AbstractController controller)
+ {
+ return childControllers.remove(controller);
+ }
+
public ControllerContext getContext(Object name, ControllerState state)
{
if (name == null)
@@ -162,7 +181,7 @@
Set<ControllerContext> result = new HashSet<ControllerContext>(errorContexts.values());
for (int i = 0; ControllerState.INSTALLED.equals(states.get(i)) == false; ++i)
{
- Set<ControllerContext> stateContexts = contextsByState.get(states.get(i));
+ Set<ControllerContext> stateContexts = getContextsByState(states.get(i));
result.addAll(stateContexts);
}
return result;
@@ -178,6 +197,11 @@
return states;
}
+ public Set<ControllerContext> getContextsByState(ControllerState state)
+ {
+ return contextsByState.get(state);
+ }
+
public void install(ControllerContext context) throws Throwable
{
boolean trace = log.isTraceEnabled();
@@ -217,6 +241,13 @@
public ControllerContext uninstall(Object name)
{
+ return uninstall(name, 0);
+ }
+
+ // todo - some better way to find context's by name
+ // currently the first one found is used
+ protected ControllerContext uninstall(Object name, int level)
+ {
boolean trace = log.isTraceEnabled();
if (name == null)
@@ -229,15 +260,26 @@
log.trace("Tidied up context in error state: " + name);
ControllerContext context = allContexts.get(name);
- if (context == null)
- throw new IllegalStateException("Not installed: " + name);
+ if (context != null)
+ {
+ if (trace)
+ log.trace("Uninstalling " + context.toShortString());
- if (trace)
- log.trace("Uninstalling " + context.toShortString());
+ uninstallContext(context, ControllerState.NOT_INSTALLED, trace);
- uninstallContext(context, ControllerState.NOT_INSTALLED, trace);
-
- allContexts.remove(name);
+ allContexts.remove(name);
+ }
+ else
+ {
+ for(AbstractController controller : childControllers)
+ {
+ context = controller.uninstall(name, level + 1);
+ if (context != null)
+ break;
+ }
+ }
+ if (context == null && level == 0)
+ throw new IllegalStateException("Not installed: " + name);
return context;
}
finally
@@ -395,6 +437,7 @@
{
ControllerState fromState = context.getState();
+ Controller fromController = context.getController();
Set fromContexts = null;
int currentIndex = -1;
@@ -422,21 +465,20 @@
return false;
}
}
- Set<ControllerContext> notInstalled = contextsByState.get(ControllerState.NOT_INSTALLED);
+ Set<ControllerContext> notInstalled = fromController.getContextsByState(ControllerState.NOT_INSTALLED);
notInstalled.add(context);
context.setState(ControllerState.NOT_INSTALLED);
}
else
{
currentIndex = states.indexOf(fromState);
- fromContexts = contextsByState.get(fromState);
+ fromContexts = fromController.getContextsByState(fromState);
if (fromContexts.contains(context) == false)
throw new IllegalStateException("Context not found in previous state: " + context.toShortString());
}
int toIndex = currentIndex + 1;
ControllerState toState = states.get(toIndex);
- Set<ControllerContext> toContexts = contextsByState.get(toState);
unlockWrite();
Throwable error = null;
@@ -463,6 +505,8 @@
if (fromContexts != null)
fromContexts.remove(context);
+ Controller toController = context.getController();
+ Set<ControllerContext> toContexts = toController.getContextsByState(toState);
toContexts.add(context);
context.setState(toState);
return true;
@@ -503,15 +547,28 @@
Set<ControllerContext> stillUnresolved = contextsByState.get(state);
if (stillUnresolved.isEmpty() == false)
{
- for (Iterator j = stillUnresolved.iterator(); j.hasNext();)
+ for (ControllerContext ctx : stillUnresolved)
{
- ControllerContext ctx = (ControllerContext) j.next();
if (advance(ctx))
log.trace("Still unresolved " + nextState.getStateString() + ": " + ctx);
}
}
}
}
+
+ // resolve child controllers
+ for (AbstractController controller : childControllers)
+ {
+ controller.lockWrite();
+ try
+ {
+ controller.resolveContexts(trace);
+ }
+ finally
+ {
+ controller.unlockWrite();
+ }
+ }
}
/**
@@ -531,9 +588,8 @@
Set<ControllerContext> resolved = resolveContexts(unresolved, toState, trace);
if (resolved.isEmpty() == false)
{
- for (Iterator i = resolved.iterator(); i.hasNext();)
+ for (ControllerContext context : resolved)
{
- ControllerContext context = (ControllerContext) i.next();
Object name = context.getName();
if (fromState.equals(context.getState()) == false)
{
@@ -586,9 +642,8 @@
if (contexts.isEmpty() == false)
{
- for (Iterator i = contexts.iterator(); i.hasNext();)
+ for (ControllerContext ctx : contexts)
{
- ControllerContext ctx = (ControllerContext) i.next();
if (advance(ctx))
{
DependencyInfo dependencies = ctx.getDependencyInfo();
@@ -649,17 +704,18 @@
if (trace)
log.trace("Uninstalling " + name + " from " + fromState.getStateString());
- Set<ControllerContext> fromContexts = contextsByState.get(fromState);
+ Controller fromController = context.getController();
+
+ Set<ControllerContext> fromContexts = fromController.getContextsByState(fromState);
if (fromContexts == null || fromContexts.remove(context) == false)
throw new Error("INTERNAL ERROR: context not found in previous state " + fromState.getStateString() + " context=" + context.toShortString(), new Exception("STACKTRACE"));
DependencyInfo dependencies = context.getDependencyInfo();
- Set dependsOnMe = dependencies.getDependsOnMe(null);
+ Set<DependencyItem> dependsOnMe = dependencies.getDependsOnMe(null);
if (dependsOnMe.isEmpty() == false)
{
- for (Iterator i = dependsOnMe.iterator(); i.hasNext();)
+ for (DependencyItem item : dependsOnMe)
{
- DependencyItem item = (DependencyItem) i.next();
if (item.isResolved())
{
ControllerState dependentState = item.getDependentState();
@@ -690,14 +746,16 @@
}
ControllerState toState = states.get(toIndex);
- Set<ControllerContext> toContexts = contextsByState.get(toState);
- toContexts.add(context);
- context.setState(toState);
unlockWrite();
try
{
uninstall(context, fromState, toState);
+
+ Controller toController = context.getController();
+ Set<ControllerContext> toContexts = toController.getContextsByState(toState);
+ toContexts.add(context);
+ context.setState(toState);
}
catch (Throwable t)
{
Modified: projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/Controller.java
===================================================================
--- projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/Controller.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/dependency/src/main/org/jboss/dependency/spi/Controller.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -112,16 +112,10 @@
List<ControllerState> getStates();
/**
- * Get the child controllers
+ * Get the contexts in certain state
*
- * @return child controllers
+ * @param state controller state to get contexts for
+ * @return set of contexts in certain state
*/
- Set<Controller> getControllers();
-
- /**
- * Add a child controller.
- *
- * @param controller new scoped controller instance
- */
- void addController(Controller controller);
+ Set<ControllerContext> getContextsByState(ControllerState state);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -47,6 +47,7 @@
import org.jboss.dependency.spi.ControllerMode;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.util.JBossObject;
import org.jboss.util.JBossStringBuilder;
@@ -451,17 +452,17 @@
public void initialVisit(MetaDataVisitor visitor)
{
- if (visitor.visitorNodeStack().isEmpty() == false || (classLoader != null && classLoader.getClassLoader() != this))
+ KernelControllerContext ctx = visitor.getControllerContext();
+ if (ctx.getBeanMetaData() == this)
+ context = ctx;
+ boolean isInnerBean = visitor.visitorNodeStack().isEmpty() == false;
+ if (isInnerBean)
{
- context = visitor.getControllerContext();
- Object name = context.getName();
+ Object name = ctx.getName();
Object iDependOn = getUnderlyingValue();
- if (name.equals(iDependOn) == false)
- {
- ControllerState whenRequired = visitor.getContextState();
- DependencyItem di = new AbstractDependencyItem(name, iDependOn, whenRequired, ControllerState.INSTALLED);
- visitor.addDependency(di);
- }
+ ControllerState whenRequired = visitor.getContextState();
+ DependencyItem di = new AbstractDependencyItem(name, iDependOn, whenRequired, ControllerState.INSTALLED);
+ visitor.addDependency(di);
}
super.initialVisit(visitor);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/AbstractKernelControllerContext.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -81,6 +81,9 @@
/** The scope */
protected ScopeKey scope;
+ /** The install scope */
+ protected ScopeKey installScope;
+
/**
* Create an abstract controller context
*
@@ -159,6 +162,16 @@
this.scope = key;
}
+ public ScopeKey getInstallScope()
+ {
+ return installScope;
+ }
+
+ public void setInstallScope(ScopeKey key)
+ {
+ this.installScope = key;
+ }
+
public void toString(JBossStringBuilder buffer)
{
if (metaData != null)
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/InstallAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/InstallAction.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/InstallAction.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -55,12 +55,11 @@
registry.registerEntry(name, context);
controller.addSupplies(context);
- List installs = metaData.getInstalls();
+ List<InstallMetaData> installs = metaData.getInstalls();
if (installs != null)
{
- for (int i = 0; i < installs.size(); ++i)
+ for (InstallMetaData install : installs)
{
- InstallMetaData install = (InstallMetaData) installs.get(i);
ControllerContext target = context;
if (install.getBean() != null)
target = controller.getContext(install.getBean(), install.getDependentState());
@@ -90,12 +89,12 @@
BeanMetaData metaData = context.getBeanMetaData();
Object name = metaData.getName();
- List uninstalls = metaData.getUninstalls();
+ List<InstallMetaData> uninstalls = metaData.getUninstalls();
if (uninstalls != null)
{
for (int i = uninstalls.size()-1; i >= 0; --i)
{
- InstallMetaData uninstall = (InstallMetaData) uninstalls.get(i);
+ InstallMetaData uninstall = uninstalls.get(i);
ControllerContext target = context;
if (uninstall.getBean() != null)
{
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PreInstallAction.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -27,7 +27,7 @@
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.plugins.AbstractController;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.config.KernelConfigurator;
import org.jboss.kernel.spi.dependency.KernelController;
@@ -53,7 +53,7 @@
{
protected void installActionInternal(KernelControllerContext context) throws Throwable
{
- KernelController controller = (KernelController) context.getController();
+ KernelController controller = (KernelController)context.getController();
Kernel kernel = controller.getKernel();
KernelConfigurator configurator = kernel.getConfigurator();
@@ -67,7 +67,7 @@
repository.addMetaData(context);
try
{
- //applyScoping(context);
+ applyScoping(context);
}
catch (Throwable t)
{
@@ -77,10 +77,12 @@
}
}
- protected void applyScoping(KernelControllerContext context) throws Throwable
+ @SuppressWarnings("unchecked")
+ protected ScopeKey getInstallScopeKey(
+ KernelControllerContext context,
+ KernelController controller,
+ KernelMetaDataRepository repository) throws Throwable
{
- KernelController controller = (KernelController)context.getController();
- KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(context);
if (retrieval != null)
{
@@ -91,7 +93,7 @@
if (annotationItems != null && annotationItems.length > 0)
{
Collection<Scope> scopes = new HashSet<Scope>();
- for(AnnotationItem annItem : annotationItems)
+ for (AnnotationItem annItem : annotationItems)
{
Annotation annotation = annItem.getAnnotation();
if (annotation.annotationType().isAnnotationPresent(ScopeFactoryLookup.class))
@@ -103,62 +105,109 @@
}
if (scopes.size() > 0)
{
- ScopeKey scopeKey = new ScopeKey(scopes);
- // todo - should this be done (repare the current context scope key)
- // or where to store this 'deployment' key?
+ return new ScopeKey(scopes);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void applyScoping(KernelControllerContext context) throws Throwable
+ {
+ KernelController controller = (KernelController)context.getController();
+ KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
+ ScopeKey scopeKey = getInstallScopeKey(context, controller, repository);
+ if (scopeKey != null)
+ {
+ scopeKey.freeze();
+ context.setInstallScope(scopeKey);
+ // todo - should this be done (repare the current context scope key)
+ // or where to store this 'deployment' key?
/*
ScopeKey contextScopeKey = context.getScope();
for (Scope s : scopes)
contextScopeKey.addScope(s);
*/
- // find scoped controller
- MutableMetaDataRepository mmdr = repository.getMetaDataRepository();
- MetaDataRetrieval mdr = mmdr.getMetaDataRetrieval(scopeKey);
- if (mdr == null)
+ // find scoped controller
+ MutableMetaDataRepository mmdr = repository.getMetaDataRepository();
+ MetaDataRetrieval mdr = mmdr.getMetaDataRetrieval(scopeKey);
+ if (mdr == null)
+ {
+ mdr = new MemoryMetaDataLoader(scopeKey);
+ mmdr.addMetaDataRetrieval(mdr);
+ }
+ MetaDataItem<ScopedKernelController> controllerItem = mdr.retrieveMetaData(ScopedKernelController.class);
+ ScopedKernelController scopedController;
+ if (controllerItem != null)
+ {
+ scopedController = controllerItem.getValue();
+ }
+ else
+ {
+ AbstractController parentController = null;
+ ScopeKey parentKey = scopeKey.getParent();
+ while (parentController == null && parentKey != null)
+ {
+ MetaDataRetrieval pmdr = mmdr.getMetaDataRetrieval(parentKey);
+ if (pmdr != null)
+ {
+ MetaDataItem<ScopedKernelController> pci = pmdr.retrieveMetaData(ScopedKernelController.class);
+ if (pci != null)
{
- mdr = new MemoryMetaDataLoader(scopeKey);
- mmdr.addMetaDataRetrieval(mdr);
+ parentController = pci.getValue();
}
- MetaDataItem<Controller> controllerItem = mdr.retrieveMetaData(Controller.class);
- Controller scopedController;
- if (controllerItem != null)
- {
- scopedController = controllerItem.getValue();
- }
- else
- {
- Controller parentController = null;
- ScopeKey parentKey = scopeKey.getParent();
- while(parentController == null && parentKey != null)
- {
- MetaDataRetrieval pmdr = mmdr.getMetaDataRetrieval(parentKey);
- if (pmdr != null)
- {
- MetaDataItem<Controller> pci = pmdr.retrieveMetaData(Controller.class);
- if (pci != null)
- {
- parentController = pci.getValue();
- }
- }
- parentKey = parentKey.getParent();
- }
- if (parentController == null)
- {
- parentController = controller;
- }
- scopedController = new ScopedKernelController(parentController);
- ((MutableMetaData)mdr).addMetaData(scopedController, Controller.class);
- }
- context.setController(scopedController);
}
+ parentKey = parentKey.getParent();
}
+ if (parentController == null)
+ {
+ if (controller instanceof AbstractController == false)
+ throw new IllegalArgumentException("Underlying controller not AbstractController instance!");
+ parentController = (AbstractController) controller;
+ }
+ scopedController = new ScopedKernelController(controller.getKernel(), parentController);
+ ((MutableMetaData)mdr).addMetaData(scopedController, ScopedKernelController.class);
}
+ scopedController.addControllerContext(context);
+ context.setController(scopedController);
}
}
protected void removeScoping(KernelControllerContext context) throws Throwable
{
- // todo
+ KernelController controller = (KernelController)context.getController();
+ KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
+ ScopeKey scopeKey = context.getInstallScope();
+ if (scopeKey != null)
+ {
+ // find scoped controller
+ MutableMetaDataRepository mmdr = repository.getMetaDataRepository();
+ MetaDataRetrieval mdr = mmdr.getMetaDataRetrieval(scopeKey);
+ if (mdr == null)
+ {
+ throw new IllegalArgumentException("Expecting MetaDataRetrieval instance in scope: " + scopeKey);
+ }
+ MetaDataItem<ScopedKernelController> controllerItem = mdr.retrieveMetaData(ScopedKernelController.class);
+ if (controllerItem == null)
+ {
+ throw new IllegalArgumentException("Expecting ScopedKernelController instance in scope:" + scopeKey);
+ }
+ ScopedKernelController scopedController = controllerItem.getValue();
+ scopedController.removeControllerContext(context);
+ if (scopedController.isActive() == false)
+ {
+ try
+ {
+ ((MutableMetaData)mdr).removeMetaData(ScopedKernelController.class);
+ context.setController(scopedController.getUnderlyingController());
+ }
+ finally
+ {
+ scopedController.release();
+ }
+ }
+ }
}
protected void uninstallActionInternal(KernelControllerContext context)
@@ -167,7 +216,7 @@
{
removeScoping(context);
}
- catch(Throwable ignored)
+ catch (Throwable ignored)
{
log.warn("Unexpected error removing scoping: ", ignored);
}
@@ -187,7 +236,7 @@
{
try
{
- KernelController controller = (KernelController) context.getController();
+ KernelController controller = (KernelController)context.getController();
KernelMetaDataRepository repository = controller.getKernel().getMetaDataRepository();
repository.removeMetaData(context);
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ScopedKernelController.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ScopedKernelController.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ScopedKernelController.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -22,17 +22,25 @@
package org.jboss.kernel.plugins.dependency;
import java.util.HashSet;
+import java.util.Properties;
import java.util.Set;
-import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.plugins.AbstractController;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.kernel.Kernel;
+import org.jboss.kernel.KernelFactory;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicKernelInitializer;
+import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
+import org.jboss.kernel.spi.bootstrap.KernelInitializer;
+import org.jboss.kernel.spi.config.KernelConfig;
+import org.jboss.kernel.spi.config.KernelConfigurator;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.kernel.spi.event.KernelEvent;
import org.jboss.kernel.spi.event.KernelEventFilter;
import org.jboss.kernel.spi.event.KernelEventListener;
+import org.jboss.kernel.spi.metadata.KernelMetaDataRepository;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.kernel.spi.registry.KernelRegistryPlugin;
@@ -43,113 +51,93 @@
*/
public class ScopedKernelController extends AbstractKernelController
{
- protected Controller parent;
+ protected Kernel parentKernel;
+ protected AbstractController underlyingController;
+ protected AbstractController parentController;
- public ScopedKernelController(Controller parentController)
- throws Exception
+ public ScopedKernelController(Kernel parentKernel, AbstractController parentController) throws Exception
{
super();
- parent = parentController;
- parent.addController(this);
+ this.parentKernel = parentKernel;
+ if (parentKernel.getController() instanceof AbstractController == false)
+ throw new IllegalArgumentException("Underlying controller not AbstractController instance!");
+ this.underlyingController = (AbstractController)parentKernel.getController();
+ this.parentController = parentController;
+ KernelConfig config = new ScopedKernelConfig(System.getProperties());
+ kernel = KernelFactory.newInstance(config);
+ this.parentController.addController(this);
}
private boolean isParentKernelController()
{
- return (parent instanceof KernelController);
+ return (parentController instanceof KernelController);
}
private KernelController getParentKernelController()
{
if (isParentKernelController() == false)
throw new IllegalArgumentException("Illegal call to parent Controller, not of KernelController instance!");
- return (KernelController)parent;
+ return (KernelController)parentController;
}
- // Controller methods
+ // Scoped helper methods
- public ControllerContext getContext(Object name, ControllerState state)
+ public AbstractController getUnderlyingController()
{
- ControllerContext context = super.getContext(name, state);
- if (context != null)
- {
- return context;
- }
- return parent.getContext(name, state);
+ return underlyingController;
}
- public Set<ControllerContext> getNotInstalled()
+ public void addControllerContext(ControllerContext context)
{
- Set<ControllerContext> uninstalled = new HashSet<ControllerContext>(parent.getNotInstalled());
- uninstalled.addAll(super.getNotInstalled());
- return uninstalled;
+ underlyingController.removeControllerContext(context);
+ allContexts.put(context.getName(), context);
}
- public ControllerContext uninstall(Object name)
+ public void removeControllerContext(ControllerContext context)
{
- return super.uninstall(name); //todo
+ allContexts.remove(context.getName());
+ underlyingController.addControllerContext(context);
}
- protected void install(ControllerContext context, boolean trace) throws Throwable
+ public boolean isActive()
{
- super.install(context, trace); //todo
+ return allContexts.isEmpty() == false;
}
- protected void change(ControllerContext context, ControllerState state, boolean trace) throws Throwable
+ public void release()
{
- super.change(context, state, trace); //todo
+ parentController.removeController(this);
+ underlyingController = null;
+ parentController = null;
+ parentKernel = null;
}
- protected void enableOnDemand(ControllerContext context, boolean trace) throws Throwable
- {
- super.enableOnDemand(context, trace); //todo
- }
+ // Controller methods
- protected boolean incrementState(ControllerContext context, boolean trace)
+ public ControllerContext getContext(Object name, ControllerState state)
{
- return super.incrementState(context, trace); //todo
+ ControllerContext context = super.getContext(name, state);
+ if (context != null)
+ {
+ return context;
+ }
+ return parentController.getContext(name, state);
}
- protected void resolveContexts(boolean trace)
+ public Set<ControllerContext> getNotInstalled()
{
- super.resolveContexts(trace); //todo
+ Set<ControllerContext> uninstalled = new HashSet<ControllerContext>(parentController.getNotInstalled());
+ uninstalled.addAll(super.getNotInstalled());
+ return uninstalled;
}
- protected boolean resolveContexts(ControllerState fromState, ControllerState toState, boolean trace)
+ protected void install(ControllerContext context, boolean trace) throws Throwable
{
- return super.resolveContexts(fromState, toState, trace); //todo
+ throw new IllegalArgumentException("Should not be called!");
}
- protected void uninstallContext(ControllerContext context, boolean trace)
- {
- super.uninstallContext(context, trace); //todo
- }
-
// KernelController methods
- public Kernel getKernel()
- {
- if (isParentKernelController())
- {
- return getParentKernelController().getKernel();
- }
- else
- {
- return super.getKernel();
- }
- }
-
- public void setKernel(Kernel kernel) throws Throwable
- {
- if (isParentKernelController())
- {
- getParentKernelController().setKernel(kernel);
- }
- else
- {
- super.setKernel(kernel);
- }
- }
-
public void fireKernelEvent(KernelEvent event)
{
if (isParentKernelController())
@@ -188,22 +176,28 @@
public Set<KernelControllerContext> getInstantiatedContexts(Class clazz)
{
- // todo - some locking?
- Set<KernelControllerContext> contexts = new HashSet<KernelControllerContext>();
- Set<KernelControllerContext> currentContexts = super.getInstantiatedContexts(clazz);
- if (currentContexts != null && currentContexts.size() > 0)
+ lockRead();
+ try
{
- contexts.addAll(currentContexts);
- }
- if (isParentKernelController())
- {
- Set<KernelControllerContext> parentContexts = ((KernelController)parent).getInstantiatedContexts(clazz);
- if (parentContexts != null && parentContexts.size() > 0)
+ Set<KernelControllerContext> contexts = new HashSet<KernelControllerContext>();
+ Set<KernelControllerContext> currentContexts = super.getInstantiatedContexts(clazz);
+ if (currentContexts != null && currentContexts.size() > 0)
{
- contexts.addAll(parentContexts);
+ contexts.addAll(currentContexts);
}
+ if (isParentKernelController())
+ {
+ Set<KernelControllerContext> parentContexts = getParentKernelController().getInstantiatedContexts(clazz);
+ if (parentContexts != null && parentContexts.size() > 0)
+ {
+ contexts.addAll(parentContexts);
+ }
+ }
+ return contexts.size() > 0 ? contexts : null;
}
- return contexts.size() > 0 ? contexts : null;
+ finally{
+ unlockRead();
+ }
}
// KernelRegistry plugin method
@@ -213,11 +207,54 @@
KernelRegistryEntry entry = super.getEntry(name);
if (entry != null)
return entry;
- if (parent instanceof KernelRegistryPlugin)
+ if (parentController instanceof KernelRegistryPlugin)
{
- return ((KernelRegistryPlugin)parent).getEntry(name);
+ return ((KernelRegistryPlugin)parentController).getEntry(name);
}
return null;
}
+ // Kernel creation util classes
+
+ private class ScopedKernelConfig extends PropertyKernelConfig
+ {
+ public ScopedKernelConfig(Properties properties)
+ {
+ super(properties);
+ }
+
+ public KernelInitializer createKernelInitializer() throws Throwable
+ {
+ return new ScopedKernelInitializer();
+ }
+ }
+
+ /**
+ * Scoped Kernel Initializer.
+ * Overriddes the creation of configurator, controller, metadatarepo
+ */
+ private class ScopedKernelInitializer extends BasicKernelInitializer
+ {
+ public ScopedKernelInitializer()
+ throws Exception
+ {
+ super();
+ }
+
+ protected KernelConfigurator createKernelConfigurator(Kernel kernel) throws Throwable
+ {
+ return parentKernel.getConfigurator();
+ }
+
+ protected KernelController createKernelController(Kernel kernel) throws Throwable
+ {
+ return ScopedKernelController.this;
+ }
+
+ protected KernelMetaDataRepository createKernelMetaDataRepository(Kernel kernel) throws Throwable
+ {
+ return parentKernel.getMetaDataRepository();
+ }
+ }
+
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployer.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -159,7 +159,7 @@
*/
public void validate() throws Throwable
{
- Set notInstalled = controller.getNotInstalled();
+ Set<ControllerContext> notInstalled = controller.getNotInstalled();
internalValidate(notInstalled);
}
@@ -171,7 +171,7 @@
*/
public void validate(KernelDeployment deployment) throws Throwable
{
- Set<KernelControllerContext> notInstalled = new HashSet<KernelControllerContext>(deployment.getInstalledContexts());
+ Set<ControllerContext> notInstalled = new HashSet<ControllerContext>(deployment.getInstalledContexts());
internalValidate(notInstalled);
}
@@ -181,7 +181,7 @@
* @param notInstalled the not installed deployments
* @throws Throwable for any error
*/
- protected void internalValidate(Set notInstalled) throws Throwable
+ protected void internalValidate(Set<ControllerContext> notInstalled) throws Throwable
{
if (notInstalled.isEmpty() == false)
{
@@ -193,11 +193,10 @@
}
if (notInstalled.isEmpty() == false)
{
- HashSet<KernelControllerContext> errors = new HashSet<KernelControllerContext>();
- HashSet<KernelControllerContext> incomplete = new HashSet<KernelControllerContext>();
- for (Iterator i = notInstalled.iterator(); i.hasNext();)
+ HashSet<ControllerContext> errors = new HashSet<ControllerContext>();
+ HashSet<ControllerContext> incomplete = new HashSet<ControllerContext>();
+ for (ControllerContext ctx : notInstalled)
{
- KernelControllerContext ctx = (KernelControllerContext) i.next();
if (ctx.getState().equals(ControllerState.ERROR))
errors.add(ctx);
else
@@ -208,24 +207,22 @@
if (errors.size() != 0)
{
buffer.append("\n*** DEPLOYMENTS IN ERROR: Name -> Error\n");
- for (Iterator i = errors.iterator(); i.hasNext(); )
+ for (ControllerContext ctx : errors)
{
- KernelControllerContext ctx = (KernelControllerContext) i.next();
buffer.append(ctx.getName()).append(" -> ").append(ctx.getError().toString()).append('\n');
}
}
if (incomplete.size() != 0)
{
buffer.append("\n*** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n");
- for (Iterator i = incomplete.iterator(); i.hasNext();)
+ for (ControllerContext ctx : incomplete)
{
- KernelControllerContext ctx = (KernelControllerContext) i.next();
buffer.append(ctx.getName()).append(" -> ");
DependencyInfo dependsInfo = ctx.getDependencyInfo();
Set depends = dependsInfo.getIDependOn(null);
for (Iterator j = depends.iterator(); j.hasNext();)
{
- DependencyItem item = (DependencyItem) j.next();
+ DependencyItem item = (DependencyItem)j.next();
buffer.append(item.getIDependOn()).append('{').append(item.getWhenRequired().getStateString());
buffer.append(':');
Object iDependOn = item.getIDependOn();
@@ -263,12 +260,11 @@
*/
protected void deployBeans(KernelController controller, KernelDeployment deployment) throws Throwable
{
- List beans = deployment.getBeans();
+ List<BeanMetaData> beans = deployment.getBeans();
if (beans != null)
{
- for (int i = 0; i < beans.size(); ++i)
+ for (BeanMetaData metaData : beans)
{
- BeanMetaData metaData = (BeanMetaData) beans.get(i);
KernelControllerContext context = deployBean(controller, deployment, metaData);
deployment.addInstalledContext(context);
}
@@ -313,12 +309,11 @@
*/
protected void changeBeans(KernelController controller, KernelDeployment deployment, ControllerState state) throws Throwable
{
- List contexts = deployment.getInstalledContexts();
+ List<KernelControllerContext> contexts = deployment.getInstalledContexts();
if (contexts != null)
{
- for (Iterator i = contexts.iterator(); i.hasNext();)
+ for (KernelControllerContext context : contexts)
{
- KernelControllerContext context = (KernelControllerContext) i.next();
changeBean(controller, context, state);
}
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/metadata/basic/BasicKernelMetaDataRepository.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -122,6 +122,8 @@
if (bean != null)
scope.addScope(CommonLevels.CLASS, bean);
}
+ // todo - some other level
+ scope.addScope(CommonLevels.WORK, String.valueOf(context.hashCode()));
return scope;
}
Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/spi/dependency/KernelControllerContext.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -23,11 +23,11 @@
import org.jboss.beans.info.spi.BeanInfo;
import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.metadata.spi.MetaData;
import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
/**
* Information about dependencies and state.
@@ -92,4 +92,18 @@
* @param key the scope key
*/
void setScope(ScopeKey key);
+
+ /**
+ * Get the install scope
+ *
+ * @return the scope
+ */
+ ScopeKey getInstallScope();
+
+ /**
+ * Set the install scope
+ *
+ * @param key the scope key
+ */
+ void setInstallScope(ScopeKey key);
}
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader>
+ <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+
+ <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.AnnotatedObjectWithBean" />
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.Deployment1ObjectWithBean">
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.Deployment2ObjectWithBean">
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.Deployment3ObjectWithBean">
+ <property name="simpleBean"><inject bean="simpleFromBoot"/></property>
+ </bean>
+
+ <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.Deployment4ObjectWithBean">
+ <property name="simpleBean"><inject bean="simpleFromApp"/></property>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.Deployment1BeanImpl">
+ <constructor>
+ <parameter>deployment1</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.Deployment2BeanImpl">
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <constructor>
+ <parameter>fromBoot</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.AnnotatedFromAppBeanImpl">
+ <constructor>
+ <parameter>fromApp</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+
+ <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ </bean>
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment3")</annotation>
+ <property name="simpleBean"><inject bean="simpleFromBoot"/></property>
+ </bean>
+
+ <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment4")</annotation>
+ <property name="simpleBean"><inject bean="simpleFromApp"/></property>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <constructor>
+ <parameter>deployment1</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <constructor>
+ <parameter>fromBoot</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <constructor>
+ <parameter>fromApp</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Modified: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.xml 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -22,8 +22,40 @@
</property>
</bean>
- <classloader>
- <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
- </classloader>
+ <bean name="SimpleObject4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <property name="beans">
+ <list>
+ <bean name="inner1" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean1</property>
+ </bean>
+ <bean name="inner2" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean2</property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+ <bean name="SimpleObject6" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <property name="beans">
+ <list>
+ <bean name="inner61" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean61</property>
+ <property name="bean">
+ <bean name="inner71" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean71</property>
+ </bean>
+ </property>
+ </bean>
+ <bean name="inner62" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean62</property>
+ <property name="bean">
+ <bean name="inner72" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean72</property>
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassLoaderTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassLoaderTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassLoaderTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="SimpleObject1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <constructor>
+ <bean name="simple1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean" />
+ </constructor>
+ </bean>
+
+ <bean name="SimpleObject2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <constructor>
+ <parameter>
+ <bean name="simple2" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl" />
+ </parameter>
+ </constructor>
+ </bean>
+
+ <bean name="SimpleObject3" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <property name="simpleBean">
+ <bean name="simple3" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl"/>
+ </property>
+ </bean>
+
+ <classloader>
+ <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+
+ <bean name="SimpleObject4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <property name="beans">
+ <list>
+ <bean name="inner1" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean1</property>
+ </bean>
+ <bean name="inner2" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean2</property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="SimpleObject6" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <property name="beans">
+ <list>
+ <bean name="inner61" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean61</property>
+ <property name="bean">
+ <bean name="inner71" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean71</property>
+ </bean>
+ </property>
+ </bean>
+ <bean name="inner62" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean62</property>
+ <property name="bean">
+ <bean name="inner72" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <property name="string">InnerBean72</property>
+ </bean>
+ </property>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="SimpleObject5" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <classloader>
+ <bean name="cl2" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+ <property name="simpleBean">
+ <bean name="simple5" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl"/>
+ </property>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader>
+ <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+
+ <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ </bean>
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <property name="simpleBean"><inject/></property>
+ </bean>
+
+ <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <property name="simpleBean"><inject/></property>
+ </bean>
+
+ <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.ObjectWithFromBootBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment3")</annotation>
+ <property name="simpleBean"><inject/></property>
+ </bean>
+
+ <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.ObjectWithFromAppBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment4")</annotation>
+ <property name="simpleBean"><inject/></property>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <constructor>
+ <parameter>deployment1</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.FromBootBean">
+ <constructor>
+ <parameter>fromBoot</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.FromAppBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <constructor>
+ <parameter>fromApp</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader>
+ <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ </bean>
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <property name="simpleBean">
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <constructor>
+ <parameter>deployment1</parameter>
+ </constructor>
+ </bean>
+ </property>
+ </bean>
+
+ <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <property name="simpleBean">
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+ </property>
+ </bean>
+
+ <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment3")</annotation>
+ <property name="simpleBean">
+ <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <constructor>
+ <parameter>fromBoot</parameter>
+ </constructor>
+ </bean>
+ </property>
+ </bean>
+
+ <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment4")</annotation>
+ <property name="simpleBean">
+ <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <constructor>
+ <parameter>fromApp</parameter>
+ </constructor>
+ </bean>
+ </property>
+ </bean>
+
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ScopingTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ScopingTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/deployment/test/ScopingTestCase.xml 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader>
+ <bean name="cl" class="org.jboss.test.kernel.deployment.support.NullClassLoader" />
+ </classloader>
+
+ <bean name="appScopeObject" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ </bean>
+
+ <bean name="deploy1" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy2" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <property name="simpleBean"><inject bean="simple"/></property>
+ </bean>
+
+ <bean name="deploy3" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment3")</annotation>
+ <property name="simpleBean"><inject bean="simpleFromBoot"/></property>
+ </bean>
+
+ <bean name="deploy4" class="org.jboss.test.kernel.deployment.support.SimpleObjectWithBean">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment4")</annotation>
+ <property name="simpleBean"><inject bean="simpleFromApp"/></property>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment1")</annotation>
+ <constructor>
+ <parameter>deployment1</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simple" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <annotation>@org.jboss.metadata.plugins.scope.DeploymentScope("deployment2")</annotation>
+ <constructor>
+ <parameter>deployment2</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromBoot" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <constructor>
+ <parameter>fromBoot</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="simpleFromApp" class="org.jboss.test.kernel.deployment.support.SimpleBeanImpl">
+ <annotation>@org.jboss.metadata.plugins.scope.ApplicationScope("testApp")</annotation>
+ <constructor>
+ <parameter>fromApp</parameter>
+ </constructor>
+ </bean>
+
+</deployment>
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedFromAppBeanImpl.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedFromAppBeanImpl.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedFromAppBeanImpl.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+
+/**
+ * A simple annotated bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+public class AnnotatedFromAppBeanImpl implements Serializable, SimpleBean
+{
+ private static final long serialVersionUID = 1L;
+
+ private String constructorString;
+
+ private String string;
+
+ private SimpleBean bean;
+
+ public AnnotatedFromAppBeanImpl()
+ {
+ constructorString = "()";
+ }
+
+ public AnnotatedFromAppBeanImpl(String string)
+ {
+ constructorString = string;
+ }
+
+ public String getConstructorString()
+ {
+ return constructorString;
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ public SimpleBean getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(SimpleBean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedObjectWithBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/AnnotatedObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+
+/**
+ * An annotated object with all possible bean as meta data
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+public class AnnotatedObjectWithBean implements Serializable, ObjectWithBeanAware
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 3258126972906387766L;
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleBean simpleBean;
+
+ public AnnotatedObjectWithBean()
+ {
+ }
+
+ public AnnotatedObjectWithBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+ public SimpleBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1BeanImpl.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1BeanImpl.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1BeanImpl.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * A simple annotated bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment1")
+public class Deployment1BeanImpl
+ implements Serializable, SimpleBean
+{
+ private static final long serialVersionUID = 1L;
+
+ private String constructorString;
+
+ private String string;
+
+ private SimpleBean bean;
+
+ public Deployment1BeanImpl()
+ {
+ constructorString = "()";
+ }
+
+ public Deployment1BeanImpl(String string)
+ {
+ constructorString = string;
+ }
+
+ public String getConstructorString()
+ {
+ return constructorString;
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ public SimpleBean getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(SimpleBean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1ObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1ObjectWithBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment1ObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * An annotated object with all possible bean as meta data
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment1")
+public class Deployment1ObjectWithBean implements Serializable, ObjectWithBeanAware
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleBean simpleBean;
+
+ public Deployment1ObjectWithBean()
+ {
+ }
+
+ public Deployment1ObjectWithBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+ public SimpleBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2BeanImpl.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2BeanImpl.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2BeanImpl.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * A simple annotated bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment2")
+public class Deployment2BeanImpl
+ implements Serializable, SimpleBean
+{
+ private static final long serialVersionUID = 1L;
+
+ private String constructorString;
+
+ private String string;
+
+ private SimpleBean bean;
+
+ public Deployment2BeanImpl()
+ {
+ constructorString = "()";
+ }
+
+ public Deployment2BeanImpl(String string)
+ {
+ constructorString = string;
+ }
+
+ public String getConstructorString()
+ {
+ return constructorString;
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ public SimpleBean getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(SimpleBean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2ObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2ObjectWithBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment2ObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * An annotated object with all possible bean as meta data
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment2")
+public class Deployment2ObjectWithBean implements Serializable, ObjectWithBeanAware
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleBean simpleBean;
+
+ public Deployment2ObjectWithBean()
+ {
+ }
+
+ public Deployment2ObjectWithBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+ public SimpleBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment3ObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment3ObjectWithBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment3ObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * An annotated object with all possible bean as meta data
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment3")
+public class Deployment3ObjectWithBean implements Serializable, ObjectWithBeanAware
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleBean simpleBean;
+
+ public Deployment3ObjectWithBean()
+ {
+ }
+
+ public Deployment3ObjectWithBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+ public SimpleBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment4ObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment4ObjectWithBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/Deployment4ObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+import org.jboss.metadata.plugins.scope.ApplicationScope;
+import org.jboss.metadata.plugins.scope.DeploymentScope;
+
+/**
+ * An annotated object with all possible bean as meta data
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+ at ApplicationScope("testApp")
+ at DeploymentScope("deployment3")
+public class Deployment4ObjectWithBean implements Serializable, ObjectWithBeanAware
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private SimpleBean simpleBean;
+
+ public Deployment4ObjectWithBean()
+ {
+ }
+
+ public Deployment4ObjectWithBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+ public SimpleBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(SimpleBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromAppBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromAppBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromAppBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+/**
+ * A simple annotated bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FromAppBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String constructorString;
+
+ private String string;
+
+ private SimpleBean bean;
+
+ public FromAppBean()
+ {
+ constructorString = "()";
+ }
+
+ public FromAppBean(String string)
+ {
+ constructorString = string;
+ }
+
+ public String getConstructorString()
+ {
+ return constructorString;
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ public SimpleBean getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(SimpleBean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromBootBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromBootBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/FromBootBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+/**
+ * A simple annotated bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class FromBootBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String constructorString;
+
+ private String string;
+
+ private SimpleBean bean;
+
+ public FromBootBean()
+ {
+ constructorString = "()";
+ }
+
+ public FromBootBean(String string)
+ {
+ constructorString = string;
+ }
+
+ public String getConstructorString()
+ {
+ return constructorString;
+ }
+
+ public String getString()
+ {
+ return string;
+ }
+
+ public void setString(String string)
+ {
+ this.string = string;
+ }
+
+ public SimpleBean getBean()
+ {
+ return bean;
+ }
+
+ public void setBean(SimpleBean bean)
+ {
+ this.bean = bean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithBeanAware.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithBeanAware.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithBeanAware.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+/**
+ * An interface with simple bean getter
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+public interface ObjectWithBeanAware
+{
+ SimpleBean getSimpleBean();
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromAppBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromAppBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromAppBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+/**
+ * A simple object with a fromapp bean
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+public class ObjectWithFromAppBean implements Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private FromAppBean simpleBean;
+
+ public FromAppBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(FromAppBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromBootBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromBootBean.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/ObjectWithFromBootBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.support;
+
+import java.io.Serializable;
+
+/**
+ * A simple object with a fromapp bean
+ *
+ * @author <a href="ales.justin at gmail.com">Ales Justin</a>
+ */
+public class ObjectWithFromBootBean implements Serializable
+{
+ // Constants -----------------------------------------------------
+
+ private static final long serialVersionUID = 1L;
+
+ // Attributes ----------------------------------------------------
+
+ private FromBootBean simpleBean;
+
+ public FromBootBean getSimpleBean()
+ {
+ return simpleBean;
+ }
+
+ public void setSimpleBean(FromBootBean simpleBean)
+ {
+ this.simpleBean = simpleBean;
+ }
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleObjectWithBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleObjectWithBean.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SimpleObjectWithBean.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -22,6 +22,7 @@
package org.jboss.test.kernel.deployment.support;
import java.io.Serializable;
+import java.util.List;
/**
* A simple object with all possible bean as meta data
@@ -37,6 +38,7 @@
// Attributes ----------------------------------------------------
private SimpleBean simpleBean;
+ private List<SimpleBean> beans;
public SimpleObjectWithBean()
{
@@ -57,4 +59,13 @@
this.simpleBean = simpleBean;
}
+ public List<SimpleBean> getBeans()
+ {
+ return beans;
+ }
+
+ public void setBeans(List<SimpleBean> beans)
+ {
+ this.beans = beans;
+ }
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractBeanMetaDataTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractBeanMetaDataTest.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AbstractBeanMetaDataTest.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,87 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import java.util.List;
+
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public abstract class AbstractBeanMetaDataTest extends AbstractDeploymentTest
+{
+ protected AbstractBeanMetaDataTest(String name)
+ throws Throwable
+ {
+ super(name);
+ }
+
+ // ---- tests
+
+ public void doInnerBeanTests() throws Throwable
+ {
+ SimpleObjectWithBean sowb1 = (SimpleObjectWithBean) getBean("SimpleObject1");
+ assertNotNull(sowb1);
+ SimpleObjectWithBean simple1 = (SimpleObjectWithBean) getBean("simple1");
+ assertNotNull(simple1);
+ assertEquals(sowb1, simple1);
+
+ SimpleObjectWithBean sowb2 = (SimpleObjectWithBean) getBean("SimpleObject2");
+ assertNotNull(sowb2);
+ SimpleBean simple2 = (SimpleBean) getBean("simple2");
+ assertNotNull(simple2);
+ assertNotNull(sowb2.getSimpleBean());
+ assertEquals(sowb2.getSimpleBean(), simple2);
+
+ SimpleObjectWithBean sowb3 = (SimpleObjectWithBean) getBean("SimpleObject3");
+ assertNotNull(sowb3);
+ SimpleBean simple3 = (SimpleBean) getBean("simple3");
+ assertNotNull(simple3);
+ assertNotNull(sowb3.getSimpleBean());
+ assertEquals(sowb3.getSimpleBean(), simple3);
+
+ SimpleObjectWithBean sowb4 = (SimpleObjectWithBean) getBean("SimpleObject4");
+ assertNotNull(sowb4);
+ List<SimpleBean> beans = sowb4.getBeans();
+ assertFalse(beans.isEmpty());
+ assertEquals(2, beans.size());
+
+ SimpleObjectWithBean sowb6 = (SimpleObjectWithBean) getBean("SimpleObject6");
+ assertNotNull(sowb6);
+ List<SimpleBean> beans6 = sowb6.getBeans();
+ assertFalse(beans6.isEmpty());
+ assertEquals(2, beans6.size());
+ SimpleBean inner61 = beans6.get(0);
+ assertNotNull(inner61);
+ SimpleBean inner71 = inner61.getBean();
+ assertNotNull(inner71);
+ assertEquals("InnerBean71", inner71.getString());
+ SimpleBean inner62 = beans6.get(1);
+ assertNotNull(inner62);
+ SimpleBean inner72 = inner62.getBean();
+ assertNotNull(inner72);
+ assertEquals("InnerBean72", inner72.getString());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedClassesScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.ObjectWithBeanAware;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+
+/**
+ * Scoping tests.
+ * With scope annotation at class level.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class AnnotatedClassesScopingTestCase extends ScopingDeploymentTest
+{
+ public AnnotatedClassesScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(AnnotatedClassesScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testAnnotatedDeploymentScoping() throws Throwable
+ {
+ ObjectWithBeanAware appScopeObject = (ObjectWithBeanAware) getBean("appScopeObject");
+ assertNotNull(appScopeObject);
+
+ ObjectWithBeanAware deploy1 = (ObjectWithBeanAware) getBean("deploy1");
+ assertNotNull(deploy1);
+ SimpleBean simple1 = deploy1.getSimpleBean();
+ assertNotNull(simple1);
+ assertEquals("deployment1", simple1.getConstructorString());
+
+ ObjectWithBeanAware deploy2 = (ObjectWithBeanAware) getBean("deploy2");
+ assertNotNull(deploy2);
+ SimpleBean simple2 = deploy2.getSimpleBean();
+ assertNotNull(simple2);
+ assertEquals("deployment2", simple2.getConstructorString());
+
+ ObjectWithBeanAware deploy3 = (ObjectWithBeanAware) getBean("deploy3");
+ assertNotNull(deploy3);
+ SimpleBean simple3 = deploy3.getSimpleBean();
+ assertNotNull(simple3);
+ assertEquals("fromBoot", simple3.getConstructorString());
+
+ ObjectWithBeanAware deploy4 = (ObjectWithBeanAware) getBean("deploy4");
+ assertNotNull(deploy4);
+ SimpleBean simple4 = deploy4.getSimpleBean();
+ assertNotNull(simple4);
+ assertEquals("fromApp", simple4.getConstructorString());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/AnnotatedDeploymentScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * Scoping tests.
+ * With scope annotation at deployment level.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class AnnotatedDeploymentScopingTestCase extends ScopingDeploymentTest
+{
+ public AnnotatedDeploymentScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(AnnotatedDeploymentScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testAnnotatedDeploymentScoping() throws Throwable
+ {
+ SimpleObjectWithBean appScopeObject = (SimpleObjectWithBean) getBean("appScopeObject");
+ assertNotNull(appScopeObject);
+
+ SimpleObjectWithBean deploy1 = (SimpleObjectWithBean) getBean("deploy1");
+ assertNotNull(deploy1);
+ SimpleBean simple1 = deploy1.getSimpleBean();
+ assertNotNull(simple1);
+ assertEquals("deployment1", simple1.getConstructorString());
+
+ SimpleObjectWithBean deploy2 = (SimpleObjectWithBean) getBean("deploy2");
+ assertNotNull(deploy2);
+ SimpleBean simple2 = deploy2.getSimpleBean();
+ assertNotNull(simple2);
+ assertEquals("deployment2", simple2.getConstructorString());
+
+ SimpleObjectWithBean deploy3 = (SimpleObjectWithBean) getBean("deploy3");
+ assertNotNull(deploy3);
+ SimpleBean simple3 = deploy3.getSimpleBean();
+ assertNotNull(simple3);
+ assertEquals("fromBoot", simple3.getConstructorString());
+
+ SimpleObjectWithBean deploy4 = (SimpleObjectWithBean) getBean("deploy4");
+ assertNotNull(deploy4);
+ SimpleBean simple4 = deploy4.getSimpleBean();
+ assertNotNull(simple4);
+ assertEquals("fromApp", simple4.getConstructorString());
+ }
+
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -21,15 +21,12 @@
*/
package org.jboss.test.kernel.deployment.test;
-import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
-import org.jboss.test.kernel.deployment.support.SimpleBean;
-
import junit.framework.Test;
/**
* @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
*/
-public class BeanMetaDataTestCase extends AbstractDeploymentTest
+public class BeanMetaDataTestCase extends AbstractBeanMetaDataTest
{
public BeanMetaDataTestCase(String name)
throws Throwable
@@ -46,28 +43,7 @@
public void testBeanAsValueMetaData() throws Throwable
{
- ClassLoader cl = (ClassLoader) getBean("cl");
- assertNotNull(cl);
-
- SimpleObjectWithBean sowb1 = (SimpleObjectWithBean) getBean("SimpleObject1");
- SimpleObjectWithBean simple1 = (SimpleObjectWithBean) getBean("simple1");
- assertNotNull(sowb1);
- assertNotNull(simple1);
- assertEquals(sowb1, simple1);
-
- SimpleObjectWithBean sowb2 = (SimpleObjectWithBean) getBean("SimpleObject2");
- SimpleBean simple2 = (SimpleBean) getBean("simple2");
- assertNotNull(sowb2);
- assertNotNull(simple2);
- assertNotNull(sowb2.getSimpleBean());
- assertEquals(sowb2.getSimpleBean(), simple2);
-
- SimpleObjectWithBean sowb3 = (SimpleObjectWithBean) getBean("SimpleObject3");
- SimpleBean simple3 = (SimpleBean) getBean("simple3");
- assertNotNull(sowb3);
- assertNotNull(simple3);
- assertNotNull(sowb3.getSimpleBean());
- assertEquals(sowb3.getSimpleBean(), simple3);
+ doInnerBeanTests();
}
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassloaderTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassloaderTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanMetaDataWithClassloaderTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,64 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class BeanMetaDataWithClassloaderTestCase extends AbstractBeanMetaDataTest
+{
+ public BeanMetaDataWithClassloaderTestCase(String name)
+ throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(BeanMetaDataWithClassloaderTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testBeanAsValueMetaData() throws Throwable
+ {
+ ClassLoader cl = (ClassLoader) getBean("cl");
+ assertNotNull(cl);
+
+ doInnerBeanTests();
+
+ ClassLoader cl2 = (ClassLoader) getBean("cl2");
+ assertNotNull(cl2);
+
+ SimpleObjectWithBean sowb5 = (SimpleObjectWithBean) getBean("SimpleObject5");
+ assertNotNull(sowb5);
+ SimpleBean simple5 = (SimpleBean) getBean("simple5");
+ assertNotNull(simple5);
+ assertNotNull(sowb5.getSimpleBean());
+ assertEquals(sowb5.getSimpleBean(), simple5);
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ContextualScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,85 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.FromAppBean;
+import org.jboss.test.kernel.deployment.support.FromBootBean;
+import org.jboss.test.kernel.deployment.support.ObjectWithFromAppBean;
+import org.jboss.test.kernel.deployment.support.ObjectWithFromBootBean;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * Contextual scoping tests.
+ * Test includes same named beans.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class ContextualScopingTestCase extends ScopingDeploymentTest
+{
+ public ContextualScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ContextualScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testSimpleScoping() throws Throwable
+ {
+ ClassLoader cl = (ClassLoader) getBean("cl");
+ assertNotNull(cl);
+
+ SimpleObjectWithBean appScopeObject = (SimpleObjectWithBean) getBean("appScopeObject");
+ assertNotNull(appScopeObject);
+
+ SimpleObjectWithBean deploy1 = (SimpleObjectWithBean) getBean("deploy1");
+ assertNotNull(deploy1);
+ SimpleBean simple1 = deploy1.getSimpleBean();
+ assertNotNull(simple1);
+ assertEquals("deployment1", simple1.getConstructorString());
+
+ SimpleObjectWithBean deploy2 = (SimpleObjectWithBean) getBean("deploy2");
+ assertNotNull(deploy2);
+ SimpleBean simple2 = deploy2.getSimpleBean();
+ assertNotNull(simple2);
+ assertEquals("deployment2", simple2.getConstructorString());
+
+ ObjectWithFromBootBean deploy3 = (ObjectWithFromBootBean)getBean("deploy3");
+ assertNotNull(deploy3);
+ FromBootBean simple3 = deploy3.getSimpleBean();
+ assertNotNull(simple3);
+ assertEquals("fromBoot", simple3.getConstructorString());
+
+ ObjectWithFromAppBean deploy4 = (ObjectWithFromAppBean)getBean("deploy4");
+ assertNotNull(deploy4);
+ FromAppBean simple4 = deploy4.getSimpleBean();
+ assertNotNull(simple4);
+ assertEquals("fromApp", simple4.getConstructorString());
+ }
+
+}
Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2007-02-22 08:33:54 UTC (rev 60789)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -43,12 +43,19 @@
TestSuite suite = new TestSuite("Deployment Tests");
suite.addTest(BeanMetaDataTestCase.suite());
+ suite.addTest(BeanMetaDataWithClassloaderTestCase.suite());
suite.addTest(DeploymentClassLoaderTestCase.suite());
suite.addTest(GenericBeanFactoryLifecycleTestCase.suite());
suite.addTest(WildcardClassLoaderTestCase.suite());
suite.addTest(BeanMetaDataFactoryTestCase.suite());
suite.addTest(AnnotatedLifecycleTestCase.suite());
suite.addTest(FineGrainedActionTestCase.suite());
+ suite.addTest(ScopingTestCase.suite());
+ suite.addTest(AnnotatedDeploymentScopingTestCase.suite());
+ suite.addTest(IllegalScopingTestCase.suite());
+ suite.addTest(AnnotatedClassesScopingTestCase.suite());
+ suite.addTest(ContextualScopingTestCase.suite());
+ suite.addTest(InnerBeanScopingTestCase.suite());
return suite;
}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/IllegalScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * Scoping tests.
+ * Diff scopes.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class IllegalScopingTestCase extends ScopingDeploymentTest
+{
+ public IllegalScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(IllegalScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testIllegalScoping() throws Throwable
+ {
+ ClassLoader cl = (ClassLoader) getBean("cl");
+ assertNotNull(cl);
+
+ Throwable expected = null;
+ try
+ {
+ getBean("deploy1");
+ }
+ catch(Throwable t)
+ {
+ expected = t;
+ }
+ assertNotNull(expected);
+
+ SimpleObjectWithBean deploy = (SimpleObjectWithBean) getBean("deploy1", ControllerState.INSTANTIATED);
+ assertNotNull(deploy);
+ SimpleBean simple1 = deploy.getSimpleBean();
+ assertNull(simple1);
+
+ SimpleBean simple = (SimpleBean)getBean("simple");
+ assertNotNull(simple);
+ assertEquals("deployment2", simple.getConstructorString());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/InnerBeanScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,82 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * Inner bean scoping tests.
+ * Test includes same named beans.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class InnerBeanScopingTestCase extends ScopingDeploymentTest
+{
+ public InnerBeanScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(InnerBeanScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testSimpleScoping() throws Throwable
+ {
+ SimpleObjectWithBean appScopeObject = (SimpleObjectWithBean) getBean("appScopeObject");
+ assertNotNull(appScopeObject);
+
+ SimpleObjectWithBean deploy1 = (SimpleObjectWithBean) getBean("deploy1");
+ assertNotNull(deploy1);
+ SimpleBean simple1 = deploy1.getSimpleBean();
+ assertNotNull(simple1);
+ assertEquals("deployment1", simple1.getConstructorString());
+
+ SimpleObjectWithBean deploy2 = (SimpleObjectWithBean) getBean("deploy2");
+ assertNotNull(deploy2);
+ SimpleBean simple2 = deploy2.getSimpleBean();
+ assertNotNull(simple2);
+ assertEquals("deployment2", simple2.getConstructorString());
+
+ SimpleObjectWithBean deploy3 = (SimpleObjectWithBean) getBean("deploy3");
+ assertNotNull(deploy3);
+ SimpleBean simple3 = deploy3.getSimpleBean();
+ assertNotNull(simple3);
+ assertEquals("fromBoot", simple3.getConstructorString());
+ SimpleBean fromBoot = (SimpleBean)getBean("simpleFromBoot");
+ assertEquals(simple3, fromBoot);
+
+ SimpleObjectWithBean deploy4 = (SimpleObjectWithBean) getBean("deploy4");
+ assertNotNull(deploy4);
+ SimpleBean simple4 = deploy4.getSimpleBean();
+ assertNotNull(simple4);
+ assertEquals("fromApp", simple4.getConstructorString());
+ SimpleBean fromApp = (SimpleBean)getBean("simpleFromApp");
+ assertEquals(simple4, fromApp);
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingDeploymentTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingDeploymentTest.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingDeploymentTest.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * Scoping Deployment Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public abstract class ScopingDeploymentTest extends AbstractDeploymentTest
+{
+ public ScopingDeploymentTest(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ /**
+ * Default setup with security manager enabled
+ *
+ * @param clazz the class
+ * @return the delegate
+ * @throws Exception for any error
+ */
+ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+ {
+ AbstractTestDelegate delegate = new ScopingTestDelegate(clazz);
+ delegate.enableSecurity = true;
+ return delegate;
+ }
+
+ protected void configureLogging()
+ {
+ //enableTrace("org.jboss.dependency");
+ //enableTrace("org.jboss.kernel.plugins.dependency");
+ //enableTrace("org.jboss.kernel.plugins.deployment");
+ }
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestCase.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.deployment.support.SimpleBean;
+import org.jboss.test.kernel.deployment.support.SimpleObjectWithBean;
+
+/**
+ * Scoping tests.
+ * Test includes same named beans.
+ *
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class ScopingTestCase extends ScopingDeploymentTest
+{
+ public ScopingTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ScopingTestCase.class);
+ }
+
+ // ---- tests
+
+ public void testSimpleScoping() throws Throwable
+ {
+ ClassLoader cl = (ClassLoader) getBean("cl");
+ assertNotNull(cl);
+
+ SimpleObjectWithBean appScopeObject = (SimpleObjectWithBean) getBean("appScopeObject");
+ assertNotNull(appScopeObject);
+
+ SimpleObjectWithBean deploy1 = (SimpleObjectWithBean) getBean("deploy1");
+ assertNotNull(deploy1);
+ SimpleBean simple1 = deploy1.getSimpleBean();
+ assertNotNull(simple1);
+ assertEquals("deployment1", simple1.getConstructorString());
+
+ SimpleObjectWithBean deploy2 = (SimpleObjectWithBean) getBean("deploy2");
+ assertNotNull(deploy2);
+ SimpleBean simple2 = deploy2.getSimpleBean();
+ assertNotNull(simple2);
+ assertEquals("deployment2", simple2.getConstructorString());
+
+ SimpleObjectWithBean deploy3 = (SimpleObjectWithBean) getBean("deploy3");
+ assertNotNull(deploy3);
+ SimpleBean simple3 = deploy3.getSimpleBean();
+ assertNotNull(simple3);
+ assertEquals("fromBoot", simple3.getConstructorString());
+
+ SimpleObjectWithBean deploy4 = (SimpleObjectWithBean) getBean("deploy4");
+ assertNotNull(deploy4);
+ SimpleBean simple4 = deploy4.getSimpleBean();
+ assertNotNull(simple4);
+ assertEquals("fromApp", simple4.getConstructorString());
+ }
+
+}
Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/ScopingTestDelegate.java 2007-02-22 10:56:29 UTC (rev 60790)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.kernel.deployment.test;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+
+/**
+ * Scoping Deployment Test Delegate.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ScopingTestDelegate extends MicrocontainerTestDelegate
+{
+ public ScopingTestDelegate(Class clazz) throws Exception
+ {
+ super(clazz);
+ }
+
+ protected KernelControllerContext getControllerContext(final Object name, final ControllerState state)
+ {
+ try
+ {
+ Controller controller = new TestController((AbstractController)kernel.getController());
+ KernelControllerContext context = (KernelControllerContext)controller.getContext(name, state);
+ if (context == null)
+ throw new IllegalStateException("Bean not found " + name + " at state " + state);
+ return context;
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ private class TestController extends AbstractController
+ {
+ private AbstractController delegate;
+
+ public TestController(AbstractController controller) throws Exception
+ {
+ this.delegate = controller;
+ }
+
+ public ControllerContext getContext(Object name, ControllerState state)
+ {
+ return findContext(delegate, name, state);
+ }
+
+ private ControllerContext findContext(AbstractController controller, Object name, ControllerState state)
+ {
+ ControllerContext context = controller.getContext(name, state);
+ if (context != null)
+ {
+ return context;
+ }
+ else
+ {
+ for (AbstractController childController : controller.getControllers())
+ {
+ ControllerContext ctx = findContext(childController, name, state);
+ if (ctx != null)
+ return ctx;
+ }
+ }
+ return null;
+ }
+ }
+
+}
More information about the jboss-cvs-commits
mailing list