Search in sources :

Example 21 with Current

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

the class Test05 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.commit(true);
        try {
            current.commit(true);
            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("Test05.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test05.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 22 with Current

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

the class Test07 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.commit(true);
        try {
            current.rollback();
            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("Test07.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test07.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 23 with Current

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

the class Test09 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.commit(false);
        try {
            current.commit(true);
            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("Test09.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test09.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 24 with Current

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

the class Test16 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();
        try {
            current.rollback_only();
            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("Test16.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test16.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : NoTransaction(org.omg.CosTransactions.NoTransaction) Current(org.omg.CosTransactions.Current)

Example 25 with Current

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

the class Test18 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        boolean correct = true;
        int numberOfTransactionNames = 1000;
        Current current = OTS.get_current();
        String[] transactionNames = new String[numberOfTransactionNames];
        for (int index = 0; index < numberOfTransactionNames; index++) {
            current.begin();
            transactionNames[index] = current.get_transaction_name();
            current.commit(false);
        }
        for (int index1 = 0; index1 < numberOfTransactionNames - 1; index1++) {
            for (int index2 = index1 + 1; index2 < numberOfTransactionNames; index2++) {
                correct = correct && (!transactionNames[index1].equals(transactionNames[index2]));
            }
        }
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Test18.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Test18.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : 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