Search in sources :

Example 1 with NestedEvent

use of alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent in project ACS by ACS-Community.

the class AnyAideTest method testComplexAnyToObject.

public void testComplexAnyToObject() {
    NestedEvent nestedStruct = new NestedEvent();
    nestedStruct.sampVal = advancedCS.getAny();
    nestedStruct.sampVal.insert_long(12);
    Any any1 = advancedCS.getAny();
    NestedEventHelper.insert(any1, nestedStruct);
    NestedEvent ns2 = (NestedEvent) anyAide.complexAnyToObject(any1);
    assertNotNull(ns2);
    assertTrue(ns2.sampVal.toString().equals("12"));
}
Also used : NotNestedEvent(alma.ADMINTEST1.NotNestedEvent) NestedEvent(alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent) Any(org.omg.CORBA.Any)

Example 2 with NestedEvent

use of alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent in project ACS by ACS-Community.

the class AnyAideTest method testComplexObjectToCorbaAny.

public void testComplexObjectToCorbaAny() {
    NestedEvent neVal = new NestedEvent();
    neVal.sampVal = advancedCS.getAny();
    neVal.sampVal.insert_long(15);
    Any anyNe = null;
    try {
        anyNe = anyAide.complexObjectToCorbaAny(neVal);
    } catch (AcsJException ex) {
    }
    assertNotNull(anyNe);
    NestedEvent neVal2 = NestedEventHelper.extract(anyNe);
    assertEquals(neVal.sampVal.extract_long(), neVal2.sampVal.extract_long());
    try {
        anyAide.complexObjectToCorbaAny(null);
        fail();
    } catch (AcsJException ex) {
    }
}
Also used : AcsJException(alma.acs.exceptions.AcsJException) NotNestedEvent(alma.ADMINTEST1.NotNestedEvent) NestedEvent(alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent) Any(org.omg.CORBA.Any)

Example 3 with NestedEvent

use of alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent in project ACS by ACS-Community.

the class AnyAideTest method testObjectToCorbaAny.

public void testObjectToCorbaAny() {
    final String strVal = "str";
    final Long lVal = 13L;
    final Double dVal = 13.7;
    final Float fVal = 13.3f;
    final Integer iVal = 11;
    final int[] intArr = new int[] { 1, 2, 3, 4 };
    final NestedEvent neVal = new NestedEvent();
    neVal.sampVal = advancedCS.getAny();
    neVal.sampVal.insert_long(15);
    Any anyNull = null, anyString = null, anyLong = null, anyDouble = null, anyFloat = null, anyInt = null;
    Any anyNe = null, anyIntArr = null;
    try {
        anyNull = anyAide.objectToCorbaAny(null);
        anyString = anyAide.objectToCorbaAny(strVal);
        anyLong = anyAide.objectToCorbaAny(lVal);
        anyDouble = anyAide.objectToCorbaAny(dVal);
        anyFloat = anyAide.objectToCorbaAny(fVal);
        anyInt = anyAide.objectToCorbaAny(iVal);
        anyNe = anyAide.objectToCorbaAny(neVal);
        anyIntArr = anyAide.objectToCorbaAny(intArr);
    } catch (AcsJException ex) {
    }
    assertNotNull(anyNull);
    assertNotNull(anyString);
    assertNotNull(anyLong);
    assertNotNull(anyDouble);
    assertNotNull(anyFloat);
    assertNotNull(anyInt);
    assertNotNull(anyNe);
    assertNotNull(anyIntArr);
    assertNull(anyNull.extract_Object());
    assertEquals(lVal.longValue(), anyLong.extract_longlong());
    assertEquals(dVal.doubleValue(), anyDouble.extract_double());
    assertEquals(fVal.floatValue(), anyFloat.extract_float());
    assertEquals(iVal.intValue(), anyInt.extract_long());
    assertEquals(strVal, anyString.extract_string());
    NestedEvent neVal2 = NestedEventHelper.extract(anyNe);
    assertEquals(neVal.sampVal.extract_long(), neVal2.sampVal.extract_long());
    int[] intArr2 = longSeqHelper.extract(anyIntArr);
    assertEquals(intArr.length, intArr2.length);
    for (int i = 0; i < intArr2.length; ++i) {
        assertEquals(intArr[i], intArr2[i]);
    }
    try {
        Any anyVector = anyAide.objectToCorbaAny(new Vector());
        fail();
    } catch (AcsJException ex) {
    }
}
Also used : AcsJException(alma.acs.exceptions.AcsJException) NotNestedEvent(alma.ADMINTEST1.NotNestedEvent) NestedEvent(alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent) Any(org.omg.CORBA.Any) Vector(java.util.Vector)

Example 4 with NestedEvent

use of alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent in project ACS by ACS-Community.

the class AnyAideTest method testCorbaStructToJavaClass.

public void testCorbaStructToJavaClass() {
    //		String nestedStructId = "IDL:alma/acssamp/NotNestedStruct:1.0";
    NotNestedEvent notNestedStruct = new NotNestedEvent();
    notNestedStruct.val = advancedCS.getAny();
    notNestedStruct.val.insert_long(12);
    Any any1 = advancedCS.getAny();
    NotNestedEventHelper.insert(any1, notNestedStruct);
    String qualClassName = anyAide.corbaStructToJavaClass(any1.type(), false);
    assertEquals("alma.ADMINTEST1.NotNestedEvent", qualClassName);
    //		nestedStructId = "IDL:alma/acssamp/SampObj/SampDataBlock:1.0";
    NestedEvent nestedStruct = new NestedEvent();
    nestedStruct.sampVal = advancedCS.getAny();
    nestedStruct.sampVal.insert_long(12);
    Any any2 = advancedCS.getAny();
    NestedEventHelper.insert(any2, nestedStruct);
    qualClassName = anyAide.corbaStructToJavaClass(any2.type(), true);
    assertEquals("alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent", qualClassName);
}
Also used : NotNestedEvent(alma.ADMINTEST1.NotNestedEvent) NestedEvent(alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent) NotNestedEvent(alma.ADMINTEST1.NotNestedEvent) Any(org.omg.CORBA.Any)

Aggregations

NestedEvent (alma.ADMINTEST1.InterfaceForNestedEventDefinitionPackage.NestedEvent)4 NotNestedEvent (alma.ADMINTEST1.NotNestedEvent)4 Any (org.omg.CORBA.Any)4 AcsJException (alma.acs.exceptions.AcsJException)2 Vector (java.util.Vector)1