Search in sources :

Example 51 with IntHolder

use of org.omg.CORBA.IntHolder in project narayana by jbosstm.

the class Client06 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String pingerIOR = ServerIORStore.loadIOR(args[args.length - 2]);
        PingPong pinger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingerIOR));
        String pongerIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        PingPong ponger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pongerIOR));
        int numberOfCalls = 10;
        for (int index = 0; index < numberOfCalls; index++) {
            pinger.hit(index, ponger, pinger, null);
        }
        IntHolder pingerValue = new IntHolder();
        pinger.get(pingerValue, null);
        IntHolder pongerValue = new IntHolder();
        ponger.get(pongerValue, null);
        if ((pingerValue.value == (numberOfCalls / 2)) && (pongerValue.value == (numberOfCalls / 2))) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client06.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client06.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 52 with IntHolder

use of org.omg.CORBA.IntHolder in project narayana by jbosstm.

the class Client10 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String pingPongIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        PingPong pingPong = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingPongIOR));
        int numberOfCalls = 10;
        for (int index0 = 0; index0 < numberOfCalls; index0++) {
            for (int index1 = 0; index1 <= index0; index1++) {
                pingPong.bad_hit(index0, index1, pingPong, pingPong, null);
            }
        }
        IntHolder pingPongValue = new IntHolder();
        pingPong.get(pingPongValue, null);
        if (pingPongValue.value == 0) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client10.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client10.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 53 with IntHolder

use of org.omg.CORBA.IntHolder in project narayana by jbosstm.

the class Client06 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String pingerIOR = ServerIORStore.loadIOR(args[args.length - 2]);
        PingPong pinger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingerIOR));
        String pongerIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        PingPong ponger = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pongerIOR));
        int numberOfCalls = 10;
        for (int index = 0; index < numberOfCalls; index++) {
            pinger.hit(index, ponger, pinger);
        }
        IntHolder pingerValue = new IntHolder();
        pinger.get(pingerValue);
        IntHolder pongerValue = new IntHolder();
        ponger.get(pongerValue);
        if ((pingerValue.value == (numberOfCalls / 2)) && (pongerValue.value == (numberOfCalls / 2))) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client06.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client06.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 54 with IntHolder

use of org.omg.CORBA.IntHolder in project narayana by jbosstm.

the class Client10 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String pingPongIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        PingPong pingPong = PingPongHelper.narrow(ORBInterface.orb().string_to_object(pingPongIOR));
        int numberOfCalls = 10;
        for (int index0 = 0; index0 < numberOfCalls; index0++) {
            for (int index1 = 0; index1 <= index0; index1++) {
                pingPong.bad_hit(index0, index1, pingPong, pingPong);
            }
        }
        IntHolder pingPongValue = new IntHolder();
        pingPong.get(pingPongValue);
        if (pingPongValue.value == 0) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client10.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client10.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 55 with IntHolder

use of org.omg.CORBA.IntHolder in project narayana by jbosstm.

the class Client19 method main.

public static void main(String[] args) {
    boolean correct = true;
    int numberOfCalls = 10;
    Counter counter = null;
    System.err.println("Starting first init");
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in first start: " + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("Starting first block");
    try {
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            counter.increase(OTS.current().get_control());
            if ((index % 2) == 0) {
                atomicTransaction.commit(true);
            } else {
                atomicTransaction.rollback();
            }
        }
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        atomicTransaction.begin();
        IntHolder value = new IntHolder();
        counter.get(value, OTS.current().get_control());
        atomicTransaction.commit(true);
        if (value.value == (numberOfCalls / 2) && correct) {
            correct = true;
        } else {
            correct = false;
        }
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in first block" + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("Starting first shutdown");
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in first shutdown" + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("----Starting second block -------");
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in second start " + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("init done starting second block");
    try {
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        atomicTransaction.begin();
        counter.set(0, OTS.current().get_control());
        atomicTransaction.commit(true);
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in set operation " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        for (int index = 0; index < numberOfCalls; index++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            counter.increase(OTS.current().get_control());
            if ((index % 2) == 0) {
                atomicTransaction.commit(true);
            } else {
                atomicTransaction.rollback();
            }
        }
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in second loop block " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        atomicTransaction.begin();
        IntHolder value = new IntHolder();
        counter.get(value, OTS.current().get_control());
        atomicTransaction.commit(true);
        if (value.value == (numberOfCalls / 2) && correct) {
            correct = true;
        } else {
            correct = false;
        }
    } catch (Exception exception) {
        correct = false;
        System.err.println("exception in second test " + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("Starting second shutdown");
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        correct = false;
        System.err.println("error in second shutdown" + exception);
        exception.printStackTrace(System.err);
    }
    System.err.println("testing result");
    if (correct) {
        System.out.println("Passed");
    } else {
        System.out.println("Failed");
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) IntHolder(org.omg.CORBA.IntHolder)

Aggregations

IntHolder (org.omg.CORBA.IntHolder)72 AtomicTransaction (com.arjuna.ats.jts.extensions.AtomicTransaction)12 Control (org.omg.CosTransactions.Control)10 ORB (com.arjuna.orbportability.ORB)6 RootOA (com.arjuna.orbportability.RootOA)6 HitCountRequest (org.codice.alliance.nsili.common.GIAS.HitCountRequest)6 Services (com.arjuna.orbportability.Services)5 ServerORB (com.hp.mwtests.ts.jts.utils.ServerORB)5 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)4 NameAlreadyUsed (gov.sandia.NotifyMonitoringExt.NameAlreadyUsed)3 NameMapError (gov.sandia.NotifyMonitoringExt.NameMapError)3 Test (org.junit.Test)3 BAD_PARAM (org.omg.CORBA.BAD_PARAM)3 AdminLimitExceeded (org.omg.CosNotifyChannelAdmin.AdminLimitExceeded)3 AcsJNarrowFailedEx (alma.ACSErrTypeCORBA.wrappers.AcsJNarrowFailedEx)2 CurrentImple (com.arjuna.ats.internal.jts.orbspecific.CurrentImple)2 SubmitQueryRequest (org.codice.alliance.nsili.common.GIAS.SubmitQueryRequest)2 DAGListHolder (org.codice.alliance.nsili.common.UCO.DAGListHolder)2 InvalidInputParameter (org.codice.alliance.nsili.common.UCO.InvalidInputParameter)2 ProcessingFault (org.codice.alliance.nsili.common.UCO.ProcessingFault)2