Skip to content

Commit

Permalink
Update to Java 17 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
slide authored Dec 3, 2024
1 parent c7b9b3b commit b123d01
Show file tree
Hide file tree
Showing 19 changed files with 143 additions and 134 deletions.
2 changes: 1 addition & 1 deletion juseppe-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</dependency>

<dependency>
<groupId>com.jayway.restassured</groupId>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static void main(String[] args) {
Runnable parse = builder.build().parse(args);
parse.run();

if (parse instanceof JuseppeCommand) {
System.exit(((JuseppeCommand) parse).getExitCode());
if (parse instanceof JuseppeCommand command) {
System.exit(command.getExitCode());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.airlift.airline.Command;
import ru.lanwen.jenkins.juseppe.props.JuseppeEnvVars.JuseppeEnvEnum;

import static java.lang.String.format;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Stream.of;

Expand All @@ -16,7 +15,7 @@ public class EnvCommand implements Runnable {
@Override
public void run() {
System.out.println(of(JuseppeEnvEnum.values())
.map(env -> format("\t%s (%s) %n\t\t- %s%n\t\tresolved: %s%n",
.map(env -> "\t%s (%s) %n\t\t- %s%n\t\tresolved: %s%n".formatted(
env.name(), env.mapping(), env.description(), env.resolved()))
.collect(joining("\n"))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;

import static java.nio.charset.StandardCharsets.UTF_8;

Expand All @@ -23,7 +23,7 @@ public class PrintCertCommand implements Runnable {
@Override
public void run() {
try {
Files.readAllLines(Paths.get(Props.populated().getCertPath()), UTF_8).forEach(System.out::println);
Files.readAllLines(Path.of(Props.populated().getCertPath()), UTF_8).forEach(System.out::println);
} catch (IOException e) {
LOG.error("Can't read certificate {}", Props.populated().getCertPath(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
Expand All @@ -19,7 +18,6 @@
import ru.lanwen.jenkins.juseppe.gen.UpdateSiteGen;
import ru.lanwen.jenkins.juseppe.props.Props;

import static java.lang.String.format;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
Expand All @@ -45,9 +43,9 @@ private WatchFiles() {

public WatchFiles configureFor(Props props) throws IOException {
this.props = props;
path = Paths.get(props.getPluginsDir());
path = Path.of(props.getPluginsDir());
this.keys = new HashMap<>();
setName(format("file-watcher-%s", path.getFileName()));
setName("file-watcher-%s".formatted(path.getFileName()));

watcher = this.path.getFileSystem().newWatchService();
walkAndRegisterDirectories(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.junit.ClassRule;
import org.junit.Test;

import static com.jayway.restassured.RestAssured.given;
import static io.restassured.RestAssured.given;

/**
* @author lanwen (Merkushev Kirill)
Expand All @@ -21,7 +21,7 @@ public void shouldFetchUpdateCenter() throws Exception {
.log().all()
.expect()
.log().status()
.get("update-center.json").then().assertThat().statusCode(200);
.when().get("update-center.json").then().assertThat().statusCode(200);
}

@Test(timeout = 10000)
Expand All @@ -31,7 +31,7 @@ public void shouldFetchHpi() throws Exception {
.log().all()
.expect()
.log().status()
.get("clang-scanbuild-plugin.hpi").then().assertThat().statusCode(200);
.when().get("clang-scanbuild-plugin.hpi").then().assertThat().statusCode(200);
}

@Test(timeout = 10000)
Expand All @@ -41,6 +41,6 @@ public void shouldFetchJpi() throws Exception {
.log().all()
.expect()
.log().status()
.get("sample-pipeline-dsl-ext-plugin-0.1.0.jpi").then().assertThat().statusCode(200);
.when().get("sample-pipeline-dsl-ext-plugin-0.1.0.jpi").then().assertThat().statusCode(200);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.concurrent.CompletableFuture;

import static com.google.common.io.Resources.getResource;
import static java.lang.String.format;

/**
* @author lanwen (Merkushev Kirill)
Expand Down Expand Up @@ -45,7 +44,7 @@ protected void after() {
}

public URI uri() {
return URI.create(format("http://localhost:%s", port));
return URI.create("http://localhost:%s".formatted(port));
}

private Integer findRandomOpenPortOnAllLocalInterfaces() throws IOException {
Expand Down
36 changes: 19 additions & 17 deletions juseppe-cli/src/test/resources/serve/cert/uc.crt
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDDjCCAfYCCQCxvzbj/rKRGTANBgkqhkiG9w0BAQsFADBJMQswCQYDVQQGEwJF
TjEWMBQGA1UECAwNVXBkYXRlLUNlbnRlcjEQMA4GA1UEBwwHSnVzZXBwZTEQMA4G
A1UECgwHSnVzZXBwZTAeFw0xODA2MTUwNDA1MzlaFw0yMTA1MDYwNDA1MzlaMEkx
CzAJBgNVBAYTAkVOMRYwFAYDVQQIDA1VcGRhdGUtQ2VudGVyMRAwDgYDVQQHDAdK
dXNlcHBlMRAwDgYDVQQKDAdKdXNlcHBlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEAoAhYmHhRmtI+afJtctDoyiXDnyfj6UHxqWnYXBO39xMCDHTjWmYd
kCLjzzNRl8d+MmfmX8XHfJy3iOpFa9sxACf12lQ/kd1PuYkNbJ9mQCmVJD3XG6wo
MrKKex4ot7DMnkIDCf5Q+zPwlo/GEkiMQSZy8JWpBLPVm4GTodAwQhgGojGwz2Tl
NO675wEnoe+Y0jXpInDiBbPSwero0ZFKL2t+tl4jATStT6u6BnDdiwpnEC7fwXZt
4lf4MgTVmo+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MaTM/OJrrfyfmtcQPD2z84MYZBnVT5zyv2S+M0UZMWV2m78691Gsf
ig20QSsZHz1cM0i/88Q1AewPJM4s6BJnJdJ4OfGMDLpEoWOafBfXyFkCAwEAAaNT
MFEwHQYDVR0OBBYEFFWgxzAg/uEI5abnyPAw5e5WwERlMB8GA1UdIwQYMBaAFFWg
xzAg/uEI5abnyPAw5e5WwERlMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
BQADggEBADtexTuCwtzmd7JonEVLTuLGOd05Q4SyTvc/ccpyiv6xCWEDpVMZCz6Z
7wloTLArKq43kkWHf0h0sKQ4PaXc5z8t6lCfb+1E/PVmie6fs4e/5zz52z7ALlB7
I6qKZobyb997JbtZhlNdIYFlQW6SShGKntWYyfjS3SCK0Je3ObQruN0/fd1B1Ld2
4n0MKR7uswYoaJC3xiOcSFUSQq9LbnGsxSyZzHNTaPHVmFxXxGESfFueO0SyjG/Q
xUiOM3gKu/HPPjqhKiT4bg76RBt0uRchcozViKWkvnHZh6rR5OOX+CLMegTXIVsh
QV2VZkuOb0ZMPC/7I9rY/S8PLMdt4ps=
-----END CERTIFICATE-----
55 changes: 28 additions & 27 deletions juseppe-cli/src/test/resources/serve/cert/uc.key
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAoAhYmHhRmtI+afJtctDoyiXDnyfj6UHxqWnYXBO39xMCDHTj
WmYdkCLjzzNRl8d+MmfmX8XHfJy3iOpFa9sxACf12lQ/kd1PuYkNbJ9mQCmVJD3X
G6woMrKKex4ot7DMnkIDCf5Q+zPwlo/GEkiMQSZy8JWpBLPVm4GTodAwQhgGojGw
z2TlNO675wEnoe+Y0jXpInDiBbPSwero0ZFKL2t+tl4jATStT6u6BnDdiwpnEC7f
wXZt4lf4MgTVmo+C7cxeCM0QEso7UqFA8i+ZouBJ6QXJpdjHvNs/aMJD/Z+UrZa/
BI1pXH0xkrXWJnOqFZYt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YKHUJ
t2u9OIwpTcmK1rCuA+TjSkegttNsiWdLrlUh6iyZNnGSxmVb6ThslkN1gsmPW8KM
KlUZkuM/RpKHgttXmYb0Prjf+QKBgQDbaXdecIb1iVPmuTw5UKoeObODeRCiTUZN
msKnYtsuvwDRsfaopPc9/cXhGAmxxBPuyFw1NXBrnRxFsJcEC1DTQDA0UnqhI1B0
w9TLWFpRPuEfMTu6qSRW/dKYmpUY6GKEGnBFX00xQEFvFYDNNSk3d/t6FRQNIHBN
wGVmo0MDYQKBgQCZnUxRPDp/UDpIZgvYGxlrGw0vsKJURAfTPm6FbYbDjoDGVZ9l
deef1VDt6C7otlYPHmBNnMvU5Hc+lDpXMWNRLV0Bt5SB2SGMhfo9iSuG5AepJj34
VNoKu7vJ5eNLpQLj8+a5WrPl/MV6pxiBbUGwzMKhWzaeaWbXXmSsGbLSiQKBgDKF
HDkgi9KpZiov6JAB5MnE23KgQ5Y7WL6xrbRA7Nrcm+GsqnC2Wz9o2VE06baGwVgv
xhtyTIpayJG7UWpa+KdLlk3V1+qWaQYZuTuBAnrGkatO+MPIAlgNZZpBraboixaD
x+oRQYLfmrFrMBcP8IeXFs5LYCyNlY4xiKeTW/DBAoGAUFt40V1zJslr/K/d8J6Z
sPZPixpJIQMHVnFio7cx7bNIi6zqLk1501LKGtdUiKQ2020QpiMltkFCDcZfuOuo
dECVfd6v4R0ylXseMzQeGOXpfG/Tgpk42XreykPPz/q47nJRnHfuCB6hKbt56JJW
ZryGBu5iFCJPyASvqd0sJvQ=
-----END PRIVATE KEY-----
13 changes: 12 additions & 1 deletion juseppe-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api -->
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>

<build>
Expand All @@ -86,16 +93,20 @@
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.4.7</version>
<version>1.2.2</version>
<configuration>
<sourceDirectory>${project.basedir}/src/main/resources/jsonschema</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/java-gen</outputDirectory>
<targetPackage>ru.lanwen.jenkins.juseppe.beans</targetPackage>
<annotationStyle>gson</annotationStyle>
<includeToString>false</includeToString>
<includeHashcodeAndEquals>false</includeHashcodeAndEquals>
<includeJsr303Annotations>true</includeJsr303Annotations>
<includeJsr305Annotations>false</includeJsr305Annotations>
<useJakartaValidation>true</useJakartaValidation>
<sourceType>jsonschema</sourceType>
<generateBuilders>true</generateBuilders>
<includeGeneratedAnnotation>false</includeGeneratedAnnotation>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Path save() {
try {
return Files.write(whereToSave, Collections.singleton(view.content()));
} catch (IOException e) {
throw new RuntimeException(String.format("Can't save json to file %s", whereToSave.toAbsolutePath()), e);
throw new RuntimeException("Can't save json to file %s".formatted(whereToSave.toAbsolutePath()), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ public Signature sign(UpdateSite site) throws GeneralSecurityException, IOExcept
X509Certificate signer = certs.get(0); // the first one is the signer, and the rest is the chain to a root CA.

Object o = new PEMParser(new FileReader(privateKey)).readObject();
isInstanceOf(PEMKeyPair.class, o, "File %s is not rsa private key!", privateKey);
PrivateKeyInfo key = ((PEMKeyPair) o).getPrivateKeyInfo();
PrivateKeyInfo key;
if(o instanceof PEMKeyPair keyPair) {
key = keyPair.getPrivateKeyInfo();
} else if(o instanceof PrivateKeyInfo) {
key = (PrivateKeyInfo) o;
} else {
throw new IllegalArgumentException(String.format("File %s is not rsa private key!", privateKey));
}

SignatureGenerator signatureGenerator = new SignatureGenerator(signer, key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
import ru.lanwen.jenkins.juseppe.props.Props;

import java.io.IOException;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;

import static java.lang.String.format;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
import static ru.lanwen.jenkins.juseppe.props.Props.populated;
Expand Down Expand Up @@ -54,11 +53,11 @@ public UpdateSiteGen withDefaults() {
site -> site.withUpdateCenterVersion(Props.UPDATE_CENTER_VERSION)
.withId(props.getUcId())
).register(
site -> Collections.singleton(new PathPluginSource(Paths.get(props.getPluginsDir()), props.getRecursiveWatch()))
site -> Collections.singleton(new PathPluginSource(Path.of(props.getPluginsDir()), props.getRecursiveWatch()))
.forEach(source -> site.getPlugins().addAll(source.plugins()))
).register(
site -> site.getPlugins()
.forEach(plugin -> plugin.setUrl(format("%s/%s", props.getBaseurl(), plugin.getUrl())))
.forEach(plugin -> plugin.setUrl("%s/%s".formatted(props.getBaseurl(), plugin.getUrl())))
).register(
site -> {
try {
Expand Down Expand Up @@ -86,7 +85,7 @@ public SavableSitesCollection toSave() {
new JsonpUpdateSite(filled, props.getUcJsonName()),
new ReleaseHistoryUpdateSite(filled, props.getReleaseHistoryJsonName())
)
.map(view -> new SavableSite(Paths.get(props.getSaveto()), view))
.map(view -> new SavableSite(Path.of(props.getSaveto()), view))
.collect(toList());

return new SavableSitesCollection(files);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import ru.lanwen.jenkins.juseppe.beans.Plugin;
import ru.lanwen.jenkins.juseppe.gen.HPI;

import static java.lang.String.format;

/**
* @author lanwen (Merkushev Kirill)
*/
Expand Down Expand Up @@ -50,7 +48,7 @@ public List<Plugin> plugins() {
}
}).filter(Objects::nonNull).collect(Collectors.toList());
} catch (IOException e) {
throw new RuntimeException(format("Can't read path %s", pluginsDir.toAbsolutePath()), e);
throw new RuntimeException("Can't read path %s".formatted(pluginsDir.toAbsolutePath()), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public JsonpUpdateSite(UpdateSite site, String name) {
@Override
public String content() {
String json = UpdateSiteSerializer.serializer().toJson(site);
return String.format("updateCenter.post(%n%s%n);", json);
return "updateCenter.post(%n%s%n);".formatted(json);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.junit.Test;
import ru.lanwen.jenkins.juseppe.beans.Plugin;

import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.List;

import static com.google.common.io.Resources.getResource;
Expand All @@ -21,7 +21,7 @@ public class PathPluginSourceTest {
@Test
public void shouldFindAllPlugins() throws Exception {
boolean recursiveWatch = false;
List<Plugin> plugins = new PathPluginSource(Paths.get(getResource(PLUGINS_DIR_CLASSPATH).getFile()),
List<Plugin> plugins = new PathPluginSource(Path.of(getResource(PLUGINS_DIR_CLASSPATH).getFile()),
recursiveWatch)
.plugins();

Expand All @@ -33,7 +33,7 @@ public void shouldFindAllPlugins() throws Exception {
@Test
public void shouldFindAllPluginsRecursively() throws Exception {
boolean recursiveWatch = true;
List<Plugin> plugins = new PathPluginSource(Paths.get(getResource(PLUGINS_DIR_CLASSPATH).getFile()),
List<Plugin> plugins = new PathPluginSource(Path.of(getResource(PLUGINS_DIR_CLASSPATH).getFile()),
recursiveWatch)
.plugins();

Expand Down
Loading

0 comments on commit b123d01

Please sign in to comment.