Search in sources :

Example 6 with IntHolder

use of org.omg.CORBA.IntHolder in project alliance by codice.

the class CatalogMgrImplTest method testHitCountWithTimeoutSet.

@Test
public void testHitCountWithTimeoutSet() throws InvalidInputParameter, SystemFault, ProcessingFault {
    catalogMgr.set_default_timeout(30);
    HitCountRequest hitCountRequest = catalogMgr.hit_count(testQuery, null);
    IntHolder hitHolder = new IntHolder();
    assertThat(hitCountRequest, notNullValue());
    hitCountRequest.complete(hitHolder);
    assertThat(hitHolder.value, greaterThan(0));
}
Also used : IntHolder(org.omg.CORBA.IntHolder) HitCountRequest(org.codice.alliance.nsili.common.GIAS.HitCountRequest) Test(org.junit.Test)

Example 7 with IntHolder

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

the class Outcome02 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String matrixIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        Matrix matrix = MatrixHelper.narrow(ORBInterface.orb().string_to_object(matrixIOR));
        int matrixWidth = matrix.get_width();
        int matrixHeight = matrix.get_height();
        int total = 0;
        for (int x = 0; x < matrixWidth; x++) {
            for (int y = 0; y < matrixHeight; y++) {
                IntHolder value = new IntHolder();
                matrix.get_value(x, y, value, null);
                total += value.value;
            }
        }
        if (total == (matrixWidth * matrixHeight / 2)) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Outcome02.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Outcome02.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 8 with IntHolder

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

the class Client0001 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++) {
            AtomicTransaction atomicTransaction = new AtomicTransaction();
            atomicTransaction.begin();
            try {
                counter.increase();
            } catch (InvocationException invocationException) {
            }
            atomicTransaction.commit(true);
        }
        AtomicTransaction atomicTransaction = new AtomicTransaction();
        atomicTransaction.begin();
        IntHolder value = new IntHolder();
        counter.get(value);
        atomicTransaction.commit(true);
        if (value.value == numberOfCalls) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client0001.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Client0001.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : AtomicTransaction(com.arjuna.ats.jts.extensions.AtomicTransaction) IntHolder(org.omg.CORBA.IntHolder)

Example 9 with IntHolder

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

the class Outcome02 method main.

public static void main(String[] args) {
    try {
        ORBInterface.initORB(args, null);
        OAInterface.initOA();
        String matrixIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        Matrix matrix = MatrixHelper.narrow(ORBInterface.orb().string_to_object(matrixIOR));
        int matrixWidth = matrix.get_width();
        int matrixHeight = matrix.get_height();
        int total = 0;
        for (int x = 0; x < matrixWidth; x++) {
            for (int y = 0; y < matrixHeight; y++) {
                IntHolder value = new IntHolder();
                matrix.get_value(x, y, value);
                total += value.value;
            }
        }
        if (total == (matrixWidth * matrixHeight / 2)) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Outcome02.main: " + exception);
        exception.printStackTrace(System.err);
    }
    try {
        OAInterface.shutdownOA();
        ORBInterface.shutdownORB();
    } catch (Exception exception) {
        System.err.println("Outcome02.main: " + exception);
        exception.printStackTrace(System.err);
    }
}
Also used : IntHolder(org.omg.CORBA.IntHolder)

Example 10 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 numberTableIOR = ServerIORStore.loadIOR(args[args.length - 1]);
        NumberTable numberTable = NumberTableHelper.narrow(ORBInterface.orb().string_to_object(numberTableIOR));
        boolean correct = true;
        OTS.current().begin();
        IntHolder valueHolder1 = new IntHolder();
        IntHolder valueHolder2 = new IntHolder();
        IntHolder valueHolder3 = new IntHolder();
        IntHolder valueHolder4 = new IntHolder();
        numberTable.get("Name_0", valueHolder1);
        numberTable.get("Name_1", valueHolder2);
        System.err.println("Phase 0, Name_0: " + valueHolder1.value);
        System.err.println("Phase 0, Name_1: " + valueHolder2.value);
        numberTable.increase("Name_0");
        Thread.sleep(15000);
        numberTable.increase("Name_1");
        numberTable.get("Name_0", valueHolder3);
        numberTable.get("Name_1", valueHolder4);
        System.err.println("Phase 1, Name_0: " + valueHolder3.value);
        System.err.println("Phase 1, Name_1: " + valueHolder4.value);
        OTS.current().commit(true);
        correct = (valueHolder1.value == valueHolder2.value) && (valueHolder3.value == valueHolder4.value) && (valueHolder1.value == (valueHolder3.value - 1)) && (valueHolder2.value == (valueHolder4.value - 1));
        if (correct) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
    } catch (InvocationException exception) {
        if (exception.myreason == Reason.ReasonCantSerializeAccess) {
            System.out.println("Passed");
        } else {
            System.out.println("Failed");
        }
        System.err.println("Client01.main: " + exception);
        exception.printStackTrace(System.err);
    } catch (Exception exception) {
        System.out.println("Failed");
        System.err.println("Client01.main: " + exception);
        exception.printStackTrace(System.err);
    } finally {
        // code change to stop database locking
        try {
            if (OTS.current().get_control() != null) {
                OTS.current().rollback();
            }
        } catch (Exception e) {
            System.err.println("Finally has caught exception");
            e.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)

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