index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestAdapterActivatorServer.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.poa;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POAPackage.*;
import org.omg.PortableServer.POAManagerPackage.*;
import java.io.*;
public final class TestAdapterActivatorServer extends test.common.TestBase {
static POA createTestPOA(POA parent, String name) {
POAManager mgr = parent.the_POAManager();
Policy[] policies = new Policy[3];
policies[0] = parent
.create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
policies[1] = parent
.create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue.USER_ID);
policies[2] = parent
.create_request_processing_policy(org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
try {
return parent.create_POA(name, mgr, policies);
} catch (AdapterAlreadyExists ex) {
assertTrue(false);
} catch (InvalidPolicy ex) {
assertTrue(false);
}
return null;
}
final static class TestAdapterActivator_impl extends AdapterActivatorPOA {
private String expectedName_;
private boolean create_;
private boolean invoked_;
TestAdapterActivator_impl() {
create_ = false;
invoked_ = false;
}
void reset(String name, boolean create) {
expectedName_ = name;
create_ = create;
invoked_ = false;
}
boolean invoked() {
return invoked_;
}
public boolean unknown_adapter(POA parent, String name) {
assertTrue(name.equals(expectedName_));
invoked_ = true;
if (create_) {
Policy[] policies = new Policy[0];
POAManager mgr = parent.the_POAManager();
try {
POA poa = parent.create_POA(name, mgr, policies);
} catch (AdapterAlreadyExists ex) {
assertTrue(false);
} catch (InvalidPolicy ex) {
assertTrue(false);
}
return true;
} else
return false;
}
}
static void TestAdapterActivator(ORB orb, POA root) {
org.omg.CORBA.Object obj;
Policy[] policies;
POA poa, parent;
POAManager mgr;
String str;
POAManager rootMgr = root.the_POAManager();
assertTrue(rootMgr != null);
//
// If this function terminates due to an exception this
// application will crash because this stack based servant will
// still be registered with the root POA
//
TestAdapterActivator_impl activatorImpl = new TestAdapterActivator_impl();
AdapterActivator activator = activatorImpl._this(orb);
root.the_activator(activator);
//
// Test: Activator and successful creation
//
activatorImpl.reset("poa1", true);
poa = null;
try {
poa = root.find_POA("poa1", true);
} catch (AdapterNonExistent ex) {
assertTrue(false);
}
assertTrue(poa != null);
assertTrue(activatorImpl.invoked());
str = poa.the_name();
assertTrue(str.equals("poa1"));
parent = poa.the_parent();
assertTrue(parent != null);
assertTrue(parent._is_equivalent(root));
//
// Test: Activator and unsuccessful creation
//
activatorImpl.reset("poa2", false);
try {
root.find_POA("poa2", true);
} catch (AdapterNonExistent ex) {
// expected
}
assertTrue(activatorImpl.invoked());
//
// Test: Make sure activator isn't called when POA already exists
//
activatorImpl.reset("poa1", true);
try {
poa = root.find_POA("poa1", true);
} catch (AdapterNonExistent ex) {
assertTrue(false);
}
assertTrue(!activatorImpl.invoked());
//
// Test: Disable adapter activator and make sure it isn't invoked
//
root.the_activator(null);
activatorImpl.reset("poa2", false);
try {
root.find_POA("poa2", true);
} catch (AdapterNonExistent ex) {
// expected
}
assertTrue(!activatorImpl.invoked());
poa.destroy(true, true);
try {
byte[] id = root.servant_to_id(activatorImpl);
root.deactivate_object(id);
} catch (ServantNotActive ex) {
assertTrue(false);
} catch (ObjectNotActive ex) {
assertTrue(false);
} catch (WrongPolicy ex) {
assertTrue(false);
}
}
//
// Classes for testing the adapter activator on a remote call.
//
final static class TestServantActivator_impl extends ServantActivatorPOA {
private ORB orb_;
TestServantActivator_impl(ORB orb) {
orb_ = orb;
}
public Servant incarnate(byte[] oid, POA poa) throws ForwardRequest {
String oidString = new String(oid);
//
// If the user is requesting the object "test" then oblige
//
Servant servant = null;
if (oidString.equals("test"))
servant = new Test_impl(orb_, "test", false);
if (servant != null) {
//
// Verify that POA allows activator to explicitly activate
// a servant
//
try {
poa.activate_object_with_id(oid, servant);
return servant;
} catch (ObjectAlreadyActive ex) {
assertTrue(false);
} catch (ServantAlreadyActive ex) {
assertTrue(false);
} catch (WrongPolicy ex) {
assertTrue(false);
}
}
//
// Fail
//
throw new OBJECT_NOT_EXIST();
}
public void etherealize(byte[] oid, POA poa, Servant servant,
boolean cleanup, boolean remaining) {
if (!remaining) {
String oidString = new String(oid);
//
// If the user is requesting the object "test" then oblige.
//
if (oidString.equals("test"))
servant = null;
}
}
}
final static class TestRemoteAdapterActivator_impl extends
AdapterActivatorPOA {
private ORB orb_;
private POA root_;
private TestServantActivator_impl activator_;
TestRemoteAdapterActivator_impl(ORB orb, POA root) {
orb_ = orb;
root_ = root;
activator_ = new TestServantActivator_impl(orb_);
activator_._this(orb_);
}
public boolean unknown_adapter(POA parent, String name) {
if (name.equals("poa3") || name.equals("poa4")) {
POA poa = createTestPOA(parent, name);
ServantActivator activator = activator_._this();
if (name.equals("poa3")) {
AdapterActivator me = _this(orb_);
poa.the_activator(me);
} else {
try {
poa.set_servant_manager(activator);
} catch (WrongPolicy ex) {
assertTrue(false);
}
}
return true;
} else
return false;
}
}
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");
ORB orb = null;
try {
orb = ORB.init(args, props);
POA root = TestUtil.GetRootPOA(orb);
POAManager manager = root.the_POAManager();
assertTrue(manager != null);
//
// Run implementation
//
try {
manager.activate();
} catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ex) {
assertTrue(false);
}
TestAdapterActivator(orb, root);
//
// First create an object-reference to the test POA. Then
// destroy the POA so that the adapter activator will activate
// the POA when necessary.
//
POA poa3 = createTestPOA(root, "poa3");
POA poa4 = createTestPOA(poa3, "poa4");
byte[] oid = ("test").getBytes();
org.omg.CORBA.Object reference1 = null;
reference1 = poa4.create_reference_with_id(oid, "IDL:Test:1.0");
poa4.destroy(true, true);
poa4 = null;
poa3.destroy(true, true);
poa3 = null;
//
// Create server
//
TestInfo[] info = new TestInfo[1];
info[0] = new TestInfo();
info[0].obj = TestHelper.narrow(reference1);
info[0].except_id = "";
TestServer_impl serverImpl = new TestServer_impl(orb, info);
TestServer server = serverImpl._this(orb);
//
// Save reference
//
String refFile = "Test.ref";
try {
FileOutputStream file = new FileOutputStream(refFile);
PrintWriter out = new PrintWriter(file);
out.println(orb.object_to_string(server));
out.flush();
file.close();
} catch (IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
System.exit(1);
}
TestRemoteAdapterActivator_impl activatorImpl = new TestRemoteAdapterActivator_impl(
orb, root);
AdapterActivator activator = activatorImpl._this(orb);
root.the_activator(activator);
orb.run();
File file = new File(refFile);
file.delete();
} catch (SystemException ex) {
ex.printStackTrace();
System.exit(1);
}
if (orb != null) {
try {
orb.destroy();
} catch (SystemException ex) {
ex.printStackTrace();
System.exit(1);
}
}
System.exit(0);
}
}
| 5,800 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestDispatchStrategyServer.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.poa;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
public final class TestDispatchStrategyServer extends test.common.TestBase {
//
// Implementation to test same thread dispatch strategy
//
abstract static class AbstractTest extends TestPOA {
private volatile boolean failed = false;
public final boolean failed() {
return failed;
}
protected void fail() {
failed = true;
}
}
abstract static class AbstractTestPool extends AbstractTest {
private final Set<Thread> threadSet = new HashSet<>();
private final int maxSize;
AbstractTestPool(int maxSize) {
this.maxSize = maxSize;
}
public final synchronized void aMethod() {
final Thread thisThread = Thread.currentThread();
if (threadSet.contains(thisThread)) return;
if (threadSet.size() < maxSize) {
threadSet.add(thisThread);
return;
}
fail();
}
}
final static class TestSameThread_impl extends AbstractTestPool {
TestSameThread_impl() { super(1); }
}
//
// Implementation to test thread per request dispatch strategy
//
final static class TestThreadPerReq_impl extends AbstractTest {
private final Set<Thread> threadSet = new HashSet<>();
public synchronized void aMethod() {
final Thread thisThread = Thread.currentThread();
//
// Test to ensure that each request is being handled
// by a different thread.
//
if (threadSet.contains(thisThread)) {
fail();
return;
}
threadSet.add(thisThread);
}
}
//
// Implementation to test thread pool dispatch strategy
//
final static class TestThreadPool_impl extends AbstractTestPool {
TestThreadPool_impl() { super(2); }
}
//
// Simple custom dispatch strategy (uses same thread)
//
final static class CustDispatchStrategy extends org.omg.CORBA.LocalObject
implements org.apache.yoko.orb.OB.DispatchStrategy {
public int id() {
return 4; // Some unique number
}
public org.omg.CORBA.Any info() {
return org.omg.CORBA.ORB.init().create_any();
}
public void dispatch(org.apache.yoko.orb.OB.DispatchRequest request) {
request.invoke();
}
}
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");
org.omg.CORBA.ORB orb = null;
try {
args = org.apache.yoko.orb.CORBA.ORB.ParseArgs(args, props, null);
//
// Set the communications concurrency model
//
props.put("yoko.orb.conc_model", "threaded");
props.put("yoko.orb.oa.conc_model", "threaded");
//
// Create ORB
//
orb = org.omg.CORBA.ORB.init(args, props);
//
// Resolve Root POA and POA Manager
//
org.omg.CORBA.Object poaObj = orb
.resolve_initial_references("RootPOA");
org.apache.yoko.orb.OBPortableServer.POA rootPOA = org.apache.yoko.orb.OBPortableServer.POAHelper
.narrow(poaObj);
org.omg.PortableServer.POAManager manager = rootPOA
.the_POAManager();
//
// Resolve Dispatch Strategy Factory
//
org.omg.CORBA.Object dsfObj = orb
.resolve_initial_references("DispatchStrategyFactory");
org.apache.yoko.orb.OB.DispatchStrategyFactory dsf = org.apache.yoko.orb.OB.DispatchStrategyFactoryHelper
.narrow(dsfObj);
//
// Create Dispatch Strategy objects
//
org.apache.yoko.orb.OB.DispatchStrategy ds_st = dsf
.create_same_thread_strategy();
org.apache.yoko.orb.OB.DispatchStrategy ds_tpr = dsf
.create_thread_per_request_strategy();
int tpid = dsf.create_thread_pool(2);
org.apache.yoko.orb.OB.DispatchStrategy ds_tp = dsf
.create_thread_pool_strategy(tpid);
org.apache.yoko.orb.OB.DispatchStrategy ds_cus = new CustDispatchStrategy();
//
// Create POAs with threaded Dispatch Strategy Policies
// - same thread
// - thread per request
// - thread pool (same pool used for two POAs)
// - custom strategy
//
org.omg.CORBA.Policy[] policies = new org.omg.CORBA.Policy[1];
policies[0] = rootPOA.create_dispatch_strategy_policy(ds_st);
org.omg.PortableServer.POA stPOA = rootPOA.create_POA("stPOA",
manager, policies);
policies[0] = rootPOA.create_dispatch_strategy_policy(ds_tpr);
org.omg.PortableServer.POA tprPOA = rootPOA.create_POA("tprPOA",
manager, policies);
policies[0] = rootPOA.create_dispatch_strategy_policy(ds_tp);
org.omg.PortableServer.POA tpPOA1 = rootPOA.create_POA("tpPOA1",
manager, policies);
org.omg.PortableServer.POA tpPOA2 = rootPOA.create_POA("tpPOA2",
manager, policies);
policies[0] = rootPOA.create_dispatch_strategy_policy(ds_cus);
org.omg.PortableServer.POA cusPOA = rootPOA.create_POA("cusPOA",
manager, policies);
//
// Create test implementation object in each POA
//
TestSameThread_impl stTest = new TestSameThread_impl();
byte[] stObjId = stPOA.activate_object(stTest);
org.omg.CORBA.Object stObjRef = stPOA.id_to_reference(stObjId);
TestThreadPerReq_impl tprTest = new TestThreadPerReq_impl();
byte[] tprObjId = tprPOA.activate_object(tprTest);
org.omg.CORBA.Object tprObjRef = tprPOA.id_to_reference(tprObjId);
TestThreadPool_impl tpTest = new TestThreadPool_impl();
byte[] tpObjId1 = tpPOA1.activate_object(tpTest);
org.omg.CORBA.Object tpObjRef1 = tpPOA1.id_to_reference(tpObjId1);
byte[] tpObjId2 = tpPOA2.activate_object(tpTest);
org.omg.CORBA.Object tpObjRef2 = tpPOA2.id_to_reference(tpObjId2);
TestSameThread_impl cusTest = new TestSameThread_impl();
byte[] cusObjId = cusPOA.activate_object(cusTest);
org.omg.CORBA.Object cusObjRef = cusPOA.id_to_reference(cusObjId);
//
// Create Test Server
//
TestInfo[] info = new TestInfo[5];
info[0] = new TestInfo();
info[1] = new TestInfo();
info[2] = new TestInfo();
info[3] = new TestInfo();
info[4] = new TestInfo();
info[0].obj = TestHelper.narrow(stObjRef);
info[0].except_id = "";
info[1].obj = TestHelper.narrow(tprObjRef);
info[1].except_id = "";
info[2].obj = TestHelper.narrow(tpObjRef1);
info[2].except_id = "";
info[3].obj = TestHelper.narrow(tpObjRef2);
info[3].except_id = "";
info[4].obj = TestHelper.narrow(cusObjRef);
info[4].except_id = "";
TestServer_impl serverImpl = new TestServer_impl(orb, info);
TestServer server = serverImpl._this(orb);
//
// Save reference
//
String refFile = "Test.ref";
try {
FileOutputStream file = new FileOutputStream(refFile);
PrintWriter out = new PrintWriter(file);
out.println(orb.object_to_string(server));
out.flush();
file.close();
} catch (IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
System.exit(1);
}
//
// Run implementation
//
manager.activate();
orb.run();
//
// Check for failure
//
if (stTest.failed() || cusTest.failed() || tpTest.failed()
|| tprTest.failed())
System.exit(1);
File file = new File(refFile);
file.delete();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
System.exit(1);
} catch (org.omg.CORBA.UserException ex) {
ex.printStackTrace();
System.exit(1);
}
if (orb != null) {
try {
orb.destroy();
} catch (org.omg.CORBA.SystemException ex) {
ex.printStackTrace();
System.exit(1);
}
}
System.exit(0);
}
}
| 5,801 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestLocationForwardServer.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.poa;
//
// IDL:TestLocationForwardServer:1.0
//
/***/
public interface TestLocationForwardServer extends TestLocationForwardServerOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,802 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestLocationForwardOperations.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.poa;
//
// IDL:TestLocationForward:1.0
//
/***/
public interface TestLocationForwardOperations extends TestOperations
{
//
// IDL:TestLocationForward/deactivate_servant:1.0
//
/***/
void
deactivate_servant();
}
| 5,803 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestServantActivatorServer.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.poa;
import static org.junit.Assert.assertTrue;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POAPackage.*;
import org.omg.PortableServer.POAManagerPackage.*;
import java.io.*;
import java.util.Properties;
public final class TestServantActivatorServer extends test.common.TestBase {
final static class TestActivator_impl extends ServantActivatorPOA {
private ORB orb_;
private boolean etherealizeCalled_ = false;
TestActivator_impl(ORB orb) {
orb_ = orb;
}
public Servant incarnate(byte[] oid, POA poa) throws ForwardRequest {
String oidString = new String(oid);
//
// If the user is requesting the object "test" then oblige
//
Servant servant = null;
if (oidString.equals("test"))
servant = new Test_impl(orb_, "test", false);
else if (oidString.equals("testDSI"))
servant = new TestDSIRef_impl(orb_, "", false);
if (servant != null) {
//
// Verify that POA allows activator to explicitly activate
// a servant
//
try {
poa.activate_object_with_id(oid, servant);
} catch (ObjectAlreadyActive ex) {
throw new RuntimeException();
} catch (WrongPolicy ex) {
throw new RuntimeException();
} catch (ServantAlreadyActive ex) {
throw new RuntimeException();
}
return servant;
}
//
// Fail
//
throw new org.omg.CORBA.OBJECT_NOT_EXIST();
}
public void etherealize(byte[] oid, POA poa, Servant servant,
boolean cleanup, boolean remaining) {
if (!remaining) {
etherealizeCalled_ = true;
//
// Etherealize is called when the orb -> shutdown()
// method is called. The ORB shutdown calls
// destroy(true, true) on each POAManagers. The
// cleanup flag should be set to true here.
//
if (!cleanup)
throw new RuntimeException();
String oidString = new String(oid);
//
// If the user is requesting the object "test" then oblige.
//
if (oidString.equals("test"))
servant = null;
else if (oidString.equals("testDSI"))
; // Do nothing here
}
}
public boolean etherealize_called() {
return etherealizeCalled_;
}
}
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");
ORB orb = null;
try {
//
// Create ORB
//
orb = ORB.init(args, props);
POA root = TestUtil.GetRootPOA(orb);
POAManager manager = root.the_POAManager();
Policy[] policies = new Policy[3];
policies[0] = root
.create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
policies[1] = root
.create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue.USER_ID);
policies[2] = root
.create_request_processing_policy(org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
POA persistentPOA = null;
try {
persistentPOA = root
.create_POA("persistent", manager, policies);
} catch (AdapterAlreadyExists ex) {
throw new RuntimeException();
} catch (InvalidPolicy ex) {
throw new RuntimeException();
}
TestActivator_impl activatorImpl = new TestActivator_impl(orb);
ServantActivator activator = activatorImpl._this(orb);
try {
persistentPOA.set_servant_manager(activator);
} catch (WrongPolicy ex) {
throw new RuntimeException();
}
//
// Create three references, two good and one bad
//
byte[] oid1 = ("test").getBytes();
byte[] oid2 = ("testDSI").getBytes();
byte[] oid3 = ("test2").getBytes();
org.omg.CORBA.Object reference1 = persistentPOA
.create_reference_with_id(oid1, "IDL:Test:1.0");
org.omg.CORBA.Object reference2 = persistentPOA
.create_reference_with_id(oid2, "IDL:Test:1.0");
org.omg.CORBA.Object reference3 = persistentPOA
.create_reference_with_id(oid3, "IDL:Test:1.0");
//
// Create server
//
TestInfo[] info = new TestInfo[3];
info[0] = new TestInfo();
info[1] = new TestInfo();
info[2] = new TestInfo();
info[0].obj = TestHelper.narrow(reference1);
info[0].except_id = "";
info[1].obj = TestHelper.narrow(reference2);
info[1].except_id = "";
info[2].obj = TestHelper.narrow(reference3);
info[2].except_id = "IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0";
TestServer_impl serverImpl = new TestServer_impl(orb, info);
TestServer server = serverImpl._this(orb);
//
// Save reference
//
String refFile = "Test.ref";
try {
FileOutputStream file = new FileOutputStream(refFile);
PrintWriter out = new PrintWriter(file);
out.println(orb.object_to_string(server));
out.flush();
file.close();
} catch (IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
System.exit(1);
}
//
// Run implementation
//
try {
manager.activate();
} catch (AdapterInactive ex) {
throw new RuntimeException();
}
orb.run();
assertTrue(activatorImpl.etherealize_called());
File file = new File(refFile);
file.delete();
} catch (SystemException ex) {
ex.printStackTrace();
System.exit(1);
}
if (orb != null) {
try {
orb.destroy();
} catch (SystemException ex) {
ex.printStackTrace();
System.exit(1);
}
}
System.exit(0);
}
}
| 5,804 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestInfoHolder.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.poa;
//
// IDL:TestInfo:1.0
//
final public class TestInfoHolder implements org.omg.CORBA.portable.Streamable
{
public TestInfo value;
public
TestInfoHolder()
{
}
public
TestInfoHolder(TestInfo initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestInfoHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestInfoHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestInfoHelper.type();
}
}
| 5,805 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/TestServer.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.poa;
//
// IDL:TestServer:1.0
//
/***/
public interface TestServer extends TestServerOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,806 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/AdapterInactiveHelper.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/AdapterInactive:1.0
//
final public class AdapterInactiveHelper
{
public static void
insert(org.omg.CORBA.Any any, AdapterInactive val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static AdapterInactive
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
org.omg.CORBA.StructMember[] members = new org.omg.CORBA.StructMember[0];
typeCode_ = orb.create_exception_tc(id(), "AdapterInactive", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:POAManagerProxy/AdapterInactive:1.0";
}
public static AdapterInactive
read(org.omg.CORBA.portable.InputStream in)
{
if(!id().equals(in.read_string()))
throw new org.omg.CORBA.MARSHAL();
AdapterInactive _ob_v = new AdapterInactive();
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, AdapterInactive val)
{
out.write_string(id());
}
}
| 5,807 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/AdapterInactiveHolder.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/AdapterInactive:1.0
//
final public class AdapterInactiveHolder implements org.omg.CORBA.portable.Streamable
{
public AdapterInactive value;
public
AdapterInactiveHolder()
{
}
public
AdapterInactiveHolder(AdapterInactive initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = AdapterInactiveHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
AdapterInactiveHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return AdapterInactiveHelper.type();
}
}
| 5,808 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/AdapterInactive.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/AdapterInactive:1.0
//
/***/
final public class AdapterInactive extends org.omg.CORBA.UserException
{
private static final String _ob_id = "IDL:POAManagerProxy/AdapterInactive:1.0";
public
AdapterInactive()
{
super(_ob_id);
}
public
AdapterInactive(String _reason)
{
super(_ob_id + " " + _reason);
}
}
| 5,809 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/StateHolder.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/State:1.0
//
final public class StateHolder implements org.omg.CORBA.portable.Streamable
{
public State value;
public
StateHolder()
{
}
public
StateHolder(State initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = StateHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
StateHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return StateHelper.type();
}
}
| 5,810 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/StateHelper.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/State:1.0
//
final public class StateHelper
{
public static void
insert(org.omg.CORBA.Any any, State val)
{
org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
write(out, val);
any.read_value(out.create_input_stream(), type());
}
public static State
extract(org.omg.CORBA.Any any)
{
if(any.type().equivalent(type()))
return read(any.create_input_stream());
else
throw new org.omg.CORBA.BAD_OPERATION();
}
private static org.omg.CORBA.TypeCode typeCode_;
public static org.omg.CORBA.TypeCode
type()
{
if(typeCode_ == null)
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
String[] members = new String[4];
members[0] = "HOLDING";
members[1] = "ACTIVE";
members[2] = "DISCARDING";
members[3] = "INACTIVE";
typeCode_ = orb.create_enum_tc(id(), "State", members);
}
return typeCode_;
}
public static String
id()
{
return "IDL:POAManagerProxy/State:1.0";
}
public static State
read(org.omg.CORBA.portable.InputStream in)
{
State _ob_v;
_ob_v = State.from_int(in.read_ulong());
return _ob_v;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, State val)
{
out.write_ulong(val.value());
}
}
| 5,811 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/poa/POAManagerProxyPackage/State.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.poa.POAManagerProxyPackage;
//
// IDL:POAManagerProxy/State:1.0
//
/***/
public class State implements org.omg.CORBA.portable.IDLEntity
{
private static State [] values_ = new State[4];
private int value_;
public final static int _HOLDING = 0;
public final static State HOLDING = new State(_HOLDING);
public final static int _ACTIVE = 1;
public final static State ACTIVE = new State(_ACTIVE);
public final static int _DISCARDING = 2;
public final static State DISCARDING = new State(_DISCARDING);
public final static int _INACTIVE = 3;
public final static State INACTIVE = new State(_INACTIVE);
protected
State(int value)
{
values_[value] = this;
value_ = value;
}
public int
value()
{
return value_;
}
public static State
from_int(int value)
{
if(value < values_.length)
return values_[value];
else
throw new org.omg.CORBA.BAD_PARAM("Value (" + value + ") out of range", 25, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
private java.lang.Object
readResolve()
throws java.io.ObjectStreamException
{
return from_int(value());
}
}
| 5,812 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleSerializable.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.rmi;
import java.io.Serializable;
import java.rmi.Remote;
import java.util.List;
public class SampleSerializable implements Serializable {
private org.omg.CORBA.Object corbaObj;
private test.rmi.SampleCorba sampleCorba;
private Remote remote;
private SampleRemote sampleRemote;
private Object remoteObj;
private Object serializableObj1, serializableObj2;
private Serializable serializable;
private int i = 0;
private List aVector;
public void setInt(int i) { this.i = i; }
public int getInt() { return i; }
public void setSampleCorba(SampleCorba sampleCorba) {
this.sampleCorba = sampleCorba;
}
public SampleCorba getSampleCorba() {
return sampleCorba;
}
public void setCorbaObj(org.omg.CORBA.Object obj) {
this.corbaObj = obj;
}
public void setRemote(Remote remote) {
this.remote = remote;
}
public void setRemoteObject(Remote remote) {
this.remoteObj = remote;
}
public void setSerializableObject(Serializable ser) {
this.serializableObj1 = this.serializableObj2 = ser;
}
public org.omg.CORBA.Object getCorbaObj() {
return corbaObj;
}
public Remote getRemote() { return remote; }
public Object getRemoteObject() {
return remoteObj;
}
public Object getSerializableObject() {
if(serializableObj1 == serializableObj2) {
return serializableObj1;
}
else {
throw new Error("Expected serializable objects to be == identical");
}
}
public void setList(List l) {
aVector = l;
}
public List getList() {
return aVector;
}
public void setSerializable(Serializable s) {
this.serializable = s;
}
public Serializable getSerializable() {
return serializable;
}
public void setSampleRemote(SampleRemote sampleRemote) {
this.sampleRemote = sampleRemote;
}
public SampleRemote getSampleRemote() {
return sampleRemote;
}
}
| 5,813 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorba_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.rmi;
public class SampleCorba_impl extends SampleCorbaPOA {
private int i;
private String s;
public int i() {
return i;
}
public void i(int newI) {
this.i = newI;
}
public String s() {
return s;
}
public void s(String newS) {
s = newS;
}
}
| 5,814 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/_SampleCorbaStub.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.rmi;
/**
* test/rmi/_SampleCorbaStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
public class _SampleCorbaStub extends org.omg.CORBA_2_3.portable.ObjectImpl implements test.rmi.SampleCorba
{
// Constructors
// NOTE: If the default constructor is used, the
// object is useless until _set_delegate (...)
// is called.
public _SampleCorbaStub ()
{
super ();
}
public _SampleCorbaStub (org.omg.CORBA.portable.Delegate delegate)
{
super ();
_set_delegate (delegate);
}
public int i ()
{
while(true) {
if ( !this._is_local() ) {
org.omg.CORBA.portable.InputStream _in = null;
try {
org.omg.CORBA.portable.OutputStream _out = _request ("_get_i",true);
_in = _invoke (_out);
int __result = _in.read_long ();
return __result;
} catch (org.omg.CORBA.portable.ApplicationException _ex) {
_in = _ex.getInputStream ();
String _id = _ex.getId ();
throw new org.omg.CORBA.UNKNOWN( "Unexpected User Exception: " + _id );
} catch (org.omg.CORBA.portable.RemarshalException _rm) {
continue;
} catch (org.omg.CORBA.portable.UnknownException _ue) {
Throwable _oe = _ue.originalEx;
if (_oe instanceof Error)
throw (Error)_oe;
else if (_oe instanceof RuntimeException)
throw (RuntimeException)_oe;
else
throw _ue;
} finally { _releaseReply (_in); }
}
else {
org.omg.CORBA.portable.ServantObject _so =
_servant_preinvoke( "_get_i",_opsClass );
if ( _so == null ) {
continue;
}
try {
int __result = ((test.rmi.SampleCorbaOperations)_so.servant).i( );
return __result;
} finally { _servant_postinvoke( _so ); }
}
}
} // i
public void i (int newI)
{
while(true) {
if ( !this._is_local() ) {
org.omg.CORBA.portable.InputStream _in = null;
try {
org.omg.CORBA.portable.OutputStream _out = _request ("_set_i",true);
_out.write_long (newI);
_in = _invoke (_out);
return;
} catch (org.omg.CORBA.portable.ApplicationException _ex) {
_in = _ex.getInputStream ();
String _id = _ex.getId ();
throw new org.omg.CORBA.UNKNOWN( "Unexpected User Exception: " + _id );
} catch (org.omg.CORBA.portable.RemarshalException _rm) {
continue;
} catch (org.omg.CORBA.portable.UnknownException _ue) {
Throwable _oe = _ue.originalEx;
if (_oe instanceof Error)
throw (Error)_oe;
else if (_oe instanceof RuntimeException)
throw (RuntimeException)_oe;
else
throw _ue;
} finally { _releaseReply (_in); }
}
else {
org.omg.CORBA.portable.ServantObject _so =
_servant_preinvoke( "_set_i",_opsClass );
if ( _so == null ) {
continue;
}
try {
((test.rmi.SampleCorbaOperations)_so.servant).i( newI );
return;
} finally { _servant_postinvoke( _so ); }
}
}
} // i
public String s ()
{
while(true) {
if ( !this._is_local() ) {
org.omg.CORBA.portable.InputStream _in = null;
try {
org.omg.CORBA.portable.OutputStream _out = _request ("_get_s",true);
_in = _invoke (_out);
String __result = _in.read_string ();
return __result;
} catch (org.omg.CORBA.portable.ApplicationException _ex) {
_in = _ex.getInputStream ();
String _id = _ex.getId ();
throw new org.omg.CORBA.UNKNOWN( "Unexpected User Exception: " + _id );
} catch (org.omg.CORBA.portable.RemarshalException _rm) {
continue;
} catch (org.omg.CORBA.portable.UnknownException _ue) {
Throwable _oe = _ue.originalEx;
if (_oe instanceof Error)
throw (Error)_oe;
else if (_oe instanceof RuntimeException)
throw (RuntimeException)_oe;
else
throw _ue;
} finally { _releaseReply (_in); }
}
else {
org.omg.CORBA.portable.ServantObject _so =
_servant_preinvoke( "_get_s",_opsClass );
if ( _so == null ) {
continue;
}
try {
String __result = ((test.rmi.SampleCorbaOperations)_so.servant).s( );
return __result;
} finally { _servant_postinvoke( _so ); }
}
}
} // s
public void s (String newS)
{
while(true) {
if ( !this._is_local() ) {
org.omg.CORBA.portable.InputStream _in = null;
try {
org.omg.CORBA.portable.OutputStream _out = _request ("_set_s",true);
_out.write_string (newS);
_in = _invoke (_out);
return;
} catch (org.omg.CORBA.portable.ApplicationException _ex) {
_in = _ex.getInputStream ();
String _id = _ex.getId ();
throw new org.omg.CORBA.UNKNOWN( "Unexpected User Exception: " + _id );
} catch (org.omg.CORBA.portable.RemarshalException _rm) {
continue;
} catch (org.omg.CORBA.portable.UnknownException _ue) {
Throwable _oe = _ue.originalEx;
if (_oe instanceof Error)
throw (Error)_oe;
else if (_oe instanceof RuntimeException)
throw (RuntimeException)_oe;
else
throw _ue;
} finally { _releaseReply (_in); }
}
else {
org.omg.CORBA.portable.ServantObject _so =
_servant_preinvoke( "_set_s",_opsClass );
if ( _so == null ) {
continue;
}
try {
((test.rmi.SampleCorbaOperations)_so.servant).s( newS );
return;
} finally { _servant_postinvoke( _so ); }
}
}
} // s
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:test/rmi/SampleCorba:1.0"};
public String[] _ids ()
{
return (String[])__ids.clone ();
}
final public static java.lang.Class _opsClass =
test.rmi.SampleCorbaOperations.class;
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
{
String str = s.readUTF ();
org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ((String[])null, null).string_to_object (str);
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
_set_delegate (delegate);
}
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
{
String str = org.omg.CORBA.ORB.init ((String[])null, null).object_to_string (this);
s.writeUTF (str);
}
} // class _SampleCorbaStub
| 5,815 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleData.java | package test.rmi;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Objects;
/**
* Created by nrichard on 11/03/16.
*/
public class SampleData implements Serializable {
private static class Data2 implements Serializable {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Data2)) return false;
return true;
}
}
private static class MrBoom implements Serializable {
private void writeObject(ObjectOutputStream oos) throws IOException {
throw new IOException("*BOOM*!");
}
}
public static enum DataEnum {
E1(new Data2()), E2(new MrBoom());
public final Serializable s;
private DataEnum(Serializable s) {
this.s = s;
}
}
public final Serializable f1 = DataEnum.E1;
public final Serializable f2 = DataEnum.E2;
public final Serializable f3 = DataEnum.E1.s;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SampleData)) return false;
SampleData sd = (SampleData)o;
if (f1 != sd.f1) return false;
if (f2 != sd.f2) return false;
return f3.equals(sd.f3);
}
@Override
public int hashCode() {
return Objects.hash(f1, f2);
}
}
| 5,816 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/ClientMain.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.rmi;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
import javax.rmi.PortableRemoteObject;
import org.junit.Assert;
import org.omg.PortableServer.POA;
public class ClientMain extends Assert {
public static class Test extends Assert {
private Sample sample;
public Test(Sample sample) {
this.sample = sample;
}
// Test invoking methods with primitive arguments
public void testPrimitive() throws RemoteException {
sample.setBoolean(true);
assertTrue(sample.getBoolean());
sample.setByte((byte)64);
assertEquals((byte)64, sample.getByte());
sample.setShort((short)128);
assertEquals((short)128, sample.getShort());
sample.setInt(256);
assertEquals(256, sample.getInt());
sample.setLong(512);
assertEquals(512, sample.getLong());
sample.setChar('a');
assertEquals('a', sample.getChar());
}
// Test invoking methods with signature conflicts and arrays
public void testArray() throws RemoteException {
assertTrue(10 == sample.sendReceiveInt(10));
int[] intA = new int[] {10, 20};
intA = sample.sendReceiveInt(intA);
assertEquals(2, intA.length);
assertTrue(20 == intA[0]);
assertTrue(10 == intA[1]);
assertTrue(10 == sample.sendReceiveShort((short)10));
short[] shortA = new short[] {10, 20};
shortA = sample.sendReceiveShort(shortA);
assertEquals(2, shortA.length);
assertTrue(20 == shortA[0]);
assertTrue(10 == shortA[1]);
assertTrue(10 == sample.sendReceiveChar((char)10));
char[] charA = new char[] {10, 20};
charA = sample.sendReceiveChar(charA);
assertEquals(2, charA.length);
assertTrue(20 == charA[0]);
assertTrue(10 == charA[1]);
assertTrue(10 == sample.sendReceiveByte((byte)10));
byte[] byteA = new byte[] {10, 20};
byteA = sample.sendReceiveByte(byteA);
assertEquals(2, byteA.length);
assertTrue(20 == byteA[0]);
assertTrue(10 == byteA[1]);
assertTrue(10L == sample.sendReceiveLong(10L));
long[] longA = new long[] {10L, 20L};
longA = sample.sendReceiveLong(longA);
assertEquals(2, longA.length);
assertTrue(20L == longA[0]);
assertTrue(10L == longA[1]);
assertTrue(10. == sample.sendReceiveFloat((float)10.));
float[] floatA = new float[] {(float)10., (float)20.};
floatA = sample.sendReceiveFloat(floatA);
assertEquals(2, floatA.length);
assertTrue(20. == floatA[0]);
assertTrue(10. == floatA[1]);
assertTrue(10. == sample.sendReceiveDouble(10.));
double[] doubleA = new double[] {10., 20.};
doubleA = sample.sendReceiveDouble(doubleA);
assertEquals(2, doubleA.length);
assertTrue(20. == doubleA[0]);
assertTrue(10. == doubleA[1]);
assertTrue(false == sample.sendReceiveBoolean(false));
boolean[] booleanA = new boolean[] {true, false};
booleanA = sample.sendReceiveBoolean(booleanA);
assertEquals(2, booleanA.length);
assertTrue(false == booleanA[0]);
assertTrue(true == booleanA[1]);
assertTrue("a".equals(sample.sendReceiveString("a")));
String[] StringA = new String[] {"a", "b"};
StringA = sample.sendReceiveString(StringA);
assertEquals(2, StringA.length);
assertTrue("b".equals(StringA[0]));
assertTrue("a".equals(StringA[1]));
SampleSerializable ser = new SampleSerializable();
ser.setInt(10);
SampleSerializable ser2 = (SampleSerializable)sample.sendReceiveSerializable(ser);
assertEquals(10, ser2.getInt());
Serializable[] sA = new Serializable[] { ser };
sA = sample.sendReceiveSerializable(sA);
ser2 = (SampleSerializable)sA[0];
assertEquals(10, ser2.getInt());
Remote r = sample.sendReceiveRemote(sample);
Sample sample2 = (Sample) PortableRemoteObject.narrow(r, Sample.class);
assertEquals(sample, sample2);
Remote[] rA = new Remote[] { sample };
rA = sample.sendReceiveRemote(rA);
sample2 = (Sample) PortableRemoteObject.narrow(rA[0], Sample.class);
assertEquals(sample, sample2);
}
// Invoke method with String argument
public void testString() throws RemoteException {
sample.setString("hello");
assertEquals("hello", sample.getString());
}
// Make sure that a field definition for a value-type interface
// gets marshaled correctly. The SampleSerializable object defines a
// List field into which we'll place a Vector object. This should properly
// be processed as a value type rather than an abstract interface.
public void testVector() throws RemoteException {
Vector v = new Vector(10);
v.add("This is a test");
SampleSerializable ser = new SampleSerializable();
ser.setList(v);
SampleSerializable ser2 = (SampleSerializable)sample.sendReceiveSerializable(ser);
Vector v2 = (Vector)ser2.getList();
assertEquals(10, v2.capacity());
assertEquals(1, v2.size());
assertEquals("This is a test", v2.elementAt(0));
}
public void testIntArray() throws RemoteException {
int[] intArray = new int[] {1, 2, 3};
sample.setIntArray(intArray);
int[] intArray2 = sample.getIntArray();
for(int i = 0; i < intArray.length; i++) {
assertEquals(intArray[i], intArray2[i]);
}
}
public void testBasicSerializable() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
}
public void testCmsfv2Data() throws RemoteException {
SampleCmsfv2ChildData d = new SampleCmsfv2ChildData();
for (int i = 0; i < 10; i++) {
System.out.println("Discarding " + d);
d = new SampleCmsfv2ChildData();
}
sample.setSerializable(d);
Serializable s = sample.getSerializable();
assertNotSame(d, s);
assertEquals(d, s);
}
public void testEnum() throws RemoteException {
SampleEnum se = SampleEnum.SAMPLE2;
sample.setSerializable(se);
Serializable s = sample.getSerializable();
assertSame(se, s);
}
public void testEnumArray() throws RemoteException {
SampleEnum[] sa = { SampleEnum.SAMPLE3, SampleEnum.SAMPLE1, SampleEnum.SAMPLE3 };
sample.setSerializable(sa);
Object[] oa = (Object[])sample.getSerializable();
assertTrue(Arrays.deepEquals(sa, oa));
}
public void testData() throws RemoteException {
SampleData sd = new SampleData();
sample.setSerializable(sd);
Serializable s = sample.getSerializable();
assertEquals(sd, s);
}
public void testTimeUnit() throws RemoteException {
TimeUnit tu = TimeUnit.NANOSECONDS;
sample.setSerializable(tu);
Serializable s = sample.getSerializable();
assertSame(tu, s);
}
public void testTimeUnitArray() throws RemoteException {
TimeUnit[] tua = { TimeUnit.NANOSECONDS, TimeUnit.HOURS, TimeUnit.NANOSECONDS };
sample.setSerializable(tua);
Object[] oa = (Object[])sample.getSerializable();
assertTrue(Arrays.deepEquals(tua, oa));
}
public void testRemoteAttributeOnServer() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setRemote(sample);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
Sample sample2 = (Sample) PortableRemoteObject.narrow(ser2.getRemote(), Sample.class);
assertEquals(sample, sample2);
}
public void testRemoteAttributeOnClient() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
SampleRemote sampleRemote = new SampleRemoteImpl();
ser.setRemote(sampleRemote);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleRemote sampleRemote2 =
(SampleRemote) PortableRemoteObject.narrow(ser2.getRemote(), SampleRemote.class);
sampleRemote.setInt(42);
assertEquals(42, sampleRemote2.getInt());
}
public void testComplexRemoteAttributeOnClient() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
SampleRemoteImpl sampleRemote = new SampleRemoteImpl();
ser.setSampleRemote(sampleRemote);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleRemote sampleRemote2 = ser2.getSampleRemote();
sampleRemote.setInt(42);
assertEquals(42, sampleRemote2.getInt());
}
public void testComplexRemoteArgument() throws RemoteException {
SampleRemoteImpl sampleRemote = new SampleRemoteImpl();
sample.setSampleRemote(sampleRemote);
sample.getSampleRemote();
}
public void testSerializableAttribute() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
SampleSerializable attr = new SampleSerializable();
ser.setSerializable(attr);
attr.setInt(42);
sample.setSerializable(ser);
SampleSerializable serCopy = (SampleSerializable) sample.getSerializable();
SampleSerializable attrCopy = (SampleSerializable) serCopy.getSerializable();
assertEquals(attr.getInt(), attrCopy.getInt());
}
public void testSerializableSelfReference() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setSerializableObject(ser);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
assertTrue(ser2 == ser2.getSerializableObject());
}
public void testRemoteObjectAttribute() throws RemoteException {
SampleSerializable ser = new SampleSerializable();
SampleRemoteImpl sampleRemote = new SampleRemoteImpl();
ser.setRemoteObject(sampleRemote);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleRemote sampleRemote2 =
(SampleRemote) PortableRemoteObject.narrow(ser2.getRemoteObject(), SampleRemote.class);
sampleRemote.setInt(42);
assertEquals(42, sampleRemote2.getInt());
}
public void testCorbaAttributeWithHelper(SampleCorba corbaRef) throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setCorbaObj(corbaRef);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleCorba corbaRef2 = SampleCorbaHelper.narrow(ser2.getCorbaObj());
corbaRef.i(42);
assertEquals(42, corbaRef2.i());
corbaRef.s("Don't panic!");
assertEquals("Don't panic!", corbaRef2.s());
}
public void testCorbaAttributeWithPRO(SampleCorba corbaRef) throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setCorbaObj(corbaRef);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleCorba corbaRef2 = (SampleCorba) PortableRemoteObject.narrow(ser2.getCorbaObj(), SampleCorba.class);
corbaRef.i(42);
assertEquals(42, corbaRef2.i());
corbaRef.s("Don't panic!");
assertEquals("Don't panic!", corbaRef2.s());
}
public void testComplexCorbaAttribute(SampleCorba corbaRef) throws RemoteException {
SampleSerializable ser = new SampleSerializable();
ser.setSampleCorba(corbaRef);
sample.setSerializable(ser);
SampleSerializable ser2 = (SampleSerializable) sample.getSerializable();
SampleCorba corbaRef2 = ser2.getSampleCorba();
}
public void testHashMap() throws RemoteException {
HashMap<Integer, Serializable> map = new HashMap<>();
String str = new String("hello");
map.put(0, str);
map.put(1, str);
Integer two = new Integer(2);
map.put(3, two);
map.put(4, two);
sample.setSerializable(map);
Map<?,?> map2 = (Map<?,?>) sample.getSerializable();
assertEquals(map, map2);
assertSame(map2.get(3), map2.get(4));
assertSame(map2.get(0), map2.get(1));
}
public void testClass() throws RemoteException {
final Class<?> type = Object.class;
sample.setSerializable(type);
Serializable s = sample.getSerializable();
assertSame(s, type);
}
public void testClassArray() throws RemoteException {
final Class<?>[] types = { Object.class, Map.class, String.class, Map.class };
sample.setSerializable(types);
Object[] oa = (Object[])sample.getSerializable();
assertArrayEquals(types, oa);
}
}
public static void main(String[] args) throws Exception {
// Initialize ORB
final org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[0], null);
POA rootPoa = (POA) orb.resolve_initial_references("RootPOA");
rootPoa.the_POAManager().activate();
System.out.println("ORB: " + orb.getClass().getName());
// Bind a sample CORBA object
SampleCorba_impl sampleCorba = new SampleCorba_impl();
byte [] id = rootPoa.activate_object(sampleCorba);
org.omg.CORBA.Object sampleCorbaRef = rootPoa.create_reference_with_id(id, sampleCorba._all_interfaces(rootPoa, id)[0]);
// Get IOR to Sample on server
BufferedReader reader = new BufferedReader(new FileReader("Sample.ref"));
String ref = reader.readLine();
org.omg.CORBA.Object sampleRef = orb.string_to_object(ref);
Sample sample = (Sample) PortableRemoteObject.narrow(sampleRef, Sample.class);
// Run RMI tests
Test test = new Test(sample);
test.testVector();
test.testPrimitive();
test.testArray();
test.testString();
test.testIntArray();
test.testBasicSerializable();
test.testRemoteObjectAttribute();
test.testRemoteAttributeOnServer();
test.testRemoteAttributeOnClient();
test.testComplexRemoteAttributeOnClient();
test.testComplexRemoteArgument();
test.testSerializableAttribute();
test.testSerializableSelfReference();
test.testCorbaAttributeWithHelper(SampleCorbaHelper.narrow(sampleCorbaRef));
test.testCorbaAttributeWithPRO((SampleCorba) PortableRemoteObject.narrow(sampleCorbaRef, SampleCorba.class));
test.testComplexCorbaAttribute(SampleCorbaHelper.narrow(sampleCorbaRef));
test.testHashMap();
test.testEnum();
test.testEnumArray();
test.testData();
test.testTimeUnit();
test.testTimeUnitArray();
test.testCmsfv2Data();
test.testClass();
test.testClassArray();
//myORB.destroy();
System.out.println("Testing complete");
}
}
| 5,817 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/Sample.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.rmi;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.HashMap;
public interface Sample extends Remote {
public boolean getBoolean() throws RemoteException;
public void setBoolean(boolean b) throws RemoteException;
public byte getByte() throws RemoteException;
public void setByte(byte b) throws RemoteException;
public short getShort() throws RemoteException;
public void setShort(short s) throws RemoteException;
public int getInt() throws RemoteException;
public void setInt(int i) throws RemoteException;
public long getLong() throws RemoteException;
public void setLong(long l) throws RemoteException;
public float getFloat() throws RemoteException;
public void setFloat(float f) throws RemoteException;
public double getDouble() throws RemoteException;
public void setDouble(double d) throws RemoteException;
public void setChar(char ch) throws RemoteException;
public char getChar() throws RemoteException;
public int[] getIntArray() throws RemoteException;
public void setIntArray(int[] intArray) throws RemoteException;
public String getString() throws RemoteException;
public void setString(String s) throws RemoteException;
public Serializable getSerializable() throws RemoteException;
public void setSerializable(Serializable s) throws RemoteException;
public Remote getRemote() throws RemoteException;
public void setRemote(Remote remote) throws RemoteException;
public SampleRemote getSampleRemote() throws RemoteException;
public void setSampleRemote(SampleRemote sampleRemote) throws RemoteException;
public long sendReceiveLong(long l) throws RemoteException;
public long[] sendReceiveLong(long[] l) throws RemoteException;
public int sendReceiveInt(int l) throws RemoteException;
public int[] sendReceiveInt(int[] l) throws RemoteException;
public short sendReceiveShort(short l) throws RemoteException;
public short[] sendReceiveShort(short[] l) throws RemoteException;
public char sendReceiveChar(char l) throws RemoteException;
public char[] sendReceiveChar(char[] l) throws RemoteException;
public byte sendReceiveByte(byte l) throws RemoteException;
public byte[] sendReceiveByte(byte[] l) throws RemoteException;
public boolean sendReceiveBoolean(boolean l) throws RemoteException;
public boolean [] sendReceiveBoolean(boolean[] l) throws RemoteException;
public String sendReceiveString(String l) throws RemoteException;
public String [] sendReceiveString(String[] l) throws RemoteException;
public float sendReceiveFloat(float l) throws RemoteException;
public float [] sendReceiveFloat(float[] l) throws RemoteException;
public double sendReceiveDouble(double l) throws RemoteException;
public double [] sendReceiveDouble(double[] l) throws RemoteException;
public Remote sendReceiveRemote(Remote l) throws RemoteException;
public Remote [] sendReceiveRemote(Remote[] l) throws RemoteException;
public Serializable sendReceiveSerializable(Serializable l) throws RemoteException;
public Serializable [] sendReceiveSerializable(Serializable[] l) throws RemoteException;
}
| 5,818 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCmsfv2ChildData.java | package test.rmi;
public class SampleCmsfv2ChildData extends SampleCmsfv2ParentData {
private static final long serialVersionUID = 1L;
private final String value = "splat";
@Override
public int hashCode() {
return 31*super.hashCode() + value.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!super.equals(obj))
return false;
if (!(obj instanceof SampleCmsfv2ChildData))
return false;
return value.equals(((SampleCmsfv2ChildData) obj).value);
}
@Override
public String toString() {
return String.format("%s:\"%s\"", super.toString(), value);
}
}
| 5,819 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorbaOperations.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.rmi;
/**
* test/rmi/SampleCorbaOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
public interface SampleCorbaOperations
{
int i ();
void i (int newI);
String s ();
void s (String newS);
} // interface SampleCorbaOperations
| 5,820 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorbaPOA.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.rmi;
/**
* test/rmi/SampleCorbaPOA.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
public abstract class SampleCorbaPOA extends org.omg.PortableServer.Servant
implements test.rmi.SampleCorbaOperations, org.omg.CORBA.portable.InvokeHandler
{
public test.rmi.SampleCorba _this() {
return test.rmi.SampleCorbaHelper.narrow(
super._this_object());
}
public test.rmi.SampleCorba _this(org.omg.CORBA.ORB orb) {
return test.rmi.SampleCorbaHelper.narrow(
super._this_object(orb));
}
public String[] _all_interfaces(
org.omg.PortableServer.POA poa,
byte[] objectId) {
return (String[])__ids.clone();
}
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:test/rmi/SampleCorba:1.0"};
private static java.util.Hashtable _methods = new java.util.Hashtable ();
static
{
_methods.put ("_get_i", new java.lang.Integer (0));
_methods.put ("_set_i", new java.lang.Integer (1));
_methods.put ("_get_s", new java.lang.Integer (2));
_methods.put ("_set_s", new java.lang.Integer (3));
}
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
if (__method == null)
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
switch (__method.intValue ())
{
case 0: // test/rmi/SampleCorba/_get_i
{
int __result = (int)0;
__result = this.i ();
out = $rh.createReply();
out.write_long (__result);
break;
}
case 1: // test/rmi/SampleCorba/_set_i
{
int newI = in.read_long ();
this.i (newI);
out = $rh.createReply();
break;
}
case 2: // test/rmi/SampleCorba/_get_s
{
String __result = null;
__result = this.s ();
out = $rh.createReply();
out.write_string (__result);
break;
}
case 3: // test/rmi/SampleCorba/_set_s
{
String newS = in.read_string ();
this.s (newS);
out = $rh.createReply();
break;
}
default:
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
}
return out;
} // _invoke
} // class _SampleCorbaPOA
| 5,821 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorbaHelper.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.rmi;
/**
* test/rmi/SampleCorbaHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
abstract public class SampleCorbaHelper
{
private static String _id = "IDL:test/rmi/SampleCorba:1.0";
public static void insert (org.omg.CORBA.Any a, test.rmi.SampleCorba that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static test.rmi.SampleCorba extract (org.omg.CORBA.Any a)
{
if (!a.type().equal(type()))
throw new org.omg.CORBA.BAD_OPERATION("extract() failed.Expected a test.rmi.SampleCorba .");
return read (a.create_input_stream ());
}
private static volatile org.omg.CORBA.TypeCode __typeCode = null;
public static org.omg.CORBA.TypeCode type ()
{
org.omg.CORBA.TypeCode __localTc = __typeCode;
if (__localTc == null)
{
__localTc = org.omg.CORBA.ORB.init ().create_interface_tc (test.rmi.SampleCorbaHelper.id (), "SampleCorba");
__typeCode = __localTc;
}
return __localTc;
}
public static String id ()
{
return _id;
}
public static test.rmi.SampleCorba read (org.omg.CORBA.portable.InputStream istream)
{
return narrow (istream.read_Object (_SampleCorbaStub.class));
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, test.rmi.SampleCorba value)
{
ostream.write_Object ((org.omg.CORBA.Object) value);
}
public static test.rmi.SampleCorba narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof test.rmi.SampleCorba)
return (test.rmi.SampleCorba)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
return new test.rmi._SampleCorbaStub (delegate);
}
}
public static test.rmi.SampleCorba unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof test.rmi.SampleCorba)
return (test.rmi.SampleCorba)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
return new test.rmi._SampleCorbaStub (delegate);
}
}
}
| 5,822 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleRemote.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.rmi;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface SampleRemote extends Remote {
public void setInt(int i) throws RemoteException;
public int getInt() throws RemoteException;
}
| 5,823 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorba.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.rmi;
/**
* test/rmi/SampleCorba.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
public interface SampleCorba extends SampleCorbaOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
{
} // interface SampleCorba
| 5,824 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCorbaHolder.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.rmi;
/**
* test/rmi/SampleCorbaHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from SampleCorbaObject.idl
* Tuesday, 28 April 2015 17:10:49 o'clock BST
*/
public final class SampleCorbaHolder implements org.omg.CORBA.portable.Streamable
{
public test.rmi.SampleCorba value = null;
public SampleCorbaHolder ()
{
}
public SampleCorbaHolder (test.rmi.SampleCorba initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = test.rmi.SampleCorbaHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
test.rmi.SampleCorbaHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return test.rmi.SampleCorbaHelper.type ();
}
}
| 5,825 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleRemoteImpl.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.rmi;
import java.rmi.RemoteException;
import javax.rmi.PortableRemoteObject;
public class SampleRemoteImpl extends PortableRemoteObject implements SampleRemote {
protected SampleRemoteImpl() throws RemoteException {
super();
}
private int i;
public void setInt(int i) { this.i = i; }
public int getInt() {return i; }
}
| 5,826 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/ServerMain.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.rmi;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.rmi.RemoteException;
import javax.rmi.PortableRemoteObject;
import javax.rmi.CORBA.Tie;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.CORBA.Policy;
import org.omg.PortableServer.LifespanPolicyValue;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.RequestProcessingPolicyValue;
import org.omg.PortableServer.Servant;
import org.omg.PortableServer.ServantRetentionPolicyValue;
public class ServerMain {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// Initialize ORB
ORB orb = ORB.init(new String[0], null);
System.out.println("ORB: " + orb.getClass().getName());
POA rootPoa = (POA) orb.resolve_initial_references("RootPOA");
// Create a POA
Policy[] tpolicy = new Policy[3];
tpolicy[0] = rootPoa.create_lifespan_policy(
LifespanPolicyValue.TRANSIENT );
tpolicy[1] = rootPoa.create_request_processing_policy(
RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
tpolicy[2] = rootPoa.create_servant_retention_policy(
ServantRetentionPolicyValue.RETAIN);
POA poa = rootPoa.create_POA("SamplePOA", null, tpolicy);
poa.the_POAManager().activate();
// Create a SampleImpl and bind it to the POA
Sample sample = new SampleImpl();
Tie tie = javax.rmi.CORBA.Util.getTie(sample);
byte[] id = poa.activate_object((Servant) tie);
org.omg.CORBA.Object obj = poa.create_reference_with_id(id, ((Servant)tie)._all_interfaces(poa, id)[0]);
// Write a IOR to a file so the client can obtain a reference to the Sample
File sampleRef = new File("Sample.ref");
PrintWriter writer = new PrintWriter(new FileOutputStream(sampleRef));
writer.write(orb.object_to_string(obj));
writer.close();
orb.run();
}
}
| 5,827 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleCmsfv2ParentData.java | package test.rmi;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* A class that writes more data than it reads in.
* This is dangerous since a child class may not know where its own data begins.
* This is addressed in custom marshaled stream format version 2, which boxes the
* parent data so the reading ORB can skip to the end of any custom marshaled
* parent data before reading in the child data.
*/
public class SampleCmsfv2ParentData implements Serializable {
private static final long serialVersionUID = 1L;
private final byte value = (byte) 0xdd;
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
ois.defaultReadObject();
}
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
oos.writeObject(new Object[0]);
oos.writeByte(0x77);
}
@Override
public int hashCode() {
return 31 + value;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof SampleCmsfv2ParentData))
return false;
return (value == ((SampleCmsfv2ParentData) obj).value);
}
@Override
public String toString() {
return String.format("%s:%02x", super.toString(), value);
}
}
| 5,828 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleImpl.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.rmi;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.HashMap;
import javax.rmi.PortableRemoteObject;
public class SampleImpl extends PortableRemoteObject implements
Sample {
public SampleImpl() throws RemoteException {
super();
}
boolean bool = false;
byte b = 0;
short s = 0;
int i = 0;
long l = 0;
float f;
double d;
char ch;
int[] intArray = null;
String str = "";
Serializable serializable = null;
Remote remote;
SampleRemote sampleRemote = null;
public boolean getBoolean() { return bool; }
public void setBoolean(boolean bool) { this.bool = bool; }
public byte getByte() {
return b;
}
public void setByte(byte b) {
this.b = b;
}
public short getShort() {
return s;
}
public void setShort(short s) {
this.s = s;
}
public int getInt() {
return i;
}
public void setInt(int i) {
this.i = i;
}
public long getLong() {
return l;
}
public void setLong(long l) {
this.l = l;
}
public float getFloat() { return f; }
public void setFloat(float f) { this.f = f; }
public double getDouble() { return d; }
public void setDouble(double d) { this.d = d; }
public char getChar() { return ch; }
public void setChar(char ch) { this.ch = ch; }
public int[] getIntArray() {
return intArray;
}
public void setIntArray(int[] intArray) {
this.intArray = intArray;
}
public String getString() {
return str;
}
public void setString(String str) {
this.str = str;
}
public Serializable getSerializable() {return serializable; }
public void setSerializable(Serializable s) {
System.out.println("received: " + s);
if(serializable instanceof SampleSerializable) {
SampleSerializable ser = (SampleSerializable) serializable;
Object o = ser.getRemoteObject();
System.out.println("retrieved remote object: " + o);
}
this.serializable = s;
}
public Remote getRemote() { return remote; }
public void setRemote(Remote remote) { this.remote = remote; }
public SampleRemote getSampleRemote() throws RemoteException {
return sampleRemote;
}
public void setSampleRemote(SampleRemote sampleRemote) throws RemoteException {
this.sampleRemote = sampleRemote;
}
public long sendReceiveLong(long l) {
return l;
}
public long[] sendReceiveLong(long[] l) {
long temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public int sendReceiveInt(int l) {
return l;
}
public int[] sendReceiveInt(int[] l) {
int temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public short sendReceiveShort(short l) {
return l;
}
public short[] sendReceiveShort(short[] l) {
short temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public char sendReceiveChar(char l) {
return l;
}
public char[] sendReceiveChar(char[] l) {
char temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public byte sendReceiveByte(byte l) {
return l;
}
public byte[] sendReceiveByte(byte[] l) {
byte temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public boolean sendReceiveBoolean(boolean l) {
return l;
}
public boolean[] sendReceiveBoolean(boolean[] l) {
boolean temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public String sendReceiveString(String l) {
return l;
}
public String[] sendReceiveString(String[] l) {
String temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public float sendReceiveFloat(float l) {
return l;
}
public float[] sendReceiveFloat(float[] l) {
float temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public double sendReceiveDouble(double l) {
return l;
}
public double[] sendReceiveDouble(double[] l) {
double temp = l[0];
l[0] = l[1];
l[1] = temp;
return l;
}
public Remote sendReceiveRemote(Remote l) {
return l;
}
public Remote[] sendReceiveRemote(Remote[] l) {
return l;
}
public Serializable sendReceiveSerializable(Serializable l) {
return l;
}
public Serializable[] sendReceiveSerializable(Serializable[] l) {
return l;
}
}
| 5,829 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/SampleEnum.java | package test.rmi;
public enum SampleEnum {
SAMPLE1, SAMPLE2, SAMPLE3
}
| 5,830 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/MyRuntimeException.java | package test.rmi.exceptionhandling;
public class MyRuntimeException extends RuntimeException {} | 5,831 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/_Thrower_Stub.java | // Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
package test.rmi.exceptionhandling;
import java.lang.String;
import java.lang.Throwable;
import java.rmi.RemoteException;
import java.rmi.UnexpectedException;
import javax.rmi.CORBA.Stub;
import javax.rmi.CORBA.Util;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.RemarshalException;
import org.omg.CORBA.portable.ServantObject;
public class _Thrower_Stub extends Stub implements Thrower {
private static final String[] _type_ids = {
"RMI:test.rmi.exceptionhandling.Thrower:0000000000000000"
};
public String[] _ids() {
return (String [] ) _type_ids.clone();
}
public void throwAppException() throws RemoteException, MyAppException {
while(true) {
if (!Util.isLocal(this)) {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
try {
OutputStream out = _request("throwAppException", true);
_invoke(out);
return;
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
if (id.equals("IDL:test/rmi/exceptionhandling/MyAppEx:1.0")) {
throw (MyAppException) in.read_value(MyAppException.class);
}
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("throwAppException",test.rmi.exceptionhandling.Thrower.class);
if (so == null) {
continue;
}
try {
((test.rmi.exceptionhandling.Thrower)so.servant).throwAppException();
return;
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
if (exCopy instanceof MyAppException) {
throw (MyAppException)exCopy;
}
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
public void throwRuntimeException() throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
InputStream in = null;
try {
try {
OutputStream out = _request("throwRuntimeException", true);
_invoke(out);
return;
} catch (ApplicationException ex) {
in = ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("throwRuntimeException",test.rmi.exceptionhandling.Thrower.class);
if (so == null) {
continue;
}
try {
((test.rmi.exceptionhandling.Thrower)so.servant).throwRuntimeException();
return;
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
}
| 5,832 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/_ThrowerImpl_Tie.java | // POA Tie class generated by rmic, do not edit.
// Contents subject to change without notice.
package test.rmi.exceptionhandling;
import java.lang.ClassCastException;
import java.lang.String;
import java.lang.Throwable;
import java.rmi.Remote;
import javax.rmi.CORBA.Tie;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
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.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
public class _ThrowerImpl_Tie extends org.omg.PortableServer.Servant implements Tie {
private ThrowerImpl target = null;
private static final String[] _type_ids = {
"RMI:test.rmi.exceptionhandling.Thrower:0000000000000000"
};
public void setTarget(Remote target) {
this.target = (ThrowerImpl) target;
}
public Remote getTarget() {
return target;
}
public Object thisObject() {
return _this_object();
}
public void deactivate() {
try {
_poa().deactivate_object(_poa().servant_to_id(this));
}
catch(WrongPolicy e) { }
catch(ObjectNotActive e) { }
catch(ServantNotActive e) { }
}
public ORB orb() {
return _orb();
}
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 needs an org.omg.CORBA_2_3.ORB");
}
}
public String[] _all_interfaces(POA poa, byte[] objectId) {
return (String [] ) _type_ids.clone();
}
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
try {
org.omg.CORBA_2_3.portable.InputStream in =
(org.omg.CORBA_2_3.portable.InputStream) _in;
switch (method.length()) {
case 17:
if (method.equals("throwAppException")) {
return throwAppException(in, reply);
}
case 21:
if (method.equals("throwRuntimeException")) {
return throwRuntimeException(in, reply);
}
}
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
private OutputStream throwAppException(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
try {
target.throwAppException();
} catch (MyAppException ex) {
String id = "IDL:test/rmi/exceptionhandling/MyAppEx:1.0";
org.omg.CORBA_2_3.portable.OutputStream out =
(org.omg.CORBA_2_3.portable.OutputStream) reply.createExceptionReply();
out.write_string(id);
out.write_value(ex,MyAppException.class);
return out;
}
OutputStream out = reply.createReply();
return out;
}
private OutputStream throwRuntimeException(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
target.throwRuntimeException();
OutputStream out = reply.createReply();
return out;
}
}
| 5,833 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/MyServerRequestInterceptor.java | package test.rmi.exceptionhandling;
import org.omg.CORBA.LocalObject;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.ORBInitInfo;
import org.omg.PortableInterceptor.ORBInitializer;
import org.omg.PortableInterceptor.ServerRequestInfo;
import org.omg.PortableInterceptor.ServerRequestInterceptor;
import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
public class MyServerRequestInterceptor extends LocalObject implements ServerRequestInterceptor, ORBInitializer {
@Override
public void receive_request(ServerRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("receive_request(" + arg0.operation() + ")");
}
@Override
public void receive_request_service_contexts(ServerRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("receive_request_service_contexts(" + arg0.operation() + ")");
}
@Override
public void send_exception(ServerRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("send_exception(" + arg0.operation() + ")");
}
@Override
public void send_other(ServerRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("send_other(" + arg0.operation() + ")");
}
@Override
public void send_reply(ServerRequestInfo arg0) {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("send_reply(" + arg0.operation() + ")");
}
@Override
public void destroy() {
}
@Override
public String name() {
return this.getClass().getName();
}
@Override
public void post_init(ORBInitInfo arg0) {
try {
arg0.add_server_request_interceptor(this);
} catch (DuplicateName e) {
throw new Error(e);
}
}
@Override
public void pre_init(ORBInitInfo arg0) {
}
}
| 5,834 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/Thrower.java | package test.rmi.exceptionhandling;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Thrower extends Remote {
void throwAppException() throws RemoteException, MyAppException;
void throwRuntimeException() throws RemoteException;
} | 5,835 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/MyClientRequestInterceptor.java | package test.rmi.exceptionhandling;
import org.omg.CORBA.LocalObject;
import org.omg.PortableInterceptor.ClientRequestInfo;
import org.omg.PortableInterceptor.ClientRequestInterceptor;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.ORBInitInfo;
import org.omg.PortableInterceptor.ORBInitializer;
import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
public class MyClientRequestInterceptor extends LocalObject implements ClientRequestInterceptor, ORBInitializer {
@Override
public void receive_exception(ClientRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("receive_exception(" + arg0.operation() + ")");
}
@Override
public void receive_other(ClientRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("receive_other(" + arg0.operation() + ")");
}
@Override
public void receive_reply(ClientRequestInfo arg0) {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("receive_reply(" + arg0.operation() + ")");
}
@Override
public void send_poll(ClientRequestInfo arg0) {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("send_poll(" + arg0.operation() + ")");
}
@Override
public void send_request(ClientRequestInfo arg0) throws ForwardRequest {
System.out.printf("%08x: ", Thread.currentThread().getId());
System.out.println("send_request(" + arg0.operation() + ")");
}
@Override
public void destroy() {
}
@Override
public String name() {
return this.getClass().getName();
}
@Override
public void post_init(ORBInitInfo arg0) {
try {
arg0.add_client_request_interceptor(this);
} catch (DuplicateName e) {
throw new Error(e);
}
}
@Override
public void pre_init(ORBInitInfo arg0) {
}
} | 5,836 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/MyAppException.java | package test.rmi.exceptionhandling;
public class MyAppException extends Exception {} | 5,837 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/rmi/exceptionhandling/ThrowerImpl.java | package test.rmi.exceptionhandling;
import java.rmi.RemoteException;
import org.omg.CORBA.ORB;
public class ThrowerImpl implements Thrower {
public static MyRuntimeException myRuntimeException;
public static MyAppException myAppException;
final ORB orb;
public ThrowerImpl(ORB orb) {
this.orb = orb;
}
@Override
public void throwAppException() throws RemoteException, MyAppException {
throw myAppException;
}
@Override
public void throwRuntimeException() throws RemoteException {
throw myRuntimeException;
}
} | 5,838 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/_TestCodeSetsStub.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.codesets;
//
// IDL:TestCodeSets:1.0
//
public class _TestCodeSetsStub extends org.omg.CORBA.portable.ObjectImpl
implements TestCodeSets
{
private static final String[] _ob_ids_ =
{
"IDL:TestCodeSets:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = TestCodeSetsOperations.class;
//
// IDL:TestCodeSets/testChar:1.0
//
public char
testChar(char _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("testChar", true);
out.write_char(_ob_a0);
in = _invoke(out);
char _ob_r = in.read_char();
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("testChar", _ob_opsClass);
if(_ob_so == null)
continue;
TestCodeSetsOperations _ob_self = (TestCodeSetsOperations)_ob_so.servant;
try
{
return _ob_self.testChar(_ob_a0);
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:TestCodeSets/testString:1.0
//
public String
testString(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("testString", true);
out.write_string(_ob_a0);
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("testString", _ob_opsClass);
if(_ob_so == null)
continue;
TestCodeSetsOperations _ob_self = (TestCodeSetsOperations)_ob_so.servant;
try
{
return _ob_self.testString(_ob_a0);
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:TestCodeSets/testWChar:1.0
//
public char
testWChar(char _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("testWChar", true);
out.write_wchar(_ob_a0);
in = _invoke(out);
char _ob_r = in.read_wchar();
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("testWChar", _ob_opsClass);
if(_ob_so == null)
continue;
TestCodeSetsOperations _ob_self = (TestCodeSetsOperations)_ob_so.servant;
try
{
return _ob_self.testWChar(_ob_a0);
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:TestCodeSets/testWString:1.0
//
public String
testWString(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("testWString", true);
out.write_wstring(_ob_a0);
in = _invoke(out);
String _ob_r = in.read_wstring();
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("testWString", _ob_opsClass);
if(_ob_so == null)
continue;
TestCodeSetsOperations _ob_self = (TestCodeSetsOperations)_ob_so.servant;
try
{
return _ob_self.testWString(_ob_a0);
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:TestCodeSets/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;
TestCodeSetsOperations _ob_self = (TestCodeSetsOperations)_ob_so.servant;
try
{
_ob_self.deactivate();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,839 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/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.codesets;
import java.io.File;
import java.util.Properties;
import org.omg.CORBA.*;
final public class Client {
public static int run(ORB orb, String[] args)
throws org.omg.CORBA.UserException {
org.omg.CORBA.Object obj = orb
.string_to_object("relfile:TestCodeSets.ref");
if (obj == null) {
System.out.println("Can't read IOR from TestCodeSets.ref");
return 0;
}
TestCodeSets p = TestCodeSetsHelper.narrow(obj);
org.apache.yoko.orb.OB.Assert._OB_assert(p != null);
{
char wc, wcRet;
wc = 'a';
wcRet = p.testWChar(wc);
org.apache.yoko.orb.OB.Assert._OB_assert(wc == wcRet);
wc = (char) 0x1234;
wcRet = p.testWChar(wc);
org.apache.yoko.orb.OB.Assert._OB_assert(wc == wcRet);
}
{
String ws, wsRet;
ws = "Hello, World!";
wsRet = p.testWString(ws);
org.apache.yoko.orb.OB.Assert._OB_assert(ws.equals(wsRet));
}
p.deactivate();
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,840 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSetsPOATie.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.codesets;
//
// IDL:TestCodeSets:1.0
//
public class TestCodeSetsPOATie extends TestCodeSetsPOA
{
private TestCodeSetsOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
TestCodeSetsPOATie(TestCodeSetsOperations delegate)
{
_ob_delegate_ = delegate;
}
public
TestCodeSetsPOATie(TestCodeSetsOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public TestCodeSetsOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(TestCodeSetsOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:TestCodeSets/testChar:1.0
//
public char
testChar(char c)
{
return _ob_delegate_.testChar(c);
}
//
// IDL:TestCodeSets/testString:1.0
//
public String
testString(String s)
{
return _ob_delegate_.testString(s);
}
//
// IDL:TestCodeSets/testWChar:1.0
//
public char
testWChar(char wc)
{
return _ob_delegate_.testWChar(wc);
}
//
// IDL:TestCodeSets/testWString:1.0
//
public String
testWString(String ws)
{
return _ob_delegate_.testWString(ws);
}
//
// IDL:TestCodeSets/deactivate:1.0
//
public void
deactivate()
{
_ob_delegate_.deactivate();
}
}
| 5,841 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSetsPOA.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.codesets;
//
// IDL:TestCodeSets:1.0
//
public abstract class TestCodeSetsPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
TestCodeSetsOperations
{
static final String[] _ob_ids_ =
{
"IDL:TestCodeSets:1.0",
};
public TestCodeSets
_this()
{
return TestCodeSetsHelper.narrow(super._this_object());
}
public TestCodeSets
_this(org.omg.CORBA.ORB orb)
{
return TestCodeSetsHelper.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",
"testChar",
"testString",
"testWChar",
"testWString"
};
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: // testChar
return _OB_op_testChar(in, handler);
case 2: // testString
return _OB_op_testString(in, handler);
case 3: // testWChar
return _OB_op_testWChar(in, handler);
case 4: // testWString
return _OB_op_testWString(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_testChar(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
char _ob_a0 = in.read_char();
char _ob_r = testChar(_ob_a0);
out = handler.createReply();
out.write_char(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_testString(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();
String _ob_r = testString(_ob_a0);
out = handler.createReply();
out.write_string(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_testWChar(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
char _ob_a0 = in.read_wchar();
char _ob_r = testWChar(_ob_a0);
out = handler.createReply();
out.write_wchar(_ob_r);
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_testWString(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
String _ob_a0 = in.read_wstring();
String _ob_r = testWString(_ob_a0);
out = handler.createReply();
out.write_wstring(_ob_r);
return out;
}
}
| 5,842 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSets.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.codesets;
//
// IDL:TestCodeSets:1.0
//
/***/
public interface TestCodeSets extends TestCodeSetsOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,843 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSetsHolder.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.codesets;
//
// IDL:TestCodeSets:1.0
//
final public class TestCodeSetsHolder implements org.omg.CORBA.portable.Streamable
{
public TestCodeSets value;
public
TestCodeSetsHolder()
{
}
public
TestCodeSetsHolder(TestCodeSets initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = TestCodeSetsHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
TestCodeSetsHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return TestCodeSetsHelper.type();
}
}
| 5,844 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSetsHelper.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.codesets;
//
// IDL:TestCodeSets:1.0
//
final public class TestCodeSetsHelper
{
public static void
insert(org.omg.CORBA.Any any, TestCodeSets val)
{
any.insert_Object(val, type());
}
public static TestCodeSets
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(), "TestCodeSets");
}
return typeCode_;
}
public static String
id()
{
return "IDL:TestCodeSets:1.0";
}
public static TestCodeSets
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (TestCodeSets)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_TestCodeSetsStub _ob_stub = new _TestCodeSetsStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, TestCodeSets val)
{
out.write_Object(val);
}
public static TestCodeSets
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (TestCodeSets)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestCodeSetsStub _ob_stub = new _TestCodeSetsStub();
_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 TestCodeSets
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (TestCodeSets)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_TestCodeSetsStub _ob_stub = new _TestCodeSetsStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,845 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/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.codesets;
import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import java.io.*;
final 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"));
//
// Activate the POA manager
//
POAManager manager = poa.the_POAManager();
manager.activate();
//
// Create implementation object
//
TestCodeSets_impl i = new TestCodeSets_impl(orb);
TestCodeSets testCodeSets = i._this(orb);
//
// 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.
//
String s = orb.object_to_string(testCodeSets);
String refFile = "TestCodeSets.ref";
try {
String ref = orb.object_to_string(testCodeSets);
FileOutputStream file = new FileOutputStream(refFile);
PrintWriter out = new PrintWriter(file);
out.println(ref);
out.flush();
file.close();
} catch (IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
return 1;
}
//
// Give up control to the ORB
//
orb.run();
File file = new File(refFile);
file.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,846 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSets_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.codesets;
class TestCodeSets_impl extends TestCodeSetsPOA {
private org.omg.CORBA.ORB orb_;
TestCodeSets_impl(org.omg.CORBA.ORB orb) {
orb_ = orb;
}
public char testChar(char c) {
return c;
}
public String testString(String s) {
return s;
}
public char testWChar(char wc) {
return wc;
}
public String testWString(String ws) {
return ws;
}
public void deactivate() {
orb_.shutdown(false);
}
}
| 5,847 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/codesets/TestCodeSetsOperations.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.codesets;
//
// IDL:TestCodeSets:1.0
//
/***/
public interface TestCodeSetsOperations
{
//
// IDL:TestCodeSets/testChar:1.0
//
/***/
char
testChar(char c);
//
// IDL:TestCodeSets/testString:1.0
//
/***/
String
testString(String s);
//
// IDL:TestCodeSets/testWChar:1.0
//
/***/
char
testWChar(char wc);
//
// IDL:TestCodeSets/testWString:1.0
//
/***/
String
testWString(String ws);
//
// IDL:TestCodeSets/deactivate:1.0
//
/***/
void
deactivate();
}
| 5,848 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/BounceableImpl.java | package test.fvd;
import static test.fvd.Sets.format;
import static test.fvd.Sets.union;
import java.io.ObjectStreamField;
import java.lang.reflect.Field;
import java.util.Objects;
import java.util.Set;
import org.junit.Assert;
class NonSerializableSuper {
final boolean isLocal;
NonSerializableSuper() { // invoked by serialization
isLocal = false;
}
NonSerializableSuper(String name) {
isLocal = true;
}
}
public class BounceableImpl extends NonSerializableSuper implements Bounceable {
private static final long serialVersionUID = 1L;
// this is the magic that makes this class marshal differently according to FieldMarshal Config
private static final ObjectStreamField[] serialPersistentFields = Marshalling.computeSerialPersistentFields(BounceableImpl.class);
private final Marshalling senderConfig = Marshalling.getCurrent();
public BounceableImpl() {
super(null); // avoid using the no-args parent constructor
}
private String a = "AAA";
@Marshalling.SkipInDefaultVersion
private transient String b = "BBB";
@Marshalling.SkipInVersion1
private String c = "CCC";
@Marshalling.SkipInVersion2
private String d = "DDD";
private String e = "EEE";
public static void main(String[] args) {
System.out.println("success!");
}
@Override
public Bounceable validateAndReplace() {
System.out.println("Received from config " + senderConfig + " into " + Marshalling.getCurrent());
Assert.assertEquals(createModelInstance(), this);
return new BounceableImpl();
}
private BounceableImpl createModelInstance() throws Error {
BounceableImpl expected = new BounceableImpl();
if (isLocal)
return expected;
try {
Set<Field> unread = Marshalling.getCurrent().getSkippedFields(expected);
Set<Field> unsent = senderConfig.getSkippedFields(expected);
System.out.printf("Creating model instance:%nunsent fields: %s%nunread fields: %s%n", format(unsent), format(unread));
for (Field f : union(unread, unsent))
f.set(expected, null);
} catch (IllegalAccessException e) {
throw new Error(e);
}
return expected;
}
@Override
public String toString() {
return String.format("[%s|%s|%s|%s|%s]", a, b, c, d, e);
}
@Override
public int hashCode() {
return Objects.hash(a, b, c, d, e);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof BounceableImpl))
return false;
BounceableImpl that = (BounceableImpl) obj;
return Objects.equals(this.a, that.a)
&& Objects.equals(this.b, that.b)
&& Objects.equals(this.c, that.c)
&& Objects.equals(this.d, that.d)
&& Objects.equals(this.e, that.e);
}
}
| 5,849 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Sets.java | package test.fvd;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
public enum Sets {
;
static <T> Set<T> union(Set<T> left, Set<T> right) {
HashSet<T> result = new HashSet<>(left);
result.addAll(right);
return result;
}
static <T> Set<T> intersection(Set<T> left, Set<T> right) {
HashSet<T> result = new HashSet<>(left);
result.retainAll(right);
return result;
}
static <T> Set<T> difference(Set<T> minuend, Set<T> subtrahend) {
HashSet<T> result = new HashSet<>(minuend);
result.removeAll(subtrahend);
return result;
}
static String format(Set<Field> fields) {
String result = "{";
for (Field field : fields)
result += (result.length() == 1 ? "" : ",") + field.getName();
return result + "}";
}
}
| 5,850 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/MissingFieldsClient.java | package test.fvd;
import java.io.BufferedReader;
import java.io.IOException;
import org.omg.CORBA.ORB;
import test.common.TestBase;
public class MissingFieldsClient extends TestBase {
private static final ApeClassLoader apeLoader = new ApeClassLoader().doNotLoad();
public static void main(String...args) throws Exception {
if (apeLoader.apeMain(args))
return;
////////////////////// CODE BELOW HERE EXECUTES IN APE LOADER ONLY //////////////////////
final String refFile = args[0];
Marshalling.valueOf(args[1]).select(); // client version
Marshalling.valueOf(args[2]); // server version
ORB orb = ORB.init(args, null);
try (BufferedReader file = openFileReader(refFile)) {
Bouncer bouncer = readRmiStub(orb, file, Bouncer.class);
try {
Bounceable bounceable = new BounceableImpl().validateAndReplace();
Bounceable returned = (Bounceable) bouncer.bounceObject(bounceable);
returned.validateAndReplace();
} finally {
bouncer.shutdown();
}
} finally {
orb.shutdown(true);
orb.destroy();
}
}
}
| 5,851 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Abstract.java | package test.fvd;
import java.io.Serializable;
public interface Abstract extends Serializable {
}
| 5,852 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/ApeClassLoader.java | package test.fvd;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLClassLoader;
import java.util.HashSet;
import java.util.Set;
public final class ApeClassLoader extends URLClassLoader {
private final Set<String> skipClassNames = new HashSet<>();
public ApeClassLoader() {
super(((URLClassLoader)ApeClassLoader.class.getClassLoader()).getURLs(),
ApeClassLoader.class.getClassLoader().getParent());
}
public ApeClassLoader doNotLoad(Class<?>... types) {
for (Class<?> type : types)
skipClassNames.add(type.getName());
return this;
}
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (skipClassNames.contains(name))
throw new ClassNotFoundException(name);
return super.findClass(name);
}
public boolean apeMain(String...args) {
if (alreadyAped()) {
System.out.println("invoked from an already aped main() in target loader " + this.getClass().getClassLoader());
return false;
}
System.out.println("aping call to main() from class loader " + this.getClass().getClassLoader());
invokeApedMain(args);
return true;
}
private static boolean alreadyAped() {
String expectedLoader = ApeClassLoader.class.getName();
String actualLoader = ApeClassLoader.class.getClassLoader().getClass().getName();
return expectedLoader.equals(actualLoader);
}
private void invokeApedMain(String...args) {
final String className = getCallerClassName();
final ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this);
try {
Class<?> targetClass = Class.forName(className, true, this);
Method m = targetClass.getMethod("main", String[].class);
// m.invoke(null, (Object[])args); // BAD
m.invoke(null, (Object)args); // GOOD
} catch (ClassNotFoundException e) {
throw new Error("Failed to load mirrored class " + className, e);
} catch (NoSuchMethodException | SecurityException e) {
throw new Error("Failed to get method main(String[]) for mirrored class " + className, e);
} catch (IllegalAccessException | IllegalArgumentException e) {
throw new Error("Failed to invoke method main(String[]) for mirrored class" + className, e);
} catch (InvocationTargetException e) {
rethrow(e.getTargetException());
throw new AssertionError("This code should be unreachable");
} finally {
Thread.currentThread().setContextClassLoader(oldTCCL);
}
}
private static void rethrow(Throwable t) throws RuntimeException {
ApeClassLoader.<RuntimeException>useTypeErasureMadnessToThrowAnyCheckedException(t);
}
@SuppressWarnings("unchecked")
private static <T extends Throwable> void useTypeErasureMadnessToThrowAnyCheckedException(Throwable t) throws T {
throw (T)t;
}
private static String getCallerClassName() {
StackTraceElement[] frames = new Throwable().getStackTrace();
int i = 0;
// find this class in the stack
while (!!!frames[i].getClassName().equals(ApeClassLoader.class.getName())) i++;
// find the next class down in the stack
while (frames[i].getClassName().equals(ApeClassLoader.class.getName())) i++;
return frames[i].getClassName();
}
} | 5,853 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/_Bouncer_Stub.java | // Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
package test.fvd;
import java.io.Serializable;
import java.lang.Object;
import java.lang.String;
import java.lang.Throwable;
import java.rmi.RemoteException;
import java.rmi.UnexpectedException;
import javax.rmi.CORBA.Stub;
import javax.rmi.CORBA.Util;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.portable.ApplicationException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.RemarshalException;
import org.omg.CORBA.portable.ServantObject;
public class _Bouncer_Stub extends Stub implements Bouncer {
private static final String[] _type_ids = {
"RMI:test.fvd.Bouncer:0000000000000000"
};
public String[] _ids() {
return (String [] ) _type_ids.clone();
}
public Abstract bounceAbstract(Abstract arg0) throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
try {
OutputStream out = _request("bounceAbstract", true);
Util.writeAbstractObject(out,arg0);
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
return (Abstract) in.read_abstract_interface(Abstract.class);
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("bounceAbstract",test.fvd.Bouncer.class);
if (so == null) {
continue;
}
try {
Abstract arg0Copy = (Abstract) Util.copyObject(arg0,_orb());
Abstract result = ((test.fvd.Bouncer)so.servant).bounceAbstract(arg0Copy);
return (Abstract)Util.copyObject(result,_orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
public Object bounceObject(Object arg0) throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
InputStream in = null;
try {
try {
OutputStream out = _request("bounceObject", true);
Util.writeAny(out,arg0);
in = _invoke(out);
return Util.readAny(in);
} catch (ApplicationException ex) {
in = ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("bounceObject",test.fvd.Bouncer.class);
if (so == null) {
continue;
}
try {
Object arg0Copy = (Object) Util.copyObject(arg0,_orb());
Object result = ((test.fvd.Bouncer)so.servant).bounceObject(arg0Copy);
return (Object)Util.copyObject(result,_orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
public Serializable bounceSerializable(Serializable arg0) throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
InputStream in = null;
try {
try {
OutputStream out = _request("bounceSerializable", true);
Util.writeAny(out,arg0);
in = _invoke(out);
return (Serializable) Util.readAny(in);
} catch (ApplicationException ex) {
in = ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("bounceSerializable",test.fvd.Bouncer.class);
if (so == null) {
continue;
}
try {
Serializable arg0Copy = (Serializable) Util.copyObject(arg0,_orb());
Serializable result = ((test.fvd.Bouncer)so.servant).bounceSerializable(arg0Copy);
return (Serializable)Util.copyObject(result,_orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
public Value bounceValue(Value arg0) throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
try {
org.omg.CORBA_2_3.portable.OutputStream out =
(org.omg.CORBA_2_3.portable.OutputStream)
_request("bounceValue", true);
out.write_value((Serializable)arg0,Value.class);
in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out);
return (Value) in.read_value(Value.class);
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("bounceValue",test.fvd.Bouncer.class);
if (so == null) {
continue;
}
try {
Value arg0Copy = (Value) Util.copyObject(arg0,_orb());
Value result = ((test.fvd.Bouncer)so.servant).bounceValue(arg0Copy);
return (Value)Util.copyObject(result,_orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
public void shutdown() throws RemoteException {
while(true) {
if (!Util.isLocal(this)) {
InputStream in = null;
try {
try {
OutputStream out = _request("shutdown", true);
_invoke(out);
return;
} catch (ApplicationException ex) {
in = ex.getInputStream();
String id = in.read_string();
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
_releaseReply(in);
}
} else {
ServantObject so = _servant_preinvoke("shutdown",test.fvd.Bouncer.class);
if (so == null) {
continue;
}
try {
((test.fvd.Bouncer)so.servant).shutdown();
return;
} catch (Throwable ex) {
Throwable exCopy = (Throwable)Util.copyObject(ex,_orb());
throw Util.wrapException(exCopy);
} finally {
_servant_postinvoke(so);
}
}
}
}
}
| 5,854 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Bounceable.java | package test.fvd;
public interface Bounceable extends Abstract, Value {
Bounceable validateAndReplace();
}
| 5,855 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Bouncer.java | package test.fvd;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Bouncer extends Remote {
Abstract bounceAbstract(Abstract obj) throws RemoteException;
Object bounceObject(Object obj) throws RemoteException;
Serializable bounceSerializable(Serializable obj) throws RemoteException;
Value bounceValue(Value obj) throws RemoteException;
void shutdown() throws RemoteException;
}
| 5,856 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/BouncerImpl.java | package test.fvd;
import java.io.Serializable;
import org.omg.CORBA.ORB;
public class BouncerImpl implements Bouncer {
final ORB orb;
public BouncerImpl(ORB orb) {
this.orb = orb;
}
@Override
public Abstract bounceAbstract(Abstract obj) {
return ((Bounceable)obj).validateAndReplace();
}
@Override
public Object bounceObject(Object obj) {
return ((Bounceable)obj).validateAndReplace();
}
@Override
public Serializable bounceSerializable(Serializable obj) {
return ((Bounceable)obj).validateAndReplace();
}
@Override
public Value bounceValue(Value obj){
return ((Bounceable)obj).validateAndReplace();
}
public void shutdown() {
orb.shutdown(false);
}
}
| 5,857 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Value.java | package test.fvd;
import java.io.Serializable;
public interface Value extends Serializable {
String toString();
}
| 5,858 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/MissingFieldsServer.java | package test.fvd;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Paths;
import org.omg.CORBA.ORB;
import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import test.common.TestBase;
public class MissingFieldsServer extends TestBase {
static final String CLASS_NAME = new Object(){}.getClass().getEnclosingClass().getName();
private static final ApeClassLoader apeLoader = new ApeClassLoader().doNotLoad();
public static void main(String...args) {
if (apeLoader.apeMain(args)) return;
////////////////////// CODE BELOW HERE EXECUTES IN APE LOADER ONLY //////////////////////
final String refFile = args[0];
Marshalling.valueOf(args[1]); // client version
Marshalling.valueOf(args[2]).select(); // server version
ORB orb = ORB.init(args, null);
System.out.println(CLASS_NAME + " opening file for writing: " + Paths.get(refFile).toAbsolutePath());
try (PrintWriter out = new PrintWriter(new FileWriter(refFile))) {
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootPOA.the_POAManager().activate();
////// create a Bouncer object and write out the IOR //////
BouncerImpl bouncer = new BouncerImpl(orb);
_BouncerImpl_Tie tie = new _BouncerImpl_Tie();
tie.setTarget(bouncer);
rootPOA.activate_object(tie);
writeRef(orb, out, tie.thisObject());
out.flush();
} catch (IOException | InvalidName | AdapterInactive | ServantAlreadyActive | WrongPolicy e) {
e.printStackTrace();
}
System.out.println("Running the orb");
orb.run();
System.out.println("Destroying the orb");
orb.destroy();
}
}
| 5,859 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/MissingFields.java | package test.fvd;
import static test.fvd.Marshalling.VERSION1;
import static test.fvd.Marshalling.VERSION2;
import java.io.File;
import org.apache.yoko.AbstractOrbTestBase;
public class MissingFields {
public static void main(String[] args) throws Exception {
final String fileName = "bouncer.ref";
final String[] serverArgs = { fileName, VERSION1.name(), VERSION2.name() };
final String[] clientArgs = serverArgs;
new Thread() {
@Override
public void run() {
MissingFieldsServer.main(serverArgs);
}
}.start();
AbstractOrbTestBase.waitFor(new File(fileName), 20000);
Thread.sleep(2000);
MissingFieldsClient.main(clientArgs);
}
}
| 5,860 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/Marshalling.java | package test.fvd;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static test.fvd.Sets.difference;
import static test.fvd.Sets.format;
import static test.fvd.Sets.intersection;
import java.io.ObjectStreamField;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Assert;
public enum Marshalling {
DEFAULT_VERSION(SkipInDefaultVersion.class),
VERSION1(SkipInVersion1.class),
VERSION2(SkipInVersion2.class);
private static final AtomicReference<Marshalling> IN_USE = new AtomicReference<>();
private static final Set<Class<? extends Annotation>> VALID_ANNOTATIONS;
static {
HashSet<Class<? extends Annotation>> set = new HashSet<>();
for (Marshalling mc : Marshalling.values())
set.add(mc.skipAnnotationType);
VALID_ANNOTATIONS = Collections.unmodifiableSet(set);
}
private final Class<? extends Annotation> skipAnnotationType;
private Marshalling(Class<? extends Annotation> annotationType) {
this.skipAnnotationType = annotationType;
}
public Marshalling select() {
if (IN_USE.compareAndSet(null, this)) return this;
Assert.fail("Attempt to select MarshallingConfiguration " + this + " when " + IN_USE.get() + " was already selected");
throw new Error("Unreachable code");
}
static Marshalling getCurrent() {
Marshalling current = IN_USE.get();
Assert.assertNotNull("A " + Marshalling.class.getSimpleName() + " setting should have been selected.", current);
return current;
}
public static ObjectStreamField[] computeSerialPersistentFields(Class<?> type) {
validate(type);
// check what type of marshalling is configured
Marshalling currentConfig = getCurrent();
System.out.println(currentConfig + " marshalling selected");
if (currentConfig == DEFAULT_VERSION) {
System.out.println("Using null for serialPersistentFields for type: " + type);
// we can coerce default serialization semantics by making the serialPersistentFields null
return null;
}
System.out.println("Constructing serialPersistentFields for type: " + type);
// build an ordered set of object stream fields
SortedSet<ObjectStreamField> result = new TreeSet<>(SerializationOrdering.INSTANCE);
for(Field f : type.getDeclaredFields()) {
if (Modifier.isStatic(f.getModifiers()) ||
getAllAnnoTypes(f).contains(currentConfig.skipAnnotationType)) {
System.out.println("Excluding field from serialPersistentFields: " + f);
} else {
System.out.println("Adding field to serialPersistentFields: "+ f);
result.add(new ObjectStreamField(f.getName(), f.getType()));
}
}
return result.toArray(new ObjectStreamField[result.size()]);
}
private static Set<Class<? extends Annotation>> getAllAnnoTypes(Field f) {
HashSet<Class<? extends Annotation>> result = new HashSet<>();
for (Annotation a : f.getAnnotations()) result.add(a.annotationType());
System.out.println("anno types for field " + f + " = " + result);
return result;
}
private static Set<Class<? extends Annotation>> getSkipAnnoTypes(Field f) {
Set<Class<? extends Annotation>> result = getAllAnnoTypes(f);
result.retainAll(VALID_ANNOTATIONS);
return result;
}
private static void validate(Class<?> type) {
Map<?, Set<Field>> fieldsByAnnoType = createAnnoTypeMap();
checkForSerialPersistentFieldsField(type);
Set<Field> nonStaticFields = getValidatedFields(type);
for (Field f : nonStaticFields) {
// find the relevant annotations for this field
Set<?> annoTypes = getSkipAnnoTypes(f);
for (Object annoType : annoTypes)
fieldsByAnnoType.get(annoType).add(f);
boolean isTransient = Modifier.isTransient(f.getModifiers());
System.out.printf("Examining field %s: isTransient=%b anno types=%s%n", f, isTransient, annoTypes);
// validate all and only default persisted fields have @Default
Assert.assertEquals("@Marshalling.SkipInDefault should be used iff the field is transient", isTransient, annoTypes.contains(SkipInDefaultVersion.class));
// validate all and only non-static fields should have at least one of the VALID_ANNOTATIONS
Assert.assertNotEquals("No field should have all the Skip annotations", VALID_ANNOTATIONS, annoTypes);
}
checkForCommonFields(nonStaticFields, fieldsByAnnoType);
checkForSkippedFields(fieldsByAnnoType);
}
private static Set<Field> getValidatedFields(Class<?> type) {
Set<Field> result = new HashSet<>();
for (Field f : type.getDeclaredFields()) {
if (Modifier.isStatic(f.getModifiers())) {
Assert.assertTrue("Static fields should not have any Skip... annotations", getSkipAnnoTypes(f).isEmpty());
continue;
}
result.add(f);
}
// check there are some persistent fields
for (Field f : result) {
if (!!!Modifier.isTransient(f.getModifiers()))
return result; // found at least one persistent field!
}
Assert.fail("The class " + type + " should declare some non-transient, non-static fields");
throw new Error("Unreachable code!");
}
private static void checkForSerialPersistentFieldsField(Class<?> type) {
// first and foremost - the class must declare serialPersistentFields
try {
Field spff = type.getDeclaredField("serialPersistentFields");
// field must be private (probably)
Assert.assertTrue(spff + " should be private", Modifier.isPrivate(spff.getModifiers()));
// field must be static
Assert.assertTrue(spff + " should be static", Modifier.isStatic(spff.getModifiers()));
// field must be final
Assert.assertTrue(spff + " should be final", Modifier.isFinal(spff.getModifiers()));
// field must be of type ObjectStreamField[]
Assert.assertEquals(spff + " should be of type ObjectStreamField[]", ObjectStreamField[].class, spff.getType());
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
Assert.fail("Class " + type + " must declare serialPersistentFields");
}
}
private static void checkForCommonFields(Set<Field> allFields, Map<?, Set<Field>> fieldsByAnnoType) {
// compare each combination of two configs
Queue<Marshalling> configs = new LinkedList<>(Arrays.asList(Marshalling.values()));
do {
Marshalling leftConfig = configs.remove();
Set<Field> leftFields = difference(allFields, fieldsByAnnoType.get(leftConfig.skipAnnotationType));
for (Marshalling rightConfig: configs) {
Set<Field> rightFields = difference(allFields, fieldsByAnnoType.get(rightConfig.skipAnnotationType));
Set<Field> commonFields = intersection(leftFields, rightFields);
System.out.printf("When communicating between %s and %s, the common fields are %s%n", leftConfig, rightConfig, format(commonFields));
Assert.assertNotEquals("There should be some common fields between versions " + leftConfig + " and " + rightConfig , Collections.emptySet(), commonFields);
}
} while(!!!configs.isEmpty());
}
private static void checkForSkippedFields(Map<?, Set<Field>> fieldsByAnnoType) {
// compare each permutation of two configs
for (Marshalling sender : Marshalling.values()) {
Set<Field> unsentFields = fieldsByAnnoType.get(sender.skipAnnotationType);
for (Marshalling receiver : Marshalling.values()) {
if (sender == receiver)
continue;
Set<Field> skippedFields = difference(fieldsByAnnoType.get(receiver.skipAnnotationType), unsentFields);
System.out.printf("When %s transmits to %s, the skipped fields are %s%n", sender, receiver, format(skippedFields));
Assert.assertNotEquals("There should be some skipped fields when " + sender + " sends to " + receiver,
Collections.emptySet(), skippedFields);
}
}
}
private static Map<Class<? extends Annotation>, Set<Field>> createAnnoTypeMap() {
Map<Class<? extends Annotation>, Set<Field>> fieldsByAnnotationType = new HashMap<>();
// fill the map with empty sets for each annotation we are considering
for (Class<? extends Annotation> annotationType : VALID_ANNOTATIONS)
fieldsByAnnotationType.put(annotationType, new HashSet<Field>());
return fieldsByAnnotationType;
}
public Set<Field> getSkippedFields(Object expected) {
Set<Field> result = new HashSet<>();
for (Field f: getValidatedFields(expected.getClass()))
if (getAllAnnoTypes(f).contains(skipAnnotationType))
result.add(f);
return result;
}
@Retention(RUNTIME)
@Target(FIELD)
@Documented
public @interface SkipInDefaultVersion {}
@Retention(RUNTIME)
@Target(FIELD)
@Documented
public @interface SkipInVersion1 {}
@Retention(RUNTIME)
@Target(FIELD)
@Documented
public @interface SkipInVersion2 {}
/**
* The serialization spec dictates that primitive fields are serialized before Objects,
* and each group is sorted by the natural ordering of their names @see {@link String#compareTo(String)}
*/
private static enum SerializationOrdering implements Comparator<ObjectStreamField> {
INSTANCE;
@Override
public int compare(ObjectStreamField f1, ObjectStreamField f2) {
boolean f1IsPrim = f1.getType().isPrimitive();
boolean f2IsPrim = f2.getType().isPrimitive();
if (f1IsPrim == f2IsPrim)
return f1.getName().compareTo(f2.getName());
return f1IsPrim ? -1 : 1;
}
}
}
| 5,861 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/fvd/_BouncerImpl_Tie.java | // POA Tie class generated by rmic, do not edit.
// Contents subject to change without notice.
package test.fvd;
import java.io.Serializable;
import java.lang.ClassCastException;
import java.lang.Object;
import java.lang.String;
import java.lang.Throwable;
import java.rmi.Remote;
import javax.rmi.CORBA.Tie;
import javax.rmi.CORBA.Util;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
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.POAPackage.ObjectNotActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
public class _BouncerImpl_Tie extends org.omg.PortableServer.Servant implements Tie {
private BouncerImpl target = null;
private static final String[] _type_ids = {
"RMI:test.fvd.Bouncer:0000000000000000"
};
public void setTarget(Remote target) {
this.target = (BouncerImpl) target;
}
public Remote getTarget() {
return target;
}
public org.omg.CORBA.Object thisObject() {
return _this_object();
}
public void deactivate() {
try {
_poa().deactivate_object(_poa().servant_to_id(this));
}
catch(WrongPolicy e) { }
catch(ObjectNotActive e) { }
catch(ServantNotActive e) { }
}
public ORB orb() {
return _orb();
}
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 needs an org.omg.CORBA_2_3.ORB");
}
}
public String[] _all_interfaces(POA poa, byte[] objectId) {
return (String [] ) _type_ids.clone();
}
public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
try {
org.omg.CORBA_2_3.portable.InputStream in =
(org.omg.CORBA_2_3.portable.InputStream) _in;
switch (method.length()) {
case 8:
if (method.equals("shutdown")) {
return shutdown(in, reply);
}
case 11:
if (method.equals("bounceValue")) {
return bounceValue(in, reply);
}
case 12:
if (method.equals("bounceObject")) {
return bounceObject(in, reply);
}
case 14:
if (method.equals("bounceAbstract")) {
return bounceAbstract(in, reply);
}
case 18:
if (method.equals("bounceSerializable")) {
return bounceSerializable(in, reply);
}
}
throw new BAD_OPERATION();
} catch (SystemException ex) {
throw ex;
} catch (Throwable ex) {
throw new UnknownException(ex);
}
}
private OutputStream bounceAbstract(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
Abstract arg0 = (Abstract) in.read_abstract_interface(Abstract.class);
Abstract result = target.bounceAbstract(arg0);
OutputStream out = reply.createReply();
Util.writeAbstractObject(out,result);
return out;
}
private OutputStream bounceObject(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
Object arg0 = Util.readAny(in);
Object result = target.bounceObject(arg0);
OutputStream out = reply.createReply();
Util.writeAny(out,result);
return out;
}
private OutputStream bounceSerializable(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
Serializable arg0 = (Serializable) Util.readAny(in);
Serializable result = target.bounceSerializable(arg0);
OutputStream out = reply.createReply();
Util.writeAny(out,result);
return out;
}
private OutputStream bounceValue(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
Value arg0 = (Value) in.read_value(Value.class);
Value result = target.bounceValue(arg0);
org.omg.CORBA_2_3.portable.OutputStream out =
(org.omg.CORBA_2_3.portable.OutputStream) reply.createReply();
out.write_value((Serializable)result,Value.class);
return out;
}
private OutputStream shutdown(org.omg.CORBA_2_3.portable.InputStream in , ResponseHandler reply) throws Throwable {
target.shutdown();
OutputStream out = reply.createReply();
return out;
}
}
| 5,862 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
/**
* TestHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:41 PM EDT
*/
//
abstract public class TestHelper
{
private static String _id = "IDL:Test:1.0";
public static void insert (org.omg.CORBA.Any a, Test that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static Test extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (TestHelper.id (), "Test");
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static Test read (org.omg.CORBA.portable.InputStream istream)
{
return narrow (istream.read_Object (_TestStub.class));
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, Test value)
{
ostream.write_Object ((org.omg.CORBA.Object) value);
}
public static Test narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Test)
return (Test)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
_TestStub stub = new _TestStub ();
stub._set_delegate(delegate);
return stub;
}
}
}
| 5,863 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
/**
* TestHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:41 PM EDT
*/
//
public final class TestHolder implements org.omg.CORBA.portable.Streamable
{
public Test value = null;
public TestHolder ()
{
}
public TestHolder (Test initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = TestHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
TestHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return TestHelper.type ();
}
}
| 5,864 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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, softwares
* 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.tnaming;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static test.tnaming.Client.NameServiceType.READ_ONLY;
import java.io.BufferedReader;
import java.rmi.Remote;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.junit.Assert;
import org.omg.CORBA.NO_PERMISSION;
import org.omg.CORBA.ORB;
import org.omg.CORBA.UserException;
import org.omg.CosNaming.Binding;
import org.omg.CosNaming.BindingHolder;
import org.omg.CosNaming.BindingIteratorHolder;
import org.omg.CosNaming.BindingListHolder;
import org.omg.CosNaming.NameComponent;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.InvalidName;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
final class Client extends test.common.TestBase implements AutoCloseable {
enum NameServiceType {
READ_ONLY, INTEGRAL, STANDALONE
};
final NameServiceType accessibility;
final ORB orb;
final POA rootPoa;
final NamingContextExt rootNamingContext;
final String name1, name2, name3;
final Test test1, test2, test3;
Client(NameServiceType accessibility, final String refFile, Properties props, String... args) throws Exception {
assertNotNull(accessibility);
this.accessibility = accessibility;
this.orb = ORB.init(args, props);
this.rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
this.rootPoa.the_POAManager().activate();
this.rootNamingContext = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
//
// Get "test" objects
//
System.out.println("Started ORB, getting test object IORs from file");
try (BufferedReader file = openFileReader(refFile)) {
String[] refStrings = new String[2];
readRef(file, refStrings);
test1 = getTestObjectFromReference(refStrings[0]);
name1 = refStrings[1];
readRef(file, refStrings);
test2 = getTestObjectFromReference(refStrings[0]);
name2 = refStrings[1];
readRef(file, refStrings);
test3 = getTestObjectFromReference(refStrings[0]);
name3 = refStrings[1];
} catch (java.io.IOException ex) {
System.err.println("Can't read from '" + ex.getMessage() + "'");
throw ex;
}
}
private Test getTestObjectFromReference(String ref) {
assertNotNull("Reference should not have been null", ref);
org.omg.CORBA.Object obj = orb.string_to_object(ref);
assertNotNull("Orb should have created a non-null stub", obj);
Test result = TestHelper.narrow(obj);
assertNotNull("Should have been able to narrow stub to a Test", result);
return result;
}
void run() throws Exception {
System.out.println("Running naming client tests");
switch (accessibility) {
case READ_ONLY :
testReadOnly();
testBoundReferences();
testIterators();
testObjectFactories();
break;
case INTEGRAL:
testBoundReferences();
testIterators();
testObjectFactories();
break;
case STANDALONE:
testBoundReferences();
testIterators();
break;
}
}
private void testBoundReferences() throws UserException {
System.out.println("Testing bound reference 1");
Util.assertTestIsBound(test1, rootNamingContext, name1);
System.out.println("Testing bound reference 2");
Util.assertTestIsBound(test2, rootNamingContext, name2);
System.out.println("Testing bound reference 3");
Util.assertTestIsBound(test3, rootNamingContext, name3);
System.out.println("Testing bound reference 1 via corbaname");
Util.assertCorbanameIsBound(test1, orb, "corbaname:rir:/NameService#"+name1);
System.out.println("Testing bound references complete.");
}
private void testIterators() throws Exception {
System.out.println("Testing iterators: narrowing context");
NamingContextExt nc = NamingContextExtHelper.narrow(rootNamingContext.resolve(Util.ITERATOR_TEST_CONTEXT_PATH));
// check the behaviour of the binding iterators
for (int listSize = 0; listSize <= Util.EXPECTED_NAMES.size() + 1; listSize++) {
System.out.println("Testing iterators: list size " + listSize);
final BindingListHolder blh = new BindingListHolder();
final BindingIteratorHolder bih = new BindingIteratorHolder();
final BindingHolder bh = new BindingHolder();
final Set<String> actualNames = new TreeSet<>();
nc.list(listSize, blh, bih); // <-- this is what we are testing
System.out.println("List returned count = " + blh.value.length);
final int expectedListSize = Math.min(listSize, Util.EXPECTED_NAMES.size());
assertEquals("Should have as many elements in the list as requested or available", expectedListSize,
blh.value.length);
for (Binding b : blh.value) {
String name = b.binding_name[0].id;
assertTrue("Name '" + name + "' should be an expected one", Util.EXPECTED_NAMES.contains(name));
assertFalse("Name '" + name + "' should not be a dupe", actualNames.contains(name));
actualNames.add(name);
}
for (int i = expectedListSize; i < Util.EXPECTED_NAMES.size(); i++) {
assertTrue(bih.value.next_one(bh));
String name = bh.value.binding_name[0].id;
assertTrue("Name '" + name + "' should be an expected one", Util.EXPECTED_NAMES.contains(name));
assertFalse("Name '" + name + "' should not be a dupe", actualNames.contains(name));
actualNames.add(name);
}
assertFalse(bih.value.next_one(bh));
assertEquals(0, bh.value.binding_name.length);
assertEquals(Util.EXPECTED_NAMES, actualNames);
}
System.out.println("Testing iterators complete.");
}
private enum WriteMethod {
bind, bind_context, bind_new_context, destroy, new_context, rebind_context, rebind, unbind
};
private void testReadOnly() throws Exception {
final NameComponent[] foo = Util.makeName("foo");
for (WriteMethod method : WriteMethod.values()) {
try {
switch (method) {
case bind :
rootNamingContext.bind(foo, rootNamingContext);
break;
case bind_context :
rootNamingContext.bind_context(foo, rootNamingContext);
break;
case bind_new_context :
rootNamingContext.bind_new_context(foo);
break;
case destroy :
rootNamingContext.destroy();
break;
case new_context :
rootNamingContext.new_context();
break;
case rebind :
rootNamingContext.rebind(foo, rootNamingContext);
break;
case rebind_context :
rootNamingContext.rebind_context(foo, rootNamingContext);
break;
case unbind :
rootNamingContext.unbind(foo);
break;
}
Assert.fail(method + " should have thrown a NO_PERMISSION exception");
} catch (NO_PERMISSION expected) {
System.out.println(method + "() threw a NO_PERMISSION as expected.");
}
}
}
public void testObjectFactories() throws CannotProceed, InvalidName {
System.out.println("Testing object factories: resolvable");
Util.assertFactoryIsBound(rootNamingContext, Server.RESOLVABLE_TEST);
System.out.println("Testing object factories: resolver");
Util.assertFactoryIsBound(rootNamingContext, Server.RESOLVER_TEST);
System.out.println("Testing object factories complete.");
}
@Override
public void close() throws Exception {
try {
if (accessibility != READ_ONLY)
Util.unbindEverything(rootNamingContext);
} finally {
try {
test1.shutdown();
} finally {
orb.destroy();
}
}
}
}
| 5,865 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/ServerWithReadWriteIntegralNameService.java | package test.tnaming;
import static org.apache.yoko.orb.spi.naming.NameServiceInitializer.NS_ORB_INIT_PROP;
import static org.apache.yoko.orb.spi.naming.NameServiceInitializer.NS_REMOTE_ACCESS_ARG;
import static org.apache.yoko.orb.spi.naming.RemoteAccess.readWrite;
import java.util.Properties;
public class ServerWithReadWriteIntegralNameService {
public static void main(String args[]) throws Exception {
final String refFile = args[0];
System.out.println("1");
Properties props = new Properties();
System.out.println("2");
props.put(NS_ORB_INIT_PROP, "");
System.out.println("3");
props.put("yoko.orb.oa.endpoint", "iiop --host localhost --port " + Util.NS_PORT);
System.out.println("4");
try (Server s = new Server(refFile, props, NS_REMOTE_ACCESS_ARG, readWrite.name())) {
System.out.println("5");
s.bindObjectFactories();
s.run();
}
}
}
| 5,866 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/Util.java | package test.tnaming;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import org.junit.Assert;
import org.omg.CORBA.ORB;
import org.omg.CORBA.UserException;
import org.omg.CosNaming.BindingHolder;
import org.omg.CosNaming.BindingIterator;
import org.omg.CosNaming.BindingIteratorHolder;
import org.omg.CosNaming.BindingListHolder;
import org.omg.CosNaming.BindingType;
import org.omg.CosNaming.NameComponent;
import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextHelper;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.InvalidName;
import org.omg.CosNaming.NamingContextPackage.NotFound;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
public class Util {
static final NameComponent[] ITERATOR_TEST_CONTEXT_PATH = Util.makeName("iteratorTest");
static final Set<String> EXPECTED_NAMES = Collections.unmodifiableSet(new TreeSet<>(Arrays.asList("test0 test1 test2 test3 test4 test5 test6 test7 test8 test9".split(" "))));
static final int NS_PORT = 40001;
static final String NS_LOC = "corbaloc::localhost:40001/NameService";
static void assertTestIsBound(String expectedId, NamingContextExt ctx, NameComponent ...path) throws CannotProceed, InvalidName {
assertNotNull(path);
assertNotEquals(0, path.length);
try {
org.omg.CORBA.Object o = ctx.resolve(path);
Test test = TestHelper.narrow(o);
assertTrue(test.get_id().equals(expectedId));
} catch (NotFound e) {
fail("Should have found Test object at path: " + ctx.to_string(path) );
}
}
static void assertFactoryIsBound(NamingContextExt ctx, NameComponent ...path) throws CannotProceed, InvalidName {
assertNotNull(path);
assertNotEquals(0, path.length);
try {
org.omg.CORBA.Object o1 = ctx.resolve(path);
org.omg.CORBA.Object o2 = ctx.resolve(path);
assertFalse(o1._is_equivalent(o2));
String id1 = TestHelper.narrow(o1).get_id();
String id2 = TestHelper.narrow(o2).get_id();
assertNotEquals(id1, id2);
} catch (NotFound nf) {
fail("Should have found Test object at path: " + ctx.to_string(path) );
}
}
static void assertNameNotBound(NamingContext initialContext, NameComponent...path) throws CannotProceed, InvalidName {
try {
initialContext.resolve(path);
fail("Expected NotFound exception");
} catch (NotFound e) {
// expected exception
}
}
static NameComponent[] makeName(String name) {
return new NameComponent[]{new NameComponent(name, "")};
}
static void assertTestIsBound(Test expected, NamingContextExt initialContext, String name) throws UserException {
Test test1a = TestHelper.narrow(initialContext.resolve_str(name));
assertNotNull(test1a);
assertEquals(test1a.get_id(),expected.get_id());
}
static void assertCorbanameIsBound(Test expected, ORB orb, String corbaname) throws UserException {
Test test1a = TestHelper.narrow(orb.string_to_object(corbaname));
assertNotNull(test1a);
assertEquals(test1a.get_id(),expected.get_id());
}
static void createBindingsOverWhichToIterate(ORB orb, NamingContext initialContext) throws Exception {
System.out.println("creating bindings");
// get the root poa
POA rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
System.out.println("got poa");
// create the context
NamingContext nc = initialContext.bind_new_context(ITERATOR_TEST_CONTEXT_PATH);
// add the bindings
for (String name : EXPECTED_NAMES)
nc.bind(makeName(name), new Test_impl(rootPoa, name)._this_object(orb));
}
public static void unbindEverything(NamingContext ctx) throws Exception {
BindingIteratorHolder iterHolder = new BindingIteratorHolder();
ctx.list(0, new BindingListHolder(), iterHolder);
BindingIterator bi = iterHolder.value;
BindingHolder bh = new BindingHolder();
while (bi.next_one(bh)) {
if (bh.value.binding_type.value() == BindingType._ncontext) {
org.omg.CORBA.Object o = ctx.resolve(bh.value.binding_name);
NamingContext nestedCtx = NamingContextHelper.narrow(o);
assertNotNull(nestedCtx);
unbindEverything(nestedCtx);
nestedCtx.destroy();
}
ctx.unbind(bh.value.binding_name);
}
}
}
| 5,867 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
public class Test_impl extends TestPOA {
private String name_;
private org.omg.PortableServer.POA poa_;
private static void TEST(boolean expr) {
if (!expr)
throw new test.common.TestException();
}
public Test_impl(org.omg.PortableServer.POA poa, String name) {
poa_ = poa;
name_ = name;
}
public org.omg.PortableServer.POA _default_POA() {
if (poa_ != null)
return poa_;
else
return super._default_POA();
}
public String get_id() {
return name_;
}
public void shutdown() {
_orb().shutdown(false);
}
}
| 5,868 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/ServerWithReadOnlyIntegralNameService.java | package test.tnaming;
import static org.apache.yoko.orb.spi.naming.NameServiceInitializer.NS_ORB_INIT_PROP;
import static org.apache.yoko.orb.spi.naming.NameServiceInitializer.NS_REMOTE_ACCESS_ARG;
import static org.apache.yoko.orb.spi.naming.RemoteAccess.readOnly;
import java.util.Properties;
public class ServerWithReadOnlyIntegralNameService {
public static void main(String args[]) throws Exception {
final String refFile = args[0];
Properties props = new Properties();
props.put(NS_ORB_INIT_PROP, "");
props.put("yoko.orb.oa.endpoint", "iiop --host localhost --port " + Util.NS_PORT);
try (Server s = new Server(refFile, props, NS_REMOTE_ACCESS_ARG, readOnly.name())) {
Util.createBindingsOverWhichToIterate(s.orb, s.rootNamingContext);
s.bindObjectFactories();
s.run();
}
}
}
| 5,869 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
/**
* TestPOA.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:25 PM EDT
*/
//
public abstract class TestPOA extends org.omg.PortableServer.Servant
implements TestOperations, org.omg.CORBA.portable.InvokeHandler
{
// Constructors
private static java.util.Hashtable _methods = new java.util.Hashtable ();
static
{
_methods.put ("get_id", new java.lang.Integer (0));
_methods.put ("shutdown", new java.lang.Integer (1));
}
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
if (__method == null)
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
switch (__method.intValue ())
{
case 0: // Test/get_id
{
String $result = null;
$result = this.get_id ();
out = $rh.createReply();
out.write_string ($result);
break;
}
case 1: // Test/shutdown
{
this.shutdown ();
out = $rh.createReply();
break;
}
default:
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
}
return out;
} // _invoke
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:Test:1.0"};
public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
{
return (String[])__ids.clone ();
}
public Test _this()
{
return TestHelper.narrow(
super._this_object());
}
public Test _this(org.omg.CORBA.ORB orb)
{
return TestHelper.narrow(
super._this_object(orb));
}
} // class TestPOA
| 5,870 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
/**
* TestOperations.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:41 PM EDT
*/
//
public interface TestOperations
{
String get_id ();
void shutdown ();
} // interface TestOperations
| 5,871 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
/**
* Test.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:41 PM EDT
*/
//
public interface Test extends TestOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
{
} // interface Test
| 5,872 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/_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.tnaming;
/**
* _TestStub.java .
* Generated by the IDL-to-Java compiler (portable), version "3.1"
* from Test.idl
* Wednesday, July 5, 2006 12:46:41 PM EDT
*/
//
public class _TestStub extends org.omg.CORBA.portable.ObjectImpl implements Test
{
public String get_id ()
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("get_id", true);
$in = _invoke ($out);
String $result = $in.read_string ();
return $result;
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
$in = $ex.getInputStream ();
String _id = $ex.getId ();
throw new org.omg.CORBA.MARSHAL (_id);
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
return get_id ( );
} finally {
_releaseReply ($in);
}
} // get_id
public void shutdown ()
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("shutdown", true);
$in = _invoke ($out);
return;
} catch (org.omg.CORBA.portable.ApplicationException $ex) {
$in = $ex.getInputStream ();
String _id = $ex.getId ();
throw new org.omg.CORBA.MARSHAL (_id);
} catch (org.omg.CORBA.portable.RemarshalException $rm) {
shutdown ( );
} finally {
_releaseReply ($in);
}
} // shutdown
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:Test:1.0"};
public String[] _ids ()
{
return (String[])__ids.clone ();
}
private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
{
String str = s.readUTF ();
String[] args = null;
java.util.Properties props = null;
org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
_set_delegate (delegate);
}
private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
{
String[] args = null;
java.util.Properties props = null;
String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
s.writeUTF (str);
}
} // class _TestStub
| 5,873 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/ClientForReadWriteNameService.java | package test.tnaming;
import java.util.Properties;
import static test.tnaming.Client.NameServiceType.*;
public class ClientForReadWriteNameService {
public static void main(String args[]) throws Exception {
final String refFile = args[0];
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");
try (Client client = new Client(STANDALONE, refFile, props, "-ORBInitRef", "NameService=" + Util.NS_LOC)) {
Util.createBindingsOverWhichToIterate(client.orb, client.rootNamingContext);
client.run();
}
}
}
| 5,874 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/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.tnaming;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
import org.apache.yoko.orb.spi.naming.Resolvable;
import org.apache.yoko.orb.spi.naming.Resolver;
import org.omg.CORBA.ORB;
import org.omg.CosNaming.NameComponent;
import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
import org.omg.CosNaming.NamingContextPackage.CannotProceed;
import org.omg.CosNaming.NamingContextPackage.InvalidName;
import org.omg.CosNaming.NamingContextPackage.NotFound;
import org.omg.PortableServer.POA;
import org.omg.PortableServer.POAHelper;
final class Server extends test.common.TestBase implements AutoCloseable {
private static final NameComponent LEVEL1 = new NameComponent("level1", "test");
private static final NameComponent LEVEL2 = new NameComponent("level2", "");
private static final NameComponent TEST1 = new NameComponent("Test1", "");
private static final NameComponent TEST2 = new NameComponent("Test2", "");
private static final NameComponent TEST3 = new NameComponent("Test3", "");
public static final NameComponent RESOLVABLE_TEST = new NameComponent("ResolvableTest", "");
public static final NameComponent RESOLVER_TEST = new NameComponent("ResolverTest", "");
final String refFile;
final ORB orb;
final POA rootPoa;
final NamingContextExt rootNamingContext;
final Test test1, test2, test3;
final Resolvable resolvable;
final Resolver resolver;
public Server(String refFile, Properties props, String... args) throws Exception {
this.refFile = refFile;
try {
System.out.println("About to init ORB");
this.orb = ORB.init(args, props);
System.out.println("create ORB");
this.rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
System.out.println("got root poa");
this.rootPoa.the_POAManager().activate();
System.out.println("activated root poa");
this.rootNamingContext = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
System.out.println("got root context");
//
// Create implementation objects
//
test1 = TestHelper.narrow(new Test_impl(rootPoa, "Test1")._this_object(orb));
test2 = TestHelper.narrow(new Test_impl(rootPoa, "Test2")._this_object(orb));
test3 = TestHelper.narrow(new Test_impl(rootPoa, "Test3")._this_object(orb));
// two ways to provide a Resolvable - both should be treated identically
resolvable = new TestFactory_impl (rootPoa, orb, RESOLVABLE_TEST.id);
resolver = new Resolver(){
@Override
public org.omg.CORBA.Object resolve() {
return resolvable.resolve();
}
};
System.out.println("created references");
} catch (Throwable t) {
System.err.println("Caught throwable: " + t);
t.printStackTrace();
throw t;
}
}
void run() throws Exception {
System.out.println("server starting to run");
// use a temporary file to avoid the client picking up an empty file when debugging the server
Path tmp = Files.createTempFile(refFile, "");
try (PrintWriter out = new PrintWriter(new FileWriter(tmp.toFile()))) {
System.out.println("server opened file for writing");
try {
NamingContext nc1 = rootNamingContext.new_context();
System.out.println("server created new naming context");
System.out.println("Binding context level1");
rootNamingContext.bind_context(new NameComponent[]{LEVEL1}, nc1);
System.out.println("server binding context");
NamingContext nc2 = rootNamingContext.bind_new_context(new NameComponent[]{LEVEL1, LEVEL2});
Util.assertNameNotBound(rootNamingContext, TEST1);
Util.assertNameNotBound(rootNamingContext, TEST1);
rootNamingContext.bind(new NameComponent[]{TEST1}, test1);
Util.assertTestIsBound("Test1", rootNamingContext, TEST1);
nc1.bind(new NameComponent[]{TEST2}, test2);
Util.assertTestIsBound("Test2", rootNamingContext, LEVEL1, TEST2);
rootNamingContext.bind(new NameComponent[]{LEVEL1, LEVEL2, TEST3}, test3);
Util.assertTestIsBound("Test3", rootNamingContext, LEVEL1, LEVEL2, TEST3);
Test test3a = TestHelper.narrow(new Test_impl(rootPoa, "Test3a")._this_object(orb));
nc2.rebind(new NameComponent[]{TEST3}, test3a);
Util.assertTestIsBound("Test3a", rootNamingContext, LEVEL1, LEVEL2, TEST3);
rootNamingContext.unbind(new NameComponent[]{LEVEL1, LEVEL2, TEST3});
Util.assertNameNotBound(nc2, TEST3);
nc2.bind(new NameComponent[]{TEST3}, test3);
Util.assertTestIsBound("Test3", rootNamingContext, LEVEL1, LEVEL2, TEST3);
nc1.unbind(new NameComponent[]{LEVEL2});
Util.assertNameNotBound(rootNamingContext, LEVEL1, LEVEL2, TEST3);
nc1.rebind_context(new NameComponent[]{LEVEL2}, nc2);
System.out.println("All contexts bound");
} catch (Exception e) {
e.printStackTrace(out);
throw e;
}
//
// 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.
//
System.out.println("Writing IORs to file");
writeRef(orb, out, test1, rootNamingContext, new NameComponent[]{TEST1});
writeRef(orb, out, test2, rootNamingContext, new NameComponent[]{LEVEL1, TEST2});
writeRef(orb, out, test3, rootNamingContext, new NameComponent[]{LEVEL1, LEVEL2, TEST3});
out.flush();
System.out.println("IORs written to file");
} catch (java.io.IOException ex) {
System.err.println("Can't write to `" + ex.getMessage() + "'");
throw ex;
}
// rename the completed file
Files.move(tmp, Paths.get(refFile));
orb.run();
}
public void bindObjectFactories() throws NotFound, CannotProceed, InvalidName, AlreadyBound {
rootNamingContext.bind(new NameComponent[]{RESOLVABLE_TEST}, resolvable);
Util.assertFactoryIsBound(rootNamingContext, RESOLVABLE_TEST);
rootNamingContext.bind(new NameComponent[]{RESOLVER_TEST}, resolver);
Util.assertFactoryIsBound(rootNamingContext, RESOLVER_TEST);
}
@Override
public void close() throws Exception {
try {
Util.unbindEverything(rootNamingContext);
} finally {
orb.destroy();
}
}
}
| 5,875 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/ClientForReadOnlyNameService.java | package test.tnaming;
import static test.tnaming.Client.NameServiceType.READ_ONLY;
import java.util.Properties;
public class ClientForReadOnlyNameService {
public static void main(String args[]) throws Exception {
final String refFile = args[0];
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");
try (Client client = new Client(READ_ONLY, refFile, props, "-ORBInitRef", "NameService=" + Util.NS_LOC )) {
client.run();
}
}
}
| 5,876 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/ServerWithReadWriteStandaloneNameService.java | package test.tnaming;
import java.util.Properties;
import org.apache.yoko.orb.CosNaming.tnaming.TransientNameService;
public class ServerWithReadWriteStandaloneNameService {
public static void main(String args[]) throws Exception {
final String refFile = args[0];
try (TransientNameService service = new TransientNameService("localhost", Util.NS_PORT)) {
System.out.println("Starting transient name service");
service.run();
System.out.println("Transient name service started");
Properties props = new Properties();
props.put("yoko.orb.oa.endpoint", "iiop --host localhost --port " + (Util.NS_PORT+1));
props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
try (Server s = new Server(refFile, props, "-ORBInitRef", "NameService=" + Util.NS_LOC)) {
s.run();
}
}
}
}
| 5,877 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/test | Create_ds/geronimo-yoko/yoko-core/src/test/java/test/tnaming/TestFactory_impl.java | package test.tnaming;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.yoko.orb.spi.naming.Resolvable;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Object;
import org.omg.PortableServer.POA;
public class TestFactory_impl extends LocalObject implements Resolvable{
POA _poa;
ORB _orb;
String _baseName;
static final AtomicInteger _count = new AtomicInteger (0);
public TestFactory_impl (POA poa, ORB orb, String baseName) {
_poa = poa;
_orb = orb;
}
@Override
public Object resolve() {
String thisOnesName = "_baseName" + _count.incrementAndGet();
return new Test_impl(_poa, thisOnesName)._this_object(_orb);
}
}
| 5,878 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/IntfPOATie.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
public class IntfPOATie extends IntfPOA
{
private IntfOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
IntfPOATie(IntfOperations delegate)
{
_ob_delegate_ = delegate;
}
public
IntfPOATie(IntfOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public IntfOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(IntfOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:ORBTest_StubTimeout/Intf/sleep_oneway:1.0
//
public void
sleep_oneway(int sec)
{
_ob_delegate_.sleep_oneway(sec);
}
//
// IDL:ORBTest_StubTimeout/Intf/sleep_twoway:1.0
//
public void
sleep_twoway(int sec)
{
_ob_delegate_.sleep_twoway(sec);
}
}
| 5,879 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/Intf.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
/***/
public interface Intf extends IntfOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,880 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/IntfPOA.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
public abstract class IntfPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
IntfOperations
{
static final String[] _ob_ids_ =
{
"IDL:ORBTest_StubTimeout/Intf:1.0",
};
public Intf
_this()
{
return IntfHelper.narrow(super._this_object());
}
public Intf
_this(org.omg.CORBA.ORB orb)
{
return IntfHelper.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 =
{
"sleep_oneway",
"sleep_twoway"
};
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: // sleep_oneway
return _OB_op_sleep_oneway(in, handler);
case 1: // sleep_twoway
return _OB_op_sleep_twoway(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_sleep_oneway(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();
sleep_oneway(_ob_a0);
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_sleep_twoway(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();
sleep_twoway(_ob_a0);
out = handler.createReply();
return out;
}
}
| 5,881 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/_IntfStub.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
public class _IntfStub extends org.omg.CORBA.portable.ObjectImpl
implements Intf
{
private static final String[] _ob_ids_ =
{
"IDL:ORBTest_StubTimeout/Intf:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = IntfOperations.class;
//
// IDL:ORBTest_StubTimeout/Intf/sleep_oneway:1.0
//
public void
sleep_oneway(int _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("sleep_oneway", false);
out.write_ulong(_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("sleep_oneway", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.sleep_oneway(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_StubTimeout/Intf/sleep_twoway:1.0
//
public void
sleep_twoway(int _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("sleep_twoway", true);
out.write_ulong(_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("sleep_twoway", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.sleep_twoway(_ob_a0);
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,882 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/IntfHelper.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
final public class IntfHelper
{
public static void
insert(org.omg.CORBA.Any any, Intf val)
{
any.insert_Object(val, type());
}
public static Intf
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(), "Intf");
}
return typeCode_;
}
public static String
id()
{
return "IDL:ORBTest_StubTimeout/Intf:1.0";
}
public static Intf
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Intf)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_IntfStub _ob_stub = new _IntfStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Intf val)
{
out.write_Object(val);
}
public static Intf
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Intf)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IntfStub _ob_stub = new _IntfStub();
_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 Intf
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Intf)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IntfStub _ob_stub = new _IntfStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,883 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/IntfHolder.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
final public class IntfHolder implements org.omg.CORBA.portable.Streamable
{
public Intf value;
public
IntfHolder()
{
}
public
IntfHolder(Intf initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = IntfHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
IntfHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return IntfHelper.type();
}
}
| 5,884 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_StubTimeout/IntfOperations.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 ORBTest_StubTimeout;
//
// IDL:ORBTest_StubTimeout/Intf:1.0
//
/***/
public interface IntfOperations
{
//
// IDL:ORBTest_StubTimeout/Intf/sleep_oneway:1.0
//
/***/
void
sleep_oneway(int sec);
//
// IDL:ORBTest_StubTimeout/Intf/sleep_twoway:1.0
//
/***/
void
sleep_twoway(int sec);
}
| 5,885 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/IntfPOATie.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
public class IntfPOATie extends IntfPOA
{
private IntfOperations _ob_delegate_;
private org.omg.PortableServer.POA _ob_poa_;
public
IntfPOATie(IntfOperations delegate)
{
_ob_delegate_ = delegate;
}
public
IntfPOATie(IntfOperations delegate, org.omg.PortableServer.POA poa)
{
_ob_delegate_ = delegate;
_ob_poa_ = poa;
}
public IntfOperations
_delegate()
{
return _ob_delegate_;
}
public void
_delegate(IntfOperations delegate)
{
_ob_delegate_ = delegate;
}
public org.omg.PortableServer.POA
_default_POA()
{
if(_ob_poa_ != null)
return _ob_poa_;
else
return super._default_POA();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_PERSIST_STORE_Ex:1.0
//
public void
op_PERSIST_STORE_Ex()
{
_ob_delegate_.op_PERSIST_STORE_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_FREE_MEM_Ex:1.0
//
public void
op_FREE_MEM_Ex()
{
_ob_delegate_.op_FREE_MEM_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_IDENT_Ex:1.0
//
public void
op_INV_IDENT_Ex()
{
_ob_delegate_.op_INV_IDENT_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_FLAG_Ex:1.0
//
public void
op_INV_FLAG_Ex()
{
_ob_delegate_.op_INV_FLAG_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INTF_REPOS_Ex:1.0
//
public void
op_INTF_REPOS_Ex()
{
_ob_delegate_.op_INTF_REPOS_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_BAD_CONTEXT_Ex:1.0
//
public void
op_BAD_CONTEXT_Ex()
{
_ob_delegate_.op_BAD_CONTEXT_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_REQUIRED_Ex:1.0
//
public void
op_TRANSACTION_REQUIRED_Ex()
{
_ob_delegate_.op_TRANSACTION_REQUIRED_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_ROLLEDBACK_Ex:1.0
//
public void
op_TRANSACTION_ROLLEDBACK_Ex()
{
_ob_delegate_.op_TRANSACTION_ROLLEDBACK_Ex();
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INVALID_TRANSACTION_Ex:1.0
//
public void
op_INVALID_TRANSACTION_Ex()
{
_ob_delegate_.op_INVALID_TRANSACTION_Ex();
}
}
| 5,886 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/Intf.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
/***/
public interface Intf extends IntfOperations,
org.omg.CORBA.Object,
org.omg.CORBA.portable.IDLEntity
{
}
| 5,887 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/IntfPOA.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
public abstract class IntfPOA
extends org.omg.PortableServer.Servant
implements org.omg.CORBA.portable.InvokeHandler,
IntfOperations
{
static final String[] _ob_ids_ =
{
"IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0",
};
public Intf
_this()
{
return IntfHelper.narrow(super._this_object());
}
public Intf
_this(org.omg.CORBA.ORB orb)
{
return IntfHelper.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 =
{
"op_BAD_CONTEXT_Ex",
"op_FREE_MEM_Ex",
"op_INTF_REPOS_Ex",
"op_INVALID_TRANSACTION_Ex",
"op_INV_FLAG_Ex",
"op_INV_IDENT_Ex",
"op_PERSIST_STORE_Ex",
"op_TRANSACTION_REQUIRED_Ex",
"op_TRANSACTION_ROLLEDBACK_Ex"
};
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: // op_BAD_CONTEXT_Ex
return _OB_op_op_BAD_CONTEXT_Ex(in, handler);
case 1: // op_FREE_MEM_Ex
return _OB_op_op_FREE_MEM_Ex(in, handler);
case 2: // op_INTF_REPOS_Ex
return _OB_op_op_INTF_REPOS_Ex(in, handler);
case 3: // op_INVALID_TRANSACTION_Ex
return _OB_op_op_INVALID_TRANSACTION_Ex(in, handler);
case 4: // op_INV_FLAG_Ex
return _OB_op_op_INV_FLAG_Ex(in, handler);
case 5: // op_INV_IDENT_Ex
return _OB_op_op_INV_IDENT_Ex(in, handler);
case 6: // op_PERSIST_STORE_Ex
return _OB_op_op_PERSIST_STORE_Ex(in, handler);
case 7: // op_TRANSACTION_REQUIRED_Ex
return _OB_op_op_TRANSACTION_REQUIRED_Ex(in, handler);
case 8: // op_TRANSACTION_ROLLEDBACK_Ex
return _OB_op_op_TRANSACTION_ROLLEDBACK_Ex(in, handler);
}
throw new org.omg.CORBA.BAD_OPERATION();
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_BAD_CONTEXT_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_BAD_CONTEXT_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_FREE_MEM_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_FREE_MEM_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_INTF_REPOS_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_INTF_REPOS_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_INVALID_TRANSACTION_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_INVALID_TRANSACTION_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_INV_FLAG_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_INV_FLAG_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_INV_IDENT_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_INV_IDENT_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_PERSIST_STORE_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_PERSIST_STORE_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_TRANSACTION_REQUIRED_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_TRANSACTION_REQUIRED_Ex();
out = handler.createReply();
return out;
}
private org.omg.CORBA.portable.OutputStream
_OB_op_op_TRANSACTION_ROLLEDBACK_Ex(org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler handler)
{
org.omg.CORBA.portable.OutputStream out = null;
op_TRANSACTION_ROLLEDBACK_Ex();
out = handler.createReply();
return out;
}
}
| 5,888 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/_IntfStub.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
public class _IntfStub extends org.omg.CORBA.portable.ObjectImpl
implements Intf
{
private static final String[] _ob_ids_ =
{
"IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0",
};
public String[]
_ids()
{
return _ob_ids_;
}
final public static java.lang.Class _ob_opsClass = IntfOperations.class;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_PERSIST_STORE_Ex:1.0
//
public void
op_PERSIST_STORE_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_PERSIST_STORE_Ex", 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("op_PERSIST_STORE_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_PERSIST_STORE_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_FREE_MEM_Ex:1.0
//
public void
op_FREE_MEM_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_FREE_MEM_Ex", 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("op_FREE_MEM_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_FREE_MEM_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_IDENT_Ex:1.0
//
public void
op_INV_IDENT_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_INV_IDENT_Ex", 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("op_INV_IDENT_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_INV_IDENT_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_FLAG_Ex:1.0
//
public void
op_INV_FLAG_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_INV_FLAG_Ex", 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("op_INV_FLAG_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_INV_FLAG_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INTF_REPOS_Ex:1.0
//
public void
op_INTF_REPOS_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_INTF_REPOS_Ex", 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("op_INTF_REPOS_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_INTF_REPOS_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_BAD_CONTEXT_Ex:1.0
//
public void
op_BAD_CONTEXT_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_BAD_CONTEXT_Ex", 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("op_BAD_CONTEXT_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_BAD_CONTEXT_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_REQUIRED_Ex:1.0
//
public void
op_TRANSACTION_REQUIRED_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_TRANSACTION_REQUIRED_Ex", 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("op_TRANSACTION_REQUIRED_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_TRANSACTION_REQUIRED_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_ROLLEDBACK_Ex:1.0
//
public void
op_TRANSACTION_ROLLEDBACK_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_TRANSACTION_ROLLEDBACK_Ex", 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("op_TRANSACTION_ROLLEDBACK_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_TRANSACTION_ROLLEDBACK_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INVALID_TRANSACTION_Ex:1.0
//
public void
op_INVALID_TRANSACTION_Ex()
{
while(true)
{
if(!this._is_local())
{
org.omg.CORBA.portable.OutputStream out = null;
org.omg.CORBA.portable.InputStream in = null;
try
{
out = _request("op_INVALID_TRANSACTION_Ex", 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("op_INVALID_TRANSACTION_Ex", _ob_opsClass);
if(_ob_so == null)
continue;
IntfOperations _ob_self = (IntfOperations)_ob_so.servant;
try
{
_ob_self.op_INVALID_TRANSACTION_Ex();
return;
}
finally
{
_servant_postinvoke(_ob_so);
}
}
}
}
}
| 5,889 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/IntfHelper.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
final public class IntfHelper
{
public static void
insert(org.omg.CORBA.Any any, Intf val)
{
any.insert_Object(val, type());
}
public static Intf
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(), "Intf");
}
return typeCode_;
}
public static String
id()
{
return "IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0";
}
public static Intf
read(org.omg.CORBA.portable.InputStream in)
{
org.omg.CORBA.Object _ob_v = in.read_Object();
try
{
return (Intf)_ob_v;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)_ob_v;
_IntfStub _ob_stub = new _IntfStub();
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
public static void
write(org.omg.CORBA.portable.OutputStream out, Intf val)
{
out.write_Object(val);
}
public static Intf
narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Intf)val;
}
catch(ClassCastException ex)
{
}
if(val._is_a(id()))
{
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IntfStub _ob_stub = new _IntfStub();
_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 Intf
unchecked_narrow(org.omg.CORBA.Object val)
{
if(val != null)
{
try
{
return (Intf)val;
}
catch(ClassCastException ex)
{
}
org.omg.CORBA.portable.ObjectImpl _ob_impl;
_IntfStub _ob_stub = new _IntfStub();
_ob_impl = (org.omg.CORBA.portable.ObjectImpl)val;
_ob_stub._set_delegate(_ob_impl._get_delegate());
return _ob_stub;
}
return null;
}
}
| 5,890 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/IntfHolder.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
final public class IntfHolder implements org.omg.CORBA.portable.Streamable
{
public Intf value;
public
IntfHolder()
{
}
public
IntfHolder(Intf initial)
{
value = initial;
}
public void
_read(org.omg.CORBA.portable.InputStream in)
{
value = IntfHelper.read(in);
}
public void
_write(org.omg.CORBA.portable.OutputStream out)
{
IntfHelper.write(out, value);
}
public org.omg.CORBA.TypeCode
_type()
{
return IntfHelper.type();
}
}
| 5,891 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java | Create_ds/geronimo-yoko/yoko-core/src/test/java/ORBTest_ExceptionsExt_2_0/IntfOperations.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 ORBTest_ExceptionsExt_2_0;
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf:1.0
//
/***/
public interface IntfOperations
{
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_PERSIST_STORE_Ex:1.0
//
/***/
void
op_PERSIST_STORE_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_FREE_MEM_Ex:1.0
//
/***/
void
op_FREE_MEM_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_IDENT_Ex:1.0
//
/***/
void
op_INV_IDENT_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INV_FLAG_Ex:1.0
//
/***/
void
op_INV_FLAG_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INTF_REPOS_Ex:1.0
//
/***/
void
op_INTF_REPOS_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_BAD_CONTEXT_Ex:1.0
//
/***/
void
op_BAD_CONTEXT_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_REQUIRED_Ex:1.0
//
/***/
void
op_TRANSACTION_REQUIRED_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_TRANSACTION_ROLLEDBACK_Ex:1.0
//
/***/
void
op_TRANSACTION_ROLLEDBACK_Ex();
//
// IDL:ORBTest_ExceptionsExt_2_0/Intf/op_INVALID_TRANSACTION_Ex:1.0
//
/***/
void
op_INVALID_TRANSACTION_Ex();
}
| 5,892 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/PoaTest.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 org.apache.yoko;
public class PoaTest extends AbstractOrbTestBase {
public void setUp() throws Exception {
super.setUp();
setWaitForFile("Test.ref");
}
public void testActivate() throws Exception {
client.invokeMain("test.poa.TestActivate");
}
public void testDeactivate() throws Exception {
client.invokeMain("test.poa.TestDeactivate");
}
public void testCollocated() throws Exception {
client.invokeMain("test.poa.TestCollocated");
}
public void testCreate() throws Exception {
client.invokeMain("test.poa.TestCreate");
}
public void testDestroy() throws Exception {
client.invokeMain("test.poa.TestDestroy");
}
public void testFind() throws Exception {
client.invokeMain("test.poa.TestFind");
}
public void testMisc() throws Exception {
client.invokeMain("test.poa.TestMisc");
}
public void testDefaultServant() throws Exception {
runServerClientTest("test.poa.TestDefaultServantServer");
}
public void testServantActivatorServer() throws Exception {
runServerClientTest("test.poa.TestServantActivatorServer");
}
public void testServantLocatorServer() throws Exception {
runServerClientTest("test.poa.TestServantLocatorServer");
}
public void testLocationForwardServer() throws Exception {
runServerClientTest("test.poa.TestLocationForwardServerMain", "test.poa.TestLocationForwardClient");
}
public void testAdapterActivatorServer() throws Exception {
runServerClientTest("test.poa.TestAdapterActivatorServer");
}
public void testPoaManagerServer() throws Exception {
runServerClientTest("test.poa.TestPOAManagerServer", "test.poa.TestPOAManagerClient");
}
public void testDispatchStrategyServer() throws Exception {
runServerClientTest("test.poa.TestDispatchStrategyServer", "test.poa.TestDispatchStrategyClient");
}
public void testMultipleOrbsServer() throws Exception {
runServerClientTest("test.poa.TestMultipleOrbsServer", "test.poa.TestMultipleOrbsClient");
}
public void testMultipleOrbsThreadedServer() throws Exception {
runServerClientTest("test.poa.TestMultipleOrbsThreadedServer", "test.poa.TestMultipleOrbsThreadedClient");
}
private void runServerClientTest(String serverClass) throws Exception {
runServerClientTest(serverClass, "test.poa.TestClient");
}
}
| 5,893 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/TypesTest.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 org.apache.yoko;
public class TypesTest extends AbstractOrbTestBase {
public void testConst() throws Exception {
client.invokeMain("test.types.TestConst");
}
public void testTypeCode() throws Exception {
client.invokeMain("test.types.TestTypeCode");
}
public void testAny() throws Exception {
client.invokeMain("test.types.TestAny");
}
public void testDynAny() throws Exception {
client.invokeMain("test.types.TestDynAny");
}
public void testPortableTypes() throws Exception {
client.invokeMain("test.types.TestPortableTypes");
}
public void testUnion() throws Exception {
client.invokeMain("test.types.TestUnion");
}
}
| 5,894 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/ObvTest.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 org.apache.yoko;
import java.io.File;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class ObvTest extends TestCase {
private static String SERVER_CLASS = "test.obv.Server";
private static String CLIENT_CLASS = "test.obv.Client";
private static File waitForFile = new File("TestOBV.ref");
String[] serverArgs, clientArgs;
public static TestSuite suite() {
return AbstractMatrixOrbTestBase.generateTestSuite(SERVER_CLASS, CLIENT_CLASS, waitForFile);
}
}
| 5,895 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/RetryTest.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 org.apache.yoko;
public class RetryTest extends AbstractOrbTestBase {
public static final String SERVER_CLASS = "test.retry.Server";
public static final String CLIENT_CLASS = "test.retry.Client";
public void testRetry() throws Exception {
setWaitForFile("Test.ref");
runServerClientTest(SERVER_CLASS, CLIENT_CLASS);
}
}
| 5,896 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/RMITest.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 org.apache.yoko;
import java.nio.file.Files;
import java.nio.file.Paths;
public class RMITest extends AbstractOrbTestBase {
private static final String REF_FILE = "Sample.ref";
public void testRMI() throws Exception {
server.launch();
Files.deleteIfExists(Paths.get(REF_FILE));
server.invokeMainAsync("test.rmi.ServerMain");
setWaitForFile(REF_FILE);
waitForFile();
client.invokeMain("test.rmi.ClientMain");
server.exit(0);
}
}
| 5,897 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/CodeSetTest.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 org.apache.yoko;
public class CodeSetTest extends AbstractOrbTestBase {
private static final String SERVER_CLASS = "test.codesets.Server";
private static final String CLIENT_CLASS = "test.codesets.Client";
private static final String OUTPUT_FILE = "TestCodeSets.ref";
public void setUp() throws Exception {
super.setUp();
setWaitForFile(OUTPUT_FILE);
}
public void testStandardCodeSet() throws Exception {
runServerClientTest(SERVER_CLASS, CLIENT_CLASS);
}
public void testStandardCodeSet_11() throws Exception {
runServerClientTest(SERVER_CLASS, new String[] {"-OAversion", "1.1"}, CLIENT_CLASS, new String[0]);
}
public void testCodeSet8859_5() throws Exception {
String[] args = {"-ORBnative_cs", "ISO/IEC", "8859-5" };
runServerClientTest(SERVER_CLASS, args, CLIENT_CLASS, args);
}
public void testCodeSet8859_5_11() throws Exception {
runServerClientTest(SERVER_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-5"},
CLIENT_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-5", "-OAversion", "1.1" });
}
public void testCodeSet8859_1_vs_8859_4() throws Exception {
runServerClientTest(SERVER_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-4"},
CLIENT_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-1" });
}
public void testCodeSet8859_1_vs_8859_4_11() throws Exception {
runServerClientTest(SERVER_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-4", "-OAversion", "1.1"},
CLIENT_CLASS, new String[] {"-ORBnative_cs", "ISO/IEC", "8859-1"});
}
}
| 5,898 |
0 | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache | Create_ds/geronimo-yoko/yoko-core/src/test/java/org/apache/yoko/MetaTest.java | package org.apache.yoko;
import java.io.Serializable;
import javax.rmi.CORBA.Util;
import javax.rmi.CORBA.ValueHandler;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.omg.CORBA.ValueDefPackage.FullValueDescription;
import org.omg.SendingContext.CodeBase;
import test.fvd.Marshalling;
public class MetaTest extends TestCase {
public static void testMetaForClassWithASelfReference() throws Exception {
ValueHandler vh = Util.createValueHandler();
CodeBase codebase = (CodeBase)vh.getRunTimeCodeBase();
String dataClassRepid = vh.getRMIRepositoryID(Data.class);
FullValueDescription fvd = codebase.meta(dataClassRepid);
Assert.assertNotNull(fvd);
}
public void testMetaForClassWithTwoSelfReferences() {
Marshalling.DEFAULT_VERSION.select();
ValueHandler vh = Util.createValueHandler();
CodeBase codebase = (CodeBase)vh.getRunTimeCodeBase();
String dataClassRepid = vh.getRMIRepositoryID(X.class);
System.out.println(dataClassRepid);
FullValueDescription fvd = codebase.meta(dataClassRepid);
Assert.assertNotNull(fvd);
}
public static class Data implements Serializable {
private static final long serialVersionUID = 1L;
public Data d;
}
public static class X {
X x1;
X x2;
}
}
| 5,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.