public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String serviceIOR1 = ServerIORStore.loadIOR(args[args.length - 2]); BeforeCrashService service1 = BeforeCrashServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR1)); String serviceIOR2 = ServerIORStore.loadIOR(args[args.length - 1]); BeforeCrashService service2 = BeforeCrashServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR2)); ResourceBehavior[] resourceBehaviors1 = new ResourceBehavior[1]; resourceBehaviors1[0] = new ResourceBehavior(); resourceBehaviors1[0].crash_behavior = CrashBehavior.CrashBehaviorNoCrash; ResourceBehavior[] resourceBehaviors2 = new ResourceBehavior[1]; resourceBehaviors2[0] = new ResourceBehavior(); resourceBehaviors2[0].crash_behavior = CrashBehavior.CrashBehaviorCrashInRollback; boolean correct = true; OTS.current().begin(); service1.setup_oper(OTS.current().get_control(), resourceBehaviors1); service2.setup_oper(OTS.current().get_control(), resourceBehaviors2); correct = correct && service1.is_correct(); correct = correct && service2.is_correct(); OTS.current().rollback_only(); try { OTS.current().commit(true); correct = false; } catch (TRANSACTION_ROLLEDBACK transactionRolledback) { } if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.out.println("Failed"); System.err.println("Client21b.main: " + exception); exception.printStackTrace(System.err); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Client21b.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String serviceIOR = ServerIORStore.loadIOR(args[args.length - 1]); Service service = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR)); boolean correct = true; OTS.current().begin(); OTS.current().begin(); OTS.current().rollback_only(); try { service.oper(1); } catch (TRANSACTION_ROLLEDBACK transactionRolledback) { } try { OTS.current().commit(true); correct = false; } catch (TRANSACTION_ROLLEDBACK transactionRolledback) { } OTS.current().commit(true); correct = correct && service.is_correct(); if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.out.println("Failed"); System.err.println("Client001.main: " + exception); exception.printStackTrace(System.err); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Client001.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String args[]) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String profileName = args[args.length - 3]; int numberOfDrivers = JDBCProfileStore.numberOfDrivers(profileName); for (int index = 0; index < numberOfDrivers; index++) { String driver = JDBCProfileStore.driver(profileName, index); Class.forName(driver); } String databaseURL = JDBCProfileStore.databaseURL(profileName); String databaseUser = JDBCProfileStore.databaseUser(profileName); String databasePassword = JDBCProfileStore.databasePassword(profileName); String databaseDynamicClass = JDBCProfileStore.databaseDynamicClass(profileName); JDBCServiceImpl01 jdbcServiceImpl = new JDBCServiceImpl01( args[args.length - 2], databaseURL, databaseUser, databasePassword, databaseDynamicClass); BeforeCrashServicePOATie servant = new BeforeCrashServicePOATie(jdbcServiceImpl); OAInterface.objectIsReady(servant); BeforeCrashService service = BeforeCrashServiceHelper.narrow(OAInterface.corbaReference(servant)); ServerIORStore.storeIOR(args[args.length - 1], ORBInterface.orb().object_to_string(service)); System.out.println("Ready"); ORBInterface.run(); } catch (Exception exception) { System.err.println("JDBCServer01.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String args[]) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); AITMatrixImpl04 aitMatrixImpl = new AITMatrixImpl04(16, 16); MatrixPOATie servant = new MatrixPOATie(aitMatrixImpl); OAInterface.objectIsReady(servant); Matrix aitMatrix = MatrixHelper.narrow(OAInterface.corbaReference(servant)); ServerIORStore.storeIOR( args[args.length - 1], ORBInterface.orb().object_to_string(aitMatrix)); System.out.println("Ready"); ORBInterface.run(); } catch (Exception exception) { System.err.println("Server04.main: " + exception); } }
public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); boolean correct = true; Current current = OTS.get_current(); current.begin(); Control control = current.get_control(); current.rollback(); try { current.resume(control); } catch (InvalidControl invalidControl) { System.err.println("Failed to resume rolled-back transaction!"); correct = false; } if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.out.println("Failed"); System.err.println("Test28.main: " + exception); exception.printStackTrace(System.err); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Test28.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String args[]) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); AfterCrashServiceImpl02 afterCrashServiceImpl = new AfterCrashServiceImpl02(args[args.length - 2].hashCode(), 0); AfterCrashServicePOATie servant = new AfterCrashServicePOATie(afterCrashServiceImpl); OAInterface.objectIsReady(servant); AfterCrashService afterCrashService = AfterCrashServiceHelper.narrow(OAInterface.corbaReference(servant)); ServerIORStore.storeIOR( args[args.length - 1], ORBInterface.orb().object_to_string(afterCrashService)); System.out.println("Ready"); ORBInterface.run(); } catch (Exception exception) { System.err.println("Server06.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String serviceIOR1 = ServerIORStore.loadIOR(args[args.length - 3]); Service service1 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR1)); String serviceIOR2 = ServerIORStore.loadIOR(args[args.length - 2]); Service service2 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR2)); String serviceIOR3 = ServerIORStore.loadIOR(args[args.length - 1]); Service service3 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR3)); ResourceBehavior[] resourceBehaviors1 = new ResourceBehavior[1]; resourceBehaviors1[0] = new ResourceBehavior(); resourceBehaviors1[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteCommit; resourceBehaviors1[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors1[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors1[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; ResourceBehavior[] resourceBehaviors2 = new ResourceBehavior[1]; resourceBehaviors2[0] = new ResourceBehavior(); resourceBehaviors2[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteCommit; resourceBehaviors2[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors2[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors2[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; ResourceBehavior[] resourceBehaviors3 = new ResourceBehavior[1]; resourceBehaviors3[0] = new ResourceBehavior(); resourceBehaviors3[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteCommit; resourceBehaviors3[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors3[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors3[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; boolean correct = true; OTS.current().begin(); service1.oper(resourceBehaviors1); service2.oper(resourceBehaviors2); service3.oper(resourceBehaviors3); OTS.current().rollback_only(); try { OTS.current().commit(false); System.err.println("Commit succeeded when it shouldn't"); correct = false; } catch (TRANSACTION_ROLLEDBACK transactionRolledback) { } correct = correct && service1.is_correct() && service2.is_correct() && service3.is_correct(); ResourceTrace resourceTrace1 = service1.get_resource_trace(0); ResourceTrace resourceTrace2 = service2.get_resource_trace(0); ResourceTrace resourceTrace3 = service3.get_resource_trace(0); correct = correct && (resourceTrace1 == ResourceTrace.ResourceTraceRollback); correct = correct && (resourceTrace2 == ResourceTrace.ResourceTraceRollback); correct = correct && (resourceTrace3 == ResourceTrace.ResourceTraceRollback); if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.out.println("Failed"); System.err.println("Client030.main: " + exception); exception.printStackTrace(System.err); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Client030.main: " + exception); exception.printStackTrace(System.err); } }
public static void main(String[] args) { try { ORBInterface.initORB(args, null); OAInterface.initOA(); String serviceIOR1 = ServerIORStore.loadIOR(args[args.length - 2]); Service service1 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR1)); String serviceIOR2 = ServerIORStore.loadIOR(args[args.length - 1]); Service service2 = ServiceHelper.narrow(ORBInterface.orb().string_to_object(serviceIOR2)); ResourceBehavior[] resourceBehaviors1 = new ResourceBehavior[1]; resourceBehaviors1[0] = new ResourceBehavior(); resourceBehaviors1[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteRollback; resourceBehaviors1[0].rollback_behavior = RollbackBehavior.RollbackBehaviorRaiseHeuristicHazard; resourceBehaviors1[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors1[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; ResourceBehavior[] resourceBehaviors2 = new ResourceBehavior[1]; resourceBehaviors2[0] = new ResourceBehavior(); resourceBehaviors2[0].prepare_behavior = PrepareBehavior.PrepareBehaviorReturnVoteReadOnly; resourceBehaviors2[0].rollback_behavior = RollbackBehavior.RollbackBehaviorReturn; resourceBehaviors2[0].commit_behavior = CommitBehavior.CommitBehaviorReturn; resourceBehaviors2[0].commitonephase_behavior = CommitOnePhaseBehavior.CommitOnePhaseBehaviorReturn; boolean correct = true; OTS.current().begin(); service1.oper(resourceBehaviors1, OTS.current().get_control()); service2.oper(resourceBehaviors2, OTS.current().get_control()); try { OTS.current().commit(true); System.err.println("Commit succeeded when it shouldn't"); correct = false; } catch (HeuristicHazard heuristicHazard) { } correct = correct && service1.is_correct() && service2.is_correct(); if (!correct) { System.err.println("service1.is_correct() or service2.is_correct() returned false"); } ResourceTrace resourceTrace1 = service1.get_resource_trace(0); ResourceTrace resourceTrace2 = service2.get_resource_trace(0); correct = correct && (resourceTrace1 == ResourceTrace.ResourceTracePrepareRollbackForget); correct = correct && ((resourceTrace2 == ResourceTrace.ResourceTracePrepare) || (resourceTrace2 == ResourceTrace.ResourceTraceRollback)); if (correct) { System.out.println("Passed"); } else { System.out.println("Failed"); } } catch (Exception exception) { System.err.println("Client091.main: " + exception); exception.printStackTrace(System.err); System.out.println("Failed"); } try { OAInterface.shutdownOA(); ORBInterface.shutdownORB(); } catch (Exception exception) { System.err.println("Client091.main: " + exception); exception.printStackTrace(System.err); } }