Skip to content

Commit 500466d

Browse files
author
bobgarner
committed
Fixed some output colorization. Fixed tests - which includes now using the -parameters option when compiling so method argument names will be returned properly when introspected.
1 parent 9463d97 commit 500466d

File tree

7 files changed

+46
-18
lines changed

7 files changed

+46
-18
lines changed

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@
7474
</descriptorRefs>
7575
</configuration>
7676
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-compiler-plugin</artifactId>
80+
<version>3.8.1</version>
81+
<configuration>
82+
<compilerArgs>
83+
<arg>-parameters</arg>
84+
</compilerArgs>
85+
</configuration>
86+
</plugin>
7787
</plugins>
7888
</build>
7989
<dependencies>

src/main/java/org/entityc/compiler/cmdline/command/CLBuild.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void run(String[] args) {
113113
// close out our session
114114
ProjectManager.getInstance().close();
115115
if (!quietMode) {
116-
ECLog.log(StdoutColor.GreenForeground.getStringValue() + "Success");
116+
ECLog.log(colorize("Success", StdoutColor.GreenForeground));
117117
}
118118
}
119119

src/main/java/org/entityc/compiler/cmdline/command/CLCommand.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ public static void displayItems(String message, Set<String> listOfItems, StdoutC
5151
ECLog.log(ECStringUtil.WrapString(message + ":", "", DISPLAY_LINE_WIDTH));
5252
Collection<String> sortedNames = listOfItems.stream().sorted().collect(Collectors.toList());
5353
for (String name : sortedNames) {
54-
ECLog.log(" " + (itemColor != null ?
55-
itemColor.stringValue :
56-
"") + name);
54+
ECLog.log(" " + colorize(name, itemColor));
5755
}
5856
}
5957

@@ -123,7 +121,7 @@ protected List<String> processSingleDirWildcardArg(String arg, String dirpath) {
123121
return sourceFileNames;
124122
}
125123

126-
protected String colorize(String text, StdoutColor color) {
124+
protected static String colorize(String text, StdoutColor color) {
127125
return color.getStringValue() + text + StdoutColor.Default.getStringValue();
128126
}
129127

src/main/java/org/entityc/compiler/project/ProjectManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ public void setQuietMode(boolean quietMode) {
323323
}
324324

325325
public void registerSchemaDirectory(String path) {
326+
if (schemaDirectories == null) {
327+
schemaDirectories = new HashSet<>();
328+
}
326329
schemaDirectories.add(path);
327330
}
328331

test/java/org/entityc/compiler/EntityCompilerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private void runTemplateTest(String testName) throws IOException {
2828
final String TestResourceDir = BASE_RESOURCE_DIR + "/" + testName;
2929
String strTmp = System.getProperty("java.io.tmpdir");
3030
String sourceFile = TestResourceDir + "/" + testName + ".edl";
31-
EntityCompiler.main(new String[]{sourceFile, "-c", "Config", "-tp", TestResourceDir, "-D", "TEMP_DIR=" + strTmp});
31+
EntityCompiler.main(new String[]{"build", "Config", sourceFile, "-tp", TestResourceDir, "-D", "TEMP_DIR=" + strTmp});
3232
String actual = FileUtils.readFileToString(new File(strTmp + File.separator + testName + ".txt"));
3333
String expected = FileUtils.readFileToString(new File(TestResourceDir + "/" + testName + "Expected.txt"));
3434
assertEquals(expected, actual);
@@ -56,7 +56,7 @@ private void runPostgresTest(String testName) throws IOException {
5656
final String TestResourceDir = BASE_RESOURCE_DIR + "/" + testName;
5757
String strTmp = System.getProperty("java.io.tmpdir");
5858
String sourceFile = TestResourceDir + "/" + testName + ".edl";
59-
EntityCompiler.main(new String[]{sourceFile, "-c", "Config", "-tp", TestResourceDir, "-D", "TEMP_DIR=" + strTmp});
59+
EntityCompiler.main(new String[]{"build", "Config", sourceFile, "-tp", TestResourceDir, "-D", "TEMP_DIR=" + strTmp});
6060
String actual = FileUtils.readFileToString(new File(strTmp + File.separator + "V1__Space.sql"));
6161
String expected = FileUtils.readFileToString(new File(TestResourceDir + "/" + testName + "Expected.sql"));
6262
assertEquals(expected, actual);

test/resources/compiler/main/CompilerDocs/CompilerDocsExpected.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ These methods relate to a part of application configuration.
469469

470470
| Method/Property |
471471
|---|
472-
| `String` **`directoryName`** |
473-
| Returns the directory name if available. Otherwise returns `null` |
472+
| `String` **`directoryPath`** |
473+
| Returns the directory path if available. Otherwise returns `null` |
474474
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
475475
| `String` **`filename`** |
476476
| Returns the filename of the template which is preceded by a directory name if available. |
@@ -943,6 +943,9 @@ These methods relate to relationships.
943943
| `boolean` **`hasParentRelationship`** |
944944
| Indicates whether it has a least one relationship declared as parent. |
945945
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
946+
| `boolean` [**`hasParentRelationshipToEntity(MTEntity parentEntity)`**](#class_MTEntity_hasParentRelationshipToEntity) |
947+
| Indicates whether it has a least one relationship declared as parent to the specified entity. |
948+
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
946949
| `boolean` **`hasPrimaryParentRelationship`** |
947950
| Indicates whether this entity has a primary parent relationship. A primary parent relationship is one which is declared `parent` and **not** declared `optional`. |
948951
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
@@ -1025,6 +1028,16 @@ Given an entity object, this method will try to find and return a relationship o
10251028

10261029

10271030

1031+
<a name="class_MTEntity_hasParentRelationshipToEntity">
1032+
#### Method `boolean hasParentRelationshipToEntity(MTEntity parentEntity)`
1033+
</a>
1034+
1035+
Indicates whether it has a least one relationship declared as parent to the specified entity.
1036+
1037+
| Parameter | Description |
1038+
|-----|-----|
1039+
|`MTEntity parentEntity` | *no description* |
1040+
10281041

10291042

10301043

@@ -1632,6 +1645,9 @@ These methods relate to data types.
16321645
| `MTEnum` **`enumType`** |
16331646
| If this type is an enum type then it returns the enum type object. Otherwise it returns `null`. |
16341647
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
1648+
| `boolean` **`isBooleanType`** |
1649+
| Indicates whether this type is one of the integer data types. |
1650+
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
16351651
| `boolean` **`isByteArrayType`** |
16361652
| Indicates whether this type is both an array type and also `byte` data type. |
16371653
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
@@ -1666,6 +1682,7 @@ These methods relate to data types.
16661682

16671683

16681684

1685+
16691686
<a name="class_MTType_isNativeDataType">
16701687
#### Method `boolean isNativeDataType(DataType dataType)`
16711688
</a>
@@ -3010,7 +3027,7 @@ These methods relate to an outlet.
30103027
| Indicates whether this author has child authors that connect to an outlet. |
30113028
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
30123029
| `boolean` **`hasChildOutletsWithIntermediateParents`** |
3013-
| Indicates whether this author has children authors that connect to an outlet and there are intermediate parent authors (that is authors that don't connect to an outlet). |
3030+
| Indicates whether this author has children authors that connect to an outlet and there are intermediate parent authors (that is, authors that don't connect to an outlet). |
30143031
|<hr style="border-bottom:1px solid #77c;"><tr></tr>|
30153032
| `boolean` **`isOutletAuthor`** |
30163033
| Indicates whether this author connects to an outlet. |

test/resources/compiler/main/TemplateCodeFormatting/TemplateCodeFormattingExpected.eml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ Enum: ${enum.name}
1313
${qualifier}Entity: ${entity.name}
1414
$[foreach attribute in entity.attributes]
1515
$[switch attribute.type]
16-
$[case string]
17-
$[let typeLongName = "String of characters"]
16+
$[case uuid]
17+
$[let typeLongName = "Unique Identifier - 128 bits"]
1818
$[case int32]
1919
$[let typeLongName = "32-bit Integer"]
2020
$[case int64]
2121
$[let typeLongName = "64-bit Integer"]
22-
$[case double]
23-
$[let typeLongName = "64-bit Floating Point"]
2422
$[case float]
2523
$[let typeLongName = "32-bit Floating Point"]
26-
$[case uuid]
27-
$[let typeLongName = "Unique Identifier - 128 bits"]
28-
$[case typedef]
29-
$[let typeLongName = "Typedef named " + attribute.type.name]
24+
$[case double]
25+
$[let typeLongName = "64-bit Floating Point"]
26+
$[case string]
27+
$[let typeLongName = "String of characters"]
3028
$[case enum]
3129
$[let typeLongName = "Enum named " + attribute.type.name]
30+
$[case typedef]
31+
$[let typeLongName = "Typedef named " + attribute.type.name]
3232
$[case entity]
3333
$[let typeLongName = "Entity named " + attribute.type.name]
3434
$[default]

0 commit comments

Comments
 (0)