-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathGenerationOdfReferenceTest.java
More file actions
87 lines (78 loc) · 3.16 KB
/
GenerationOdfReferenceTest.java
File metadata and controls
87 lines (78 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* *********************************************************************
*
* <p>DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* <p>Use is subject to license terms.
*
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0. You can also obtain a copy of the License at
* http://odftoolkit.org/docs/license.txt
*
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
*
* <p>See the License for the specific language governing permissions and limitations under the
* License.
*
* <p>******************************************************************
*/
package schema2template.grammar;
import static schema2template.grammar.ConstantsBuildEnv.GENERATION_TARGET_BASE_DIR;
import java.io.File;
import java.util.ArrayList;
import java.util.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
import schema2template.GenerationParameters;
import schema2template.SchemaToTemplate;
import schema2template.grammar.ConstantsOdf.OdfSpecificationPart;
public class GenerationOdfReferenceTest {
private static final Logger LOG = Logger.getLogger(GenerationOdfReferenceTest.class.getName());
private static final String ODF_REFERENCE_DIRECTORY = "odf-reference";
private static final String MAIN_TEMPLATE_PATH =
ConstantsBuildEnv.TEMPLATE_BASE_DIR
+ ODF_REFERENCE_DIRECTORY
+ File.separator
+ "file-creation-list.vm";
/** Test: It should be able to generate all examples without a failure. */
@Test
public void testAllExampleGenerations() throws Exception {
ArrayList<GenerationParameters> generations = new ArrayList<>();
for (OdfSpecificationPart specPart : OdfSpecificationPart.values()) {
LOG.info(
"\n\nNew ODF transformation with following parameters:"
+ "\n\tgrammarVersion "
+ specPart.grammarVersion
+ "\n\tgrammarID: "
+ specPart.grammarID
+ "\n\tgrammarPath: "
+ specPart.grammarPath
+ "\n\tmainTemplatePath: "
+ MAIN_TEMPLATE_PATH
+ "\n\ttargetDirPath: "
+ GENERATION_TARGET_BASE_DIR
+ ODF_REFERENCE_DIRECTORY);
generations.add(
new GenerationParameters(
specPart.grammarVersion,
specPart.grammarID,
specPart.grammarPath,
null,
MAIN_TEMPLATE_PATH,
GENERATION_TARGET_BASE_DIR + ODF_REFERENCE_DIRECTORY));
}
try {
SchemaToTemplate.run(generations);
} catch (Exception e) {
Assert.fail("Exception during test run: " + e.toString());
throw new Exception(e);
}
// Changing order of multiple puzzlepieces makes file comparison unuseable
/*compareDirectories(
GENERATION_TARGET_BASE_DIR + ODF_REFERENCE_DIRECTORY,
GENERATION_REFERENCE_BASE_DIR + ODF_REFERENCE_DIRECTORY);*/
}
}