You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2009/12/28 19:33:37 UTC
svn commit: r894211 - in
/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed:
./ multipleinterfaces/
Author: struberg
Date: Mon Dec 28 18:33:36 2009
New Revision: 894211
URL: http://svn.apache.org/viewvc?rev=894211&view=rev
Log:
OWB-210 unit test for demonstrating the problem with an interface showing up twice in the class hierarchy.
Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java (with props)
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html (with props)
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,60 @@
+/*
+ * 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.webbeans.newtests.managed;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.managed.multipleinterfaces.MyEntityServiceImpl;
+import org.junit.Test;
+
+public class ProxyFactoryTest extends AbstractUnitTest {
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testProxyFactoryWithMultipleInterfaces() {
+ Collection<URL> beanXmls = new ArrayList<URL>();
+
+ Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+ beanClasses.add(MyEntityServiceImpl.class);
+
+ startContainer(beanClasses, beanXmls);
+
+ Set<Bean<?>> beans = getBeanManager().getBeans(MyEntityServiceImpl.class);
+ Assert.assertNotNull(beans);
+
+ @SuppressWarnings("unchecked")
+ Bean<MyEntityServiceImpl> bean = (Bean<MyEntityServiceImpl>) beans.iterator().next();
+ Assert.assertNotNull(bean);
+
+ CreationalContext<MyEntityServiceImpl> ctx = getBeanManager().createCreationalContext(bean);
+
+ Object reference = getBeanManager().getReference(bean, MyEntityServiceImpl.class, ctx);
+ Assert.assertNotNull(reference);
+ }
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/ProxyFactoryTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,48 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public abstract class AbstractCrudService<T> implements GenericCrudService<T> {
+
+ @Override
+ public T create(T entity) {
+ // em.create(type)
+ return null;
+ }
+
+ @Override
+ public void delete(T entity) {
+ // em.delete...
+
+ }
+
+ @Override
+ public T getById(Object id) {
+ // em.find...
+ return null;
+ }
+
+ @Override
+ public T update(T entity) {
+ // em.merge...
+ return null;
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/AbstractCrudService.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,28 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public interface GenericCrudService<T> {
+
+ public T create(T type);
+ public T update(T entity);
+ public T getById(Object id);
+ public void delete(T entity);
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/GenericCrudService.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+// @Entity ...
+public class MyEntity {
+
+ private int id;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntity.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,25 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+public interface MyEntityService extends GenericCrudService<MyEntity> {
+
+ public void specialMyEntityFunction(MyEntity e);
+}
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityService.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java Mon Dec 28 18:33:36 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.webbeans.newtests.managed.multipleinterfaces;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class MyEntityServiceImpl extends AbstractCrudService<MyEntity> implements MyEntityService {
+
+ @Override
+ public void specialMyEntityFunction(MyEntity e) {
+ // do something very special ;)
+ }
+}
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/MyEntityServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html?rev=894211&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html Mon Dec 28 18:33:36 2009
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+<html>
+<body>
+<h2>Test classes for demonstrating OWB-210</h2>
+<p>This package contains a realworld scenario of a CRUD Service Framework.</p>
+<p>We left away the entity etc, but show the important structure. The original
+problem was that <code>GenericCrudSerive</code> is contained twice in the
+class definition chain which caused the JavassistProxyFactory to fail while
+creating the proxy.</p>
+</body>
+</html>
\ No newline at end of file
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/managed/multipleinterfaces/package.html
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision