[jboss-cvs] jboss-seam/src/test/integration/src/org/jboss/seam/test/integration ...
Norman Richards
norman.richards at jboss.com
Fri Nov 16 01:27:10 EST 2007
User: nrichards
Date: 07/11/16 01:27:10
Modified: src/test/integration/src/org/jboss/seam/test/integration
testng.xml
Added: src/test/integration/src/org/jboss/seam/test/integration
EntityPassivationTest.java UnversionedThing.java
Log:
JBSEAM-2214
Revision Changes Path
1.8 +1 -1 jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/testng.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: testng.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/testng.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testng.xml 18 Oct 2007 21:26:29 -0000 1.7
+++ testng.xml 16 Nov 2007 06:27:10 -0000 1.8
@@ -1,7 +1,6 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
<suite name="Seam Core Tests" verbose="2" parallel="false">
-
<test name="Seam Core - Integration: Contexts">
<classes>
<class name="org.jboss.seam.test.integration.PageContextTest"/>
@@ -11,6 +10,7 @@
<test name="Seam Core - Integration: Persistence">
<classes>
<class name="org.jboss.seam.test.integration.EntityTest"/>
+ <class name="org.jboss.seam.test.integration.EntityPassivationTest" />
</classes>
</test>
1.1 date: 2007/11/16 06:27:10; author: nrichards; state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EntityPassivationTest.java
Index: EntityPassivationTest.java
===================================================================
package org.jboss.seam.test.integration;
import java.util.List;
import javax.persistence.EntityManager;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Conversation;
import org.jboss.seam.mock.SeamTest;
import org.testng.annotations.Test;
public class EntityPassivationTest
extends SeamTest
{
@Test
public void testEntityList()
throws Exception
{
String id = new FacesRequest("/test.xhtml") {
@Override
protected void invokeApplication()
throws Exception
{
Conversation.instance().begin(true, false);
invokeAction("#{entitytest.someComponent.createSomeThings}");
invokeAction("#{entitytest.someComponent.loadThings}");
}
@Override
protected void renderResponse()
throws Exception
{
List things = (List) getValue("#{entitytest.someComponent.things}");
assert things!=null && things.size() > 0;
assert things.get(0) != null;
}
}.run();
new FacesRequest("/test.xhtml", id) {
// the entities should be passivated
}.run();
new FacesRequest("/test.xhtml", id) {
// passivated a second time
}.run();
new FacesRequest("/test.xhtml", id) {
@Override
protected void renderResponse()
throws Exception
{
List things = (List) getValue("#{entitytest.someComponent.things}");
assert things!=null && things.size() > 0;
assert things.get(0) != null;
Object thing = getValue("#{entitytest.someComponent.thing}");
System.out.println("thing=" + thing);
assert thing!=null;
}
}.run();
}
@Name("entitytest.someComponent")
@Scope(ScopeType.CONVERSATION)
@AutoCreate
public static class SomeComponent {
@In EntityManager entityManager;
List<UnversionedThing> things;
UnversionedThing thing;
public void loadThings() {
things = entityManager.createQuery("select t from UnversionedThing t").getResultList();
thing = things.get(0);
}
public List<UnversionedThing> getThings() {
return things;
}
public UnversionedThing getThing() {
return thing;
}
public void createSomeThings() {
UnversionedThing thing1 = new UnversionedThing();
thing1.setName("thing one");
entityManager.persist(thing1);
}
}
}
1.1 date: 2007/11/16 06:27:10; author: nrichards; state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/UnversionedThing.java
Index: UnversionedThing.java
===================================================================
package org.jboss.seam.test.integration;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Version;
@Entity
public class UnversionedThing {
@GeneratedValue
@Id
private Long id;
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "UnversionedThing#" + id + "]";
}
}
More information about the jboss-cvs-commits
mailing list