deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [4/6] git commit: DELTASPIKE-417 Improved tests, allow default EM producer.
Date Wed, 02 Oct 2013 12:45:55 GMT
DELTASPIKE-417 Improved tests, allow default EM producer.


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/dec5d7e7
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/dec5d7e7
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/dec5d7e7

Branch: refs/heads/master
Commit: dec5d7e7e7f80e4c7d22c4e56b42d0f568f730b4
Parents: af0270f
Author: Thomas Hug <Thomas.Hug@ctp-consulting.com>
Authored: Wed Oct 2 13:59:54 2013 +0200
Committer: Thomas Hug <Thomas.Hug@ctp-consulting.com>
Committed: Wed Oct 2 14:36:54 2013 +0200

----------------------------------------------------------------------
 .../impl/handler/CdiQueryContextHolder.java     |   6 +-
 .../data/impl/handler/EntityManagerLookup.java  |   3 +-
 .../data/impl/handler/EntityManagerTest.java    |  40 ++-
 .../impl/handler/EntityManagerTestProducer.java |  35 ---
 .../NonQualifiedEntityManagerTestProducer.java  |  32 +++
 .../QualifiedEntityManagerTestProducer.java     | 286 +++++++++++++++++++
 .../SimpleRepositoryWithEntityManager.java      |   2 -
 ...mpleRepositoryWithEntityManagerResolver.java |  35 +++
 ...leRepositoryWithOverriddenEntityManager.java |  42 ---
 9 files changed, 377 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java
index a3eab9e..bda1e42 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/CdiQueryContextHolder.java
@@ -40,7 +40,11 @@ public class CdiQueryContextHolder
 
     public void dispose()
     {
-        context.get().cleanup();
+        CdiQueryInvocationContext ctx = context.get();
+        if (ctx != null)
+        {
+            ctx.cleanup();
+        }
         context.remove();
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
index 976ba70..5548f16 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/EntityManagerLookup.java
@@ -23,6 +23,7 @@ import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 import javax.persistence.EntityManager;
 
+import org.apache.deltaspike.core.api.literal.DefaultLiteral;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.api.provider.DependentProvider;
 import org.apache.deltaspike.data.api.EntityManagerResolver;
@@ -47,7 +48,7 @@ public class EntityManagerLookup
         }
         else
         {
-            result = entityManager.get();
+            result = entityManager.select(new DefaultLiteral()).get();
         }
         if (repository.hasEntityManagerFlushMode())
         {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java
index e812c8a..18f2399 100644
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTest.java
@@ -20,6 +20,7 @@ package org.apache.deltaspike.data.impl.handler;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import java.util.List;
 
@@ -27,7 +28,7 @@ import javax.inject.Inject;
 
 import org.apache.deltaspike.data.test.domain.Simple;
 import org.apache.deltaspike.data.test.service.SimpleRepositoryWithEntityManager;
-import org.apache.deltaspike.data.test.service.SimpleRepositoryWithOverriddenEntityManager;
+import org.apache.deltaspike.data.test.service.SimpleRepositoryWithEntityManagerResolver;
 import org.apache.deltaspike.data.test.service.Simplistic;
 import org.apache.deltaspike.data.test.service.SimplisticEntityManagerResolver;
 import org.apache.deltaspike.data.test.util.TestDeployments;
@@ -49,48 +50,41 @@ public class EntityManagerTest
     {
         return TestDeployments.initDeployment()
                 .addClasses(SimpleRepositoryWithEntityManager.class,
-                        SimpleRepositoryWithOverriddenEntityManager.class,
-                        EntityManagerTestProducer.class,
+                        SimpleRepositoryWithEntityManagerResolver.class,
+                        QualifiedEntityManagerTestProducer.class,
+                        NonQualifiedEntityManagerTestProducer.class,
                         Simplistic.class, SimplisticEntityManagerResolver.class);
     }
 
     @Inject
-    private SimpleRepositoryWithEntityManager repoWithAnnotation;
+    private SimpleRepositoryWithEntityManager repoWithDefaultEm;
 
     @Inject
-    private SimpleRepositoryWithOverriddenEntityManager repoWithInjection;
+    private SimpleRepositoryWithEntityManagerResolver repoWithInjection;
 
     @Test
-    public void should_use_qualified_entity_manager()
+    public void should_use_default_entity_manager()
     {
         // when
-        List<Simple> result = repoWithAnnotation.findByName("testUseQualifiedEntityManager");
+        List<Simple> result = repoWithDefaultEm.findByName("testUseQualifiedEntityManager");
 
         // then
         assertNotNull(result);
         assertEquals(0, result.size());
     }
 
-    @Test
-    public void should_use_injected_entity_manager()
-    {
-        // when
-        List<Simple> result = repoWithInjection.findByName("testUseInjectedEntityManager");
-
-        // then
-        assertNotNull(result);
-        assertEquals(0, result.size());
-    }
-
-    @Test
-    public void should_inject_entity_manager()
+    /*
+     * Injected EM throws UnsupportedOperationException on all methods.
+     * Shortcutting the creation of multiple PUs (lazy guy...)
+     */
+    @Test(expected = QueryInvocationException.class)
+    public void should_use_entity_manager_from_resolver()
     {
         // when
-        List<Simple> result = repoWithInjection.findWithEm("testInjectEntityManager");
+        repoWithInjection.findByName("testUseQualifiedEntityManager");
 
         // then
-        assertNotNull(result);
-        assertEquals(0, result.size());
+        fail("Fake EM should have thrown Exception");
     }
 
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTestProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTestProducer.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTestProducer.java
deleted file mode 100644
index 87aeda4..0000000
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/EntityManagerTestProducer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.deltaspike.data.impl.handler;
-
-import javax.enterprise.inject.Produces;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.apache.deltaspike.data.test.service.Simplistic;
-
-public class EntityManagerTestProducer
-{
-
-    @Produces
-    @Simplistic
-    @PersistenceContext
-    private EntityManager entityManager;
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NonQualifiedEntityManagerTestProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NonQualifiedEntityManagerTestProducer.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NonQualifiedEntityManagerTestProducer.java
new file mode 100644
index 0000000..eac7620
--- /dev/null
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/NonQualifiedEntityManagerTestProducer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.deltaspike.data.impl.handler;
+
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class NonQualifiedEntityManagerTestProducer
+{
+
+    @Produces
+    @PersistenceContext
+    private EntityManager entityManager;
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QualifiedEntityManagerTestProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QualifiedEntityManagerTestProducer.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QualifiedEntityManagerTestProducer.java
new file mode 100644
index 0000000..4a80299
--- /dev/null
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/impl/handler/QualifiedEntityManagerTestProducer.java
@@ -0,0 +1,286 @@
+/*
+ * 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.deltaspike.data.impl.handler;
+
+import java.util.Map;
+
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.FlushModeType;
+import javax.persistence.LockModeType;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.metamodel.Metamodel;
+
+import org.apache.deltaspike.data.test.service.Simplistic;
+
+public class QualifiedEntityManagerTestProducer
+{
+
+    @Produces
+    @Simplistic
+    private final EntityManager entityManager = new EntityManager()
+    {
+
+        @Override
+        public <T> T unwrap(Class<T> arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setProperty(String arg0, Object arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setFlushMode(FlushModeType arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void remove(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void refresh(Object arg0, LockModeType arg1, Map<String, Object> arg2)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void refresh(Object arg0, LockModeType arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void refresh(Object arg0, Map<String, Object> arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void refresh(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void persist(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T merge(T arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void lock(Object arg0, LockModeType arg1, Map<String, Object> arg2)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void lock(Object arg0, LockModeType arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void joinTransaction()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean isOpen()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public EntityTransaction getTransaction()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T getReference(Class<T> arg0, Object arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Map<String, Object> getProperties()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Metamodel getMetamodel()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public LockModeType getLockMode(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public FlushModeType getFlushMode()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public EntityManagerFactory getEntityManagerFactory()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Object getDelegate()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public CriteriaBuilder getCriteriaBuilder()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void flush()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2, Map<String,
Object> arg3)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T find(Class<T> arg0, Object arg1, LockModeType arg2)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T find(Class<T> arg0, Object arg1, Map<String, Object>
arg2)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> T find(Class<T> arg0, Object arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void detach(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> TypedQuery<T> createQuery(String arg0, Class<T> arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> TypedQuery<T> createQuery(CriteriaQuery<T> arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Query createQuery(String arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Query createNativeQuery(String arg0, String arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Query createNativeQuery(String arg0, Class arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Query createNativeQuery(String arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public <T> TypedQuery<T> createNamedQuery(String arg0, Class<T>
arg1)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Query createNamedQuery(String arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public boolean contains(Object arg0)
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void close()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void clear()
+        {
+            throw new UnsupportedOperationException();
+        }
+    };
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java
index d6f8ca7..6c890c5 100644
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManager.java
@@ -20,13 +20,11 @@ package org.apache.deltaspike.data.test.service;
 
 import java.util.List;
 
-import org.apache.deltaspike.data.api.EntityManagerConfig;
 import org.apache.deltaspike.data.api.EntityRepository;
 import org.apache.deltaspike.data.api.Repository;
 import org.apache.deltaspike.data.test.domain.Simple;
 
 @Repository
-@EntityManagerConfig(entityManagerResolver = SimplisticEntityManagerResolver.class)
 public interface SimpleRepositoryWithEntityManager extends EntityRepository<Simple, Long>
 {
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManagerResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManagerResolver.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManagerResolver.java
new file mode 100644
index 0000000..dc82e2d
--- /dev/null
+++ b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithEntityManagerResolver.java
@@ -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.deltaspike.data.test.service;
+
+import java.util.List;
+
+import org.apache.deltaspike.data.api.AbstractEntityRepository;
+import org.apache.deltaspike.data.api.EntityManagerConfig;
+import org.apache.deltaspike.data.api.Repository;
+import org.apache.deltaspike.data.test.domain.Simple;
+
+@Repository
+@EntityManagerConfig(entityManagerResolver = SimplisticEntityManagerResolver.class)
+public abstract class SimpleRepositoryWithEntityManagerResolver extends AbstractEntityRepository<Simple,
Long>
+{
+
+    public abstract List<Simple> findByName(String name);
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/dec5d7e7/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithOverriddenEntityManager.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithOverriddenEntityManager.java
b/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithOverriddenEntityManager.java
deleted file mode 100644
index 6111a8d..0000000
--- a/deltaspike/modules/data/impl/src/test/java/org/apache/deltaspike/data/test/service/SimpleRepositoryWithOverriddenEntityManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.deltaspike.data.test.service;
-
-import java.util.List;
-
-import org.apache.deltaspike.data.api.AbstractEntityRepository;
-import org.apache.deltaspike.data.api.EntityManagerConfig;
-import org.apache.deltaspike.data.api.Repository;
-import org.apache.deltaspike.data.test.domain.Simple;
-
-@EntityManagerConfig(entityManagerResolver = SimplisticEntityManagerResolver.class)
-@Repository
-public abstract class SimpleRepositoryWithOverriddenEntityManager extends AbstractEntityRepository<Simple,
Long>
-{
-
-    public abstract List<Simple> findByName(String name);
-
-    public List<Simple> findWithEm(String name)
-    {
-        return entityManager().createQuery("select s from Simple s where s.name = ?1", Simple.class)
-                .setParameter(1, name)
-                .getResultList();
-    }
-
-}


Mime
View raw message