PageRenderTime 25ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/etlunit-database/src/main/java/org/bitbucket/bradleysmithllc/etlunit/feature/database/DatabaseRuntimeSupport.java

https://bitbucket.org/bradleysmithllc/etl-unit
Java | 126 lines | 73 code | 24 blank | 29 comment | 0 complexity | 16e2348e47e193b6b57a4d982e714597 MD5 | raw file
  1. package org.bitbucket.bradleysmithllc.etlunit.feature.database;
  2. /*
  3. * #%L
  4. * etlunit-database
  5. * %%
  6. * Copyright (C) 2010 - 2014 bradleysmithllc
  7. * %%
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. * #L%
  20. */
  21. import org.bitbucket.bradleysmithllc.etlunit.TestExecutionError;
  22. import org.bitbucket.bradleysmithllc.etlunit.context.VariableContext;
  23. import org.bitbucket.bradleysmithllc.etlunit.feature.database.db.Database;
  24. import org.bitbucket.bradleysmithllc.etlunit.feature.database.db.Table;
  25. import org.bitbucket.bradleysmithllc.etlunit.feature.file.FileRuntimeSupport;
  26. import org.bitbucket.bradleysmithllc.etlunit.feature.file.RequestedFmlNotFoundException;
  27. import org.bitbucket.bradleysmithllc.etlunit.io.file.DataFileSchema;
  28. import org.bitbucket.bradleysmithllc.etlunit.io.file.reference_file_type.ReferenceFileTypeRef;
  29. import org.bitbucket.bradleysmithllc.etlunit.metadata.MetaDataContext;
  30. import org.bitbucket.bradleysmithllc.etlunit.parser.ETLTestOperation;
  31. import org.bitbucket.bradleysmithllc.etlunit.parser.ETLTestPackage;
  32. import org.bitbucket.bradleysmithllc.etlunit.parser.ETLTestValueObject;
  33. import java.io.File;
  34. import java.io.IOException;
  35. import java.util.List;
  36. public interface DatabaseRuntimeSupport
  37. {
  38. File getSourceDataSetDirectoryForCurrentTest();
  39. File getSourceDataDirectoryForCurrentTest();
  40. File getSourceScriptsDirectoryForCurrentTest();
  41. File getSourceDataSetDirectory(ETLTestPackage package_);
  42. File getSourceDataDirectory(ETLTestPackage package_);
  43. File getSourceScriptsDirectory(ETLTestPackage package_);
  44. File getSourceDataSet(ETLTestPackage package_, String dataSetName, String use);
  45. File getSourceDataSetForCurrentTest(String dataSetName, String use);
  46. File getSourceData(ETLTestPackage package_, String dataSetName, String use, DataFileSchema.format_type type);
  47. File getSourceDataForCurrentTest(String dataSetName, String use, DataFileSchema.format_type type);
  48. File getSourceScript(ETLTestPackage package_, String scriptName, String use);
  49. File getSourceScriptForCurrentTest(String scriptName, String use);
  50. File getCachedMetaData(DatabaseConnection conn);
  51. File getGeneratedSourceDirectory(DatabaseConnection conn, String mode);
  52. File getGeneratedData(DatabaseConnection conn, String mode, String dataSetName);
  53. DataFileSchema createRelationalMetaInfo(DatabaseConnection dbConn, String schema, String name);
  54. DataFileSchema createRelationalMetaInfo(String connectionId, String schema, String name);
  55. FileRuntimeSupport.DataFileSchemaQueryResult getRelationalMetaInfo(DatabaseConnection dbConn, String schema, String name, List<String> masterName, ETLTestValueObject etlObj, ReferenceFileTypeRef.ref_type type) throws RequestedFmlNotFoundException, TestExecutionError;
  56. FileRuntimeSupport.DataFileSchemaQueryResult getRelationalMetaInfo(String connId, String schema, String name, List<String> masterName, ETLTestValueObject etlObj, ReferenceFileTypeRef.ref_type type) throws RequestedFmlNotFoundException, TestExecutionError;
  57. void persistDataFileSchema(ETLTestOperation op, DataFileSchema schema) throws IOException;
  58. String createSchemaKey(Table table);
  59. SQLAggregator resolveSQLRef(String text) throws IOException, TestExecutionError;
  60. SQLAggregator resolveDDLRef(DDLSourceRef ddlRef, DatabaseConnection databaseConnection) throws IOException, TestExecutionError;
  61. /**
  62. * Tell whether the configuration for this database has changed since the last run
  63. * @param databaseConnection
  64. * @return
  65. */
  66. int getDatabaseConfigurationState(DatabaseConnection databaseConnection);
  67. /**
  68. * Tells whether the DDL for the database has changed
  69. * @param databaseConnection
  70. * @return
  71. */
  72. int getDatabaseDDLState(DatabaseConnection databaseConnection) throws TestExecutionError;
  73. DataFileSchema generateReferenceFileForTable(Table table);
  74. boolean hasDatabase(DatabaseConnection connection, VariableContext context);
  75. Database getDatabase(DatabaseConnection connection, VariableContext context);
  76. void refreshDatabaseMetadata(
  77. DatabaseConnection conn,
  78. String mode,
  79. DatabaseImplementation impl,
  80. VariableContext context,
  81. MetaDataContext databaseMetaContext,
  82. JDBCClient jdbcClient
  83. ) throws Exception;
  84. void loadTable(
  85. Table table,
  86. String mode,
  87. DatabaseImplementation impl
  88. ) throws Exception;
  89. void loadTable(
  90. Table table,
  91. String mode,
  92. DatabaseImplementation impl,
  93. ETLTestOperation op
  94. ) throws Exception;
  95. void loadTable(
  96. Table table,
  97. String mode,
  98. DatabaseImplementation impl,
  99. ETLTestOperation op,
  100. boolean loadReferenceType
  101. ) throws Exception;
  102. }