KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > bugs > bug532 > TestCase


1 package org.jacorb.test.bugs.bug532;
2
3
4
5 /*
6
7  * JacORB - a free Java ORB
8
9  *
10
11  * Copyright (C) 1997-2003 Gerald Brose.
12
13  *
14
15  * This library is free software; you can redistribute it and/or
16
17  * modify it under the terms of the GNU Library General Public
18
19  * License as published by the Free Software Foundation; either
20
21  * version 2 of the License, or (at your option) any later version.
22
23  *
24
25  * This library is distributed in the hope that it will be useful,
26
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
31  * Library General Public License for more details.
32
33  *
34
35  * You should have received a copy of the GNU Library General Public
36
37  * License along with this library; if not, write to the Free
38
39  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
40
41  */

42
43
44
45 import junit.framework.*;
46
47
48
49 import org.omg.CORBA.*;
50
51
52
53 /**
54
55  * Test for bug 532, CDROutputStream.create_input_stream completely fails
56
57  * to take account of deferred writes, so fails when byte[]s larger than
58
59  * 4000 bytes are being sent. We saw that bug appearing in JBoss when we
60
61  * could not insert into an Any a byte[] of size larger than 4000 bytes.
62
63  *
64
65  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
66
67  * @version $Id: TestCase.java,v 1.1 2005/03/27 19:00:21 francisco Exp $
68
69  */

70
71 public class TestCase extends junit.framework.TestCase
72
73 {
74
75     public TestCase(String JavaDoc name)
76
77     {
78
79         super(name);
80
81     }
82
83
84
85     public static Test suite()
86
87     {
88
89         TestSuite suite = new TestSuite ("bug 532 CDROutputStream.create_input_stream is wrong when there are deferred writes");
90
91         suite.addTest (new TestCase ("testLargeByteArrayToAnyInsertion"));
92
93         return suite;
94
95     }
96
97
98
99     public void testLargeByteArrayToAnyInsertion()
100
101     {
102
103         try
104
105         {
106
107             ORB orb = org.omg.CORBA.ORB.init (new String JavaDoc[]{}, null);
108
109
110
111             byte[] bytes = new byte[4001];
112
113             Any any = orb.create_any();
114
115             ByteSequenceHelper.insert(any, bytes);
116
117         }
118
119         catch (Exception JavaDoc e)
120
121         {
122
123             fail("Caught Exception while inserting large byte[] into an Any: " + e);
124
125         }
126
127     }
128
129
130
131     public static void main(String JavaDoc[] args)
132
133     {
134
135         junit.textui.TestRunner.run(TestCase.class);
136
137     }
138
139
140
141 }
142
143
Popular Tags