use of de.fraunhofer.iosb.ilt.faaast.service.endpoint.opcua.helper.assetconnection.TestAssetConnection in project FAAAST-Service by FraunhoferIOSB.
the class OpcUaEndpointFullTest method startTest.
/**
* Initialize and start the test.
*
* @throws Exception If the operation fails
*/
@BeforeClass
public static void startTest() throws Exception {
CoreConfig coreConfig = new CoreConfig();
OpcUaEndpointConfig config = new OpcUaEndpointConfig();
config.setTcpPort(OPC_TCP_PORT);
config.setSecondsTillShutdown(0);
AssetConnection assetConnection = new TestAssetConnection();
// register Test Operation
List<Key> keys = new ArrayList<>();
keys.add(new DefaultKey.Builder().type(KeyElements.SUBMODEL).idType(KeyType.IRI).value("https://acplt.org/Test_Submodel3").build());
keys.add(new DefaultKey.Builder().type(KeyElements.OPERATION).idType(KeyType.ID_SHORT).value("ExampleOperation").build());
Reference ref = new DefaultReference.Builder().keys(keys).build();
List<OperationVariable> outputArgs = new ArrayList<>();
outputArgs.add(new DefaultOperationVariable.Builder().value(new DefaultProperty.Builder().idShort("Test Output 1").valueType("string").value("XYZ1").build()).build());
assetConnection.registerOperationProvider(ref, new TestOperationProviderConfig(outputArgs));
endpoint = new OpcUaEndpoint();
service = new TestService(endpoint, assetConnection, true);
endpoint.init(coreConfig, config, service);
service.start();
}
Aggregations