Adds some still not working code for building spigot and bukkit .jar files
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
All checks were successful
KnarCraft/Minecraft-Server-Launcher/pipeline/head This commit looks good
This commit is contained in:
@ -0,0 +1,79 @@
|
||||
package net.knarcraft.minecraftserverlauncher.utility;
|
||||
|
||||
import net.knarcraft.minecraftserverlauncher.Main;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class JarBuilderTest {
|
||||
|
||||
private static JarBuilder jarBuilder;
|
||||
private static String targetDirectory;
|
||||
private static String jarDirectory;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
targetDirectory = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator +
|
||||
"BuildTools" + File.separator;
|
||||
jarDirectory = Main.getApplicationWorkDirectory() + File.separator + "files" + File.separator +
|
||||
"testjars" + File.separator;
|
||||
jarBuilder = new JarBuilder(targetDirectory, jarDirectory);
|
||||
removeBuildToolsFiles();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void buildLatestSpigotJarTest() {
|
||||
jarBuilder.buildSpigotJar();
|
||||
assertTrue(new File(jarDirectory + "SpigotLatest.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void buildLatestBukkitJarTest() {
|
||||
jarBuilder.buildBukkitJar();
|
||||
assertTrue(new File(jarDirectory + "BukkitLatest.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void downloadLatestBuildToolsJarTest() {
|
||||
jarBuilder.downloadBuildTools();
|
||||
assertTrue(new File(targetDirectory + "BuildTools.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void getLatestBuildToolsVersionTest() {
|
||||
try {
|
||||
String latestVersion = jarBuilder.getLatestBuildToolsVersion();
|
||||
assertNotEquals("", latestVersion);
|
||||
int newVersion = Integer.parseInt(latestVersion);
|
||||
assertNotEquals(newVersion, 0);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes build tools files
|
||||
*/
|
||||
private static void removeBuildToolsFiles() {
|
||||
File target = new File(targetDirectory);
|
||||
if (!target.exists() && !target.mkdirs()) {
|
||||
throw new IllegalArgumentException("Unable to create the test files directory");
|
||||
}
|
||||
CommonFunctions.removeFilesRecursively(target);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user