[weld-commits] Weld SVN: r6953 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Tue Aug 10 16:39:50 EDT 2010
Author: pete.muir at jboss.org
Date: 2010-08-10 16:39:49 -0400 (Tue, 10 Aug 2010)
New Revision: 6953
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java
Log:
CDITCK-169
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java 2010-08-10 20:39:49 UTC (rev 6953)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext;
+
+import javax.ejb.Local;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Local
+public interface ServiceBean
+{
+ public boolean validateEntityManager();
+
+ public ManagedBean getManagedBean();
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java 2010-08-10 20:39:49 UTC (rev 6953)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext;
+
+import javax.ejb.Stateless;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Stateless
+public class ServiceBeanImpl implements ServiceBean
+{
+ @Inject
+ ManagedBean managedBean;
+
+ public ManagedBean getManagedBean()
+ {
+ return managedBean;
+ }
+
+ public boolean validateEntityManager()
+ {
+ boolean entityManagerValid = true;
+ EntityManager entityManager = managedBean.getPersistenceContext();
+ assert entityManager != null;
+ Object delegate = entityManager.getDelegate();
+ assert delegate != null;
+ try
+ {
+ entityManager.getTransaction();
+ entityManagerValid = false;
+ }
+ catch (IllegalStateException e)
+ {
+ // an IllegalStateException is the expected result if this is a JTA entityManager
+ }
+ try
+ {
+ entityManager.close();
+ entityManagerValid = false;
+ }
+ catch (IllegalStateException e)
+ {
+ // an IllegalStateException is the expected result if the entityManager is container-managed
+ }
+ return entityManagerValid;
+ }
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the weld-commits
mailing list