diff --git a/README.md b/README.md index c9ba6fe..027b98a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ (Example: If MySQL server `max_allowed_packet` parameter is too small - [64 MB by default](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet)) * Appends emoji country flags 🇦🇩 🇦🇪 🇦🇫 🇦🇬 🇦🇮 🇦🇱 🇦🇲 🇦🇴 🇦🇶 🇦🇷 🇦🇸 🇦🇹 🇦🇺 🇦🇼 🇦🇽 🇦🇿 🇧🇦 🇧🇧 🇧🇩 🇧🇪 🇧🇫 🇧🇬 🇧🇭 🇧🇮 🇧🇯 🇧🇱 🇧🇲 🇧🇳 🇧🇴 🇧🇶 🇧🇷 🇧🇸 🇧🇹 🇧🇻 🇧🇼 🇧🇾... * Supports MaxMind edition IDs: `GeoLite2-Country-CSV, GeoLite2-City-CSV`; `IPv4, IPv6`; Locations locale codes: `en, ru, de, es, fr, ja, pt-BR, zh-CN` -* Provides configuration files and template engine syntax for build DDL/DML for MySQL/PostgreSQL/Microsoft SQL Server 2019/your custom. For custom DBMS, you can write a template yourself. +* Provides [template-ready configuration files](https://github.com/mbto/maxmind-geoip2-csv2sql-converter/tree/master/src/main/resources) for `MySQL 8/PostgreSQL 13/Microsoft SQL Server 2019` and template engine with simple syntax for build DDL/DML. For custom DBMS, you can write a template yourself. * Win/Unix distribution #### Requirements: @@ -24,6 +24,6 @@ * Requirements: * Gradle 5.4+ * With tests: - * gradle build + * gradlew.bat build * Without tests: - * gradle build -x test + * gradlew.bat build -x test diff --git a/src/main/java/com/github/mbto/maxmind/geoip2/csv2sql/Registry.java b/src/main/java/com/github/mbto/maxmind/geoip2/csv2sql/Registry.java index f2c65d0..4c723c5 100644 --- a/src/main/java/com/github/mbto/maxmind/geoip2/csv2sql/Registry.java +++ b/src/main/java/com/github/mbto/maxmind/geoip2/csv2sql/Registry.java @@ -79,11 +79,11 @@ public void allocateRegistrySettings() { } public void allocateScriptsPath() throws IOException { - String archiveNameWithoutDot = archivePath.getFileName().toString(); - int dot = archiveNameWithoutDot.lastIndexOf('.'); - archiveNameWithoutDot = dot > -1 ? archiveNameWithoutDot.substring(0, dot) : archiveNameWithoutDot; - scriptsPath = args.getOutputDirPath().resolve(archiveNameWithoutDot); - if (Files.notExists(scriptsPath)) +// String archiveNameWithoutDot = archivePath.getFileName().toString(); +// int dot = archiveNameWithoutDot.lastIndexOf('.'); +// archiveNameWithoutDot = dot > -1 ? archiveNameWithoutDot.substring(0, dot) : archiveNameWithoutDot; + scriptsPath = args.getOutputDirPath();//.resolve(archiveNameWithoutDot); + if (!Files.isDirectory(scriptsPath)) Files.createDirectories(scriptsPath); System.out.println("Resolved scripts path '" + scriptsPath + "'"); diff --git a/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/Constants.java b/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/Constants.java index 6572219..28a66d5 100644 --- a/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/Constants.java +++ b/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/Constants.java @@ -57,10 +57,9 @@ static String buildIntegrationOutputDirPath(String testId) { return testId.isEmpty() ? integrationTestsDirPath.toString() : integrationTestsDirPath.resolve(testId).toString(); } - static Path buildFullArchivePath(String editionId, String testId) { + static Path buildFullArchivePath(String testId) { return integrationTestsDirPath .resolve(testId) - .resolve(editionId + "_" + archiveDate) .resolve(resultArchiveName); } @@ -94,7 +93,7 @@ static void assertStats(String[] argsRaw, String editionId, String testId, t = e; } - Path fullArchivePath = buildFullArchivePath(editionId, testId); + Path fullArchivePath = buildFullArchivePath(testId); Assert.assertTrue("Path '" + fullArchivePath + "' not a file", Files.exists(fullArchivePath) && Files.isRegularFile(fullArchivePath)); long actualArchiveFileSize = Files.size(fullArchivePath); @@ -109,8 +108,8 @@ static void assertStats(String[] argsRaw, String editionId, String testId, "),\n\t\t\t\t\t\t" + actualArchiveFileSize + "},"))); } if (delete) { - // Deleting testId direcroty from: R:\IntegrationTests\SOFTWARE_NAME\testId\editionId + archiveDate\resultArchiveName - deleteRecursive(fullArchivePath.getParent().getParent()); + // Deleting testId direcroty from: R:\IntegrationTests\SOFTWARE_NAME\testId\resultArchiveName + deleteRecursive(fullArchivePath.getParent()); } Assert.assertNull(t); Assert.assertNotNull(application); diff --git a/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/ManualTest.java b/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/ManualTest.java index ce3518b..4b310a2 100644 --- a/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/ManualTest.java +++ b/src/test/java/com/github/mbto/maxmind/geoip2/csv2sql/ManualTest.java @@ -45,6 +45,8 @@ public void manualBuild1() throws Throwable { // args.setApiURI(); args.setDeleteCSVs(false); args.setDeleteScripts(false); +// args.setDeleteCSVs(true); +// args.setDeleteScripts(true); registry.allocateRegistrySettings(); args.setSourceArchiveURI(resourceTestsDirPath.resolve(buildArchiveName(registry.getEditionId())).toString());