gitgabrio commented on code in PR #6405:
URL:
https://github.com/apache/incubator-kie-drools/pull/6405#discussion_r2238896826
##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/DMNTestUtil.java:
##########
@@ -42,4 +53,58 @@ public static DMNModel getAndAssertModelNoErrors(final
DMNRuntime runtime, final
public static Function<String, Reader> getRelativeResolver(String key,
String content) {
return s -> s.equals(key) ? new StringReader(content) : null;
}
+
+ /**
+ * Dynamically loads and instantiates the latest version of DMNTypeRegistry
+ * @return DMNTypeRegistry
+ */
+ public static DMNTypeRegistry getLatestDMNTypeRegistry() {
+ try {
+ String dMNTypeRegistryClassName =
String.format("org.kie.dmn.core.compiler.DMNTypeRegistryV%s",
DMNVersion.getLatest().getDmnVersion());
+ logger.warn("DMNTypeRegistry class is {}",
dMNTypeRegistryClassName);
+ Class<? extends DMNTypeRegistry> registryClass = (Class<?
+ extends DMNTypeRegistry>)
Class.forName(dMNTypeRegistryClassName);
+ Constructor<? extends DMNTypeRegistry> constructor =
+ registryClass.getConstructor(Map.class);
+
+ return constructor.newInstance(Collections.emptyMap());
+ } catch (ClassNotFoundException | IllegalAccessException |
ClassCastException | NoSuchMethodException |
+ InstantiationException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Dynamically loads and instantiates the latest URI_FEEL value reflexively
+ * @return string URI_FEEL
+ */
+ public static String getLatestFeelReflectively() {
+ try {
+ String latestVersion =
convertClassNameVersionCase(String.valueOf(DMNVersion.getLatest()));
Review Comment:
Hi @ChinchuAjith
I was thinking, what about:
1. modify the DMNVersion enum to also have the correct string representation
2. add a getLatestString method on DMNVersion (that returns the correct
string representation)
3. remove the convertClassNameVersionCase
WDYT ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]