use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class EqualsTest method testScalar.
@Test
public void testScalar() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(42));
FilterOperand op1 = new LiteralOperand(new Variant(42));
when(context.resolve(op0, eventNode)).thenReturn(42);
when(context.resolve(op1, eventNode)).thenReturn(42);
Boolean result = Operators.EQUALS.apply(context, eventNode, new FilterOperand[] { op0, op1 });
assertNotNull(result);
assertTrue(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class IsNullTest method testNonNullValue.
@Test
public void testNonNullValue() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(42));
when(context.resolve(op0, eventNode)).thenReturn(42);
Boolean result = Operators.IS_NULL.apply(context, eventNode, new FilterOperand[] { op0 });
assertNotNull(result);
assertFalse(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class IsNullTest method testNullValue.
@Test
public void testNullValue() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(null));
when(context.resolve(op0, eventNode)).thenReturn(null);
Boolean result = Operators.IS_NULL.apply(context, eventNode, new FilterOperand[] { op0 });
assertNotNull(result);
assertTrue(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class EqualsTest method testScalarNotEqual.
@Test
public void testScalarNotEqual() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(1));
FilterOperand op1 = new LiteralOperand(new Variant(2));
when(context.resolve(op0, eventNode)).thenReturn(1);
when(context.resolve(op1, eventNode)).thenReturn(2);
Boolean result = Operators.EQUALS.apply(context, eventNode, new FilterOperand[] { op0, op1 });
assertNotNull(result);
assertFalse(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class EqualsTest method testArray.
@Test
public void testArray() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(new int[] { 1, 2, 3 }));
FilterOperand op1 = new LiteralOperand(new Variant(new int[] { 1, 2, 3 }));
when(context.resolve(op0, eventNode)).thenReturn(new int[] { 1, 2, 3 });
when(context.resolve(op1, eventNode)).thenReturn(new int[] { 1, 2, 3 });
Boolean result = Operators.EQUALS.apply(context, eventNode, new FilterOperand[] { op0, op1 });
assertNotNull(result);
assertTrue(result);
}
Aggregations