KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > regression > ejbthree440 > unit > FailingTestCase


1 package org.jboss.ejb3.test.regression.ejbthree440.unit;
2
3 import junit.framework.Test;
4 import org.jboss.ejb3.test.regression.ejbthree440.model.MyResource;
5 import org.jboss.ejb3.test.regression.ejbthree440.session.i.IInheritanceDemo;
6 import org.jboss.test.JBossTestCase;
7 import org.jnp.interfaces.NamingContextFactory;
8
9 import javax.naming.Context JavaDoc;
10 import javax.naming.InitialContext JavaDoc;
11 import javax.transaction.UserTransaction JavaDoc;
12 import java.util.Properties JavaDoc;
13 import org.jboss.serial.io.MarshalledObject;
14
15
16 /**
17  * Demonstrates entity inheritance.
18  *
19  * @author Ortwin Gl�ck
20  */

21 public class FailingTestCase extends JBossTestCase
22 {
23    org.jboss.logging.Logger log = getLog();
24
25    static boolean deployed = false;
26    static int test = 0;
27
28    public FailingTestCase(String JavaDoc name)
29    {
30
31       super(name);
32
33    }
34
35    public void testSerializationError() throws Exception JavaDoc
36    {
37       try
38       {
39          UserTransaction JavaDoc tx = null;
40          Context JavaDoc ctx = getInitialContext();
41
42          tx = (UserTransaction JavaDoc) ctx.lookup("UserTransaction");
43          IInheritanceDemo playground = (IInheritanceDemo) ctx.lookup("InheritanceDemo/remote");
44
45          tx.begin();
46          playground.create();
47          tx.commit();
48
49          tx.begin();
50          MarshalledObject mo = playground.readFromMO();
51          MyResource r = (MyResource)mo.get();
52          r = (MyResource) playground.read();
53          playground.remove();
54          tx.commit();
55          tx = null;
56       }
57       catch (Exception JavaDoc e)
58       {
59          e.printStackTrace();
60          throw e;
61       }
62    }
63
64
65    public static Test suite() throws Exception JavaDoc
66    {
67       return getDeploySetup(FailingTestCase.class, "ejbthree440.ear");
68    }
69 }
70
Popular Tags