Search in sources :

Example 1 with ServiceCounterDataType

use of org.eclipse.milo.opcua.stack.core.types.structured.ServiceCounterDataType in project milo by eclipse.

the class VariantSerializationTest method testVariant_UaStructure.

@Test
public void testVariant_UaStructure() {
    ServiceCounterDataType sc1 = new ServiceCounterDataType(uint(1), uint(2));
    Variant v = new Variant(sc1);
    writer.writeVariant(v);
    Variant decoded = reader.readVariant();
    ExtensionObject extensionObject = (ExtensionObject) decoded.getValue();
    ServiceCounterDataType sc2 = (ServiceCounterDataType) extensionObject.decode(new TestSerializationContext());
    Assert.assertEquals(sc1.getTotalCount(), sc2.getTotalCount());
    Assert.assertEquals(sc1.getErrorCount(), sc2.getErrorCount());
}
Also used : Variant(org.eclipse.milo.opcua.stack.core.types.builtin.Variant) ExtensionObject(org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject) TestSerializationContext(org.eclipse.milo.opcua.stack.core.serialization.TestSerializationContext) ServiceCounterDataType(org.eclipse.milo.opcua.stack.core.types.structured.ServiceCounterDataType) Test(org.testng.annotations.Test)

Aggregations

TestSerializationContext (org.eclipse.milo.opcua.stack.core.serialization.TestSerializationContext)1 ExtensionObject (org.eclipse.milo.opcua.stack.core.types.builtin.ExtensionObject)1 Variant (org.eclipse.milo.opcua.stack.core.types.builtin.Variant)1 ServiceCounterDataType (org.eclipse.milo.opcua.stack.core.types.structured.ServiceCounterDataType)1 Test (org.testng.annotations.Test)1