Search in sources :

Example 11 with Current

use of org.omg.CosTransactions.Current in project narayana by jbosstm.

the class Test24 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        current.begin();
        current.rollback();
        Control control = current.suspend();
        correct = (control == null);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test24.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test24.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : Control(org.omg.CosTransactions.Control) Current(org.omg.CosTransactions.Current)

Example 12 with Current

use of org.omg.CosTransactions.Current in project narayana by jbosstm.

the class Test26 method main.

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.commit(true);
        try {
            current.resume(control);
        } catch (InvalidControl invalidControl) {
            System.err.println("Failed to resume committed transaction!");
            correct = false;
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test26.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test26.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : Control(org.omg.CosTransactions.Control) InvalidControl(org.omg.CosTransactions.InvalidControl) Current(org.omg.CosTransactions.Current) InvalidControl(org.omg.CosTransactions.InvalidControl)

Example 13 with Current

use of org.omg.CosTransactions.Current in project narayana by jbosstm.

the class Test28 method main.

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);
    }
}
Also used : Control(org.omg.CosTransactions.Control) InvalidControl(org.omg.CosTransactions.InvalidControl) Current(org.omg.CosTransactions.Current) InvalidControl(org.omg.CosTransactions.InvalidControl)

Example 14 with Current

use of org.omg.CosTransactions.Current in project narayana by jbosstm.

the class Test32 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        current.begin();
        current.rollback();
        correct = (current.get_status() == Status.StatusNoTransaction);
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test32.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test32.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : Current(org.omg.CosTransactions.Current)

Example 15 with Current

use of org.omg.CosTransactions.Current in project narayana by jbosstm.

the class Test02 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        Current current = OTS.get_current();
        try {
            current.commit(false);
            correct = false;
        } catch (NoTransaction noTransaction) {
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test02.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test02.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Aggregations

Current (org.omg.CosTransactions.Current)37 NoTransaction (org.omg.CosTransactions.NoTransaction)17 Control (org.omg.CosTransactions.Control)9 InvalidControl (org.omg.CosTransactions.InvalidControl)4 ORB (com.arjuna.orbportability.ORB)2 RootOA (com.arjuna.orbportability.RootOA)2 com.hp.mwtests.ts.jts.orbspecific.resources.heuristic (com.hp.mwtests.ts.jts.orbspecific.resources.heuristic)2 Test (org.junit.Test)2 AtomicResource (com.hp.mwtests.ts.jts.orbspecific.resources.AtomicResource)1 DemoResource (com.hp.mwtests.ts.jts.orbspecific.resources.DemoResource)1 ResourceTrace (com.hp.mwtests.ts.jts.utils.ResourceTrace)1 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)1 SystemException (org.omg.CORBA.SystemException)1 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)1 Coordinator (org.omg.CosTransactions.Coordinator)1 HeuristicHazard (org.omg.CosTransactions.HeuristicHazard)1 HeuristicMixed (org.omg.CosTransactions.HeuristicMixed)1 Resource (org.omg.CosTransactions.Resource)1 Status (org.omg.CosTransactions.Status)1