[jboss-cvs] JBossAS SVN: r65261 - in trunk/ejb3: src/resources/test and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Sep 9 01:07:54 EDT 2007
Author: ALRubinger
Date: 2007-09-09 01:07:47 -0400 (Sun, 09 Sep 2007)
New Revision: 65261
Added:
trunk/ejb3/src/resources/test/ejbthree958/
trunk/ejb3/src/resources/test/ejbthree958/META-INF/
trunk/ejb3/src/resources/test/ejbthree958/META-INF/ejb-jar.xml
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Bean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Remote.java
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/DefaultToFieldNameForResourceInjectionByNameUnitTestCase.java
Modified:
trunk/ejb3/build-test.xml
Log:
EJBTHREE-958: Unit Test
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2007-09-09 04:20:54 UTC (rev 65260)
+++ trunk/ejb3/build-test.xml 2007-09-09 05:07:47 UTC (rev 65261)
@@ -2031,7 +2031,21 @@
</fileset>
</copy>
</target>
+
+ <target name="ejbthree958"
+ description="Builds a simple jar files."
+ depends="compile-classes">
+
+ <mkdir dir="${build.lib}"/>
+ <jar jarfile="${build.lib}/ejbthree958.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/ejbthree958/*.class"/>
+ </fileset>
+ <fileset dir="${resources}/test/ejbthree958" includes="META-INF/*"/>
+ </jar>
+ </target>
+
<target name="ejbthree959"
description="Builds a simple jar files."
depends="compile-classes">
@@ -3639,7 +3653,7 @@
circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440,
ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree832, ejbthree921, ejbthree936,
ejbthree939,
- ejbthree953, ejbthree957, ejbthree959, ejbthree963, ejbthree967, ejbthree971, ejbthree973, ejbthree985, ejbthree986,
+ ejbthree953, ejbthree957, ejbthree958, ejbthree959, ejbthree963, ejbthree967, ejbthree971, ejbthree973, ejbthree985, ejbthree986,
ejbthree989, ejbthree1020, ejbthree1023, ejbthree1025, ejbthree1040,
jaxws,
aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency,
@@ -4538,6 +4552,9 @@
<param name="test" value="ejbthree957"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="ejbthree958"/>
+ </antcall>
+ <antcall target="test" inheritRefs="true">
<param name="test" value="ejbthree959"/>
</antcall>
<antcall target="test" inheritRefs="true">
Added: trunk/ejb3/src/resources/test/ejbthree958/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/ejbthree958/META-INF/ejb-jar.xml (rev 0)
+++ trunk/ejb3/src/resources/test/ejbthree958/META-INF/ejb-jar.xml 2007-09-09 05:07:47 UTC (rev 65261)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- we're going to force this down the ejb3 deployer -->
+<ejb-jar
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <display-name>ejbthree958</display-name>
+ <enterprise-beans>
+ <session>
+ <ejb-name>TestStatelessEjbthree958Bean</ejb-name>
+ <env-entry>
+ <env-entry-name>testValue</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>5</env-entry-value>
+ </env-entry>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Property changes on: trunk/ejb3/src/resources/test/ejbthree958/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Bean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Bean.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Bean.java 2007-09-09 05:07:47 UTC (rev 65261)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.ejbthree958;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+
+ at Stateless
+public class TestStatelessEjbthree958Bean implements TestStatelessEjbthree958Remote
+{
+
+ // Instance Members
+ @Resource
+ private int testValue;
+
+ // Required Implementations
+ public int getTestValue()
+ {
+ return this.testValue;
+ }
+
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Bean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Remote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Remote.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Remote.java 2007-09-09 05:07:47 UTC (rev 65261)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, 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.ejb3.test.ejbthree958;
+
+import javax.ejb.Remote;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+
+ at Remote
+ at RemoteBinding(jndiBinding = TestStatelessEjbthree958Remote.JNDI_BINDING)
+public interface TestStatelessEjbthree958Remote
+{
+ // Class Members
+ public static final String JNDI_BINDING = "TestStatelessEjbthree958Bean/remote";
+
+ // Contracts
+
+ public int getTestValue();
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/TestStatelessEjbthree958Remote.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/DefaultToFieldNameForResourceInjectionByNameUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/DefaultToFieldNameForResourceInjectionByNameUnitTestCase.java (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/DefaultToFieldNameForResourceInjectionByNameUnitTestCase.java 2007-09-09 05:07:47 UTC (rev 65261)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, 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.ejb3.test.ejbthree958.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree958.TestStatelessEjbthree958Remote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Unit test for EJBTHREE-958, ensures that @Resource injections default to
+ * encName matching the name of the field to be injected in the case that @Resource.name is not specified
+ *
+ * @author <a href="mailto:alr at alrubinger.com">ALR</a>
+ * @version $Revision: $
+ */
+public class DefaultToFieldNameForResourceInjectionByNameUnitTestCase extends JBossTestCase
+{
+
+ // Class Members
+ private static final String JAR_NAME = "ejbthree958.jar";
+
+ private static final int EXPECTED_VALUE = 5;
+
+ public DefaultToFieldNameForResourceInjectionByNameUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(DefaultToFieldNameForResourceInjectionByNameUnitTestCase.class, null);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ undeploy(DefaultToFieldNameForResourceInjectionByNameUnitTestCase.JAR_NAME);
+ super.tearDown();
+ }
+
+ /**
+ * Deploys the test JAR, invokes upon the test method to
+ * ensure that "testValue" is injected from the env-entry properly,
+ * defaulting to the name of the field as @Resource.name is not specified
+ *
+ * @author ALR
+ * @throws Exception
+ */
+ public void testDefaultToFieldNameForResourceName() throws Exception
+ {
+ try
+ {
+ // Deploy Test JAR
+ redeploy(DefaultToFieldNameForResourceInjectionByNameUnitTestCase.JAR_NAME);
+
+ // Lookup EJB, attempt cast
+ TestStatelessEjbthree958Remote stateless = (TestStatelessEjbthree958Remote) this.getInitialContext().lookup(
+ TestStatelessEjbthree958Remote.JNDI_BINDING);
+
+ // Obtain injected value
+ int injectedValue = stateless.getTestValue();
+
+ // Ensure value from invocation is expected
+ JBossTestCase.assertEquals(DefaultToFieldNameForResourceInjectionByNameUnitTestCase.EXPECTED_VALUE,
+ injectedValue);
+
+ // Log Success
+ log.info("Injected Value " + injectedValue + " matches expected value "
+ + DefaultToFieldNameForResourceInjectionByNameUnitTestCase.EXPECTED_VALUE);
+
+ }
+ catch (Exception e)
+ {
+ // Unexpected error encountered
+ log.error(e);
+ JBossTestCase.fail("Exception received; " + e);
+
+ }
+ }
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree958/unit/DefaultToFieldNameForResourceInjectionByNameUnitTestCase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jboss-cvs-commits
mailing list