diff --git a/README.md b/README.md index 4d53969d1..7e3815118 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,24 @@ Usage: dbptk [plugin] [import module options] [exp ## Available import modules: -i , --import=module -Import module: MySQLJDBC +Import module: microsoft-sql-server + -is, --import-server-name=value (required) the name (host name) of the server + -idb, --import-database=value (required) the name of the database we'll be accessing + -iu, --import-username=value (required) the name of the user to use in the connection + -ip, --import-password=value (required) the password of the user to use in the connection + -il, --import-use-integrated-login (optional) use windows login; by default the SQL Server login is used + -ide, --import-disable-encryption (optional) use to turn off encryption in the connection + -iin, --import-instance-name=value (optional) the name of the instance + -ipn, --import-port-number=value (optional) the port number of the server instance, default is 1433 + +Import module: mysql -ih, --import-hostname=value (required) the hostname of the MySQL server -idb, --import-database=value (required) the name of the database to import from -iu, --import-username=value (required) the name of the user to use in connection -ip, --import-password=value (required) the password of the user to use in connection -ipn, --import-port-number=value (optional) the port that the MySQL server is listening -Import module: PostgreSQLJDBC +Import module: postgresql -ih, --import-hostname=value (required) the name of the PostgreSQL server host (e.g. localhost) -idb, --import-database=value (required) the name of the database to connect to -iu, --import-username=value (required) the name of the user to use in connection @@ -48,32 +58,32 @@ Import module: PostgreSQLJDBC -ide, --import-disable-encryption (optional) use to turn off encryption in the connection -ipn, --import-port-number=value (optional) the port of where the PostgreSQL server is listening, default is 5432 -Import module: SIARD1 +Import module: siard-1 -if, --import-file=value (required) Path to SIARD1 archive file -Import module: SIARD2 +Import module: siard-2 -if, --import-file=value (required) Path to SIARD2 archive file -Import module: SQLServerJDBC - -is, --import-server-name=value (required) the name (host name) of the server - -idb, --import-database=value (required) the name of the database we'll be accessing - -iu, --import-username=value (required) the name of the user to use in the connection - -ip, --import-password=value (required) the password of the user to use in the connection - -il, --import-use-integrated-login (optional) use windows login; by default the SQL Server login is used - -ide, --import-disable-encryption (optional) use to turn off encryption in the connection - -iin, --import-instance-name=value (optional) the name of the instance - -ipn, --import-port-number=value (optional) the port number of the server instance, default is 1433 - ## Available export modules: -e , --export=module -Export module: MySQLJDBC +Export module: microsoft-sql-server + -es, --export-server-name=value (required) the name (host name) of the server + -edb, --export-database=value (required) the name of the database we'll be accessing + -eu, --export-username=value (required) the name of the user to use in the connection + -ep, --export-password=value (required) the password of the user to use in the connection + -el, --export-use-integrated-login (optional) use windows login; by default the SQL Server login is used + -ede, --export-disable-encryption (optional) use to turn off encryption in the connection + -ein, --export-instance-name=value (optional) the name of the instance + -epn, --export-port-number=value (optional) the port number of the server instance, default is 1433 + +Export module: mysql -eh, --export-hostname=value (required) the hostname of the MySQL server -edb, --export-database=value (required) the name of the database to import from -eu, --export-username=value (required) the name of the user to use in connection -ep, --export-password=value (required) the password of the user to use in connection -epn, --export-port-number=value (optional) the port that the MySQL server is listening -Export module: PostgreSQLJDBC +Export module: postgresql -eh, --export-hostname=value (required) the name of the PostgreSQL server host (e.g. localhost) -edb, --export-database=value (required) the name of the database to connect to -eu, --export-username=value (required) the name of the user to use in connection @@ -81,31 +91,21 @@ Export module: PostgreSQLJDBC -ede, --export-disable-encryption (optional) use to turn off encryption in the connection -epn, --export-port-number=value (optional) the port of where the PostgreSQL server is listening, default is 5432 -Export module: SIARD1 +Export module: siard-1 -ef, --export-file=value (required) Path to SIARD1 archive file -ec, --export-compress (optional) use to compress the SIARD1 archive file with deflate method -ep, --export-pretty-xml (optional) write human-readable XML -Export module: SIARD2 +Export module: siard-2 -ef, --export-file=value (required) Path to SIARD2 archive file -ec, --export-compress (optional) use to compress the SIARD2 archive file with deflate method -ep, --export-pretty-xml (optional) write human-readable XML -Export module: SIARDDK +Export module: siard-dk -ef, --export-folder=value (required) Path to SIARDDK archive folder -eai, --export-archiveIndex=value (optional) Path to archiveIndex.xml input file -eci, --export-contextDocumentationIndex=value (optional) Path to contextDocumentationIndex.xml input file -ecf, --export-contextDocumentationFolder=value (optional) Path to contextDocumentation folder which should contain the context documentation for the archive - -Export module: SQLServerJDBC - -es, --export-server-name=value (required) the name (host name) of the server - -edb, --export-database=value (required) the name of the database we'll be accessing - -eu, --export-username=value (required) the name of the user to use in the connection - -ep, --export-password=value (required) the password of the user to use in the connection - -el, --export-use-integrated-login (optional) use windows login; by default the SQL Server login is used - -ede, --export-disable-encryption (optional) use to turn off encryption in the connection - -ein, --export-instance-name=value (optional) the name of the instance - -epn, --export-port-number=value (optional) the port number of the server instance, default is 1433 ``` You have to select an input and an output module, providing for each its configuration. diff --git a/dbptk-core/src/main/java/com/databasepreservation/cli/CLI.java b/dbptk-core/src/main/java/com/databasepreservation/cli/CLI.java index 18f3a9534..9940fb1ec 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/cli/CLI.java +++ b/dbptk-core/src/main/java/com/databasepreservation/cli/CLI.java @@ -210,10 +210,10 @@ private DatabaseModuleFactoriesPair getModuleFactories(List args) throws DatabaseModuleFactory exportModuleFactory = null; for (DatabaseModuleFactory factory : factories) { String moduleName = factory.getModuleName(); - if (moduleName.equals(importModuleName) && factory.producesImportModules()) { + if (moduleName.equalsIgnoreCase(importModuleName) && factory.producesImportModules()) { importModuleFactory = factory; } - if (moduleName.equals(exportModuleName) && factory.producesExportModules()) { + if (moduleName.equalsIgnoreCase(exportModuleName) && factory.producesExportModules()) { exportModuleFactory = factory; } } diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/db2/DB2ModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/db2/DB2ModuleFactory.java index af8308f2e..b73323519 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/db2/DB2ModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/db2/DB2ModuleFactory.java @@ -48,7 +48,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "DB2JDBC"; + return "db2"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/mySql/MySQLModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/mySql/MySQLModuleFactory.java index 17b9986f4..4ea2978bc 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/mySql/MySQLModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/mySql/MySQLModuleFactory.java @@ -50,7 +50,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "MySQLJDBC"; + return "mysql"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/postgreSql/PostgreSQLModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/postgreSql/PostgreSQLModuleFactory.java index 663ac643c..e5b99fb88 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/postgreSql/PostgreSQLModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/postgreSql/PostgreSQLModuleFactory.java @@ -55,7 +55,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "PostgreSQLJDBC"; + return "postgresql"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD1ModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD1ModuleFactory.java index b3c7ec762..45c4e34d7 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD1ModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD1ModuleFactory.java @@ -44,7 +44,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "SIARD1"; + return "siard-1"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD2ModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD2ModuleFactory.java index 61440b6e9..f6eab1177 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD2ModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARD2ModuleFactory.java @@ -55,7 +55,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "SIARD2"; + return "siard-2"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARDDKModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARDDKModuleFactory.java index d0fa11956..6e4fd4ee5 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARDDKModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/siard/SIARDDKModuleFactory.java @@ -47,7 +47,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "SIARDDK"; + return "siard-dk"; } @Override diff --git a/dbptk-core/src/main/java/com/databasepreservation/modules/sqlServer/SQLServerJDBCModuleFactory.java b/dbptk-core/src/main/java/com/databasepreservation/modules/sqlServer/SQLServerJDBCModuleFactory.java index 43831863a..1c3dc3877 100644 --- a/dbptk-core/src/main/java/com/databasepreservation/modules/sqlServer/SQLServerJDBCModuleFactory.java +++ b/dbptk-core/src/main/java/com/databasepreservation/modules/sqlServer/SQLServerJDBCModuleFactory.java @@ -63,7 +63,7 @@ public boolean producesExportModules() { @Override public String getModuleName() { - return "SQLServerJDBC"; + return "microsoft-sql-server"; } @Override diff --git a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/MySqlTest.java b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/MySqlTest.java index 9a71ec983..66e60fcde 100644 --- a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/MySqlTest.java +++ b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/MySqlTest.java @@ -44,11 +44,11 @@ public void setup() throws IOException, InterruptedException, URISyntaxException db_source), String.format("mysqldump -v --user=\"%s\" --password=\"%s\" %s --compact", db_tmp_username, db_tmp_password, db_target), - new String[] {"--import=MySQLJDBC", "--import-hostname=localhost", "--import-database", db_source, - "--import-username", db_tmp_username, "--import-password", db_tmp_password, "--export=SIARD1", + new String[] {"--import=mysql", "--import-hostname=localhost", "--import-database", db_source, + "--import-username", db_tmp_username, "--import-password", db_tmp_password, "--export=siard-1", "--export-compress", "--export-file", Roundtrip.TMP_FILE_SIARD_VAR}, - new String[] {"--import=SIARD1", "--import-file", Roundtrip.TMP_FILE_SIARD_VAR, "--export=MySQLJDBC", + new String[] {"--import=siard-1", "--import-file", Roundtrip.TMP_FILE_SIARD_VAR, "--export=mysql", "--export-hostname=localhost", "--export-database", db_target, "--export-username", db_tmp_username, "--export-password", db_tmp_password}, diff --git a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/PostgreSqlTest.java b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/PostgreSqlTest.java index 5b12f4757..54c3cb949 100644 --- a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/PostgreSqlTest.java +++ b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/PostgreSqlTest.java @@ -57,11 +57,11 @@ public void setup() throws IOException, InterruptedException, URISyntaxException "pg_dump --format plain --no-owner --no-privileges --column-inserts --no-security-labels --no-tablespaces", "pg_dump --format plain --no-owner --no-privileges --column-inserts --no-security-labels --no-tablespaces", - new String[] {"--import=PostgreSQLJDBC", "--import-hostname=localhost", "--import-database", db_source, + new String[] {"--import=postgresql", "--import-hostname=localhost", "--import-database", db_source, "--import-username", db_tmp_username, "--import-password", db_tmp_password, "--import-disable-encryption", - "--export=SIARD1", "--export-file", Roundtrip.TMP_FILE_SIARD_VAR}, + "--export=siard-1", "--export-file", Roundtrip.TMP_FILE_SIARD_VAR}, - new String[] {"--import=SIARD1", "--import-file", Roundtrip.TMP_FILE_SIARD_VAR, "--export=PostgreSQLJDBC", + new String[] {"--import=siard-1", "--import-file", Roundtrip.TMP_FILE_SIARD_VAR, "--export=postgresql", "--export-hostname=localhost", "--export-database", db_target, "--export-username", db_tmp_username, "--export-password", db_tmp_password, "--export-disable-encryption"}, new PostgreSqlDumpDiffExpectations(), env_var_source, env_var_target); diff --git a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/SqlServerTest.java b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/SqlServerTest.java index a483e859f..6f181c3a8 100644 --- a/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/SqlServerTest.java +++ b/dbptk-core/src/test/java/com/databasepreservation/testing/integration/roundtrip/SqlServerTest.java @@ -123,8 +123,8 @@ private Connection setup() throws SQLException { public void testConnection() throws IOException, InterruptedException, SQLException { setup(); - Main.internal_main("-i", "SQLServerJDBC", "-is", SERVER_NAME, "-iin", INSTANCE_NAME, "-idb", db_source, "-iu", - USERNAME, "-ip", PASSWORD, "-e", "SIARD1", "-ef", SIARD_FILE, "-ide"); + Main.internal_main("-i", "microsoft-sql-server", "-is", SERVER_NAME, "-iin", INSTANCE_NAME, "-idb", db_source, "-iu", + USERNAME, "-ip", PASSWORD, "-e", "siard-1", "-ef", SIARD_FILE, "-ide"); } } diff --git a/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/PostgreSQLModuleFactoryTest.java b/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/PostgreSQLModuleFactoryTest.java index d38f35e83..a05ed54b3 100644 --- a/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/PostgreSQLModuleFactoryTest.java +++ b/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/PostgreSQLModuleFactoryTest.java @@ -25,9 +25,9 @@ public class PostgreSQLModuleFactoryTest { @Test public void arguments_required_long() { - List args = Arrays.asList("--import=PostgreSQLJDBC", "--import-username=name-user", + List args = Arrays.asList("--import=postgresql", "--import-username=name-user", "--import-password=abc1 23=456", "--import-hostname=the-server-name", "--import-database=dbname", - "--export=PostgreSQLJDBC", "--export-username=name-another-user", "--export-password=2bcd123=456", + "--export=postgresql", "--export-username=name-another-user", "--export-password=2bcd123=456", "--export-hostname=another-server", "--export-database=another-db-name", "--import-disable-encryption"); // test parameters for import module @@ -50,8 +50,8 @@ public void arguments_required_long() { @Test public void arguments_required_short() { - List args = Arrays.asList("-i", "PostgreSQLJDBC", "-iu", "name-user", "-ip", "abc1 23=456", "-ih", - "the-server-name", "-idb", "dbname", "-e", "PostgreSQLJDBC", "-eu", "name-another-user", "-ep", "2bcd123=456", + List args = Arrays.asList("-i", "postgresql", "-iu", "name-user", "-ip", "abc1 23=456", "-ih", + "the-server-name", "-idb", "dbname", "-e", "postgresql", "-eu", "name-another-user", "-ep", "2bcd123=456", "-eh", "another-server", "-edb", "another-db-name", "-ede"); // test parameters for import module @@ -75,9 +75,9 @@ public void arguments_required_short() { @Test public void arguments_portNumber_long() { - List args = Arrays.asList("--import=PostgreSQLJDBC", "--import-username=name-user", + List args = Arrays.asList("--import=postgresql", "--import-username=name-user", "--import-password=abc1 23=456", "--import-hostname=the-server-name", "--import-database=dbname", - "--export=PostgreSQLJDBC", "--export-username=name-another-user", "--export-password=2bcd123=456", + "--export=postgresql", "--export-username=name-another-user", "--export-password=2bcd123=456", "--export-hostname=another-server", "--export-database=another-db-name", "--import-disable-encryption", "--import-port-number=1234", "--export-port-number=4321"); @@ -103,8 +103,8 @@ public void arguments_portNumber_long() { @Test public void arguments_portNumber_short() { - List args = Arrays.asList("-i", "PostgreSQLJDBC", "-iu", "name-user", "-ip", "abc1 23=456", "-ih", - "the-server-name", "-idb", "dbname", "-e", "PostgreSQLJDBC", "-eu", "name-another-user", "-ep", "2bcd123=456", + List args = Arrays.asList("-i", "postgresql", "-iu", "name-user", "-ip", "abc1 23=456", "-ih", + "the-server-name", "-idb", "dbname", "-e", "postgresql", "-eu", "name-another-user", "-ep", "2bcd123=456", "-eh", "another-server", "-edb", "another-db-name", "-ede", "-ipn", "4567", "-epn", "7654"); // test parameters for import module diff --git a/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/SQLServerJDBCModuleFactoryTest.java b/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/SQLServerJDBCModuleFactoryTest.java index 618a37512..442ee8ece 100644 --- a/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/SQLServerJDBCModuleFactoryTest.java +++ b/dbptk-core/src/test/java/com/databasepreservation/testing/unit/cli/SQLServerJDBCModuleFactoryTest.java @@ -25,9 +25,9 @@ public class SQLServerJDBCModuleFactoryTest { @Test public void arguments_required_long() { - List args = Arrays.asList("--import=SQLServerJDBC", "--import-username=name-user", + List args = Arrays.asList("--import=microsoft-sql-server", "--import-username=name-user", "--import-password=abc1 23=456", "--import-server-name=the-server-name", "--import-database=dbname", - "--import-disable-encryption", "--export=SQLServerJDBC", "--export-username=name-another-user", + "--import-disable-encryption", "--export=microsoft-sql-server", "--export-username=name-another-user", "--export-password=2bcd123=456", "--export-server-name=another-server", "--export-database=another-db-name"); // test parameters for import module @@ -50,8 +50,8 @@ public void arguments_required_long() { @Test public void arguments_required_short() { - List args = Arrays.asList("-i", "SQLServerJDBC", "-iu", "name-user", "-ip", "abc1 23=456", "-is", - "the-server-name", "-idb", "dbname", "-e", "SQLServerJDBC", "-eu", "name-another-user", "-ep", "2bcd123=456", + List args = Arrays.asList("-i", "microsoft-sql-server", "-iu", "name-user", "-ip", "abc1 23=456", "-is", + "the-server-name", "-idb", "dbname", "-e", "microsoft-sql-server", "-eu", "name-another-user", "-ep", "2bcd123=456", "-es", "another-server", "-ede", "-edb", "another-db-name"); // test parameters for import module @@ -74,8 +74,8 @@ public void arguments_required_short() { @Test public void arguments_instanceName_short() { - List args = Arrays.asList("-i", "SQLServerJDBC", "-iu", "name-user", "-ip", "abc1 23=456", "-is", - "the-server-name", "-idb", "dbname", "-iin", "name-for-the-instance", "-e", "SQLServerJDBC", "-eu", + List args = Arrays.asList("-i", "microsoft-sql-server", "-iu", "name-user", "-ip", "abc1 23=456", "-is", + "the-server-name", "-idb", "dbname", "-iin", "name-for-the-instance", "-e", "microsoft-sql-server", "-eu", "name-another-user", "-ep", "2bcd123=456", "-es", "another-server", "-edb", "another-db-name", "-ein", "name-for-another-instance"); @@ -100,9 +100,9 @@ public void arguments_instanceName_short() { @Test public void arguments_instanceName_long() { - List args = Arrays.asList("--import=SQLServerJDBC", "--import-username=name-user", + List args = Arrays.asList("--import=microsoft-sql-server", "--import-username=name-user", "--import-password=abc1 23=456", "--import-server-name=the-server-name", "--import-database=dbname", - "--import-instance-name=name-for-the-instance", "--export=SQLServerJDBC", "--export-username=name-another-user", + "--import-instance-name=name-for-the-instance", "--export=microsoft-sql-server", "--export-username=name-another-user", "--export-password=2bcd123=456", "--export-server-name=another-server", "--export-database=another-db-name", "--export-instance-name=name-for-another-instance"); @@ -127,8 +127,8 @@ public void arguments_instanceName_long() { @Test public void arguments_portNumber_short() { - List args = Arrays.asList("-i", "SQLServerJDBC", "-iu", "name-user", "-ip", "abc1 23=456", "-is", - "the-server-name", "-idb", "dbname", "-ipn", "1234", "-e", "SQLServerJDBC", "-eu", "name-another-user", "-ep", + List args = Arrays.asList("-i", "microsoft-sql-server", "-iu", "name-user", "-ip", "abc1 23=456", "-is", + "the-server-name", "-idb", "dbname", "-ipn", "1234", "-e", "microsoft-sql-server", "-eu", "name-another-user", "-ep", "2bcd123=456", "-es", "another-server", "-edb", "another-db-name", "-epn", "4321"); // test parameters for import module @@ -152,9 +152,9 @@ public void arguments_portNumber_short() { @Test public void arguments_portNumber_long() { - List args = Arrays.asList("--import=SQLServerJDBC", "--import-username=name-user", + List args = Arrays.asList("--import=microsoft-sql-server", "--import-username=name-user", "--import-password=abc1 23=456", "--import-server-name=the-server-name", "--import-database=dbname", - "--import-port-number=1234", "--export=SQLServerJDBC", "--export-username=name-another-user", + "--import-port-number=1234", "--export=microsoft-sql-server", "--export-username=name-another-user", "--export-password=2bcd123=456", "--export-server-name=another-server", "--export-database=another-db-name", "--export-port-number=4321");