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/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestShortSeqHelper.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 TestShortSeqHelper
{
public static void
insert(org.omg.CORBA.Any any, short[] val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static short[]
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(), "TestShortSeq", orb.create_sequence_tc(0, orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short)));
}
return typeCode_;
}
public static String
id()
{
return "IDL:test/types/DynAnyTypes/TestShortSeq:1.0";
}
public static short[]
read(org.omg.CORBA.portable.InputStream in)
{
short[] _ob_v;
int len0 = in.read_ulong();
_ob_v = new short[len0];
in.read_short_array(_ob_v, 0, len0);
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, short[] val)
{
int len0 = val.length;
out.write_ulong(len0);
out.write_short_array(val, 0, len0);
}
}
| 5,600 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/DynAnyTypes/TestValue3.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
//
/***/
public abstract class TestValue3 extends TestValue2
{
//
// IDL:test/types/DynAnyTypes/TestValue3/unionVal:1.0
//
/***/
public TestUnion4 unionVal;
private static String[] _OB_truncatableIds_ =
{
TestValue3Helper.id()
};
public String[]
_truncatable_ids()
{
return _OB_truncatableIds_;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
super._read(in);
unionVal = TestUnion4Helper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
super._write(out);
TestUnion4Helper.write(out, unionVal);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestValue3Helper.type();
}
}
| 5,601 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/ConstEnum.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.TestConstModule;
//
// IDL:TestConstModule/ConstEnum:1.0
//
/***/
public interface ConstEnum
{
test.types.Measurement value = test.types.Measurement.METERS;
}
| 5,602 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/ConstBoolean.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.TestConstModule;
//
// IDL:TestConstModule/ConstBoolean:1.0
//
/***/
public interface ConstBoolean
{
boolean value = false;
}
| 5,603 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/ConstString.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.TestConstModule;
//
// IDL:TestConstModule/ConstString:1.0
//
/***/
public interface ConstString
{
String value = "This is ConstString in a module";
}
| 5,604 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/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.TestConstModule;
//
// IDL:TestConstModule/ConstDouble:1.0
//
/***/
public interface ConstDouble
{
double value = (double)(2.890588999999994967993188765831291675567626953125D);
}
| 5,605 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/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.TestConstModule;
//
// IDL:TestConstModule/ConstLong:1.0
//
/***/
public interface ConstLong
{
int value = (int)(12345678L);
}
| 5,606 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/types/TestConstModule/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.TestConstModule;
//
// IDL:TestConstModule/ConstWString:1.0
//
/***/
public interface ConstWString
{
String value = "This is ConstWString in a module";
}
| 5,607 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestHelper.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
final public class TestHelper
{
public static void
insert(org.omg.CORBA.Any any, Test val)
{
any.insert_Object(val, type());
}
public static Test
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(), "Test");
}
return typeCode_;
}
public static String
id()
{
return "IDL:Test:1.0";
}
public static Test
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Test)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_TestStub _ob_stub = new _TestStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Test val)
{
out.write_Object(val);
}
public static Test
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_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 Test
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,608 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
import org.omg.IOP.IOR;
public class ClientPlugin implements ConnectionHelper {
public static final String CLIENT_ARGS = "TestingClient";
static private boolean constructed = false;
static private boolean initialized = false;
static private boolean createdConnection = false;
public ClientPlugin() {
System.out.println("Client-side connection helper constructed");
constructed = true;
}
public void init(ORB orb, String parms) {
System.out.println("Initializing client-side connection helper with parms " + parms);
if (!parms.equals(CLIENT_ARGS)) {
throw new IllegalArgumentException("Invalid client initialization argument " + parms);
}
initialized = true;
}
public Socket createSocket(IOR ior, Policy[] policies, InetAddress address, int port) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating client socket connection for IOR=" + ior + " address=" + address + " port=" + port);
createdConnection = true;
return new Socket(address, port);
}
public Socket createSelfConnection(InetAddress address, int port) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating self client socket connection for address=" + address + " port=" + port);
return new Socket(address, port);
}
public ServerSocket createServerSocket(int port, int backlog) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating server socket for port=" + port + " backlog=" + backlog);;
return new ServerSocket(port, backlog);
}
public ServerSocket createServerSocket(int port, int backlog, InetAddress address) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating server socket for port=" + port + " backlog=" + backlog + " address=" + address);
return new ServerSocket(port, backlog, address);
}
static public boolean testPassed() {
System.out.println("constructed=" + constructed + " initalized=" + initialized + " createdConnection=" + createdConnection);
return constructed && initialized && createdConnection;
}
}
| 5,609 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/LocalTestHolder.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:LocalTest:1.0
//
final public class LocalTestHolder implements org.omg.CORBA.portable.Streamable
{
public LocalTest value;
public
LocalTestHolder()
{
}
public
LocalTestHolder(LocalTest initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = LocalTestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
LocalTestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return LocalTestHelper.type();
}
}
| 5,610 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/LocalTestOperations.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:LocalTest:1.0
//
/***/
public interface LocalTestOperations extends TestOperations
{
}
| 5,611 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestORBInitializer.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import org.omg.CORBA.LocalObject;
import org.omg.PortableInterceptor.ORBInitInfo;
import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
import org.omg.PortableInterceptor.ORBInitializer;
public class TestORBInitializer extends LocalObject implements ORBInitializer {
public TestORBInitializer() {
}
/**
* Called during ORB initialization. If it is expected that initial
* services registered by an interceptor will be used by other
* interceptors, then those initial services shall be registered at
* this point via calls to
* <code>ORBInitInfo.register_initial_reference</code>.
*
* @param info provides initialization attributes and operations by
* which Interceptors can be registered.
*/
public void pre_init(ORBInitInfo info) {
}
/**
* Called during ORB initialization. If a service must resolve initial
* references as part of its initialization, it can assume that all
* initial references will be available at this point.
* <p/>
* Calling the <code>post_init</code> operations is not the final
* task of ORB initialization. The final task, following the
* <code>post_init</code> calls, is attaching the lists of registered
* interceptors to the ORB. Therefore, the ORB does not contain the
* interceptors during calls to <code>post_init</code>. If an
* ORB-mediated call is made from within <code>post_init</code>, no
* request interceptors will be invoked on that call.
* Likewise, if an operation is performed which causes an IOR to be
* created, no IOR interceptors will be invoked.
*
* @param info provides initialization attributes and
* operations by which Interceptors can be registered.
*/
public void post_init(ORBInitInfo info) {
try {
try {
info.add_server_request_interceptor(new ServiceContextInterceptor());
} catch (DuplicateName dn) {
}
} catch (RuntimeException re) {
throw re;
}
}
}
| 5,612 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/LocalTestHelper.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:LocalTest:1.0
//
final public class LocalTestHelper
{
public static void
insert(org.omg.CORBA.Any any, LocalTest val)
{
any.insert_Object(val, type());
}
public static LocalTest
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_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "LocalTest");
}
return typeCode_;
}
public static String
id()
{
return "IDL:LocalTest:1.0";
}
public static LocalTest
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL();
}
public static void
write(org.omg.CORBA.portable.OutputStream out, LocalTest val)
{
throw new org.omg.CORBA.MARSHAL();
}
public static LocalTest
narrow(org.omg.CORBA.Object val)
{
try
{
return (LocalTest)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM();
}
}
| 5,613 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestHolder.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
final public class TestHolder implements org.omg.CORBA.portable.Streamable
{
public Test value;
public
TestHolder()
{
}
public
TestHolder(Test initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestHelper.type();
}
}
| 5,614 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/Client.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
public class Client extends test.common.TestBase {
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
//
// Get "test" object
//
org.omg.CORBA.Object obj = orb.string_to_object("relfile:/Test.ref");
if (obj == null) {
System.err.println("cannot read IOR from Test.ref");
return 1;
}
Test test = TestHelper.narrow(obj);
assertTrue(test != null);
Test localTest = new LocalTest_impl();
org.omg.IOP.CodecFactory factory = org.omg.IOP.CodecFactoryHelper
.narrow(orb.resolve_initial_references("CodecFactory"));
assertTrue(factory != null);
org.omg.IOP.Encoding how = new org.omg.IOP.Encoding();
how.major_version = 0;
how.minor_version = 0;
how.format = org.omg.IOP.ENCODING_CDR_ENCAPS.value;
org.omg.IOP.Codec codec = factory.create_codec(how);
assertTrue(codec != null);
System.out.print("Testing Codec... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, test);
byte[] data = codec.encode_value(a);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
System.out.print("Testing simple RPC call... ");
System.out.flush();
test.say("Hi");
System.out.println("Done!");
System.out.print("Testing passing non-local object... ");
System.out.flush();
try {
test.intest(test);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
System.out.print("Testing passing local object... ");
System.out.flush();
try {
test.intest(localTest);
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
System.out.print("Testing passing non-local object in any... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, test);
test.inany(a);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
// if (!ServerPlugin.testPassed()) {
// TEST(false);
// }
if (!ClientPlugin.testPassed()) {
assertTrue(false);
}
System.out.println("Done!");
test.shutdown();
return 0;
}
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");
String[] arguments = new String[] { "-IIOPconnectionHelper", "test.iiopplugin.ClientPlugin", "-IIOPconnectionHelperArgs", ClientPlugin.CLIENT_ARGS };
int status = 0;
ORB orb = null;
try {
orb = ORB.init(arguments, props);
status = run(orb, arguments);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,615 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/Test_impl.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
public class Test_impl extends TestPOA {
private org.omg.PortableServer.POA poa_;
private Test localTest_;
private static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
public Test_impl(org.omg.PortableServer.POA poa) {
poa_ = poa;
localTest_ = new LocalTest_impl();
}
public org.omg.PortableServer.POA _default_POA() {
if (poa_ != null)
return poa_;
else
return super._default_POA();
}
public void say(String s) {
// System.out.println(s);
}
public void intest(Test t) {
t.say("hi");
}
public void inany(org.omg.CORBA.Any a) {
Test t = TestHelper.extract(a);
}
public void outany(org.omg.CORBA.AnyHolder a) {
a.value = _orb().create_any();
TestHelper.insert(a.value, localTest_);
}
public Test returntest() {
return localTest_;
}
public void shutdown() {
_orb().shutdown(false);
if (!ServerPlugin.testPassed())
throw new test.common.TestException();
}
}
| 5,616 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestPOA.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
public abstract class TestPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
TestOperations
{
static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public Test
_this()
{
return TestHelper.narrow(super._this_object());
}
public Test
_this(org.omg.CORBA.ORB orb)
{
return TestHelper.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)
{
final String[] _ob_names =
{
"inany",
"intest",
"outany",
"returntest",
"say",
"shutdown"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // inany
return _OB_op_inany(in, handler);
case 1: // intest
return _OB_op_intest(in, handler);
case 2: // outany
return _OB_op_outany(in, handler);
case 3: // returntest
return _OB_op_returntest(in, handler);
case 4: // say
return _OB_op_say(in, handler);
case 5: // shutdown
return _OB_op_shutdown(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_inany(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.Any _ob_a0 = in.read_any();
inany(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_intest(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Test _ob_a0 = TestHelper.read(in);
intest(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_outany(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.AnyHolder _ob_ah0 = new org.omg.CORBA.AnyHolder();
outany(_ob_ah0);
out = handler.createReply();
out.write_any(_ob_ah0.value);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_returntest(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Test _ob_r = returntest();
out = handler.createReply();
TestHelper.write(out, _ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_say(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_a0 = in.read_string();
say(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_shutdown(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
shutdown();
out = handler.createReply();
return out;
}
}
| 5,617 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/LocalTest_impl.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
public class LocalTest_impl extends org.omg.CORBA.LocalObject implements
LocalTest {
public void say(String s) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void intest(Test t) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void inany(org.omg.CORBA.Any a) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void outany(org.omg.CORBA.AnyHolder a) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public Test returntest() {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void shutdown() {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
}
| 5,618 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestOperations.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
/***/
public interface TestOperations
{
//
// IDL:Test/say:1.0
//
/***/
void
say(String s);
//
// IDL:Test/intest:1.0
//
/***/
void
intest(Test t);
//
// IDL:Test/inany:1.0
//
/***/
void
inany(org.omg.CORBA.Any a);
//
// IDL:Test/outany:1.0
//
/***/
void
outany(org.omg.CORBA.AnyHolder a);
//
// IDL:Test/returntest:1.0
//
/***/
Test
returntest();
//
// IDL:Test/shutdown:1.0
//
/***/
void
shutdown();
}
| 5,619 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/TestPOATie.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
public class TestPOATie extends TestPOA
{
private TestOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
TestPOATie(TestOperations delegate)
{
_ob_delegate_ = delegate;
}
public
TestPOATie(TestOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public TestOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(TestOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:Test/say:1.0
//
public void
say(String s)
{
_ob_delegate_.say(s);
}
//
// IDL:Test/intest:1.0
//
public void
intest(Test t)
{
_ob_delegate_.intest(t);
}
//
// IDL:Test/inany:1.0
//
public void
inany(org.omg.CORBA.Any a)
{
_ob_delegate_.inany(a);
}
//
// IDL:Test/outany:1.0
//
public void
outany(org.omg.CORBA.AnyHolder a)
{
_ob_delegate_.outany(a);
}
//
// IDL:Test/returntest:1.0
//
public Test
returntest()
{
return _ob_delegate_.returntest();
}
//
// IDL:Test/shutdown:1.0
//
public void
shutdown()
{
_ob_delegate_.shutdown();
}
}
| 5,620 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/Test.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
/***/
public interface Test extends TestOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,621 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/LocalTest.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:LocalTest:1.0
//
/***/
public interface LocalTest extends LocalTestOperations,
Test
{
}
| 5,622 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import java.net.Socket;
import org.apache.yoko.orb.PortableInterceptor.ServerRequestInfoExt;
import org.apache.yoko.orb.OCI.TransportInfo;
import org.apache.yoko.orb.OCI.IIOP.TransportInfo_impl;
import org.omg.CORBA.LocalObject;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.PortableInterceptor.ServerRequestInterceptor;
/**
* @version $Revision: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
final class ServiceContextInterceptor extends LocalObject implements ServerRequestInterceptor {
public ServiceContextInterceptor() {
}
public void receive_request(ServerRequestInfo ri) {
}
public void receive_request_service_contexts(ServerRequestInfo ri) {
ServerRequestInfoExt riExt = (ServerRequestInfoExt) ri;
TransportInfo_impl connection = (TransportInfo_impl)riExt.getTransportInfo();
if (connection != null) {
String remoteHost = connection.remote_addr();
if (remoteHost != null && remoteHost.length() > 0) {
System.out.println("Retrieved remote host successfully");
return;
}
}
}
public void send_exception(ServerRequestInfo ri) {
}
public void send_other(ServerRequestInfo ri) {
}
public void send_reply(ServerRequestInfo ri) {
}
public void destroy() {
}
public String name() {
return "test.iiopplugin.ServiceContextInterceptor";
}
}
| 5,623 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/_TestStub.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
//
// IDL:Test:1.0
//
public class _TestStub extends org.omg.CORBA.portable.ObjectImpl
implements Test
{
private static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestOperations.class;
//
// IDL:Test/say:1.0
//
public void
say(String _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("say", true);
out.write_string(_ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("say", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.say(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/intest:1.0
//
public void
intest(Test _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("intest", true);
TestHelper.write(out, _ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("intest", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.intest(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/inany:1.0
//
public void
inany(org.omg.CORBA.Any _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("inany", true);
out.write_any(_ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("inany", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.inany(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/outany:1.0
//
public void
outany(org.omg.CORBA.AnyHolder _ob_ah0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("outany", true);
in = _invoke(out);
_ob_ah0.value = in.read_any();
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("outany", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.outany(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/returntest:1.0
//
public Test
returntest()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("returntest", true);
in = _invoke(out);
Test _ob_r = TestHelper.read(in);
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("returntest", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
return _ob_self.returntest();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/shutdown:1.0
//
public void
shutdown()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("shutdown", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("shutdown", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.shutdown();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,624 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/Server.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
public class Server {
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
//
// Resolve Root POA
//
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
//
// Get a reference to the POA manager and activate it
//
POAManager manager = poa.the_POAManager();
manager.activate();
//
// Create implementation object
//
Test_impl testImpl = new Test_impl(poa);
Test test = testImpl._this(orb);
//
// Save reference. This must be done after POA manager
// activation, otherwise there is a potential for a race
// condition between the client sending a request and the
// server not being ready yet.
//
String refFile = "Test.ref";
try {
String ref = orb.object_to_string(test);
java.io.FileOutputStream file = new java.io.FileOutputStream(
refFile);
java.io.PrintWriter out = new java.io.PrintWriter(file);
out.println(ref);
out.flush();
file.close();
} catch (java.io.IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
return 1;
}
//
// Run implementation
//
orb.run();
//
// Delete file
//
new java.io.File(refFile).delete();
return 0;
}
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");
props.put("org.omg.PortableInterceptor.ORBInitializerClass.test.iiopplugin.TestORBInitializer", "");
String[] arguments = new String[] { "-IIOPconnectionHelper", "test.iiopplugin.ServerPlugin", "-IIOPconnectionHelperArgs", ServerPlugin.SERVER_ARGS };
int status = 0;
ORB orb = null;
try {
orb = ORB.init(arguments, props);
status = run(orb, arguments);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,625 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.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.
*/
/**
* @version $Rev: 491396 $ $Date: 2006-12-30 22:06:13 -0800 (Sat, 30 Dec 2006) $
*/
package test.iiopplugin;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
import org.omg.CORBA.Policy;
import org.omg.CORBA.ORB;
import org.omg.IOP.IOR;
public class ServerPlugin implements ConnectionHelper {
public static final String SERVER_ARGS = "TestingServer";
static private boolean constructed = false;
static private boolean initialized = false;
static private boolean createdSelfConnection = false;
static private boolean createdServerConnection = false;
public ServerPlugin() {
System.out.println("Server-side connection helper constructed");
constructed = true;
}
public void init(ORB orb, String parms) {
System.out.println("Initializing server-side connection helper with parms " + parms);
if (!parms.equals(SERVER_ARGS)) {
throw new IllegalArgumentException("Invalid server initialization argument " + parms);
}
initialized = true;
}
public Socket createSocket(IOR ior, Policy[] policies, InetAddress address, int port) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating client socket connection for IOR=" + ior + " address=" + address + " port=" + port);
return new Socket(address, port);
}
public Socket createSelfConnection(InetAddress address, int port) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating self client socket connection for address=" + address + " port=" + port);
createdSelfConnection = true;
return new Socket(address, port);
}
public ServerSocket createServerSocket(int port, int backlog) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating server socket for port=" + port + " backlog=" + backlog);;
createdServerConnection = true;
return new ServerSocket(port, backlog);
}
public ServerSocket createServerSocket(int port, int backlog, InetAddress address) throws IOException, ConnectException {
System.out.println("Plugin " + this + " creating server socket for port=" + port + " backlog=" + backlog + " address=" + address);
createdServerConnection = true;
return new ServerSocket(port, backlog, address);
}
static public boolean testPassed() {
System.out.println("constructed=" + constructed + " initalized=" + initialized + " createdSelfConnection=" + createdSelfConnection + " createdServerConnection=" + createdServerConnection);
return constructed && initialized && createdServerConnection;
}
}
| 5,626 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServer_impl.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.retry;
public class RetryServer_impl extends RetryServerPOA {
private org.omg.PortableServer.POA poa_;
private Test test_;
private Retry retry_;
public RetryServer_impl(org.omg.PortableServer.POA poa, Test test,
Retry retry) {
poa_ = poa;
test_ = test;
retry_ = retry;
}
public org.omg.PortableServer.POA _default_POA() {
if (poa_ != null)
return poa_;
else
return super._default_POA();
}
public Test get_location_forward_object() {
return test_;
}
public Retry get_retry_object() {
return retry_;
}
public void deactivate() {
_orb().shutdown(false);
}
}
| 5,627 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/TestHelper.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.retry;
//
// IDL:Test:1.0
//
final public class TestHelper
{
public static void
insert(org.omg.CORBA.Any any, Test val)
{
any.insert_Object(val, type());
}
public static Test
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(), "Test");
}
return typeCode_;
}
public static String
id()
{
return "IDL:Test:1.0";
}
public static Test
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Test)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_TestStub _ob_stub = new _TestStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Test val)
{
out.write_Object(val);
}
public static Test
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_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 Test
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,628 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryPOA.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.retry;
//
// IDL:Retry:1.0
//
public abstract class RetryPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
RetryOperations
{
static final String[] _ob_ids_ =
{
"IDL:Retry:1.0",
"IDL:Test:1.0"
};
public Retry
_this()
{
return RetryHelper.narrow(super._this_object());
}
public Retry
_this(org.omg.CORBA.ORB orb)
{
return RetryHelper.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)
{
final String[] _ob_names =
{
"aMethod",
"get_count",
"raise_exception"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // aMethod
return _OB_op_aMethod(in, handler);
case 1: // get_count
return _OB_op_get_count(in, handler);
case 2: // raise_exception
return _OB_op_raise_exception(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_aMethod(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
aMethod();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_get_count(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
int _ob_r = get_count();
out = handler.createReply();
out.write_ulong(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_raise_exception(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
int _ob_a0 = in.read_ulong();
boolean _ob_a1 = in.read_boolean();
raise_exception(_ob_a0, _ob_a1);
out = handler.createReply();
return out;
}
}
| 5,629 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/_RetryServerStub.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.retry;
//
// IDL:RetryServer:1.0
//
public class _RetryServerStub extends org.omg.CORBA.portable.ObjectImpl
implements RetryServer
{
private static final String[] _ob_ids_ =
{
"IDL:RetryServer:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = RetryServerOperations.class;
//
// IDL:RetryServer/get_location_forward_object:1.0
//
public Test
get_location_forward_object()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("get_location_forward_object", true);
in = _invoke(out);
Test _ob_r = TestHelper.read(in);
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("get_location_forward_object", _ob_opsClass);
if(_ob_so == null)
continue;
RetryServerOperations _ob_self = (RetryServerOperations)_ob_so.servant;
try
{
return _ob_self.get_location_forward_object();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:RetryServer/get_retry_object:1.0
//
public Retry
get_retry_object()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("get_retry_object", true);
in = _invoke(out);
Retry _ob_r = RetryHelper.read(in);
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("get_retry_object", _ob_opsClass);
if(_ob_so == null)
continue;
RetryServerOperations _ob_self = (RetryServerOperations)_ob_so.servant;
try
{
return _ob_self.get_retry_object();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:RetryServer/deactivate:1.0
//
public void
deactivate()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("deactivate", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("deactivate", _ob_opsClass);
if(_ob_so == null)
continue;
RetryServerOperations _ob_self = (RetryServerOperations)_ob_so.servant;
try
{
_ob_self.deactivate();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,630 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServerOperations.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.retry;
//
// IDL:RetryServer:1.0
//
/***/
public interface RetryServerOperations
{
//
// IDL:RetryServer/get_location_forward_object:1.0
//
/***/
Test
get_location_forward_object();
//
// IDL:RetryServer/get_retry_object:1.0
//
/***/
Retry
get_retry_object();
//
// IDL:RetryServer/deactivate:1.0
//
/***/
void
deactivate();
}
| 5,631 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/TestHolder.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.retry;
//
// IDL:Test:1.0
//
final public class TestHolder implements org.omg.CORBA.portable.Streamable
{
public Test value;
public
TestHolder()
{
}
public
TestHolder(Test initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestHelper.type();
}
}
| 5,632 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/Client.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.retry;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
public class Client extends test.common.TestBase {
static void testLocationForward(org.omg.CORBA.ORB orb, RetryServer server) {
System.out.print("Testing forwarding loop detection... ");
System.out.flush();
//
// Verify that we detect excessive forwarding
//
Test test = server.get_location_forward_object();
try {
test.aMethod();
assertTrue(false);
} catch (org.omg.CORBA.TRANSIENT ex) {
// Expected
assertTrue(ex.minor == org.apache.yoko.orb.OB.MinorCodes.MinorLocationForwardHopCountExceeded);
}
System.out.println("Done!");
}
static Retry getRetry(org.omg.CORBA.ORB orb, Retry orig, short mode,
int interval, int max, boolean remote) {
try {
org.apache.yoko.orb.OB.RetryAttributes attrib = new org.apache.yoko.orb.OB.RetryAttributes();
attrib.mode = mode;
attrib.interval = interval;
attrib.max = max;
attrib.remote = remote;
org.omg.CORBA.Any a = orb.create_any();
org.apache.yoko.orb.OB.RetryAttributesHelper.insert(a, attrib);
org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[1];
policies[0] = orb.create_policy(
org.apache.yoko.orb.OB.RETRY_POLICY_ID.value, a);
org.omg.CORBA.Object obj = orig._set_policy_override(policies,
org.omg.CORBA.SetOverrideType.SET_OVERRIDE);
return RetryHelper.narrow(obj);
} catch (org.omg.CORBA.UserException ex) {
ex.printStackTrace();
assertTrue(false);
return null;
}
}
static void testRetry(org.omg.CORBA.ORB orb, RetryServer server) {
Retry retry;
Retry orig = server.get_retry_object();
//
// Test: Do not retry on remote exceptions
//
System.out.print("Testing retry for remote exceptions... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
0, 0, false);
retry.raise_exception(1, false);
try {
retry.aMethod();
assertTrue(false);
} catch (org.omg.CORBA.TRANSIENT ex) {
// Expected
assertTrue(retry.get_count() == 1);
}
//
// Test: Retry once on remote exceptions
//
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
0, 0, true);
retry.raise_exception(1, false);
try {
retry.aMethod();
assertTrue(retry.get_count() == 2);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
//
// Test: Don't retry if completion status is COMPLETED_MAYBE and
// mode is RETRY_STRICT
//
System.out.print("Testing RETRY_STRICT... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
0, 0, true);
retry.raise_exception(1, true);
try {
retry.aMethod();
assertTrue(false);
} catch (org.omg.CORBA.SystemException ex) {
// Expected
assertTrue(retry.get_count() == 1);
}
System.out.println("Done!");
//
// Test: RETRY_NEVER
//
System.out.print("Testing RETRY_NEVER... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_NEVER.value,
0, 0, true);
retry.raise_exception(1, false);
try {
retry.aMethod();
assertTrue(false);
} catch (org.omg.CORBA.TRANSIENT ex) {
// Expected
assertTrue(retry.get_count() == 1);
}
System.out.println("Done!");
//
// Test: RETRY_ALWAYS
//
System.out.print("Testing RETRY_ALWAYS... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_ALWAYS.value,
0, 0, true);
retry.raise_exception(1, true);
try {
retry.aMethod();
assertTrue(retry.get_count() == 2);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
//
// Test: Retry five times
//
System.out.print("Testing multiple retries... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
0, 0, true);
retry.raise_exception(5, false);
try {
retry.aMethod();
assertTrue(retry.get_count() == 6);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
//
// Test: Retry five times with failure
//
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
0, 5, true);
retry.raise_exception(6, false);
try {
retry.aMethod();
assertTrue(false);
} catch (org.omg.CORBA.TRANSIENT ex) {
// Expected
assertTrue(retry.get_count() == 6);
}
System.out.println("Done!");
//
// Test: Retry interval
//
System.out.print("Testing retry interval... ");
System.out.flush();
retry = getRetry(orb, orig, org.apache.yoko.orb.OB.RETRY_STRICT.value,
100, 0, true);
retry.raise_exception(12, false);
try {
long start = System.currentTimeMillis();
retry.aMethod();
long stop = System.currentTimeMillis();
assertTrue((stop - start) > 1000);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
}
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 {
orb = org.omg.CORBA.ORB.init(args, props);
org.omg.CORBA.Object obj = orb
.string_to_object("relfile:/Test.ref");
if (obj == null) {
System.err.println("cannot read IOR from Test.ref");
System.exit(1);
}
RetryServer server = RetryServerHelper.narrow(obj);
assertTrue(server != null);
testLocationForward(orb, server);
testRetry(orb, server);
server.deactivate();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,633 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/Retry.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.retry;
//
// IDL:Retry:1.0
//
/***/
public interface Retry extends RetryOperations,
Test,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,634 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/TestPOA.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.retry;
//
// IDL:Test:1.0
//
public abstract class TestPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
TestOperations
{
static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public Test
_this()
{
return TestHelper.narrow(super._this_object());
}
public Test
_this(org.omg.CORBA.ORB orb)
{
return TestHelper.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)
{
final String[] _ob_names =
{
"aMethod"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // aMethod
return _OB_op_aMethod(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_aMethod(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
aMethod();
out = handler.createReply();
return out;
}
}
| 5,635 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/TestOperations.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.retry;
//
// IDL:Test:1.0
//
/***/
public interface TestOperations
{
//
// IDL:Test/aMethod:1.0
//
/***/
void
aMethod();
}
| 5,636 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/Retry_impl.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.retry;
public class Retry_impl extends RetryPOA {
private org.omg.PortableServer.POA poa_;
private int count_;
private int max_;
private boolean maybe_;
public Retry_impl(org.omg.PortableServer.POA poa) {
poa_ = poa;
}
public org.omg.PortableServer.POA _default_POA() {
if (poa_ != null)
return poa_;
else
return super._default_POA();
}
public void aMethod() {
count_++;
if (max_ > 0 && count_ <= max_) {
if (maybe_)
throw new org.omg.CORBA.TRANSIENT(0,
org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
else
throw new org.omg.CORBA.TRANSIENT(0,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
}
public int get_count() {
return count_;
}
public void raise_exception(int max, boolean maybe) {
count_ = 0;
max_ = max;
maybe_ = maybe;
}
}
| 5,637 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServer.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.retry;
//
// IDL:RetryServer:1.0
//
/***/
public interface RetryServer extends RetryServerOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,638 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryOperations.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.retry;
//
// IDL:Retry:1.0
//
/***/
public interface RetryOperations extends TestOperations
{
//
// IDL:Retry/get_count:1.0
//
/***/
int
get_count();
//
// IDL:Retry/raise_exception:1.0
//
/***/
void
raise_exception(int max,
boolean maybe);
}
| 5,639 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryHolder.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.retry;
//
// IDL:Retry:1.0
//
final public class RetryHolder implements org.omg.CORBA.portable.Streamable
{
public Retry value;
public
RetryHolder()
{
}
public
RetryHolder(Retry initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = RetryHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
RetryHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return RetryHelper.type();
}
}
| 5,640 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/Test.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.retry;
//
// IDL:Test:1.0
//
/***/
public interface Test extends TestOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,641 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryHelper.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.retry;
//
// IDL:Retry:1.0
//
final public class RetryHelper
{
public static void
insert(org.omg.CORBA.Any any, Retry val)
{
any.insert_Object(val, type());
}
public static Retry
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(), "Retry");
}
return typeCode_;
}
public static String
id()
{
return "IDL:Retry:1.0";
}
public static Retry
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Retry)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_RetryStub _ob_stub = new _RetryStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Retry val)
{
out.write_Object(val);
}
public static Retry
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Retry)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_RetryStub _ob_stub = new _RetryStub();
_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 Retry
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Retry)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_RetryStub _ob_stub = new _RetryStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,642 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/_TestStub.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.retry;
//
// IDL:Test:1.0
//
public class _TestStub extends org.omg.CORBA.portable.ObjectImpl
implements Test
{
private static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestOperations.class;
//
// IDL:Test/aMethod:1.0
//
public void
aMethod()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("aMethod", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("aMethod", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.aMethod();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,643 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/Server.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.retry;
import java.util.Properties;
class FwdLocator_impl extends org.omg.CORBA.LocalObject implements
org.omg.PortableServer.ServantLocator {
private org.omg.CORBA.Object obj_;
public FwdLocator_impl(org.omg.CORBA.Object obj) {
obj_ = obj;
}
public org.omg.PortableServer.Servant preinvoke(byte[] oid,
org.omg.PortableServer.POA poa, String operation,
org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie)
throws org.omg.PortableServer.ForwardRequest {
throw new org.omg.PortableServer.ForwardRequest(obj_);
}
public void postinvoke(byte[] oid, org.omg.PortableServer.POA poa,
String operation, java.lang.Object cookie,
org.omg.PortableServer.Servant servant) {
}
}
public class Server {
public static int run(org.omg.CORBA.ORB orb, String[] args)
throws org.omg.CORBA.UserException {
//
// Resolve Root POA
//
org.omg.PortableServer.POA rootPOA = org.omg.PortableServer.POAHelper
.narrow(orb.resolve_initial_references("RootPOA"));
//
// Get a reference to the POA manager and activate it
//
org.omg.PortableServer.POAManager manager = rootPOA.the_POAManager();
manager.activate();
org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[3];
policies[0] = rootPOA
.create_request_processing_policy(org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
policies[1] = rootPOA
.create_servant_retention_policy(org.omg.PortableServer.ServantRetentionPolicyValue.NON_RETAIN);
policies[2] = rootPOA
.create_implicit_activation_policy(org.omg.PortableServer.ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION);
//
// Create two POAs with servant locators, each with its own
// POAManager (and therefore, each with unique endpoints).
// The locators will simply raise ForwardRequest for the
// given object, thus creating an infinite loop.
//
org.omg.PortableServer.POA poa1 = rootPOA.create_POA("poa1", null,
policies);
org.omg.PortableServer.POA poa2 = rootPOA.create_POA("poa2", null,
policies);
org.omg.CORBA.Object obj1 = poa1.create_reference("IDL:Test:1.0");
org.omg.CORBA.Object obj2 = poa2.create_reference("IDL:Test:1.0");
org.omg.PortableServer.ServantLocator locator1 = new FwdLocator_impl(
obj2);
org.omg.PortableServer.ServantLocator locator2 = new FwdLocator_impl(
obj1);
poa1.set_servant_manager(locator1);
poa2.set_servant_manager(locator2);
Test test = TestHelper.narrow(obj1);
Retry_impl retryImpl = new Retry_impl(rootPOA);
Retry retry = retryImpl._this(orb);
RetryServer_impl serverImpl = new RetryServer_impl(rootPOA, test, retry);
RetryServer server = serverImpl._this(orb);
//
// Save reference. This must be done after POA manager
// activation, otherwise there is a potential for a race
// condition between the client sending a request and the
// server not being ready yet.
//
String refFile = "Test.ref";
try {
String ref = orb.object_to_string(server);
java.io.FileOutputStream file = new java.io.FileOutputStream(
refFile);
java.io.PrintWriter out = new java.io.PrintWriter(file);
out.println(ref);
out.flush();
file.close();
} catch (java.io.IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
return 1;
}
//
// Run implementation
//
org.omg.PortableServer.POAManager mgr = poa1.the_POAManager();
mgr.activate();
mgr = poa2.the_POAManager();
mgr.activate();
orb.run();
//
// Delete file
//
new java.io.File(refFile).delete();
return 0;
}
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 {
orb = org.omg.CORBA.ORB.init(args, props);
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,644 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServerPOA.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.retry;
//
// IDL:RetryServer:1.0
//
public abstract class RetryServerPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
RetryServerOperations
{
static final String[] _ob_ids_ =
{
"IDL:RetryServer:1.0",
};
public RetryServer
_this()
{
return RetryServerHelper.narrow(super._this_object());
}
public RetryServer
_this(org.omg.CORBA.ORB orb)
{
return RetryServerHelper.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)
{
final String[] _ob_names =
{
"deactivate",
"get_location_forward_object",
"get_retry_object"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // deactivate
return _OB_op_deactivate(in, handler);
case 1: // get_location_forward_object
return _OB_op_get_location_forward_object(in, handler);
case 2: // get_retry_object
return _OB_op_get_retry_object(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_deactivate(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
deactivate();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_get_location_forward_object(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Test _ob_r = get_location_forward_object();
out = handler.createReply();
TestHelper.write(out, _ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_get_retry_object(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Retry _ob_r = get_retry_object();
out = handler.createReply();
RetryHelper.write(out, _ob_r);
return out;
}
}
| 5,645 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServerHolder.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.retry;
//
// IDL:RetryServer:1.0
//
final public class RetryServerHolder implements org.omg.CORBA.portable.Streamable
{
public RetryServer value;
public
RetryServerHolder()
{
}
public
RetryServerHolder(RetryServer initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = RetryServerHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
RetryServerHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return RetryServerHelper.type();
}
}
| 5,646 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/_RetryStub.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.retry;
//
// IDL:Retry:1.0
//
public class _RetryStub extends org.omg.CORBA.portable.ObjectImpl
implements Retry
{
private static final String[] _ob_ids_ =
{
"IDL:Retry:1.0",
"IDL:Test:1.0"
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = RetryOperations.class;
//
// IDL:Retry/get_count:1.0
//
public int
get_count()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("get_count", true);
in = _invoke(out);
int _ob_r = in.read_ulong();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("get_count", _ob_opsClass);
if(_ob_so == null)
continue;
RetryOperations _ob_self = (RetryOperations)_ob_so.servant;
try
{
return _ob_self.get_count();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Retry/raise_exception:1.0
//
public void
raise_exception(int _ob_a0,
boolean _ob_a1)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("raise_exception", true);
out.write_ulong(_ob_a0);
out.write_boolean(_ob_a1);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("raise_exception", _ob_opsClass);
if(_ob_so == null)
continue;
RetryOperations _ob_self = (RetryOperations)_ob_so.servant;
try
{
_ob_self.raise_exception(_ob_a0, _ob_a1);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/aMethod:1.0
//
public void
aMethod()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("aMethod", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("aMethod", _ob_opsClass);
if(_ob_so == null)
continue;
RetryOperations _ob_self = (RetryOperations)_ob_so.servant;
try
{
_ob_self.aMethod();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,647 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/retry/RetryServerHelper.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.retry;
//
// IDL:RetryServer:1.0
//
final public class RetryServerHelper
{
public static void
insert(org.omg.CORBA.Any any, RetryServer val)
{
any.insert_Object(val, type());
}
public static RetryServer
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(), "RetryServer");
}
return typeCode_;
}
public static String
id()
{
return "IDL:RetryServer:1.0";
}
public static RetryServer
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (RetryServer)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_RetryServerStub _ob_stub = new _RetryServerStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, RetryServer val)
{
out.write_Object(val);
}
public static RetryServer
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (RetryServer)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_RetryServerStub _ob_stub = new _RetryServerStub();
_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 RetryServer
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (RetryServer)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_RetryServerStub _ob_stub = new _RetryServerStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,648 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/util/MultiException.java | package test.util;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
public class MultiException extends RuntimeException {
private static final String SEP = "--------------------------------------------------------------------------------";
private static final String NULL_COUNT_FORMAT = SEP + "%n%d \u2715 null%n" + SEP + "%n";
private static final String ENTRY_FORMAT = "%n" + SEP + "%n%d \u2715 %s" + SEP + "%n";
private Map<String, Integer> map = new TreeMap<>();
private int nullCount;
public boolean isEmpty() {
return map.isEmpty();
}
public Integer add(Throwable t) {
if (t == null) return nullCount++;
String desc = getDescription(t);
Integer count = map.get(desc);
return count == null ?
map.put(desc, 1) :
map.put(desc, ++count);
}
private String getDescription(Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println(t);
pw.println(SEP);
t.printStackTrace(pw);
pw.flush();
return sw.getBuffer().toString();
}
public <T extends Throwable, F extends Future<T>> MultiException(Iterable<F> results) {
for (F f : results)
try {
add(f.get());
} catch (InterruptedException | ExecutionException e) {
add(e);
}
}
@Override
public void printStackTrace(PrintStream s) {
s.printf(NULL_COUNT_FORMAT, nullCount);
for (Map.Entry<String, Integer> e : map.entrySet()) s.printf(ENTRY_FORMAT, e.getValue(), e.getKey());
}
@Override
public void printStackTrace(PrintWriter s) {
s.printf(NULL_COUNT_FORMAT, nullCount);
for (Map.Entry<String, Integer> e : map.entrySet()) s.printf(ENTRY_FORMAT, e.getValue(), e.getKey());
}
}
| 5,649 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/util/Skellington.java | package test.util;
import org.apache.yoko.orb.OBPortableServer.POAHelper;
import org.junit.Assert;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ResponseHandler;
import org.omg.CORBA.portable.UnknownException;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import org.omg.PortableServer.Servant;
import javax.rmi.CORBA.Tie;
import javax.rmi.CORBA.Util;
import javax.rmi.CORBA.ValueHandler;
import java.lang.reflect.Method;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.*;
public abstract class Skellington extends Servant implements Tie, Remote {
private final Collection<Class<? extends Remote>> interfaceClasses;
private final String[] ids;
public Skellington() {
Set<Class<? extends Remote>> ifaces = new HashSet<>();
for (Class<?> c = this.getClass(); c != Object.class; c = c.getSuperclass()) {
NEXT_CLASS: for (Class<?> iface: c.getInterfaces()) {
if (Remote.class.isAssignableFrom(iface)) {
for (Method m : iface.getMethods()) {
if (Arrays.asList(m.getExceptionTypes()).contains(RemoteException.class))
continue;
continue NEXT_CLASS;
}
// there were no non-remote methods, so add the interface
ifaces.add((Class<? extends Remote>)iface);
}
}
}
final ValueHandler vh = Util.createValueHandler();
this.interfaceClasses = Collections.unmodifiableSet(ifaces);
this.ids = new String[interfaceClasses.size()];
int index = 0;
for (Class<?> c : interfaceClasses)
this.ids[index++] = vh.getRMIRepositoryID(c);
}
public Skellington(Class<? extends Remote>... interfaces) {
final ValueHandler vh = Util.createValueHandler();
ids = new String[interfaces.length];
List<Class<? extends Remote>> iflst = new ArrayList<>();
for (int i = 0; i < interfaces.length; i++) {
Assert.assertTrue(interfaces[i].isInterface());
iflst.add(interfaces[i]);
ids[i] = vh.getRMIRepositoryID(interfaces[i]);
}
this.interfaceClasses = Collections.unmodifiableList(iflst);
}
@Override
public String[] _all_interfaces(POA poa, byte[] objectId) {
return ids.clone();
}
@Override
public org.omg.CORBA.Object thisObject() {
return _this_object();
}
@Override
public void deactivate() throws NoSuchObjectException {
try{
_poa().deactivate_object(_poa().servant_to_id(this));
} catch (WrongPolicy |ObjectNotActive |ServantNotActive ignored){}
}
@Override
public ORB orb() {return _orb();}
@Override
public void orb(ORB orb) {
try {
((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
} catch(ClassCastException e) {
throw new BAD_PARAM("POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
}
}
@Override
public void setTarget(Remote target) {
throw new UnsupportedOperationException();
}
@Override
public Remote getTarget() {
return this;
}
@Override
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
try {
return dispatch(method, (org.omg.CORBA_2_3.portable.InputStream) _in, reply);
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
public String publish(ORB serverORB) throws InvalidName, AdapterInactive, ServantAlreadyActive, WrongPolicy {
POA rootPOA = POAHelper.narrow(serverORB.resolve_initial_references("RootPOA"));
rootPOA.the_POAManager().activate();
rootPOA.activate_object(this);
return serverORB.object_to_string(thisObject());
}
protected abstract OutputStream dispatch(String method, org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply) throws RemoteException;
}
| 5,650 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/TestHelper.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.local;
//
// IDL:Test:1.0
//
final public class TestHelper
{
public static void
insert(org.omg.CORBA.Any any, Test val)
{
any.insert_Object(val, type());
}
public static Test
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(), "Test");
}
return typeCode_;
}
public static String
id()
{
return "IDL:Test:1.0";
}
public static Test
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Test)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_TestStub _ob_stub = new _TestStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Test val)
{
out.write_Object(val);
}
public static Test
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_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 Test
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Test)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestStub _ob_stub = new _TestStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,651 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/LocalTestHolder.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.local;
//
// IDL:LocalTest:1.0
//
final public class LocalTestHolder implements org.omg.CORBA.portable.Streamable
{
public LocalTest value;
public
LocalTestHolder()
{
}
public
LocalTestHolder(LocalTest initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = LocalTestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
LocalTestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return LocalTestHelper.type();
}
}
| 5,652 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/LocalTestOperations.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.local;
//
// IDL:LocalTest:1.0
//
/***/
public interface LocalTestOperations extends TestOperations
{
}
| 5,653 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/LocalTestHelper.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.local;
//
// IDL:LocalTest:1.0
//
final public class LocalTestHelper
{
public static void
insert(org.omg.CORBA.Any any, LocalTest val)
{
any.insert_Object(val, type());
}
public static LocalTest
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_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "LocalTest");
}
return typeCode_;
}
public static String
id()
{
return "IDL:LocalTest:1.0";
}
public static LocalTest
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL();
}
public static void
write(org.omg.CORBA.portable.OutputStream out, LocalTest val)
{
throw new org.omg.CORBA.MARSHAL();
}
public static LocalTest
narrow(org.omg.CORBA.Object val)
{
try
{
return (LocalTest)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM();
}
}
| 5,654 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/TestHolder.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.local;
//
// IDL:Test:1.0
//
final public class TestHolder implements org.omg.CORBA.portable.Streamable
{
public Test value;
public
TestHolder()
{
}
public
TestHolder(Test initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestHelper.type();
}
}
| 5,655 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/Client.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.local;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
public class Client extends test.common.TestBase {
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
//
// Get "test" object
//
org.omg.CORBA.Object obj = orb.string_to_object("relfile:/Test.ref");
if (obj == null) {
System.err.println("cannot read IOR from Test.ref");
return 1;
}
Test test = TestHelper.narrow(obj);
assertTrue(test != null);
Test localTest = new LocalTest_impl();
org.omg.IOP.CodecFactory factory = org.omg.IOP.CodecFactoryHelper
.narrow(orb.resolve_initial_references("CodecFactory"));
assertTrue(factory != null);
org.omg.IOP.Encoding how = new org.omg.IOP.Encoding();
how.major_version = 0;
how.minor_version = 0;
how.format = org.omg.IOP.ENCODING_CDR_ENCAPS.value;
org.omg.IOP.Codec codec = factory.create_codec(how);
assertTrue(codec != null);
System.out.print("Testing Codec... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, test);
byte[] data = codec.encode_value(a);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, localTest);
byte[] data = codec.encode_value(a);
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
System.out.print("Testing simple RPC call... ");
System.out.flush();
test.say("Hi");
System.out.println("Done!");
System.out.print("Testing passing non-local object... ");
System.out.flush();
try {
test.intest(test);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
System.out.print("Testing passing local object... ");
System.out.flush();
try {
test.intest(localTest);
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
System.out.print("Testing passing non-local object in any... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, test);
test.inany(a);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
System.out.print("Testing insertion of local object in any... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, localTest);
Test t = TestHelper.extract(a);
assertTrue(t == localTest);
} catch (org.omg.CORBA.SystemException ex) {
assertTrue(false);
}
System.out.println("Done!");
System.out.print("Testing passing local object in any... ");
System.out.flush();
try {
org.omg.CORBA.Any a = orb.create_any();
TestHelper.insert(a, localTest);
test.inany(a);
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
System.out.print("Testing returning local object... ");
System.out.flush();
try {
Test t = test.returntest();
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
System.out.print("Testing returning local object in any... ");
System.out.flush();
try {
org.omg.CORBA.AnyHolder a = new org.omg.CORBA.AnyHolder();
test.outany(a);
assertTrue(false);
} catch (org.omg.CORBA.MARSHAL ex) {
// Expected
}
System.out.println("Done!");
test.shutdown();
return 0;
}
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;
ORB orb = null;
try {
orb = ORB.init(args, props);
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,656 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/Test_impl.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.local;
public class Test_impl extends TestPOA {
private org.omg.PortableServer.POA poa_;
private Test localTest_;
private static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
public Test_impl(org.omg.PortableServer.POA poa) {
poa_ = poa;
localTest_ = new LocalTest_impl();
}
public org.omg.PortableServer.POA _default_POA() {
if (poa_ != null)
return poa_;
else
return super._default_POA();
}
public void say(String s) {
// System.out.println(s);
}
public void intest(Test t) {
t.say("hi");
}
public void inany(org.omg.CORBA.Any a) {
Test t = TestHelper.extract(a);
}
public void outany(org.omg.CORBA.AnyHolder a) {
a.value = _orb().create_any();
TestHelper.insert(a.value, localTest_);
}
public Test returntest() {
return localTest_;
}
public void shutdown() {
_orb().shutdown(false);
}
}
| 5,657 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/TestPOA.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.local;
//
// IDL:Test:1.0
//
public abstract class TestPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
TestOperations
{
static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public Test
_this()
{
return TestHelper.narrow(super._this_object());
}
public Test
_this(org.omg.CORBA.ORB orb)
{
return TestHelper.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)
{
final String[] _ob_names =
{
"inany",
"intest",
"outany",
"returntest",
"say",
"shutdown"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // inany
return _OB_op_inany(in, handler);
case 1: // intest
return _OB_op_intest(in, handler);
case 2: // outany
return _OB_op_outany(in, handler);
case 3: // returntest
return _OB_op_returntest(in, handler);
case 4: // say
return _OB_op_say(in, handler);
case 5: // shutdown
return _OB_op_shutdown(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_inany(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.Any _ob_a0 = in.read_any();
inany(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_intest(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Test _ob_a0 = TestHelper.read(in);
intest(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_outany(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.AnyHolder _ob_ah0 = new org.omg.CORBA.AnyHolder();
outany(_ob_ah0);
out = handler.createReply();
out.write_any(_ob_ah0.value);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_returntest(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
Test _ob_r = returntest();
out = handler.createReply();
TestHelper.write(out, _ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_say(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_a0 = in.read_string();
say(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_shutdown(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
shutdown();
out = handler.createReply();
return out;
}
}
| 5,658 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/LocalTest_impl.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.local;
public class LocalTest_impl extends org.omg.CORBA.LocalObject implements
LocalTest {
public void say(String s) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void intest(Test t) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void inany(org.omg.CORBA.Any a) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void outany(org.omg.CORBA.AnyHolder a) {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public Test returntest() {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
public void shutdown() {
throw new org.omg.CORBA.NO_IMPLEMENT();
}
}
| 5,659 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/TestOperations.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.local;
//
// IDL:Test:1.0
//
/***/
public interface TestOperations
{
//
// IDL:Test/say:1.0
//
/***/
void
say(String s);
//
// IDL:Test/intest:1.0
//
/***/
void
intest(Test t);
//
// IDL:Test/inany:1.0
//
/***/
void
inany(org.omg.CORBA.Any a);
//
// IDL:Test/outany:1.0
//
/***/
void
outany(org.omg.CORBA.AnyHolder a);
//
// IDL:Test/returntest:1.0
//
/***/
Test
returntest();
//
// IDL:Test/shutdown:1.0
//
/***/
void
shutdown();
}
| 5,660 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/TestPOATie.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.local;
//
// IDL:Test:1.0
//
public class TestPOATie extends TestPOA
{
private TestOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
TestPOATie(TestOperations delegate)
{
_ob_delegate_ = delegate;
}
public
TestPOATie(TestOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public TestOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(TestOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:Test/say:1.0
//
public void
say(String s)
{
_ob_delegate_.say(s);
}
//
// IDL:Test/intest:1.0
//
public void
intest(Test t)
{
_ob_delegate_.intest(t);
}
//
// IDL:Test/inany:1.0
//
public void
inany(org.omg.CORBA.Any a)
{
_ob_delegate_.inany(a);
}
//
// IDL:Test/outany:1.0
//
public void
outany(org.omg.CORBA.AnyHolder a)
{
_ob_delegate_.outany(a);
}
//
// IDL:Test/returntest:1.0
//
public Test
returntest()
{
return _ob_delegate_.returntest();
}
//
// IDL:Test/shutdown:1.0
//
public void
shutdown()
{
_ob_delegate_.shutdown();
}
}
| 5,661 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/Test.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.local;
//
// IDL:Test:1.0
//
/***/
public interface Test extends TestOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,662 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/LocalTest.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.local;
//
// IDL:LocalTest:1.0
//
/***/
public interface LocalTest extends LocalTestOperations,
Test
{
}
| 5,663 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/_TestStub.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.local;
//
// IDL:Test:1.0
//
public class _TestStub extends org.omg.CORBA.portable.ObjectImpl
implements Test
{
private static final String[] _ob_ids_ =
{
"IDL:Test:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestOperations.class;
//
// IDL:Test/say:1.0
//
public void
say(String _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("say", true);
out.write_string(_ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("say", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.say(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/intest:1.0
//
public void
intest(Test _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("intest", true);
TestHelper.write(out, _ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("intest", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.intest(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/inany:1.0
//
public void
inany(org.omg.CORBA.Any _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("inany", true);
out.write_any(_ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("inany", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.inany(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/outany:1.0
//
public void
outany(org.omg.CORBA.AnyHolder _ob_ah0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("outany", true);
in = _invoke(out);
_ob_ah0.value = in.read_any();
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("outany", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.outany(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/returntest:1.0
//
public Test
returntest()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("returntest", true);
in = _invoke(out);
Test _ob_r = TestHelper.read(in);
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("returntest", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
return _ob_self.returntest();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:Test/shutdown:1.0
//
public void
shutdown()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("shutdown", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("shutdown", _ob_opsClass);
if(_ob_so == null)
continue;
TestOperations _ob_self = (TestOperations)_ob_so.servant;
try
{
_ob_self.shutdown();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,664 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/local/Server.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.local;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
public class Server {
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
//
// Resolve Root POA
//
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
//
// Get a reference to the POA manager and activate it
//
POAManager manager = poa.the_POAManager();
manager.activate();
//
// Create implementation object
//
Test_impl testImpl = new Test_impl(poa);
Test test = testImpl._this(orb);
//
// Save reference. This must be done after POA manager
// activation, otherwise there is a potential for a race
// condition between the client sending a request and the
// server not being ready yet.
//
String refFile = "Test.ref";
try {
String ref = orb.object_to_string(test);
java.io.FileOutputStream file = new java.io.FileOutputStream(
refFile);
java.io.PrintWriter out = new java.io.PrintWriter(file);
out.println(ref);
out.flush();
file.close();
} catch (java.io.IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
return 1;
}
//
// Run implementation
//
orb.run();
//
// Delete file
//
new java.io.File(refFile).delete();
return 0;
}
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;
ORB orb = null;
try {
orb = ORB.init(args, props);
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,665 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/Client.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.ins;
import java.util.Properties;
import org.omg.CORBA.*;
//
// Corba URL client test class
//
final public class Client {
//
// Simple exception class for test failures
//
private static class TestFailure extends Exception {
TestFailure() {
}
//
// Logging constructor
//
TestFailure(String msg) {
System.err.println(msg);
}
}
private static class ClientTest {
ORB orb;
//
// number of times to repeat the test
//
int count;
//
// object references to use during testing
//
test.ins.URLTest.IIOPAddress[] ior = new test.ins.URLTest.IIOPAddress[2];
//
// multi profile IOR tests are disabled in this beta release
//
private final boolean multiProfileTest = false;
//
// Test corbaloc URL construction that uses full OB4 Object Keys
// in a manner compatible with the IMR utilities
//
private final boolean imrTest = true;
ClientTest() {
}
//
// Create the client test with the associated ORB
//
void init(ORB aOrb, int aCount) {
orb = aOrb;
count = aCount;
}
//
// Convert a URL string to a test.ins.URLTest.IIOPAddress reference
// raises a TestFailure exception if the reference is null or the
// URL is invalid.
//
test.ins.URLTest.IIOPAddress stringToIIOPAddress(String objStr)
throws TestFailure {
org.omg.CORBA.Object obj = null;
test.ins.URLTest.IIOPAddress nObj = null;
boolean stringToObjOK = false;
try {
obj = orb.string_to_object(objStr);
stringToObjOK = true;
nObj = test.ins.URLTest.IIOPAddressHelper.narrow(obj);
if (obj == null) {
System.err.println("Error stringToIIOPAddress:");
System.err.println("object `" + objStr + "; is nil "
+ "reference.");
throw new TestFailure();
}
} catch (SystemException se) {
System.err.println("Error stringToIIOPAddress:");
se.printStackTrace();
System.err.println("Original URL: " + objStr);
System.err.print("Resultant URL: ");
if (stringToObjOK == false)
System.err.println("NONE, string_to_object raised the "
+ "exception");
else {
String iorStr = orb.object_to_string(obj);
System.err.println(iorStr);
}
throw new TestFailure();
}
return nObj;
}
//
// Log test start
//
void declare_test(String msg) {
System.out.print("Testing " + msg + "... ");
System.out.flush();
}
//
// Log test end, raise a TestFailure on a false test result
//
void finish_test(boolean isOk) throws TestFailure {
System.out.println((isOk ? "Done!" : "Failed!"));
if (isOk == false)
throw new TestFailure();
}
//
// Get the proper "unsigned" int value from the port short
//
int getIntPort(test.ins.URLTest.IIOPAddress obj) {
int iPort = obj.getPort();
if (iPort < 0)
iPort += 65536;
return iPort;
}
//
// Compare two IIOPAddress objects by querying them for
// host, port and key information. This *does not* compare
// the results of getString.
//
boolean compareObjs(test.ins.URLTest.IIOPAddress iop1,
test.ins.URLTest.IIOPAddress iop2) {
String cKey[] = new String[2];
String cHost[] = new String[2];
int cPort[] = new int[2];
test.ins.URLTest.IIOPAddress activeIOR = null;
try {
activeIOR = iop1;
cKey[0] = iop1.getKey();
cHost[0] = iop1.getHost();
cPort[0] = getIntPort(iop1);
activeIOR = iop2;
cKey[1] = iop2.getKey();
cHost[1] = iop2.getHost();
cPort[1] = getIntPort(iop2);
} catch (SystemException se) {
System.out.print("Error compareObj, invoking:");
se.printStackTrace();
String iorStr = orb.object_to_string(activeIOR);
System.out.println(iorStr);
throw se;
}
return (cKey[0].equals(cKey[1]) && cHost[0].equals(cHost[1]) && cPort[0] == cPort[1]);
}
//
// Simplistic escape - escapes more than necessary but is ok
// for testing
//
String escape(byte[] arr) {
StringBuffer result = new StringBuffer(arr.length * 3);
for (int i = 0; i < arr.length; i++) {
result.append('%');
result.append(Character.toUpperCase(Character.forDigit(
(arr[i] >> 4) & 0xF, 16)));
result.append(Character.toUpperCase(Character.forDigit(
arr[i] & 0xF, 16)));
}
return result.toString();
}
//
// Construct the iiop address portion of a URL for an IIOPAddress.
// "iiop:555objs.com:2809" for example.
//
String getURLAddressComponent(test.ins.URLTest.IIOPAddress nObj,
String prefix) {
String url = prefix != null ? prefix : ":";
url += nObj.getHost();
url += ":";
url += Integer.toString(getIntPort(nObj));
return url;
}
//
// Run a single test pass
//
void runPass(int passNumber) throws TestFailure {
//
// Start with very basic tests
//
String[] host = new String[2];
String[] key = new String[2];
int[] port = new int[2];
//
// Test that initial object strings are ok (Tests scheme
// provided on command line)
//
declare_test("string_to_object");
for (int i = 0; i < 2; i++) {
key[i] = ior[i].getKey();
host[i] = ior[i].getHost();
port[i] = getIntPort(ior[i]);
}
finish_test(true);
//
// Verify string_to_object -> object_to_string round-trip
// works as expected
//
declare_test("object_to_string");
for (int i = 0; i < 2; i++) {
String iorStr = orb.object_to_string(ior[i]);
test.ins.URLTest.IIOPAddress nAddr = stringToIIOPAddress(iorStr);
if (compareObjs(ior[i], nAddr) == false)
finish_test(false);
}
finish_test(true);
//
// Check null URL string handling.
//
declare_test("null URL string exception");
{
boolean correctException = false;
try {
org.omg.CORBA.Object obj = orb.string_to_object(null);
} catch (BAD_PARAM bp) {
correctException = true;
}
finish_test(correctException);
}
//
// Check illegal port and no valid scheme parsing.
//
declare_test("bad corbaloc port and scheme exceptions");
{
//
// Try same URL with legal, and illegal low, high ports.
//
int exceptionCount = 0;
String urlStr[] = { "corbaloc:iiop:localhost:2809/a/b/c",
"corbaloc:iiop:localhost:0/a/b/c",
"corbaloc:iiop:localhost:65536/a/b/c",
"corbaloc:iiop:localhost:-90/a/b/c",
"corbaloc:iiop:localhost:not_a_number/a/b/c",
"corbaloc:corbaloc-bad-scheme:localhost:not_a_number/a/b/c" };
for (int i = 0; i < 6; ++i) {
try {
org.omg.CORBA.Object obj = orb
.string_to_object(urlStr[i]);
} catch (BAD_PARAM bp) {
//
// legal URL must not raise exception
//
if (i == 0)
finish_test(false);
++exceptionCount;
}
}
//
// The last 5 URLs should have failed
//
finish_test(exceptionCount == 5);
}
//
// Basic corbaloc test
//
declare_test("iiop default version 1.0 corbaloc URL");
for (int i = 0; i < 2; i++) {
String url = ior[i].getCorbalocURL();
test.ins.URLTest.IIOPAddress nObj = stringToIIOPAddress(url);
if (compareObjs(ior[i], nObj) == false)
finish_test(false);
String str = nObj.getString();
if (str.equals("corbaloc") == false)
finish_test(false);
}
finish_test(true);
//
// Test URLs with 1.0 - 1.9 iiop profiles
//
declare_test("iiop version 1.0 - 1.9 corbaloc URL");
for (int i = 0; i < 2; i++) {
for (int iv = 0; iv < 10; ++iv) {
String addr = getURLAddressComponent(ior[i], ":1." + iv
+ "@");
String url = "corbaloc:" + addr + "/" + ior[i].getKey();
test.ins.URLTest.IIOPAddress nObj = stringToIIOPAddress(url);
if (compareObjs(ior[i], nObj) == false)
finish_test(false);
}
}
finish_test(true);
//
// Versioned corbaloc rejection test.
//
declare_test("unsupported iiop version corbaloc URL");
for (int i = 0; i < 2; i++) {
//
// Try iiop major versions 0 and 2
//
String iiopMajor = (i == 0) ? ":0." : ":2.";
for (int iv = 0; iv < 10; ++iv) {
String addr = getURLAddressComponent(ior[i], iiopMajor + iv
+ "@");
String url = "corbaloc:" + addr + "/" + ior[i].getKey();
try {
orb.string_to_object(url);
System.err.println("\nIncorrectly accepted '" + url
+ "'");
finish_test(false);
} catch (BAD_PARAM ex) {
}
}
}
finish_test(true);
//
// Test corbaloc access the same way the
// IMR mkref utility generates corbaloc's.
//
declare_test("IMR corbaloc");
for (int i = 0; i < 2; i++) {
//
// Create the ORBacus specific object key
//
String iorKey = ior[i].getKey();
byte[] oid = iorKey.getBytes();
org.apache.yoko.orb.OB.ObjectKeyData data = new org.apache.yoko.orb.OB.ObjectKeyData();
data.persistent = true;
data.createTime = 0;
data.oid = oid;
data.serverId = "_RootPOA";
data.poaId = new String[1];
data.poaId[0] = "testPOA";
byte[] oct = org.apache.yoko.orb.OB.ObjectKey
.CreateObjectKey(data);
String keyStr = escape(oct);
//
// Create a corbaloc URL for this
//
String addr = getURLAddressComponent(ior[i],
(i & 1) != 0 ? ":1.1@" : ":1.2@");
String url = "corbaloc:" + addr + '/' + keyStr;
test.ins.URLTest.IIOPAddress nObj = stringToIIOPAddress(url);
if (compareObjs(ior[i], nObj) == false)
finish_test(false);
String str = nObj.getString();
if (!str.equals("corbaloc"))
finish_test(false);
}
finish_test(true);
//
// Test if object can be contacted, if "active" profile
// is the first in a multi-profile IOR
//
declare_test("active profile 1 in a multi-profile IOR");
for (int i = 0; i < 2; i++) {
String url = "corbaloc:";
String addr = getURLAddressComponent(ior[i], null);
url += addr;
//
// add 2 dummy profiles at corbaloc reserved port
//
url += ",:localhost:2809";
url += ",:localhost:2809";
url += "/" + ior[i].getKey();
test.ins.URLTest.IIOPAddress nObj = stringToIIOPAddress(url);
if (compareObjs(ior[i], nObj) == false)
finish_test(false);
String str = nObj.getString();
if (!str.equals("corbaloc"))
finish_test(false);
}
finish_test(true);
//
// Test if object can be contacted, if "active" profile
// is third in a multi-profile IOR
//
boolean multi_3_test = false;
if (multi_3_test) {
//
// multi-profile test 3
//
declare_test("active profile 3 in a multi-profile IOR");
for (int i = 0; i < 2; i++) {
String url = "corbaloc:";
//
// 2 dummy profiles at corbaloc reserved port
//
url += ":localhost:2809";
url += ",:localhost:2809,";
//
// usable profile
//
String addr = getURLAddressComponent(ior[i], null);
url += addr;
url += "/" + ior[i].getKey();
test.ins.URLTest.IIOPAddress nObj = stringToIIOPAddress(url);
if (compareObjs(ior[i], nObj) == false)
finish_test(false);
}
finish_test(true);
}
}
//
// Run the test suite, parsing the test pass count and IIOPAddress
// URLs
//
void run() throws TestFailure {
//
// Run tests
//
for (int c = 0; c < count; c++) {
if (count != 1)
System.out.println("Test Pass: " + (c + 1));
try {
runPass(c);
} catch (TestFailure tfe) {
//
// In multi-pass test, continue for TestFailure
//
if (count == 1)
throw tfe;
}
}
}
}
//
// URL test main, arguments are: test loop count and the URL of the
// server, a second server URL can optionally be specified
//
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
if (args.length < 2) {
System.out.println("usage: test.ins.Client loop_count "
+ "ior_url1 [ior_url2]");
return 1;
}
int count = Integer.parseInt(args[0]);
if (count <= 0) {
System.err.println("bad test count: " + args[0]);
return 1;
}
ClientTest test = new ClientTest();
test.init(orb, count);
int status = 0;
try {
test.ior[0] = test.stringToIIOPAddress(args[1]);
test.ior[1] = (args.length != 3) ? test.ior[0] : test
.stringToIIOPAddress(args[2]);
test.run();
} catch (TestFailure ex) {
ex.printStackTrace();
status = 1;
}
if (test.ior[0] != null)
test.ior[0].deactivate();
return status;
}
//
// Client test entry point
//
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;
ORB orb = null;
try {
orb = org.omg.CORBA.ORB.init(args, props);
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,666 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/Server.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.ins;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
public final class Server {
//
// Return the port used by an acceptor
//
static int getPort(org.apache.yoko.orb.OCI.IIOP.AcceptorInfo iiopInfo) {
short portShort = iiopInfo.port();
int port;
if (portShort < 0)
port = 0xffff + (int) portShort + 1;
else
port = (int) portShort;
return port;
}
//
// Helper class for writing IOR references out to files
//
public static class TempIORFile {
private String iorFile;
//
// Constructor writes out an object reference to a file
//
public TempIORFile(ORB orb, org.omg.CORBA.Object obj, String fileName)
throws java.io.IOException {
iorFile = fileName;
try {
String ref = orb.object_to_string(obj);
java.io.FileOutputStream file = new java.io.FileOutputStream(
iorFile);
java.io.PrintWriter out = new java.io.PrintWriter(file);
out.println(ref);
out.flush();
file.close();
} catch (java.io.IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
throw ex;
}
}
//
// Destroy the object reference file
//
public void release() {
if (iorFile != null)
new java.io.File(iorFile).delete();
iorFile = null;
}
//
// Make sure it's destroyed
//
protected void finalize() throws Throwable {
release();
super.finalize();
}
}
//
// Simple server providing objects for corba URL tests
//
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
if (args.length != 2) {
System.out.println("usage: test.ins.Server key_string "
+ "ior_file");
return 1;
}
//
// corbaloc key
//
String keyStr = args[0];
String iorFile = args[1];
//
// Resolve Root POA
//
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
//
// Activate the POA manager
//
POAManager manager = poa.the_POAManager();
manager.activate();
//
// Create POA
//
Policy[] policies = new Policy[2];
policies[0] = poa.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
policies[1] = poa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
POA testPOA = poa.create_POA("testPOA", manager, policies);
//
// Resolve the Boot Manager
//
org.apache.yoko.orb.OB.BootManager bootManager = org.apache.yoko.orb.OB.BootManagerHelper
.narrow(orb.resolve_initial_references("BootManager"));
//
// Find the POA Manager's Acceptor Port
//
org.apache.yoko.orb.OBPortableServer.POAManager obManager = org.apache.yoko.orb.OBPortableServer.POAManagerHelper
.narrow(manager);
org.apache.yoko.orb.OCI.Acceptor[] acceptors = obManager
.get_acceptors();
org.apache.yoko.orb.OCI.IIOP.AcceptorInfo iiopInfo = null;
for (int i = 0; i < acceptors.length; i++) {
org.apache.yoko.orb.OCI.AcceptorInfo info = acceptors[i].get_info();
iiopInfo = org.apache.yoko.orb.OCI.IIOP.AcceptorInfoHelper
.narrow(info);
if (iiopInfo != null)
break;
}
String[] hosts = iiopInfo.hosts();
int port = getPort(iiopInfo);
//
// corbaloc test object
//
test.ins.URLTest.IIOPAddress corbaURLObj;
test.ins.URLTest.IIOPAddress_impl urlServant = new test.ins.URLTest.IIOPAddress_impl(
orb, hosts[0], port, keyStr, "corbaloc");
byte[] oid = urlServant.getKey().getBytes();
testPOA.activate_object_with_id(oid, urlServant);
corbaURLObj = urlServant._this(orb);
bootManager.add_binding(oid, corbaURLObj);
//
// Save references. This must be done after POA manager
// activation, otherwise there is a potential for a race
// condition between the client sending request and the server
// not being ready yet.
//
TempIORFile iorRef;
try {
iorRef = new TempIORFile(orb, corbaURLObj, iorFile);
} catch (java.io.IOException ex) {
ex.printStackTrace();
return 0;
}
//
// Give up control to the ORB
//
orb.run();
//
// Remove the ref file
//
iorRef.release();
return 0;
}
//
// Start the INS test server
//
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;
ORB orb = null;
try {
orb = ORB.init(args, props);
status = run(orb, args);
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
if (orb != null) {
try {
orb.destroy();
} catch (Exception ex) {
ex.printStackTrace();
status = 1;
}
}
System.exit(status);
}
}
| 5,667 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddress.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
/**
* interface for testing CORBA URLs using iiop protocol
**/
public interface IIOPAddress extends IIOPAddressOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,668 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddressOperations.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
/**
* interface for testing CORBA URLs using iiop protocol
**/
public interface IIOPAddressOperations
{
//
// IDL:URLTest/IIOPAddress/getKey:1.0
//
/**
* Get the corbaloc key the object is advertised with.
* More than one object may return the same corbaloc key
**/
String
getKey();
//
// IDL:URLTest/IIOPAddress/getPort:1.0
//
/**
* Get the port this object is listening on
**/
short
getPort();
//
// IDL:URLTest/IIOPAddress/getHost:1.0
//
/**
* Get the hostname / address this object is listening on
**/
String
getHost();
//
// IDL:URLTest/IIOPAddress/getIIOPAddress:1.0
//
/**
* Get the object's corabloc iiop address
* such as ":555objs.com:34"
**/
String
getIIOPAddress();
//
// IDL:URLTest/IIOPAddress/getCorbalocURL:1.0
//
/**
* Get the object's full URL string.
* "corbaloc::555objs.com:34/Key"
**/
String
getCorbalocURL();
//
// IDL:URLTest/IIOPAddress/destroy:1.0
//
/**
* Destroy this object. This allows fault tolerance testing
* if this object is referenced in a multi-profile IOR.
**/
void
destroy();
//
// IDL:URLTest/IIOPAddress/setString:1.0
//
/**
* Set arbitrary text string
* @param textStr The text string to set
* @see getString
**/
void
setString(String textStr);
//
// IDL:URLTest/IIOPAddress/getString:1.0
//
/**
* Retrieve any text set for this object
* returns a zero-length string if no string
* has been set
**/
String
getString();
//
// IDL:URLTest/IIOPAddress/deactivate:1.0
//
/**
* Deactivate this server (via orb shutdown)
**/
void
deactivate();
}
| 5,669 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddressPOATie.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
public class IIOPAddressPOATie extends IIOPAddressPOA
{
private IIOPAddressOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
IIOPAddressPOATie(IIOPAddressOperations delegate)
{
_ob_delegate_ = delegate;
}
public
IIOPAddressPOATie(IIOPAddressOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public IIOPAddressOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(IIOPAddressOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:URLTest/IIOPAddress/getKey:1.0
//
public String
getKey()
{
return _ob_delegate_.getKey();
}
//
// IDL:URLTest/IIOPAddress/getPort:1.0
//
public short
getPort()
{
return _ob_delegate_.getPort();
}
//
// IDL:URLTest/IIOPAddress/getHost:1.0
//
public String
getHost()
{
return _ob_delegate_.getHost();
}
//
// IDL:URLTest/IIOPAddress/getIIOPAddress:1.0
//
public String
getIIOPAddress()
{
return _ob_delegate_.getIIOPAddress();
}
//
// IDL:URLTest/IIOPAddress/getCorbalocURL:1.0
//
public String
getCorbalocURL()
{
return _ob_delegate_.getCorbalocURL();
}
//
// IDL:URLTest/IIOPAddress/destroy:1.0
//
public void
destroy()
{
_ob_delegate_.destroy();
}
//
// IDL:URLTest/IIOPAddress/setString:1.0
//
public void
setString(String textStr)
{
_ob_delegate_.setString(textStr);
}
//
// IDL:URLTest/IIOPAddress/getString:1.0
//
public String
getString()
{
return _ob_delegate_.getString();
}
//
// IDL:URLTest/IIOPAddress/deactivate:1.0
//
public void
deactivate()
{
_ob_delegate_.deactivate();
}
}
| 5,670 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/_IIOPAddressStub.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
public class _IIOPAddressStub extends org.omg.CORBA.portable.ObjectImpl
implements IIOPAddress
{
private static final String[] _ob_ids_ =
{
"IDL:URLTest/IIOPAddress:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = IIOPAddressOperations.class;
//
// IDL:URLTest/IIOPAddress/getKey:1.0
//
public String
getKey()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getKey", true);
in = _invoke(out);
String _ob_r = in.read_string();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getKey", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getKey();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/getPort:1.0
//
public short
getPort()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getPort", true);
in = _invoke(out);
short _ob_r = in.read_ushort();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getPort", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getPort();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/getHost:1.0
//
public String
getHost()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getHost", true);
in = _invoke(out);
String _ob_r = in.read_string();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getHost", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getHost();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/getIIOPAddress:1.0
//
public String
getIIOPAddress()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getIIOPAddress", true);
in = _invoke(out);
String _ob_r = in.read_string();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getIIOPAddress", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getIIOPAddress();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/getCorbalocURL:1.0
//
public String
getCorbalocURL()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getCorbalocURL", true);
in = _invoke(out);
String _ob_r = in.read_string();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getCorbalocURL", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getCorbalocURL();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/destroy:1.0
//
public void
destroy()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("destroy", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("destroy", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
_ob_self.destroy();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/setString:1.0
//
public void
setString(String _ob_a0)
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("setString", true);
out.write_string(_ob_a0);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("setString", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
_ob_self.setString(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/getString:1.0
//
public String
getString()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("getString", true);
in = _invoke(out);
String _ob_r = in.read_string();
return _ob_r;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("getString", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
return _ob_self.getString();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:URLTest/IIOPAddress/deactivate:1.0
//
public void
deactivate()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("deactivate", true);
in = _invoke(out);
return;
}
catch(org.omg.CORBA.portable.RemarshalException _ob_ex)
{
continue;
}
catch(org.omg.CORBA.portable.ApplicationException _ob_aex)
{
final String _ob_id = _ob_aex.getId();
in = _ob_aex.getInputStream();
throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: " + _ob_id);
}
finally
{
_releaseReply(in);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("deactivate", _ob_opsClass);
if(_ob_so == null)
continue;
IIOPAddressOperations _ob_self = (IIOPAddressOperations)_ob_so.servant;
try
{
_ob_self.deactivate();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,671 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddressPOA.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
public abstract class IIOPAddressPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
IIOPAddressOperations
{
static final String[] _ob_ids_ =
{
"IDL:URLTest/IIOPAddress:1.0",
};
public IIOPAddress
_this()
{
return IIOPAddressHelper.narrow(super._this_object());
}
public IIOPAddress
_this(org.omg.CORBA.ORB orb)
{
return IIOPAddressHelper.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)
{
final String[] _ob_names =
{
"deactivate",
"destroy",
"getCorbalocURL",
"getHost",
"getIIOPAddress",
"getKey",
"getPort",
"getString",
"setString"
};
int _ob_left = 0;
int _ob_right = _ob_names.length;
int _ob_index = -1;
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(opName);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
if(_ob_index == -1 && opName.charAt(0) == '_')
{
_ob_left = 0;
_ob_right = _ob_names.length;
String _ob_ami_op =
opName.substring(1);
while(_ob_left < _ob_right)
{
int _ob_m = (_ob_left + _ob_right) / 2;
int _ob_res = _ob_names[_ob_m].compareTo(_ob_ami_op);
if(_ob_res == 0)
{
_ob_index = _ob_m;
break;
}
else if(_ob_res > 0)
_ob_right = _ob_m;
else
_ob_left = _ob_m + 1;
}
}
switch(_ob_index)
{
case 0: // deactivate
return _OB_op_deactivate(in, handler);
case 1: // destroy
return _OB_op_destroy(in, handler);
case 2: // getCorbalocURL
return _OB_op_getCorbalocURL(in, handler);
case 3: // getHost
return _OB_op_getHost(in, handler);
case 4: // getIIOPAddress
return _OB_op_getIIOPAddress(in, handler);
case 5: // getKey
return _OB_op_getKey(in, handler);
case 6: // getPort
return _OB_op_getPort(in, handler);
case 7: // getString
return _OB_op_getString(in, handler);
case 8: // setString
return _OB_op_setString(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_deactivate(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
deactivate();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_destroy(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
destroy();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getCorbalocURL(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_r = getCorbalocURL();
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getHost(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_r = getHost();
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getIIOPAddress(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_r = getIIOPAddress();
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getKey(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_r = getKey();
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getPort(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
short _ob_r = getPort();
out = handler.createReply();
out.write_ushort(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_getString(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_r = getString();
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_setString(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_a0 = in.read_string();
setString(_ob_a0);
out = handler.createReply();
return out;
}
}
| 5,672 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddress_impl.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
//
// class for testing CORBA URLs using iiop protocol
//
public class IIOPAddress_impl extends IIOPAddressPOA {
private ORB orb_;
private String host_;
private int port_;
private String key_;
private String str_;
//
// construct a test object with enough info to report its own
// corbaloc parameters
//
public IIOPAddress_impl(ORB orb, String host, int port, String key,
String str) {
orb_ = orb;
host_ = host;
port_ = port;
key_ = key;
str_ = str;
}
//
// IDL:URLTest/IIOPAddress/getKey:1.0
//
public String getKey() {
return key_;
}
//
// IDL:URLTest/IIOPAddress/getPort:1.0
//
public short getPort() {
short shortPort = (port_ > 0x8000) ? (short) (port_ - 0xffff - 1)
: (short) port_;
return shortPort;
}
//
// IDL:URLTest/IIOPAddress/getHost:1.0
//
public String getHost() {
return host_;
}
//
// IDL:URLTest/IIOPAddress/getIIOPAddress:1.0
//
public String getIIOPAddress() {
String result = "iiop:";
result += host_;
result += ":";
result += Integer.toString(port_);
return result;
}
//
// IDL:URLTest/IIOPAddress/getCorbalocURL:1.0
//
public String getCorbalocURL() {
String result = "corbaloc:" + getIIOPAddress();
result += "/" + key_;
return result;
}
//
// IDL:URLTest/IIOPAddress/destroy:1.0
//
public void destroy() {
// TODO: implement
}
//
// IDL:URLTest/IIOPAddress/setString:1.0
//
public void setString(String textStr) {
str_ = textStr;
}
//
// IDL:URLTest/IIOPAddress/getString:1.0
//
public String getString() {
return str_;
}
//
// IDL:URLTest/IIOPAddress/deactivate:1.0
//
public void deactivate() {
orb_.shutdown(false);
}
}
| 5,673 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddressHelper.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
final public class IIOPAddressHelper
{
public static void
insert(org.omg.CORBA.Any any, IIOPAddress val)
{
any.insert_Object(val, type());
}
public static IIOPAddress
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(), "IIOPAddress");
}
return typeCode_;
}
public static String
id()
{
return "IDL:URLTest/IIOPAddress:1.0";
}
public static IIOPAddress
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (IIOPAddress)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_IIOPAddressStub _ob_stub = new _IIOPAddressStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, IIOPAddress val)
{
out.write_Object(val);
}
public static IIOPAddress
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (IIOPAddress)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IIOPAddressStub _ob_stub = new _IIOPAddressStub();
_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 IIOPAddress
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (IIOPAddress)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IIOPAddressStub _ob_stub = new _IIOPAddressStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,674 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/ins/URLTest/IIOPAddressHolder.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.ins.URLTest;
//
// IDL:URLTest/IIOPAddress:1.0
//
final public class IIOPAddressHolder implements org.omg.CORBA.portable.Streamable
{
public IIOPAddress value;
public
IIOPAddressHolder()
{
}
public
IIOPAddressHolder(IIOPAddress initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = IIOPAddressHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
IIOPAddressHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return IIOPAddressHelper.type();
}
}
| 5,675 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/DummyServerInterceptor_impl.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.pi;
import org.omg.PortableInterceptor.*;
final class DummyServerInterceptor_impl extends org.omg.CORBA.LocalObject
implements org.omg.PortableInterceptor.ServerRequestInterceptor {
//
// IDL to Java Mapping
//
public String name() {
return "dummy";
}
public void destroy() {
}
public void receive_request_service_contexts(ServerRequestInfo ri) {
}
public void receive_request(ServerRequestInfo ri) {
}
public void send_reply(ServerRequestInfo ri) {
}
public void send_other(ServerRequestInfo ri) {
}
public void send_exception(ServerRequestInfo ri) {
}
}
| 5,676 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/TestInterface_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import test.pi.TestInterfacePackage.*;
final class TestInterface_impl extends TestInterfacePOA {
//
// From TestBase (no multiple inheritance)
//
public static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
private ORB orb_;
private POA poa_;
private org.omg.PortableInterceptor.Current current_;
TestInterface_impl(ORB orb, POA poa) {
orb_ = orb;
poa_ = poa;
try {
org.omg.CORBA.Object obj = orb
.resolve_initial_references("PICurrent");
current_ = org.omg.PortableInterceptor.CurrentHelper.narrow(obj);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
}
TEST(current_ != null);
}
// ----------------------------------------------------------------------
// TestInterface_impl public member implementation
// ----------------------------------------------------------------------
public void noargs() {
}
public void noargs_oneway() {
}
public void systemexception() {
throw new NO_IMPLEMENT();
}
public void userexception() throws user {
throw new user();
}
public void location_forward() {
TEST(false);
}
public void test_service_context() {
//
// Test: get_slot
//
Any slotData = null;
try {
slotData = current_.get_slot(0);
} catch (org.omg.PortableInterceptor.InvalidSlot ex) {
TEST(false);
}
int v = slotData.extract_long();
TEST(v == 10);
//
// Test: set_slot
//
slotData.insert_long(20);
try {
current_.set_slot(0, slotData);
} catch (org.omg.PortableInterceptor.InvalidSlot ex) {
TEST(false);
}
}
public String string_attrib() {
return "TEST";
}
public void string_attrib(String param) {
TEST(param.equals("TEST"));
}
public void one_string_in(String param) {
TEST(param.equals("TEST"));
}
public void one_string_inout(StringHolder param) {
TEST(param.value.equals("TESTINOUT"));
param.value = "TEST";
}
public void one_string_out(StringHolder param) {
param.value = "TEST";
}
public String one_string_return() {
return "TEST";
}
public s struct_attrib() {
s r = new s();
r.sval = "TEST";
return r;
}
public void struct_attrib(s param) {
TEST(param.sval.equals("TEST"));
}
public void one_struct_in(s param) {
TEST(param.sval.equals("TEST"));
}
public void one_struct_inout(sHolder param) {
param.value.sval = "TEST";
}
public void one_struct_out(sHolder param) {
param.value = new s();
param.value.sval = "TEST";
}
public s one_struct_return() {
s r = new s();
r.sval = "TEST";
return r;
}
public void deactivate() {
System.out.println("TestInterface_Impl.deactivate() - calling orb.shutdown(false)");
orb_.shutdown(false);
System.out.println("TestInterface_Impl.deactivate() - returned from orb.shutdown(false)");
}
public POA _default_POA() {
return poa_;
}
}
| 5,677 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/TestLocator_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POAPackage.*;
//
// ServantLocator implementation to provide location forwarding
//
final class TestLocator_impl extends ServantLocatorPOA {
private ORB orb_;
private TestInterface_impl test_;
private TestInterfaceDSI_impl testDSI_;
TestLocator_impl(ORB orb, TestInterface_impl test,
TestInterfaceDSI_impl testDSI) {
orb_ = orb;
test_ = test;
testDSI_ = testDSI;
}
public Servant preinvoke(byte[] oid, POA poa, String operation,
org.omg.PortableServer.ServantLocatorPackage.CookieHolder the_cookie)
throws org.omg.PortableServer.ForwardRequest {
String oidString = new String(oid);
//
// Request for object "test" or "testDSI"
//
if (oidString.equals("test") || oidString.equals("testDSI")) {
//
// Location forward requested? Location forward back to
// the same object. (The client-side interceptor consumes
// the location forward).
//
if (operation.equals("location_forward")) {
org.omg.CORBA.Object obj = poa.create_reference_with_id(oid,
"IDL:TestInterface:1.0");
throw new org.omg.PortableServer.ForwardRequest(obj);
}
if (oidString.equals("test"))
return test_;
return testDSI_;
}
//
// Fail
//
throw new OBJECT_NOT_EXIST();
}
public void postinvoke(byte[] oid, POA poa, String operation,
java.lang.Object the_cookie, Servant the_servant) {
}
}
| 5,678 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MY_SERVER_POLICY_ID.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.pi;
//
// IDL:MY_SERVER_POLICY_ID:1.0
//
/**
*
*
*
**/
public interface MY_SERVER_POLICY_ID
{
int value = (int)(1010L);
}
| 5,679 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/Client.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.pi;
import static org.junit.Assert.assertTrue;
import static org.omg.CORBA.SetOverrideType.ADD_OVERRIDE;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;
import org.apache.yoko.orb.OB.Assert;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.NO_PERMISSION;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
import org.omg.CORBA.Request;
import org.omg.CORBA.StringHolder;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.WrongTransaction;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.IOP.Codec;
import org.omg.IOP.CodecFactory;
import org.omg.IOP.CodecFactoryHelper;
import org.omg.IOP.ENCODING_CDR_ENCAPS;
import org.omg.IOP.Encoding;
import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
import org.omg.IOP.CodecPackage.FormatMismatch;
import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
import org.omg.IOP.CodecPackage.TypeMismatch;
import org.omg.PortableInterceptor.ClientRequestInterceptor;
import org.omg.PortableInterceptor.Current;
import org.omg.PortableInterceptor.CurrentHelper;
import org.omg.PortableInterceptor.InvalidSlot;
import test.pi.TestInterfacePackage.s;
import test.pi.TestInterfacePackage.sHelper;
import test.pi.TestInterfacePackage.sHolder;
import test.pi.TestInterfacePackage.user;
import test.pi.TestInterfacePackage.userHelper;
public final class Client extends test.common.TestBase {
private static void TestTranslation(ORB orb, ClientProxyManager manager, TestInterface ti) {
//
// Set up the correct interceptor
//
TranslateCallInterceptor_impl i0 = new TranslateCallInterceptor_impl();
TranslateCallInterceptor_impl i1 = new TranslateCallInterceptor_impl();
TranslateCallInterceptor_impl i2 = new TranslateCallInterceptor_impl();
manager.setInterceptor(0, i0);
manager.setInterceptor(1, i1);
manager.setInterceptor(2, i2);
i0.throwOnRequest(new NO_PERMISSION());
try {
ti.noargs();
assertTrue(false);
} catch (NO_PERMISSION ex) {
// Expected
}
i0.noThrowOnRequest();
i0.throwOnReply(new NO_PERMISSION());
try {
ti.noargs();
assertTrue(false);
} catch (NO_PERMISSION ex) {
// Expected
}
i0.noThrowOnReply();
i1.throwOnReply(new NO_PERMISSION());
i0.expectException(new NO_PERMISSION());
try {
ti.noargs();
assertTrue(false);
} catch (NO_PERMISSION ex) {
// Expected
}
i1.noThrowOnReply();
i0.expectException(new NO_PERMISSION());
i1.expectException(new BAD_INV_ORDER());
i1.throwOnException(new NO_PERMISSION());
i2.throwOnRequest(new BAD_INV_ORDER());
try {
ti.noargs();
assertTrue(false);
} catch (NO_PERMISSION ex) {
// Expected
}
i2.noThrowOnRequest();
i2.throwOnReply(new BAD_INV_ORDER());
try {
ti.noargs();
assertTrue(false);
} catch (NO_PERMISSION ex) {
// Expected
}
manager.clearInterceptors();
}
private static void TestCalls(ORB orb, ClientProxyManager manager, TestInterface ti) {
Current pic = null;
try {
org.omg.CORBA.Object obj = orb.resolve_initial_references("PICurrent");
pic = CurrentHelper.narrow(obj);
} catch (InvalidName ex) {
}
assertTrue(pic != null);
Any slotData = orb.create_any();
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
//
// Set up the correct interceptor
//
CallInterceptor_impl impl = new CallInterceptor_impl(orb);
ClientRequestInterceptor interceptor = impl;
manager.setInterceptor(0, interceptor);
int num = 0;
ti.noargs();
assertTrue(++num == impl._OB_numReq());
ti.noargs_oneway();
assertTrue(++num == impl._OB_numReq());
try {
ti.userexception();
assertTrue(false);
} catch (user ex) {
}
assertTrue(++num == impl._OB_numReq());
try {
ti.systemexception();
assertTrue(false);
} catch (SystemException ex) {
}
assertTrue(++num == impl._OB_numReq());
ti.test_service_context();
assertTrue(++num == impl._OB_numReq());
try {
ti.location_forward();
} catch (NO_IMPLEMENT ex) {
}
assertTrue(++num == impl._OB_numReq());
//
// Test simple attribute
//
ti.string_attrib("TEST");
assertTrue(++num == impl._OB_numReq());
String satt = ti.string_attrib();
assertTrue(satt.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
//
// Test in, inout and out simple parameters
//
ti.one_string_in("TEST");
assertTrue(++num == impl._OB_numReq());
StringHolder spinout = new StringHolder("TESTINOUT");
ti.one_string_inout(spinout);
assertTrue(spinout.value.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
StringHolder spout = new StringHolder();
ti.one_string_out(spout);
assertTrue(spout.value.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
String sprc = ti.one_string_return();
assertTrue(sprc.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
//
// Test struct attribute
//
s ss = new s();
ss.sval = "TEST";
ti.struct_attrib(ss);
assertTrue(++num == impl._OB_numReq());
s ssatt = ti.struct_attrib();
assertTrue(ssatt.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
//
// Test in, inout and out struct parameters
//
ti.one_struct_in(ss);
assertTrue(++num == impl._OB_numReq());
sHolder sinout = new sHolder(new s("TESTINOUT"));
ti.one_struct_inout(sinout);
assertTrue(sinout.value.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
sHolder sout = new sHolder();
ti.one_struct_out(sout);
assertTrue(sout.value.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
s ssrc = ti.one_struct_return();
assertTrue(ssrc.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
manager.clearInterceptors();
//
// Test: PortableInterceptor::Current still has the same value
//
Any slotData2 = null;
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
int v = slotData2.extract_long();
assertTrue(v == 10);
}
private static void TestDIICalls(ORB orb, ClientProxyManager manager, TestInterface ti) {
Current pic = null;
try {
org.omg.CORBA.Object obj = orb.resolve_initial_references("PICurrent");
pic = CurrentHelper.narrow(obj);
} catch (InvalidName ex) {
}
assertTrue(pic != null);
Any slotData = orb.create_any();
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
//
// Set up the correct interceptor
//
CallInterceptor_impl impl = new CallInterceptor_impl(orb);
ClientRequestInterceptor interceptor = impl;
manager.setInterceptor(0, interceptor);
int num = 0;
Request req;
req = ti._request("noargs");
req.invoke();
assertTrue(++num == impl._OB_numReq());
req = ti._request("noargs_oneway");
req.send_oneway();
assertTrue(++num == impl._OB_numReq());
req = ti._request("userexception");
req.exceptions().add(userHelper.type());
req.invoke();
assertTrue(++num == impl._OB_numReq());
req = ti._request("systemexception");
try {
req.invoke();
} catch (NO_IMPLEMENT ex) {
// expected - raised by remote servant
}
assertTrue(++num == impl._OB_numReq());
req = ti._request("location_forward");
try {
req.invoke();
} catch (NO_IMPLEMENT ex) {
// expected - raised by local interceptor
}
assertTrue(++num == impl._OB_numReq());
//
// Test in, inout and out simple parameters
//
{
req = ti._request("one_string_in");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
req.add_in_arg().insert_string("TEST");
req.invoke();
assertTrue(++num == impl._OB_numReq());
req = ti._request("one_string_inout");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
Any inOutAny = req.add_inout_arg();
String sp = "TESTINOUT";
inOutAny.insert_string(sp);
req.invoke();
String sprc = inOutAny.extract_string();
assertTrue(sprc.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
req = ti._request("one_string_out");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
Any outAny = req.add_out_arg();
outAny.insert_string("");
req.invoke();
sprc = outAny.extract_string();
assertTrue(sprc.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
req = ti._request("one_string_return");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_string));
req.invoke();
sprc = req.return_value().extract_string();
assertTrue(sprc.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
}
//
// Test in, inout and out struct parameters
//
{
s ss = new s();
ss.sval = "TEST";
req = ti._request("one_struct_in");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
sHelper.insert(req.add_in_arg(), ss);
req.invoke();
assertTrue(++num == impl._OB_numReq());
ss.sval = "TESTINOUT";
req = ti._request("one_struct_inout");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
Any inOutAny = req.add_inout_arg();
sHelper.insert(inOutAny, ss);
req.invoke();
s ssrc = sHelper.extract(inOutAny);
assertTrue(ssrc.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
req = ti._request("one_struct_out");
req.set_return_type(orb.get_primitive_tc(TCKind.tk_void));
Any outAny = req.add_out_arg();
outAny.type(sHelper.type());
req.invoke();
ssrc = sHelper.extract(outAny);
assertTrue(ssrc.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
req = ti._request("one_struct_return");
req.set_return_type(sHelper.type());
req.invoke();
ssrc = sHelper.extract(req.return_value());
assertTrue(ssrc.sval.equals("TEST"));
assertTrue(++num == impl._OB_numReq());
}
//
// Test: PortableInterceptor::Current still has the same value
//
Any slotData2 = null;
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
int v = slotData2.extract_long();
assertTrue(v == 10);
//
// Test: ASYNC calls
//
{
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
req = ti._request("noargs");
req.send_deferred();
assertTrue(++num == impl._OB_numReq());
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 10);
slotData.insert_long(11);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
try {
req.get_response();
} catch (WrongTransaction ex) {
assertTrue(false);
}
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 11);
}
{
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
req = ti._request("userexception");
req.exceptions().add(userHelper.type());
req.send_deferred();
assertTrue(++num == impl._OB_numReq());
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 10);
slotData.insert_long(11);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
try {
req.get_response();
} catch (WrongTransaction ex) {
assertTrue(false);
}
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 11);
}
{
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
req = ti._request("systemexception");
req.send_deferred();
assertTrue(++num == impl._OB_numReq());
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 10);
slotData.insert_long(11);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
try {
req.get_response();
} catch (WrongTransaction ex) {
assertTrue(false);
} catch (NO_IMPLEMENT ex) {
// expected - raised by remote servant
}
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 11);
}
{
slotData.insert_long(10);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
req = ti._request("location_forward");
req.send_deferred();
assertTrue(++num == impl._OB_numReq());
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 10);
slotData.insert_long(11);
try {
pic.set_slot(0, slotData);
} catch (InvalidSlot ex) {
assertTrue(false);
}
try {
req.get_response();
} catch (WrongTransaction ex) {
assertTrue(false);
} catch (NO_IMPLEMENT ex) {
// expected - raised by local interceptor
}
try {
slotData2 = pic.get_slot(0);
} catch (InvalidSlot ex) {
assertTrue(false);
}
v = slotData2.extract_long();
assertTrue(v == 11);
}
manager.clearInterceptors();
}
private static void TestCodec(ORB orb) {
//
// Test: Resolve CodecFactory
//
CodecFactory factory = null;
try {
factory = CodecFactoryHelper.narrow(orb.resolve_initial_references("CodecFactory"));
} catch (InvalidName ex) {
assertTrue(false);
}
assertTrue(factory != null);
Encoding how = new Encoding();
how.major_version = 0;
how.minor_version = 0;
//
// Test: Create non-existent codec
//
try {
how.format = 1; // Some unknown value
factory.create_codec(how);
assertTrue(false);
} catch (UnknownEncoding ex) {
// Expected
}
//
// Test: CDR Codec
//
how.format = ENCODING_CDR_ENCAPS.value;
Codec cdrCodec = null;
try {
cdrCodec = factory.create_codec(how);
} catch (UnknownEncoding ex) {
assertTrue(false);
}
Assert._OB_assert(cdrCodec != null);
//
// Test: Encode/decode
//
foo f = new foo();
f.l = 10;
Any any = orb.create_any();
fooHelper.insert(any, f);
byte[] encoding = null;
try {
encoding = cdrCodec.encode(any);
} catch (InvalidTypeForEncoding ex) {
assertTrue(false);
}
Any result = null;
try {
result = cdrCodec.decode(encoding);
} catch (FormatMismatch ex) {
assertTrue(false);
}
foo newf = fooHelper.extract(result);
assertTrue(newf.l == 10);
//
// Test: Encode/decode
//
try {
encoding = cdrCodec.encode_value(any);
} catch (InvalidTypeForEncoding ex) {
assertTrue(false);
}
try {
result = cdrCodec.decode_value(encoding, fooHelper.type());
} catch (FormatMismatch ex) {
assertTrue(false);
} catch (TypeMismatch ex) {
assertTrue(false);
}
newf = fooHelper.extract(result);
assertTrue(newf.l == 10);
}
static void ClientRegisterInterceptors(Properties props, boolean local) {
props.put("org.omg.PortableInterceptor.ORBInitializerClass." + ClientORBInitializer_impl.class.getName(), "");
ClientORBInitializer_impl._OB_setLocal(local);
}
static void ClientRun(ORB orb, boolean nonBlocking, String[] args) throws Exception {
String impl;
String dsiImpl;
//
// Get TestInterface
//
try (BufferedReader in = new BufferedReader(new FileReader("TestInterface.ref"))) {
impl = readRef(in);
dsiImpl = readRef(in);
}
System.out.print("Testing string_to_object()... ");
System.out.flush();
org.omg.CORBA.Object obj = orb.string_to_object(impl);
org.omg.CORBA.Object dsiObj = orb.string_to_object(dsiImpl);
assertTrue(obj != null);
assertTrue(dsiObj != null);
System.out.println("Done!");
//
// Test: Create a policy set on the object-reference
//
Any any = orb.create_any();
any.insert_long(10);
Policy[] pl = new Policy[1];
pl[0] = orb.create_policy(MY_CLIENT_POLICY_ID.value, any);
System.out.print("Testing _narrow()... ");
System.out.flush();
obj = obj._set_policy_override(pl, ADD_OVERRIDE);
TestInterface ti = TestInterfaceHelper.narrow(obj);
assertTrue(ti != null);
try {
if ("".isEmpty()) return;
dsiObj = dsiObj._set_policy_override(pl, ADD_OVERRIDE);
TestInterface tiDSI = TestInterfaceHelper.narrow(dsiObj);
assertTrue(tiDSI != null);
System.out.println("Done!");
//
// Test: Codec
//
System.out.print("Testing Codec... ");
System.out.flush();
TestCodec(orb);
System.out.println("Done!");
//
// Test: Exception translation
//
System.out.print("Testing client side exception translation... ");
System.out.flush();
TestTranslation(orb, ClientORBInitializer_impl.clientProxyManager, ti);
System.out.println("Done!");
//
// Run tests
//
System.out.print("Testing standard method calls with static stubs... ");
System.out.flush();
TestCalls(orb, ClientORBInitializer_impl.clientProxyManager, ti);
System.out.println("Done!");
System.out.print("Ditto, but with the DSI implementation... ");
System.out.flush();
TestCalls(orb, ClientORBInitializer_impl.clientProxyManager, tiDSI);
System.out.println("Done!");
System.out.print("Testing standard method calls with the DII... ");
System.out.flush();
TestDIICalls(orb, ClientORBInitializer_impl.clientProxyManager, ti);
System.out.println("Done!");
System.out.print("Ditto, but with the DSI implementation... ");
System.out.flush();
TestDIICalls(orb, ClientORBInitializer_impl.clientProxyManager, tiDSI);
System.out.println("Done!");
} finally {
System.out.println("About to call deactivate");
ti.deactivate();
System.out.println("Deactivate returned normally");
}
}
private static String readRef(BufferedReader in) throws Exception {
String line = in.readLine();
if (line == null) {
throw new RuntimeException("Unknown Server error");
} else if (!!!line.equals("ref:")) {
try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) {
pw.println("Server error:");
do {
pw.print('\t');
pw.println(line);
} while ((line = in.readLine()) != null);
pw.flush();
throw new RuntimeException(sw.toString());
}
}
return in.readLine();
}
public static void main(String[] args) throws Exception {
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");
ORB orb = null;
try {
ClientRegisterInterceptors(props, false);
orb = ORB.init(args, props);
ClientRun(orb, false, args);
} finally {
if (orb != null) {
orb.destroy();
}
}
}
}
| 5,680 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyIORInterceptor_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableInterceptor.*;
final class MyIORInterceptor_impl extends org.omg.CORBA.LocalObject implements
IORInterceptor {
private org.omg.IOP.Codec cdrCodec_;
MyIORInterceptor_impl(ORBInitInfo info) {
org.omg.IOP.CodecFactory factory = info.codec_factory();
org.omg.IOP.Encoding how = new org.omg.IOP.Encoding(
(byte) org.omg.IOP.ENCODING_CDR_ENCAPS.value, (byte) 0,
(byte) 0);
try {
cdrCodec_ = factory.create_codec(how);
} catch (org.omg.IOP.CodecFactoryPackage.UnknownEncoding ex) {
throw new RuntimeException();
}
org.apache.yoko.orb.OB.Assert._OB_assert(cdrCodec_ != null);
}
//
// IDL to Java Mapping
//
public String name() {
return "";
}
public void destroy() {
}
public void establish_components(IORInfo info) {
try {
Policy p = info.get_effective_policy(MY_SERVER_POLICY_ID.value);
if (p == null) {
return;
}
MyServerPolicy policy = MyServerPolicyHelper.narrow(p);
MyComponent content = new MyComponent();
content.val = policy.value();
Any any = ORB.init().create_any();
MyComponentHelper.insert(any, content);
byte[] encoding = null;
try {
encoding = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
throw new RuntimeException();
}
org.omg.IOP.TaggedComponent component = new org.omg.IOP.TaggedComponent();
component.tag = MY_COMPONENT_ID.value;
component.component_data = new byte[encoding.length];
System.arraycopy(encoding, 0, component.component_data, 0,
encoding.length);
info.add_ior_component(component);
} catch (INV_POLICY ex) {
return;
}
}
public void components_established(IORInfo info) {
}
public void adapter_state_change(ObjectReferenceTemplate[] templates,
short state) {
}
public void adapter_manager_state_change(int id, short state) {
}
}
| 5,681 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/Collocated.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.pi;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableInterceptor.*;
final public class Collocated {
public static void main(String[] args) throws Exception {
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");
ORB orb = null;
try {
Client.ClientRegisterInterceptors(props, true);
Server.ServerRegisterInterceptors(props);
props.put("yoko.orb.id", "myORB");
orb = ORB.init(args, props);
Server.ServerRun(orb, true, args);
Client.ClientRun(orb, true, args);
//
// The ORB must be totally shutdown before the servants
// are deleted.
//
orb.shutdown(true);
Server.ServerCleanup();
} finally {
if (orb != null) {
orb.destroy();
}
}
}
}
| 5,682 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyClientPolicy.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.pi;
//
// IDL:MyClientPolicy:1.0
//
/***/
public interface MyClientPolicy extends MyClientPolicyOperations,
org.omg.CORBA.Policy
{
}
| 5,683 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyClientPolicyHolder.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.pi;
//
// IDL:MyClientPolicy:1.0
//
final public class MyClientPolicyHolder implements org.omg.CORBA.portable.Streamable
{
public MyClientPolicy value;
public
MyClientPolicyHolder()
{
}
public
MyClientPolicyHolder(MyClientPolicy initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = MyClientPolicyHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
MyClientPolicyHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return MyClientPolicyHelper.type();
}
}
| 5,684 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/ServerInterceptorProxy_impl.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.pi;
import org.omg.PortableInterceptor.*;
final class ServerInterceptorProxy_impl extends org.omg.CORBA.LocalObject
implements org.omg.PortableInterceptor.ServerRequestInterceptor {
//
// From TestBase (no multiple inheritance)
//
public static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
private ServerRequestInterceptor interceptor_;
private int count_;
protected void finalize() throws Throwable {
TEST(count_ == 0);
super.finalize();
}
//
// IDL to Java Mappping
//
public String name() {
if (interceptor_ != null)
return interceptor_.name();
return "";
}
public void destroy() {
}
public void receive_request_service_contexts(ServerRequestInfo ri)
throws ForwardRequest {
TEST(count_ >= 0);
if (interceptor_ != null)
interceptor_.receive_request_service_contexts(ri);
count_++;
}
public void receive_request(ServerRequestInfo ri) throws ForwardRequest {
TEST(count_ > 0);
if (interceptor_ != null)
interceptor_.receive_request(ri);
}
public void send_reply(ServerRequestInfo ri) {
TEST(count_ > 0);
count_--;
if (interceptor_ != null)
interceptor_.send_reply(ri);
}
public void send_other(ServerRequestInfo ri) throws ForwardRequest {
TEST(count_ > 0);
count_--;
if (interceptor_ != null)
interceptor_.send_other(ri);
}
public void send_exception(ServerRequestInfo ri) throws ForwardRequest {
TEST(count_ > 0);
count_--;
if (interceptor_ != null)
interceptor_.send_exception(ri);
}
void _OB_changeInterceptor(ServerRequestInterceptor interceptor) {
interceptor_ = interceptor;
}
}
| 5,685 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyClientPolicyHelper.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.pi;
//
// IDL:MyClientPolicy:1.0
//
final public class MyClientPolicyHelper
{
public static void
insert(org.omg.CORBA.Any any, MyClientPolicy val)
{
any.insert_Object(val, type());
}
public static MyClientPolicy
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_ = ((org.omg.CORBA_2_4.ORB)orb).create_local_interface_tc(id(), "MyClientPolicy");
}
return typeCode_;
}
public static String
id()
{
return "IDL:MyClientPolicy:1.0";
}
public static MyClientPolicy
read(org.omg.CORBA.portable.InputStream in)
{
throw new org.omg.CORBA.MARSHAL();
}
public static void
write(org.omg.CORBA.portable.OutputStream out, MyClientPolicy val)
{
throw new org.omg.CORBA.MARSHAL();
}
public static MyClientPolicy
narrow(org.omg.CORBA.Object val)
{
try
{
return (MyClientPolicy)val;
}
catch(ClassCastException ex)
{
}
throw new org.omg.CORBA.BAD_PARAM();
}
}
| 5,686 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/TestInterfaceDSI_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import test.pi.TestInterfacePackage.*;
final class TestInterfaceDSI_impl extends
org.omg.PortableServer.DynamicImplementation {
//
// From TestBase (no multiple inheritance)
//
public static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
private ORB orb_;
private POA poa_;
private org.omg.PortableInterceptor.Current current_;
TestInterfaceDSI_impl(ORB orb, POA poa) {
orb_ = orb;
poa_ = poa;
try {
org.omg.CORBA.Object obj = orb
.resolve_initial_references("PICurrent");
current_ = org.omg.PortableInterceptor.CurrentHelper.narrow(obj);
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
}
TEST(current_ != null);
}
// ----------------------------------------------------------------------
// TestInterfaceDSI_impl public member implementation
// ----------------------------------------------------------------------
static final String[] interfaces_ = { "IDL:TestInterface:1.0" };
public String[] _all_interfaces(POA poa, byte[] oid) {
return interfaces_;
}
public boolean _is_a(String name) {
if (name.equals("IDL:TestInterface:1.0")) {
return true;
}
return super._is_a(name);
}
public void invoke(ServerRequest request) {
String name = request.operation();
if (name.equals("noargs")) {
NVList list = orb_.create_list(0);
request.arguments(list);
return;
}
if (name.equals("noargs_oneway")) {
NVList list = orb_.create_list(0);
request.arguments(list);
return;
}
if (name.equals("systemexception")) {
NVList list = orb_.create_list(0);
request.arguments(list);
Any result = orb_.create_any();
NO_IMPLEMENTHelper.insert(result, new NO_IMPLEMENT());
request.set_exception(result);
return;
}
if (name.equals("userexception")) {
NVList list = orb_.create_list(0);
request.arguments(list);
Any result = orb_.create_any();
userHelper.insert(result, new user());
request.set_exception(result);
return;
}
if (name.equals("location_forward")) {
TEST(false);
return;
}
if (name.equals("test_service_context")) {
NVList list = orb_.create_list(0);
request.arguments(list);
//
// Test: get_slot
//
Any slotData = null;
try {
slotData = current_.get_slot(0);
} catch (org.omg.PortableInterceptor.InvalidSlot ex) {
TEST(false);
}
int v = slotData.extract_long();
TEST(v == 10);
//
// Test: set_slot
//
slotData.insert_long(20);
try {
current_.set_slot(0, slotData);
} catch (org.omg.PortableInterceptor.InvalidSlot ex) {
TEST(false);
}
return;
}
if (name.equals("_get_string_attrib")) {
NVList list = orb_.create_list(0);
request.arguments(list);
Any result = orb_.create_any();
result.insert_string("TEST");
request.set_result(result);
return;
}
if (name.equals("_set_string_attrib")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(orb_.create_string_tc(0));
list.add_value("", any, org.omg.CORBA.ARG_IN.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
String param = any.extract_string();
TEST(param.equals("TEST"));
return;
}
if (name.equals("one_string_in")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(orb_.create_string_tc(0));
list.add_value("", any, org.omg.CORBA.ARG_IN.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
String param = any.extract_string();
TEST(param.equals("TEST"));
return;
}
if (name.equals("one_string_inout")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(orb_.create_string_tc(0));
list.add_value("", any, org.omg.CORBA.ARG_INOUT.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
String param = any.extract_string();
TEST(param.equals("TESTINOUT"));
any.insert_string("TEST");
return;
}
if (name.equals("one_string_out")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(orb_.create_string_tc(0));
list.add_value("", any, org.omg.CORBA.ARG_OUT.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
any.insert_string("TEST");
return;
}
if (name.equals("one_string_return")) {
NVList list = orb_.create_list(0);
request.arguments(list);
Any result = orb_.create_any();
result.insert_string("TEST");
request.set_result(result);
return;
}
if (name.equals("_get_struct_attrib")) {
NVList list = orb_.create_list(0);
request.arguments(list);
s rc = new s();
rc.sval = "TEST";
Any result = orb_.create_any();
sHelper.insert(result, rc);
request.set_result(result);
return;
}
if (name.equals("_set_struct_attrib")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(sHelper.type());
list.add_value("", any, org.omg.CORBA.ARG_IN.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
s param = sHelper.extract(any);
TEST(param.sval.equals("TEST"));
return;
}
if (name.equals("one_struct_in")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(sHelper.type());
list.add_value("", any, org.omg.CORBA.ARG_IN.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
s param = sHelper.extract(any);
TEST(param.sval.equals("TEST"));
return;
}
if (name.equals("one_struct_inout")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(sHelper.type());
list.add_value("", any, org.omg.CORBA.ARG_INOUT.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
s param = sHelper.extract(any);
TEST(param.sval.equals("TESTINOUT"));
s rc = new s();
rc.sval = "TEST";
sHelper.insert(any, rc);
return;
}
if (name.equals("one_struct_out")) {
NVList list = orb_.create_list(0);
Any any = orb_.create_any();
any.type(sHelper.type());
list.add_value("", any, org.omg.CORBA.ARG_OUT.value);
request.arguments(list);
try {
any = list.item(0).value();
} catch (Bounds ex) {
TEST(false);
}
s rc = new s();
rc.sval = "TEST";
sHelper.insert(any, rc);
return;
}
if (name.equals("one_struct_return")) {
NVList list = orb_.create_list(0);
request.arguments(list);
s rc = new s();
rc.sval = "TEST";
Any result = orb_.create_any();
sHelper.insert(result, rc);
request.set_result(result);
return;
}
if (name.equals("deactivate")) {
NVList list = orb_.create_list(0);
request.arguments(list);
orb_.shutdown(false);
return;
}
System.err.println("DSI implementation: unknown operation: " + name);
NVList list = orb_.create_list(0);
request.arguments(list);
Any exAny = orb_.create_any();
BAD_OPERATIONHelper.insert(exAny, new BAD_OPERATION());
request.set_exception(exAny);
}
}
| 5,687 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/_TestInterfaceStub.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.pi;
//
// IDL:TestInterface:1.0
//
public class _TestInterfaceStub extends org.apache.yoko.orb.CORBA.ObjectImpl
implements TestInterface
{
private static final String[] _ob_ids_ =
{
"IDL:TestInterface:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestInterfaceOperations.class;
//
// IDL:TestInterface/string_attrib:1.0
//
public String
string_attrib()
{
org.omg.CORBA.StringHolder _ob_rh = new org.omg.CORBA.StringHolder();
org.apache.yoko.orb.OB.ParameterDesc _ob_retDesc = new org.apache.yoko.orb.OB.ParameterDesc(_ob_rh, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 0);
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("_get_string_attrib", true, null, _ob_retDesc, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_rh.value = in.read_string();
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return _ob_rh.value;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("string_attrib", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
return _ob_self.string_attrib();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
public void
string_attrib(String _ob_a)
{
org.omg.CORBA.StringHolder _ob_ah = new org.omg.CORBA.StringHolder(_ob_a);
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 0)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("_set_string_attrib", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
out.write_string(_ob_ah.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("string_attrib", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.string_attrib(_ob_a);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/struct_attrib:1.0
//
public test.pi.TestInterfacePackage.s
struct_attrib()
{
test.pi.TestInterfacePackage.sHolder _ob_rh = new test.pi.TestInterfacePackage.sHolder();
org.apache.yoko.orb.OB.ParameterDesc _ob_retDesc = new org.apache.yoko.orb.OB.ParameterDesc(_ob_rh, test.pi.TestInterfacePackage.sHelper.type(), 0);
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("_get_struct_attrib", true, null, _ob_retDesc, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_rh.value = test.pi.TestInterfacePackage.sHelper.read(in);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return _ob_rh.value;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("struct_attrib", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
return _ob_self.struct_attrib();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
public void
struct_attrib(test.pi.TestInterfacePackage.s _ob_a)
{
test.pi.TestInterfacePackage.sHolder _ob_ah = new test.pi.TestInterfacePackage.sHolder(_ob_a);
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah, test.pi.TestInterfacePackage.sHelper.type(), 0)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("_set_struct_attrib", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
test.pi.TestInterfacePackage.sHelper.write(out, _ob_ah.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("struct_attrib", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.struct_attrib(_ob_a);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/noargs:1.0
//
public void
noargs()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("noargs", true, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("noargs", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.noargs();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/noargs_oneway:1.0
//
public void
noargs_oneway()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("noargs_oneway", false, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.oneway(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("noargs_oneway", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.noargs_oneway();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/systemexception:1.0
//
public void
systemexception()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("systemexception", true, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("systemexception", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.systemexception();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/userexception:1.0
//
public void
userexception()
throws test.pi.TestInterfacePackage.user
{
org.omg.CORBA.TypeCode[] _ob_exceptions =
{
test.pi.TestInterfacePackage.userHelper.type()
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("userexception", true, null, null, _ob_exceptions);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
try
{
String _ob_id = _ob_stub.unmarshalExceptionId(_ob_down);
if(_ob_id.equals(test.pi.TestInterfacePackage.userHelper.id()))
{
test.pi.TestInterfacePackage.user _ob_ex = test.pi.TestInterfacePackage.userHelper.read(in);
_ob_stub.setUserException(_ob_down, _ob_ex, _ob_id);
_ob_stub.postUnmarshal(_ob_down);
throw _ob_ex;
}
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
}
else
{
_ob_stub.postUnmarshal(_ob_down);
return;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("userexception", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.userexception();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(test.pi.TestInterfacePackage.user _ob_ex)
{
throw _ob_ex;
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/location_forward:1.0
//
public void
location_forward()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("location_forward", true, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("location_forward", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.location_forward();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/test_service_context:1.0
//
public void
test_service_context()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("test_service_context", true, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("test_service_context", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.test_service_context();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_string_in:1.0
//
public void
one_string_in(String _ob_a0)
{
org.omg.CORBA.StringHolder _ob_ah0 = new org.omg.CORBA.StringHolder(_ob_a0);
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 0 /*in*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_string_in", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
out.write_string(_ob_ah0.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_string_in", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_string_in(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_string_inout:1.0
//
public void
one_string_inout(org.omg.CORBA.StringHolder _ob_ah0)
{
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 2 /*inout*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_string_inout", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
out.write_string(_ob_ah0.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_ah0.value = in.read_string();
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_string_inout", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_string_inout(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_string_out:1.0
//
public void
one_string_out(org.omg.CORBA.StringHolder _ob_ah0)
{
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 1 /*out*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_string_out", true, _ob_desc, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_ah0.value = in.read_string();
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_string_out", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_string_out(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_string_return:1.0
//
public String
one_string_return()
{
org.omg.CORBA.StringHolder _ob_rh = new org.omg.CORBA.StringHolder();
org.apache.yoko.orb.OB.ParameterDesc _ob_retDesc = new org.apache.yoko.orb.OB.ParameterDesc(_ob_rh, _orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_string), 0);
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_string_return", true, null, _ob_retDesc, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_rh.value = in.read_string();
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return _ob_rh.value;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_string_return", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
return _ob_self.one_string_return();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_struct_in:1.0
//
public void
one_struct_in(test.pi.TestInterfacePackage.s _ob_a0)
{
test.pi.TestInterfacePackage.sHolder _ob_ah0 = new test.pi.TestInterfacePackage.sHolder(_ob_a0);
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, test.pi.TestInterfacePackage.sHelper.type(), 0 /*in*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_struct_in", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
test.pi.TestInterfacePackage.sHelper.write(out, _ob_ah0.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_struct_in", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_struct_in(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_struct_inout:1.0
//
public void
one_struct_inout(test.pi.TestInterfacePackage.sHolder _ob_ah0)
{
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, test.pi.TestInterfacePackage.sHelper.type(), 2 /*inout*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_struct_inout", true, _ob_desc, null, null);
try
{
org.omg.CORBA.portable.OutputStream out = _ob_stub.preMarshal(_ob_down);
try
{
test.pi.TestInterfacePackage.sHelper.write(out, _ob_ah0.value);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.marshalEx(_ob_down, _ob_ex);
}
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_ah0.value = test.pi.TestInterfacePackage.sHelper.read(in);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_struct_inout", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_struct_inout(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_struct_out:1.0
//
public void
one_struct_out(test.pi.TestInterfacePackage.sHolder _ob_ah0)
{
org.apache.yoko.orb.OB.ParameterDesc[] _ob_desc =
{
new org.apache.yoko.orb.OB.ParameterDesc(_ob_ah0, test.pi.TestInterfacePackage.sHelper.type(), 1 /*out*/)
};
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_struct_out", true, _ob_desc, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_ah0.value = test.pi.TestInterfacePackage.sHelper.read(in);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_struct_out", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.one_struct_out(_ob_ah0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/one_struct_return:1.0
//
public test.pi.TestInterfacePackage.s
one_struct_return()
{
test.pi.TestInterfacePackage.sHolder _ob_rh = new test.pi.TestInterfacePackage.sHolder();
org.apache.yoko.orb.OB.ParameterDesc _ob_retDesc = new org.apache.yoko.orb.OB.ParameterDesc(_ob_rh, test.pi.TestInterfacePackage.sHelper.type(), 0);
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("one_struct_return", true, null, _ob_retDesc, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
org.omg.CORBA.BooleanHolder _ob_uex = new org.omg.CORBA.BooleanHolder();
org.omg.CORBA.portable.InputStream in = _ob_stub.preUnmarshal(_ob_down, _ob_uex);
if(_ob_uex.value)
{
_ob_stub.postUnmarshal(_ob_down);
}
else
{
try
{
_ob_rh.value = test.pi.TestInterfacePackage.sHelper.read(in);
}
catch(org.omg.CORBA.SystemException _ob_ex)
{
_ob_stub.unmarshalEx(_ob_down, _ob_ex);
}
_ob_stub.postUnmarshal(_ob_down);
return _ob_rh.value;
}
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("one_struct_return", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
return _ob_self.one_struct_return();
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
//
// IDL:TestInterface/deactivate:1.0
//
public void
deactivate()
{
org.apache.yoko.orb.CORBA.RetryInfo _ob_info = new org.apache.yoko.orb.CORBA.RetryInfo();
while(true)
{
try
{
while(true)
{
if(!this._is_local())
{
org.apache.yoko.orb.OB.DowncallStub _ob_stub = _OB_getDowncallStub();
org.apache.yoko.orb.OB.Downcall _ob_down = _ob_stub.createPIArgsDowncall("deactivate", true, null, null, null);
try
{
_ob_stub.preMarshal(_ob_down);
_ob_stub.postMarshal(_ob_down);
_ob_stub.request(_ob_down);
_ob_stub.preUnmarshal(_ob_down);
_ob_stub.postUnmarshal(_ob_down);
return;
}
catch(org.apache.yoko.orb.OB.FailureException _ob_ex)
{
_ob_stub.handleFailureException(_ob_down, _ob_ex);
}
}
else
{
org.omg.CORBA.portable.ServantObject _ob_so = _servant_preinvoke("deactivate", _ob_opsClass);
if(_ob_so == null)
continue;
TestInterfaceOperations _ob_self = (TestInterfaceOperations)_ob_so.servant;
try
{
_ob_self.deactivate();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
catch(Exception _ob_ex)
{
_OB_handleException(_ob_ex, _ob_info);
}
}
}
}
| 5,688 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/ServerProxyManager.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.pi;
import org.omg.PortableInterceptor.*;
final class ServerProxyManager {
private ServerInterceptorProxy_impl[] p_ = new ServerInterceptorProxy_impl[3];
ServerProxyManager(ORBInitInfo info) {
p_[0] = new ServerInterceptorProxy_impl();
p_[1] = new ServerInterceptorProxy_impl();
p_[2] = new ServerInterceptorProxy_impl();
//
// Register the client side interceptor
//
try {
info.add_server_request_interceptor(p_[1]);
info.add_server_request_interceptor(p_[2]);
info.add_server_request_interceptor(p_[0]);
} catch (org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ex) {
throw new RuntimeException();
}
}
void setInterceptor(int which, ServerRequestInterceptor i) {
org.apache.yoko.orb.OB.Assert._OB_assert(which >= 0 && which < 3);
p_[which]._OB_changeInterceptor(i);
}
void clearInterceptors() {
setInterceptor(0, null);
setInterceptor(1, null);
setInterceptor(2, null);
}
}
| 5,689 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/ServerTestInterceptor_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableInterceptor.*;
import test.pi.TestInterfacePackage.*;
final class ServerTestInterceptor_impl extends org.omg.CORBA.LocalObject
implements ServerRequestInterceptor {
//
// From TestBase (no multiple inheritance)
//
public static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
private ORB orb_; // For Any creation
private org.omg.IOP.Codec cdrCodec_; // The cached CDR codec
private void testArgs(ServerRequestInfo ri, boolean resultAvail) {
String op = ri.operation();
org.omg.Dynamic.Parameter[] args = ri.arguments();
if (op.startsWith("_set_") || op.startsWith("_get_")) {
boolean isstr; // struct or string?
isstr = (op.indexOf("string") != -1);
if (op.startsWith("_get_")) {
TEST(args.length == 0);
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
if (isstr) {
String str = result.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(result);
TEST(sp.sval.startsWith("TEST"));
}
}
} else {
TEST(args.length == 1);
TEST(args[0].mode == org.omg.CORBA.ParameterMode.PARAM_IN);
if (resultAvail) {
if (isstr) {
String str = args[0].argument.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(args[0].argument);
TEST(sp.sval.startsWith("TEST"));
}
}
}
} else if (op.startsWith("one_")) {
String which = op.substring(4); // Which operation?
boolean isstr; // struct or string?
ParameterMode mode; // The parameter mode
if (which.startsWith("string"))
isstr = true;
else
// if which.startsWith("struct"))
isstr = false;
which = which.substring(7); // Skip <string|struct>_
if (which.equals("return")) {
TEST(args.length == 0);
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
if (isstr) {
String str = result.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(result);
TEST(sp.sval.startsWith("TEST"));
}
}
} else {
TEST(args.length == 1);
if (which.equals("in"))
mode = org.omg.CORBA.ParameterMode.PARAM_IN;
else if (which.equals("inout"))
mode = org.omg.CORBA.ParameterMode.PARAM_INOUT;
else
// if(which.equals("out"))
mode = org.omg.CORBA.ParameterMode.PARAM_OUT;
TEST(mode == args[0].mode);
if (mode != org.omg.CORBA.ParameterMode.PARAM_OUT
|| resultAvail) {
if (isstr) {
String str = args[0].argument.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(args[0].argument);
TEST(sp.sval.startsWith("TEST"));
}
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
TypeCode tc = result.type();
TEST(tc.kind() == TCKind.tk_void);
}
}
}
} else {
TEST(args.length == 0);
}
if (!resultAvail) {
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
}
}
private void testServiceContext(String op, ServerRequestInfo ri,
boolean addContext) {
if (op.equals("test_service_context")) {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(sc.context_id == REQUEST_CONTEXT_ID.value);
} catch (BAD_PARAM ex) {
TEST(false);
}
//
// Test: get_reply_service_context
//
org.omg.IOP.ServiceContext sc = null;
try {
sc = ri.get_reply_service_context(REPLY_CONTEXT_4_ID.value);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, ReplyContextHelper.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
ReplyContext context = ReplyContextHelper.extract(any);
TEST(context.data.equals("reply4"));
TEST(context.val == 114);
if (addContext) {
//
// Test: add_reply_service_context
//
context.data = "reply3";
context.val = 103;
any = orb_.create_any();
ReplyContextHelper.insert(any, context);
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
sc.context_id = REPLY_CONTEXT_3_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
try {
ri.add_reply_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: add same context again (no replace)
//
try {
ri.add_reply_service_context(sc, false);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: add same context again (replace)
//
try {
ri.add_reply_service_context(sc, true);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: replace context added in receive_request
//
context.data = "reply4";
context.val = 124;
ReplyContextHelper.insert(any, context);
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
sc.context_id = REPLY_CONTEXT_4_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
try {
ri.add_reply_service_context(sc, true);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
}
} else {
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
}
}
ServerTestInterceptor_impl(org.omg.CORBA.ORB orb,
org.omg.IOP.CodecFactory factory) {
orb_ = orb;
org.omg.IOP.Encoding how = new org.omg.IOP.Encoding(
(byte) org.omg.IOP.ENCODING_CDR_ENCAPS.value, (byte) 0,
(byte) 0);
try {
cdrCodec_ = factory.create_codec(how);
} catch (org.omg.IOP.CodecFactoryPackage.UnknownEncoding ex) {
TEST(false);
}
org.apache.yoko.orb.OB.Assert._OB_assert(cdrCodec_ != null);
}
//
// IDL to Java Mapping
//
public String name() {
return "ServerTestInterceptor";
}
public void destroy() {
}
public void receive_request_service_contexts(ServerRequestInfo ri) {
try {
//
// Test: get operation name
//
String op = ri.operation();
boolean oneway = (op.equals("noargs_oneway"));
//
// Test: Arguments should not be available
//
try {
org.omg.Dynamic.Parameter[] args = ri.arguments();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
// TODO: test operation_context
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: exceptions
//
try {
TypeCode[] exceptions = ri.exceptions();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: response expected and oneway should be equivalent
//
TEST((oneway && !ri.response_expected())
|| (!oneway && ri.response_expected()));
// TODO: test sync scope
//
// Test: reply status is not available
//
try {
ri.reply_status();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object ior = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: object id is not available
//
try {
byte[] id = ri.object_id();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: adapter id is not available
//
try {
byte[] id = ri.adapter_id();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: servant_most_derived_interface is not available
//
try {
String mdi = ri.target_most_derived_interface();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: server id is not available
//
try {
String id = ri.server_id();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: orb id is not available
//
try {
String id = ri.orb_id();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: adapter name is not available
//
try {
String[] name = ri.adapter_name();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: servant_is_a is not available
//
try {
ri.target_is_a("");
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
if (op.equals("test_service_context")) {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(sc.context_id == REQUEST_CONTEXT_ID.value);
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, RequestContextHelper
.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
RequestContext context = RequestContextHelper.extract(any);
TEST(context.data.equals("request"));
TEST(context.val == 10);
//
// Test: PortableInterceptor::Current
//
Any slotData = orb_.create_any();
slotData.insert_long(context.val);
try {
ri.set_slot(0, slotData);
} catch (InvalidSlot ex) {
TEST(false);
}
} catch (BAD_PARAM ex) {
TEST(false);
}
//
// Test: add_reply_service_context
//
ReplyContext context = new ReplyContext();
context.data = "reply1";
context.val = 101;
Any any = orb_.create_any();
ReplyContextHelper.insert(any, context);
byte[] data = null;
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REPLY_CONTEXT_1_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
try {
ri.add_reply_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: add same context again (no replace)
//
try {
ri.add_reply_service_context(sc, false);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: add same context again (replace)
//
try {
ri.add_reply_service_context(sc, true);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: add second context
//
context.data = "reply4";
context.val = 104;
ReplyContextHelper.insert(any, context);
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
sc.context_id = REPLY_CONTEXT_4_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
// try
// {
ri.add_reply_service_context(sc, false);
// }
// catch(BAD_INV_ORDER ex)
// {
// TEST(false);
// }
} else {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: sending exception is not available
//
try {
Any any = ri.sending_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_server_policy
//
Policy policy = ri.get_server_policy(MY_SERVER_POLICY_ID.value);
MyServerPolicy myServerPolicy = MyServerPolicyHelper.narrow(policy);
TEST(myServerPolicy != null);
TEST(myServerPolicy.value() == 10);
try {
policy = ri.get_server_policy(1013);
TEST(false);
} catch (INV_POLICY ex) {
// Expected
}
} catch (test.common.TestException ex) {
ex.printStackTrace();
throw ex;
}
}
public void receive_request(ServerRequestInfo ri) {
try {
//
// Test: get operation name
//
String op = ri.operation();
boolean oneway = (op.equals("noargs_oneway"));
//
// Test: Examine arguments
//
testArgs(ri, false);
// TODO: test operation_context
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: exceptions
//
try {
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
} catch (NO_RESOURCES ex) {
// Expected (if servant is DSI)
}
//
// Test: response expected and oneway should be equivalent
//
TEST((oneway && !ri.response_expected())
|| (!oneway && ri.response_expected()));
// TODO: test sync scope
//
// Test: reply status is not available
//
try {
ri.reply_status();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object ior = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
if (op.equals("test_service_context")) {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(sc.context_id == REQUEST_CONTEXT_ID.value);
} catch (BAD_PARAM ex) {
TEST(false);
}
//
// Test: add_reply_service_context
//
ReplyContext context = new ReplyContext();
context.data = "reply2";
context.val = 102;
Any any = orb_.create_any();
ReplyContextHelper.insert(any, context);
byte[] data = null;
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REPLY_CONTEXT_2_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
try {
ri.add_reply_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: add same context again (no replace)
//
try {
ri.add_reply_service_context(sc, false);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: add same context again (replace)
//
try {
ri.add_reply_service_context(sc, true);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: replace context added in
// receive_request_service_context
//
context.data = "reply4";
context.val = 114;
ReplyContextHelper.insert(any, context);
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
sc.context_id = REPLY_CONTEXT_4_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
try {
ri.add_reply_service_context(sc, true);
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
} else {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: sending exception is not available
//
try {
Any any = ri.sending_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: object id is correct
//
byte[] oid = ri.object_id();
TEST((oid.length == 4 && (new String(oid)).equals("test"))
|| (oid.length == 7 && (new String(oid)).equals("testDSI")));
//
// Test: adapter id is correct (this is a tough one to test)
//
byte[] adapterId = ri.adapter_id();
TEST(adapterId.length != 0);
//
// Test: servant most derived interface is correct
//
String mdi = ri.target_most_derived_interface();
TEST(mdi.equals("IDL:TestInterface:1.0"));
//
// Test: server id is correct
//
String serverId = ri.server_id();
TEST(serverId.equals(""));
//
// Test: orb id is correct
//
String orbId = ri.orb_id();
TEST(orbId.equals("myORB"));
//
// Test: adapter name is correct
//
String[] adapterName = ri.adapter_name();
TEST(adapterName.length == 1 && adapterName[0].equals("persistent"));
//
// Test: servant is a is correct
//
TEST(ri.target_is_a("IDL:TestInterface:1.0"));
//
// Test: get_server_policy
//
Policy policy = ri.get_server_policy(MY_SERVER_POLICY_ID.value);
MyServerPolicy myServerPolicy = MyServerPolicyHelper.narrow(policy);
TEST(myServerPolicy != null);
TEST(myServerPolicy.value() == 10);
try {
policy = ri.get_server_policy(1013);
TEST(false);
} catch (INV_POLICY ex) {
// Expected
}
} catch (test.common.TestException ex) {
ex.printStackTrace();
throw ex;
}
}
public void send_reply(ServerRequestInfo ri) {
try {
//
// Test: get operation name
//
String op = ri.operation();
//
// If "deactivate" then we're done
//
if (op.equals("deactivate"))
return;
boolean oneway = op.equals("noargs_oneway");
//
// Test: Arguments should be available
//
testArgs(ri, true);
// TODO: test operation_context
//
// Test: exceptions
//
try {
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
} catch (NO_RESOURCES ex) {
// Expected (if servant is DSI)
}
//
// Test: response expected and oneway should be equivalent
//
TEST((oneway && !ri.response_expected())
|| (!oneway && ri.response_expected()));
// TODO: test sync scope
//
// Test: reply status is available
//
TEST(ri.reply_status() == SUCCESSFUL.value);
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object ior = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_request_service_context
// Test: get_reply_service_context
// Test: add_reply_service_context
//
testServiceContext(op, ri, true);
//
// Test: sending exception is not available
//
try {
Any any = ri.sending_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: object id is correct
//
byte[] oid = ri.object_id();
TEST((oid.length == 4 && (new String(oid)).equals("test"))
|| (oid.length == 7 && (new String(oid)).equals("testDSI")));
//
// Test: adapter id is correct (this is a tough one to test)
//
byte[] adapterId = ri.adapter_id();
TEST(adapterId.length != 0);
//
// Test: target_most_derived_interface raises BAD_INV_ORDER
//
try {
String mdi = ri.target_most_derived_interface();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: server id is correct
//
String serverId = ri.server_id();
TEST(serverId.equals(""));
//
// Test: orb id is correct
//
String orbId = ri.orb_id();
TEST(orbId.equals("myORB"));
//
// Test: adapter name is correct
//
String[] adapterName = ri.adapter_name();
TEST(adapterName.length == 1 && adapterName[0].equals("persistent"));
//
// Test: target_is_a raises BAD_INV_ORDER
//
try {
ri.target_is_a("IDL:TestInterface:1.0");
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_server_policy
//
Policy policy = ri.get_server_policy(MY_SERVER_POLICY_ID.value);
MyServerPolicy myServerPolicy = MyServerPolicyHelper.narrow(policy);
TEST(myServerPolicy != null);
TEST(myServerPolicy.value() == 10);
try {
policy = ri.get_server_policy(1013);
TEST(false);
} catch (INV_POLICY ex) {
// Expected
}
//
// Test: get_slot
//
if (op.equals("test_service_context")) {
int val;
Any slotData = null;
try {
slotData = ri.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
val = slotData.extract_long();
TEST(val == 20);
}
} catch (test.common.TestException ex) {
ex.printStackTrace();
throw ex;
}
}
public void send_other(ServerRequestInfo ri) {
try {
//
// Test: get operation name
//
String op = ri.operation();
TEST(op.equals("location_forward"));
//
// Test: Arguments should not be available
//
try {
org.omg.Dynamic.Parameter[] parameters = ri.arguments();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: exceptions
//
try {
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
} catch (BAD_INV_ORDER ex) {
// Expected, depending on what raised the exception
} catch (NO_RESOURCES ex) {
// Expected (if servant is DSI)
}
// TODO: test operation_context
//
// Test: response expected should be true
//
TEST(ri.response_expected());
// TODO: test sync scope
//
// Test: reply status is available
//
TEST(ri.reply_status() == LOCATION_FORWARD.value);
//
// Test: forward reference is available
//
try {
org.omg.CORBA.Object ior = ri.forward_reference();
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: get_request_service_context
// Test: get_reply_service_context
//
testServiceContext(op, ri, false);
//
// Test: sending exception is not available
//
try {
Any any = ri.sending_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: object id is correct
//
byte[] oid = ri.object_id();
TEST((oid.length == 4 && (new String(oid)).equals("test"))
|| (oid.length == 7 && (new String(oid)).equals("testDSI")));
//
// Test: adapter id is correct (this is a tough one to test)
//
byte[] adapterId = ri.adapter_id();
TEST(adapterId.length != 0);
//
// Test: target_most_derived_interface raises BAD_INV_ORDER
//
try {
String mdi = ri.target_most_derived_interface();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: server id is correct
//
String serverId = ri.server_id();
TEST(serverId.equals(""));
//
// Test: orb id is correct
//
String orbId = ri.orb_id();
TEST(orbId.equals("myORB"));
//
// Test: adapter name is correct
//
String[] adapterName = ri.adapter_name();
TEST(adapterName.length == 1 && adapterName[0].equals("persistent"));
//
// Test: target_is_a raises BAD_INV_ORDER
//
try {
ri.target_is_a("IDL:TestInterface:1.0");
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_server_policy
//
Policy policy = ri.get_server_policy(MY_SERVER_POLICY_ID.value);
MyServerPolicy myServerPolicy = MyServerPolicyHelper.narrow(policy);
TEST(myServerPolicy != null);
TEST(myServerPolicy.value() == 10);
try {
policy = ri.get_server_policy(1013);
TEST(false);
} catch (INV_POLICY ex) {
// Expected
}
} catch (test.common.TestException ex) {
ex.printStackTrace();
throw ex;
}
}
public void send_exception(ServerRequestInfo ri) {
try {
//
// Test: get operation name
//
String op = ri.operation();
TEST(op.equals("systemexception") || op.equals("userexception")
|| op.equals("deactivate"));
boolean user = op.equals("userexception");
//
// If "deactivate" then we're done
//
if (op.equals("deactivate"))
return;
//
// Test: Arguments should not be available
//
try {
org.omg.Dynamic.Parameter[] parameters = ri.arguments();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
// TODO: test operation_context
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: exceptions
//
try {
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
} catch (BAD_INV_ORDER ex) {
TEST(false);
} catch (NO_RESOURCES ex) {
// Expected (if servant is DSI)
}
//
// Test: response expected should be true
//
TEST(ri.response_expected());
// TODO: test sync scope
//
// Test: reply status is available
//
if (user)
TEST(ri.reply_status() == USER_EXCEPTION.value);
else
TEST(ri.reply_status() == SYSTEM_EXCEPTION.value);
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object ior = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_request_service_context
// Test: get_reply_service_context
//
testServiceContext(op, ri, false);
//
// Test: sending exception is available
//
try {
Any any = ri.sending_exception();
if (!user) {
SystemException ex = org.apache.yoko.orb.OB.Util
.unmarshalSystemException(any.create_input_stream());
} else {
user ex = userHelper.extract(any);
}
} catch (BAD_INV_ORDER ex) {
TEST(false);
} catch (NO_RESOURCES ex) // TODO: remove this!
{
}
//
// Test: object id is correct
//
byte[] oid = ri.object_id();
TEST((oid.length == 4 && (new String(oid)).equals("test"))
|| (oid.length == 7 && (new String(oid)).equals("testDSI")));
//
// Test: adapter id is correct (this is a tough one to test)
//
byte[] adapterId = ri.adapter_id();
TEST(adapterId.length != 0);
//
// Test: target_most_derived_interface raises BAD_INV_ORDER
//
try {
String mdi = ri.target_most_derived_interface();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: server id is correct
//
String serverId = ri.server_id();
TEST(serverId.equals(""));
//
// Test: orb id is correct
//
String orbId = ri.orb_id();
TEST(orbId.equals("myORB"));
//
// Test: adapter name is correct
//
String[] adapterName = ri.adapter_name();
TEST(adapterName.length == 1 && adapterName[0].equals("persistent"));
//
// Test: target_is_a raises BAD_INV_ORDER
//
try {
ri.target_is_a("IDL:TestInterface:1.0");
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_server_policy
//
Policy policy = ri.get_server_policy(MY_SERVER_POLICY_ID.value);
MyServerPolicy myServerPolicy = MyServerPolicyHelper.narrow(policy);
TEST(myServerPolicy != null);
TEST(myServerPolicy.value() == 10);
try {
policy = ri.get_server_policy(1013);
TEST(false);
} catch (INV_POLICY ex) {
// Expected
}
} catch (test.common.TestException ex) {
ex.printStackTrace();
throw ex;
}
}
}
| 5,690 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyComponentHelper.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.pi;
//
// IDL:MyComponent:1.0
//
final public class MyComponentHelper
{
public static void
insert(org.omg.CORBA.Any any, MyComponent val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static MyComponent
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[1];
members[0] = new org.omg.CORBA.StructMember();
members[0].name = "val";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
typeCode_ = orb.create_struct_tc(id(), "MyComponent", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:MyComponent:1.0";
}
public static MyComponent
read(org.omg.CORBA.portable.InputStream in)
{
MyComponent _ob_v = new MyComponent();
_ob_v.val = in.read_long();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, MyComponent val)
{
out.write_long(val.val);
}
}
| 5,691 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyServerPolicyOperations.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.pi;
//
// IDL:MyServerPolicy:1.0
//
/***/
public interface MyServerPolicyOperations extends org.omg.CORBA.PolicyOperations
{
//
// IDL:MyServerPolicy/value:1.0
//
/***/
int
value();
}
| 5,692 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/CallInterceptor_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableInterceptor.*;
import test.pi.TestInterfacePackage.*;
final class CallInterceptor_impl extends org.omg.CORBA.LocalObject implements
ClientRequestInterceptor {
//
// From TestBase (no multiple inheritance)
//
public static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
private int req_;
private org.omg.IOP.Codec cdrCodec_;
private org.omg.PortableInterceptor.Current pic_;
void testArgs(ClientRequestInfo ri, boolean resultAvail) {
String op = ri.operation();
org.omg.Dynamic.Parameter[] args = ri.arguments();
if (op.startsWith("_set_") || op.startsWith("_get_")) {
boolean isstr; // struct or string?
isstr = (op.indexOf("string") != -1);
if (op.startsWith("_get_")) {
TEST(args.length == 0);
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
if (isstr) {
String str = result.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(result);
TEST(sp.sval.startsWith("TEST"));
}
}
} else {
TEST(args.length == 1);
TEST(args[0].mode == org.omg.CORBA.ParameterMode.PARAM_IN);
if (resultAvail) {
if (isstr) {
String str = args[0].argument.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(args[0].argument);
TEST(sp.sval.startsWith("TEST"));
}
}
}
} else if (op.startsWith("one_")) {
String which = op.substring(4); // Which operation?
boolean isstr; // struct or string?
ParameterMode mode; // The parameter mode
if (which.startsWith("string"))
isstr = true;
else
// if(which.startsWith("struct"))
isstr = false;
which = which.substring(7); // Skip <string|struct>_
if (which.equals("return")) {
TEST(args.length == 0);
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
if (isstr) {
String str = result.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(result);
TEST(sp.sval.startsWith("TEST"));
}
}
} else {
TEST(args.length == 1);
if (which.equals("in"))
mode = org.omg.CORBA.ParameterMode.PARAM_IN;
else if (which.equals("inout"))
mode = org.omg.CORBA.ParameterMode.PARAM_INOUT;
else
// if(which.equals("out"))
mode = org.omg.CORBA.ParameterMode.PARAM_OUT;
TEST(mode == args[0].mode);
if (mode != org.omg.CORBA.ParameterMode.PARAM_OUT
|| resultAvail) {
if (isstr) {
String str = args[0].argument.extract_string();
TEST(str.startsWith("TEST"));
} else {
s sp = sHelper.extract(args[0].argument);
TEST(sp.sval.startsWith("TEST"));
}
if (resultAvail) {
//
// Test: result
//
Any result = ri.result();
TypeCode tc = result.type();
TEST(tc.kind() == TCKind.tk_void);
}
}
}
} else {
TEST(args.length == 0);
}
if (!resultAvail) {
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
}
}
CallInterceptor_impl(ORB orb) {
org.omg.IOP.CodecFactory factory = null;
try {
factory = org.omg.IOP.CodecFactoryHelper.narrow(orb
.resolve_initial_references("CodecFactory"));
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
TEST(false);
}
TEST(factory != null);
try {
pic_ = org.omg.PortableInterceptor.CurrentHelper.narrow(orb
.resolve_initial_references("PICurrent"));
} catch (org.omg.CORBA.ORBPackage.InvalidName ex) {
TEST(false);
}
TEST(pic_ != null);
org.omg.IOP.Encoding how = new org.omg.IOP.Encoding(
(byte) org.omg.IOP.ENCODING_CDR_ENCAPS.value, (byte) 0,
(byte) 0);
try {
cdrCodec_ = factory.create_codec(how);
} catch (org.omg.IOP.CodecFactoryPackage.UnknownEncoding ex) {
TEST(false);
}
org.apache.yoko.orb.OB.Assert._OB_assert(cdrCodec_ != null);
}
public String name() {
return "CRI";
}
public void destroy() {
}
public void send_request(ClientRequestInfo ri) {
req_++;
//
// Test: request id
//
int id = ri.request_id();
//
// This statement is required to avoid "unused variable" warning
// generated by the compiler.
//
TEST(id == id);
//
// Test: get operation name
//
String op = ri.operation();
boolean oneway = op.equals("noargs_oneway");
//
// Test: Examine arguments
//
testArgs(ri, false);
// TODO: test context
//
// Test: result is not available
//
try {
Any result = ri.result();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: exceptions
//
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
//
// Test: oneway and response expected are equivalent
TEST((oneway && !ri.response_expected())
|| (!oneway && ri.response_expected()));
// TODO: test sync scope
//
// Test: target is available
//
org.omg.CORBA.Object target = ri.target();
TEST(target != null);
//
// Test: effective_target is available
//
org.omg.CORBA.Object effectiveTarget = ri.effective_target();
TEST(effectiveTarget != null);
//
// Test: effective_profile
org.omg.IOP.TaggedProfile effectiveProfile = ri.effective_profile();
TEST(effectiveProfile.tag == org.omg.IOP.TAG_INTERNET_IOP.value);
//
// Test: reply status is not available
//
try {
ri.reply_status();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: received_exception is not available
//
try {
Any rc = ri.received_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object fwd = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: test get_effective_component
//
org.omg.IOP.TaggedComponent componentEncoding = ri
.get_effective_component(MY_COMPONENT_ID.value);
byte[] componentData = componentEncoding.component_data;
Any componentAny = null;
try {
componentAny = cdrCodec_.decode_value(componentData,
MyComponentHelper.type());
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
}
MyComponent component = MyComponentHelper.extract(componentAny);
TEST(component.val == 10);
// TODO: test get_effective_components
//
// Test: get_request_policy
//
Policy policy = ri.get_request_policy(MY_CLIENT_POLICY_ID.value);
MyClientPolicy myClientPolicy = MyClientPolicyHelper.narrow(policy);
TEST(myClientPolicy != null);
TEST(myClientPolicy.value() == 10);
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: add_request_service_context
//
if (op.equals("test_service_context")) {
RequestContext context = new RequestContext();
context.data = "request";
//
// Test: PortableInteceptor::Current
//
Any slotData = null;
try {
slotData = ri.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
context.val = slotData.extract_long();
TEST(context.val == 10);
Any any = ORB.init().create_any();
RequestContextHelper.insert(any, context);
byte[] data = null;
try {
data = cdrCodec_.encode_value(any);
} catch (org.omg.IOP.CodecPackage.InvalidTypeForEncoding ex) {
TEST(false);
}
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REQUEST_CONTEXT_ID.value;
sc.context_data = new byte[data.length];
System.arraycopy(data, 0, sc.context_data, 0, data.length);
ri.add_request_service_context(sc, false);
//
// Test: ensure that the data is present
//
try {
org.omg.IOP.ServiceContext sc2 = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
} catch (BAD_PARAM ex) {
TEST(false);
}
} else {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
}
//
// Test: examine PICurrent
//
Any slotData = null;
try {
slotData = pic_.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
TEST(slotData.type().kind().value() == TCKind._tk_null);
Any newSlotData = ORB.init().create_any();
newSlotData.insert_long(15);
try {
pic_.set_slot(0, newSlotData);
} catch (InvalidSlot ex) {
TEST(false);
}
}
public void send_poll(ClientRequestInfo ri) {
TEST(false);
}
public void receive_reply(ClientRequestInfo ri) {
//
// Test: request id
//
int id = ri.request_id();
//
// This statement is required to avoid "unused variable" warning
// generated by the compiler.
//
TEST(id == id);
//
// Test: get operation name
//
String op = ri.operation();
//
// If "deactivate" then we're done
//
if (op.equals("deactivate"))
return;
boolean oneway = op.equals("noargs_oneway");
//
// Test: Examine arguments
//
testArgs(ri, true);
// TODO: test context
//
// Test: exceptions
//
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
//
// Test: oneway and response expected are equivalent
//
TEST((oneway && !ri.response_expected())
|| (!oneway && ri.response_expected()));
// TODO: test sync scope
//
// Test: target is available
//
org.omg.CORBA.Object target = ri.target();
TEST(target != null);
//
// Test: effective_target is available
//
org.omg.CORBA.Object effectiveTarget = ri.effective_target();
TEST(effectiveTarget != null);
//
// Test: effective_profile
//
org.omg.IOP.TaggedProfile effectiveProfile = ri.effective_profile();
TEST(effectiveProfile.tag == org.omg.IOP.TAG_INTERNET_IOP.value);
//
// Test: test get_effective_component
//
org.omg.IOP.TaggedComponent componentEncoding = ri
.get_effective_component(MY_COMPONENT_ID.value);
byte[] componentData = componentEncoding.component_data;
Any componentAny = null;
try {
componentAny = cdrCodec_.decode_value(componentData,
MyComponentHelper.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
MyComponent component = MyComponentHelper.extract(componentAny);
TEST(component.val == 10);
// TODO: test get_effective_components
//
// Test: get_request_policy
//
Policy policy = ri.get_request_policy(MY_CLIENT_POLICY_ID.value);
MyClientPolicy myClientPolicy = MyClientPolicyHelper.narrow(policy);
TEST(myClientPolicy != null);
TEST(myClientPolicy.value() == 10);
//
// Test: reply status is SUCCESS
//
TEST(ri.reply_status() == SUCCESSFUL.value);
//
// Test: received_exception is not available
//
try {
Any rc = ri.received_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: forward reference is not available
//
try {
org.omg.CORBA.Object fwd = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
if (op.equals("test_service_context")) {
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
} catch (BAD_PARAM ex) {
TEST(false);
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(sc.context_id == REPLY_CONTEXT_1_ID.value);
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, ReplyContextHelper
.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
ReplyContext context = ReplyContextHelper.extract(any);
TEST(context.data.equals("reply1"));
TEST(context.val == 101);
} catch (BAD_PARAM ex) {
TEST(false);
}
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_2_ID.value);
TEST(sc.context_id == REPLY_CONTEXT_2_ID.value);
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, ReplyContextHelper
.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
ReplyContext context = ReplyContextHelper.extract(any);
TEST(context.data.equals("reply2"));
TEST(context.val == 102);
} catch (BAD_PARAM ex) {
TEST(false);
}
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_3_ID.value);
TEST(sc.context_id == REPLY_CONTEXT_3_ID.value);
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, ReplyContextHelper
.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
ReplyContext context = ReplyContextHelper.extract(any);
TEST(context.data.equals("reply3"));
TEST(context.val == 103);
} catch (BAD_PARAM ex) {
TEST(false);
}
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_4_ID.value);
TEST(sc.context_id == REPLY_CONTEXT_4_ID.value);
byte[] data = new byte[sc.context_data.length];
System.arraycopy(sc.context_data, 0, data, 0,
sc.context_data.length);
Any any = null;
try {
any = cdrCodec_.decode_value(data, ReplyContextHelper
.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
ReplyContext context = ReplyContextHelper.extract(any);
TEST(context.data.equals("reply4"));
TEST(context.val == 124);
} catch (BAD_PARAM ex) {
TEST(false);
}
} else {
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
}
//
// Test: add_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REQUEST_CONTEXT_ID.value;
ri.add_request_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: examine PICurrent
//
Any slotData = null;
try {
slotData = pic_.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
int v = slotData.extract_long();
TEST(v == 15);
Any newSlotData = ORB.init().create_any();
newSlotData.insert_long(16);
try {
pic_.set_slot(0, newSlotData);
} catch (InvalidSlot ex) {
TEST(false);
}
}
public void receive_other(ClientRequestInfo ri) {
//
// Test: request id
//
int id = ri.request_id();
//
// This statement is required to avoid "unused variable" warning
// generated by the compiler.
//
TEST(id == id);
//
// Test: get operation name. Verify operation name is valid.
//
String op = ri.operation();
TEST(op.equals("location_forward"));
//
// Test: Examine arguments
//
try {
org.omg.Dynamic.Parameter[] args = ri.arguments();
} catch (org.omg.CORBA.BAD_INV_ORDER ex) {
// Expected
}
// TODO: test context
//
// Test: exceptions
//
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
//
// Test: response expected is true
//
TEST(ri.response_expected());
// TODO: test sync scope
//
// Test: target is available
//
org.omg.CORBA.Object target = ri.target();
TEST(target != null);
//
// Test: effective_target is available
//
org.omg.CORBA.Object effectiveTarget = ri.effective_target();
TEST(effectiveTarget != null);
//
// Test: effective_profile
//
org.omg.IOP.TaggedProfile effectiveProfile = ri.effective_profile();
TEST(effectiveProfile.tag == org.omg.IOP.TAG_INTERNET_IOP.value);
//
// Test: test get_effective_component
//
org.omg.IOP.TaggedComponent componentEncoding = ri
.get_effective_component(MY_COMPONENT_ID.value);
byte[] componentData = componentEncoding.component_data;
Any componentAny = null;
try {
componentAny = cdrCodec_.decode_value(componentData,
MyComponentHelper.type());
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
}
MyComponent component = MyComponentHelper.extract(componentAny);
TEST(component.val == 10);
// TODO: test get_effective_components
//
// Test: get_request_policy
//
Policy policy = ri.get_request_policy(MY_CLIENT_POLICY_ID.value);
MyClientPolicy myClientPolicy = MyClientPolicyHelper.narrow(policy);
TEST(myClientPolicy != null);
TEST(myClientPolicy.value() == 10);
//
// Test: reply status is LOCATION_FORWARD
//
TEST(ri.reply_status() == LOCATION_FORWARD.value);
//
// Test: received_exception is not available
//
try {
Any rc = ri.received_exception();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: forward reference is available
//
try {
org.omg.CORBA.Object fwd = ri.forward_reference();
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: add_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REQUEST_CONTEXT_ID.value;
ri.add_request_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: examine PICurrent
//
Any slotData = null;
try {
slotData = pic_.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
int v = slotData.extract_long();
TEST(v == 15);
Any newSlotData = ORB.init().create_any();
newSlotData.insert_long(16);
try {
pic_.set_slot(0, newSlotData);
} catch (InvalidSlot ex) {
TEST(false);
}
//
// Eat the location forward
//
throw new NO_IMPLEMENT();
}
public void receive_exception(ClientRequestInfo ri) {
//
// Test: request id
//
int id = ri.request_id();
//
// This statement is required to avoid "unused variable" warning
// generated by the compiler.
//
TEST(id == id);
//
// Test: get operation name. Verify that operation name is
// valid
String op = ri.operation();
TEST(op.equals("systemexception") || op.equals("userexception")
|| op.equals("deactivate"));
//
// If "deactivate" then we're done
//
if (op.equals("deactivate"))
return;
boolean user = op.equals("userexception");
//
// Test: Examine arguments
//
try {
org.omg.Dynamic.Parameter[] args = ri.arguments();
} catch (org.omg.CORBA.BAD_INV_ORDER ex) {
// Expected
}
// TODO: test context
//
// Test: exceptions
//
TypeCode[] exceptions = ri.exceptions();
if (op.equals("userexception")) {
TEST(exceptions.length == 1);
TEST(exceptions[0].equal(userHelper.type()));
} else {
TEST(exceptions.length == 0);
}
//
// Test: response expected is true
//
TEST(ri.response_expected());
// TODO: test sync scope
//
// Test: target is available
//
org.omg.CORBA.Object target = ri.target();
TEST(target != null);
//
// Test: effective_target is available
//
org.omg.CORBA.Object effectiveTarget = ri.effective_target();
TEST(effectiveTarget != null);
//
// Test: effective_profile
//
org.omg.IOP.TaggedProfile effectiveProfile = ri.effective_profile();
TEST(effectiveProfile.tag == org.omg.IOP.TAG_INTERNET_IOP.value);
//
// Test: test get_effective_component
org.omg.IOP.TaggedComponent componentEncoding = ri
.get_effective_component(MY_COMPONENT_ID.value);
byte[] componentData = componentEncoding.component_data;
Any componentAny = null;
try {
componentAny = cdrCodec_.decode_value(componentData,
MyComponentHelper.type());
} catch (org.omg.IOP.CodecPackage.FormatMismatch ex) {
TEST(false);
} catch (org.omg.IOP.CodecPackage.TypeMismatch ex) {
TEST(false);
}
MyComponent component = MyComponentHelper.extract(componentAny);
TEST(component.val == 10);
// TODO: test get_effective_components
//
// Test: get_request_policy
//
Policy policy = ri.get_request_policy(MY_CLIENT_POLICY_ID.value);
MyClientPolicy myClientPolicy = MyClientPolicyHelper.narrow(policy);
TEST(myClientPolicy != null);
TEST(myClientPolicy.value() == 10);
//
// Test: reply status is correct
//
if (user)
TEST(ri.reply_status() == USER_EXCEPTION.value);
else
TEST(ri.reply_status() == SYSTEM_EXCEPTION.value);
//
// Test: received_exception is available and correct
//
try {
Any rc = ri.received_exception();
if (!user) {
SystemException ex = org.apache.yoko.orb.OB.Util
.unmarshalSystemException(rc.create_input_stream());
} else {
String exId = ri.received_exception_id();
TEST(exId.equals(userHelper.id()));
user ex = userHelper.extract(rc);
}
} catch (BAD_INV_ORDER ex) {
TEST(false);
}
//
// Test: forward reference is available
//
try {
org.omg.CORBA.Object fwd = ri.forward_reference();
TEST(false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: get_reply_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_reply_service_context(REPLY_CONTEXT_1_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: get_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = ri
.get_request_service_context(REQUEST_CONTEXT_ID.value);
TEST(false);
} catch (BAD_PARAM ex) {
// Expected
}
//
// Test: add_request_service_context
//
try {
org.omg.IOP.ServiceContext sc = new org.omg.IOP.ServiceContext();
sc.context_id = REQUEST_CONTEXT_ID.value;
ri.add_request_service_context(sc, false);
} catch (BAD_INV_ORDER ex) {
// Expected
}
//
// Test: examine PICurrent
//
Any slotData = null;
try {
slotData = pic_.get_slot(0);
} catch (InvalidSlot ex) {
TEST(false);
}
int v = slotData.extract_long();
TEST(v == 15);
Any newSlotData = ORB.init().create_any();
newSlotData.insert_long(16);
try {
pic_.set_slot(0, newSlotData);
} catch (InvalidSlot ex) {
TEST(false);
}
}
int _OB_numReq() {
return req_;
}
}
| 5,693 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/REPLY_CONTEXT_4_ID.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.pi;
//
// IDL:REPLY_CONTEXT_4_ID:1.0
//
/***/
public interface REPLY_CONTEXT_4_ID
{
int value = (int)(104L);
}
| 5,694 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/RequestContext.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.pi;
//
// IDL:RequestContext:1.0
//
/***/
final public class RequestContext implements org.omg.CORBA.portable.IDLEntity
{
private static final String _ob_id = "IDL:RequestContext:1.0";
public
RequestContext()
{
}
public
RequestContext(String data,
int val)
{
this.data = data;
this.val = val;
}
public String data;
public int val;
}
| 5,695 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyServerPolicyFactory_impl.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.pi;
import org.omg.CORBA.*;
import org.omg.PortableInterceptor.*;
final class MyServerPolicyFactory_impl extends org.omg.CORBA.LocalObject
implements PolicyFactory {
//
// IDL to Java Mapping
//
public Policy create_policy(int type, Any any) throws PolicyError {
if (type == MY_SERVER_POLICY_ID.value) {
try {
int val = any.extract_long();
return new MyServerPolicy_impl(val);
} catch (BAD_OPERATION ex) {
throw new PolicyError(BAD_POLICY_TYPE.value);
}
}
throw new PolicyError(BAD_POLICY.value);
}
}
| 5,696 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/MyComponentHolder.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.pi;
//
// IDL:MyComponent:1.0
//
final public class MyComponentHolder implements org.omg.CORBA.portable.Streamable
{
public MyComponent value;
public
MyComponentHolder()
{
}
public
MyComponentHolder(MyComponent initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = MyComponentHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
MyComponentHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return MyComponentHelper.type();
}
}
| 5,697 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/RequestContextHolder.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.pi;
//
// IDL:RequestContext:1.0
//
final public class RequestContextHolder implements org.omg.CORBA.portable.Streamable
{
public RequestContext value;
public
RequestContextHolder()
{
}
public
RequestContextHolder(RequestContext initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = RequestContextHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
RequestContextHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return RequestContextHelper.type();
}
}
| 5,698 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/pi/ReplyContextHelper.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.pi;
//
// IDL:ReplyContext:1.0
//
final public class ReplyContextHelper
{
public static void
insert(org.omg.CORBA.Any any, ReplyContext val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static ReplyContext
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 = "data";
members[0].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string);
members[1] = new org.omg.CORBA.StructMember();
members[1].name = "val";
members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
typeCode_ = orb.create_struct_tc(id(), "ReplyContext", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:ReplyContext:1.0";
}
public static ReplyContext
read(org.omg.CORBA.portable.InputStream in)
{
ReplyContext _ob_v = new ReplyContext();
_ob_v.data = in.read_string();
_ob_v.val = in.read_long();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, ReplyContext val)
{
out.write_string(val.data);
out.write_long(val.val);
}
}
| 5,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.