01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.
06: //
07: // $Id: ArgsTest.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
08:
09: package org.ozoneDB.test.args;
10:
11: import org.ozoneDB.*;
12: import org.ozoneDB.DxLib.*;
13: import org.ozoneDB.test.*;
14: import junit.framework.*;
15:
16: /**
17: * @author <a href="http://www.softwarebuero.de/">SMB</a>
18: * @version $Revision: 1.1 $Date: 2001/12/18 10:31:31 $
19: */
20: public class ArgsTest extends OzoneTestCase {
21:
22: protected Args args;
23:
24: public static Test suite() {
25: TestSuite suite = new TestSuite();
26: suite.addTestSuite(ArgsTest.class);
27: return suite;
28: }
29:
30: public ArgsTest(String name) {
31: super (name);
32: }
33:
34: public void testAll() throws Exception {
35: createObject();
36: accessObject();
37: accessObject();
38: deleteObject();
39: }
40:
41: public void createObject() throws Exception {
42: args = (Args) db().createObject(ArgsImpl.class.getName(),
43: OzoneInterface.Public, "ArgTest");
44: args.setup();
45: }
46:
47: public void deleteObject() throws Exception {
48: db().deleteObject(args);
49: }
50:
51: public void accessObject() throws Exception {
52: assert (args.setInt(100) == 100);
53:
54: assert (args.setShort((short) 100) == 100);
55:
56: String resultString = args.setSimpleObject("hallo");
57: assert (resultString.equals("hallo"));
58:
59: DxBag bag = new DxListBag();
60: for (int i = 0; i < 10; i++) {
61: bag.add(new Integer(i));
62: }
63: DxBag resultBag = args.setComplexObject(bag);
64: DxIterator it = resultBag.iterator();
65: for (int i = 0; it.next() != null; i++) {
66: assert (it.object().equals(new Integer(i)));
67: }
68:
69: Args serverSide = (Args) args.getProxy();
70: serverSide = (Args) serverSide.getProxy();
71: assert (serverSide == null);
72:
73: DxArrayBag abag = (DxArrayBag) args.getComplexProxy();
74: serverSide = (Args) abag.elementAtIndex(0);
75: serverSide = (Args) serverSide.getProxy();
76: assert (serverSide == null);
77:
78: // db.nameObject (args, null);
79: // db.deleteObject (args);
80: }
81: }
|