Search in sources :

Example 1 with SetMonitoringModeResult

use of org.eclipse.milo.opcua.sdk.client.subscriptions.BatchSetMonitoringMode.SetMonitoringModeResult in project milo by eclipse.

the class BatchSetMonitoringModeTest method multipleOperations.

@Test
public void multipleOperations() throws UaException, InterruptedException {
    ManagedDataItem item1 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    ManagedDataItem item2 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    ManagedDataItem item3 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    BatchSetMonitoringMode batch = new BatchSetMonitoringMode(client, subscription.getSubscription());
    batch.add(item1.getMonitoredItem(), MonitoringMode.Sampling);
    batch.add(item2.getMonitoredItem(), MonitoringMode.Sampling);
    batch.add(item3.getMonitoredItem(), MonitoringMode.Sampling);
    List<SetMonitoringModeResult> results = batch.execute();
    for (SetMonitoringModeResult result : results) {
        assertTrue(result.isServiceResultGood());
        assertTrue(result.isOperationResultGood());
    }
    assertEquals(MonitoringMode.Sampling, item1.getMonitoringMode());
    assertEquals(MonitoringMode.Sampling, item2.getMonitoringMode());
    assertEquals(MonitoringMode.Sampling, item3.getMonitoringMode());
    assertEquals(1, batch.getServiceInvocationCount());
}
Also used : SetMonitoringModeResult(org.eclipse.milo.opcua.sdk.client.subscriptions.BatchSetMonitoringMode.SetMonitoringModeResult) Test(org.junit.jupiter.api.Test)

Example 2 with SetMonitoringModeResult

use of org.eclipse.milo.opcua.sdk.client.subscriptions.BatchSetMonitoringMode.SetMonitoringModeResult in project milo by eclipse.

the class BatchSetMonitoringModeTest method multipleServiceInvocations.

@Test
public void multipleServiceInvocations() throws UaException, InterruptedException {
    ManagedDataItem item1 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    ManagedDataItem item2 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    ManagedDataItem item3 = subscription.createDataItem(Identifiers.Server_ServerStatus_CurrentTime);
    item1.setMonitoringMode(MonitoringMode.Disabled);
    item2.setMonitoringMode(MonitoringMode.Sampling);
    item3.setMonitoringMode(MonitoringMode.Reporting);
    BatchSetMonitoringMode batch = new BatchSetMonitoringMode(client, subscription.getSubscription());
    batch.add(item1.getMonitoredItem(), MonitoringMode.Sampling);
    batch.add(item2.getMonitoredItem(), MonitoringMode.Reporting);
    batch.add(item3.getMonitoredItem(), MonitoringMode.Disabled);
    List<SetMonitoringModeResult> results = batch.execute();
    for (SetMonitoringModeResult result : results) {
        assertTrue(result.isServiceResultGood());
        assertTrue(result.isOperationResultGood());
    }
    assertEquals(MonitoringMode.Sampling, item1.getMonitoringMode());
    assertEquals(MonitoringMode.Reporting, item2.getMonitoringMode());
    assertEquals(MonitoringMode.Disabled, item3.getMonitoringMode());
    assertEquals(3, batch.getServiceInvocationCount());
}
Also used : SetMonitoringModeResult(org.eclipse.milo.opcua.sdk.client.subscriptions.BatchSetMonitoringMode.SetMonitoringModeResult) Test(org.junit.jupiter.api.Test)

Aggregations

SetMonitoringModeResult (org.eclipse.milo.opcua.sdk.client.subscriptions.BatchSetMonitoringMode.SetMonitoringModeResult)2 Test (org.junit.jupiter.api.Test)2