Weld SVN: r6945 - cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-08-09 16:07:23 -0400 (Mon, 09 Aug 2010)
New Revision: 6945
Added:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ManagedBean.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java
Log:
CDITCK-169 fixed in the 1.0 branch
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ManagedBean.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ManagedBean.java 2010-08-09 17:37:52 UTC (rev 6944)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ManagedBean.java 2010-08-09 20:07:23 UTC (rev 6945)
@@ -22,7 +22,7 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
-class ManagedBean implements Serializable
+public class ManagedBean implements Serializable
{
@Inject @Database
private EntityManager persistenceContext;
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java 2010-08-09 17:37:52 UTC (rev 6944)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextInjectionTest.java 2010-08-09 20:07:23 UTC (rev 6945)
@@ -55,11 +55,10 @@
})
public void testInjectionOfPersistenceContext()
{
- Bean<ManagedBean> managedBeanBean = getBeans(ManagedBean.class).iterator().next();
- CreationalContext<ManagedBean> managedBeanCc = getCurrentManager().createCreationalContext(managedBeanBean);
- ManagedBean managedBean = managedBeanBean.create(managedBeanCc);
+ ServiceBean serviceBean = getInstanceByType(ServiceBean.class);
+ ManagedBean managedBean = serviceBean.getManagedBean();
assert managedBean.getPersistenceContext() != null : "Persistence context was not injected into bean";
- assert managedBean.getPersistenceContext().isOpen() : "Persistence context not open injected into bean";
+ assert serviceBean.validateEntityManager();
}
@Test(groups = { "beanLifecycle", "commonAnnotations", "integration" })
@@ -88,7 +87,7 @@
ManagedBean managedBean = managedBeanBean.create(managedBeanCc);
managedBean = (ManagedBean) deserialize(serialize(managedBean));
assert managedBean.getPersistenceContext() != null : "Persistence context was not injected into bean";
- assert managedBean.getPersistenceContext().isOpen() : "Persistence context not open injected into bean";
+ assert managedBean.getPersistenceContext().getDelegate() != null : "Persistence context not deserialized correctly";
}
@Test(groups = { "beanLifecycle", "commonAnnotations", "integration" })
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBean.java 2010-08-09 20:07:23 UTC (rev 6945)
@@ -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
+ */
+@Local
+public interface ServiceBean
+{
+ public boolean validateEntityManager();
+
+ public ManagedBean getManagedBean();
+}
Added: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java (rev 0)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/ServiceBeanImpl.java 2010-08-09 20:07:23 UTC (rev 6945)
@@ -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
+ */
+@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;
+ }
+}
15 years, 8 months
Weld SVN: r6944 - cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-08-09 13:37:52 -0400 (Mon, 09 Aug 2010)
New Revision: 6944
Modified:
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java
Log:
CDITCK-165
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2010-08-09 14:55:12 UTC (rev 6943)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2010-08-09 17:37:52 UTC (rev 6944)
@@ -100,6 +100,8 @@
{
SimpleBeanA instanceOfA = getInstanceByType(SimpleBeanA.class);
SimpleBeanB instanceOfB = getInstanceByType(SimpleBeanB.class);
- assert instanceOfA.getZ() == instanceOfB.getZ();
+ instanceOfA.getZ().setName("Ben");
+ assert instanceOfA.getZ().getName().equals("Ben");
+ assert instanceOfB.getZ().getName().equals("Ben");
}
}
Modified: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java 2010-08-09 14:55:12 UTC (rev 6943)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/context/SimpleBeanZ.java 2010-08-09 17:37:52 UTC (rev 6944)
@@ -24,5 +24,17 @@
public class SimpleBeanZ implements Serializable
{
private static final long serialVersionUID = 1L;
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
}
15 years, 8 months
[weld/core] a7e114: WELD-583 Added transactional observer integration ...
by noreply@github.com
Branch: refs/heads/master
Home: http://github.com/weld/core
Commit: a7e1144dfbeea62a1712f2feb90897043f8006d0
http://github.com/weld/core/commit/a7e1144dfbeea62a1712f2feb90897043f8006d0
Author: drallen <david.allen(a)acm.org>
Date: 2010-08-09 (Mon, 09 Aug 2010)
Changed paths:
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/Agent.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/DogAgent.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/FooException.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/Pomeranian.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/PomeranianInterface.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/Tame.java
A tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/TransactionalObserversTest.java
Log Message:
-----------
WELD-583 Added transactional observer integration tests to Arquillian test suite
Commit: dcb6768604d401962be2f5ebf996e079c37eebfe
http://github.com/weld/core/commit/dcb6768604d401962be2f5ebf996e079c37eebfe
Author: drallen <david.allen(a)acm.org>
Date: 2010-08-09 (Mon, 09 Aug 2010)
Changed paths:
M tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/Pomeranian.java
M tests-arquillian/src/test/java/org/jboss/weld/tests/event/observer/transactional/TransactionalObserversTest.java
Log Message:
-----------
Fixed new tests for transactional observers
15 years, 8 months