[jboss-cvs] JBossAS SVN: r72424 - in projects/microcontainer/trunk/kernel/src: tests/org/jboss/test/kernel/deployment/support and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Apr 18 04:48:15 EDT 2008
Author: alesj
Date: 2008-04-18 04:48:15 -0400 (Fri, 18 Apr 2008)
New Revision: 72424
Added:
projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.xml
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SetDemandTransformer.java
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.java
Modified:
projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java
Log:
Bean container set demand.
Copied: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.xml (from rev 72270, projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/BeanContainerStaticTestCase.xml)
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.xml (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.xml 2008-04-18 08:48:15 UTC (rev 72424)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="demander" class="org.jboss.test.kernel.deployment.support.StaticHolder">
+ <demand transformer="org.jboss.test.kernel.deployment.support.SetDemandTransformer">one,two,three</demand>
+ </bean>
+
+ <bean name="supplier" class="org.jboss.test.kernel.deployment.support.StaticHolder">
+ <supply>two</supply>
+ </bean>
+
+</deployment>
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SetDemandTransformer.java (from rev 72270, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/StaticHolder.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SetDemandTransformer.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/SetDemandTransformer.java 2008-04-18 08:48:15 UTC (rev 72424)
@@ -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.support;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.kernel.api.dependency.Matcher;
+import org.jboss.kernel.api.dependency.MatcherTransformer;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SetDemandTransformer implements MatcherTransformer
+{
+ public Matcher transform(Object value)
+ {
+ String string = value.toString();
+ return new SetDemandMatcher(new HashSet<Object>(Arrays.asList(string.split(","))));
+ }
+
+ public class SetDemandMatcher implements Matcher
+ {
+ private Set<Object> set;
+
+ public SetDemandMatcher(Set<Object> set)
+ {
+ if (set == null)
+ throw new IllegalArgumentException("Null set");
+ this.set = set;
+ }
+
+ public boolean match(Object other)
+ {
+ return set.contains(other);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.java (from rev 72270, projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanContainerStaticTestCase.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.java (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/BeanContainerSetDemandTestCase.java 2008-04-18 08:48:15 UTC (rev 72424)
@@ -0,0 +1,47 @@
+/*
+* 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.StaticHolder;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BeanContainerSetDemandTestCase extends AbstractDeploymentTest
+{
+ public BeanContainerSetDemandTestCase(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(BeanContainerSetDemandTestCase.class);
+ }
+
+ public void testSetDemands() throws Throwable
+ {
+ StaticHolder bean = assertBean("demander", StaticHolder.class);
+ assertNotNull(bean);
+ }
+}
\ No newline at end of file
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 2008-04-18 08:46:41 UTC (rev 72423)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/test/DeploymentTestSuite.java 2008-04-18 08:48:15 UTC (rev 72424)
@@ -71,6 +71,7 @@
suite.addTest(BeanContainerScopingTestCase.suite());
suite.addTest(BeanContainerInjectionTestCase.suite());
suite.addTest(BeanContainerStaticTestCase.suite());
+ suite.addTest(BeanContainerSetDemandTestCase.suite());
return suite;
}
More information about the jboss-cvs-commits
mailing list