1 //==============================================================================
2 // file : JibxUtilTest.java
3 // project: East Networks News System
4 //
5 // last change: date: $Date: 2003/09/10 09:28:37 $
6 // by: $Author: bitiboy $
7 // revision: $Revision: 1.1 $
8 //------------------------------------------------------------------------------
9 // copyright: GNU GPL Software License (see class documentation)
10 //==============================================================================
11 package net.eastol.news.test;
12
13 import com.justhis.jdo.JDOContext;
14 import com.justhis.jdo.JDOUtil;
15
16 import com.justhis.jibx.JibxUtil;
17
18 import com.justhis.util.exception.LogicException;
19 import com.justhis.util.exception.PropertiesFileReadException;
20
21 import junit.framework.TestCase;
22
23 import net.eastol.news.jdo.bean.NewsClass;
24
25 import org.jibx.runtime.JiBXException;
26
27 import java.io.FileNotFoundException;
28
29 import java.sql.SQLException;
30
31 import java.util.Date;
32
33 import javax.jdo.PersistenceManager;
34
35
36 /*
37 * TODO
38 * @author <a href="http://blog.ejb.cn">acai</a>
39 *
40 * @version $Revision: 1.1 $
41 */
42 public class JibxUtilTest extends TestCase {
43 //~ Constructors -----------------------------------------------------------
44
45 /***
46 * Constructor for JibxUtilTest.
47 *
48 * @param arg0
49 */
50 public JibxUtilTest(String arg0) {
51 super(arg0);
52 }
53
54 //~ Methods ----------------------------------------------------------------
55
56 /*
57 * ???? void marshallDocument(Object, String, OutputStream)
58 */
59 public void testMarshallDocumentObjectStringOutputStream()
60 throws SQLException,
61 LogicException,
62 FileNotFoundException,
63 JiBXException {
64 NewsClass nc = new NewsClass();
65 nc.setClassName("className");
66 nc.setNewsClassId(123);
67 nc.setListStyle(23);
68 nc.setStyleId(32);
69 nc.setLogo("logo");
70 nc.setNewsAd("newsAd");
71 nc.setHeadAd("headAd");
72 nc.setLastUpdate(new Date());
73
74 PersistenceManager pm = getPM();
75
76 JDOUtil.createObject(pm, nc);
77
78 JibxUtil.marshallDocument(nc, "asdf.xslt", "asdf.xml");
79 }
80
81 /*
82 * ???? Object unmarshallDocument(Object, String)
83 */
84 public void testUnmarshallDocumentObjectString() {
85 }
86
87 /***
88 * TODO
89 *
90 * @return TODO
91 *
92 * @throws SQLException TODO
93 * @throws LogicException TODO
94 */
95 protected PersistenceManager getPM() throws SQLException, LogicException {
96 JDOContext ctx = null;
97
98 //????JDO??????
99 try {
100 ctx = JDOContext.getContext();
101 } catch (PropertiesFileReadException e) {
102 throw new LogicException("can't read properties File!");
103 }
104
105 if (ctx == null) {
106 throw new SQLException("Can't get JDOContext!");
107 }
108
109 return ctx.getPersistenceManager();
110 }
111 }
112
113
114 /*
115 * $Log: JibxUtilTest.java,v $
116 * Revision 1.1 2003/09/10 09:28:37 bitiboy
117 * *** empty log message ***
118 *
119 *
120 */
This page was automatically generated by Maven