mirror of
https://github.com/ethauvin/bld.git
synced 2025-04-26 08:37:11 -07:00
Draft implementations of JpackageOperation, JmodOperation and JlinkOperation
This commit is contained in:
parent
aeecd957c6
commit
547b20a242
11 changed files with 1890 additions and 0 deletions
26
src/test/java/rife/bld/operations/TestJlinkOperation.java
Normal file
26
src/test/java/rife/bld/operations/TestJlinkOperation.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
|
||||
package rife.bld.operations;
|
||||
|
||||
import org.junit.Test;
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestJlinkOperation {
|
||||
@Test
|
||||
public void TestNoArguments() {
|
||||
var jlink = new JlinkOperation();
|
||||
assertThrows(ExitStatusException.class, jlink::execute);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestVersion() {
|
||||
var jlink = new JlinkOperation().toolArg("--version");
|
||||
assertDoesNotThrow(jlink::execute);
|
||||
}
|
||||
}
|
26
src/test/java/rife/bld/operations/TestJmodOperation.java
Normal file
26
src/test/java/rife/bld/operations/TestJmodOperation.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
|
||||
package rife.bld.operations;
|
||||
|
||||
import org.junit.Test;
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestJmodOperation {
|
||||
@Test
|
||||
public void TestNoArguments() {
|
||||
var jmod = new JmodOperation();
|
||||
assertThrows(ExitStatusException.class, jmod::execute);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestVersion() {
|
||||
var jmod = new JmodOperation().operationMode(JmodOperation.OperationMode.DESCRIBE).toolArg("--version");
|
||||
assertDoesNotThrow(jmod::execute);
|
||||
}
|
||||
}
|
56
src/test/java/rife/bld/operations/TestJpackageOperation.java
Normal file
56
src/test/java/rife/bld/operations/TestJpackageOperation.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
|
||||
package rife.bld.operations;
|
||||
|
||||
import org.junit.Test;
|
||||
import rife.bld.operations.exceptions.ExitStatusException;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestJpackageOperation {
|
||||
@Test
|
||||
public void TestCreatePackage() throws Exception {
|
||||
var tmpdir = Files.createTempDirectory("bld-jpackage-test").toFile();
|
||||
tmpdir.deleteOnExit();
|
||||
var options = new JpackageOptions()
|
||||
.input("lib/bld")
|
||||
.name("bld")
|
||||
.mainJar("bld-wrapper.jar")
|
||||
.javaOptions("--enable-preview")
|
||||
.dest(tmpdir.getAbsolutePath())
|
||||
.verbose(true);
|
||||
|
||||
var os = System.getProperty("os.name");
|
||||
if (os.startsWith("Windows")) {
|
||||
options.type(JpackageOptions.PackageType.EXE);
|
||||
} else if (os.startsWith("Linux")) {
|
||||
options.type(JpackageOptions.PackageType.DEB);
|
||||
} else if (os.startsWith("Mac")) {
|
||||
options.type(JpackageOptions.PackageType.DMG);
|
||||
}
|
||||
|
||||
var jpackage = new JpackageOperation().jpackageOptions(options);
|
||||
jpackage.execute();
|
||||
|
||||
var deb = new File(tmpdir, "bld_1.0-1_amd64.deb");
|
||||
assertTrue(deb.delete());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestNoArguments() {
|
||||
var jpackage = new JpackageOperation();
|
||||
assertThrows(ExitStatusException.class, jpackage::execute);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestVersion() {
|
||||
var jpackage = new JpackageOperation().toolArg("--version");
|
||||
assertDoesNotThrow(jpackage::execute);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue