Search in sources :

Example 16 with IntHolder

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

the class Client01 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        int numberOfCalls = 1000;
        for (int index = 0; index < numberOfCalls; index++) {
            counter.increase();
        }
        IntHolder value = new IntHolder();
        counter.get(value);
        if (value.value == numberOfCalls) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client01.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client01.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 17 with IntHolder

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

the class Client05 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 index = 0; index < numberOfCalls; index++) {
            pingPong.hit(index, pingPong, pingPong);
        }
        IntHolder pingPongValue = new IntHolder();
        pingPong.get(pingPongValue);
        if (pingPongValue.value == numberOfCalls) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client05.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client05.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 18 with IntHolder

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

the class Outcome01 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        int expectedValue = Integer.parseInt(args[args.length - 2]);
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        IntHolder value = new IntHolder();
        counter.get(value, null);
        if (value.value == expectedValue) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Outcome01.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Outcome01.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 19 with IntHolder

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

the class Client14 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 3]);
        Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        int numberOfWorkers = Integer.parseInt(args[args.length - 2]);
        int numberOfCalls = Integer.parseInt(args[args.length - 1]);
        Worker[] workers = new Worker[numberOfWorkers];
        for (int index = 0; index < workers.length; index++) {
            workers[index] = new Worker(numberOfCalls, counter);
        }
        for (int index = 0; index < workers.length; index++) {
            workers[index].start();
        }
        boolean correct = true;
        for (int index = 0; index < workers.length; index++) {
            workers[index].join();
            correct = correct && workers[index].isCorrect();
        }
        IntHolder value = new IntHolder();
        counter.get(value, null);
        correct = correct && (value.value == (numberOfWorkers * numberOfCalls));
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client14.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client14.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 20 with IntHolder

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

the class Client16 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String counterIOR = ServerIORStore.loadIOR(args[args.length - 3]);
        Counter counter = CounterHelper.narrow(ORBInterface.orb().string_to_object(counterIOR));
        int numberOfWorkers = Integer.parseInt(args[args.length - 2]);
        int numberOfCalls = Integer.parseInt(args[args.length - 1]);
        Worker[] workers = new Worker[numberOfWorkers];
        for (int index = 0; index < workers.length; index++) {
            workers[index] = new Worker(numberOfCalls, counter);
        }
        for (int index = 0; index < workers.length; index++) {
            workers[index].start();
        }
        boolean correct = true;
        for (int index = 0; index < workers.length; index++) {
            workers[index].join();
            correct = correct && workers[index].isCorrect();
        }
        IntHolder value = new IntHolder();
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        atomicTransaction.begin();
        counter.get(value, OTS.current().get_control());
        atomicTransaction.commit(true);
        correct = correct && (value.value == (numberOfWorkers * numberOfCalls));
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client16.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client16.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
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