@Test public void testPetstoreEndpoints() { OpenApiEndpointSource source = new OpenApiEndpointSource(); Iterable<EndpointSource.Endpoint> endpoints = source.listEndpoints(); Set<String> endpointStrings = StreamSupport .stream(endpoints.spliterator(), false) .map(Object::toString) .collect(Collectors.toSet()); for (String endpoint: EXPECTED) { assertTrue(endpointStrings.contains(endpoint)); } }
@Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = OpenApiHelper.openApi3.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from OpenApi spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = pathPair.getKey(); for (String method : pathPair.getValue().getOperations().keySet()) { Endpoint endpoint = new Endpoint(basePath + path, method); if(log.isDebugEnabled()) log.debug(endpoint.toString()); endpoints.add(endpoint); } } return endpoints; }
OpenApiEndpointSource implements EndpointSource { @Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = OpenApiHelper.openApi3.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from OpenApi spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = pathPair.getKey(); for (String method : pathPair.getValue().getOperations().keySet()) { Endpoint endpoint = new Endpoint(basePath + path, method); if(log.isDebugEnabled()) log.debug(endpoint.toString()); endpoints.add(endpoint); } } return endpoints; } }
OpenApiEndpointSource implements EndpointSource { @Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = OpenApiHelper.openApi3.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from OpenApi spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = pathPair.getKey(); for (String method : pathPair.getValue().getOperations().keySet()) { Endpoint endpoint = new Endpoint(basePath + path, method); if(log.isDebugEnabled()) log.debug(endpoint.toString()); endpoints.add(endpoint); } } return endpoints; }  }
OpenApiEndpointSource implements EndpointSource { @Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = OpenApiHelper.openApi3.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from OpenApi spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = pathPair.getKey(); for (String method : pathPair.getValue().getOperations().keySet()) { Endpoint endpoint = new Endpoint(basePath + path, method); if(log.isDebugEnabled()) log.debug(endpoint.toString()); endpoints.add(endpoint); } } return endpoints; }  @Override Iterable<Endpoint> listEndpoints(); String findBasePath(); }
OpenApiEndpointSource implements EndpointSource { @Override public Iterable<Endpoint> listEndpoints() { List<Endpoint> endpoints = new ArrayList<>(); String basePath = findBasePath(); Map<String, Path> paths = OpenApiHelper.openApi3.getPaths(); if(log.isInfoEnabled()) log.info("Generating paths from OpenApi spec"); for (Map.Entry<String, Path> pathPair : paths.entrySet()) { String path = pathPair.getKey(); for (String method : pathPair.getValue().getOperations().keySet()) { Endpoint endpoint = new Endpoint(basePath + path, method); if(log.isDebugEnabled()) log.debug(endpoint.toString()); endpoints.add(endpoint); } } return endpoints; }  @Override Iterable<Endpoint> listEndpoints(); String findBasePath();  }