You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2008/12/09 22:49:57 UTC
svn commit: r724906 [1/2] - in /openejb/trunk/sandbox/openejb-eclipse-plugin:
common/src/main/java/org/apache/openejb/plugins/common/
common/src/test/java/org/apache/openejb/plugins/common/
common/src/test/resources/org/apache/openejb/plugins/common/ p...
Author: jgallimore
Date: Tue Dec 9 13:49:56 2008
New Revision: 724906
URL: http://svn.apache.org/viewvc?rev=724906&view=rev
Log:
Eclipse plugin - adding some unit tests
Added:
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EjbReferencesConverterTest.java
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EntityBeanConverterTest.java
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/badsession-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-openejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/empty-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptyrelationship-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptysession-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytomany-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytoone-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/nobeans-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-openejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetomany-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetoone-ejb-jar.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean-local.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean.xml
Modified:
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar1.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar2.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/openejb-jar2.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertFinderMethodToCodeTest.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21Product.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21ProductBean.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21ProductHome.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Ejb21SessionBean.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/Expected30ProductBean.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ExpectedSessionBean.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-1.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-2.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean21-3.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-1.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-2.txt
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/resources/org/apache/openejb/helper/annotation/tests/ProductManagerBean30-3.txt
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java?rev=724906&r1=724905&r2=724906&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/main/java/org/apache/openejb/plugins/common/EntityBeanConverter.java Tue Dec 9 13:49:56 2008
@@ -38,7 +38,6 @@
import org.apache.openejb.jee.Relationships;
import org.apache.openejb.jee.jpa.Attributes;
import org.apache.openejb.jee.jpa.Basic;
-import org.apache.openejb.jee.jpa.CascadeType;
import org.apache.openejb.jee.jpa.Column;
import org.apache.openejb.jee.jpa.EntityMappings;
import org.apache.openejb.jee.jpa.FetchType;
@@ -46,13 +45,9 @@
import org.apache.openejb.jee.jpa.GenerationType;
import org.apache.openejb.jee.jpa.Id;
import org.apache.openejb.jee.jpa.IdClass;
-import org.apache.openejb.jee.jpa.ManyToOne;
import org.apache.openejb.jee.jpa.NamedNativeQuery;
import org.apache.openejb.jee.jpa.NamedQuery;
-import org.apache.openejb.jee.jpa.OneToMany;
-import org.apache.openejb.jee.jpa.OneToOne;
import org.apache.openejb.jee.jpa.QueryHint;
-import org.apache.openejb.jee.jpa.RelationField;
import org.apache.openejb.jee.jpa.SequenceGenerator;
import org.apache.openejb.jee.jpa.TableGenerator;
import org.apache.openejb.jee.jpa.UniqueConstraint;
@@ -67,26 +62,6 @@
}
@SuppressWarnings("unchecked") //$NON-NLS-1$
- private void addOneToManyRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
-
- try {
- List<OneToMany> relationships = entity.getAttributes().getOneToMany();
- for (OneToMany relationship : relationships) {
-
- Map oneToManyProperties = getPropertiesForRelationship(relationship);
-
- String name = relationship.getName();
- String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
-
- facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToMany.class, oneToManyProperties);
- }
- } catch (Exception e) {
- String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.persistence.OneToMany", entityBean.getEjbClass());
- facade.addWarning(warning);
- }
- }
-
- @SuppressWarnings("unchecked") //$NON-NLS-1$
private void addNamedQueriesAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
try {
@@ -212,11 +187,13 @@
}
}
- private void addTableAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
+ void addTableAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
try {
String tableName = entity.getTable().getName();
String schemaName = entity.getTable().getSchema();
String catalogName = entity.getTable().getCatalog();
+
+ if (tableName == null && schemaName == null && catalogName == null) return;
Map<String, Object> tableProperties = new HashMap<String, Object>();
if (tableName != null && tableName.length() > 0) {
@@ -291,18 +268,19 @@
addBasicAnnotations(entityBean, attributes.getBasic());
addNamedQueriesAnnotations(entityBean, entity);
addNamedNativeQueriesAnnotations(entityBean, entity);
-// addOneToManyRelationshipAnnotations(entityBean, entity);
-// addManyToOneRelationshipAnnotations(entityBean, entity);
-// addOneToOneRelationshipAnnotations(entityBean, entity);
}
}
}
- private void addRelationshipAnnotations(AppModule appModule) {
+ void addRelationshipAnnotations(AppModule appModule) {
List<EjbModule> ejbModules = appModule.getEjbModules();
for (EjbModule ejbModule : ejbModules) {
EjbJar ejbJar = ejbModule.getEjbJar();
Relationships relationships = ejbJar.getRelationships();
+
+ if (relationships == null)
+ return;
+
List<EjbRelation> relations = relationships.getEjbRelation();
for (EjbRelation relation : relations) {
@@ -383,89 +361,6 @@
}
@SuppressWarnings("unchecked") //$NON-NLS-1$
- private void addOneToOneRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
- try {
- List<OneToOne> relationships = entity.getAttributes().getOneToOne();
- for (OneToOne relationship : relationships) {
-
- String name = relationship.getName();
- String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
-
- Map<String, Object> oneToOneProperties = getPropertiesForRelationship(relationship);
-
- facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToOne.class, oneToOneProperties);
- }
- } catch (Exception e) {
- String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.persistence.OneToOne", entityBean.getEjbClass());
- facade.addWarning(warning);
- }
- }
-
- @SuppressWarnings("unchecked") //$NON-NLS-1$
- private void addManyToOneRelationshipAnnotations(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
- List<ManyToOne> relationships = entity.getAttributes().getManyToOne();
- for (ManyToOne relationship : relationships) {
-
- try {
- String name = relationship.getName();
- String nameGetter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); //$NON-NLS-1$
- Map manyToOneProperties = getPropertiesForRelationship(relationship);
- Boolean optional = relationship.isOptional();
- if (optional != null) {
- manyToOneProperties.put("optional", optional.booleanValue()); //$NON-NLS-1$
- }
- facade.addMethodAnnotation(entityBean.getEjbClass(), nameGetter, new String[] {}, javax.persistence.OneToOne.class, manyToOneProperties);
- } catch (Exception e) {
- String warning = String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.12"), "@javax.persistence.OneToOone", entityBean.getEjbClass());
- facade.addWarning(warning);
- }
- }
- }
-
- @SuppressWarnings("unchecked") //$NON-NLS-1$
- private Map<String,Object> getPropertiesForRelationship(RelationField relationship) {
- String targetEntity = relationship.getTargetEntity();
- FetchType fetch = relationship.getFetch();
- CascadeType cascade = relationship.getCascade();
-
-
- Map<String, Object> manyToOneProperties = new HashMap<String, Object>();
- if (fetch != null) {
- manyToOneProperties.put("fetch", fetch.value()); //$NON-NLS-1$
- }
-
- if (cascade != null) {
- List cascadeList = new ArrayList();
- if (cascade.isCascadeAll()) {
- cascadeList.add(javax.persistence.CascadeType.ALL);
- }
-
- if (cascade.isCascadeMerge()) {
- cascadeList.add(javax.persistence.CascadeType.MERGE);
- }
-
- if (cascade.isCascadePersist()) {
- cascadeList.add(javax.persistence.CascadeType.PERSIST);
- }
-
- if (cascade.isCascadeRefresh()) {
- cascadeList.add(javax.persistence.CascadeType.REFRESH);
- }
-
- if (cascade.isCascadeRemove()) {
- cascadeList.add(javax.persistence.CascadeType.REMOVE);
- }
-
- manyToOneProperties.put("cascade", cascadeList.toArray(new Object[0])); //$NON-NLS-1$
- }
-
- if (targetEntity != null && targetEntity.length() > 0) {
- manyToOneProperties.put("targetEntity", targetEntity); //$NON-NLS-1$
- }
- return manyToOneProperties;
- }
-
- @SuppressWarnings("unchecked") //$NON-NLS-1$
private void addIdClassAnnotation(EntityBean entityBean, org.apache.openejb.jee.jpa.Entity entity) {
try {
IdClass idClass = entity.getIdClass();
@@ -537,7 +432,7 @@
}
@SuppressWarnings("unchecked") //$NON-NLS-1$
- private void addIdAnnotation(EntityBean entityBean, Id id) {
+ void addIdAnnotation(EntityBean entityBean, Id id) {
try {
String fieldName = id.getName();
String methodName = convertFieldNameToGetterName(fieldName);
@@ -546,7 +441,9 @@
GeneratedValue generatedValue = id.getGeneratedValue();
if (generatedValue != null) {
Map<String, Object> generatedValueProps = new HashMap<String, Object>();
- generatedValueProps.put("generator", generatedValue.getGenerator()); //$NON-NLS-1$
+ if (generatedValue.getGenerator() != null) {
+ generatedValueProps.put("generator", generatedValue.getGenerator()); //$NON-NLS-1$
+ }
GenerationType strategy = generatedValue.getStrategy();
switch (strategy) {
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EjbReferencesConverterTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EjbReferencesConverterTest.java?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EjbReferencesConverterTest.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EjbReferencesConverterTest.java Tue Dec 9 13:49:56 2008
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.plugins.common;
+
+import java.io.InputStream;
+
+import javax.ejb.EJB;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+public class EjbReferencesConverterTest extends TestCase {
+ public void testShouldNotThrowAnExceptionWhenProcessingAnEmptyEjbJar() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("empty-ejb-jar.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ }
+
+ public void testShouldNotThrowAnExceptionWhenProcessingAnEmptyEnterpriseBeansElement() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("nobeans-ejb-jar.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ }
+
+ public void testShouldNotThrowAnExceptionIfSessionBeanHasNoRemoteAndNoLocalClasses() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("badsession-ejb-jar.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ }
+
+ public void testShouldNotThrowAnExceptionIfSessionBeanIsEmpty() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("emptysession-ejb-jar.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ }
+
+ public void testShouldAddDIAnnotationForRemoteInterface() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("single-session-bean.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ context.checking(new Expectations() {
+ {
+ one(jdtFacade).addAnnotationToFieldsOfType("org.superbiz.Store", EJB.class, null);
+ }
+ });
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ context.assertIsSatisfied();
+ }
+
+ public void testShouldAddDIAnnotationForLocalInterface() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("single-session-bean-local.xml");
+ ClassLoader classLoader = getClass().getClassLoader();
+
+ InputSource ejbJarSrc = new InputSource(is);
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+ appModule.getEjbModules().add(ejbModule);
+
+ context.checking(new Expectations() {
+ {
+ one(jdtFacade).addAnnotationToFieldsOfType("org.superbiz.Store", EJB.class, null);
+ }
+ });
+
+ new EjbReferencesConverter(jdtFacade).convert(appModule);
+ context.assertIsSatisfied();
+ }
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EntityBeanConverterTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EntityBeanConverterTest.java?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EntityBeanConverterTest.java (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/java/org/apache/openejb/plugins/common/EntityBeanConverterTest.java Tue Dec 9 13:49:56 2008
@@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.plugins.common;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.TestCase;
+
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.CmpJpaConversion;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.config.InitEjbDeployments;
+import org.apache.openejb.config.OpenEjb2Conversion;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.JaxbJavaee;
+import org.apache.openejb.jee.jpa.Entity;
+import org.apache.openejb.jee.oejb2.JaxbOpenejbJar2;
+import org.apache.openejb.jee.oejb2.OpenejbJarType;
+import org.apache.openejb.jee.oejb3.OpenejbJar;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.xml.sax.InputSource;
+
+public class EntityBeanConverterTest extends TestCase {
+ public void testShouldNotThrowAnExceptionWhenProcessingAnEmptyEjbJar() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("empty-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+ new EntityBeanConverter(jdtFacade).convert(appModule);
+ }
+
+ public void testShouldNotThrowAnExceptionWhenProcessingAnEmptyEnterpriseBeansElement() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("nobeans-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+ new EntityBeanConverter(jdtFacade).convert(appModule);
+ }
+
+
+ public void testShouldNotThrowExceptionForEmptyRelationship() throws Exception {
+ Mockery context = new Mockery();
+
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("emptyrelationship-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+ new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
+ }
+
+ public void testAddAnnotationsForOneToManyRelationship() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("onetomany-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+
+ context.checking(new Expectations() {
+ {
+ Map<String, Object> oneToManyProperties = new HashMap<String,Object>();
+ oneToManyProperties.put("targetEntity", "org.superbiz.OrderLineBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.OrderBean", "getOrderLine", new String[0], OneToMany.class, oneToManyProperties);
+
+ Map<String, Object> manyToOneProperties = new HashMap<String,Object>();
+ manyToOneProperties.put("targetEntity", "org.superbiz.OrderBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.OrderLineBean", "getOrder", new String[0], ManyToOne.class, manyToOneProperties);
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
+ }
+
+ public void testAddAnnotationsForManyToManyRelationship() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("manytomany-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+
+ context.checking(new Expectations() {
+ {
+ Map<String, Object> oneToManyProperties = new HashMap<String,Object>();
+ oneToManyProperties.put("targetEntity", "org.superbiz.ProductBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.OrderLineBean", "getProduct", new String[0], ManyToMany.class, oneToManyProperties);
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
+ }
+
+ public void testAddAnnotationsForOneToOneRelationship() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("onetoone-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+ context.checking(new Expectations() {
+ {
+ Map<String, Object> oneToManyProperties = new HashMap<String,Object>();
+ oneToManyProperties.put("targetEntity", "org.superbiz.ProductBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.OrderLineBean", "getProduct", new String[0], OneToOne.class, oneToManyProperties);
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
+ }
+
+ public void testAddAnnotationsForManyToOneRelationship() throws Exception {
+ Mockery context = new Mockery();
+
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+ InputStream is = getClass().getResourceAsStream("manytoone-ejb-jar.xml");
+ InputSource ejbJarSrc = new InputSource(is);
+
+ AppModule appModule = getAppModule(ejbJarSrc, null);
+
+ context.checking(new Expectations() {
+ {
+ Map<String, Object> oneToManyProperties = new HashMap<String,Object>();
+ oneToManyProperties.put("targetEntity", "org.superbiz.ProductBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.OrderLineBean", "getProduct", new String[0], ManyToOne.class, oneToManyProperties);
+
+ Map<String, Object> manyToOneProperties = new HashMap<String,Object>();
+ manyToOneProperties.put("targetEntity", "org.superbiz.OrderLineBean");
+ one(jdtFacade).addMethodAnnotation("org.superbiz.ProductBean", "getOrderLine", new String[0], OneToMany.class, manyToOneProperties);
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addRelationshipAnnotations(appModule);
+
+ context.assertIsSatisfied();
+ }
+
+ public void testShouldNotThrowExceptionIfTableNameIsMissing() throws Exception {
+ Mockery context = new Mockery();
+ IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+
+ InputStream ejbJarSrc = getClass().getResourceAsStream("notablename-ejb-jar.xml");
+ InputStream openejbJarSrc = getClass().getResourceAsStream("notablename-openejb-jar.xml");
+
+ AppModule appModule = getAppModule(new InputSource(ejbJarSrc), new InputSource(openejbJarSrc));
+ Entity entity = appModule.getCmpMappings().getEntityMap().get("openejb.java.lang.Product");
+ EntityBean entityBean = (EntityBean) appModule.getEjbModules().get(0).getEjbJar().getEnterpriseBean("ProductEJB");
+
+ new EntityBeanConverter(jdtFacade).addTableAnnotation(entityBean, entity);
+ }
+
+ public void testShouldAddTableAnnotation() throws Exception {
+ Mockery context = new Mockery();
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+
+ InputStream ejbJarSrc = getClass().getResourceAsStream("basicentity-ejb-jar.xml");
+ InputStream openejbJarSrc = getClass().getResourceAsStream("basicentity-openejb-jar.xml");
+
+ AppModule appModule = getAppModule(new InputSource(ejbJarSrc), new InputSource(openejbJarSrc));
+ Entity entity = appModule.getCmpMappings().getEntityMap().get("openejb.java.lang.Product");
+ EntityBean entityBean = (EntityBean) appModule.getEjbModules().get(0).getEjbJar().getEnterpriseBean("ProductEJB");
+
+ context.checking(new Expectations() {
+ {
+ Map<String,Object> properties = new HashMap<String, Object>();
+ properties.put("name", "products");
+ one(jdtFacade).addClassAnnotation("org.superbiz.ProductBean", Table.class, properties);
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addTableAnnotation(entityBean, entity);
+ }
+
+ // columns
+
+ // named queries
+
+ // native named queries
+
+ // id
+ public void testShouldAddIdAnnotation() throws Exception {
+ Mockery context = new Mockery();
+ final IJDTFacade jdtFacade = context.mock(IJDTFacade.class);
+
+ InputStream ejbJarSrc = getClass().getResourceAsStream("basicentity-ejb-jar.xml");
+ InputStream openejbJarSrc = getClass().getResourceAsStream("basicentity-openejb-jar.xml");
+
+ AppModule appModule = getAppModule(new InputSource(ejbJarSrc), new InputSource(openejbJarSrc));
+ Entity entity = appModule.getCmpMappings().getEntityMap().get("openejb.java.lang.Product");
+ EntityBean entityBean = (EntityBean) appModule.getEjbModules().get(0).getEjbJar().getEnterpriseBean("ProductEJB");
+
+ context.checking(new Expectations() {
+ {
+ one(jdtFacade).addMethodAnnotation("org.superbiz.ProductBean", "getId", new String[0], Id.class, null);
+ Map<String, Object> generatedvalueProps = new HashMap<String, Object>();
+ generatedvalueProps.put("strategy", GenerationType.IDENTITY);
+ one(jdtFacade).addMethodAnnotation("org.superbiz.ProductBean", "getId", new String[0], GeneratedValue.class, generatedvalueProps );
+ }
+ });
+
+ new EntityBeanConverter(jdtFacade).addIdAnnotation(entityBean, entity.getAttributes().getId().get(0));
+ }
+
+ private class DummyClassLoader extends ClassLoader {
+
+ @Override
+ protected synchronized Class<?> loadClass(String className, boolean resolve) throws ClassNotFoundException {
+ return Object.class;
+ }
+
+ }
+
+ private AppModule getAppModule(InputSource ejbJarSrc, InputSource openEjbJarSrc) throws Exception {
+ DummyClassLoader classLoader = new DummyClassLoader();
+ AppModule appModule = new AppModule(classLoader, "ModuleToConvert"); //$NON-NLS-1$
+
+ EjbJar ejbJar = (EjbJar) JaxbJavaee.unmarshal(EjbJar.class, ejbJarSrc.getByteStream());
+ EjbModule ejbModule = new EjbModule(ejbJar, new OpenejbJar());
+ ejbModule.setClassLoader(classLoader);
+ appModule.getEjbModules().add(ejbModule);
+
+ if (openEjbJarSrc != null) {
+ InitEjbDeployments initEjbDeployments = new InitEjbDeployments();
+ initEjbDeployments.deploy(ejbModule, new HashMap<String, String>());
+
+ JAXBElement<?> element = (JAXBElement<?>) JaxbOpenejbJar2.unmarshal(OpenejbJarType.class, openEjbJarSrc.getByteStream());
+ OpenejbJarType openejbJarType = (OpenejbJarType) element.getValue();
+ ejbModule.getAltDDs().put("openejb-jar.xml", openejbJarType); //$NON-NLS-1$
+
+ CmpJpaConversion cmpJpaConversion = new CmpJpaConversion();
+ cmpJpaConversion.deploy(appModule);
+
+ OpenEjb2Conversion openEjb2Conversion = new OpenEjb2Conversion();
+ openEjb2Conversion.deploy(appModule);
+ }
+
+ return appModule;
+ }
+
+}
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/badsession-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/badsession-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/badsession-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/badsession-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,12 @@
+<ejb-jar>
+ <enterprise-beans>
+ <session>
+ <description>Business logic for the store</description>
+ <display-name>Store</display-name>
+ <ejb-name>StoreEJB</ejb-name>
+ <ejb-class>org.superbiz.StoreBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Product</abstract-schema-name>
+ <cmp-field>
+ <description>Identity</description>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product name</description>
+ <field-name>name</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product stock code</description>
+ <field-name>code</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product description</description>
+ <field-name>description</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findAll</method-name>
+ <method-params/>
+ </query-method>
+ <ejb-ql>SELECT p from Product p</ejb-ql>
+ </query>
+ </entity>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-openejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-openejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-openejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/basicentity-openejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openejb-jar
+ xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
+ xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+ xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
+ xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-jndi-name>ProductEJBLocalHome</local-jndi-name>
+ <table-name>products</table-name>
+ <cmp-field-mapping>
+ <cmp-field-name>id</cmp-field-name>
+ <table-column>id</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>name</cmp-field-name>
+ <table-column>name</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>description</cmp-field-name>
+ <table-column>description</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>code</cmp-field-name>
+ <table-column>code</table-column>
+ </cmp-field-mapping>
+ <primkey-field>id</primkey-field>
+ <pkgen:key-generator>
+ <pkgen:auto-increment-table>
+ <pkgen:sql>INSERT INTO products(id, name, description, code) VALUES(null, null, null, null)</pkgen:sql>
+ <pkgen:return-type>java.lang.Integer</pkgen:return-type>
+ </pkgen:auto-increment-table>
+ </pkgen:key-generator>
+ </entity>
+ </enterprise-beans>
+</openejb-jar>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar1.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar1.xml?rev=724906&r1=724905&r2=724906&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar1.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar1.xml Tue Dec 9 13:49:56 2008
@@ -9,45 +9,45 @@
<description>Business logic for the store</description>
<display-name>Store</display-name>
<ejb-name>StoreEJB</ejb-name>
- <home>uk.me.jrg.jee.store.ejb.StoreHome</home>
- <remote>uk.me.jrg.jee.store.ejb.Store</remote>
- <ejb-class>uk.me.jrg.jee.store.ejb.StoreBean</ejb-class>
+ <home>org.superbiz.StoreHome</home>
+ <remote>org.superbiz.Store</remote>
+ <ejb-class>org.superbiz.StoreBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Product</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.store.ejb.ProductHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.Product</local>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
<ejb-link>ProductEJB</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/Order</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.store.ejb.OrderHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.Order</local>
+ <local-home>org.superbiz.OrderHome</local-home>
+ <local>org.superbiz.Order</local>
<ejb-link>OrderEJB</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/OrderLine</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.store.ejb.OrderLineHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.OrderLine</local>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
<ejb-link>OrderLineEJB</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/User</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.store.ejb.UserHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.User</local>
+ <local-home>org.superbiz.UserHome</local-home>
+ <local>org.superbiz.User</local>
<ejb-link>UserEJB</ejb-link>
</ejb-local-ref>
</session>
<entity>
<ejb-name>ProductEJB</ejb-name>
- <local-home>uk.me.jrg.jee.store.ejb.ProductHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.Product</local>
- <ejb-class>uk.me.jrg.jee.store.ejb.ProductBean</ejb-class>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>true</reentrant>
@@ -80,9 +80,9 @@
</entity>
<entity>
<ejb-name>OrderEJB</ejb-name>
- <local-home>uk.me.jrg.jee.store.ejb.OrderHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.Order</local>
- <ejb-class>uk.me.jrg.jee.store.ejb.OrderBean</ejb-class>
+ <local-home>org.superbiz.OrderHome</local-home>
+ <local>org.superbiz.Order</local>
+ <ejb-class>org.superbiz.OrderBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>true</reentrant>
@@ -104,9 +104,9 @@
</entity>
<entity>
<ejb-name>OrderLineEJB</ejb-name>
- <local-home>uk.me.jrg.jee.store.ejb.OrderLineHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.OrderLine</local>
- <ejb-class>uk.me.jrg.jee.store.ejb.OrderLineBean</ejb-class>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>true</reentrant>
@@ -122,9 +122,9 @@
</entity>
<entity>
<ejb-name>UserEJB</ejb-name>
- <local-home>uk.me.jrg.jee.store.ejb.UserHome</local-home>
- <local>uk.me.jrg.jee.store.ejb.User</local>
- <ejb-class>uk.me.jrg.jee.store.ejb.UserBean</ejb-class>
+ <local-home>org.superbiz.UserHome</local-home>
+ <local>org.superbiz.User</local>
+ <ejb-class>org.superbiz.UserBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>true</reentrant>
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar2.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar2.xml?rev=724906&r1=724905&r2=724906&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar2.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/ejb-jar2.xml Tue Dec 9 13:49:56 2008
@@ -14,26 +14,26 @@
<ejb-name>AddressBook</ejb-name>
- <home>uk.me.jrg.jee.sample.interfaces.AddressBookHome</home>
- <remote>uk.me.jrg.jee.sample.interfaces.AddressBook</remote>
- <local-home>uk.me.jrg.jee.sample.interfaces.AddressBookLocalHome</local-home>
- <local>uk.me.jrg.jee.sample.interfaces.AddressBookLocal</local>
- <ejb-class>uk.me.jrg.jee.sample.ejb.AddressBookBean</ejb-class>
+ <home>org.superbiz.AddressBookHome</home>
+ <remote>org.superbiz.AddressBook</remote>
+ <local-home>org.superbiz.AddressBookLocalHome</local-home>
+ <local>org.superbiz.AddressBookLocal</local>
+ <ejb-class>org.superbiz.AddressBookBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref >
<ejb-ref-name>ejb/Person</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.sample.interfaces.PersonLocalHome</local-home>
- <local>uk.me.jrg.jee.sample.interfaces.PersonLocal</local>
+ <local-home>org.superbiz.PersonLocalHome</local-home>
+ <local>org.superbiz.PersonLocal</local>
<ejb-link>Person</ejb-link>
</ejb-local-ref>
<ejb-local-ref >
<ejb-ref-name>ejb/Contact</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
- <local-home>uk.me.jrg.jee.sample.interfaces.ContactLocalHome</local-home>
- <local>uk.me.jrg.jee.sample.interfaces.ContactLocal</local>
+ <local-home>org.superbiz.ContactLocalHome</local-home>
+ <local>org.superbiz.ContactLocal</local>
<ejb-link>Contact</ejb-link>
</ejb-local-ref>
@@ -51,10 +51,10 @@
<ejb-name>Person</ejb-name>
- <local-home>uk.me.jrg.jee.sample.interfaces.PersonLocalHome</local-home>
- <local>uk.me.jrg.jee.sample.interfaces.PersonLocal</local>
+ <local-home>org.superbiz.PersonLocalHome</local-home>
+ <local>org.superbiz.PersonLocal</local>
- <ejb-class>uk.me.jrg.jee.sample.ejb.PersonCMP</ejb-class>
+ <ejb-class>org.superbiz.PersonCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
@@ -111,10 +111,10 @@
<ejb-name>Contact</ejb-name>
- <local-home>uk.me.jrg.jee.sample.interfaces.ContactLocalHome</local-home>
- <local>uk.me.jrg.jee.sample.interfaces.ContactLocal</local>
+ <local-home>org.superbiz.ContactLocalHome</local-home>
+ <local>org.superbiz.ContactLocal</local>
- <ejb-class>uk.me.jrg.jee.sample.ejb.ContactCMP</ejb-class>
+ <ejb-class>org.superbiz.ContactCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/empty-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/empty-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/empty-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/empty-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1 @@
+<ejb-jar/>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptyrelationship-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptyrelationship-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptyrelationship-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptyrelationship-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>OrderEJB</ejb-name>
+ <local-home>org.superbiz.OrderHome</local-home>
+ <local>org.superbiz.Order</local>
+ <ejb-class>org.superbiz.OrderBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderHeader</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findOrdersByUsername</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT OBJECT(o) FROM OrderHeader o</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>OrderLineEJB</ejb-name>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderLine</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>qty</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <relationships/>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptysession-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptysession-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptysession-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/emptysession-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,5 @@
+<ejb-jar>
+ <enterprise-beans>
+ <session/>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytomany-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytomany-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytomany-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytomany-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Product</abstract-schema-name>
+ <cmp-field>
+ <description>Identity</description>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product name</description>
+ <field-name>name</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product stock code</description>
+ <field-name>code</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product description</description>
+ <field-name>description</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findAll</method-name>
+ <method-params/>
+ </query-method>
+ <ejb-ql>SELECT p from Product p</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>OrderLineEJB</ejb-name>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderLine</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>qty</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <relationships>
+ <ejb-relation>
+ <ejb-relation-name>OrderLineEJB - ProductEJB</ejb-relation-name>
+ <ejb-relationship-role>
+ <multiplicity>Many</multiplicity>
+ <relationship-role-source>
+ <ejb-name>OrderLineEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>product</cmr-field-name>
+ </cmr-field>
+ </ejb-relationship-role>
+ <ejb-relationship-role>
+ <multiplicity>Many</multiplicity>
+ <relationship-role-source>
+ <ejb-name>ProductEJB</ejb-name>
+ </relationship-role-source>
+ </ejb-relationship-role>
+ </ejb-relation>
+ </relationships>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytoone-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytoone-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytoone-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/manytoone-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Product</abstract-schema-name>
+ <cmp-field>
+ <description>Identity</description>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product name</description>
+ <field-name>name</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product stock code</description>
+ <field-name>code</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product description</description>
+ <field-name>description</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findAll</method-name>
+ <method-params/>
+ </query-method>
+ <ejb-ql>SELECT p from Product p</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>OrderLineEJB</ejb-name>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderLine</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>qty</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <relationships>
+ <ejb-relation>
+ <ejb-relation-name>OrderLineEJB - ProductEJB</ejb-relation-name>
+ <ejb-relationship-role>
+ <multiplicity>Many</multiplicity>
+ <relationship-role-source>
+ <ejb-name>OrderLineEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>product</cmr-field-name>
+ </cmr-field>
+ </ejb-relationship-role>
+ <ejb-relationship-role>
+ <multiplicity>One</multiplicity>
+ <relationship-role-source>
+ <ejb-name>ProductEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>orderLine</cmr-field-name>
+ </cmr-field>
+
+ </ejb-relationship-role>
+ </ejb-relation>
+ </relationships>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/nobeans-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/nobeans-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/nobeans-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/nobeans-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,3 @@
+<ejb-jar>
+ <enterprise-beans/>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Product</abstract-schema-name>
+ <cmp-field>
+ <description>Identity</description>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product name</description>
+ <field-name>name</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product stock code</description>
+ <field-name>code</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product description</description>
+ <field-name>description</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findAll</method-name>
+ <method-params/>
+ </query-method>
+ <ejb-ql>SELECT p from Product p</ejb-ql>
+ </query>
+ </entity>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-openejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-openejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-openejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/notablename-openejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openejb-jar
+ xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
+ xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+ xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1"
+ xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-jndi-name>ProductEJBLocalHome</local-jndi-name>
+ <cmp-field-mapping>
+ <cmp-field-name>id</cmp-field-name>
+ <table-column>id</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>name</cmp-field-name>
+ <table-column>name</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>description</cmp-field-name>
+ <table-column>description</table-column>
+ </cmp-field-mapping>
+ <cmp-field-mapping>
+ <cmp-field-name>code</cmp-field-name>
+ <table-column>code</table-column>
+ </cmp-field-mapping>
+ <pkgen:key-generator>
+ <pkgen:auto-increment-table>
+ <pkgen:sql>INSERT INTO products(id, name, description, code) VALUES(null, null, null, null)</pkgen:sql>
+ <pkgen:return-type>java.lang.Integer</pkgen:return-type>
+ </pkgen:auto-increment-table>
+ </pkgen:key-generator>
+ </entity>
+ </enterprise-beans>
+</openejb-jar>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetomany-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetomany-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetomany-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetomany-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>OrderEJB</ejb-name>
+ <local-home>org.superbiz.OrderHome</local-home>
+ <local>org.superbiz.Order</local>
+ <ejb-class>org.superbiz.OrderBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderHeader</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findOrdersByUsername</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ </method-params>
+ </query-method>
+ <ejb-ql>SELECT OBJECT(o) FROM OrderHeader o</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>OrderLineEJB</ejb-name>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderLine</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>qty</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <relationships>
+ <ejb-relation>
+ <ejb-relation-name>OrderEJB - OrderLineEJB</ejb-relation-name>
+ <ejb-relationship-role>
+ <multiplicity>One</multiplicity>
+ <relationship-role-source>
+ <ejb-name>OrderEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>orderLine</cmr-field-name>
+ <cmr-field-type>java.util.Collection</cmr-field-type>
+ </cmr-field>
+ </ejb-relationship-role>
+ <ejb-relationship-role>
+ <multiplicity>Many</multiplicity>
+ <relationship-role-source>
+ <ejb-name>OrderLineEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>order</cmr-field-name>
+ </cmr-field>
+ </ejb-relationship-role>
+ </ejb-relation>
+ </relationships>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetoone-ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetoone-ejb-jar.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetoone-ejb-jar.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/onetoone-ejb-jar.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <entity>
+ <ejb-name>ProductEJB</ejb-name>
+ <local-home>org.superbiz.ProductHome</local-home>
+ <local>org.superbiz.Product</local>
+ <ejb-class>org.superbiz.ProductBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>Product</abstract-schema-name>
+ <cmp-field>
+ <description>Identity</description>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product name</description>
+ <field-name>name</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product stock code</description>
+ <field-name>code</field-name>
+ </cmp-field>
+ <cmp-field>
+ <description>product description</description>
+ <field-name>description</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ <query>
+ <query-method>
+ <method-name>findAll</method-name>
+ <method-params/>
+ </query-method>
+ <ejb-ql>SELECT p from Product p</ejb-ql>
+ </query>
+ </entity>
+ <entity>
+ <ejb-name>OrderLineEJB</ejb-name>
+ <local-home>org.superbiz.OrderLineHome</local-home>
+ <local>org.superbiz.OrderLine</local>
+ <ejb-class>org.superbiz.OrderLineBean</ejb-class>
+ <persistence-type>Container</persistence-type>
+ <prim-key-class>java.lang.Integer</prim-key-class>
+ <reentrant>true</reentrant>
+ <cmp-version>2.x</cmp-version>
+ <abstract-schema-name>OrderLine</abstract-schema-name>
+ <cmp-field>
+ <field-name>id</field-name>
+ </cmp-field>
+ <cmp-field>
+ <field-name>qty</field-name>
+ </cmp-field>
+ <primkey-field>id</primkey-field>
+ </entity>
+ </enterprise-beans>
+ <relationships>
+ <ejb-relation>
+ <ejb-relation-name>OrderLineEJB - ProductEJB</ejb-relation-name>
+ <ejb-relationship-role>
+ <multiplicity>One</multiplicity>
+ <relationship-role-source>
+ <ejb-name>OrderLineEJB</ejb-name>
+ </relationship-role-source>
+ <cmr-field>
+ <cmr-field-name>product</cmr-field-name>
+ </cmr-field>
+ </ejb-relationship-role>
+ <ejb-relationship-role>
+ <multiplicity>One</multiplicity>
+ <relationship-role-source>
+ <ejb-name>ProductEJB</ejb-name>
+ </relationship-role-source>
+ </ejb-relationship-role>
+ </ejb-relation>
+ </relationships>
+</ejb-jar>
\ No newline at end of file
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/openejb-jar2.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/openejb-jar2.xml?rev=724906&r1=724905&r2=724906&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/openejb-jar2.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/openejb-jar2.xml Tue Dec 9 13:49:56 2008
@@ -2,7 +2,7 @@
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
- <dep:groupId>uk.me.jrg.jee.sample.project</dep:groupId>
+ <dep:groupId>org.superbiz.project</dep:groupId>
<dep:artifactId>ejb</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>jar</dep:type>
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean-local.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean-local.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean-local.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean-local.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <session>
+ <description>Business logic for the store</description>
+ <display-name>Store</display-name>
+ <ejb-name>StoreEJB</ejb-name>
+ <local-home>org.superbiz.StoreHome</local-home>
+ <local>org.superbiz.Store</local>
+ <ejb-class>org.superbiz.StoreBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean.xml?rev=724906&view=auto
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean.xml (added)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/common/src/test/resources/org/apache/openejb/plugins/common/single-session-bean.xml Tue Dec 9 13:49:56 2008
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+ <enterprise-beans>
+ <session>
+ <description>Business logic for the store</description>
+ <display-name>Store</display-name>
+ <ejb-name>StoreEJB</ejb-name>
+ <home>org.superbiz.StoreHome</home>
+ <remote>org.superbiz.Store</remote>
+ <ejb-class>org.superbiz.StoreBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java?rev=724906&r1=724905&r2=724906&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/org.apache.openejb.helper.annotation.test/src/main/java/org/apache/openejb/helper/annotation/tests/ConvertEjbCreateMethodToConstructorTest.java Tue Dec 9 13:49:56 2008
@@ -41,29 +41,29 @@
}
public void testShouldConvertEjbCreateMethodToAConstructor() throws Exception {
- fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+ fixture.addClassToProject("org.superbiz.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
JDTFacade facade = new JDTFacade(fixture.getProject());
- facade.convertMethodToConstructor("uk.me.jrg.jee.store.ejb.ProductBean", "ejbCreate", new String[] { "java.lang.Integer", "java.lang.String", "java.lang.String", "java.lang.String"}); //$NON-NLS-1$
+ facade.convertMethodToConstructor("org.superbiz.ProductBean", "ejbCreate", new String[] { "java.lang.Integer", "java.lang.String", "java.lang.String", "java.lang.String"}); //$NON-NLS-1$
Change change = facade.getChange();
change.perform(new NullProgressMonitor());
- assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("Expected30ProductBean.txt")), fixture.getClassContents("uk.me.jrg.jee.store.ejb.ProductBean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("Expected30ProductBean.txt")), fixture.getClassContents("org.superbiz.ProductBean")); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testShouldChangeUsesOfEjbCreateToUseConstructor() throws Exception {
- fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
- fixture.addClassToProject("uk.me.jrg.jee.store.ejb.ProductHome", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductHome.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
- fixture.addClassToProject("uk.me.jrg.jee.store.ejb.SessionBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21SessionBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
- fixture.addClassToProject("uk.me.jrg.jee.store.ejb.Product", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21Product.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+ fixture.addClassToProject("org.superbiz.ProductBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+ fixture.addClassToProject("org.superbiz.ProductHome", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21ProductHome.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+ fixture.addClassToProject("org.superbiz.SessionBean", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21SessionBean.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
+ fixture.addClassToProject("org.superbiz.Product", fixture.getStreamContent(getClass().getResourceAsStream("Ejb21Product.txt"))); //$NON-NLS-1$ //$NON-NLS-2$
JDTFacade facade = new JDTFacade(fixture.getProject());
String[] signature = new String[] { "java.lang.Integer", "java.lang.String", "java.lang.String", "java.lang.String" };
- facade.changeInvocationsToConstructor("uk.me.jrg.jee.store.ejb.ProductHome", "create", signature, "uk.me.jrg.jee.store.ejb.ProductBean");
+ facade.changeInvocationsToConstructor("org.superbiz.ProductHome", "create", signature, "org.superbiz.ProductBean");
Change change = facade.getChange();
change.perform(new NullProgressMonitor());
- assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedSessionBean.txt")), fixture.getClassContents("uk.me.jrg.jee.store.ejb.SessionBean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals(fixture.getStreamContent(getClass().getResourceAsStream("ExpectedSessionBean.txt")), fixture.getClassContents("org.superbiz.SessionBean")); //$NON-NLS-1$ //$NON-NLS-2$
}
}