Package h07
Class Installer
- java.lang.Object
-
- h07.Installer
-
public class Installer extends Object
Installer for the community tests.
This is a standalone class that can download all necessary files to run tests for this assignment. More specifically, it can download all files whose hashes are listed in.test_metadata.xml
. This class can also be used to reset or rather re-download files that have become corrupted or have otherwise been modified.
It is important that the working directory is the same as the project root directory when runningmain(String[])
, otherwise the files might be downloaded to the wrong location or even overwrite other files!
-
-
Field Summary
Fields Modifier and Type Field Description private static String
ASSIGNMENT_ID
The ID of this assignment
-
Constructor Summary
Constructors Constructor Description Installer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static HttpResponse<String>
getHttpResource(String resource)
Requests a resource / file from the repository.static void
main(String[] args)
Test installer / downloaderprivate static void
updateLocal(String fileName)
Creates (or overwrites) the specified file with the contents of the file at the repository.
-
-
-
Field Detail
-
ASSIGNMENT_ID
private static final String ASSIGNMENT_ID
The ID of this assignment- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(String[] args) throws Exception
Test installer / downloader- Parameters:
args
- An array of filenames to download. All filenames have to be relative to project root. If any are given, only those will be downloaded (and overwritten). If none are given, all files whose hashes are in.test_metadata.xml
will be downloaded (and overwritten).- Throws:
Exception
-
getHttpResource
private static HttpResponse<String> getHttpResource(String resource) throws IOException, InterruptedException
Requests a resource / file from the repository.- Parameters:
resource
- The resource to get from the repository.- Returns:
- a
HttpResponse
object - Throws:
IOException
InterruptedException
-
updateLocal
private static void updateLocal(String fileName) throws IOException, InterruptedException
Creates (or overwrites) the specified file with the contents of the file at the repository. All missing directories will be created automatically.- Parameters:
fileName
- The file with path relative to project root.- Throws:
IOException
InterruptedException
-
-