private static final URI BASE_URI = URI.create("http://localhost:8080/");
private static URI baseUri;
public static void main(final String[] args) throws Exception {
baseUri = args.length > 0 ? URI.create(args[0]) : BASE_URI;
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, createApp());
LOG.info("Jersey performance test data generation - application started.");
try {
// generate text files - 1kb, 5kb, 10kb, 1MB and optionally 1GB
generateFile("simple/text", 1024, FILE_PATH + "custom-1kb.text");
generateFile("simple/text", 5 * 1024, FILE_PATH + "custom-5kb.text");
generateFile("simple/text", 10 * 1024, FILE_PATH + "custom-10kb.text");
generateFile("simple/text", 1024 * 1024, FILE_PATH + "custom-1MB.text");
if (GENERATE_ALSO_GIGABYTE_DATASETS) {
generateFile("text", 1024 * 1024 * 1024, FILE_PATH + "custom-1GB.text");
}
// generate json files - 1kb, 5kb, 10kb, 1MB and optionally 1GB
generateFile("simple/json", 1024, FILE_PATH + "custom-1kb.json");
generateFile("simple/json", 5 * 1024, FILE_PATH + "custom-5kb.json");
generateFile("simple/json", 10 * 1024, FILE_PATH + "custom-10kb.json");
generateFile("simple/json", 1024 * 1024, FILE_PATH + "custom-1MB.json");
if (GENERATE_ALSO_GIGABYTE_DATASETS) {
generateFile("simple/json", 1024 * 1024 * 1024, FILE_PATH + "custom-1GB.json");
}
// generate xml files - 1kb, 5kb, 10kb, 1MB and optionally 1GB
generateFile("simple/xml", 1024, FILE_PATH + "custom-1kb.xml");
generateFile("simple/xml", 5 * 1024, FILE_PATH + "custom-5kb.xml");
generateFile("simple/xml", 10 * 1024, FILE_PATH + "custom-10kb.xml");
generateFile("simple/xml", 1024 * 1024, FILE_PATH + "custom-1MB.xml");
if (GENERATE_ALSO_GIGABYTE_DATASETS) {
generateFile("simple/xml", 1024 * 1024 * 1024, FILE_PATH + "custom-1GB.json");
}
} catch (final IOException e) {
LOG.log(Level.SEVERE, "An error occurred during test data generation. ", e);
}
server.shutdown();
}