Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Ean Schuessler
/
mo-mcp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
ea17693e
authored
2025-11-29 13:15:30 -0600
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix McpTestScreen rendering by implementing missing webappName property in WebFacadeStub
1 parent
e4ef25c5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
11 deletions
screen/McpTestScreen.xml
service/McpServices.xml
src/main/groovy/org/moqui/mcp/CustomScreenTestImpl.groovy
src/main/groovy/org/moqui/mcp/WebFacadeStub.groovy
screen/McpTestScreen.xml
View file @
ea17693
...
...
@@ -14,14 +14,9 @@
<set
field=
"userId"
from=
"ec.user?.userId ?: 'ANONYMOUS'"
/>
<set
field=
"sessionId"
from=
"ec.web?.sessionId ?: 'NO_SESSION'"
/>
<!-- Test different data access patterns -->
<entity-find
entity-name=
"moqui.basic.Enumeration"
list=
"enumerations"
limit=
"5"
/>
<entity-find
entity-name=
"McpSession"
list=
"mcpSessions"
limit=
"5"
>
<econdition
field-name=
"userId"
from=
"userId"
/>
</entity-find>
<!-- Test service calls -->
<service-call
name=
"org.moqui.impl.SystemServices.ping"
out-map=
"pingResult"
/>
<service-call
name=
"McpServices.mcp#Ping"
out-map=
"pingContext"
/>
<set
field=
"pingResult"
from=
"pingContext?.result"
/>
<!-- Test permissions -->
<set
field=
"hasAdminAccess"
from=
"ec.user?.hasPermission('MCP_ADMIN')"
/>
...
...
@@ -30,7 +25,7 @@
<!-- Test context data -->
<set
field=
"renderMode"
from=
"sri.renderMode ?: 'unknown'"
/>
<set
field=
"screenPath"
from=
"sri.
screenPath
?: 'unknown'"
/>
<set
field=
"screenPath"
from=
"sri.
getActiveScreenPath()?.join('/')
?: 'unknown'"
/>
<set
field=
"webappName"
from=
"ec.web?.webappName ?: 'unknown'"
/>
<set
field=
"locale"
from=
"ec.user?.locale ?: 'en_US'"
/>
</actions>
...
...
@@ -81,9 +76,7 @@
<container
style=
"test-section"
>
<label
text=
"Data Access Tests"
type=
"h2"
/>
<container
style=
"data-section"
>
<label
text=
"System Ping Result: ${pingResult?.message ?: 'No response'}"
type=
"p"
/>
<label
text=
"Enumerations Found: ${enumerations?.size() ?: 0}"
type=
"p"
/>
<label
text=
"MCP Sessions Found: ${mcpSessions?.size() ?: 0}"
type=
"p"
/>
<label
text=
"System Ping Result: ${pingResult?.status ?: 'No response'}"
type=
"p"
/>
</container>
</container>
...
...
service/McpServices.xml
View file @
ea17693
...
...
@@ -1457,6 +1457,7 @@ def startTime = System.currentTimeMillis()
def screenTest = new org.moqui.mcp.CustomScreenTestImpl(ec.ecfi)
.rootScreen(rootScreen)
.renderMode(renderMode ? renderMode : "html")
.auth(ec.user.username) // Propagate current user to the test renderer
ec.logger.info("MCP Screen Execution: ScreenTest object created: ${screenTest?.getClass()?.getSimpleName()}")
...
...
src/main/groovy/org/moqui/mcp/CustomScreenTestImpl.groovy
View file @
ea17693
...
...
@@ -55,6 +55,7 @@ class CustomScreenTestImpl implements McpScreenTest {
protected
String
servletContextPath
=
null
protected
String
webappName
=
null
protected
boolean
skipJsonSerialize
=
false
protected
String
authUsername
=
null
protected
static
final
String
hostname
=
"localhost"
long
renderCount
=
0
,
errorCount
=
0
,
totalChars
=
0
,
startTime
=
System
.
currentTimeMillis
()
...
...
@@ -116,6 +117,8 @@ class CustomScreenTestImpl implements McpScreenTest {
@Override
McpScreenTest
baseLinkUrl
(
String
baseLinkUrl
)
{
this
.
baseLinkUrl
=
baseLinkUrl
;
return
this
}
@Override
McpScreenTest
servletContextPath
(
String
scp
)
{
this
.
servletContextPath
=
scp
;
return
this
}
@Override
McpScreenTest
skipJsonSerialize
(
boolean
skip
)
{
this
.
skipJsonSerialize
=
skip
;
return
this
}
McpScreenTest
auth
(
String
username
)
{
this
.
authUsername
=
username
;
return
this
}
@Override
McpScreenTest
webappName
(
String
wan
)
{
...
...
@@ -213,6 +216,8 @@ class CustomScreenTestImpl implements McpScreenTest {
ExecutionContextFactoryImpl
ecfi
=
sti
.
ecfi
ExecutionContextImpl
localEci
=
ecfi
.
getEci
()
String
username
=
localEci
.
userFacade
.
getUsername
()
if
(!
username
&&
sti
.
authUsername
)
username
=
sti
.
authUsername
org
.
apache
.
shiro
.
subject
.
Subject
loginSubject
=
localEci
.
userFacade
.
getCurrentSubject
()
boolean
authzDisabled
=
localEci
.
artifactExecutionFacade
.
getAuthzDisabled
()
CustomScreenTestRenderImpl
stri
=
this
...
...
src/main/groovy/org/moqui/mcp/WebFacadeStub.groovy
View file @
ea17693
...
...
@@ -125,6 +125,12 @@ class WebFacadeStub implements WebFacade {
return
withPort
?
"localhost:8080"
:
"localhost"
}
String
getWebappName
()
{
// Return a default webappName since this is a stub implementation
// In real Moqui, this would come from the webapp configuration
return
"mcp"
}
@Override
String
getPathInfo
()
{
if
(
logger
.
isDebugEnabled
())
{
...
...
@@ -176,6 +182,8 @@ class WebFacadeStub implements WebFacade {
@Override
String
getSessionToken
()
{
return
"test-token"
}
String
getSessionId
()
{
return
httpSession
?.
getId
()
}
@Override
ServletContext
getServletContext
()
{
...
...
Please
register
or
sign in
to post a comment