@Test public void getWorkspaceEntries() { assumeThat(getCWD().getName(), is("com.eclipsesource.modelserver.emf")); serverConfiguration.setWorkspaceRoot("."); assertThat(serverConfiguration.getWorkspaceEntries(), hasItem(endsWith("/ServerConfigurationTest.class"))); }
public Set<String> getWorkspaceEntries() { Set<String> filePaths = new HashSet<>(); URI normalized = URIConverter.INSTANCE.normalize(workspaceRootURI); if (normalized.isFile()) { try (Stream<Path> paths = Files.walk(Paths.get(normalized.toFileString()))) { paths .filter(Files::isRegularFile) .forEach(file -> filePaths.add(file.toString())); } catch (InvalidPathException i) { LOG.error(String.format("Could not get workspace path! ’%s’ cannot be converted to a valid Path", this.workspaceRootURI)); } catch (IOException io) { LOG.error(String.format("IOException occured while reading files in workspace ’%s’: " + io.getMessage(), this.workspaceRootURI)); } catch (SecurityException s) { LOG.error("Security manager denies access to files under workspace " + this.workspaceRootURI); } } return filePaths; }
ServerConfiguration { public Set<String> getWorkspaceEntries() { Set<String> filePaths = new HashSet<>(); URI normalized = URIConverter.INSTANCE.normalize(workspaceRootURI); if (normalized.isFile()) { try (Stream<Path> paths = Files.walk(Paths.get(normalized.toFileString()))) { paths .filter(Files::isRegularFile) .forEach(file -> filePaths.add(file.toString())); } catch (InvalidPathException i) { LOG.error(String.format("Could not get workspace path! ’%s’ cannot be converted to a valid Path", this.workspaceRootURI)); } catch (IOException io) { LOG.error(String.format("IOException occured while reading files in workspace ’%s’: " + io.getMessage(), this.workspaceRootURI)); } catch (SecurityException s) { LOG.error("Security manager denies access to files under workspace " + this.workspaceRootURI); } } return filePaths; } }
ServerConfiguration { public Set<String> getWorkspaceEntries() { Set<String> filePaths = new HashSet<>(); URI normalized = URIConverter.INSTANCE.normalize(workspaceRootURI); if (normalized.isFile()) { try (Stream<Path> paths = Files.walk(Paths.get(normalized.toFileString()))) { paths .filter(Files::isRegularFile) .forEach(file -> filePaths.add(file.toString())); } catch (InvalidPathException i) { LOG.error(String.format("Could not get workspace path! ’%s’ cannot be converted to a valid Path", this.workspaceRootURI)); } catch (IOException io) { LOG.error(String.format("IOException occured while reading files in workspace ’%s’: " + io.getMessage(), this.workspaceRootURI)); } catch (SecurityException s) { LOG.error("Security manager denies access to files under workspace " + this.workspaceRootURI); } } return filePaths; }  }
ServerConfiguration { public Set<String> getWorkspaceEntries() { Set<String> filePaths = new HashSet<>(); URI normalized = URIConverter.INSTANCE.normalize(workspaceRootURI); if (normalized.isFile()) { try (Stream<Path> paths = Files.walk(Paths.get(normalized.toFileString()))) { paths .filter(Files::isRegularFile) .forEach(file -> filePaths.add(file.toString())); } catch (InvalidPathException i) { LOG.error(String.format("Could not get workspace path! ’%s’ cannot be converted to a valid Path", this.workspaceRootURI)); } catch (IOException io) { LOG.error(String.format("IOException occured while reading files in workspace ’%s’: " + io.getMessage(), this.workspaceRootURI)); } catch (SecurityException s) { LOG.error("Security manager denies access to files under workspace " + this.workspaceRootURI); } } return filePaths; }  URI getWorkspaceRootURI(); void setWorkspaceRootURI(final URI uri); String getWorkspaceRoot(); void setWorkspaceRoot(final String workspaceRoot); Set<String> getWorkspaceEntries(); int getServerPort(); void setServerPort(final int serverPort); static boolean isValidWorkspaceRoot(final String fileUrl); static boolean isValidPort(final Integer port); }
ServerConfiguration { public Set<String> getWorkspaceEntries() { Set<String> filePaths = new HashSet<>(); URI normalized = URIConverter.INSTANCE.normalize(workspaceRootURI); if (normalized.isFile()) { try (Stream<Path> paths = Files.walk(Paths.get(normalized.toFileString()))) { paths .filter(Files::isRegularFile) .forEach(file -> filePaths.add(file.toString())); } catch (InvalidPathException i) { LOG.error(String.format("Could not get workspace path! ’%s’ cannot be converted to a valid Path", this.workspaceRootURI)); } catch (IOException io) { LOG.error(String.format("IOException occured while reading files in workspace ’%s’: " + io.getMessage(), this.workspaceRootURI)); } catch (SecurityException s) { LOG.error("Security manager denies access to files under workspace " + this.workspaceRootURI); } } return filePaths; }  URI getWorkspaceRootURI(); void setWorkspaceRootURI(final URI uri); String getWorkspaceRoot(); void setWorkspaceRoot(final String workspaceRoot); Set<String> getWorkspaceEntries(); int getServerPort(); void setServerPort(final int serverPort); static boolean isValidWorkspaceRoot(final String fileUrl); static boolean isValidPort(final Integer port);  }