index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstFixed.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstFixed:1.0
//
/***/
public interface ConstFixed
{
java.math.BigDecimal value = new java.math.BigDecimal("368.054107");
}
| 5,500 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstInterfaceHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestConstInterface:1.0
//
final public class TestConstInterfaceHelper
{
public static void
insert(org.omg.CORBA.Any any, TestConstInterface val)
{
any.insert_Object(val, type());
}
public static TestConstInterface
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return narrow(any.extract_Object());
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_interface_tc(id(), "TestConstInterface");
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestConstInterface:1.0";
}
public static TestConstInterface
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (TestConstInterface)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_TestConstInterfaceStub _ob_stub = new _TestConstInterfaceStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestConstInterface val)
{
out.write_Object(val);
}
public static TestConstInterface
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (TestConstInterface)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestConstInterfaceStub _ob_stub = new _TestConstInterfaceStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
throw new org.omg.CORBA.BAD_PARAM();
}
return null;
}
public static TestConstInterface
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (TestConstInterface)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestConstInterfaceStub _ob_stub = new _TestConstInterfaceStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,501 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstInterfacePOA.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestConstInterface:1.0
//
public abstract class TestConstInterfacePOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
TestConstInterfaceOperations
{
static final String[] _ob_ids_ =
{
"IDL:TestConstInterface:1.0",
};
public TestConstInterface
_this()
{
return TestConstInterfaceHelper.narrow(super._this_object());
}
public TestConstInterface
_this(org.omg.CORBA.ORB orb)
{
return TestConstInterfaceHelper.narrow(super._this_object(orb));
}
public String[]
_all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId)
{
return _ob_ids_;
}
public org.omg.CORBA.portable.OutputStream
_invoke(String opName,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
throw new org.omg.CORBA.BAD_OPERATION();
}
}
| 5,502 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/_TestConstInterfaceStub.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestConstInterface:1.0
//
public class _TestConstInterfaceStub extends org.omg.CORBA.portable.ObjectImpl
implements TestConstInterface
{
private static final String[] _ob_ids_ =
{
"IDL:TestConstInterface:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestConstInterfaceOperations.class;
}
| 5,503 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion1.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion1:1.0
//
/***/
final public class TestUnion1 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
int _ob_d_;
static boolean
_OB_check(int d0, int d1)
{
int d[] = new int[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case -1:
break;
case -2:
break;
case -3:
break;
case 0:
case 1:
case 2:
case 3:
case -4:
case -5:
d[i] = 0;
break;
default:
d[i] = 4;
break;
}
}
return d[0] == d[1];
}
public
TestUnion1()
{
_ob_i_ = false;
}
public int
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public int
l()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, -1))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.IntHolder)_ob_v_).value;
}
public void
l(int val)
{
_ob_i_ = true;
_ob_d_ = -1;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public double[][][]
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, -2))
throw new org.omg.CORBA.BAD_OPERATION();
return (double[][][])_ob_v_;
}
public void
a(double[][][] val)
{
_ob_i_ = true;
_ob_d_ = -2;
_ob_v_ = val;
}
public String
s()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, -3))
throw new org.omg.CORBA.BAD_OPERATION();
return (String)_ob_v_;
}
public void
s(String val)
{
_ob_i_ = true;
_ob_d_ = -3;
_ob_v_ = val;
}
public TestStruct2
str()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 0))
throw new org.omg.CORBA.BAD_OPERATION();
return (TestStruct2)_ob_v_;
}
public void
str(TestStruct2 val)
{
_ob_i_ = true;
_ob_d_ = 0;
_ob_v_ = val;
}
public void
str(int d, TestStruct2 val)
{
if(!_OB_check(d, 0))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = val;
}
public org.omg.CORBA.TypeCode
tc()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 4))
throw new org.omg.CORBA.BAD_OPERATION();
return (org.omg.CORBA.TypeCode)_ob_v_;
}
public void
tc(org.omg.CORBA.TypeCode val)
{
_ob_i_ = true;
_ob_d_ = 4;
_ob_v_ = val;
}
public void
tc(int d, org.omg.CORBA.TypeCode val)
{
if(!_OB_check(d, 4))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = val;
}
}
| 5,504 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/String40SeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:String40Seq:1.0
//
final public class String40SeqHelper
{
public static void
insert(org.omg.CORBA.Any any, String[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static String[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "String40Seq", orb.create_sequence_tc(40, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:String40Seq:1.0";
}
public static String[]
read(org.omg.CORBA.portable.InputStream in)
{
String[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new String[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v[i0] = in.read_string();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, String[] val)
{
int len0 = val.length;
if(len0 > 40)
throw new org.omg.CORBA.MARSHAL();
out.write_ulong(len0);
for(int i0 = 0; i0 < len0; i0++)
out.write_string(val[i0]);
}
}
| 5,505 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct1Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct1:1.0
//
final public class TestStruct1Holder implements org.omg.CORBA.portable.Streamable
{
public TestStruct1 value;
public
TestStruct1Holder()
{
}
public
TestStruct1Holder(TestStruct1 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStruct1Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStruct1Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStruct1Helper.type();
}
}
| 5,506 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestFixed2Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestFixed2:1.0
//
final public class TestFixed2Helper
{
public static void
insert(org.omg.CORBA.Any any, java.math.BigDecimal val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static java.math.BigDecimal
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestFixed2", orb.create_fixed_tc((short)24, (short)8));
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestFixed2:1.0";
}
public static java.math.BigDecimal
read(org.omg.CORBA.portable.InputStream in)
{
java.math.BigDecimal _ob_v;
_ob_v = in.read_fixed().movePointLeft(8);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, java.math.BigDecimal val)
{
out.write_fixed(val.movePointRight(8));
}
}
| 5,507 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstDouble.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstDouble:1.0
//
/***/
public interface ConstDouble
{
double value = (double)(5.78117799999998993598637753166258335113525390625D);
}
| 5,508 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion2.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion2:1.0
//
/***/
final public class TestUnion2 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
int _ob_d_;
static boolean
_OB_check(int d0, int d1)
{
int d[] = new int[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case TestEnum._A:
case TestEnum._B:
d[i] = TestEnum._A;
break;
case TestEnum._C:
break;
}
}
return d[0] == d[1];
}
public
TestUnion2()
{
_ob_i_ = false;
}
public TestEnum
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return TestEnum.from_int(_ob_d_);
}
public int[]
seq()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, TestEnum._A))
throw new org.omg.CORBA.BAD_OPERATION();
return (int[])_ob_v_;
}
public void
seq(int[] val)
{
_ob_i_ = true;
_ob_d_ = TestEnum._A;
_ob_v_ = val;
}
public void
seq(TestEnum d, int[] val)
{
if(!_OB_check(d.value(), TestEnum._A))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d.value();
_ob_v_ = val;
}
public TestUnion1
un()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, TestEnum._C))
throw new org.omg.CORBA.BAD_OPERATION();
return (TestUnion1)_ob_v_;
}
public void
un(TestUnion1 val)
{
_ob_i_ = true;
_ob_d_ = TestEnum._C;
_ob_v_ = val;
}
}
| 5,509 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstShort.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstShort:1.0
//
/***/
public interface ConstShort
{
short value = (short)(-3L);
}
| 5,510 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstULongLongMax.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstULongLongMax:1.0
//
/***/
public interface ConstULongLongMax
{
long value = -1L;
}
| 5,511 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion3Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion3:1.0
//
final public class TestUnion3Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion3 value;
public
TestUnion3Holder()
{
}
public
TestUnion3Holder(TestUnion3 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion3Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion3Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion3Helper.type();
}
}
| 5,512 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct2Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct2:1.0
//
final public class TestStruct2Helper
{
public static void
insert(org.omg.CORBA.Any any, TestStruct2 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestStruct2
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[4];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "s";
members[0].type = TestStruct1Helper.type();
members[1] = new org.omg.CORBA.StructMember();
members[1].name = "a";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any);
members[2] = new org.omg.CORBA.StructMember();
members[2].name = "da";
members[2].type = DoubleArrayHelper.type();
members[3] = new org.omg.CORBA.StructMember();
members[3].name = "sa";
members[3].type = orb.create_array_tc(100, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));
typeCode_ = orb.create_struct_tc(id(), "TestStruct2", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestStruct2:1.0";
}
public static TestStruct2
read(org.omg.CORBA.portable.InputStream in)
{
TestStruct2 _ob_v = new TestStruct2();
_ob_v.s = TestStruct1Helper.read(in);
_ob_v.a = in.read_any();
_ob_v.da = DoubleArrayHelper.read(in);
int len0 = 100;
_ob_v.sa = new String[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v.sa[i0] = in.read_string();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestStruct2 val)
{
TestStruct1Helper.write(out, val.s);
out.write_any(val.a);
DoubleArrayHelper.write(out, val.da);
int len0 = val.sa.length;
if(len0 != 100)
throw new org.omg.CORBA.MARSHAL();
for(int i0 = 0; i0 < len0; i0++)
out.write_string(val.sa[i0]);
}
}
| 5,513 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct2Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct2:1.0
//
final public class TestStruct2Holder implements org.omg.CORBA.portable.Streamable
{
public TestStruct2 value;
public
TestStruct2Holder()
{
}
public
TestStruct2Holder(TestStruct2 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStruct2Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStruct2Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStruct2Helper.type();
}
}
| 5,514 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestFixed1Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestFixed1:1.0
//
final public class TestFixed1Helper
{
public static void
insert(org.omg.CORBA.Any any, java.math.BigDecimal val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static java.math.BigDecimal
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestFixed1", orb.create_fixed_tc((short)24, (short)0));
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestFixed1:1.0";
}
public static java.math.BigDecimal
read(org.omg.CORBA.portable.InputStream in)
{
java.math.BigDecimal _ob_v;
_ob_v = in.read_fixed().movePointLeft(0);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, java.math.BigDecimal val)
{
out.write_fixed(val.movePointRight(0));
}
}
| 5,515 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstEmptyString.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstEmptyString:1.0
//
/***/
public interface ConstEmptyString
{
String value = "";
}
| 5,516 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion3Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion3:1.0
//
final public class TestUnion3Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion3 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion3
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[5];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "c";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[0].label = orb.create_any();
members[0].label.insert_char('a');
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "c";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[1].label = orb.create_any();
members[1].label.insert_char('b');
members[2] = new org.omg.CORBA.UnionMember();
members[2].name = "a";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any);
members[2].label = orb.create_any();
members[2].label.insert_char('c');
members[3] = new org.omg.CORBA.UnionMember();
members[3].name = "ar";
members[3].type = orb.create_array_tc(10, orb.create_array_tc(20, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)));
members[3].label = orb.create_any();
members[3].label.insert_char('d');
members[4] = new org.omg.CORBA.UnionMember();
members[4].name = "s";
members[4].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[4].label = orb.create_any();
members[4].label.insert_char('x');
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
typeCode_ = orb.create_union_tc(id(), "TestUnion3", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestUnion3:1.0";
}
public static TestUnion3
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion3 _ob_v = new TestUnion3();
char _ob_d;
_ob_d = in.read_char();
switch(_ob_d)
{
case 'a':
case 'b':
{
char _ob_m;
_ob_m = in.read_char();
_ob_v.c(_ob_d, _ob_m);
break;
}
case 'c':
{
org.omg.CORBA.Any _ob_m;
_ob_m = in.read_any();
_ob_v.a(_ob_m);
break;
}
case 'd':
{
String[][] _ob_m;
int len0 = 10;
_ob_m = new String[len0][];
for(int i0 = 0; i0 < len0; i0++)
{
int len1 = 20;
_ob_m[i0] = new String[len1];
for(int i1 = 0; i1 < len1; i1++)
_ob_m[i0][i1] = in.read_string();
}
_ob_v.ar(_ob_m);
break;
}
case 'x':
{
String _ob_m;
_ob_m = in.read_string();
_ob_v.s(_ob_m);
break;
}
default:
_ob_v.__default(_ob_d);
break;
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion3 val)
{
char _ob_d = val.discriminator();
out.write_char(_ob_d);
switch(_ob_d)
{
case 'a':
case 'b':
{
char _ob_m = val.c();
out.write_char(_ob_m);
break;
}
case 'c':
{
org.omg.CORBA.Any _ob_m = val.a();
out.write_any(_ob_m);
break;
}
case 'd':
{
String[][] _ob_m = val.ar();
int len0 = _ob_m.length;
if(len0 != 10)
throw new org.omg.CORBA.MARSHAL();
for(int i0 = 0; i0 < len0; i0++)
{
int len1 = _ob_m[i0].length;
if(len1 != 20)
throw new org.omg.CORBA.MARSHAL();
for(int i1 = 0; i1 < len1; i1++)
out.write_string(_ob_m[i0][i1]);
}
break;
}
case 'x':
{
String _ob_m = val.s();
out.write_string(_ob_m);
break;
}
default:
break;
}
}
}
| 5,517 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct2.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct2:1.0
//
/***/
final public class TestStruct2 implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:TestStruct2:1.0";
public
TestStruct2()
{
}
public
TestStruct2(TestStruct1 s,
org.omg.CORBA.Any a,
double[][][] da,
String[] sa)
{
this.s = s;
this.a = a;
this.da = da;
this.sa = sa;
}
public TestStruct1 s;
public org.omg.CORBA.Any a;
public double[][][] da;
public String[] sa;
}
| 5,518 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConst.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
import static org.junit.Assert.assertTrue;
import java.math.*;
import org.omg.CORBA.*;
public class TestConst extends test.common.TestBase {
public TestConst() {
{
final Measurement constEnum = Measurement.FURLONGS;
assertTrue(constEnum == ConstEnum.value);
final int constLong = -1234;
assertTrue(constLong == ConstLong.value);
final long constLongLong = constLong * constLong;
assertTrue(constLongLong == ConstLongLong.value);
final long constLongLongMin = -9223372036854775807L - 1L;
assertTrue(constLongLongMin == ConstLongLongMin.value);
final long constLongLongMax = 9223372036854775807L;
assertTrue(constLongLongMax == ConstLongLongMax.value);
final int constULong = (5432 + constLong) * 100 % 124;
assertTrue(constULong == ConstULong.value);
final long constULongLong = constULong + (constULong << 20);
assertTrue(constULongLong == ConstULongLong.value);
//
// 18446744073709551615 is represented as -1
//
final long constULongLongMax = -1L;
assertTrue(constULongLongMax == ConstULongLongMax.value);
final double constDouble = 50.23 - 1532.718 * 0.029;
assertTrue(constDouble == ConstDouble.value);
final float constFloat = (float) (constDouble * 1.11);
assertTrue(constFloat == ConstFloat.value);
final short constShort = (short) (-23 % 10);
assertTrue(constShort == ConstShort.value);
final boolean constBoolean = true;
assertTrue(constBoolean == ConstBoolean.value);
final byte constOctet = (byte) 254;
assertTrue(constOctet == ConstOctet.value);
final BigDecimal constFixed = new BigDecimal("275.189").multiply(
new BigDecimal("1.163")).add(new BigDecimal("48.0093"));
assertTrue(constFixed.equals(ConstFixed.value));
final String constString = "This is ConstString";
assertTrue(constString.equals(ConstString.value));
final String constEmptyString = "";
assertTrue(constEmptyString.equals(ConstEmptyString.value));
final String constWString = "This is ConstWString";
assertTrue(constWString.equals(ConstWString.value));
final String constEmptyWString = "";
assertTrue(constEmptyWString.equals(ConstEmptyWString.value));
}
{
final int constLong = 12345678;
assertTrue(constLong == test.types.TestConstModule.ConstLong.value);
final double constDouble = ConstDouble.value / 2.0;
assertTrue(constDouble == test.types.TestConstModule.ConstDouble.value);
final boolean constBoolean = false;
assertTrue(constBoolean == test.types.TestConstModule.ConstBoolean.value);
final String constString = "This is ConstString in a module";
assertTrue(constString
.equals(test.types.TestConstModule.ConstString.value));
final String constWString = "This is ConstWString in a module";
assertTrue(constWString
.equals(test.types.TestConstModule.ConstWString.value));
final Measurement constEnum = Measurement.METERS;
assertTrue(constEnum == test.types.TestConstModule.ConstEnum.value);
}
{
final int constLong = (0xf | 0xf000) & 0xfffe;
assertTrue(constLong == TestConstInterface.ConstLong);
final int constULong = (int) 0xFFFFFFFF;
assertTrue(constULong == TestConstInterface.ConstULong);
final char constChar0 = (char) 0;
assertTrue(constChar0 == TestConstInterface.ConstChar0);
final char constChar1 = 'c';
assertTrue(constChar1 == TestConstInterface.ConstChar1);
final char constChar2 = '\n';
assertTrue(constChar2 == TestConstInterface.ConstChar2);
final char constChar3 = '\377';
assertTrue(constChar3 == TestConstInterface.ConstChar3);
final char constChar4 = '\210';
assertTrue(constChar4 == TestConstInterface.ConstChar4);
final char constChar5 = '\'';
assertTrue(constChar5 == TestConstInterface.ConstChar5);
final char constWChar = 'Z';
assertTrue(constWChar == TestConstInterface.ConstWChar);
final String constString = "\n\t\013\b\r\f\007\\?\'\"\377\377\007";
assertTrue(constString.equals(TestConstInterface.ConstString));
final String constWString = "\n\t\013\b\r\f\007\\?\'\"\377\377\007";
assertTrue(constWString.equals(TestConstInterface.ConstWString));
}
}
public static void main(String args[]) {
int status = 0;
try {
//
// Run tests
//
System.out.print("Testing constants... ");
System.out.flush();
new TestConst();
System.out.println("Done!");
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
System.exit(status);
}
}
| 5,519 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstEmptyWString.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstEmptyWString:1.0
//
/***/
public interface ConstEmptyWString
{
String value = "";
}
| 5,520 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/Measurement.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:Measurement:1.0
//
/***/
public class Measurement implements org.omg.CORBA.portable.IDLEntity
{
private static Measurement [] values_ = new Measurement[3];
private int value_;
public final static int _FEET = 0;
public final static Measurement FEET = new Measurement(_FEET);
public final static int _METERS = 1;
public final static Measurement METERS = new Measurement(_METERS);
public final static int _FURLONGS = 2;
public final static Measurement FURLONGS = new Measurement(_FURLONGS);
protected
Measurement(int value)
{
values_[value] = this;
value_ = value;
}
public int
value()
{
return value_;
}
public static Measurement
from_int(int value)
{
if(value < values_.length)
return values_[value];
else
throw new org.omg.CORBA.BAD_PARAM("Value (" + value + ") out of range", 25, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private java.lang.Object
readResolve()
throws java.io.ObjectStreamException
{
return from_int(value());
}
}
| 5,521 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct3.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct3:1.0
//
/***/
final public class TestStruct3 implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:TestStruct3:1.0";
public
TestStruct3()
{
}
public
TestStruct3(int l,
TestStruct3[] seq)
{
this.l = l;
this.seq = seq;
}
public int l;
public TestStruct3[] seq;
}
| 5,522 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstULongLong.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstULongLong:1.0
//
/***/
public interface ConstULongLong
{
long value = 62914620L;
}
| 5,523 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstFloat.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstFloat:1.0
//
/***/
public interface ConstFloat
{
float value = (float)(6.41710758209228515625D);
}
| 5,524 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestTypeCode.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
import static org.junit.Assert.assertTrue;
import org.omg.CORBA.*;
public class TestTypeCode extends test.common.TestBase {
private static final boolean CHECK_IDL_NAMES = false;
public TestTypeCode(ORB orb) {
//
// Test CompletionStatus
//
// Note: In JDK 1.3, the repository ID of CompletionStatus
// is IDL:omg.org/CORBA/CompletionStatus:1.0 (which is
// incorrect)
//
try {
TCKind kind = CompletionStatusHelper.type().kind();
assertTrue(kind == TCKind.tk_enum);
String name = CompletionStatusHelper.type().name();
assertTrue(name.equals("completion_status")
|| name.equals("CompletionStatus"));
String id = CompletionStatusHelper.type().id();
assertTrue(id.equals("IDL:omg.org/CORBA/completion_status:1.0")
|| id.equals("IDL:omg.org/CORBA/CompletionStatus:1.0"));
int count = CompletionStatusHelper.type().member_count();
assertTrue(count == 3);
String name0 = CompletionStatusHelper.type().member_name(0);
assertTrue(name0.equals("COMPLETED_YES"));
String name1 = CompletionStatusHelper.type().member_name(1);
assertTrue(name1.equals("COMPLETED_NO"));
String name2 = CompletionStatusHelper.type().member_name(2);
assertTrue(name2.equals("COMPLETED_MAYBE"));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TypeCode type = org.omg.CORBA.TypeCodePackage.BoundsHelper.type();
TCKind kind = type.kind();
assertTrue(kind == TCKind.tk_except);
String name = type.name();
assertTrue(name.equals("Bounds"));
String id = type.id();
assertTrue(id.equals("IDL:omg.org/CORBA/TypeCode/Bounds:1.0"));
int count = type.member_count();
assertTrue(count == 0);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
}
try {
TypeCode type = org.omg.CORBA.TypeCodePackage.BadKindHelper.type();
TCKind kind = type.kind();
assertTrue(kind == TCKind.tk_except);
String name = type.name();
assertTrue(name.equals("BadKind"));
String id = type.id();
assertTrue(id.equals("IDL:omg.org/CORBA/TypeCode/BadKind:1.0"));
int count = type.member_count();
assertTrue(count == 0);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
}
try {
TCKind kind = TestStruct1Helper.type().kind();
assertTrue(kind == TCKind.tk_struct);
String name = TestStruct1Helper.type().name();
assertTrue(name.equals("TestStruct1"));
long count = TestStruct1Helper.type().member_count();
assertTrue(count == 7);
String name0 = TestStruct1Helper.type().member_name(0);
assertTrue(name0.equals("s"));
String name1 = TestStruct1Helper.type().member_name(1);
assertTrue(name1.equals("l"));
String name2 = TestStruct1Helper.type().member_name(2);
assertTrue(name2.equals("d"));
String name3 = TestStruct1Helper.type().member_name(3);
assertTrue(name3.equals("b"));
String name4 = TestStruct1Helper.type().member_name(4);
assertTrue(name4.equals("c"));
String name5 = TestStruct1Helper.type().member_name(5);
assertTrue(name5.equals("o"));
String name6 = TestStruct1Helper.type().member_name(6);
assertTrue(name6.equals("str"));
TypeCode type0 = TestStruct1Helper.type().member_type(0);
assertTrue(type0.equal(orb.get_primitive_tc(TCKind.tk_short)));
TypeCode type1 = TestStruct1Helper.type().member_type(1);
assertTrue(type1.equal(orb.get_primitive_tc(TCKind.tk_long)));
TypeCode type2 = TestStruct1Helper.type().member_type(2);
assertTrue(type2.equal(orb.get_primitive_tc(TCKind.tk_double)));
TypeCode type3 = TestStruct1Helper.type().member_type(3);
assertTrue(type3.equal(orb.get_primitive_tc(TCKind.tk_boolean)));
TypeCode type4 = TestStruct1Helper.type().member_type(4);
assertTrue(type4.equal(orb.get_primitive_tc(TCKind.tk_char)));
TypeCode type5 = TestStruct1Helper.type().member_type(5);
assertTrue(type5.equal(orb.get_primitive_tc(TCKind.tk_octet)));
TypeCode type6 = TestStruct1Helper.type().member_type(6);
assertTrue(type6.equal(orb.get_primitive_tc(TCKind.tk_string)));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TCKind kind = TestStruct2Helper.type().kind();
assertTrue(kind == TCKind.tk_struct);
String name = TestStruct2Helper.type().name();
assertTrue(name.equals("TestStruct2"));
long count = TestStruct2Helper.type().member_count();
assertTrue(count == 4);
String name0 = TestStruct2Helper.type().member_name(0);
assertTrue(name0.equals("s"));
TypeCode type0 = TestStruct2Helper.type().member_type(0);
assertTrue(type0.equal(TestStruct1Helper.type()));
String name1 = TestStruct2Helper.type().member_name(1);
assertTrue(name1.equals("a"));
TypeCode type1 = TestStruct2Helper.type().member_type(1);
assertTrue(type1.equal(orb.get_primitive_tc(TCKind.tk_any)));
String name2 = TestStruct2Helper.type().member_name(2);
assertTrue(name2.equals("da"));
TypeCode type2 = TestStruct2Helper.type().member_type(2);
assertTrue(type2.equal(DoubleArrayHelper.type()));
String name3 = TestStruct2Helper.type().member_name(3);
assertTrue(name3.equals("sa"));
TypeCode type3 = TestStruct2Helper.type().member_type(3);
assertTrue(type3.equal(orb.create_array_tc(100, orb
.get_primitive_tc(TCKind.tk_string))));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TCKind kind = TestStruct3Helper.type().kind();
assertTrue(kind == TCKind.tk_struct);
String name = TestStruct3Helper.type().name();
assertTrue(name.equals("TestStruct3"));
int count = TestStruct3Helper.type().member_count();
assertTrue(count == 2);
String name0 = TestStruct3Helper.type().member_name(0);
assertTrue(name0.equals("l"));
TypeCode type0 = TestStruct3Helper.type().member_type(0);
assertTrue(type0.equal(orb.get_primitive_tc(TCKind.tk_long)));
String name1 = TestStruct3Helper.type().member_name(1);
assertTrue(name1.equals("seq"));
TypeCode type1 = TestStruct3Helper.type().member_type(1);
TypeCode contentType = type1.content_type();
assertTrue(contentType.equal(TestStruct3Helper.type()));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TCKind kind = TestStruct4Helper.type().kind();
assertTrue(kind == TCKind.tk_struct);
String name = TestStruct4Helper.type().name();
assertTrue(name.equals("TestStruct4"));
int count = TestStruct4Helper.type().member_count();
assertTrue(count == 2);
String name0 = TestStruct4Helper.type().member_name(0);
assertTrue(name0.equals("a"));
TypeCode type0 = TestStruct4Helper.type().member_type(0);
assertTrue(type0.equal(TestStruct3Helper.type()));
String name1 = TestStruct4Helper.type().member_name(1);
assertTrue(name1.equals("b"));
TypeCode type1 = TestStruct4Helper.type().member_type(1);
TypeCode contentType = type1.content_type();
assertTrue(contentType.equal(TestStruct3Helper.type()));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TCKind kind = TestUnion4Helper.type().kind();
assertTrue(kind == TCKind.tk_union);
String name = TestUnion4Helper.type().name();
assertTrue(name.equals("TestUnion4"));
int count = TestUnion4Helper.type().member_count();
assertTrue(count == 2);
String name0 = TestUnion4Helper.type().member_name(0);
assertTrue(name0.equals("seq"));
TypeCode type0 = TestUnion4Helper.type().member_type(0);
TypeCode contentType = type0.content_type();
assertTrue(contentType.equal(TestUnion4Helper.type()));
String name1 = TestUnion4Helper.type().member_name(1);
assertTrue(name1.equals("c"));
TypeCode type1 = TestUnion4Helper.type().member_type(1);
assertTrue(type1.equal(orb.get_primitive_tc(TCKind.tk_char)));
Any label = TestUnion4Helper.type().member_label(1);
TypeCode labelType = label.type();
assertTrue(labelType.equal(org.apache.yoko.orb.OB.TypeCodeFactory
.createPrimitiveTC(org.omg.CORBA_2_4.TCKind
.from_int(org.omg.CORBA.TCKind._tk_short))));
short labelValue = label.extract_short();
assertTrue(labelValue == 1);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
Any label = TestUnion1Helper.type().member_label(
TestUnion1Helper.type().default_index());
byte defaultValue = label.extract_octet();
assertTrue(defaultValue == 0);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
Any label = TestUnion2Helper.type().member_label(0);
TestEnum enumValue = TestEnumHelper.extract(label);
assertTrue(enumValue.value() == TestEnum._A);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
assertTrue(false);
}
try {
TypeCode p;
p = RepositoryIdHelper.type();
assertTrue(p.name().equals("RepositoryId"));
p = ScopedNameHelper.type();
assertTrue(p.name().equals("ScopedName"));
p = IdentifierHelper.type();
assertTrue(p.name().equals("Identifier"));
p = DefinitionKindHelper.type();
assertTrue(p.name().equals("DefinitionKind"));
p = IRObjectHelper.type();
assertTrue(p.name().equals("IRObject"));
p = VersionSpecHelper.type();
assertTrue(p.name().equals("VersionSpec"));
p = ContainedHelper.type();
assertTrue(p.name().equals("Contained"));
p = org.omg.CORBA.ContainedPackage.DescriptionHelper.type();
assertTrue(p.name().equals("Description"));
p = InterfaceDefSeqHelper.type();
assertTrue(p.name().equals("InterfaceDefSeq"));
p = ContainedSeqHelper.type();
assertTrue(p.name().equals("ContainedSeq"));
p = StructMemberHelper.type();
assertTrue(p.name().equals("StructMember"));
p = StructMemberSeqHelper.type();
assertTrue(p.name().equals("StructMemberSeq"));
p = UnionMemberHelper.type();
assertTrue(p.name().equals("UnionMember"));
p = UnionMemberSeqHelper.type();
assertTrue(p.name().equals("UnionMemberSeq"));
p = EnumMemberSeqHelper.type();
assertTrue(p.name().equals("EnumMemberSeq"));
p = ContainerHelper.type();
assertTrue(p.name().equals("Container"));
p = org.omg.CORBA.ContainerPackage.DescriptionHelper.type();
assertTrue(p.name().equals("Description"));
p = org.omg.CORBA.ContainerPackage.DescriptionSeqHelper.type();
assertTrue(p.name().equals("DescriptionSeq"));
p = IDLTypeHelper.type();
assertTrue(p.name().equals("IDLType"));
p = PrimitiveKindHelper.type();
assertTrue(p.name().equals("PrimitiveKind"));
p = RepositoryHelper.type();
assertTrue(p.name().equals("Repository"));
p = ModuleDefHelper.type();
assertTrue(p.name().equals("ModuleDef"));
p = ModuleDescriptionHelper.type();
assertTrue(p.name().equals("ModuleDescription"));
p = ConstantDefHelper.type();
assertTrue(p.name().equals("ConstantDef"));
p = ConstantDescriptionHelper.type();
assertTrue(p.name().equals("ConstantDescription"));
p = TypedefDefHelper.type();
assertTrue(p.name().equals("TypedefDef"));
p = TypeDescriptionHelper.type();
assertTrue(p.name().equals("TypeDescription"));
p = StructDefHelper.type();
assertTrue(p.name().equals("StructDef"));
p = UnionDefHelper.type();
assertTrue(p.name().equals("UnionDef"));
p = EnumDefHelper.type();
assertTrue(p.name().equals("EnumDef"));
p = AliasDefHelper.type();
assertTrue(p.name().equals("AliasDef"));
p = PrimitiveDefHelper.type();
assertTrue(p.name().equals("PrimitiveDef"));
p = StringDefHelper.type();
assertTrue(p.name().equals("StringDef"));
p = SequenceDefHelper.type();
assertTrue(p.name().equals("SequenceDef"));
p = ArrayDefHelper.type();
assertTrue(p.name().equals("ArrayDef"));
p = ExceptionDefHelper.type();
assertTrue(p.name().equals("ExceptionDef"));
p = ExceptionDescriptionHelper.type();
assertTrue(p.name().equals("ExceptionDescription"));
p = AttributeModeHelper.type();
assertTrue(p.name().equals("AttributeMode"));
p = AttributeDefHelper.type();
assertTrue(p.name().equals("AttributeDef"));
p = AttributeDescriptionHelper.type();
assertTrue(p.name().equals("AttributeDescription"));
p = OperationModeHelper.type();
assertTrue(p.name().equals("OperationMode"));
p = ParameterModeHelper.type();
assertTrue(p.name().equals("ParameterMode"));
p = ParameterDescriptionHelper.type();
assertTrue(p.name().equals("ParameterDescription"));
p = ParDescriptionSeqHelper.type();
assertTrue(p.name().equals("ParDescriptionSeq"));
p = ContextIdentifierHelper.type();
assertTrue(p.name().equals("ContextIdentifier"));
p = ContextIdSeqHelper.type();
assertTrue(p.name().equals("ContextIdSeq"));
p = ExceptionDefSeqHelper.type();
assertTrue(p.name().equals("ExceptionDefSeq"));
p = ExcDescriptionSeqHelper.type();
assertTrue(p.name().equals("ExcDescriptionSeq"));
p = OperationDefHelper.type();
assertTrue(p.name().equals("OperationDef"));
p = OperationDescriptionHelper.type();
assertTrue(p.name().equals("OperationDescription"));
p = RepositoryIdSeqHelper.type();
assertTrue(p.name().equals("RepositoryIdSeq"));
p = OpDescriptionSeqHelper.type();
assertTrue(p.name().equals("OpDescriptionSeq"));
p = AttrDescriptionSeqHelper.type();
assertTrue(p.name().equals("AttrDescriptionSeq"));
p = InterfaceDefHelper.type();
assertTrue(p.name().equals("InterfaceDef"));
p = org.omg.CORBA.InterfaceDefPackage.FullInterfaceDescriptionHelper
.type();
assertTrue(p.name().equals("FullInterfaceDescription"));
p = InterfaceDescriptionHelper.type();
assertTrue(p.name().equals("InterfaceDescription"));
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
}
//
// Check repository ID
//
{
String[] bogusIds = { "foo", ":foo", "foo:" };
for (int i = 0; i < bogusIds.length; i++) {
try {
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[1];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "a";
members[0].type = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_struct_tc(bogusIds[i], "foo", members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[1];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = tcShort;
orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
members[0].label = orb.create_any();
members[0].label.insert_short((short) 1);
orb.create_union_tc(bogusIds[i], "foo", tcShort, members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_alias_tc(bogusIds[i], "foo", tcShort);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[1];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "a";
members[0].type = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_exception_tc(bogusIds[i], "foo", members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_interface_tc(bogusIds[i], "foo");
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[0];
orb.create_value_tc(bogusIds[i], "foo",
org.omg.CORBA.VM_NONE.value, null, members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_value_box_tc(bogusIds[i], "foo", tcShort);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_native_tc(bogusIds[i], "foo");
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_abstract_interface_tc(bogusIds[i], "foo");
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
((org.omg.CORBA_2_4.ORB) orb).create_local_interface_tc(
bogusIds[i], "foo");
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
}
}
//
// Check IDL name
//
if (CHECK_IDL_NAMES) {
String[] bogusNames = { "_foo", "1foo", "f.oo" };
for (int i = 0; i < bogusNames.length; i++) {
try {
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[1];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "a";
members[0].type = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_struct_tc("IDL:foo:1.0", bogusNames[i], members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[1];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = tcShort;
orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
members[0].label = orb.create_any();
members[0].label.insert_short((short) 1);
orb.create_union_tc("IDL:foo:1.0", bogusNames[i], tcShort,
members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_alias_tc("IDL:foo:1.0", bogusNames[i], tcShort);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[1];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "a";
members[0].type = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_exception_tc("IDL:foo:1.0", bogusNames[i],
members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_interface_tc("IDL:foo:1.0", bogusNames[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[0];
orb.create_value_tc("IDL:foo:1.0", bogusNames[i],
org.omg.CORBA.VM_NONE.value, null, members);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.TypeCode tcShort = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_value_box_tc("IDL:foo:1.0", bogusNames[i],
tcShort);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_native_tc("IDL:foo:1.0", bogusNames[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
orb.create_abstract_interface_tc("IDL:foo:1.0",
bogusNames[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
((org.omg.CORBA_2_4.ORB) orb).create_local_interface_tc(
"IDL:foo:1.0", bogusNames[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
}
}
//
// Check illegal TypeCodes
//
{
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[0];
org.omg.CORBA.TypeCode exTC = orb.create_exception_tc("IDL:ex:1.0",
"ex", members);
org.omg.CORBA.TypeCode[] types = new org.omg.CORBA.TypeCode[3];
types[0] = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_null);
types[1] = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_void);
types[2] = exTC;
for (int i = 0; i < types.length; i++) {
try {
org.omg.CORBA.StructMember[] seq = new org.omg.CORBA.StructMember[1];
seq[0] = new org.omg.CORBA.StructMember();
seq[0].name = "v";
seq[0].type = types[i];
orb.create_struct_tc("IDL:foo:1.0", "foo", seq);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
org.omg.CORBA.UnionMember[] seq = new org.omg.CORBA.UnionMember[1];
seq[0] = new org.omg.CORBA.UnionMember();
seq[0].name = "v";
seq[0].type = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
seq[0].label = orb.create_any();
seq[0].label.insert_short((short) 1);
orb.create_union_tc("IDL:foo:1.0", "foo", types[i], seq);
assertTrue(false);
} catch (org.omg.CORBA.BAD_PARAM ex) {
// Expected
}
try {
org.omg.CORBA.UnionMember[] seq = new org.omg.CORBA.UnionMember[1];
seq[0] = new org.omg.CORBA.UnionMember();
seq[0].name = "v";
seq[0].type = types[i];
seq[0].label = orb.create_any();
seq[0].label.insert_short((short) 1);
org.omg.CORBA.TypeCode disc = orb
.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
orb.create_union_tc("IDL:foo:1.0", "foo", disc, seq);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
orb.create_alias_tc("IDL:foo:1.0", "foo", types[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
org.omg.CORBA.StructMember[] seq = new org.omg.CORBA.StructMember[1];
seq[0] = new org.omg.CORBA.StructMember();
seq[0].name = "v";
seq[0].type = types[i];
orb.create_exception_tc("IDL:foo:1.0", "foo", seq);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
orb.create_sequence_tc(0, types[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
orb.create_array_tc(1, types[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
org.omg.CORBA.ValueMember[] seq = new org.omg.CORBA.ValueMember[1];
seq[0] = new org.omg.CORBA.ValueMember();
seq[0].name = "v";
seq[0].type = types[i];
seq[0].access = org.omg.CORBA.PUBLIC_MEMBER.value;
orb.create_value_tc("IDL:foo:1.0", "foo",
org.omg.CORBA.VM_NONE.value, null, seq);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
try {
orb.create_value_box_tc("IDL:foo:1.0", "foo", types[i]);
assertTrue(false);
} catch (org.omg.CORBA.BAD_TYPECODE ex) {
// Expected
}
}
}
}
public static void main(String args[]) {
java.util.Properties props = System.getProperties();
props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
props.put("org.omg.CORBA.ORBSingletonClass",
"org.apache.yoko.orb.CORBA.ORBSingleton");
int status = 0;
org.omg.CORBA.ORB orb = null;
try {
//
// Create ORB
//
orb = org.omg.CORBA.ORB.init(args, props);
//
// Run tests
//
System.out.print("Testing TypeCode type... ");
System.out.flush();
new TestTypeCode(orb);
System.out.println("Done!");
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,525 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestDynAny.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
import static org.junit.Assert.assertTrue;
import java.math.*;
import java.util.Properties;
import org.omg.CORBA.Any;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.ORB;
import org.omg.DynamicAny.*;
import test.types.DynAnyTypes.*;
public class TestDynAny extends test.common.TestBase {
//
// TestStructBox factory implementation - not needed in Java
//
//
// TestStringBox factory implementation - not needed in Java
//
//
// TestValue1 implementation
//
static class TestValue1_impl extends TestValue1 {
}
static class TestValue1Factory_impl implements
org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value(
org.omg.CORBA_2_3.portable.InputStream in) {
return new TestValue1_impl();
}
}
//
// TestValue2 implementation
//
static class TestValue2_impl extends TestValue2 {
}
static class TestValue2Factory_impl implements
org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value(
org.omg.CORBA_2_3.portable.InputStream in) {
TestValue2_impl result = new TestValue2_impl();
result._read(in);
return result;
}
}
//
// TestValue3 implementation
//
static class TestValue3_impl extends TestValue3 {
}
static class TestValue3Factory_impl implements
org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value(
org.omg.CORBA_2_3.portable.InputStream in) {
TestValue3_impl result = new TestValue3_impl();
result._read(in);
return result;
}
}
//
// TestValue4 implementation
//
static class TestValue4_impl extends TestValue4 {
}
static class TestValue4Factory_impl implements
org.omg.CORBA.portable.ValueFactory {
public java.io.Serializable read_value(
org.omg.CORBA_2_3.portable.InputStream in) {
TestValue4_impl result = new TestValue4_impl();
result._read(in);
return result;
}
}
//
// Test generic operations
//
static void testOps(ORB orb, DynAnyFactory factory, TypeCode tc,
boolean hasComponents) {
try {
Any badAny = orb.create_any();
DynAny d1 = null, d2 = null, d3 = null, copy = null;
TypeCode origTC = getOrigType(tc);
//
// Create an any having a TypeCode that will not match tc
//
if (tc.kind() != TCKind.tk_short)
badAny.insert_short((short) 0);
else
badAny.insert_ushort((short) 0);
//
// Test: type()
//
d1 = factory.create_dyn_any_from_type_code(tc);
TypeCode tcv = d1.type();
assertTrue(tc.equal(tcv));
d1.destroy();
//
// Test: assign() TypeMismatch exception
//
try {
d1 = factory.create_dyn_any_from_type_code(tc);
d2 = factory.create_dyn_any(badAny);
d1.assign(d2);
assertTrue("assign() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d1.destroy();
d2.destroy();
}
//
// Test: from_any() TypeMismatch exception
//
try {
d1 = factory.create_dyn_any_from_type_code(tc);
d1.from_any(badAny);
assertTrue("from_any() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d1.destroy();
}
//
// Test: from_any() InvalidValue exception
//
switch (origTC.kind().value()) {
case TCKind._tk_null:
case TCKind._tk_void:
case TCKind._tk_TypeCode:
case TCKind._tk_Principal:
case TCKind._tk_objref:
case TCKind._tk_value:
case TCKind._tk_value_box:
// nothing to do
break;
default:
try {
Any a = orb.create_any();
a.type(tc);
d1 = factory.create_dyn_any_from_type_code(tc);
d1.from_any(a);
assertTrue("from_any() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
}
if (hasComponents) {
int count;
d1 = factory.create_dyn_any_from_type_code(tc);
if (origTC.kind() == TCKind.tk_union)
count = d1.component_count();
else
count = origTC.member_count();
assertTrue(count > 0);
//
// Test: seek
//
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: component_count()
//
assertTrue(d1.component_count() == count);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d3 = d1.current_component();
assertTrue(d3 == null);
d1.destroy();
} else {
d1 = factory.create_dyn_any_from_type_code(tc);
//
// Test: seek
//
assertTrue(d1.seek(0) == false);
assertTrue(d1.seek(-1) == false);
//
// Test: next
//
assertTrue(d1.next() == false);
//
// Test: component_count()
//
assertTrue(d1.component_count() == 0);
//
// Test: current_component TypeMismatch exception
//
try {
d1.current_component();
assertTrue("current_component() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
d1.destroy();
}
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
} catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
assertTrue(false);
}
}
static void testBasic(ORB orb, DynAnyFactory factory) {
try {
org.omg.CORBA.Object obj;
Any any = orb.create_any();
Any av;
DynAny d1 = null, d2 = null, copy = null;
TypeCode type, tc;
//
// Test: short
//
type = orb.get_primitive_tc(TCKind.tk_short);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_short() == (short) 0);
d1.insert_short((short) -53);
assertTrue(d1.get_short() == (short) -53);
d1.insert_short((short) 32000);
assertTrue(d1.get_short() == (short) 32000);
av = d1.to_any();
short shortVal = av.extract_short();
assertTrue(shortVal == (short) 32000);
any.insert_short((short) 32000);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_short() == (short) 32000);
any.insert_short((short) -99);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: unsigned short
//
type = orb.get_primitive_tc(TCKind.tk_ushort);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_ushort() == (short) 0);
d1.insert_ushort((short) 199);
assertTrue(d1.get_ushort() == (short) 199);
d1.insert_ushort((short) 65001);
assertTrue(d1.get_ushort() == (short) 65001);
av = d1.to_any();
short ushortVal = av.extract_ushort();
assertTrue(ushortVal == (short) 65001);
any.insert_ushort((short) 65001);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_ushort() == (short) 65001);
any.insert_ushort((short) 501);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: long
//
type = orb.get_primitive_tc(TCKind.tk_long);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_long() == 0);
d1.insert_long(-530000);
assertTrue(d1.get_long() == -530000);
d1.insert_long(3200000);
assertTrue(d1.get_long() == 3200000);
av = d1.to_any();
int longVal = av.extract_long();
assertTrue(longVal == 3200000);
any.insert_long(3200000);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_long() == 3200000);
any.insert_long(-99000);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: unsigned long
//
type = orb.get_primitive_tc(TCKind.tk_ulong);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_ulong() == 0);
d1.insert_ulong(199000);
assertTrue(d1.get_ulong() == 199000);
d1.insert_ulong(65001000);
assertTrue(d1.get_ulong() == 65001000);
av = d1.to_any();
int ulongVal = av.extract_ulong();
assertTrue(ulongVal == 65001000);
any.insert_ulong(65001000);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_ulong() == 65001000);
any.insert_ulong(501000);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: float
//
type = orb.get_primitive_tc(TCKind.tk_float);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_float() == 0.0f);
d1.insert_float(199.001f);
assertTrue(d1.get_float() > 199.0f && d1.get_float() < 199.1f);
d1.insert_float(6500.10001f);
assertTrue(d1.get_float() > 6500.0f && d1.get_float() < 6501.0f);
av = d1.to_any();
float floatVal = av.extract_float();
assertTrue(floatVal > 6500.1 && floatVal < 6500.2);
any.insert_float((float) 6500.10001);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_float() > 6500.1 && copy.get_float() < 6500.2);
any.insert_float((float) 501.001);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: double
//
type = orb.get_primitive_tc(TCKind.tk_double);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_double() == 0.0);
d1.insert_double(199000.001);
assertTrue(d1.get_double() > 199000.0 && d1.get_double() < 199000.1);
d1.insert_double(6500000.10001);
assertTrue(d1.get_double() > 6500000.1 && d1.get_double() < 6500000.2);
av = d1.to_any();
double doubleVal = av.extract_double();
assertTrue(doubleVal > 6500000.1 && doubleVal < 6500000.2);
any.insert_double(6500000.10001);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_double() > 6500000.1 && copy.get_double() < 6500000.2);
any.insert_double(501000.001);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: boolean
//
type = orb.get_primitive_tc(TCKind.tk_boolean);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_boolean() == false);
d1.insert_boolean(false);
assertTrue(d1.get_boolean() == false);
d1.insert_boolean(true);
assertTrue(d1.get_boolean() == true);
av = d1.to_any();
boolean boolVal = av.extract_boolean();
assertTrue(boolVal == true);
any.insert_boolean(true);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_boolean() == true);
any.insert_boolean(false);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: char
//
type = orb.get_primitive_tc(TCKind.tk_char);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_char() == 0);
d1.insert_char('A');
assertTrue(d1.get_char() == 'A');
d1.insert_char('z');
assertTrue(d1.get_char() == 'z');
av = d1.to_any();
char charVal = av.extract_char();
assertTrue(charVal == 'z');
any.insert_char('z');
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_char() == 'z');
any.insert_char('@');
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: octet
//
type = orb.get_primitive_tc(TCKind.tk_octet);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_octet() == 0);
d1.insert_octet((byte) 255);
assertTrue(d1.get_octet() == (byte) 255);
d1.insert_octet((byte) 1);
assertTrue(d1.get_octet() == (byte) 1);
av = d1.to_any();
byte octetVal = av.extract_octet();
assertTrue(octetVal == (byte) 1);
any.insert_octet((byte) 1);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_octet() == (byte) 1);
any.insert_octet((byte) 127);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: any
//
type = orb.get_primitive_tc(TCKind.tk_any);
d1 = factory.create_dyn_any_from_type_code(type);
any.insert_long(345678);
d1.insert_any(any);
av = d1.get_any();
longVal = av.extract_long();
assertTrue(longVal == 345678);
Any anyVal = orb.create_any();
anyVal.insert_long(345678);
any.insert_any(anyVal);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
av = d1.to_any();
Any cap = av.extract_any();
longVal = cap.extract_long();
assertTrue(longVal == 345678);
anyVal.insert_string("anyValue");
any.insert_any(anyVal);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: TypeCode
//
TypeCode tcVal;
type = orb.get_primitive_tc(TCKind.tk_TypeCode);
d1 = factory.create_dyn_any_from_type_code(type);
tcVal = d1.get_typecode();
TypeCode tcNull = orb.get_primitive_tc(TCKind.tk_null);
assertTrue(tcVal.equal(tcNull));
TypeCode tcFloat = orb.get_primitive_tc(TCKind.tk_float);
d1.insert_typecode(tcFloat);
tcVal = d1.get_typecode();
assertTrue(tcVal.equal(tcFloat));
av = d1.to_any();
tcVal = av.extract_TypeCode();
assertTrue(tcVal.equal(tcFloat));
any.insert_TypeCode(tcFloat);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
tcVal = copy.get_typecode();
assertTrue(tcVal.equal(tcFloat));
TypeCode tcDouble = orb.get_primitive_tc(TCKind.tk_double);
any.insert_TypeCode(tcDouble);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: objref
//
type = orb.get_primitive_tc(TCKind.tk_objref);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_reference() == null);
org.omg.CORBA.Object objVal1, objVal2;
objVal1 = orb.string_to_object("corbaloc::localhost:9999/SomeKey");
d1.insert_reference(objVal1);
objVal2 = d1.get_reference();
assertTrue(objVal1._is_equivalent(objVal2));
av = d1.to_any();
objVal2 = av.extract_Object();
assertTrue(objVal1._is_equivalent(objVal2));
copy = d1.copy();
assertTrue(d1.equal(copy));
d2 = factory.create_dyn_any_from_type_code(type);
any.insert_Object(objVal2);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.insert_reference(null);
objVal1 = d1.get_reference();
assertTrue(objVal1 == null);
d2.assign(d1);
assertTrue(d1.equal(d2));
copy.destroy();
copy = d1.copy();
assertTrue(d1.equal(copy));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: string (unbounded)
//
type = orb.create_string_tc(0);
String stringVal;
d1 = factory.create_dyn_any_from_type_code(type);
stringVal = d1.get_string();
assertTrue(stringVal.length() == 0);
d1.insert_string("polymorph");
stringVal = d1.get_string();
assertTrue(stringVal.equals("polymorph"));
av = d1.to_any();
String ccp = av.extract_string();
assertTrue(ccp.equals("polymorph"));
any.insert_string("polymorph");
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
stringVal = copy.get_string();
assertTrue(stringVal.equals("polymorph"));
any.insert_string("cloister");
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: longlong
//
long ll1 = -530000999L, ll2 = 3200000999L, ll3 = -99000999L;
type = orb.get_primitive_tc(TCKind.tk_longlong);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_longlong() == 0);
d1.insert_longlong(ll1);
assertTrue(d1.get_longlong() == ll1);
d1.insert_longlong(ll2);
assertTrue(d1.get_longlong() == ll2);
av = d1.to_any();
long longlongVal = av.extract_longlong();
assertTrue(longlongVal == ll2);
any.insert_longlong(ll2);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_longlong() == ll2);
any.insert_longlong(ll3);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: unsigned longlong
//
long ul1 = 199000999L, ul2 = 65001000999L, ul3 = 501000999L;
type = orb.get_primitive_tc(TCKind.tk_ulonglong);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_ulonglong() == 0);
d1.insert_ulonglong(ul1);
assertTrue(d1.get_ulonglong() == ul1);
d1.insert_ulonglong(ul2);
assertTrue(d1.get_ulonglong() == ul2);
av = d1.to_any();
long ulonglongVal = av.extract_ulonglong();
assertTrue(ulonglongVal == ul2);
any.insert_ulonglong(ul2);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_ulonglong() == ul2);
any.insert_ulonglong(ul3);
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: wchar
//
type = orb.get_primitive_tc(TCKind.tk_wchar);
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.get_wchar() == 0);
d1.insert_wchar('A');
assertTrue(d1.get_wchar() == 'A');
d1.insert_wchar('z');
assertTrue(d1.get_wchar() == 'z');
av = d1.to_any();
char wcharVal = av.extract_wchar();
assertTrue(wcharVal == 'z');
any.insert_wchar('z');
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
assertTrue(copy.get_wchar() == 'z');
any.insert_wchar('@');
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: wstring (unbounded)
//
type = orb.create_wstring_tc(0);
String wstringVal;
d1 = factory.create_dyn_any_from_type_code(type);
wstringVal = d1.get_wstring();
assertTrue(wstringVal.length() == 0);
d1.insert_wstring("polymorph");
wstringVal = d1.get_wstring();
String wstr = "polymorph";
assertTrue(wstringVal.equals(wstr));
av = d1.to_any();
String cwp = av.extract_wstring();
assertTrue(cwp.equals(wstr));
any.insert_wstring(wstr);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
copy = d1.copy();
assertTrue(d1.equal(copy));
wstringVal = copy.get_wstring();
assertTrue(wstringVal.equals(wstr));
any.insert_wstring("cloister");
d2.from_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d1.destroy();
d2.destroy();
copy.destroy();
testOps(orb, factory, type, false);
//
// Test: null
//
type = orb.get_primitive_tc(TCKind.tk_null);
d1 = factory.create_dyn_any_from_type_code(type);
av = d1.to_any();
tc = av.type();
assertTrue(tc.equal(type));
d2 = d1.copy();
d1.assign(d2);
d1.destroy();
d2.destroy();
testOps(orb, factory, type, false);
//
// Test: void
//
type = orb.get_primitive_tc(TCKind.tk_void);
d1 = factory.create_dyn_any_from_type_code(type);
av = d1.to_any();
tc = av.type();
assertTrue(tc.equal(type));
d2 = d1.copy();
d1.assign(d2);
d1.destroy();
d2.destroy();
testOps(orb, factory, type, false);
//
// Test: insert_dyn_any(), get_dyn_any()
//
type = orb.get_primitive_tc(TCKind.tk_any);
d1 = factory.create_dyn_any_from_type_code(type);
anyVal.insert_boolean(true);
any.insert_any(anyVal);
d2 = factory.create_dyn_any(any);
d1.insert_dyn_any(d2);
copy = d1.get_dyn_any();
assertTrue(copy.get_boolean() == true);
anyVal.insert_short((short) 53);
d1.insert_any(anyVal);
copy = d1.get_dyn_any();
assertTrue(copy.get_short() == (short) 53);
d1.destroy();
d2.destroy();
//
// Test: string (bounded) exception
//
type = orb.create_string_tc(3);
d1 = factory.create_dyn_any_from_type_code(type);
d1.insert_string("123");
stringVal = d1.get_string();
assertTrue(stringVal.equals("123"));
try {
d1.insert_string("four");
assertTrue("insert_string() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
d1.destroy();
//
// Test: wstring (bounded) exception
//
wstr = "123";
type = orb.create_wstring_tc(3);
d1 = factory.create_dyn_any_from_type_code(type);
d1.insert_wstring(wstr);
wstringVal = d1.get_wstring();
assertTrue(wstringVal.equals(wstr));
try {
d1.insert_wstring("four");
assertTrue("insert_wstring() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testFixed(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1 = null, d2 = null, copy = null;
TypeCode tc;
String str;
DynFixed f1, f2;
BigDecimal f;
//
// Create TypeCode
//
tc = orb.create_fixed_tc((short) 5, (short) 2);
//
// Test: get_value()
//
d1 = factory.create_dyn_any_from_type_code(tc);
f1 = DynFixedHelper.narrow(d1);
str = f1.get_value();
f = new BigDecimal(str);
assertTrue(f.equals(new BigDecimal("0")));
//
// Test: set_value()
//
assertTrue(f1.set_value("1.1"));
assertTrue(f1.set_value("123.1"));
assertTrue(f1.set_value("123.12"));
assertTrue(!f1.set_value("123.123"));
//
// Test: from_any()
//
f = new BigDecimal("98");
any.insert_fixed(f, tc);
f1.from_any(any);
//
// Test: to_any()
//
av = f1.to_any();
f = av.extract_fixed();
assertTrue(f.equals(new BigDecimal("98")));
//
// Test: copy
//
copy = f1.copy();
assertTrue(f1.equal(copy));
f1.destroy();
copy.destroy();
//
// Test: set_value() InvalidValue exception (part 1)
//
try {
d1 = factory.create_dyn_any_from_type_code(tc);
f1 = DynFixedHelper.narrow(d1);
f1.set_value("");
assertTrue("set_value() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
//
// Test: set_value() TypeMismatch exception (part 2)
//
try {
d1 = factory.create_dyn_any_from_type_code(tc);
f1 = DynFixedHelper.narrow(d1);
f1.set_value("-123D?");
assertTrue("set_value() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d1.destroy();
}
//
// Test: set_value() InvalidValue exception
//
try {
d1 = factory.create_dyn_any_from_type_code(tc);
f1 = DynFixedHelper.narrow(d1);
f1.set_value("12345.123"); // too many digits
assertTrue("set_value() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
//
// Test: assign() TypeMismatch exception
//
try {
f = new BigDecimal("99");
any.insert_fixed(f, orb.create_fixed_tc((short) 4, (short) 2));
d1 = factory.create_dyn_any(any);
d2 = factory.create_dyn_any_from_type_code(tc);
d2.assign(d1);
assertTrue("assign() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d1.destroy();
d2.destroy();
}
//
// Test: from_any() TypeMismatch exception
//
try {
f = new BigDecimal("99");
any.insert_fixed(f, orb.create_fixed_tc((short) 4, (short) 2));
d1 = factory.create_dyn_any_from_type_code(tc);
d1.from_any(any);
assertTrue("from_any() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d1.destroy();
}
testOps(orb, factory, tc, false);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testEnum(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1 = null, d2 = null, copy = null;
String str;
DynEnum e1, e2;
test.types.DynAnyTypes.TestEnum e;
TypeCode type = test.types.DynAnyTypes.TestEnumHelper.type();
//
// Test: initial value
//
d1 = factory.create_dyn_any_from_type_code(type);
e1 = DynEnumHelper.narrow(d1);
assertTrue(e1.get_as_ulong() == 0);
str = e1.get_as_string();
assertTrue(str.equals("red"));
//
// Test: set_as_string()
//
e1.set_as_string("green");
assertTrue(e1.get_as_ulong() == 1);
str = e1.get_as_string();
assertTrue(str.equals("green"));
e1.set_as_string("blue");
assertTrue(e1.get_as_ulong() == 2);
str = e1.get_as_string();
assertTrue(str.equals("blue"));
//
// Test: set_as_ulong()
//
e1.set_as_ulong(1);
assertTrue(e1.get_as_ulong() == 1);
str = e1.get_as_string();
assertTrue(str.equals("green"));
e1.set_as_ulong(2);
assertTrue(e1.get_as_ulong() == 2);
str = e1.get_as_string();
assertTrue(str.equals("blue"));
//
// Test: from_any()
//
test.types.DynAnyTypes.TestEnumHelper.insert(any,
test.types.DynAnyTypes.TestEnum.green);
e1.from_any(any);
//
// Test: to_any()
//
av = e1.to_any();
e = test.types.DynAnyTypes.TestEnumHelper.extract(av);
assertTrue(e == test.types.DynAnyTypes.TestEnum.green);
//
// Test: copy
//
copy = e1.copy();
assertTrue(e1.equal(copy));
e1.destroy();
copy.destroy();
//
// Test: set_as_ulong() InvalidValue exception
//
try {
d1 = factory.create_dyn_any_from_type_code(type);
e1 = DynEnumHelper.narrow(d1);
e1.set_as_ulong(3);
assertTrue("set_as_ulong() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
try {
d1 = factory.create_dyn_any_from_type_code(type);
e1 = DynEnumHelper.narrow(d1);
//
// In Java there is no *unsigned* int, so we need an
// additional test case not required for C++.
//
e1.set_as_ulong(-1);
assertTrue("set_as_ulong() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
//
// Test: set_as_string() InvalidValue exception
//
try {
d1 = factory.create_dyn_any_from_type_code(type);
e1 = DynEnumHelper.narrow(d1);
e1.set_as_string("alizarin");
assertTrue("set_as_string() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
d1.destroy();
}
testOps(orb, factory, TestEnumHelper.type(), false);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
final static short SHORT_VALUE = (short) -10000;
final static short USHORT_VALUE = (short) 40000;
final static int LONG_VALUE = -300000;
final static int ULONG_VALUE = 500000;
final static float FLOAT_VALUE = (float) 1.9183;
final static double DOUBLE_VALUE = 7.31e29;
final static boolean BOOLEAN_VALUE = true;
final static char CHAR_VALUE = 'Y';
final static byte OCTET_VALUE = (byte) 155;
final static String ANY_VALUE = "This is a string in an any";
//
// Can't do this, because it causes a failure under JDK 1.2.2.
// The problem is that ORB.init() is called before main() has
// a chance to set the ORB properties, so the JDK ORB's
// singleton implementation is used instead. This will result
// in a NullPointerException due to a bug in that ORB.
//
// final static TypeCode TYPECODE_VALUE =
// ORB.init().get_primitive_tc(TCKind.tk_float);
static TypeCode TYPECODE_VALUE;
final static String STRING_VALUE = "This is a string";
final static long LONGLONG_VALUE = -1234567890L;
final static long ULONGLONG_VALUE = 9876543210L;
final static char WCHAR_VALUE = 'Z';
final static String WSTRING_VALUE = "This is a wstring";
static void loadStruct(ORB orb, TestStruct ts) {
ts.shortVal = SHORT_VALUE;
ts.ushortVal = USHORT_VALUE;
ts.longVal = LONG_VALUE;
ts.ulongVal = ULONG_VALUE;
ts.floatVal = FLOAT_VALUE;
ts.doubleVal = DOUBLE_VALUE;
ts.boolVal = BOOLEAN_VALUE;
ts.charVal = CHAR_VALUE;
ts.octetVal = OCTET_VALUE;
ts.anyVal = orb.create_any();
ts.anyVal.insert_string(ANY_VALUE);
ts.tcVal = TYPECODE_VALUE;
ts.objectVal = null;
ts.stringVal = STRING_VALUE;
ts.longlongVal = LONGLONG_VALUE;
ts.ulonglongVal = ULONGLONG_VALUE;
ts.wcharVal = WCHAR_VALUE;
ts.wstringVal = WSTRING_VALUE;
}
static void checkStruct(final TestStruct ts) {
assertTrue(ts.shortVal == SHORT_VALUE);
assertTrue(ts.ushortVal == USHORT_VALUE);
assertTrue(ts.longVal == LONG_VALUE);
assertTrue(ts.ulongVal == ULONG_VALUE);
assertTrue(ts.floatVal == FLOAT_VALUE);
assertTrue(ts.doubleVal == DOUBLE_VALUE);
assertTrue(ts.boolVal == BOOLEAN_VALUE);
assertTrue(ts.charVal == CHAR_VALUE);
assertTrue(ts.octetVal == OCTET_VALUE);
assertTrue(ts.anyVal.extract_string().equals(ANY_VALUE));
assertTrue(ts.tcVal.equal(TYPECODE_VALUE));
assertTrue(ts.objectVal == null);
assertTrue(ts.stringVal.equals(STRING_VALUE));
assertTrue(ts.longlongVal == LONGLONG_VALUE);
assertTrue(ts.ulonglongVal == ULONGLONG_VALUE);
assertTrue(ts.wcharVal == WCHAR_VALUE);
assertTrue(ts.wstringVal.equals(WSTRING_VALUE));
}
static void testStruct(ORB orb, DynAnyFactory factory) {
try {
int i;
Any any = orb.create_any();
Any av;
DynAny d1, d2, copy;
String str;
String wstr;
DynStruct s1, s2;
String cp;
TypeCode type, tc;
TestStruct ts = new TestStruct();
TestStruct pts;
NameValuePair[] nvpseq;
NameDynAnyPair[] ndpseq;
type = TestStructHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynStructHelper.narrow(d1);
//
// Test: current_member_name, current_member_kind
//
str = s1.current_member_name();
assertTrue(str.equals("shortVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_short);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("ushortVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_ushort);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("longVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_long);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("ulongVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_ulong);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("floatVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_float);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("doubleVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_double);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("boolVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_boolean);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("charVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_char);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("octetVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_octet);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("anyVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_any);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("tcVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_TypeCode);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("objectVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_objref);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("stringVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_string);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("longlongVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_longlong);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("ulonglongVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_ulonglong);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("wcharVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_wchar);
s1.next();
str = s1.current_member_name();
assertTrue(str.equals("wstringVal"));
assertTrue(s1.current_member_kind() == TCKind.tk_wstring);
//
// Test: insert values into members
//
s1.rewind();
s1.insert_short(SHORT_VALUE);
s1.next();
s1.insert_ushort(USHORT_VALUE);
s1.next();
s1.insert_long(LONG_VALUE);
s1.next();
s1.insert_ulong(ULONG_VALUE);
s1.next();
s1.insert_float(FLOAT_VALUE);
s1.next();
s1.insert_double(DOUBLE_VALUE);
s1.next();
s1.insert_boolean(BOOLEAN_VALUE);
s1.next();
s1.insert_char(CHAR_VALUE);
s1.next();
s1.insert_octet(OCTET_VALUE);
s1.next();
any.insert_string(ANY_VALUE);
s1.insert_any(any);
s1.next();
s1.insert_typecode(TYPECODE_VALUE);
s1.next();
s1.insert_reference(null);
s1.next();
s1.insert_string(STRING_VALUE);
s1.next();
s1.insert_longlong(LONGLONG_VALUE);
s1.next();
s1.insert_ulonglong(ULONGLONG_VALUE);
s1.next();
s1.insert_wchar(WCHAR_VALUE);
s1.next();
s1.insert_wstring(WSTRING_VALUE);
s1.next();
//
// Test: get values from members
//
s1.rewind();
assertTrue(s1.get_short() == SHORT_VALUE);
s1.next();
assertTrue(s1.get_ushort() == USHORT_VALUE);
s1.next();
assertTrue(s1.get_long() == LONG_VALUE);
s1.next();
assertTrue(s1.get_ulong() == ULONG_VALUE);
s1.next();
assertTrue(s1.get_float() == FLOAT_VALUE);
s1.next();
assertTrue(s1.get_double() == DOUBLE_VALUE);
s1.next();
assertTrue(s1.get_boolean() == BOOLEAN_VALUE);
s1.next();
assertTrue(s1.get_char() == CHAR_VALUE);
s1.next();
assertTrue(s1.get_octet() == OCTET_VALUE);
s1.next();
av = s1.get_any();
s1.next();
assertTrue(av.extract_string().equals(ANY_VALUE));
tc = s1.get_typecode();
s1.next();
assertTrue(tc.equal(TYPECODE_VALUE));
assertTrue(s1.get_reference() == null);
s1.next();
str = s1.get_string();
s1.next();
assertTrue(str.equals(STRING_VALUE));
assertTrue(s1.get_longlong() == LONGLONG_VALUE);
s1.next();
assertTrue(s1.get_ulonglong() == ULONGLONG_VALUE);
s1.next();
assertTrue(s1.get_wchar() == WCHAR_VALUE);
s1.next();
wstr = s1.get_wstring();
s1.next();
assertTrue(wstr.equals(WSTRING_VALUE));
//
// Initialize struct
//
loadStruct(orb, ts);
//
// Test: equal
//
TestStructHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: from_any()
//
d1.from_any(any);
//
// Test: to_any()
//
av = d1.to_any();
pts = TestStructHelper.extract(av);
checkStruct(pts);
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
//
// Test: get_members
//
nvpseq = s1.get_members();
s1.rewind();
for (i = 0; i < nvpseq.length; i++) {
str = s1.current_member_name();
assertTrue(str.equals(nvpseq[i].id));
DynAny dv = factory.create_dyn_any(nvpseq[i].value);
DynAny comp = s1.current_component();
assertTrue(dv.equal(comp));
dv.destroy();
s1.next();
}
//
// Test: set_members
//
s1.set_members(nvpseq);
d2 = s1.current_component();
tc = d2.type();
assertTrue(tc.kind() == TCKind.tk_short); // ensure index is reset to 0
TestStructHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: set_members TypeMismatch exception (part 1)
//
try {
str = nvpseq[2].id;
nvpseq[2].id = "totally_wrong";
s1.set_members(nvpseq);
assertTrue("set_members should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
nvpseq[2].id = str; // restore value
}
//
// Test: set_members TypeMismatch exception (part 2)
//
try {
any = nvpseq[2].value;
nvpseq[2].value.insert_string("this is not a long");
s1.set_members(nvpseq);
assertTrue("set_members should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
nvpseq[2].value = any; // restore value
}
//
// Test: set_members InvalidValue exception
//
try {
nvpseq = new NameValuePair[0];
s1.set_members(nvpseq);
assertTrue("set_members should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: get_members_as_dyn_any
//
ndpseq = s1.get_members_as_dyn_any();
s1.rewind();
for (i = 0; i < ndpseq.length; i++) {
str = s1.current_member_name();
assertTrue(str.equals(ndpseq[i].id));
s1.next();
}
//
// Test: set_members_as_dyn_any()
//
s1.set_members_as_dyn_any(ndpseq);
d2 = s1.current_component();
tc = d2.type();
assertTrue(tc.kind() == TCKind.tk_short); // ensure index is reset to 0
TestStructHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: set_members_as_dyn_any() TypeMismatch exception (part 1)
//
try {
str = ndpseq[2].id;
ndpseq[2].id = "totally_wrong";
s1.set_members_as_dyn_any(ndpseq);
assertTrue("set_members_as_dyn_any should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
ndpseq[2].id = str; // restore value
}
//
// Test: set_members_as_dyn_any() TypeMismatch exception (part 2)
//
try {
d2 = ndpseq[2].value; // save value
any.insert_boolean(false);
ndpseq[2].value = factory.create_dyn_any(any);
s1.set_members_as_dyn_any(ndpseq);
assertTrue("set_members_as_dyn_any should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
ndpseq[2].value.destroy();
ndpseq[2].value = d2; // restore value
}
//
// Test: set_members_as_dyn_any() InvalidValue exception
//
try {
ndpseq = new NameDynAnyPair[0];
s1.set_members_as_dyn_any(ndpseq);
assertTrue("set_members_as_dyn_any should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
d1.destroy();
testOps(orb, factory, type, true);
//
// Test: empty exception
//
type = TestEmptyExceptionHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynStructHelper.narrow(d1);
TestEmptyException ex = new TestEmptyException();
TestEmptyExceptionHelper.insert(any, ex);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d1.assign(d2);
d1.from_any(any);
nvpseq = s1.get_members();
assertTrue(nvpseq.length == 0);
s1.set_members(nvpseq);
d1.destroy();
d2.destroy();
testOps(orb, factory, type, false);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testException(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, copy;
DynStruct s1, s2;
TypeCode type, tc;
NameValuePair[] nvpseq;
NameDynAnyPair[] ndpseq;
//
// Test: empty exception
//
type = TestEmptyExceptionHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynStructHelper.narrow(d1);
TestEmptyException ex = new TestEmptyException();
TestEmptyExceptionHelper.insert(any, ex);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d1.assign(d2);
d1.from_any(any);
nvpseq = s1.get_members();
assertTrue(nvpseq.length == 0);
s1.set_members(nvpseq);
d1.destroy();
d2.destroy();
testOps(orb, factory, type, false);
//
// Test: system exception
//
type = org.omg.CORBA.OBJECT_NOT_EXISTHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynStructHelper.narrow(d1);
d1.insert_ulong(1);
d1.next();
d2 = d1.current_component();
DynEnum de = DynEnumHelper.narrow(d2);
de.set_as_string("COMPLETED_MAYBE");
org.omg.CORBA.OBJECT_NOT_EXIST one = new org.omg.CORBA.OBJECT_NOT_EXIST(
1, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
org.omg.CORBA.OBJECT_NOT_EXISTHelper.insert(any, one);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d1.assign(d2);
d1.from_any(any);
nvpseq = s1.get_members();
assertTrue(nvpseq.length == 2);
av = d1.to_any();
one = org.omg.CORBA.OBJECT_NOT_EXISTHelper.extract(av);
assertTrue(one.minor == 1);
assertTrue(one.completed == org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
d1.destroy();
d2.destroy();
testOps(orb, factory, type, true);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testUnion1(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, copy, disc, member;
String str;
DynUnion u1;
TypeCode type, discType, tc;
test.types.DynAnyTypes.TestUnion1 tu1 = new test.types.DynAnyTypes.TestUnion1();
test.types.DynAnyTypes.TestUnion1 ptu1;
//
// Test: TestUnion1 initialization - first named member should
// be activated
//
type = test.types.DynAnyTypes.TestUnion1Helper.type();
discType = orb.get_primitive_tc(TCKind.tk_short);
d1 = factory.create_dyn_any_from_type_code(type);
u1 = DynUnionHelper.narrow(d1);
assertTrue(u1.discriminator_kind() == TCKind.tk_short);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
disc = u1.get_discriminator();
assertTrue(disc.get_short() == (short) 0);
assertTrue(u1.component_count() == 2);
//
// Test: set_discriminator() - ensure member is not deactivated
// when new discriminator selects the current member
//
u1.seek(1); // initialize member value
u1.insert_long(55);
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 1); // change disc to 1
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
assertTrue(u1.get_long() == 55); // also tests current position
disc.destroy();
disc = u1.get_discriminator();
assertTrue(disc.get_short() == (short) 1);
u1.rewind();
assertTrue(u1.get_short() == (short) 1);
//
// Test: set_discriminator() - ensure member is deactivated when
// new discriminator selects a new member
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 3); // change disc to 3
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("b"));
assertTrue(u1.member_kind() == TCKind.tk_float);
assertTrue(u1.get_float() == (float) 0);
u1.insert_float(99.99f);
disc.destroy();
disc = u1.get_discriminator();
assertTrue(disc.get_short() == (short) 3);
u1.rewind();
assertTrue(u1.get_short() == (short) 3);
//
// Test: set_discriminator() - use discriminator value that
// selects the default member
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 9); // change disc to 9
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("c"));
assertTrue(u1.member_kind() == TCKind.tk_string);
str = u1.get_string();
assertTrue(str.length() == 0);
u1.insert_string("hi there");
disc.insert_short((short) 23); // change disc again - still
// default member
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("c"));
str = u1.get_string();
assertTrue(str.equals("hi there"));
disc.destroy();
//
// Test: set_discriminator() TypeMismatch exception
//
disc = factory.create_dyn_any_from_type_code(orb
.get_primitive_tc(TCKind.tk_ushort));
disc.insert_ushort((short) 55);
try {
u1.set_discriminator(disc);
assertTrue("set_discriminator() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
disc.destroy();
//
// Test: set_to_default_member() - active member should not change
// from last test
//
u1.set_to_default_member();
str = u1.member_name();
assertTrue(str.equals("c"));
u1.next();
str = u1.get_string();
assertTrue(str.equals("hi there"));
//
// Test: set_to_default_member() - force a new member to be
// activated
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 1);
u1.set_discriminator(disc);
disc.destroy();
u1.set_to_default_member();
str = u1.member_name();
assertTrue(str.equals("c"));
assertTrue(u1.component_count() == 2);
//
// Test: is_set_to_default_member()
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 0);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 1);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 3);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 2);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == true);
disc.destroy();
disc = u1.get_discriminator();
disc.insert_short((short) 0);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 1);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 3);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 2);
assertTrue(u1.is_set_to_default_member() == true);
//
// Test: has_no_active_member()
//
assertTrue(u1.has_no_active_member() == false);
//
// Test: set_to_no_active_member() TypeMismatch exception
//
try {
u1.set_to_no_active_member();
assertTrue("set_to_no_active_member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: change discriminator by manipulating the components
// directly
//
u1.set_to_default_member();
u1.seek(0);
disc = u1.current_component();
disc.insert_short((short) 0);
str = u1.member_name();
assertTrue(str.equals("a"));
u1.insert_long(55);
disc.insert_short((short) 1);
assertTrue(u1.get_long() == 55);
//
// Test: to_any
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 1);
u1.set_discriminator(disc);
disc.destroy();
u1.insert_long(49);
av = u1.to_any();
ptu1 = test.types.DynAnyTypes.TestUnion1Helper.extract(av);
assertTrue(ptu1.discriminator() == (short) 1);
assertTrue(ptu1.a() == 49);
//
// Test: assign
//
tu1.c("hi there");
test.types.DynAnyTypes.TestUnion1Helper.insert(any, tu1);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
str = u1.member_name();
assertTrue(str.equals("c"));
u1.seek(1);
str = u1.get_string();
assertTrue(str.equals("hi there"));
d2.destroy();
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
d1.destroy();
testOps(orb, factory, type, true);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testUnion2(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, copy, disc, member;
String str;
DynUnion u1;
TypeCode type, discType, tc;
test.types.DynAnyTypes.TestUnion2 tu2 = new test.types.DynAnyTypes.TestUnion2();
test.types.DynAnyTypes.TestUnion2 ptu2;
//
// Test: TestUnion2 initialization - first named member should
// be activated
//
type = test.types.DynAnyTypes.TestUnion2Helper.type();
discType = orb.get_primitive_tc(TCKind.tk_boolean);
d1 = factory.create_dyn_any_from_type_code(type);
u1 = DynUnionHelper.narrow(d1);
assertTrue(u1.discriminator_kind() == TCKind.tk_boolean);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
disc = u1.get_discriminator();
assertTrue(disc.get_boolean() == true);
assertTrue(u1.component_count() == 2);
//
// Test: set_discriminator() - sets union to have no active member
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_boolean(false);
u1.set_discriminator(disc);
assertTrue(u1.component_count() == 1);
disc.destroy();
//
// Test: seek - with no active member, 0 is only valid position
//
assertTrue(!u1.seek(1));
//
// Test: next - with no active member, 0 is only valid position
//
u1.rewind();
assertTrue(!u1.next());
//
// Test: copy
//
copy = u1.copy();
assertTrue(u1.equal(copy));
copy.destroy();
//
// Test: has_no_active_member()
//
assertTrue(u1.has_no_active_member());
//
// Test: set_discriminator() TypeMismatch exception
//
disc = factory.create_dyn_any_from_type_code(orb
.get_primitive_tc(TCKind.tk_ushort));
disc.insert_ushort((short) 55);
try {
u1.set_discriminator(disc);
assertTrue("set_discriminator() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
disc.destroy();
//
// Test: set_to_default_member() TypeMismatch exception
//
try {
u1.set_to_default_member();
assertTrue("set_to_default_member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: is_set_to_default_member()
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_boolean(true);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_boolean(false);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.destroy();
disc = u1.get_discriminator();
disc.insert_boolean(true);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_boolean(false);
assertTrue(u1.is_set_to_default_member() == false);
//
// Test: member() InvalidValue exception
//
try {
member = u1.member();
assertTrue("member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: member_name() InvalidValue exception
//
try {
str = u1.member_name();
assertTrue("member_name() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: member_kind() InvalidValue exception
//
try {
u1.member_kind();
assertTrue("member_kind() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: set_to_no_active_member()
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_boolean(true);
u1.set_discriminator(disc);
disc.destroy();
u1.insert_long(49);
assertTrue(!u1.has_no_active_member());
u1.set_to_no_active_member();
assertTrue(u1.has_no_active_member());
//
// Test: change discriminator by manipulating the components
// directly
//
u1.set_to_no_active_member();
disc = u1.current_component();
assertTrue(disc.get_boolean() == false);
disc.insert_boolean(true);
str = u1.member_name();
assertTrue(str.equals("a"));
u1.insert_long(55);
assertTrue(u1.get_long() == 55);
//
// Test: to_any
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_boolean(true);
u1.set_discriminator(disc);
disc.destroy();
u1.insert_long(49);
av = u1.to_any();
ptu2 = test.types.DynAnyTypes.TestUnion2Helper.extract(av);
assertTrue(ptu2.discriminator() == true);
assertTrue(ptu2.a() == 49);
//
// Test: assign
//
tu2.a(199);
test.types.DynAnyTypes.TestUnion2Helper.insert(any, tu2);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
str = u1.member_name();
assertTrue(str.equals("a"));
u1.seek(1);
assertTrue(u1.get_long() == 199);
d2.destroy();
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
d1.destroy();
testOps(orb, factory, type, true);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testUnion3(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, copy, disc, member;
String str;
DynUnion u1, u2;
DynEnum e;
TypeCode type, discType, tc;
test.types.DynAnyTypes.TestUnion3 tu3 = new test.types.DynAnyTypes.TestUnion3();
test.types.DynAnyTypes.TestUnion3 ptu3;
//
// Test: TestUnion3 initialization - first named member should
// be activated
//
type = test.types.DynAnyTypes.TestUnion3Helper.type();
discType = test.types.DynAnyTypes.TestEnumHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
u1 = DynUnionHelper.narrow(d1);
assertTrue(u1.discriminator_kind() == TCKind.tk_enum);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
disc = u1.get_discriminator();
e = DynEnumHelper.narrow(disc);
assertTrue(e.get_as_ulong() == 0);
assertTrue(u1.component_count() == 2);
//
// Test: set_discriminator()
//
disc = factory.create_dyn_any_from_type_code(discType);
e = DynEnumHelper.narrow(disc);
e.set_as_string("green");
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("b"));
assertTrue(u1.member_kind() == TCKind.tk_double);
assertTrue(u1.component_count() == 2);
//
// Test: change discriminator by manipulating the components
// directly
//
e.set_as_string("blue");
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("c"));
assertTrue(u1.member_kind() == TCKind.tk_char);
assertTrue(u1.component_count() == 2);
disc.destroy();
//
// Test: copy
//
copy = u1.copy();
assertTrue(u1.equal(copy));
copy.destroy();
//
// Test: has_no_active_member()
//
assertTrue(!u1.has_no_active_member());
//
// Test: set_discriminator() TypeMismatch exception
//
disc = factory.create_dyn_any_from_type_code(orb
.get_primitive_tc(TCKind.tk_ushort));
disc.insert_ushort((short) 55);
try {
u1.set_discriminator(disc);
assertTrue("set_discriminator() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
disc.destroy();
//
// Test: set_to_default_member() TypeMismatch exception
//
try {
u1.set_to_default_member();
assertTrue("set_to_default_member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: is_set_to_default_member()
//
disc = factory.create_dyn_any_from_type_code(discType);
e = DynEnumHelper.narrow(disc);
e.set_as_string("red");
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
e.set_as_string("green");
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
e.set_as_string("blue");
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.destroy();
disc = u1.get_discriminator();
e = DynEnumHelper.narrow(disc);
e.set_as_string("red");
assertTrue(u1.is_set_to_default_member() == false);
e.set_as_string("green");
assertTrue(u1.is_set_to_default_member() == false);
e.set_as_string("blue");
assertTrue(u1.is_set_to_default_member() == false);
//
// Test: set_to_no_active_member() exception
//
try {
u1.set_to_no_active_member();
assertTrue("set_to_no_active_member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: to_any
//
disc = u1.get_discriminator();
e = DynEnumHelper.narrow(disc);
e.set_as_string("blue");
u1.insert_char('Z');
av = u1.to_any();
ptu3 = test.types.DynAnyTypes.TestUnion3Helper.extract(av);
assertTrue(ptu3.discriminator() == test.types.DynAnyTypes.TestEnum.blue);
assertTrue(ptu3.c() == 'Z');
//
// Test: assign
//
tu3.b(1.99);
test.types.DynAnyTypes.TestUnion3Helper.insert(any, tu3);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
str = u1.member_name();
assertTrue(str.equals("b"));
u1.seek(1);
assertTrue(u1.get_double() >= 1.99);
d2.destroy();
d1.destroy();
testOps(orb, factory, type, true);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testUnion4(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
;
Any av;
DynAny d1, d2, copy, disc, member;
String str;
DynUnion u1, u2;
TypeCode type, discType, tc;
test.types.DynAnyTypes.TestUnion4 tu4 = new test.types.DynAnyTypes.TestUnion4();
test.types.DynAnyTypes.TestUnion4 ptu4;
//
// Test: TestUnion4 initialization - first named member should be
// activated
//
type = test.types.DynAnyTypes.TestUnion4Helper.type();
discType = orb.get_primitive_tc(TCKind.tk_short);
d1 = factory.create_dyn_any_from_type_code(type);
u1 = DynUnionHelper.narrow(d1);
assertTrue(u1.discriminator_kind() == TCKind.tk_short);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
disc = u1.get_discriminator();
assertTrue(u1.component_count() == 2);
//
// Test: set_discriminator()
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 99);
u1.set_discriminator(disc);
str = u1.member_name();
assertTrue(str.equals("b"));
assertTrue(u1.member_kind() == TCKind.tk_float);
assertTrue(u1.component_count() == 2);
disc.destroy();
//
// Test: change discriminator by manipulating the components
// directly
//
disc = u1.get_discriminator();
disc.insert_short((short) 33);
str = u1.member_name();
assertTrue(str.equals("a"));
assertTrue(u1.member_kind() == TCKind.tk_long);
assertTrue(u1.component_count() == 2);
u1.insert_long(444);
disc.insert_short((short) 66);
assertTrue(u1.get_long() == 444);
//
// Test: copy
//
copy = u1.copy();
assertTrue(u1.equal(copy));
copy.destroy();
//
// Test: has_no_active_member()
//
assertTrue(!u1.has_no_active_member());
//
// Test: set_discriminator() TypeMismatch exception
//
disc = factory.create_dyn_any_from_type_code(orb
.get_primitive_tc(TCKind.tk_ushort));
disc.insert_ushort((short) 55);
try {
u1.set_discriminator(disc);
assertTrue("set_discriminator() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
disc.destroy();
//
// Test: set_to_default_member()
//
disc = u1.get_discriminator();
disc.insert_short((short) 99); // select "b"
u1.set_to_default_member();
str = u1.member_name();
assertTrue(str.equals("a"));
//
// Test: is_set_to_default_member()
//
disc = factory.create_dyn_any_from_type_code(discType);
disc.insert_short((short) 99);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 0);
u1.set_discriminator(disc);
assertTrue(u1.is_set_to_default_member() == true);
disc.destroy();
disc = u1.get_discriminator();
disc.insert_short((short) 99);
assertTrue(u1.is_set_to_default_member() == false);
disc.insert_short((short) 0);
assertTrue(u1.is_set_to_default_member() == true);
//
// Test: set_to_no_active_member() exception
//
try {
u1.set_to_no_active_member();
assertTrue("set_to_no_active_member() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: to_any
//
u1.set_to_default_member();
u1.next();
u1.insert_long(888);
av = u1.to_any();
ptu4 = test.types.DynAnyTypes.TestUnion4Helper.extract(av);
assertTrue(ptu4.a() == 888);
//
// Test: assign
//
tu4.b(1.99f);
test.types.DynAnyTypes.TestUnion4Helper.insert(any, tu4);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
str = u1.member_name();
assertTrue(str.equals("b"));
u1.seek(1);
assertTrue(u1.get_float() >= 1.99f);
d2.destroy();
d1.destroy();
testOps(orb, factory, type, true);
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testShortSeq(ORB orb, DynAnyFactory factory) {
try {
int i;
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynSequence s1, s2;
TypeCode type, tc;
short[] seq;
short[] pseq;
//
// Test: initialization
//
type = TestShortSeqHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynSequenceHelper.narrow(d1);
assertTrue(s1.get_length() == 0);
assertTrue(s1.component_count() == 0);
//
// Test: set_length() - increase length - position should be 0
//
s1.set_length(5);
assertTrue(s1.get_length() == 5);
assertTrue(s1.component_count() == 5);
for (i = 0; i < 5; i++) {
s1.insert_short((short) i);
s1.next();
}
s1.rewind();
for (i = 0; i < 5; i++) {
assertTrue(s1.get_short() == (short) i);
s1.next();
}
//
// Test: set_length() - decrease length - position should not change
//
s1.seek(1);
s1.set_length(3);
assertTrue(s1.get_short() == (short) 1);
assertTrue(s1.get_length() == 3);
assertTrue(s1.component_count() == 3);
s1.rewind();
for (i = 0; i < 3; i++) {
assertTrue(s1.get_short() == (short) i);
s1.next();
}
//
// Test: to_any
//
av = s1.to_any();
pseq = TestShortSeqHelper.extract(av);
assertTrue(pseq.length == 3);
for (i = 0; i < 3; i++)
assertTrue(pseq[i] == (short) i);
//
// Test: copy
//
copy = s1.copy();
assertTrue(s1.equal(copy));
copy.destroy();
//
// Test: equal
//
copy = s1.copy();
copy.seek(1);
copy.insert_short((short) -33);
assertTrue(!s1.equal(copy));
copy.destroy();
//
// Test: from_any
//
seq = new short[8];
for (i = 0; i < 8; i++)
seq[i] = (short) (8 - i);
TestShortSeqHelper.insert(any, seq);
s1.from_any(any);
s1.rewind();
for (i = 0; i < 8; i++) {
assertTrue(s1.get_short() == (short) (8 - i));
s1.next();
}
//
// Test: components - ensure that the sequence and its components
// are synchronized
//
s1.rewind();
for (i = 0; i < 8; i++) {
comp = s1.current_component();
assertTrue(comp.get_short() == (short) (8 - i));
comp.insert_short((short) i);
assertTrue(s1.get_short() == (short) i);
s1.next();
}
//
// Test: get_elements()
//
Any[] anySeq = s1.get_elements();
assertTrue(anySeq.length == 8);
for (i = 0; i < 8; i++) {
short n = anySeq[i].extract_short();
assertTrue(n == (short) i);
}
//
// Test: set_elements()
//
anySeq = new Any[3]; // decrease sequence length
for (i = 0; i < 3; i++) {
anySeq[i] = orb.create_any();
anySeq[i].insert_short((short) (i + 10));
}
s1.set_elements(anySeq);
s1.rewind();
for (i = 0; i < 3; i++) {
assertTrue(s1.get_short() == (short) (i + 10));
s1.next();
}
//
// Test: get_elements_as_dyn_any()
//
DynAny[] dynAnySeq = s1.get_elements_as_dyn_any();
assertTrue(dynAnySeq.length == 3);
for (i = 0; i < 3; i++)
assertTrue(dynAnySeq[i].get_short() == (short) (i + 10));
//
// Test: set_elements_as_dyn_any
//
dynAnySeq = new DynAny[4]; // increase sequence length
for (i = 0; i < 4; i++) {
any.insert_short((short) (i + 100));
dynAnySeq[i] = factory.create_dyn_any(any);
}
s1.set_elements_as_dyn_any(dynAnySeq);
s1.rewind();
for (i = 0; i < 4; i++) {
assertTrue(s1.get_short() == (short) (i + 100));
s1.next();
}
for (i = 0; i < 4; i++)
dynAnySeq[i].destroy();
//
// Test: assign
//
seq = new short[10];
for (i = 0; i < 10; i++)
seq[i] = (short) (i * 10);
TestShortSeqHelper.insert(any, seq);
d2 = factory.create_dyn_any(any);
s2 = DynSequenceHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(s1.get_length() == 10);
assertTrue(s1.component_count() == 10);
s1.rewind();
for (i = 0; i < 10; i++) {
assertTrue(s1.get_short() == (short) (i * 10));
s1.next();
}
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testBoundedString10Seq(ORB orb, DynAnyFactory factory) {
try {
int i;
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynSequence s1, s2;
TypeCode type, tc;
String[] seq;
String[] pseq;
//
// Test: initialization
//
type = TestBoundedString10SeqHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynSequenceHelper.narrow(d1);
assertTrue(s1.get_length() == 0);
assertTrue(s1.component_count() == 0);
//
// Test: set_length() - increase length - position should be 0
//
s1.set_length(5);
assertTrue(s1.get_length() == 5);
assertTrue(s1.component_count() == 5);
for (i = 0; i < 5; i++) {
str = s1.get_string();
assertTrue(str.length() == 0);
str += "str ";
str += i;
s1.insert_string(str);
s1.next();
}
s1.rewind();
for (i = 0; i < 5; i++) {
str = s1.get_string();
String s = "str " + i;
assertTrue(str.equals(s));
s1.next();
}
//
// Test: set_length() - decrease length - position should not
// change
//
s1.seek(1);
s1.set_length(3);
str = s1.get_string();
assertTrue(str.equals("str 1"));
assertTrue(s1.get_length() == 3);
assertTrue(s1.component_count() == 3);
//
// Test: to_any
//
av = s1.to_any();
pseq = TestBoundedString10SeqHelper.extract(av);
assertTrue(pseq.length == 3);
for (i = 0; i < 3; i++) {
String s = "str " + i;
assertTrue(pseq[i].equals(s));
}
//
// Test: copy
//
copy = s1.copy();
assertTrue(s1.equal(copy));
copy.destroy();
//
// Test: equal
//
copy = s1.copy();
copy.seek(1);
copy.insert_string("hi there");
assertTrue(!s1.equal(copy));
copy.destroy();
//
// Test: from_any
//
seq = new String[8];
for (i = 0; i < 8; i++)
seq[i] = "STR " + i;
TestBoundedString10SeqHelper.insert(any, seq);
s1.from_any(any);
s1.rewind();
for (i = 0; i < 8; i++) {
str = s1.get_string();
String s = "STR " + i;
assertTrue(str.equals(s));
s1.next();
}
//
// Test: components - ensure that the sequence and its components
// are synchronized
//
s1.rewind();
for (i = 0; i < 8; i++) {
comp = s1.current_component();
str = comp.get_string();
String s = "STR " + i;
assertTrue(str.equals(s));
s = "string " + i;
comp.insert_string(s);
str = s1.get_string();
assertTrue(str.equals(s));
s1.next();
}
//
// Test: get_elements()
//
Any[] anySeq = s1.get_elements();
assertTrue(anySeq.length == 8);
for (i = 0; i < 8; i++) {
String cp = anySeq[i].extract_string();
String s = "string " + i;
assertTrue(cp.equals(s));
}
//
// Test: set_elements()
//
anySeq = new Any[3]; // decrease sequence length
for (i = 0; i < 3; i++) {
String s = "String " + i;
anySeq[i] = orb.create_any();
TestBoundedStringHelper.insert(anySeq[i], (s));
}
s1.set_elements(anySeq);
s1.rewind();
for (i = 0; i < 3; i++) {
str = s1.get_string();
String s = "String " + i;
assertTrue(str.equals(s));
s1.next();
}
//
// Test: get_elements_as_dyn_any()
//
DynAny[] dynAnySeq = s1.get_elements_as_dyn_any();
assertTrue(dynAnySeq.length == 3);
for (i = 0; i < 3; i++) {
str = dynAnySeq[i].get_string();
String s = "String " + i;
assertTrue(str.equals(s));
}
//
// Test: set_elements_as_dyn_any
//
dynAnySeq = new DynAny[4]; // increase sequence length
for (i = 0; i < 4; i++) {
String s = "STRING " + i;
TestBoundedStringHelper.insert(any, s);
dynAnySeq[i] = factory.create_dyn_any(any);
}
s1.set_elements_as_dyn_any(dynAnySeq);
s1.rewind();
for (i = 0; i < 4; i++) {
str = s1.get_string();
String s = "STRING " + i;
assertTrue(str.equals(s));
s1.next();
}
for (i = 0; i < 4; i++)
dynAnySeq[i].destroy();
//
// Test: assign
//
seq = new String[10];
for (i = 0; i < 10; i++)
seq[i] = "Str " + i;
TestBoundedString10SeqHelper.insert(any, seq);
d2 = factory.create_dyn_any(any);
s2 = DynSequenceHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(s1.get_length() == 10);
assertTrue(s1.component_count() == 10);
s1.rewind();
for (i = 0; i < 10; i++) {
str = s1.get_string();
String s = "Str " + i;
assertTrue(str.equals(s));
s1.next();
}
//
// Test: set_length() InvalidValue exception
//
i = s1.component_count();
try {
s1.set_length(11);
assertTrue("set_length() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
assertTrue(s1.component_count() == i);
//
// Test: set_elements() TypeMismatch exception
//
anySeq = new Any[5];
for (i = 0; i < 5; i++) {
String s = "String " + i;
anySeq[i] = orb.create_any();
anySeq[i].insert_string(s); // Not using Helper.insert()
}
try {
s1.set_elements(anySeq);
assertTrue("set_elements() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testAnySeq(ORB orb, DynAnyFactory factory) {
try {
int i;
short s;
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynSequence s1, s2;
TypeCode type, tc;
Any[] seq;
Any[] pseq;
//
// Test: initialization
//
type = TestAnySeqHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
s1 = DynSequenceHelper.narrow(d1);
assertTrue(s1.get_length() == 0);
assertTrue(s1.component_count() == 0);
//
// Test: set_length() - increase length - position should be 0
//
s1.set_length(5);
assertTrue(s1.get_length() == 5);
assertTrue(s1.component_count() == 5);
for (i = 0; i < 5; i++) {
any.insert_short((short) i);
s1.insert_any(any);
s1.next();
}
s1.rewind();
for (i = 0; i < 5; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) i);
s1.next();
}
//
// Test: set_length() - decrease length - position should not
// change
//
s1.seek(1);
s1.set_length(3);
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) 1);
assertTrue(s1.get_length() == 3);
assertTrue(s1.component_count() == 3);
s1.rewind();
for (i = 0; i < 3; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) i);
s1.next();
}
//
// Test: to_any
//
av = s1.to_any();
pseq = TestAnySeqHelper.extract(av);
assertTrue(pseq.length == 3);
for (i = 0; i < 3; i++) {
s = pseq[i].extract_short();
assertTrue(s == (short) i);
}
//
// Test: copy
//
copy = s1.copy();
assertTrue(s1.equal(copy));
copy.destroy();
//
// Test: equal
//
copy = s1.copy();
copy.seek(1);
any.insert_short((short) -33);
copy.insert_any(any);
assertTrue(!s1.equal(copy));
copy.destroy();
//
// Test: from_any
//
seq = new Any[8];
for (i = 0; i < 8; i++) {
seq[i] = orb.create_any();
seq[i].insert_short((short) (8 - i));
}
TestAnySeqHelper.insert(any, seq);
s1.from_any(any);
s1.rewind();
for (i = 0; i < 8; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) (8 - i));
s1.next();
}
//
// Test: components - ensure that the sequence and its components
// are synchronized
//
s1.rewind();
for (i = 0; i < 8; i++) {
comp = s1.current_component();
av = comp.get_any();
s = av.extract_short();
assertTrue(s == (short) (8 - i));
any.insert_short((short) i);
comp.insert_any(any);
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) i);
s1.next();
}
//
// Test: get_elements()
//
Any[] anySeq = s1.get_elements();
assertTrue(anySeq.length == 8);
for (i = 0; i < 8; i++) {
Any p = anySeq[i].extract_any();
s = p.extract_short();
assertTrue(s == (short) i);
}
//
// Test: set_elements()
//
anySeq = new Any[3]; // decrease sequence length
for (i = 0; i < 3; i++) {
Any anyVal = orb.create_any();
anyVal.insert_short((short) (i + 10));
anySeq[i] = orb.create_any();
anySeq[i].insert_any(anyVal);
}
s1.set_elements(anySeq);
s1.rewind();
for (i = 0; i < 3; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) (i + 10));
s1.next();
}
//
// Test: get_elements_as_dyn_any()
//
DynAny[] dynAnySeq = s1.get_elements_as_dyn_any();
assertTrue(dynAnySeq.length == 3);
for (i = 0; i < 3; i++) {
av = dynAnySeq[i].get_any();
s = av.extract_short();
assertTrue(s == (short) (i + 10));
}
//
// Test: set_elements_as_dyn_any
//
dynAnySeq = new DynAny[4]; // increase sequence length
for (i = 0; i < 4; i++) {
Any anyVal = orb.create_any();
anyVal.insert_short((short) (i + 100));
any.insert_any(anyVal);
dynAnySeq[i] = factory.create_dyn_any(any);
}
s1.set_elements_as_dyn_any(dynAnySeq);
s1.rewind();
for (i = 0; i < 4; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) (i + 100));
s1.next();
}
for (i = 0; i < 4; i++)
dynAnySeq[i].destroy();
//
// Test: assign
//
seq = new Any[10];
for (i = 0; i < 10; i++) {
seq[i] = orb.create_any();
seq[i].insert_short((short) (i * 10));
}
TestAnySeqHelper.insert(any, seq);
d2 = factory.create_dyn_any(any);
s2 = DynSequenceHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(s1.get_length() == 10);
assertTrue(s1.component_count() == 10);
s1.rewind();
for (i = 0; i < 10; i++) {
av = s1.get_any();
s = av.extract_short();
assertTrue(s == (short) (i * 10));
s1.next();
}
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testStringArray(ORB orb, DynAnyFactory factory) {
try {
int i;
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynArray a1, a2;
String[] arr;
TypeCode type;
//
// Test: initialization
//
type = TestStringArrayHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
a1 = DynArrayHelper.narrow(d1);
assertTrue(a1.component_count() == 10);
for (i = 0; i < 10; i++) {
str = a1.get_string();
assertTrue(str.length() == 0);
String s = "str " + i;
a1.insert_string(s);
a1.next();
}
//
// Test: to_any
//
av = a1.to_any();
arr = TestStringArrayHelper.extract(av);
for (i = 0; i < 10; i++) {
String s = "str " + i;
assertTrue(arr[i].equals(s));
}
//
// Test: copy
//
copy = a1.copy();
assertTrue(a1.equal(copy));
copy.destroy();
//
// Test: equal
//
copy = a1.copy();
copy.seek(1);
copy.insert_string("hi there");
assertTrue(!a1.equal(copy));
copy.destroy();
//
// Test: from_any
//
for (i = 0; i < 10; i++)
arr[i] = "STR " + i;
TestStringArrayHelper.insert(any, arr);
a1.from_any(any);
a1.rewind();
for (i = 0; i < 10; i++) {
str = a1.get_string();
String s = "STR " + i;
assertTrue(str.equals(s));
a1.next();
}
//
// Test: components - ensure that the sequence and its components
// are synchronized
//
a1.rewind();
for (i = 0; i < 10; i++) {
comp = a1.current_component();
str = comp.get_string();
String s = "STR " + i;
assertTrue(str.equals(s));
s = "string " + i;
comp.insert_string(s);
str = a1.get_string();
assertTrue(str.equals(s));
a1.next();
}
//
// Test: get_elements()
//
Any[] anySeq = a1.get_elements();
assertTrue(anySeq.length == 10);
for (i = 0; i < 10; i++) {
String cp = anySeq[i].extract_string();
String s = "string " + i;
assertTrue(cp.equals(s));
}
//
// Test: set_elements()
//
for (i = 0; i < 10; i++) {
String s = "String " + i;
anySeq[i].insert_string(s);
}
a1.set_elements(anySeq);
a1.rewind();
for (i = 0; i < 10; i++) {
str = a1.get_string();
String s = "String " + i;
assertTrue(str.equals(s));
a1.next();
}
//
// Test: get_elements_as_dyn_any()
//
DynAny[] dynAnySeq = a1.get_elements_as_dyn_any();
assertTrue(dynAnySeq.length == 10);
for (i = 0; i < 10; i++) {
str = dynAnySeq[i].get_string();
String s = "String " + i;
assertTrue(str.equals(s));
}
//
// Test: set_elements_as_dyn_any
//
dynAnySeq = new DynAny[10];
for (i = 0; i < 10; i++) {
String s = "STRING " + i;
any.insert_string(s);
dynAnySeq[i] = factory.create_dyn_any(any);
}
a1.set_elements_as_dyn_any(dynAnySeq);
a1.rewind();
for (i = 0; i < 10; i++) {
str = a1.get_string();
String s = "STRING " + i;
assertTrue(str.equals(s));
a1.next();
}
for (i = 0; i < 10; i++)
dynAnySeq[i].destroy();
//
// Test: assign
//
for (i = 0; i < 10; i++)
arr[i] = "Str " + i;
TestStringArrayHelper.insert(any, arr);
d2 = factory.create_dyn_any(any);
a2 = DynArrayHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(a1.component_count() == 10);
a1.rewind();
for (i = 0; i < 10; i++) {
str = a1.get_string();
String s = "Str " + i;
assertTrue(str.equals(s));
a1.next();
}
//
// Test: set_elements() InvalidValue exception
//
try {
anySeq = new Any[4]; // size doesn't match array length
for (i = 0; i < 4; i++) {
String s = "String " + i;
anySeq[i] = orb.create_any();
anySeq[i].insert_string(s);
}
a1.set_elements(anySeq);
assertTrue("set_elements() should not have succeeded" == null);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
assertTrue(a1.component_count() == 10);
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testStructBox(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynValueBox v1, v2;
DynStruct ds;
TestStruct ts = new TestStruct();
TestStruct pts;
TypeCode type;
//
// Test: initialization
//
type = TestStructBoxHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueBoxHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
assertTrue(v1.current_component() == null);
//
// Test: to_any (null)
//
av = d1.to_any();
pts = TestStructBoxHelper.extract(av);
assertTrue(pts == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
//
// Test: equal (null)
//
TestStructBoxHelper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestStructBoxHelper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: get_boxed_value (null)
//
try {
v1.get_boxed_value();
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: get_boxed_value_as_dyn_any (null)
//
try {
v1.get_boxed_value_as_dyn_any();
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: set_boxed_value (TypeMismatch)
//
try {
any.insert_string("hi");
v1.set_boxed_value(any);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: set_boxed_value (InvalidValue)
//
try {
any.type(TestStructHelper.type());
v1.set_boxed_value(any);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: set_boxed_value_as_dyn_any (TypeMismatch)
//
try {
any.insert_long(123);
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d2.destroy();
}
//
// Test: set_to_value
//
assertTrue(v1.is_null());
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 1);
//
// Test: component
//
comp = v1.current_component();
ds = DynStructHelper.narrow(comp);
loadStruct(orb, ts);
TestStructHelper.insert(any, ts);
ds.from_any(any);
//
// Test: to_any
//
av = d1.to_any();
pts = TestStructBoxHelper.extract(av);
checkStruct(pts);
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
//
// Test: equal
//
TestStruct tsbv = new TestStruct();
loadStruct(orb, tsbv);
TestStructBoxHelper.insert(any, tsbv);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: get_boxed_value
//
av = v1.get_boxed_value();
pts = TestStructHelper.extract(av);
checkStruct(pts);
//
// Test: set_boxed_value
//
ts.shortVal = (short) -99;
TestStructHelper.insert(any, ts);
copy = v1.copy();
v1.set_boxed_value(any);
assertTrue(!v1.equal(copy));
copy.destroy();
//
// Test: get_boxed_value_as_dyn_any
//
d2 = v1.get_boxed_value_as_dyn_any();
ds = DynStructHelper.narrow(d2);
//
// Test: set_boxed_value_as_dyn_any
//
TestStructHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
d2.destroy();
//
// Test: assign
//
ts.longVal = -99;
TestStructBoxHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
v2 = DynValueBoxHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 1);
//
// Test: set_boxed_value (from null)
//
v1.set_to_null();
assertTrue(v1.is_null());
ts.shortVal = (short) -99;
TestStructHelper.insert(any, ts);
v1.set_boxed_value(any);
assertTrue(!v1.is_null());
assertTrue(v1.current_component() != null);
//
// Test: set_boxed_value_as_dyn_any (from null)
//
v1.set_to_null();
assertTrue(v1.is_null());
TestStructHelper.insert(any, ts);
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
d2.destroy();
assertTrue(!v1.is_null());
assertTrue(v1.current_component() != null);
//
// Test: seek
//
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(1) == false);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(0);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testStringBox(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
String cp;
DynValueBox v1, v2;
String ptsb;
TypeCode type;
//
// Test: initialization
//
type = TestStringBoxHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueBoxHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
assertTrue(v1.current_component() == null);
//
// Test: to_any (null)
//
av = d1.to_any();
str = TestStringBoxHelper.extract(av);
assertTrue(str == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
//
// Test: equal (null)
//
TestStringBoxHelper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestStringBoxHelper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: get_boxed_value (null)
//
try {
v1.get_boxed_value();
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: get_boxed_value_as_dyn_any (null)
//
try {
v1.get_boxed_value_as_dyn_any();
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: set_boxed_value (TypeMismatch)
//
try {
any.insert_boolean(false);
v1.set_boxed_value(any);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: set_boxed_value (InvalidValue)
//
try {
any.type(orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));
v1.set_boxed_value(any);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
// expected
}
//
// Test: set_boxed_value_as_dyn_any (TypeMismatch)
//
try {
any.insert_long(123);
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
d2.destroy();
}
//
// Test: set_to_value
//
assertTrue(v1.is_null());
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 1);
//
// Test: component
//
comp = v1.current_component();
str = comp.get_string();
assertTrue(str.length() == 0);
any.insert_string("hi");
comp.from_any(any);
//
// Test: to_any
//
av = d1.to_any();
str = TestStringBoxHelper.extract(av);
assertTrue(str.equals("hi"));
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
copy.destroy();
//
// Test: equal
//
TestStringBoxHelper.insert(any, "hi");
d2 = factory.create_dyn_any(any);
assertTrue(d1.equal(d2));
d2.destroy();
//
// Test: get_boxed_value
//
av = v1.get_boxed_value();
assertTrue(av.extract_string().equals("hi"));
//
// Test: set_boxed_value
//
any.insert_string("bye");
copy = v1.copy();
v1.set_boxed_value(any);
assertTrue(!v1.equal(copy));
copy.destroy();
//
// Test: get_boxed_value_as_dyn_any
//
d2 = v1.get_boxed_value_as_dyn_any();
assertTrue(d2.get_string().equals("bye"));
//
// Test: set_boxed_value_as_dyn_any
//
any.insert_string("foo");
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
d2.destroy();
//
// Test: assign
//
TestStringBoxHelper.insert(any, "bar");
d2 = factory.create_dyn_any(any);
v2 = DynValueBoxHelper.narrow(d2);
d1.assign(d2);
assertTrue(d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 1);
//
// Test: set_boxed_value (from null)
//
v1.set_to_null();
assertTrue(v1.is_null());
any.insert_string("foo");
v1.set_boxed_value(any);
assertTrue(!v1.is_null());
assertTrue(v1.current_component() != null);
//
// Test: set_boxed_value_as_dyn_any (from null)
//
v1.set_to_null();
assertTrue(v1.is_null());
any.insert_string("bar");
d2 = factory.create_dyn_any(any);
v1.set_boxed_value_as_dyn_any(d2);
d2.destroy();
assertTrue(!v1.is_null());
assertTrue(v1.current_component() != null);
//
// Test: seek
//
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(1) == false);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(0);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testValue1(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
DynValue v1, v2;
TestValue1 ptv1;
TypeCode type;
//
// Test: initialization
//
type = TestValue1Helper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
//
// Test: to_any (null)
//
av = d1.to_any();
ptv1 = TestValue1Helper.extract(av);
assertTrue(ptv1 == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal (null) - not a reference equality
//
TestValue1Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestValue1Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: set_to_value
//
assertTrue(v1.is_null());
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 0);
//
// Test: current_component TypeMismatch exception
//
try {
comp = v1.current_component();
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
// expected
}
//
// Test: to_any
//
av = d1.to_any();
ptv1 = TestValue1Helper.extract(av);
assertTrue(ptv1 != null);
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal - not a reference equality
//
TestValue1 tv1v = new TestValue1_impl();
TestValue1Helper.insert(any, tv1v);
d2 = factory.create_dyn_any(any);
v2 = DynValueHelper.narrow(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: get_members
//
NameValuePair[] nvpSeq = v1.get_members();
assertTrue(nvpSeq.length == 0);
//
// Test: set_members
//
v1.set_members(nvpSeq);
//
// Test: set_members (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members(nvpSeq);
assertTrue(!v1.is_null());
//
// Test: get_members_as_dyn_any
//
NameDynAnyPair[] ndpSeq = v1.get_members_as_dyn_any();
assertTrue(ndpSeq.length == 0);
//
// Test: set_elements_as_dyn_any
//
ndpSeq = new NameDynAnyPair[0];
v1.set_members_as_dyn_any(ndpSeq);
//
// Test: set_elements_as_dyn_any (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members_as_dyn_any(ndpSeq);
assertTrue(!v1.is_null());
//
// Test: assign
//
tv1v = new TestValue1_impl();
TestValue1Helper.insert(any, tv1v);
d2 = factory.create_dyn_any(any);
v2 = DynValueHelper.narrow(d2);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 0);
//
// Test: seek
//
assertTrue(d1.seek(0) == false);
assertTrue(d1.seek(-1) == false);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == false);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testValue2(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
String cp;
DynValue v1, v2;
TestValue2 ptv2;
short shortVal;
int longVal;
TypeCode type;
//
// Test: initialization
//
type = TestValue2Helper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
//
// Test: to_any (null)
//
av = d1.to_any();
ptv2 = TestValue2Helper.extract(av);
assertTrue(ptv2 == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal (null) - not a reference equality
//
TestValue2Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestValue2Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: set_to_value
//
assertTrue(v1.is_null());
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 3);
//
// Test: components
//
v1.insert_short((short) -55);
v1.next();
v1.insert_long(333);
v1.next();
v1.insert_string("hi there");
//
// Test: to_any
//
av = d1.to_any();
ptv2 = TestValue2Helper.extract(av);
assertTrue(ptv2.shortVal == (short) -55);
assertTrue(ptv2.longVal == 333);
assertTrue(ptv2.stringVal.equals("hi there"));
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal - not a reference equality
//
TestValue2 tv2v = new TestValue2_impl();
tv2v.shortVal = (short) -55;
tv2v.longVal = 333;
tv2v.stringVal = "hi there";
TestValue2Helper.insert(any, tv2v);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: get_members
//
NameValuePair[] nvpSeq = v1.get_members();
assertTrue(nvpSeq.length == 3);
shortVal = nvpSeq[0].value.extract_short();
assertTrue(shortVal == (short) -55);
longVal = nvpSeq[1].value.extract_long();
assertTrue(longVal == 333);
cp = nvpSeq[2].value.extract_string();
assertTrue(cp.equals("hi there"));
//
// Test: set_members
//
nvpSeq[0].value.insert_short((short) 237);
nvpSeq[1].value.insert_long(680580);
nvpSeq[2].value.insert_string("ho there");
v1.set_members(nvpSeq);
//
// Test: set_members (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members(nvpSeq);
assertTrue(!v1.is_null());
//
// Test: get_members_as_dyn_any
//
NameDynAnyPair[] ndpSeq = v1.get_members_as_dyn_any();
assertTrue(ndpSeq.length == 3);
assertTrue(ndpSeq[0].value.get_short() == (short) 237);
assertTrue(ndpSeq[1].value.get_long() == 680580);
str = ndpSeq[2].value.get_string();
assertTrue(str.equals("ho there"));
//
// Test: set_elements_as_dyn_any
//
ndpSeq = new NameDynAnyPair[3];
ndpSeq[0] = new NameDynAnyPair();
ndpSeq[0].id = "shortVal";
any.insert_short((short) 880);
ndpSeq[0].value = factory.create_dyn_any(any);
ndpSeq[1] = new NameDynAnyPair();
ndpSeq[1].id = "longVal";
any.insert_long(280101);
ndpSeq[1].value = factory.create_dyn_any(any);
ndpSeq[2] = new NameDynAnyPair();
ndpSeq[2].id = "stringVal";
any.insert_string("you there");
ndpSeq[2].value = factory.create_dyn_any(any);
v1.set_members_as_dyn_any(ndpSeq);
//
// Test: set_elements_as_dyn_any (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members_as_dyn_any(ndpSeq);
assertTrue(!v1.is_null());
//
// Test: assign
//
tv2v = new TestValue2_impl();
tv2v.shortVal = (short) 880;
tv2v.longVal = 280101;
tv2v.stringVal = "you there";
TestValue2Helper.insert(any, tv2v);
d2 = factory.create_dyn_any(any);
v2 = DynValueHelper.narrow(d2);
assertTrue(!d1.equal(d2));
d2.insert_short((short) 980);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 3);
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testValue3(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
String cp;
DynValue v1, v2;
TestValue3 ptv3;
short shortVal;
long longVal;
test.types.DynAnyTypes.TestUnion4 tu4 = new test.types.DynAnyTypes.TestUnion4();
test.types.DynAnyTypes.TestUnion4 ptu4;
DynUnion u;
TypeCode type;
//
// Test: initialization
//
type = TestValue3Helper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
//
// Test: to_any (null)
//
av = d1.to_any();
ptv3 = TestValue3Helper.extract(av);
assertTrue(ptv3 == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal (null) - not a reference equality
//
TestValue3Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestValue3Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: set_to_value
//
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 4);
//
// Test: components
//
v1.insert_short((short) -55);
v1.next();
v1.insert_long(333);
v1.next();
v1.insert_string("hi there");
v1.next();
comp = v1.current_component();
u = DynUnionHelper.narrow(comp);
u.insert_short((short) 0);
u.next();
u.insert_long(333);
//
// Test: to_any
//
av = d1.to_any();
ptv3 = TestValue3Helper.extract(av);
assertTrue(ptv3.shortVal == (short) -55);
assertTrue(ptv3.longVal == 333);
assertTrue(ptv3.stringVal.equals("hi there"));
assertTrue(ptv3.unionVal.discriminator() == (short) 0);
assertTrue(ptv3.unionVal.a() == 333);
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal - not a reference equality
//
TestValue3 tv3v = new TestValue3_impl();
tv3v.shortVal = (short) -55;
tv3v.longVal = 333;
tv3v.stringVal = "hi there";
tv3v.unionVal = new test.types.DynAnyTypes.TestUnion4();
tv3v.unionVal.a((short) 0, 333);
TestValue3Helper.insert(any, tv3v);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: get_members
//
NameValuePair[] nvpSeq = v1.get_members();
assertTrue(nvpSeq.length == 4);
shortVal = nvpSeq[0].value.extract_short();
assertTrue(shortVal == (short) -55);
longVal = nvpSeq[1].value.extract_long();
assertTrue(longVal == 333);
cp = nvpSeq[2].value.extract_string();
assertTrue(cp.equals("hi there"));
ptu4 = test.types.DynAnyTypes.TestUnion4Helper
.extract(nvpSeq[3].value);
assertTrue(ptu4.a() == 333);
//
// Test: set_members
//
nvpSeq[0].value.insert_short((short) 237);
nvpSeq[1].value.insert_long(680580);
nvpSeq[2].value.insert_string("ho there");
tu4.b(1.99f);
test.types.DynAnyTypes.TestUnion4Helper
.insert(nvpSeq[3].value, tu4);
v1.set_members(nvpSeq);
//
// Test: set_members (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members(nvpSeq);
assertTrue(!v1.is_null());
//
// Test: get_members_as_dyn_any
//
NameDynAnyPair[] ndpSeq = v1.get_members_as_dyn_any();
assertTrue(ndpSeq.length == 4);
assertTrue(ndpSeq[0].value.get_short() == (short) 237);
assertTrue(ndpSeq[1].value.get_long() == 680580);
str = ndpSeq[2].value.get_string();
assertTrue(str.equals("ho there"));
ndpSeq[3].value.seek(1);
assertTrue(ndpSeq[3].value.get_float() < 2.0f);
//
// Test: set_elements_as_dyn_any
//
ndpSeq = new NameDynAnyPair[4];
ndpSeq[0] = new NameDynAnyPair();
ndpSeq[0].id = "shortVal";
any.insert_short((short) 880);
ndpSeq[0].value = factory.create_dyn_any(any);
ndpSeq[1] = new NameDynAnyPair();
ndpSeq[1].id = "longVal";
any.insert_long(280101);
ndpSeq[1].value = factory.create_dyn_any(any);
ndpSeq[2] = new NameDynAnyPair();
ndpSeq[2].id = "stringVal";
any.insert_string("you there");
ndpSeq[2].value = factory.create_dyn_any(any);
ndpSeq[3] = new NameDynAnyPair();
ndpSeq[3].id = "unionVal";
tu4.a(123456);
test.types.DynAnyTypes.TestUnion4Helper.insert(any, tu4);
ndpSeq[3].value = factory.create_dyn_any(any);
v1.set_members_as_dyn_any(ndpSeq);
//
// Test: set_elements_as_dyn_any (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members_as_dyn_any(ndpSeq);
assertTrue(!v1.is_null());
//
// Test: assign
//
tv3v = new TestValue3_impl();
tv3v.shortVal = (short) 880;
tv3v.longVal = 280101;
tv3v.stringVal = "you there";
tv3v.unionVal = new test.types.DynAnyTypes.TestUnion4();
tv3v.unionVal.a(123456);
TestValue3Helper.insert(any, tv3v);
d2 = factory.create_dyn_any(any);
v2 = DynValueHelper.narrow(d2);
assertTrue(!d1.equal(d2));
d2.insert_short((short) 980);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 4);
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testValue4(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
String str;
String cp;
DynValue v1, v2;
TestValue4 ptv4;
short shortVal;
int longVal;
char charVal;
long longlongVal;
TypeCode type;
//
// Test: initialization
//
type = TestValue4Helper.type();
d1 = factory.create_dyn_any_from_type_code(type);
v1 = DynValueHelper.narrow(d1);
assertTrue(v1.is_null());
assertTrue(v1.component_count() == 0);
//
// Test: to_any (null)
//
av = d1.to_any();
ptv4 = TestValue4Helper.extract(av);
assertTrue(ptv4 == null);
//
// Test: copy (null)
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal (null) - not a reference equality
//
TestValue4Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: assign (null)
//
TestValue4Helper.insert(any, null);
d2 = factory.create_dyn_any(any);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.is_null());
//
// Test: set_to_value
//
v1.set_to_value();
assertTrue(!v1.is_null());
assertTrue(v1.component_count() == 5);
//
// Test: components
//
v1.insert_short((short) -55);
v1.next();
v1.insert_long(333);
v1.next();
v1.insert_string("hi there");
v1.next();
v1.insert_char('A');
v1.next();
v1.insert_longlong(7890123L);
//
// Test: to_any
//
av = d1.to_any();
ptv4 = TestValue4Helper.extract(av);
assertTrue(ptv4.shortVal == (short) -55);
assertTrue(ptv4.longVal == 333);
assertTrue(ptv4.stringVal.equals("hi there"));
assertTrue(ptv4.charVal == 'A');
assertTrue(ptv4.longlongVal == 7890123L);
//
// Test: copy
//
copy = d1.copy();
assertTrue(d1.equal(copy));
// destroying copy would also destroy d1
// copy.destroy();
//
// Test: equal - not a reference equality
//
TestValue4 tv4v = new TestValue4_impl();
tv4v.shortVal = (short) -55;
tv4v.longVal = 333;
tv4v.stringVal = "hi there";
tv4v.charVal = 'A';
tv4v.longlongVal = 7890123L;
TestValue4Helper.insert(any, tv4v);
d2 = factory.create_dyn_any(any);
assertTrue(!d1.equal(d2));
d2.destroy();
//
// Test: get_members
//
NameValuePair[] nvpSeq = v1.get_members();
assertTrue(nvpSeq.length == 5);
shortVal = nvpSeq[0].value.extract_short();
assertTrue(shortVal == (short) -55);
longVal = nvpSeq[1].value.extract_long();
assertTrue(longVal == 333);
cp = nvpSeq[2].value.extract_string();
assertTrue(cp.equals("hi there"));
charVal = nvpSeq[3].value.extract_char();
assertTrue(charVal == 'A');
longlongVal = nvpSeq[4].value.extract_longlong();
assertTrue(longlongVal == 7890123L);
//
// Test: set_members
//
nvpSeq[0].value.insert_short((short) 237);
nvpSeq[1].value.insert_long(680580);
nvpSeq[2].value.insert_string("ho there");
nvpSeq[3].value.insert_char('Z');
nvpSeq[4].value.insert_longlong(1237890L);
v1.set_members(nvpSeq);
//
// Test: set_members (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members(nvpSeq);
assertTrue(!v1.is_null());
//
// Test: get_members_as_dyn_any
//
NameDynAnyPair[] ndpSeq = v1.get_members_as_dyn_any();
assertTrue(ndpSeq.length == 5);
assertTrue(ndpSeq[0].value.get_short() == (short) 237);
assertTrue(ndpSeq[1].value.get_long() == 680580);
str = ndpSeq[2].value.get_string();
assertTrue(str.equals("ho there"));
assertTrue(ndpSeq[3].value.get_char() == 'Z');
assertTrue(ndpSeq[4].value.get_longlong() == 1237890L);
//
// Test: set_elements_as_dyn_any
//
ndpSeq = new NameDynAnyPair[5];
ndpSeq[0] = new NameDynAnyPair();
ndpSeq[0].id = "shortVal";
any.insert_short((short) 880);
ndpSeq[0].value = factory.create_dyn_any(any);
ndpSeq[1] = new NameDynAnyPair();
ndpSeq[1].id = "longVal";
any.insert_long(280101);
ndpSeq[1].value = factory.create_dyn_any(any);
ndpSeq[2] = new NameDynAnyPair();
ndpSeq[2].id = "stringVal";
any.insert_string("you there");
ndpSeq[2].value = factory.create_dyn_any(any);
ndpSeq[3] = new NameDynAnyPair();
ndpSeq[3].id = "charVal";
any.insert_char('!');
ndpSeq[3].value = factory.create_dyn_any(any);
ndpSeq[4] = new NameDynAnyPair();
ndpSeq[4].id = "longlongVal";
any.insert_longlong(44556677L);
ndpSeq[4].value = factory.create_dyn_any(any);
v1.set_members_as_dyn_any(ndpSeq);
//
// Test: set_elements_as_dyn_any (null)
//
v1.set_to_null();
assertTrue(v1.is_null());
v1.set_members_as_dyn_any(ndpSeq);
assertTrue(!v1.is_null());
//
// Test: assign
//
tv4v = new TestValue4_impl();
tv4v.shortVal = (short) 880;
tv4v.longVal = 280101;
tv4v.stringVal = "you there";
tv4v.charVal = '!';
tv4v.longlongVal = 44556677L;
TestValue4Helper.insert(any, tv4v);
d2 = factory.create_dyn_any(any);
v2 = DynValueHelper.narrow(d2);
assertTrue(!d1.equal(d2));
d2.insert_short((short) 980);
d1.assign(d2);
assertTrue(!d1.equal(d2));
d2.destroy();
assertTrue(v1.component_count() == 5);
//
// Test: seek
//
int count = d1.component_count();
assertTrue(d1.seek(0) == true);
assertTrue(d1.seek(-1) == false);
assertTrue(d1.seek(count) == false);
assertTrue(d1.seek(count - 1) == true);
//
// Test: next
//
d1.seek(-1);
assertTrue(d1.next() == true);
d1.seek(count - 1);
assertTrue(d1.next() == false);
//
// Test: current_component
//
d1.rewind();
d2 = d1.current_component();
assertTrue(d2 != null);
//
// Test: destroy
//
d2.destroy(); // should do nothing because it's a child
d2.destroy(); // ditto
//
// Test: current_component
//
d1.seek(-9);
d2 = d1.current_component();
assertTrue(d2 == null);
d1.destroy();
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
static void testValueStruct(ORB orb, DynAnyFactory factory) {
try {
Any any = orb.create_any();
Any av;
DynAny d1, d2, comp, copy;
DynValue dv;
String str;
TypeCode type;
//
// Test: initialization
//
type = TestValueStructHelper.type();
d1 = factory.create_dyn_any_from_type_code(type);
assertTrue(d1.component_count() == 2);
//
// Test: components
//
d1.insert_string("name");
d1.next();
comp = d1.current_component();
dv = DynValueHelper.narrow(comp);
assertTrue(dv.is_null());
dv.set_to_value();
comp.insert_short((short) -55);
comp.next();
comp.insert_long(333);
comp.next();
comp.insert_string("hi there");
//
// Test: get_val()
//
java.io.Serializable vb = d1.get_val();
TestValue2 ptv2 = null;
try {
ptv2 = (TestValue2) vb;
} catch (ClassCastException ex) {
assertTrue(false);
}
assertTrue(ptv2.shortVal == (short) -55);
assertTrue(ptv2.longVal == 333);
assertTrue(ptv2.stringVal.equals("hi there"));
//
// Test: insert_val()
//
TestValue4 tv4 = new TestValue4_impl();
tv4.shortVal = (short) -77;
tv4.longVal = 555;
tv4.stringVal = "ho there";
tv4.charVal = 'Z';
tv4.longlongVal = 9876543L;
d1.insert_val(tv4);
//
// Test: get_val() - The TestValue4 value should have been
// truncated to TestValue2
//
comp = d1.current_component();
assertTrue(comp.component_count() == 3);
comp.rewind();
assertTrue(comp.get_short() == (short) -77);
comp.next();
assertTrue(comp.get_long() == 555);
comp.next();
str = comp.get_string();
assertTrue(str.equals("ho there"));
vb = d1.get_val();
try {
ptv2 = (TestValue2) vb;
} catch (ClassCastException ex) {
assertTrue(false);
}
try {
TestValue4 ptv4 = (TestValue4) vb;
assertTrue(false);
} catch (ClassCastException ex) {
// expected
}
} catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
assertTrue(false);
} catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
assertTrue(false);
}
}
public TestDynAny(ORB orb) {
org.omg.CORBA.Object obj = null;
try {
obj = orb.resolve_initial_references("DynAnyFactory");
assertTrue(obj != null);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
assertTrue(false);
}
//
// Register valuetype factories
//
org.omg.CORBA_2_3.ORB orb_2_3 = (org.omg.CORBA_2_3.ORB) orb;
//
// NOTE: It's not necessary to register the valuebox factories in Java
//
orb_2_3.register_value_factory(TestValue1Helper.id(),
new TestValue1Factory_impl());
orb_2_3.register_value_factory(TestValue2Helper.id(),
new TestValue2Factory_impl());
orb_2_3.register_value_factory(TestValue3Helper.id(),
new TestValue3Factory_impl());
orb_2_3.register_value_factory(TestValue4Helper.id(),
new TestValue4Factory_impl());
DynAnyFactory factory = DynAnyFactoryHelper.narrow(obj);
testBasic(orb, factory);
testFixed(orb, factory);
testEnum(orb, factory);
testStruct(orb, factory);
testException(orb, factory);
testUnion1(orb, factory);
testUnion2(orb, factory);
testUnion3(orb, factory);
testUnion4(orb, factory);
testShortSeq(orb, factory);
testBoundedString10Seq(orb, factory);
testAnySeq(orb, factory);
testStringArray(orb, factory);
testStructBox(orb, factory);
testStringBox(orb, factory);
testValue1(orb, factory);
testValue2(orb, factory);
testValue3(orb, factory);
testValue4(orb, factory);
testValueStruct(orb, factory);
}
public static void main(String args[]) {
java.util.Properties props = new Properties();
props.putAll(System.getProperties());
props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
props.put("org.omg.CORBA.ORBSingletonClass",
"org.apache.yoko.orb.CORBA.ORBSingleton");
int status = 0;
org.omg.CORBA.ORB orb = null;
try {
//
// Create ORB
//
orb = org.omg.CORBA.ORB.init(args, props);
TYPECODE_VALUE = orb.get_primitive_tc(TCKind.tk_float);
//
// Run tests
//
new TestDynAny(orb);
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,526 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion3.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion3:1.0
//
/***/
final public class TestUnion3 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
char _ob_d_;
static boolean
_OB_check(char d0, char d1)
{
char d[] = new char[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case 'a':
case 'b':
d[i] = 'a';
break;
case 'c':
break;
case 'd':
break;
case 'x':
break;
default:
d[i] = '\0';
break;
}
}
return d[0] == d[1];
}
public
TestUnion3()
{
_ob_i_ = false;
}
public char
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public char
c()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 'a'))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.CharHolder)_ob_v_).value;
}
public void
c(char val)
{
_ob_i_ = true;
_ob_d_ = 'a';
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
public void
c(char d, char val)
{
if(!_OB_check(d, 'a'))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
public org.omg.CORBA.Any
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 'c'))
throw new org.omg.CORBA.BAD_OPERATION();
return (org.omg.CORBA.Any)_ob_v_;
}
public void
a(org.omg.CORBA.Any val)
{
_ob_i_ = true;
_ob_d_ = 'c';
_ob_v_ = val;
}
public String[][]
ar()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 'd'))
throw new org.omg.CORBA.BAD_OPERATION();
return (String[][])_ob_v_;
}
public void
ar(String[][] val)
{
_ob_i_ = true;
_ob_d_ = 'd';
_ob_v_ = val;
}
public String
s()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 'x'))
throw new org.omg.CORBA.BAD_OPERATION();
return (String)_ob_v_;
}
public void
s(String val)
{
_ob_i_ = true;
_ob_d_ = 'x';
_ob_v_ = val;
}
public void
__default()
{
_ob_i_ = true;
_ob_d_ = '\0';
_ob_v_ = null;
}
public void
__default(char d)
{
if(!_OB_check(d, '\0'))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = null;
}
}
| 5,527 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestAny.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
import static org.junit.Assert.assertTrue;
import java.math.*;
import java.util.Properties;
import org.omg.CORBA.*;
public class TestAny extends test.common.TestBase {
public TestAny(ORB orb) {
Any any = orb.create_any();
Any anyEq = orb.create_any();
int i;
{
short v = -32768;
short vSave = v;
any.insert_short(v);
v = any.extract_short();
assertTrue(v == vSave);
anyEq.insert_short(v);
assertTrue(any.equal(anyEq));
}
{
short v = (short) 65535;
short vSave = v;
any.insert_ushort(v);
v = any.extract_ushort();
assertTrue(v == vSave);
anyEq.insert_ushort(v);
assertTrue(any.equal(anyEq));
}
{
int v = -2147483647 - 1;
int vSave = v;
any.insert_long(v);
v = any.extract_long();
assertTrue(v == vSave);
anyEq.insert_long(v);
assertTrue(any.equal(anyEq));
}
{
int v = 2147483647;
int vSave = v;
any.insert_ulong(v);
v = any.extract_ulong();
assertTrue(v == vSave);
anyEq.insert_ulong(v);
assertTrue(any.equal(anyEq));
}
{
long v = -9223372036854775807L - 1;
long vSave = v;
any.insert_longlong(v);
v = any.extract_longlong();
assertTrue(v == vSave);
anyEq.insert_longlong(v);
assertTrue(any.equal(anyEq));
}
{
long v = 9223372036854775807L;
long vSave = v;
any.insert_ulonglong(v);
v = any.extract_ulonglong();
assertTrue(v == vSave);
anyEq.insert_ulonglong(v);
assertTrue(any.equal(anyEq));
}
{
float v = (float) 1.23456789;
float vSave = v;
any.insert_float(v);
v = any.extract_float();
assertTrue(v == vSave);
anyEq.insert_float(v);
assertTrue(any.equal(anyEq));
}
{
double v = 1E200;
double vSave = v;
any.insert_double(v);
v = any.extract_double();
assertTrue(v == vSave);
anyEq.insert_double(v);
assertTrue(any.equal(anyEq));
}
{
byte v = (byte) 0xff;
byte vSave = v;
any.insert_octet(v);
v = any.extract_octet();
assertTrue(v == vSave);
anyEq.insert_octet(v);
assertTrue(any.equal(anyEq));
}
{
char v = 'x';
char vSave = v;
any.insert_char(v);
v = any.extract_char();
assertTrue(v == vSave);
anyEq.insert_char(v);
assertTrue(any.equal(anyEq));
}
{
char v = 'x';
char vSave = v;
any.insert_wchar(v);
v = any.extract_wchar();
assertTrue(v == vSave);
anyEq.insert_wchar(v);
assertTrue(any.equal(anyEq));
}
{
boolean v = true;
boolean vSave = v;
any.insert_boolean(v);
v = any.extract_boolean();
assertTrue(v == vSave);
anyEq.insert_boolean(v);
assertTrue(any.equal(anyEq));
}
{
String v = "Hello";
String vSave = v;
any.insert_string(v);
v = any.extract_string();
assertTrue(v.equals(vSave));
anyEq.insert_string(v);
assertTrue(any.equal(anyEq));
}
{
String v = "Hello";
String vSave = v;
any.insert_wstring(v);
v = any.extract_wstring();
assertTrue(v.equals(vSave));
anyEq.insert_wstring(v);
assertTrue(any.equal(anyEq));
}
{
BigDecimal v1 = new BigDecimal("-123456789");
BigDecimal v1Save = v1;
any.insert_fixed(v1, orb.create_fixed_tc((short) 24, (short) 0));
v1 = any.extract_fixed();
assertTrue(v1.compareTo(v1Save) == 0);
anyEq.insert_fixed(v1, orb.create_fixed_tc((short) 24, (short) 0));
assertTrue(any.equal(anyEq));
BigDecimal v2 = new BigDecimal("1.23456789");
BigDecimal v2Save = v2;
any.insert_fixed(v2, orb.create_fixed_tc((short) 24, (short) 8));
v2 = any.extract_fixed();
assertTrue(v2.compareTo(v2Save) == 0);
anyEq.insert_fixed(v2, orb.create_fixed_tc((short) 24, (short) 8));
assertTrue(any.equal(anyEq));
}
{
double v = 1E200;
double vSave = v;
Any any2 = orb.create_any();
Any any3 = orb.create_any();
Any any4 = orb.create_any();
Any any5;
Any any6;
Any any7;
any.insert_double(v);
any2.insert_any(any);
any3.insert_any(any2);
any4.insert_any(any3);
any5 = any4.extract_any();
any6 = any5.extract_any();
any7 = any6.extract_any();
v = any7.extract_double();
assertTrue(v == vSave);
anyEq.insert_any(any3);
assertTrue(any4.equal(anyEq));
}
{
String v = "Hello world!";
String vSave = v;
Any any2 = orb.create_any();
Any any3 = orb.create_any();
Any any4 = orb.create_any();
Any any5;
Any any6;
Any any7;
any.insert_string(v);
any2.insert_any(any);
any3.insert_any(any2);
any4.insert_any(any3);
any5 = any4.extract_any();
any6 = any5.extract_any();
any7 = any6.extract_any();
v = any7.extract_string();
assertTrue(v.equals(vSave));
anyEq.insert_any(any3);
assertTrue(any4.equal(anyEq));
}
{
char v = '*';
char vSave = v;
Any any2 = orb.create_any();
Any any3 = orb.create_any();
Any any4 = orb.create_any();
Any any5;
Any any6;
Any any7;
any.insert_char(v);
any2.insert_any(any);
any3.insert_any(any2);
any4.insert_any(any3);
any5 = any4.extract_any();
any6 = any5.extract_any();
any7 = any6.extract_any();
v = any7.extract_char();
assertTrue(v == vSave);
anyEq.insert_any(any3);
assertTrue(any4.equal(anyEq));
}
{
TestStruct1 v = new TestStruct1();
v.s = -32768;
v.l = -2147483647 - 1;
v.d = 1E200;
v.b = true;
v.c = 'x';
v.o = (byte) 0xff;
v.str = "abc";
TestStruct1 vSave = v;
TestStruct1Helper.insert(any, v);
v = TestStruct1Helper.extract(any);
assertTrue(v.s == vSave.s);
assertTrue(v.l == vSave.l);
assertTrue(v.d == vSave.d);
assertTrue(v.c == vSave.c);
assertTrue(v.b == vSave.b);
assertTrue(v.o == vSave.o);
assertTrue(v.str.equals(vSave.str));
TestStruct1Helper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
TestStruct2 v2 = new TestStruct2();
v2.da = new double[10][20][30];
v2.sa = new String[100];
for (i = 0; i < 100; i++)
v2.sa[i] = "";
v2.s = v;
v2.a = any;
v2.da[0][0][0] = 1.23;
v2.da[2][3][4] = -1.11;
v2.sa[50] = "Hi!";
Any any2 = orb.create_any();
TestStruct2Helper.insert(any2, v2);
v2 = TestStruct2Helper.extract(any2);
assertTrue(v2.s.s == vSave.s);
assertTrue(v2.s.l == vSave.l);
assertTrue(v2.s.d == vSave.d);
assertTrue(v2.s.c == vSave.c);
assertTrue(v2.s.b == vSave.b);
assertTrue(v2.s.o == vSave.o);
assertTrue(v2.s.str.equals(vSave.str));
assertTrue(v2.da[0][0][0] == 1.23);
assertTrue(v2.da[2][3][4] == -1.11);
assertTrue(v2.sa[50].equals("Hi!"));
v = TestStruct1Helper.extract(v2.a);
assertTrue(v.s == vSave.s);
assertTrue(v.l == vSave.l);
assertTrue(v.d == vSave.d);
assertTrue(v.c == vSave.c);
assertTrue(v.b == vSave.b);
assertTrue(v.o == vSave.o);
assertTrue(v.str.equals(vSave.str));
TestStruct2Helper.insert(anyEq, v2);
assertTrue(any2.equal(anyEq));
}
{
TestEnum v = TestEnum.B;
TestEnumHelper.insert(any, v);
v = TestEnumHelper.extract(any);
assertTrue(v == TestEnum.B);
TestEnumHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
byte[] v;
byte o;
v = new byte[100];
for (o = 0; o < 100; o++)
v[o] = o;
OctetSeqHelper.insert(any, v);
v = OctetSeqHelper.extract(any);
for (o = 0; o < 100; o++)
assertTrue(v[o] == o);
OctetSeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
double d;
for (i = 0, d = 0; d < 10; i++, d += 0.1)
;
double[] v = new double[i];
for (i = 0, d = 0; d < 10; i++, d += 0.1)
v[i] = d;
DoubleSeqHelper.insert(any, v);
double[] v2 = DoubleSeqHelper.extract(any);
for (i = 0, d = 0; d < 10; i++, d += 0.1)
assertTrue(v2[i] == v[i]);
DoubleSeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
double[] v = new double[10];
for (i = 0; i < 10; i++)
v[i] = (double) i;
Double10SeqHelper.insert(any, v);
double[] v2 = Double10SeqHelper.extract(any);
for (i = 0; i < 10; i++)
assertTrue(v2[i] == v[i]);
Double10SeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
char[] v;
char o;
v = new char[100];
for (o = 0; o < 100; o++)
v[o] = o;
CharSeqHelper.insert(any, v);
v = CharSeqHelper.extract(any);
for (o = 0; o < 100; o++)
assertTrue(v[o] == o);
CharSeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
String[] v = new String[40];
for (i = 0; i < 40; i++)
v[i] = "abc";
String40SeqHelper.insert(any, v);
v = String40SeqHelper.extract(any);
for (i = 0; i < 40; i++)
assertTrue(v[i].equals("abc"));
String40SeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
TestStruct1[] v = new TestStruct1[2];
v[0] = new TestStruct1();
v[0].s = -32768;
v[0].l = -2147483647 - 1;
v[0].d = 1E200;
v[0].b = true;
v[0].c = 'x';
v[0].o = (byte) 0xff;
v[0].str = "Hi!";
v[1] = new TestStruct1();
v[1].s = 32767;
v[1].l = 2147483647;
v[1].d = -1E200;
v[1].b = false;
v[1].c = 'y';
v[1].o = (byte) 0x12;
v[1].str = "Bye!";
TestStruct1[] vSave = v;
TestStruct1SeqHelper.insert(any, v);
v = TestStruct1SeqHelper.extract(any);
assertTrue(v[0].s == vSave[0].s);
assertTrue(v[0].l == vSave[0].l);
assertTrue(v[0].d == vSave[0].d);
assertTrue(v[0].b == vSave[0].b);
assertTrue(v[0].c == vSave[0].c);
assertTrue(v[0].o == vSave[0].o);
assertTrue(v[0].str.equals(vSave[0].str));
assertTrue(v[1].s == vSave[1].s);
assertTrue(v[1].l == vSave[1].l);
assertTrue(v[1].d == vSave[1].d);
assertTrue(v[1].b == vSave[1].b);
assertTrue(v[1].c == vSave[1].c);
assertTrue(v[1].o == vSave[1].o);
assertTrue(v[1].str.equals(vSave[1].str));
TestStruct1SeqHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
double v[][][] = new double[10][20][30];
v[0][0][0] = -999;
v[1][2][3] = 1.23;
v[9][19][29] = 9.1929;
DoubleArrayHelper.insert(any, v);
v = DoubleArrayHelper.extract(any);
assertTrue(v[0][0][0] == -999);
assertTrue(v[1][2][3] == 1.23);
assertTrue(v[9][19][29] == 9.1929);
DoubleArrayHelper.insert(anyEq, v);
assertTrue(any.equal(anyEq));
}
{
TypeCode tc;
any.insert_TypeCode(TestStruct1Helper.type());
tc = any.extract_TypeCode();
assertTrue(tc.equal(TestStruct1Helper.type()));
anyEq.insert_TypeCode(TestStruct1Helper.type());
assertTrue(any.equal(anyEq));
}
}
public static void main(String args[]) {
java.util.Properties props = new Properties();
props.putAll(System.getProperties());
props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
props.put("org.omg.CORBA.ORBSingletonClass",
"org.apache.yoko.orb.CORBA.ORBSingleton");
int status = 0;
org.omg.CORBA.ORB orb = null;
try {
//
// Create ORB
//
String[] a = null;
orb = org.omg.CORBA.ORB.init(a, props);
//
// Run tests
//
System.out.print("Testing any type... ");
System.out.flush();
new TestAny(orb);
System.out.println("Done!");
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,528 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/MeasurementHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:Measurement:1.0
//
final public class MeasurementHolder implements org.omg.CORBA.portable.Streamable
{
public Measurement value;
public
MeasurementHolder()
{
}
public
MeasurementHolder(Measurement initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = MeasurementHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
MeasurementHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return MeasurementHelper.type();
}
}
| 5,529 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/OctetSeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:OctetSeq:1.0
//
final public class OctetSeqHelper
{
public static void
insert(org.omg.CORBA.Any any, byte[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static byte[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "OctetSeq", orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_octet)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:OctetSeq:1.0";
}
public static byte[]
read(org.omg.CORBA.portable.InputStream in)
{
byte[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new byte[len0];
in.read_octet_array(_ob_v, 0, len0);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, byte[] val)
{
int len0 = val.length;
out.write_ulong(len0);
out.write_octet_array(val, 0, len0);
}
}
| 5,530 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestStruct4.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestStruct4:1.0
//
/***/
final public class TestStruct4 implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:TestStruct4:1.0";
public
TestStruct4()
{
}
public
TestStruct4(TestStruct3 a,
TestStruct3[] b)
{
this.a = a;
this.b = b;
}
public TestStruct3 a;
public TestStruct3[] b;
}
| 5,531 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestEnumSeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestEnumSeq:1.0
//
final public class TestEnumSeqHelper
{
public static void
insert(org.omg.CORBA.Any any, TestEnum[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestEnum[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestEnumSeq", orb.create_sequence_tc(0, TestEnumHelper.type()));
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestEnumSeq:1.0";
}
public static TestEnum[]
read(org.omg.CORBA.portable.InputStream in)
{
TestEnum[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new TestEnum[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v[i0] = TestEnumHelper.read(in);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestEnum[] val)
{
int len0 = val.length;
out.write_ulong(len0);
for(int i0 = 0; i0 < len0; i0++)
TestEnumHelper.write(out, val[i0]);
}
}
| 5,532 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstInterfaceOperations.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestConstInterface:1.0
//
/***/
public interface TestConstInterfaceOperations
{
//
// IDL:TestConstInterface/ConstLong:1.0
//
/***/
int ConstLong = (int)(61454L);
//
// IDL:TestConstInterface/ConstULong:1.0
//
/***/
int ConstULong = (int)(4294967295L);
//
// IDL:TestConstInterface/ConstChar0:1.0
//
/***/
char ConstChar0 = '\0';
//
// IDL:TestConstInterface/ConstChar1:1.0
//
/***/
char ConstChar1 = 'c';
//
// IDL:TestConstInterface/ConstChar2:1.0
//
/***/
char ConstChar2 = '\n';
//
// IDL:TestConstInterface/ConstChar3:1.0
//
/***/
char ConstChar3 = '\377';
//
// IDL:TestConstInterface/ConstChar4:1.0
//
/***/
char ConstChar4 = '\210';
//
// IDL:TestConstInterface/ConstChar5:1.0
//
/***/
char ConstChar5 = '\'';
//
// IDL:TestConstInterface/ConstWChar:1.0
//
/***/
char ConstWChar = 'Z';
//
// IDL:TestConstInterface/ConstString:1.0
//
/***/
String ConstString = "\n\t\013\b\r\f\007\\?\'\"\377\377\007";
//
// IDL:TestConstInterface/ConstWString:1.0
//
/***/
String ConstWString = "\n\t\013\b\r\f\007\\?\'\"\377\377\007";
//
// IDL:TestConstInterface/ConstEnum:1.0
//
/***/
Measurement ConstEnum = Measurement.FEET;
}
| 5,533 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion1Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion1:1.0
//
final public class TestUnion1Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion1 value;
public
TestUnion1Holder()
{
}
public
TestUnion1Holder(TestUnion1 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion1Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion1Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion1Helper.type();
}
}
| 5,534 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/OctetSeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:OctetSeq:1.0
//
final public class OctetSeqHolder implements org.omg.CORBA.portable.Streamable
{
public byte[] value;
public
OctetSeqHolder()
{
}
public
OctetSeqHolder(byte[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = OctetSeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
OctetSeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return OctetSeqHelper.type();
}
}
| 5,535 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestEnumSeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestEnumSeq:1.0
//
final public class TestEnumSeqHolder implements org.omg.CORBA.portable.Streamable
{
public TestEnum[] value;
public
TestEnumSeqHolder()
{
}
public
TestEnumSeqHolder(TestEnum[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestEnumSeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestEnumSeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestEnumSeqHelper.type();
}
}
| 5,536 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion1Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion1:1.0
//
final public class TestUnion1Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion1 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion1
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[10];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "l";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[0].label = orb.create_any();
members[0].label.insert_long((int)(-1L));
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "a";
members[1].type = DoubleArrayHelper.type();
members[1].label = orb.create_any();
members[1].label.insert_long((int)(-2L));
members[2] = new org.omg.CORBA.UnionMember();
members[2].name = "s";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[2].label = orb.create_any();
members[2].label.insert_long((int)(-3L));
members[3] = new org.omg.CORBA.UnionMember();
members[3].name = "str";
members[3].type = TestStruct2Helper.type();
members[3].label = orb.create_any();
members[3].label.insert_long((int)(0L));
members[4] = new org.omg.CORBA.UnionMember();
members[4].name = "str";
members[4].type = TestStruct2Helper.type();
members[4].label = orb.create_any();
members[4].label.insert_long((int)(1L));
members[5] = new org.omg.CORBA.UnionMember();
members[5].name = "str";
members[5].type = TestStruct2Helper.type();
members[5].label = orb.create_any();
members[5].label.insert_long((int)(2L));
members[6] = new org.omg.CORBA.UnionMember();
members[6].name = "str";
members[6].type = TestStruct2Helper.type();
members[6].label = orb.create_any();
members[6].label.insert_long((int)(3L));
members[7] = new org.omg.CORBA.UnionMember();
members[7].name = "str";
members[7].type = TestStruct2Helper.type();
members[7].label = orb.create_any();
members[7].label.insert_long((int)(-4L));
members[8] = new org.omg.CORBA.UnionMember();
members[8].name = "str";
members[8].type = TestStruct2Helper.type();
members[8].label = orb.create_any();
members[8].label.insert_long((int)(-5L));
members[9] = new org.omg.CORBA.UnionMember();
members[9].name = "tc";
members[9].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode);
members[9].label = orb.create_any();
members[9].label.insert_octet((byte)0);
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
typeCode_ = orb.create_union_tc(id(), "TestUnion1", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestUnion1:1.0";
}
public static TestUnion1
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion1 _ob_v = new TestUnion1();
int _ob_d;
_ob_d = in.read_long();
switch(_ob_d)
{
case -1:
{
int _ob_m;
_ob_m = in.read_long();
_ob_v.l(_ob_m);
break;
}
case -2:
{
double[][][] _ob_m;
_ob_m = DoubleArrayHelper.read(in);
_ob_v.a(_ob_m);
break;
}
case -3:
{
String _ob_m;
_ob_m = in.read_string();
_ob_v.s(_ob_m);
break;
}
case 0:
case 1:
case 2:
case 3:
case -4:
case -5:
{
TestStruct2 _ob_m;
_ob_m = TestStruct2Helper.read(in);
_ob_v.str(_ob_d, _ob_m);
break;
}
default:
{
org.omg.CORBA.TypeCode _ob_m;
_ob_m = in.read_TypeCode();
_ob_v.tc(_ob_d, _ob_m);
break;
}
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion1 val)
{
int _ob_d = val.discriminator();
out.write_long(_ob_d);
switch(_ob_d)
{
case -1:
{
int _ob_m = val.l();
out.write_long(_ob_m);
break;
}
case -2:
{
double[][][] _ob_m = val.a();
DoubleArrayHelper.write(out, _ob_m);
break;
}
case -3:
{
String _ob_m = val.s();
out.write_string(_ob_m);
break;
}
case 0:
case 1:
case 2:
case 3:
case -4:
case -5:
{
TestStruct2 _ob_m = val.str();
TestStruct2Helper.write(out, _ob_m);
break;
}
default:
{
org.omg.CORBA.TypeCode _ob_m = val.tc();
out.write_TypeCode(_ob_m);
break;
}
}
}
}
| 5,537 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion4.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion4:1.0
//
/***/
final public class TestUnion4 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
short _ob_d_;
static boolean
_OB_check(short d0, short d1)
{
short d[] = new short[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case (short)0:
break;
case (short)1:
break;
default:
d[i] = (short)2;
break;
}
}
return d[0] == d[1];
}
public
TestUnion4()
{
_ob_i_ = false;
}
public short
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public TestUnion4[]
seq()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)0))
throw new org.omg.CORBA.BAD_OPERATION();
return (TestUnion4[])_ob_v_;
}
public void
seq(TestUnion4[] val)
{
_ob_i_ = true;
_ob_d_ = (short)0;
_ob_v_ = val;
}
public char
c()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)1))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.CharHolder)_ob_v_).value;
}
public void
c(char val)
{
_ob_i_ = true;
_ob_d_ = (short)1;
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
public void
__default()
{
_ob_i_ = true;
_ob_d_ = (short)2;
_ob_v_ = null;
}
public void
__default(short d)
{
if(!_OB_check(d, (short)2))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = null;
}
}
| 5,538 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/MeasurementHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:Measurement:1.0
//
final public class MeasurementHelper
{
public static void
insert(org.omg.CORBA.Any any, Measurement val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static Measurement
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
String[] members = new String[3];
members[0] = "FEET";
members[1] = "METERS";
members[2] = "FURLONGS";
typeCode_ = orb.create_enum_tc(id(), "Measurement", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:Measurement:1.0";
}
public static Measurement
read(org.omg.CORBA.portable.InputStream in)
{
Measurement _ob_v;
_ob_v = Measurement.from_int(in.read_ulong());
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Measurement val)
{
out.write_ulong(val.value());
}
}
| 5,539 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstLong.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstLong:1.0
//
/***/
public interface ConstLong
{
int value = (int)(-1234L);
}
| 5,540 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion4Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion4:1.0
//
final public class TestUnion4Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion4 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion4
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[2];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "seq";
org.omg.CORBA.TypeCode content0;
content0 = orb.create_recursive_tc(id());
members[0].type = orb.create_sequence_tc(0, content0);
members[0].label = orb.create_any();
members[0].label.insert_short((short)(0L));
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "c";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[1].label = orb.create_any();
members[1].label.insert_short((short)(1L));
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
typeCode_ = orb.create_union_tc(id(), "TestUnion4", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestUnion4:1.0";
}
public static TestUnion4
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion4 _ob_v = new TestUnion4();
short _ob_d;
_ob_d = in.read_short();
switch(_ob_d)
{
case (short)0:
{
TestUnion4[] _ob_m;
int len0 = in.read_ulong();
_ob_m = new TestUnion4[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_m[i0] = TestUnion4Helper.read(in);
_ob_v.seq(_ob_m);
break;
}
case (short)1:
{
char _ob_m;
_ob_m = in.read_char();
_ob_v.c(_ob_m);
break;
}
default:
_ob_v.__default(_ob_d);
break;
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion4 val)
{
short _ob_d = val.discriminator();
out.write_short(_ob_d);
switch(_ob_d)
{
case (short)0:
{
TestUnion4[] _ob_m = val.seq();
int len0 = _ob_m.length;
out.write_ulong(len0);
for(int i0 = 0; i0 < len0; i0++)
TestUnion4Helper.write(out, _ob_m[i0]);
break;
}
case (short)1:
{
char _ob_m = val.c();
out.write_char(_ob_m);
break;
}
default:
break;
}
}
}
| 5,541 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion5.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion5:1.0
//
/***/
final public class TestUnion5 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
long _ob_d_;
static boolean
_OB_check(long d0, long d1)
{
long d[] = new long[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
if(d[i] == -42L)
;
else if(d[i] == 100000L ||
d[i] == 50000000L)
d[i] = 100000L;
else
d[i] = 0L;
}
return d[0] == d[1];
}
public
TestUnion5()
{
_ob_i_ = false;
}
public long
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public org.omg.CORBA.Any
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, -42L))
throw new org.omg.CORBA.BAD_OPERATION();
return (org.omg.CORBA.Any)_ob_v_;
}
public void
a(org.omg.CORBA.Any val)
{
_ob_i_ = true;
_ob_d_ = -42L;
_ob_v_ = val;
}
public char
c()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 100000L))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.CharHolder)_ob_v_).value;
}
public void
c(char val)
{
_ob_i_ = true;
_ob_d_ = 100000L;
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
public void
c(long d, char val)
{
if(!_OB_check(d, 100000L))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
public String
f()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 0L))
throw new org.omg.CORBA.BAD_OPERATION();
return (String)_ob_v_;
}
public void
f(String val)
{
_ob_i_ = true;
_ob_d_ = 0L;
_ob_v_ = val;
}
public void
f(long d, String val)
{
if(!_OB_check(d, 0L))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = val;
}
}
| 5,542 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/Double10SeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:Double10Seq:1.0
//
final public class Double10SeqHolder implements org.omg.CORBA.portable.Streamable
{
public double[] value;
public
Double10SeqHolder()
{
}
public
Double10SeqHolder(double[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = Double10SeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
Double10SeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return Double10SeqHelper.type();
}
}
| 5,543 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DoubleSeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:DoubleSeq:1.0
//
final public class DoubleSeqHolder implements org.omg.CORBA.portable.Streamable
{
public double[] value;
public
DoubleSeqHolder()
{
}
public
DoubleSeqHolder(double[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = DoubleSeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
DoubleSeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return DoubleSeqHelper.type();
}
}
| 5,544 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestPortableTypes.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
public class TestPortableTypes extends test.common.TestBase {
private static void testTypeCode(org.omg.CORBA.ORB orb,
org.omg.CORBA.ORB singleton) {
//
// All of these TypeCodes will be created using the
// singleton ORB
//
org.omg.CORBA.TypeCode[] types = { TestStruct1Helper.type(),
TestEnumHelper.type(), OctetSeqHelper.type(),
CharSeqHelper.type(), DoubleSeqHelper.type(),
TestStruct1SeqHelper.type(), TestEnumSeqHelper.type(),
BoundedStringHelper.type(), Double10SeqHelper.type(),
Double10Seq10SeqHelper.type(), TestStruct120SeqHelper.type(),
TestEnum30SeqHelper.type(), String40SeqHelper.type(),
DoubleArrayHelper.type(), TestStruct2Helper.type(),
TestStruct2SeqHelper.type(), TestFixed1Helper.type(),
TestFixed2Helper.type(), TestStruct3Helper.type(),
TestStruct4Helper.type(), TestUnion1Helper.type(),
TestUnion2Helper.type(), TestUnion3Helper.type(),
TestUnion4Helper.type(), TestUnion5Helper.type() };
for (int i = 0; i < types.length; i++) {
//
// Force the conversion to an ORBacus TypeCode
//
org.apache.yoko.orb.CORBA.TypeCode tc = org.apache.yoko.orb.CORBA.TypeCode
._OB_convertForeignTypeCode(types[i]);
//
// Reset the repository ID so that equivalent will do
// more than just compare IDs
//
tc.id_ = "";
assertTrue(tc.equivalent(types[i]));
//
// There's no point in calling equal() because the comparison
// will stop at the repository IDs
//
// TEST(tc.equal(types[i]));
}
}
private static void testDynAny(org.omg.CORBA.ORB orb,
org.omg.CORBA.ORB singleton) throws org.omg.CORBA.UserException {
boolean jdk1_2 = false; // Are we using JDK 1.2?
if (singleton.getClass().getName().equals(
"com.sun.CORBA.idl.ORBSingleton"))
jdk1_2 = true;
//
// All of these TypeCodes will be created using the
// singleton ORB
//
org.omg.CORBA.TypeCode[] types;
if (jdk1_2) {
org.omg.CORBA.TypeCode[] dummy = {
test.types.DynAnyTypes.TestEnumHelper.type(),
test.types.DynAnyTypes.TestEmptyExceptionHelper.type(),
test.types.DynAnyTypes.TestExceptionHelper.type(),
test.types.DynAnyTypes.TestStructHelper.type(),
test.types.DynAnyTypes.TestUnion1Helper.type(),
test.types.DynAnyTypes.TestUnion2Helper.type(),
test.types.DynAnyTypes.TestUnion3Helper.type(),
test.types.DynAnyTypes.TestUnion4Helper.type(),
test.types.DynAnyTypes.TestShortSeqHelper.type(),
test.types.DynAnyTypes.TestBoundedStringHelper.type(),
test.types.DynAnyTypes.TestBoundedString10SeqHelper.type(),
test.types.DynAnyTypes.TestAnySeqHelper.type(),
test.types.DynAnyTypes.TestStringArrayHelper.type(),
test.types.DynAnyTypes.TestStructBoxHelper.type(),
test.types.DynAnyTypes.TestStringBoxHelper.type()
//
// JDK 1.2 has a bug which causes a NullPointerException
// when the following TypeCodes are created:
//
// test.types.DynAnyTypes.TestValue1Helper.type(),
// test.types.DynAnyTypes.TestValue2Helper.type(),
// test.types.DynAnyTypes.TestValue3Helper.type(),
// test.types.DynAnyTypes.TestValue4Helper.type(),
// test.types.DynAnyTypes.TestValueStructHelper.type()
};
types = dummy;
} else // JDK 1.3
{
org.omg.CORBA.TypeCode[] dummy = {
test.types.DynAnyTypes.TestEnumHelper.type(),
test.types.DynAnyTypes.TestEmptyExceptionHelper.type(),
test.types.DynAnyTypes.TestExceptionHelper.type(),
test.types.DynAnyTypes.TestStructHelper.type(),
test.types.DynAnyTypes.TestUnion1Helper.type(),
test.types.DynAnyTypes.TestUnion2Helper.type(),
test.types.DynAnyTypes.TestUnion3Helper.type(),
test.types.DynAnyTypes.TestUnion4Helper.type(),
test.types.DynAnyTypes.TestShortSeqHelper.type(),
test.types.DynAnyTypes.TestBoundedStringHelper.type(),
test.types.DynAnyTypes.TestBoundedString10SeqHelper.type(),
test.types.DynAnyTypes.TestAnySeqHelper.type(),
test.types.DynAnyTypes.TestStringArrayHelper.type(),
test.types.DynAnyTypes.TestStructBoxHelper.type(),
test.types.DynAnyTypes.TestStringBoxHelper.type(),
test.types.DynAnyTypes.TestValue1Helper.type(),
test.types.DynAnyTypes.TestValue2Helper.type(),
test.types.DynAnyTypes.TestValue3Helper.type(),
test.types.DynAnyTypes.TestValue4Helper.type(),
test.types.DynAnyTypes.TestValueStructHelper.type() };
types = dummy;
}
org.omg.DynamicAny.DynAnyFactory factory = null;
org.omg.CORBA.Object obj = orb
.resolve_initial_references("DynAnyFactory");
factory = org.omg.DynamicAny.DynAnyFactoryHelper.narrow(obj);
for (int i = 0; i < types.length; i++) {
//
// Create and test a DynAny using a "foreign" TypeCode
//
org.omg.DynamicAny.DynAny da = factory
.create_dyn_any_from_type_code(types[i]);
org.omg.CORBA.Any any = da.to_any();
da.from_any(any);
da.destroy();
}
//
// TestEnum
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestEnumHelper.insert(any1,
test.types.DynAnyTypes.TestEnum.red);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestEmptyException
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestEmptyExceptionHelper.insert(any1,
new test.types.DynAnyTypes.TestEmptyException());
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestException
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestExceptionHelper.insert(any1,
new test.types.DynAnyTypes.TestException("hi", 0));
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestStruct
//
if (!jdk1_2) {
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestStruct val = new test.types.DynAnyTypes.TestStruct();
val.shortVal = (short) -10000;
val.ushortVal = (short) 40000;
val.longVal = -300000;
val.ulongVal = 500000;
val.floatVal = (float) 1.9183;
val.doubleVal = 7.31e29;
val.boolVal = true;
val.charVal = 'Y';
val.octetVal = (byte) 155;
val.anyVal = singleton.create_any();
val.anyVal.insert_string("This is a string in an any");
val.tcVal = singleton
.get_primitive_tc(org.omg.CORBA.TCKind.tk_float);
val.objectVal = null;
val.stringVal = "This is a string";
val.longlongVal = -1234567890L;
val.ulonglongVal = 9876543210L;
val.wcharVal = 'Z';
val.wstringVal = "This is a wstring";
test.types.DynAnyTypes.TestStructHelper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
/**
*
* The JDK ORB raises MARSHAL because of the wchar
*
* org.omg.CORBA.portable.OutputStream out =
* orb.create_output_stream(); out.write_any(any1);
*/
}
//
// test.types.TestStruct1
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.TestStruct1 val = new test.types.TestStruct1();
val.s = (short) -10000;
val.l = -300000;
val.d = 7.31e29;
val.b = true;
val.c = 'Y';
val.o = (byte) 155;
val.str = "This is a string";
test.types.TestStruct1Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion1 (#1)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion1 val = new test.types.DynAnyTypes.TestUnion1();
val.a(1000);
test.types.DynAnyTypes.TestUnion1Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion1 (#2)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion1 val = new test.types.DynAnyTypes.TestUnion1();
val.b((float) 2.934);
test.types.DynAnyTypes.TestUnion1Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion1 (#3)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion1 val = new test.types.DynAnyTypes.TestUnion1();
val.c("hi");
test.types.DynAnyTypes.TestUnion1Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion2 (#1)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion2 val = new test.types.DynAnyTypes.TestUnion2();
val.a(1000);
test.types.DynAnyTypes.TestUnion2Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion2 (#2)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion2 val = new test.types.DynAnyTypes.TestUnion2();
val.__default(false);
test.types.DynAnyTypes.TestUnion2Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
/**
*
* Another JDK bug
*
* org.omg.CORBA.portable.OutputStream out =
* orb.create_output_stream(); out.write_any(any1);
*/
}
//
// TestUnion3 (#1)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion3 val = new test.types.DynAnyTypes.TestUnion3();
val.a(1000);
test.types.DynAnyTypes.TestUnion3Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion3 (#2)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion3 val = new test.types.DynAnyTypes.TestUnion3();
val.b(3.3933);
test.types.DynAnyTypes.TestUnion3Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion3 (#3)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion3 val = new test.types.DynAnyTypes.TestUnion3();
val.c('Z');
test.types.DynAnyTypes.TestUnion3Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion4 (#1)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion4 val = new test.types.DynAnyTypes.TestUnion4();
val.a(1000);
test.types.DynAnyTypes.TestUnion4Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion4 (#2)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion4 val = new test.types.DynAnyTypes.TestUnion4();
val.a((short) 2, 1000);
test.types.DynAnyTypes.TestUnion4Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestUnion4 (#3)
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestUnion4 val = new test.types.DynAnyTypes.TestUnion4();
val.b((float) 1.0189);
test.types.DynAnyTypes.TestUnion4Helper.insert(any1, val);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestShortSeq
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
test.types.DynAnyTypes.TestShortSeqHelper
.insert(any1, new short[5]);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
/*
* These tests don't work with the JDK ORB - there is a bug in their Any
* implementation of extract_string for bounded string TypeCodes
* // // TestBoundedString // { org.omg.CORBA.Any any1 =
* singleton.create_any();
* test.types.DynAnyTypes.TestBoundedStringHelper.insert( any1, "hi
* there"); org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
* org.omg.CORBA.Any any2 = da.to_any(); TEST(any2.equal(any1));
* da.destroy();
*
* org.omg.CORBA.portable.OutputStream out = orb.create_output_stream();
* out.write_any(any1); }
* // // TestBoundedString10Seq // { org.omg.CORBA.Any any1 =
* singleton.create_any(); String[] seq = { "1", "2", "3" };
* test.types.DynAnyTypes.TestBoundedString10SeqHelper.insert( any1,
* seq); org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
* org.omg.CORBA.Any any2 = da.to_any(); TEST(any2.equal(any1));
* da.destroy();
*
* org.omg.CORBA.portable.OutputStream out = orb.create_output_stream();
* out.write_any(any1); }
*/
//
// TestAnySeq
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
org.omg.CORBA.Any[] seq = new org.omg.CORBA.Any[2];
seq[0] = singleton.create_any();
seq[1] = singleton.create_any();
test.types.DynAnyTypes.TestAnySeqHelper.insert(any1, seq);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
//
// TestStringArray
//
{
org.omg.CORBA.Any any1 = singleton.create_any();
String[] seq = new String[10];
for (int i = 0; i < seq.length; i++)
seq[i] = "# " + i;
test.types.DynAnyTypes.TestStringArrayHelper.insert(any1, seq);
org.omg.DynamicAny.DynAny da = factory.create_dyn_any(any1);
org.omg.CORBA.Any any2 = da.to_any();
assertTrue(any2.equal(any1));
da.destroy();
org.omg.CORBA.portable.OutputStream out = orb
.create_output_stream();
out.write_any(any1);
}
/**
*
* Can't test valuetypes inserted into Anys created by the JDK ORB
* singleton, since an ORB singleton can't be expected to deal with
* valuetypes properly.
*
*/
}
public static int run(org.omg.CORBA.ORB orb, String[] args)
throws org.omg.CORBA.UserException {
org.omg.CORBA.ORB singleton = org.omg.CORBA.ORB.init();
//
// We will get the ORBacus ORB singleton if JDK 1.1 is being used,
// in which case there's no need to continue with the tests
//
if (singleton instanceof org.apache.yoko.orb.CORBA.ORBSingleton)
return 0;
//
// Run tests
//
System.out.print("Testing TypeCode portability... ");
System.out.flush();
testTypeCode(orb, singleton);
System.out.println("Done!");
System.out.print("Testing DynAny portability... ");
System.out.flush();
testDynAny(orb, singleton);
System.out.println("Done!");
return 0;
}
public static void main(String args[]) {
//
// Before we initialize the ORB, we ensure that there is
// no ORBSingletonClass property defined in the system
// property set.
//
java.util.Properties props = new Properties();
props.putAll(System.getProperties());
props.remove("org.omg.CORBA.ORBSingletonClass");
//
// Don't specify an ORBSingletonClass property - we want
// to use the JDK's ORB singleton implementation
//
props = new java.util.Properties();
props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
int status = 0;
org.omg.CORBA.ORB orb = null;
try {
//
// Create ORB
//
orb = org.omg.CORBA.ORB.init(args, props);
//
// Run tests
//
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,545 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DoubleSeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:DoubleSeq:1.0
//
final public class DoubleSeqHelper
{
public static void
insert(org.omg.CORBA.Any any, double[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static double[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "DoubleSeq", orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:DoubleSeq:1.0";
}
public static double[]
read(org.omg.CORBA.portable.InputStream in)
{
double[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new double[len0];
in.read_double_array(_ob_v, 0, len0);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, double[] val)
{
int len0 = val.length;
out.write_ulong(len0);
out.write_double_array(val, 0, len0);
}
}
| 5,546 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/Double10SeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:Double10Seq:1.0
//
final public class Double10SeqHelper
{
public static void
insert(org.omg.CORBA.Any any, double[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static double[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "Double10Seq", orb.create_sequence_tc(10, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:Double10Seq:1.0";
}
public static double[]
read(org.omg.CORBA.portable.InputStream in)
{
double[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new double[len0];
in.read_double_array(_ob_v, 0, len0);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, double[] val)
{
int len0 = val.length;
if(len0 > 10)
throw new org.omg.CORBA.MARSHAL();
out.write_ulong(len0);
out.write_double_array(val, 0, len0);
}
}
| 5,547 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/ConstWString.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:ConstWString:1.0
//
/***/
public interface ConstWString
{
String value = "This is ConstWString";
}
| 5,548 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestUnion4Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types;
//
// IDL:TestUnion4:1.0
//
final public class TestUnion4Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion4 value;
public
TestUnion4Holder()
{
}
public
TestUnion4Holder(TestUnion4 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion4Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion4Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion4Helper.type();
}
}
| 5,549 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestExceptionHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestException:1.0
//
final public class TestExceptionHolder implements org.omg.CORBA.portable.Streamable
{
public TestException value;
public
TestExceptionHolder()
{
}
public
TestExceptionHolder(TestException initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestExceptionHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestExceptionHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestExceptionHelper.type();
}
}
| 5,550 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStructBoxHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStructBox:1.0
//
final public class TestStructBoxHelper implements org.omg.CORBA.portable.BoxedValueHelper
{
private static final TestStructBoxHelper _instance = new TestStructBoxHelper();
public static void
insert(org.omg.CORBA.Any any, TestStruct val)
{
any.insert_Value((java.io.Serializable)val, type());
}
public static TestStruct
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof TestStruct)
return (TestStruct)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_value_box_tc(id(), "TestStructBox", TestStructHelper.type());
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestStructBox:1.0";
}
public static TestStruct
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (TestStruct)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(_instance);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestStruct val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value((java.io.Serializable)val, _instance);
}
public java.io.Serializable
read_value(org.omg.CORBA.portable.InputStream in)
{
TestStruct _ob_v;
_ob_v = TestStructHelper.read(in);
return (java.io.Serializable)_ob_v;
}
public void
write_value(org.omg.CORBA.portable.OutputStream out, java.io.Serializable val)
{
if(!(val instanceof TestStruct))
throw new org.omg.CORBA.MARSHAL();
TestStruct _ob_value = (TestStruct)val;
TestStructHelper.write(out, _ob_value);
}
public String
get_id()
{
return id();
}
}
| 5,551 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStructBoxHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStructBox:1.0
//
final public class TestStructBoxHolder implements org.omg.CORBA.portable.Streamable
{
public TestStruct value;
public
TestStructBoxHolder()
{
}
public
TestStructBoxHolder(TestStruct initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStructBoxHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStructBoxHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStructBoxHelper.type();
}
}
| 5,552 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestExceptionHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestException:1.0
//
final public class TestExceptionHelper
{
public static void
insert(org.omg.CORBA.Any any, TestException val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestException
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[2];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "reason";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[1] = new org.omg.CORBA.StructMember();
members[1].name = "code";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
typeCode_ = orb.create_exception_tc(id(), "TestException", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestException:1.0";
}
public static TestException
read(org.omg.CORBA.portable.InputStream in)
{
if(!id().equals(in.read_string()))
throw new org.omg.CORBA.MARSHAL();
TestException _ob_v = new TestException();
_ob_v.reason = in.read_string();
_ob_v.code = in.read_long();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestException val)
{
out.write_string(id());
out.write_string(val.reason);
out.write_long(val.code);
}
}
| 5,553 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEmptyException.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEmptyException:1.0
//
/***/
final public class TestEmptyException extends org.omg.CORBA.UserException
{
private static final String _ob_id = "IDL:test/types/DynAnyTypes/TestEmptyException:1.0";
public
TestEmptyException()
{
super(_ob_id);
}
public
TestEmptyException(String _reason)
{
super(_ob_id + " " + _reason);
}
}
| 5,554 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion2Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion2:1.0
//
final public class TestUnion2Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion2 value;
public
TestUnion2Holder()
{
}
public
TestUnion2Holder(TestUnion2 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion2Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion2Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion2Helper.type();
}
}
| 5,555 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEnumHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEnum:1.0
//
final public class TestEnumHelper
{
public static void
insert(org.omg.CORBA.Any any, TestEnum val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestEnum
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
String[] members = new String[3];
members[0] = "red";
members[1] = "green";
members[2] = "blue";
typeCode_ = orb.create_enum_tc(id(), "TestEnum", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestEnum:1.0";
}
public static TestEnum
read(org.omg.CORBA.portable.InputStream in)
{
TestEnum _ob_v;
_ob_v = TestEnum.from_int(in.read_ulong());
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestEnum val)
{
out.write_ulong(val.value());
}
}
| 5,556 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValueStructHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValueStruct:1.0
//
final public class TestValueStructHolder implements org.omg.CORBA.portable.Streamable
{
public TestValueStruct value;
public
TestValueStructHolder()
{
}
public
TestValueStructHolder(TestValueStruct initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestValueStructHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestValueStructHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValueStructHelper.type();
}
}
| 5,557 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEmptyExceptionHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEmptyException:1.0
//
final public class TestEmptyExceptionHolder implements org.omg.CORBA.portable.Streamable
{
public TestEmptyException value;
public
TestEmptyExceptionHolder()
{
}
public
TestEmptyExceptionHolder(TestEmptyException initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestEmptyExceptionHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestEmptyExceptionHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestEmptyExceptionHelper.type();
}
}
| 5,558 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValueStructHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValueStruct:1.0
//
final public class TestValueStructHelper
{
public static void
insert(org.omg.CORBA.Any any, TestValueStruct val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestValueStruct
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[2];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "name";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[1] = new org.omg.CORBA.StructMember();
members[1].name = "value";
members[1].type = TestValue2Helper.type();
typeCode_ = orb.create_struct_tc(id(), "TestValueStruct", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestValueStruct:1.0";
}
public static TestValueStruct
read(org.omg.CORBA.portable.InputStream in)
{
TestValueStruct _ob_v = new TestValueStruct();
_ob_v.name = in.read_string();
_ob_v.value = TestValue2Helper.read(in);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestValueStruct val)
{
out.write_string(val.name);
TestValue2Helper.write(out, val.value);
}
}
| 5,559 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue1.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue1:1.0
//
/***/
public abstract class TestValue1 implements org.omg.CORBA.portable.StreamableValue
{
private static String[] _OB_truncatableIds_ =
{
TestValue1Helper.id()
};
public String[]
_truncatable_ids()
{
return _OB_truncatableIds_;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue1Helper.type();
}
}
| 5,560 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEmptyExceptionHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEmptyException:1.0
//
final public class TestEmptyExceptionHelper
{
public static void
insert(org.omg.CORBA.Any any, TestEmptyException val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestEmptyException
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[0];
typeCode_ = orb.create_exception_tc(id(), "TestEmptyException", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestEmptyException:1.0";
}
public static TestEmptyException
read(org.omg.CORBA.portable.InputStream in)
{
if(!id().equals(in.read_string()))
throw new org.omg.CORBA.MARSHAL();
TestEmptyException _ob_v = new TestEmptyException();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestEmptyException val)
{
out.write_string(id());
}
}
| 5,561 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEnumHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEnum:1.0
//
final public class TestEnumHolder implements org.omg.CORBA.portable.Streamable
{
public TestEnum value;
public
TestEnumHolder()
{
}
public
TestEnumHolder(TestEnum initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestEnumHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestEnumHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestEnumHelper.type();
}
}
| 5,562 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion2Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion2:1.0
//
final public class TestUnion2Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion2 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion2
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[1];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[0].label = orb.create_any();
members[0].label.insert_boolean(true);
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean);
typeCode_ = orb.create_union_tc(id(), "TestUnion2", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestUnion2:1.0";
}
public static TestUnion2
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion2 _ob_v = new TestUnion2();
boolean _ob_d;
_ob_d = in.read_boolean();
switch(_ob_d ? 1 : 0)
{
case 1:
{
int _ob_m;
_ob_m = in.read_long();
_ob_v.a(_ob_m);
break;
}
default:
_ob_v.__default(_ob_d);
break;
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion2 val)
{
boolean _ob_d = val.discriminator();
out.write_boolean(_ob_d);
switch(_ob_d ? 1 : 0)
{
case 1:
{
int _ob_m = val.a();
out.write_long(_ob_m);
break;
}
default:
break;
}
}
}
| 5,563 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestEnum.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestEnum:1.0
//
/***/
public class TestEnum implements org.omg.CORBA.portable.IDLEntity
{
private static TestEnum [] values_ = new TestEnum[3];
private int value_;
public final static int _red = 0;
public final static TestEnum red = new TestEnum(_red);
public final static int _green = 1;
public final static TestEnum green = new TestEnum(_green);
public final static int _blue = 2;
public final static TestEnum blue = new TestEnum(_blue);
protected
TestEnum(int value)
{
values_[value] = this;
value_ = value;
}
public int
value()
{
return value_;
}
public static TestEnum
from_int(int value)
{
if(value < values_.length)
return values_[value];
else
throw new org.omg.CORBA.BAD_PARAM("Value (" + value + ") out of range", 25, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private java.lang.Object
readResolve()
throws java.io.ObjectStreamException
{
return from_int(value());
}
}
| 5,564 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestAnySeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestAnySeq:1.0
//
final public class TestAnySeqHelper
{
public static void
insert(org.omg.CORBA.Any any, org.omg.CORBA.Any[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static org.omg.CORBA.Any[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestAnySeq", orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestAnySeq:1.0";
}
public static org.omg.CORBA.Any[]
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Any[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new org.omg.CORBA.Any[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v[i0] = in.read_any();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.Any[] val)
{
int len0 = val.length;
out.write_ulong(len0);
for(int i0 = 0; i0 < len0; i0++)
out.write_any(val[i0]);
}
}
| 5,565 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue2Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue2:1.0
//
final public class TestValue2Helper
{
public static void
insert(org.omg.CORBA.Any any, TestValue2 val)
{
any.insert_Value(val, type());
}
public static TestValue2
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof TestValue2)
return (TestValue2)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[3];
members[0] = new org.omg.CORBA.ValueMember();
members[0].name = "shortVal";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
members[0].access = org.omg.CORBA.PUBLIC_MEMBER.value;
members[1] = new org.omg.CORBA.ValueMember();
members[1].name = "longVal";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[1].access = org.omg.CORBA.PUBLIC_MEMBER.value;
members[2] = new org.omg.CORBA.ValueMember();
members[2].name = "stringVal";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[2].access = org.omg.CORBA.PUBLIC_MEMBER.value;
typeCode_ = orb.create_value_tc(id(), "TestValue2", org.omg.CORBA.VM_NONE.value, null, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestValue2:1.0";
}
public static TestValue2
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (TestValue2)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(id());
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestValue2 val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value(val, id());
}
}
| 5,566 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue2Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue2:1.0
//
final public class TestValue2Holder implements org.omg.CORBA.portable.Streamable
{
public TestValue2 value;
public
TestValue2Holder()
{
}
public
TestValue2Holder(TestValue2 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestValue2Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestValue2Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue2Helper.type();
}
}
| 5,567 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestAnySeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestAnySeq:1.0
//
final public class TestAnySeqHolder implements org.omg.CORBA.portable.Streamable
{
public org.omg.CORBA.Any[] value;
public
TestAnySeqHolder()
{
}
public
TestAnySeqHolder(org.omg.CORBA.Any[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestAnySeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestAnySeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestAnySeqHelper.type();
}
}
| 5,568 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStructHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStruct:1.0
//
final public class TestStructHelper
{
public static void
insert(org.omg.CORBA.Any any, TestStruct val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestStruct
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[17];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "shortVal";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
members[1] = new org.omg.CORBA.StructMember();
members[1].name = "ushortVal";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ushort);
members[2] = new org.omg.CORBA.StructMember();
members[2].name = "longVal";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[3] = new org.omg.CORBA.StructMember();
members[3].name = "ulongVal";
members[3].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong);
members[4] = new org.omg.CORBA.StructMember();
members[4].name = "floatVal";
members[4].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_float);
members[5] = new org.omg.CORBA.StructMember();
members[5].name = "doubleVal";
members[5].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double);
members[6] = new org.omg.CORBA.StructMember();
members[6].name = "boolVal";
members[6].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean);
members[7] = new org.omg.CORBA.StructMember();
members[7].name = "charVal";
members[7].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[8] = new org.omg.CORBA.StructMember();
members[8].name = "octetVal";
members[8].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_octet);
members[9] = new org.omg.CORBA.StructMember();
members[9].name = "anyVal";
members[9].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any);
members[10] = new org.omg.CORBA.StructMember();
members[10].name = "tcVal";
members[10].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode);
members[11] = new org.omg.CORBA.StructMember();
members[11].name = "objectVal";
members[11].type = orb.create_interface_tc("IDL:omg.org/CORBA/Object:1.0", "Object");
members[12] = new org.omg.CORBA.StructMember();
members[12].name = "stringVal";
members[12].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[13] = new org.omg.CORBA.StructMember();
members[13].name = "longlongVal";
members[13].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_longlong);
members[14] = new org.omg.CORBA.StructMember();
members[14].name = "ulonglongVal";
members[14].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulonglong);
members[15] = new org.omg.CORBA.StructMember();
members[15].name = "wcharVal";
members[15].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_wchar);
members[16] = new org.omg.CORBA.StructMember();
members[16].name = "wstringVal";
members[16].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_wstring);
typeCode_ = orb.create_struct_tc(id(), "TestStruct", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestStruct:1.0";
}
public static TestStruct
read(org.omg.CORBA.portable.InputStream in)
{
TestStruct _ob_v = new TestStruct();
_ob_v.shortVal = in.read_short();
_ob_v.ushortVal = in.read_ushort();
_ob_v.longVal = in.read_long();
_ob_v.ulongVal = in.read_ulong();
_ob_v.floatVal = in.read_float();
_ob_v.doubleVal = in.read_double();
_ob_v.boolVal = in.read_boolean();
_ob_v.charVal = in.read_char();
_ob_v.octetVal = in.read_octet();
_ob_v.anyVal = in.read_any();
_ob_v.tcVal = in.read_TypeCode();
_ob_v.objectVal = in.read_Object();
_ob_v.stringVal = in.read_string();
_ob_v.longlongVal = in.read_longlong();
_ob_v.ulonglongVal = in.read_ulonglong();
_ob_v.wcharVal = in.read_wchar();
_ob_v.wstringVal = in.read_wstring();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestStruct val)
{
out.write_short(val.shortVal);
out.write_ushort(val.ushortVal);
out.write_long(val.longVal);
out.write_ulong(val.ulongVal);
out.write_float(val.floatVal);
out.write_double(val.doubleVal);
out.write_boolean(val.boolVal);
out.write_char(val.charVal);
out.write_octet(val.octetVal);
out.write_any(val.anyVal);
out.write_TypeCode(val.tcVal);
out.write_Object(val.objectVal);
out.write_string(val.stringVal);
out.write_longlong(val.longlongVal);
out.write_ulonglong(val.ulonglongVal);
out.write_wchar(val.wcharVal);
out.write_wstring(val.wstringVal);
}
}
| 5,569 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion1.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion1:1.0
//
/***/
final public class TestUnion1 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
short _ob_d_;
static boolean
_OB_check(short d0, short d1)
{
short d[] = new short[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case (short)0:
case (short)1:
d[i] = (short)0;
break;
case (short)3:
break;
default:
d[i] = (short)2;
break;
}
}
return d[0] == d[1];
}
public
TestUnion1()
{
_ob_i_ = false;
}
public short
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public int
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)0))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.IntHolder)_ob_v_).value;
}
public void
a(int val)
{
_ob_i_ = true;
_ob_d_ = (short)0;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public void
a(short d, int val)
{
if(!_OB_check(d, (short)0))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public float
b()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)3))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.FloatHolder)_ob_v_).value;
}
public void
b(float val)
{
_ob_i_ = true;
_ob_d_ = (short)3;
_ob_v_ = new org.omg.CORBA.FloatHolder(val);
}
public String
c()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)2))
throw new org.omg.CORBA.BAD_OPERATION();
return (String)_ob_v_;
}
public void
c(String val)
{
_ob_i_ = true;
_ob_d_ = (short)2;
_ob_v_ = val;
}
public void
c(short d, String val)
{
if(!_OB_check(d, (short)2))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = val;
}
}
| 5,570 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStructHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStruct:1.0
//
final public class TestStructHolder implements org.omg.CORBA.portable.Streamable
{
public TestStruct value;
public
TestStructHolder()
{
}
public
TestStructHolder(TestStruct initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStructHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStructHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStructHelper.type();
}
}
| 5,571 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestBoundedString10SeqHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestBoundedString10Seq:1.0
//
final public class TestBoundedString10SeqHelper
{
public static void
insert(org.omg.CORBA.Any any, String[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static String[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestBoundedString10Seq", orb.create_sequence_tc(10, TestBoundedStringHelper.type()));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestBoundedString10Seq:1.0";
}
public static String[]
read(org.omg.CORBA.portable.InputStream in)
{
String[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new String[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v[i0] = in.read_string();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, String[] val)
{
int len0 = val.length;
if(len0 > 10)
throw new org.omg.CORBA.MARSHAL();
out.write_ulong(len0);
for(int i0 = 0; i0 < len0; i0++)
out.write_string(val[i0]);
}
}
| 5,572 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion2.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion2:1.0
//
/***/
final public class TestUnion2 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
int _ob_d_;
static boolean
_OB_check(int d0, int d1)
{
int d[] = new int[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
case 1:
break;
default:
d[i] = 0;
break;
}
}
return d[0] == d[1];
}
public
TestUnion2()
{
_ob_i_ = false;
}
public boolean
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_ == 0 ? false : true;
}
public int
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, 1))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.IntHolder)_ob_v_).value;
}
public void
a(int val)
{
_ob_i_ = true;
_ob_d_ = 1;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public void
__default()
{
_ob_i_ = true;
_ob_d_ = 0;
_ob_v_ = null;
}
public void
__default(boolean d)
{
if(!_OB_check(d ? 1 : 0, 0))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d ? 1 : 0;
_ob_v_ = null;
}
}
| 5,573 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion3Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion3:1.0
//
final public class TestUnion3Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion3 value;
public
TestUnion3Holder()
{
}
public
TestUnion3Holder(TestUnion3 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion3Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion3Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion3Helper.type();
}
}
| 5,574 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue4Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue4:1.0
//
final public class TestValue4Holder implements org.omg.CORBA.portable.Streamable
{
public TestValue4 value;
public
TestValue4Holder()
{
}
public
TestValue4Holder(TestValue4 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestValue4Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestValue4Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue4Helper.type();
}
}
| 5,575 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestException.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestException:1.0
//
/***/
final public class TestException extends org.omg.CORBA.UserException
{
private static final String _ob_id = "IDL:test/types/DynAnyTypes/TestException:1.0";
public
TestException()
{
super(_ob_id);
}
public
TestException(String reason,
int code)
{
super(_ob_id);
this.reason = reason;
this.code = code;
}
public
TestException(String _reason,
String reason,
int code)
{
super(_ob_id + " " + _reason);
this.reason = reason;
this.code = code;
}
public String reason;
public int code;
}
| 5,576 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStringArrayHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStringArray:1.0
//
final public class TestStringArrayHolder implements org.omg.CORBA.portable.Streamable
{
public String[] value;
public
TestStringArrayHolder()
{
}
public
TestStringArrayHolder(String[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStringArrayHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStringArrayHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStringArrayHelper.type();
}
}
| 5,577 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStringArrayHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStringArray:1.0
//
final public class TestStringArrayHelper
{
public static void
insert(org.omg.CORBA.Any any, String[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static String[]
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestStringArray", orb.create_array_tc(10, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestStringArray:1.0";
}
public static String[]
read(org.omg.CORBA.portable.InputStream in)
{
String[] _ob_v;
int len0 = 10;
_ob_v = new String[len0];
for(int i0 = 0; i0 < len0; i0++)
_ob_v[i0] = in.read_string();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, String[] val)
{
int len0 = val.length;
if(len0 != 10)
throw new org.omg.CORBA.MARSHAL();
for(int i0 = 0; i0 < len0; i0++)
out.write_string(val[i0]);
}
}
| 5,578 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue4.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue4:1.0
//
/***/
public abstract class TestValue4 extends TestValue2
{
//
// IDL:test/types/DynAnyTypes/TestValue4/charVal:1.0
//
/***/
public char charVal;
//
// IDL:test/types/DynAnyTypes/TestValue4/longlongVal:1.0
//
/***/
public long longlongVal;
private static String[] _OB_truncatableIds_ =
{
TestValue4Helper.id(),
TestValue2Helper.id()
};
public String[]
_truncatable_ids()
{
return _OB_truncatableIds_;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
super._read(in);
charVal = in.read_char();
longlongVal = in.read_longlong();
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
super._write(out);
out.write_char(charVal);
out.write_longlong(longlongVal);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue4Helper.type();
}
}
| 5,579 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue4Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue4:1.0
//
final public class TestValue4Helper
{
public static void
insert(org.omg.CORBA.Any any, TestValue4 val)
{
any.insert_Value(val, type());
}
public static TestValue4
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof TestValue4)
return (TestValue4)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[2];
members[0] = new org.omg.CORBA.ValueMember();
members[0].name = "charVal";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[0].access = org.omg.CORBA.PUBLIC_MEMBER.value;
members[1] = new org.omg.CORBA.ValueMember();
members[1].name = "longlongVal";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_longlong);
members[1].access = org.omg.CORBA.PUBLIC_MEMBER.value;
org.omg.CORBA.TypeCode baseType = TestValue2Helper.type();
typeCode_ = orb.create_value_tc(id(), "TestValue4", org.omg.CORBA.VM_TRUNCATABLE.value, baseType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestValue4:1.0";
}
public static TestValue4
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (TestValue4)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(id());
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestValue4 val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value(val, id());
}
}
| 5,580 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion3Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion3:1.0
//
final public class TestUnion3Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion3 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion3
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[3];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[0].label = orb.create_any();
TestEnumHelper.insert(members[0].label, TestEnum.from_int(0));
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "b";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double);
members[1].label = orb.create_any();
TestEnumHelper.insert(members[1].label, TestEnum.from_int(1));
members[2] = new org.omg.CORBA.UnionMember();
members[2].name = "c";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
members[2].label = orb.create_any();
TestEnumHelper.insert(members[2].label, TestEnum.from_int(2));
org.omg.CORBA.TypeCode discType = TestEnumHelper.type();
typeCode_ = orb.create_union_tc(id(), "TestUnion3", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestUnion3:1.0";
}
public static TestUnion3
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion3 _ob_v = new TestUnion3();
TestEnum _ob_d;
_ob_d = TestEnumHelper.read(in);
switch(_ob_d.value())
{
case TestEnum._red:
{
int _ob_m;
_ob_m = in.read_long();
_ob_v.a(_ob_m);
break;
}
case TestEnum._green:
{
double _ob_m;
_ob_m = in.read_double();
_ob_v.b(_ob_m);
break;
}
case TestEnum._blue:
{
char _ob_m;
_ob_m = in.read_char();
_ob_v.c(_ob_m);
break;
}
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion3 val)
{
TestEnum _ob_d = val.discriminator();
TestEnumHelper.write(out, _ob_d);
switch(_ob_d.value())
{
case TestEnum._red:
{
int _ob_m = val.a();
out.write_long(_ob_m);
break;
}
case TestEnum._green:
{
double _ob_m = val.b();
out.write_double(_ob_m);
break;
}
case TestEnum._blue:
{
char _ob_m = val.c();
out.write_char(_ob_m);
break;
}
}
}
}
| 5,581 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestBoundedString10SeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestBoundedString10Seq:1.0
//
final public class TestBoundedString10SeqHolder implements org.omg.CORBA.portable.Streamable
{
public String[] value;
public
TestBoundedString10SeqHolder()
{
}
public
TestBoundedString10SeqHolder(String[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestBoundedString10SeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestBoundedString10SeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestBoundedString10SeqHelper.type();
}
}
| 5,582 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue1Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue1:1.0
//
final public class TestValue1Helper
{
public static void
insert(org.omg.CORBA.Any any, TestValue1 val)
{
any.insert_Value(val, type());
}
public static TestValue1
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof TestValue1)
return (TestValue1)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[0];
typeCode_ = orb.create_value_tc(id(), "TestValue1", org.omg.CORBA.VM_NONE.value, null, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestValue1:1.0";
}
public static TestValue1
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (TestValue1)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(id());
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestValue1 val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value(val, id());
}
}
| 5,583 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion3.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion3:1.0
//
/***/
final public class TestUnion3 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
int _ob_d_;
static boolean
_OB_check(int d0, int d1)
{
return d0 == d1;
}
public
TestUnion3()
{
_ob_i_ = false;
}
public TestEnum
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return TestEnum.from_int(_ob_d_);
}
public int
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, TestEnum._red))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.IntHolder)_ob_v_).value;
}
public void
a(int val)
{
_ob_i_ = true;
_ob_d_ = TestEnum._red;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public double
b()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, TestEnum._green))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.DoubleHolder)_ob_v_).value;
}
public void
b(double val)
{
_ob_i_ = true;
_ob_d_ = TestEnum._green;
_ob_v_ = new org.omg.CORBA.DoubleHolder(val);
}
public char
c()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, TestEnum._blue))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.CharHolder)_ob_v_).value;
}
public void
c(char val)
{
_ob_i_ = true;
_ob_d_ = TestEnum._blue;
_ob_v_ = new org.omg.CORBA.CharHolder(val);
}
}
| 5,584 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue1Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue1:1.0
//
final public class TestValue1Holder implements org.omg.CORBA.portable.Streamable
{
public TestValue1 value;
public
TestValue1Holder()
{
}
public
TestValue1Holder(TestValue1 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestValue1Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestValue1Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue1Helper.type();
}
}
| 5,585 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue2.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue2:1.0
//
/***/
public abstract class TestValue2 implements org.omg.CORBA.portable.StreamableValue
{
//
// IDL:test/types/DynAnyTypes/TestValue2/shortVal:1.0
//
/***/
public short shortVal;
//
// IDL:test/types/DynAnyTypes/TestValue2/longVal:1.0
//
/***/
public int longVal;
//
// IDL:test/types/DynAnyTypes/TestValue2/stringVal:1.0
//
/***/
public String stringVal;
private static String[] _OB_truncatableIds_ =
{
TestValue2Helper.id()
};
public String[]
_truncatable_ids()
{
return _OB_truncatableIds_;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
shortVal = in.read_short();
longVal = in.read_long();
stringVal = in.read_string();
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
out.write_short(shortVal);
out.write_long(longVal);
out.write_string(stringVal);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue2Helper.type();
}
}
| 5,586 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion1Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion1:1.0
//
final public class TestUnion1Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion1 value;
public
TestUnion1Holder()
{
}
public
TestUnion1Holder(TestUnion1 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion1Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion1Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion1Helper.type();
}
}
| 5,587 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion1Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion1:1.0
//
final public class TestUnion1Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion1 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion1
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[4];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[0].label = orb.create_any();
members[0].label.insert_short((short)(0L));
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "a";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[1].label = orb.create_any();
members[1].label.insert_short((short)(1L));
members[2] = new org.omg.CORBA.UnionMember();
members[2].name = "b";
members[2].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_float);
members[2].label = orb.create_any();
members[2].label.insert_short((short)(3L));
members[3] = new org.omg.CORBA.UnionMember();
members[3].name = "c";
members[3].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[3].label = orb.create_any();
members[3].label.insert_octet((byte)0);
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
typeCode_ = orb.create_union_tc(id(), "TestUnion1", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestUnion1:1.0";
}
public static TestUnion1
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion1 _ob_v = new TestUnion1();
short _ob_d;
_ob_d = in.read_short();
switch(_ob_d)
{
case (short)0:
case (short)1:
{
int _ob_m;
_ob_m = in.read_long();
_ob_v.a(_ob_d, _ob_m);
break;
}
case (short)3:
{
float _ob_m;
_ob_m = in.read_float();
_ob_v.b(_ob_m);
break;
}
default:
{
String _ob_m;
_ob_m = in.read_string();
_ob_v.c(_ob_d, _ob_m);
break;
}
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion1 val)
{
short _ob_d = val.discriminator();
out.write_short(_ob_d);
switch(_ob_d)
{
case (short)0:
case (short)1:
{
int _ob_m = val.a();
out.write_long(_ob_m);
break;
}
case (short)3:
{
float _ob_m = val.b();
out.write_float(_ob_m);
break;
}
default:
{
String _ob_m = val.c();
out.write_string(_ob_m);
break;
}
}
}
}
| 5,588 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion4.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion4:1.0
//
/***/
final public class TestUnion4 implements org.omg.CORBA.portable.IDLEntity
{
java.lang.Object _ob_v_;
boolean _ob_i_;
short _ob_d_;
static boolean
_OB_check(short d0, short d1)
{
short d[] = new short[2];
d[0] = d0;
d[1] = d1;
for(int i = 0; i < 2; i++)
{
switch(d[i])
{
default:
d[i] = (short)0;
break;
case (short)99:
break;
}
}
return d[0] == d[1];
}
public
TestUnion4()
{
_ob_i_ = false;
}
public short
discriminator()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
return _ob_d_;
}
public int
a()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)0))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.IntHolder)_ob_v_).value;
}
public void
a(int val)
{
_ob_i_ = true;
_ob_d_ = (short)0;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public void
a(short d, int val)
{
if(!_OB_check(d, (short)0))
throw new org.omg.CORBA.BAD_PARAM();
_ob_i_ = true;
_ob_d_ = d;
_ob_v_ = new org.omg.CORBA.IntHolder(val);
}
public float
b()
{
if(!_ob_i_)
throw new org.omg.CORBA.BAD_OPERATION();
if(!_OB_check(_ob_d_, (short)99))
throw new org.omg.CORBA.BAD_OPERATION();
return ((org.omg.CORBA.FloatHolder)_ob_v_).value;
}
public void
b(float val)
{
_ob_i_ = true;
_ob_d_ = (short)99;
_ob_v_ = new org.omg.CORBA.FloatHolder(val);
}
}
| 5,589 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValueStruct.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValueStruct:1.0
//
/***/
final public class TestValueStruct implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:test/types/DynAnyTypes/TestValueStruct:1.0";
public
TestValueStruct()
{
}
public
TestValueStruct(String name,
TestValue2 value)
{
this.name = name;
this.value = value;
}
public String name;
public TestValue2 value;
}
| 5,590 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStruct.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStruct:1.0
//
/***/
final public class TestStruct implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:test/types/DynAnyTypes/TestStruct:1.0";
public
TestStruct()
{
}
public
TestStruct(short shortVal,
short ushortVal,
int longVal,
int ulongVal,
float floatVal,
double doubleVal,
boolean boolVal,
char charVal,
byte octetVal,
org.omg.CORBA.Any anyVal,
org.omg.CORBA.TypeCode tcVal,
org.omg.CORBA.Object objectVal,
String stringVal,
long longlongVal,
long ulonglongVal,
char wcharVal,
String wstringVal)
{
this.shortVal = shortVal;
this.ushortVal = ushortVal;
this.longVal = longVal;
this.ulongVal = ulongVal;
this.floatVal = floatVal;
this.doubleVal = doubleVal;
this.boolVal = boolVal;
this.charVal = charVal;
this.octetVal = octetVal;
this.anyVal = anyVal;
this.tcVal = tcVal;
this.objectVal = objectVal;
this.stringVal = stringVal;
this.longlongVal = longlongVal;
this.ulonglongVal = ulonglongVal;
this.wcharVal = wcharVal;
this.wstringVal = wstringVal;
}
public short shortVal;
public short ushortVal;
public int longVal;
public int ulongVal;
public float floatVal;
public double doubleVal;
public boolean boolVal;
public char charVal;
public byte octetVal;
public org.omg.CORBA.Any anyVal;
public org.omg.CORBA.TypeCode tcVal;
public org.omg.CORBA.Object objectVal;
public String stringVal;
public long longlongVal;
public long ulonglongVal;
public char wcharVal;
public String wstringVal;
}
| 5,591 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestBoundedStringHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestBoundedString:1.0
//
final public class TestBoundedStringHelper
{
public static void
insert(org.omg.CORBA.Any any, String val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static String
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_alias_tc(id(), "TestBoundedString", orb.create_string_tc(12));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestBoundedString:1.0";
}
public static String
read(org.omg.CORBA.portable.InputStream in)
{
String _ob_v;
_ob_v = in.read_string();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, String val)
{
out.write_string(val);
}
}
| 5,592 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestShortSeqHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestShortSeq:1.0
//
final public class TestShortSeqHolder implements org.omg.CORBA.portable.Streamable
{
public short[] value;
public
TestShortSeqHolder()
{
}
public
TestShortSeqHolder(short[] initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestShortSeqHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestShortSeqHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestShortSeqHelper.type();
}
}
| 5,593 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion4Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion4:1.0
//
final public class TestUnion4Helper
{
public static void
insert(org.omg.CORBA.Any any, TestUnion4 val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static TestUnion4
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[2];
members[0] = new org.omg.CORBA.UnionMember();
members[0].name = "a";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
members[0].label = orb.create_any();
members[0].label.insert_octet((byte)0);
members[1] = new org.omg.CORBA.UnionMember();
members[1].name = "b";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_float);
members[1].label = orb.create_any();
members[1].label.insert_short((short)(99L));
org.omg.CORBA.TypeCode discType = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
typeCode_ = orb.create_union_tc(id(), "TestUnion4", discType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestUnion4:1.0";
}
public static TestUnion4
read(org.omg.CORBA.portable.InputStream in)
{
TestUnion4 _ob_v = new TestUnion4();
short _ob_d;
_ob_d = in.read_short();
switch(_ob_d)
{
default:
{
int _ob_m;
_ob_m = in.read_long();
_ob_v.a(_ob_d, _ob_m);
break;
}
case (short)99:
{
float _ob_m;
_ob_m = in.read_float();
_ob_v.b(_ob_m);
break;
}
}
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestUnion4 val)
{
short _ob_d = val.discriminator();
out.write_short(_ob_d);
switch(_ob_d)
{
default:
{
int _ob_m = val.a();
out.write_long(_ob_m);
break;
}
case (short)99:
{
float _ob_m = val.b();
out.write_float(_ob_m);
break;
}
}
}
}
| 5,594 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue3Helper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue3:1.0
//
final public class TestValue3Helper
{
public static void
insert(org.omg.CORBA.Any any, TestValue3 val)
{
any.insert_Value(val, type());
}
public static TestValue3
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof TestValue3)
return (TestValue3)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.ValueMember[] members = new org.omg.CORBA.ValueMember[1];
members[0] = new org.omg.CORBA.ValueMember();
members[0].name = "unionVal";
members[0].type = TestUnion4Helper.type();
members[0].access = org.omg.CORBA.PUBLIC_MEMBER.value;
org.omg.CORBA.TypeCode baseType = TestValue2Helper.type();
typeCode_ = orb.create_value_tc(id(), "TestValue3", org.omg.CORBA.VM_NONE.value, baseType, members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestValue3:1.0";
}
public static TestValue3
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (TestValue3)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(id());
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestValue3 val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value(val, id());
}
}
| 5,595 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStringBoxHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStringBox:1.0
//
final public class TestStringBoxHelper implements org.omg.CORBA.portable.BoxedValueHelper
{
private static final TestStringBoxHelper _instance = new TestStringBoxHelper();
public static void
insert(org.omg.CORBA.Any any, String val)
{
any.insert_Value((java.io.Serializable)val, type());
}
public static String
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
{
java.io.Serializable _ob_v = any.extract_Value();
if(_ob_v == null || _ob_v instanceof String)
return (String)_ob_v;
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
typeCode_ = orb.create_value_box_tc(id(), "TestStringBox", orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestStringBox:1.0";
}
public static String
read(org.omg.CORBA.portable.InputStream in)
{
if(!(in instanceof org.omg.CORBA_2_3.portable.InputStream))
throw new org.omg.CORBA.BAD_PARAM();
return (String)((org.omg.CORBA_2_3.portable.InputStream)in).read_value(_instance);
}
public static void
write(org.omg.CORBA.portable.OutputStream out, String val)
{
if(!(out instanceof org.omg.CORBA_2_3.portable.OutputStream))
throw new org.omg.CORBA.BAD_PARAM();
((org.omg.CORBA_2_3.portable.OutputStream)out).write_value((java.io.Serializable)val, _instance);
}
public java.io.Serializable
read_value(org.omg.CORBA.portable.InputStream in)
{
String _ob_v;
_ob_v = in.read_string();
return (java.io.Serializable)_ob_v;
}
public void
write_value(org.omg.CORBA.portable.OutputStream out, java.io.Serializable val)
{
if(!(val instanceof String))
throw new org.omg.CORBA.MARSHAL();
String _ob_value = (String)val;
out.write_string(_ob_value);
}
public String
get_id()
{
return id();
}
}
| 5,596 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue3Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestValue3:1.0
//
final public class TestValue3Holder implements org.omg.CORBA.portable.Streamable
{
public TestValue3 value;
public
TestValue3Holder()
{
}
public
TestValue3Holder(TestValue3 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestValue3Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestValue3Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue3Helper.type();
}
}
| 5,597 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestStringBoxHolder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestStringBox:1.0
//
final public class TestStringBoxHolder implements org.omg.CORBA.portable.Streamable
{
public String value;
public
TestStringBoxHolder()
{
}
public
TestStringBoxHolder(String initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestStringBoxHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestStringBoxHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestStringBoxHelper.type();
}
}
| 5,598 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestUnion4Holder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test.types.DynAnyTypes;
//
// IDL:test/types/DynAnyTypes/TestUnion4:1.0
//
final public class TestUnion4Holder implements org.omg.CORBA.portable.Streamable
{
public TestUnion4 value;
public
TestUnion4Holder()
{
}
public
TestUnion4Holder(TestUnion4 initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestUnion4Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestUnion4Helper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestUnion4Helper.type();
}
}
| 5,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.