@Test public void connectionNoParams(){ connectionStringValidSet.forEach(connectionAddress -> { String connectionString = connectionAddress; try { PlcConnection opcuaConnection = new PlcDriverManager().getConnection(connectionString); assert opcuaConnection.isConnected(); opcuaConnection.close(); assert !opcuaConnection.isConnected(); } catch (PlcConnectionException e) { fail("Exception during connectionNoParams while connecting Test EXCEPTION: " + e.getMessage()); } catch (Exception e) { fail("Exception during connectionNoParams while closing Test EXCEPTION: " + e.getMessage()); } }); }
@Override public PlcConnection getConnection(String url) throws PlcConnectionException { Matcher matcher = OPCUA_URI_PATTERN.matcher(url); if (!matcher.matches()) { throw new PlcConnectionException( "Connection url doesn't match the format 'opcua:{type} } String host = matcher.group("host"); String portString = matcher.group("port"); Integer port = StringUtils.isNotBlank(portString) ? Integer.parseInt(portString) : null; String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null; try { return opcuaConnectionFactory.opcuaTcpPlcConnectionOf(InetAddress.getByName(host), port, params, requestTimeout); } catch (UnknownHostException e) { throw new PlcConnectionException(e); } }
OpcuaPlcDriver implements PlcDriver { @Override public PlcConnection getConnection(String url) throws PlcConnectionException { Matcher matcher = OPCUA_URI_PATTERN.matcher(url); if (!matcher.matches()) { throw new PlcConnectionException( "Connection url doesn't match the format 'opcua:{type} } String host = matcher.group("host"); String portString = matcher.group("port"); Integer port = StringUtils.isNotBlank(portString) ? Integer.parseInt(portString) : null; String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null; try { return opcuaConnectionFactory.opcuaTcpPlcConnectionOf(InetAddress.getByName(host), port, params, requestTimeout); } catch (UnknownHostException e) { throw new PlcConnectionException(e); } } }
OpcuaPlcDriver implements PlcDriver { @Override public PlcConnection getConnection(String url) throws PlcConnectionException { Matcher matcher = OPCUA_URI_PATTERN.matcher(url); if (!matcher.matches()) { throw new PlcConnectionException( "Connection url doesn't match the format 'opcua:{type} } String host = matcher.group("host"); String portString = matcher.group("port"); Integer port = StringUtils.isNotBlank(portString) ? Integer.parseInt(portString) : null; String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null; try { return opcuaConnectionFactory.opcuaTcpPlcConnectionOf(InetAddress.getByName(host), port, params, requestTimeout); } catch (UnknownHostException e) { throw new PlcConnectionException(e); } }  }
OpcuaPlcDriver implements PlcDriver { @Override public PlcConnection getConnection(String url) throws PlcConnectionException { Matcher matcher = OPCUA_URI_PATTERN.matcher(url); if (!matcher.matches()) { throw new PlcConnectionException( "Connection url doesn't match the format 'opcua:{type} } String host = matcher.group("host"); String portString = matcher.group("port"); Integer port = StringUtils.isNotBlank(portString) ? Integer.parseInt(portString) : null; String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null; try { return opcuaConnectionFactory.opcuaTcpPlcConnectionOf(InetAddress.getByName(host), port, params, requestTimeout); } catch (UnknownHostException e) { throw new PlcConnectionException(e); } }  @Override String getProtocolCode(); @Override String getProtocolName(); @Override PlcConnection getConnection(String url); @Override PlcConnection getConnection(String url, PlcAuthentication authentication); @Override OpcuaField prepareField(String query); }
OpcuaPlcDriver implements PlcDriver { @Override public PlcConnection getConnection(String url) throws PlcConnectionException { Matcher matcher = OPCUA_URI_PATTERN.matcher(url); if (!matcher.matches()) { throw new PlcConnectionException( "Connection url doesn't match the format 'opcua:{type} } String host = matcher.group("host"); String portString = matcher.group("port"); Integer port = StringUtils.isNotBlank(portString) ? Integer.parseInt(portString) : null; String params = matcher.group("params") != null ? matcher.group("params").substring(1) : null; try { return opcuaConnectionFactory.opcuaTcpPlcConnectionOf(InetAddress.getByName(host), port, params, requestTimeout); } catch (UnknownHostException e) { throw new PlcConnectionException(e); } }  @Override String getProtocolCode(); @Override String getProtocolName(); @Override PlcConnection getConnection(String url); @Override PlcConnection getConnection(String url, PlcAuthentication authentication); @Override OpcuaField prepareField(String query); static final Pattern INET_ADDRESS_PATTERN; static final Pattern OPCUA_URI_PARAM_PATTERN; static final Pattern OPCUA_URI_PATTERN; }