Revision c26ab6e0
Added by Andreas Müller almost 3 years ago
cdmlib-test/src/main/java/eu/etaxonomy/cdm/test/unitils/DdlCreator.java | ||
---|---|---|
57 | 57 |
public void execute(Class<?> dialect, String lowerCaseDialectName){ |
58 | 58 |
|
59 | 59 |
try { |
60 |
String outputFileName = String.format("%s.%s.%s", new Object[] {"001-cdm", lowerCaseDialectName, "sql" }); |
|
61 |
String outputFileClassPath = "dbscripts/" + outputFileName; |
|
62 |
// String templateFileName = outputFileName + "-template"; |
|
63 |
// String templateFileClassPath = "dbscripts/" + templateFileName; |
|
60 |
String fileName = String.format("%s.%s.%s", new Object[] {"001-cdm", lowerCaseDialectName, "sql" }); |
|
61 |
String outputFileClassPath = "dbscripts/" + fileName; |
|
64 | 62 |
|
65 | 63 |
ClassPathResource resource = new ClassPathResource(outputFileClassPath); |
66 | 64 |
File folder = resource.getFile().getParentFile(); |
67 |
String outputPath = folder.getCanonicalPath()+File.separator + outputFileName; |
|
68 |
// String templatePath = folder.getCanonicalPath()+File.separator + templateFileName; |
|
69 |
System.out.println(outputPath); |
|
70 |
// System.out.println(templatePath); |
|
65 |
String outputPath = folder.getCanonicalPath()+File.separator + fileName; |
|
71 | 66 |
|
72 | 67 |
StandardServiceRegistryBuilder registryBuilder = new StandardServiceRegistryBuilder() |
73 | 68 |
.applySetting(AvailableSettings.DIALECT, dialect.getCanonicalName()) // dialect |
74 |
// .applySetting(AvailableSettings.HBM2DDL_CREATE_SCRIPT_SOURCE, resource.getURL()) |
|
69 |
// .applySetting(AvailableSettings.HBM2DDL_CREATE_SCRIPT_SOURCE, resource.getURL()) //does not have the expected effect
|
|
75 | 70 |
; |
76 | 71 |
|
77 | 72 |
StandardServiceRegistry serviceRegistry = registryBuilder.build(); |
... | ... | |
92 | 87 |
.build(); |
93 | 88 |
|
94 | 89 |
//export |
95 |
EnumSet<TargetType> targetTypes = EnumSet.of(/*TargetType.STDOUT, */TargetType.SCRIPT);
|
|
90 |
EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.SCRIPT); |
|
96 | 91 |
new SchemaExport() |
97 | 92 |
.setFormat(true) |
98 | 93 |
.setDelimiter(";") |
99 |
// .setImportFiles(templatePath) |
|
94 |
// .setImportFiles(templatePath) //does not have the expected effect
|
|
100 | 95 |
.setOutputFile(outputPath) |
101 | 96 |
.createOnly(targetTypes, metadata); |
102 | 97 |
|
Also available in: Unified diff
cleanup