@Override public Endpoint createEndpoint(String endpointUri, TestContext context) { try { URI uri = new URI(endpointUri); String path = uri.getSchemeSpecificPart(); if (path.startsWith("//")) { path = path.substring(2); } if (path.contains("?")) { path = path.substring(0, path.indexOf('?')); } Map<String, String> parameters = getParameters(endpointUri); String endpointName = null; if (parameters.containsKey(ENDPOINT_NAME)) { endpointName = parameters.remove(ENDPOINT_NAME); } Endpoint endpoint = createEndpoint(path, parameters, context); if (StringUtils.hasText(endpointName)) { endpoint.setName(endpointName); } return endpoint; } catch (URISyntaxException e) { throw new CitrusRuntimeException( String.format("Unable to parse endpoint uri '%s'", endpointUri), e); } }
private Endpoint getEndpoint(String name, String component) { Endpoint endpoint = endpointRepository.findOneByComponent(component); if (endpoint == null) { endpoint = new Endpoint(); endpoint.setComponent(component); endpoint.setName(name); return endpointRepository.save(endpoint); } return endpoint; }