[jboss-cvs] JBossAS SVN: r67276 - in projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3: runas and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 19 21:59:34 EST 2007
Author: scott.stark at jboss.org
Date: 2007-11-19 21:59:34 -0500 (Mon, 19 Nov 2007)
New Revision: 67276
Added:
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/InterMediate.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/RunAsUnitTestCase.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/TargetBean.java
Log:
Additional test beans
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/InterMediate.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/InterMediate.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/InterMediate.java 2007-11-20 02:59:34 UTC (rev 67276)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.annotation.ejb3.runas;
+
+import javax.annotation.security.RunAs;
+import javax.ejb.Stateless;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Stateless
+ at RunAs("InternalUser")
+public class InterMediate
+{
+
+}
Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/InterMediate.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/RunAsUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/RunAsUnitTestCase.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/RunAsUnitTestCase.java 2007-11-20 02:59:34 UTC (rev 67276)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.annotation.ejb3.runas;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.metadata.annotation.creator.ejb.EjbJar30Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBoss50DTDMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar20MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar21MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.test.metadata.javaee.AbstractJavaEEMetaDataTest;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class RunAsUnitTestCase extends AbstractJavaEEMetaDataTest
+{
+ private static BasicMetaDataRepository repository = new BasicMetaDataRepository();
+
+ public static SchemaBindingResolver initResolver()
+ {
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ resolver.addClassBindingForLocation("ejb-jar_2_0.dtd", EjbJar20MetaData.class);
+ resolver.addClassBindingForLocation("ejb-jar_2_1.xsd", EjbJar21MetaData.class);
+ resolver.addClassBindingForLocation("ejb-jar_3_0.xsd", EjbJar30MetaData.class);
+ resolver.addClassBindingForLocation("jboss_3_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_3_2.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_4_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_4_2.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_5_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_5_0.xsd", JBoss50MetaData.class);
+ // Workaround wildard resolution slowness
+ resolver.addClassBinding("http://www.jboss.com/xml/ns/javaee", JBoss50MetaData.class);
+ return resolver;
+ }
+
+ public RunAsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testXmlAnnotationMerge()
+ throws Exception
+ {
+ Class[] beanClasses = {
+ InterMediate.class
+ };
+ List<Class> classes = Arrays.asList(beanClasses);
+ MetaData scopeMetaData = createMetaDataFromAnnotations("ejb0.jar", classes);
+
+ JBossMetaData xmlMetaData = unmarshal("jboss.xml", JBossMetaData.class, null);
+ EjbJarMetaData specMetaData = unmarshal("ejb-jar.xml", EjbJarMetaData.class, null);
+ JBossMetaData mergedData = new JBossMetaData();
+
+ // Validate the proxy view
+ JBossEnterpriseBeanMetaData InterMediateBean = mergedData.getEnterpriseBean("InterMediateBean");
+ assertNotNull(InterMediateBean);
+ }
+
+ protected MetaData createMetaDataFromAnnotations(String jarName, Collection<Class> classes)
+ {
+ ScopeKey jarKey = new ScopeKey(CommonLevels.DEPLOYMENT, jarName);
+ MemoryMetaDataLoader loader = new MemoryMetaDataLoader(jarKey);
+ repository.addMetaDataRetrieval(loader);
+
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ EjbJar30Creator creator = new EjbJar30Creator(finder);
+ EjbJar30MetaData metaData = creator.create(classes);
+ loader.addMetaData(metaData, EjbJarMetaData.class);
+ repository.addMetaDataRetrieval(loader);
+ MetaData keyMetaData = repository.getMetaData(jarKey);
+ return keyMetaData;
+ }
+
+}
Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/RunAsUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/TargetBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/TargetBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/TargetBean.java 2007-11-20 02:59:34 UTC (rev 67276)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.annotation.ejb3.runas;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class TargetBean
+{
+
+}
Property changes on: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/ejb3/runas/TargetBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list