(Path jar, Path sourceFolder)
| 175 | } |
| 176 | |
| 177 | private void checkPluginJar(Path jar, Path sourceFolder) throws IOException |
| 178 | { |
| 179 | try (Stream<Path> stream = Files.walk(sourceFolder)) { |
| 180 | var javaPlugins = stream |
| 181 | .filter(Files::isRegularFile) |
| 182 | .map(Path::getFileName) |
| 183 | .map(Path::toString) |
| 184 | .filter(s -> s.endsWith(JAVA_EXT)) |
| 185 | .map(s -> s.substring(0, s.length() - JAVA_EXT.length())) |
| 186 | .collect(Collectors.toSet()); |
| 187 | |
| 188 | try (JarFile jarFile = new JarFile(jar.toFile())) { |
| 189 | var res = jarFile.stream() |
| 190 | .map(JarEntry::getRealName) |
| 191 | .filter(s -> s.endsWith(CLASS_EXT)) |
| 192 | .map(s -> s.substring(s.lastIndexOf('/') + 1)) // trim everything before the last '/' |
| 193 | .map(s -> s.substring(0, s.length() - CLASS_EXT.length())) // trim the class extension |
| 194 | .collect(Collectors.toSet()); |
| 195 | |
| 196 | javaPlugins.removeAll(res); |
| 197 | |
| 198 | assertTrue(javaPlugins.isEmpty(), "All java plugins should be represented in jar " + jar + " but the following were not: " + javaPlugins); |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | } |
no test coverage detected