rbeckman-nextgen / test-mc3

0 stars 0 forks source link

Improve code template support in the CLI #3627

Closed rbeckman-nextgen closed 4 years ago

rbeckman-nextgen commented 4 years ago

Right now there are only two options, import/overwrite all and export all.

Imported Issue. Original Details: Jira Issue Key: MIRTH-3762 Reporter: narupley Created: 2015-08-22T16:08:31.000-0700

rbeckman-nextgen commented 4 years ago

Code template support in the CLI has been completely overhauled along with the changes made in MIRTH-1892. The token structure is basically like this now: \ \

The list feature is similar to channels and outputs a formatted table with the ID/name/type/revision/last modified values. The libraries are the same except there's an extra option there to also print out code templates underneath each library in a sort of sub-table.

The old CLI commands are still there but have been deprecated.

Imported Comment. Original Details: Author: narupley Created: 2015-08-22T16:19:51.000-0700

rbeckman-nextgen commented 4 years ago
mirthconnect-3.3.0.7736.b1707-unix minhtran$ ./mccommand Connected to Mirth Connect server @ https://127.0.0.1:8443 (3.3.0.7736) $codetemplate ` Error: Invalid number of arguments. Syntax is: codetemplate library list [includecodetemplates], codetemplate list, codetemplate [library] import path [force], codetemplate [library] export id](name * path, or codetemplate [library) remove id name * **$codetemplate list** Name Id Type Revision Last Modified

12digitDateTime 920c9ead-70a6-4168-9d95-89261b73ae44 Function 1 2015-08-26 13:50:13 14digitDateTime fe2689ec-1946-46d5-8dd6-8fbbf106e1e6 Function 1 2015-08-26 13:50:13 CDRSelect d2b446c7-a858-474c-b7b6-8090f216dfcf Function 1 2015-08-26 13:31:45 CDRUpdate 9a0b54ca-0d95-41df-9e0f-1f7caf53c537 Function 2 2015-08-26 14:28:32 Template 1 8dccd2c6-f11f-433b-9ae7-0231b80d18fe Function 4 2015-08-27 08:33:09 Template 2 60219399-306a-4c81-b024-3528bf3ab36a Function 1 2015-08-26 14:14:27 Template 3 95d4377d-faa4-4bc1-ad78-e6fa00c17c3a Function 3 2015-08-26 14:30:45 fixHL7NodeOrder 7e747999-4bec-43fc-978d-7049d3543cf0 Function 1 2015-08-26 13:50:13 formatHL7Date dfedacf6-773b-413e-b78d-1bf16a92071d Function 1 2015-08-26 13:50:13 getChannelState 84b4f1c7-f82d-4140-9fbd-98a95f68ff32 Function 1 2015-08-26 13:50:13 getCurrentLocalTime a8f54921-2cb6-4134-8806-3c4e10a757d9 Function 1 2015-08-26 13:50:13 overwritename 9f74cb6f-c110-4d53-8e49-50352ecfc436 Function 3 2015-08-26 14:11:04 random test1 41c08907-23b9-40d1-8915-5629a7085e03 Function 5 2015-08-26 14:27:46 stopOnErrorCount 2c64669f-f07e-4365-bf64-c559ace83004 Function 1 2015-08-26 13:50:13 test 08044817-3504-4fc1-80ee-404870195151 Compiled Code Block 1 2015-08-26 13:50:13 **$codetemplate library list** Name Id Revision Last Modified


[Unassigned] [Unassigned] N/A N/A DATABASE dac6d8f9-7e24-45b5-9c9b-cb06b822e5cc 9 2015-08-26 14:21:50 FORMAT 8c9a8268-4ef0-43e9-ae5b-bf8895f0b80c 6 2015-08-26 14:27:28 MISC 6a32d94d-408c-4e10-9799-e45e150b5c1f 2 2015-08-26 14:09:34 `

Imported Comment. Original Details: Author: minht Created: 2015-08-27T09:27:58.000-0700

rbeckman-nextgen commented 4 years ago

Server(s) and URLs Used: Run Mirth Connect on local OSX Yosemite 10.10 Version(s)/Build(s) to verify new feature: mirthconnect-3.3.0.7736.b1707-unix How Tested (list tests run):

Verify Fixed:

Additional Info:

Imported Comment. Original Details: Author: minht Created: 2015-08-27T11:16:50.000-0700

rbeckman-nextgen commented 4 years ago

ERROR from importing library (same error for one or all libraries) ` $codetemplate library export * /Users/minhtran/Desktop/MinhShare/inbox/codetemplate_library_all.xml Successfully exported 4 code template libraries.

$codetemplate library import /Users/minhtran/Desktop/MinhShare/inbox/codetemplate_library_all.xml java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mirth.connect.cli.launcher.CommandLineLauncher.main(CommandLineLauncher.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.exe4j.runtime.LauncherEngine.launch(Unknown Source) at com.install4j.runtime.launcher.Launcher.main(Unknown Source) Caused by: java.lang.NoClassDefFoundError: org/mozilla/javascript/ast/NodeVisitor at com.mirth.connect.model.CodeTemplate.updateDocumentation(CodeTemplate.java:192) at com.mirth.connect.model.CodeTemplate.setCode(CodeTemplate.java:165) at com.mirth.connect.model.CodeTemplate.(CodeTemplate.java:90) at com.mirth.connect.model.CodeTemplateLibrary.(CodeTemplateLibrary.java:68) at com.mirth.connect.cli.CommandLineInterface.commandImportCodeTemplateLibraries(CommandLineInterface.java:943) at com.mirth.connect.cli.CommandLineInterface.executeStatement(CommandLineInterface.java:385) at com.mirth.connect.cli.CommandLineInterface.runConsole(CommandLineInterface.java:230) at com.mirth.connect.cli.CommandLineInterface.runShell(CommandLineInterface.java:195) at com.mirth.connect.cli.CommandLineInterface.run(CommandLineInterface.java:161) at com.mirth.connect.cli.CommandLineInterface.(CommandLineInterface.java:103) ... 11 more Caused by: java.lang.ClassNotFoundException: org.mozilla.javascript.ast.NodeVisitor at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 21 more `

Imported Comment. Original Details: Author: minht Created: 2015-08-27T11:23:23.000-0700

rbeckman-nextgen commented 4 years ago

CLI for codetemplate library import not working

Imported Comment. Original Details: Author: minht Created: 2015-08-27T11:26:51.000-0700

rbeckman-nextgen commented 4 years ago

Fixed the above issue with importing libraries. Rhino just needed to be added to the CLI classpath.

Imported Comment. Original Details: Author: narupley Created: 2015-08-27T12:18:50.000-0700

rbeckman-nextgen commented 4 years ago

Import is still failing at mirthconnect-3.3.0.7739.b1711-unix

$codetemplate library import /Users/minhtran/Desktop/MinhShare/inbox/codetemplate_library_all.xml Error: Failed to import code template libraries.

[2015-08-27 13:23:49,508] ERROR (com.mirth.connect.server.controllers.Cache:130): Error refreshing Code Template Library cache java.lang.NullPointerException at com.mirth.connect.server.controllers.Cache.refreshCache(Cache.java:99) at com.mirth.connect.server.controllers.Cache.getAllItems(Cache.java:48) at com.mirth.connect.server.controllers.DefaultCodeTemplateController.updateLibraries(DefaultCodeTemplateController.java:142) at com.mirth.connect.server.servlets.CodeTemplateServlet.doPost(CodeTemplateServlet.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1038) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:374) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:972) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:363) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:483) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:931) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:992) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)

Imported Comment. Original Details: Author: minht Created: 2015-08-28T16:23:34.000-0700

rbeckman-nextgen commented 4 years ago

This should be fixed now with the latest changes, since the Unassigned library is gone. In testing you'll just need to make new exports, as any previously existing exports from earlier trunk builds may not work.

Imported Comment. Original Details: Author: narupley Created: 2015-08-29T19:07:09.000-0700

rbeckman-nextgen commented 4 years ago

re-test Library import using mirthconnect-3.3.0.7752.b1732-unix ` $codetemplate library import /Users/minhtran/Desktop/MinhShare/CodeTemplate/MC330_CodeTemplate_AllLibraries.xml 4 code template libraries imported successfully.

$codetemplate library list Name Id Revision Last Modified


DATABASE dac6d8f9-7e24-45b5-9c9b-cb06b822e5cc 1 2015-09-01 16:37:45 FORMAT 8c9a8268-4ef0-43e9-ae5b-bf8895f0b80c 1 2015-09-01 16:37:45 Library 1 f4efb6d6-9cf7-4605-a0f6-12e96883d3d8 1 2015-09-01 16:37:45 MISC b4f7b3c3-5bd9-4788-b878-fc996e04afaf 1 2015-09-01 16:37:45

$codetemplate list Name Id Type Revision Last Modified


12digitDateTime 920c9ead-70a6-4168-9d95-89261b73ae44 Function 1 2015-09-01 16:37:45 14digitDateTime fe2689ec-1946-46d5-8dd6-8fbbf106e1e6 Function 1 2015-09-01 16:37:45 CDRSelect d2b446c7-a858-474c-b7b6-8090f216dfcf Function 1 2015-09-01 16:37:46 CDRUpdate 9a0b54ca-0d95-41df-9e0f-1f7caf53c537 Function 1 2015-09-01 16:37:45 Counter a6ccb0a8-5695-4446-8f1a-f26d8b82a5d4 Drag-and-Drop Code Block 1 2015-09-01 16:37:45 fixHL7NodeOrder 7e747999-4bec-43fc-978d-7049d3543cf0 Function 1 2015-09-01 16:37:46 formatHL7Date dfedacf6-773b-413e-b78d-1bf16a92071d Function 1 2015-09-01 16:37:45 getChannelState d2acfd60-1bb5-43ac-9e89-7184b7447473 Drag-and-Drop Code Block 1 2015-09-01 16:37:45 getCurrentLocalTime ff8be261-9c89-44e5-9edf-71f1bd72e57b Function 1 2015-09-01 16:37:45 random test cd8f8203-fa43-407a-aa54-bcdd63a4aa73 Function 1 2015-09-01 16:37:46 random test1 41c08907-23b9-40d1-8915-5629a7085e03 Drag-and-Drop Code Block 1 2015-09-01 16:37:45 stoponErrorCount 64ae3a48-3c30-4074-a28c-debeffae4d4e Function 1 2015-09-01 16:37:45 Template 2 a687532b-d316-497f-9a9f-6cd1221002d3 Function 1 2015-09-01 16:37:45 `

Imported Comment. Original Details: Author: minht Created: 2015-09-01T16:41:51.000-0700

rbeckman-nextgen commented 4 years ago

retest Library import with existing libraries ` $codetemplate library list Name Id Revision Last Modified


Library 1 f4efb6d6-9cf7-4605-a0f6-12e96883d3d8 2 2015-09-01 16:40:11 MISC b4f7b3c3-5bd9-4788-b878-fc996e04afaf 1 2015-09-01 16:37:45

$codetemplate library import /Users/minhtran/Desktop/MinhShare/CodeTemplate/MC330_CodeTemplate_AllLibraries.xml Error: One or more code templates or libraries is outdated (use the "force" option to import them anyway).

$codetemplate library import /Users/minhtran/Desktop/MinhShare/CodeTemplate/MC330_CodeTemplate_AllLibraries.xml force 4 code template libraries imported successfully.

$codetemplate library list Name Id Revision Last Modified


DATABASE dac6d8f9-7e24-45b5-9c9b-cb06b822e5cc 1 2015-09-01 16:41:29 FORMAT 8c9a8268-4ef0-43e9-ae5b-bf8895f0b80c 1 2015-09-01 16:41:29 Library 1 f4efb6d6-9cf7-4605-a0f6-12e96883d3d8 3 2015-09-01 16:41:29 MISC b4f7b3c3-5bd9-4788-b878-fc996e04afaf 1 2015-09-01 16:37:45 `

Imported Comment. Original Details: Author: minht Created: 2015-09-01T16:42:20.000-0700

rbeckman-nextgen commented 4 years ago

Server(s) and URLs Used: Run Mirth Connect on local OSX Yosemite 10.10 Version(s)/Build(s) to verify new feature: mirthconnect-3.3.0.7752.b1732-unix How Tested (list tests run):

Verify Fixed:

Additional Info:

Imported Comment. Original Details: Author: minht Created: 2015-09-01T16:52:22.000-0700

rbeckman-nextgen commented 4 years ago

What is the issue: orphan code templates when remove library from Code Template CLI Server(s) /URLs Used: MC instance running on local OSX Issue found /exists in Version(s)/Build(s): mirthconnect-3.3.0.7773.b1758-unix Is the Issue Consistent (list details): Remove library from GUI will remove all code templates. However, remove library from CLI will leave code templates without library, they are not visible from the GUI Steps to Reproduce:

Actual Outcome: No Library or code template listed in GUI. However CLI still listing code templates when there is no library.

Imported Comment. Original Details: Author: minht Created: 2015-09-04T17:18:11.000-0700

rbeckman-nextgen commented 4 years ago

`$codetemplate list Name Id Type Revision Last Modified


Template 1 377c90d4-3ad2-41f6-b434-57d599c03c0a Function 1 2015-09-04 17:01:00 Template 2 aab07dc5-d347-4971-9a64-169416b40071 Function 1 2015-09-04 17:01:00 Template 3 fa1b73a1-124c-4268-a1f2-e07a8a719867 Function 1 2015-09-04 17:01:00 Template 4 4be2e498-b2eb-421c-984f-3dfe041d59ed Function 1 2015-09-04 17:01:00 Template 5 0f187c63-c4d1-4764-aa44-4cc8e3c100e0 Function 1 2015-09-04 17:01:00 $codetemplate library list Name Id Revision Last Modified


Library 1 31ab29d3-c803-48a4-99fa-9efbd0e6ac10 1 2015-09-04 17:01:00 Library 2 99e48163-70f9-4b0d-9056-4ed352ffa784 1 2015-09-04 17:01:00 $codetemplate library remove "Library 1" Successfully removed 1 code template library. $codetemplate list Name Id Type Revision Last Modified


Template 1 377c90d4-3ad2-41f6-b434-57d599c03c0a Function 1 2015-09-04 17:01:00 Template 2 aab07dc5-d347-4971-9a64-169416b40071 Function 1 2015-09-04 17:01:00 Template 3 fa1b73a1-124c-4268-a1f2-e07a8a719867 Function 1 2015-09-04 17:01:00 Template 4 4be2e498-b2eb-421c-984f-3dfe041d59ed Function 1 2015-09-04 17:01:00 Template 5 0f187c63-c4d1-4764-aa44-4cc8e3c100e0 Function 1 2015-09-04 17:01:00 $codetemplate library remove "Library 2" Successfully removed 1 code template library. $codetemplate library list $ $codetemplate list Name Id Type Revision Last Modified


Template 1 377c90d4-3ad2-41f6-b434-57d599c03c0a Function 1 2015-09-04 17:01:00 Template 2 aab07dc5-d347-4971-9a64-169416b40071 Function 1 2015-09-04 17:01:00 Template 3 fa1b73a1-124c-4268-a1f2-e07a8a719867 Function 1 2015-09-04 17:01:00 Template 4 4be2e498-b2eb-421c-984f-3dfe041d59ed Function 1 2015-09-04 17:01:00 Template 5 0f187c63-c4d1-4764-aa44-4cc8e3c100e0 Function 1 2015-09-04 17:01:00`

Imported Comment. Original Details: Author: minht Created: 2015-09-04T17:19:53.000-0700

rbeckman-nextgen commented 4 years ago

Revision 7776: The CLI will now correctly remove code templates when removing a library.

Imported Comment. Original Details: Author: narupley Created: 2015-09-04T18:14:16.000-0700

rbeckman-nextgen commented 4 years ago

Server(s) and URLs Used: Run Mirth Connect on local OSX Yosemite 10.10 Version(s)/Build(s) to verify fixes: mirthconnect-3.3.0.7776.b1763-unix How Tested (list tests run):

Verified Fixed: `$codetemplate library list Name Id Revision Last Modified


Library 1 b6f5c726-2e4c-496a-9192-b8c4c461cc58 1 2015-09-08 12:48:26 $codetemplate list Name Id Type Revision Last Modified


Template 1 8a1c6f03-f3a4-4fc8-91b9-8453c1ed440c Function 1 2015-09-08 12:48:26 Template 2 4c929af7-3dc5-40ee-b55b-db906c39416d Function 1 2015-09-08 12:48:26 $codetemplate library remove "Library 1" Successfully removed 1 code template library. $codetemplate library list $codetemplate list
Name Id Type Revision Last Modified


`

Imported Comment. Original Details: Author: minht Created: 2015-09-08T12:54:30.000-0700

rbeckman-nextgen commented 4 years ago

Verify all fixes in mirthconnect-3.3.0.7776.b1763-unix

Imported Comment. Original Details: Author: minht Created: 2015-09-08T12:55:45.000-0700