[ 
https://issues.apache.org/jira/browse/UNOMI-847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francois Gerthoffert updated UNOMI-847:
---------------------------------------
    Description: 
There's an issue in the way Groovy Actions are registered via the REST API, 
causing further issues downstream when trying to call actions.

Create a groovy action, call it hello-world.groovy (from the doc):
{code:java}
@Action(id = "helloWorldGroovyAction",
        actionExecutor = "groovy:helloWorldAction",
        parameters = [@Parameter(id = "location", type = "string", multivalued 
= false)])
def execute() {
    logger.info("Hello {}", action.getParameterValues().get("location"))
    EventService.NO_CHANGE
}
{code}
h2. Steps to reproduce:
 * Start unomi 2.5.0
 * Submit the action:
 ** curl -X POST 'http://localhost:8181/cxs/groovyActions' --user karaf:karaf 
--form file=@hello-world.groovy
 ** In the logs:

{code:java}
04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has 
been persisted. 
04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has 
been loaded.  {code}
 * List the actions using the karaf shell: "unomi:action-list"

{code:java}
karaf@root()> unomi:action-list                                                 
                                                                                
                              
Id                                      │ Name                                  
  │ System tags
────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────────────────────────────────
addToListsAction                        │ addToListsAction                      
  │ profileTags,availableToEndUser,demographic
allEventToProfilePropertiesAction       │ allEventToProfilePropertiesAction     
  │ profileTags,event
copyPropertiesAction                    │ copyPropertiesAction                  
  │ profileTags,event
evaluateProfileAgeAction                │ evaluateProfileAgeAction              
  │ profileTags,event
evaluateProfileSegmentsAction           │ evaluateProfileSegmentsAction         
  │ profileTags,event
evaluateVisitPropertiesAction           │ evaluateVisitPropertiesAction         
  │ profileTags
eventToProfilePropertyAction            │ eventToProfilePropertyAction          
  │ profileTags,event
helloWorldGroovyAction                  │ helloWorldGroovyAction                
  │
incrementPropertyAction                 │ incrementPropertyAction               
  │ profileTags
mergeProfilesOnPropertyAction           │ mergeProfilesOnPropertyAction         
  │ profileTags,demographic
modifyConsentAction                     │ modifyConsentAction                   
  │ profileTags,demographic
requestHeaderToProfilePropertyAction    │ requestHeaderToProfilePropertyAction  
  │ profileTags,event
requestParameterToProfilePropertyAction │ 
requestParameterToProfilePropertyAction │ profileTags,event
sendEventAction                         │ sendEventAction                       
  │ profileTags,event
sendMailAction                          │ sendMailAction                        
  │ allowMultipleInstances,profileTags,availableToEndUser,event
setEventOccurenceCountAction            │ setEventOccurenceCountAction          
  │ profileTags,demographic
setPropertyAction                       │ setPropertyAction                     
  │ allowMultipleInstances,profileTags,availableToEndUser,demographic
setRemoteHostInfoAction                 │ setRemoteHostInfoAction               
  │ profileTags,event
updatePropertiesAction                  │ updatePropertiesAction                
  │ profileTags,demographic {code}
 
 * Notice the action is now listed as: "helloWorldGroovyAction"
 * Delete the action:
 ** curl -X DELETE 
'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user 
karaf:karaf
 * List the actions using the karaf shell: "unomi:action-list"
 ** {color:#ff0000}*The action is still listed, no errors in unomi to indicate 
that the deletion failed*{color}

 

  was:
There's an issue in the way Groovy Actions are registered via the REST API, 
causing further issues downstream when trying to call actions.

Create a groovy action, call it hello-world.groovy (from the doc):
{code:java}
@Action(id = "helloWorldGroovyAction",
        actionExecutor = "groovy:helloWorldAction",
        parameters = [@Parameter(id = "location", type = "string", multivalued 
= false)])
def execute() {
    logger.info("Hello {}", action.getParameterValues().get("location"))
    EventService.NO_CHANGE
}
{code}
h2. Steps to reproduce:
 * Start unomi 2.5.0
 * Submit the action:
 ** curl -X POST 'http://localhost:8181/cxs/groovyActions' --user karaf:karaf 
--form file=@hello-world.groovy
 ** In the logs:

{code:java}
04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has 
been persisted. 
04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world has 
been loaded.  {code}
 * List the actions using the karaf shell: "unomi:action-list"
 * Notice the action is now listed as: "helloWorldGroovyAction"
 * Delete the action:
 ** curl -X DELETE 
'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user 
karaf:karaf
 * List the actions using the karaf shell: "unomi:action-list"
 ** {color:#FF0000}*The action is still listed, no errors in unomi to indicate 
that the deletion failed*{color}

 


> Unable to delete a groovy action
> --------------------------------
>
>                 Key: UNOMI-847
>                 URL: https://issues.apache.org/jira/browse/UNOMI-847
>             Project: Apache Unomi
>          Issue Type: Bug
>    Affects Versions: unomi-2.5.0
>            Reporter: Francois Gerthoffert
>            Priority: Major
>             Fix For: unomi-2.6.0
>
>
> There's an issue in the way Groovy Actions are registered via the REST API, 
> causing further issues downstream when trying to call actions.
> Create a groovy action, call it hello-world.groovy (from the doc):
> {code:java}
> @Action(id = "helloWorldGroovyAction",
>         actionExecutor = "groovy:helloWorldAction",
>         parameters = [@Parameter(id = "location", type = "string", 
> multivalued = false)])
> def execute() {
>     logger.info("Hello {}", action.getParameterValues().get("location"))
>     EventService.NO_CHANGE
> }
> {code}
> h2. Steps to reproduce:
>  * Start unomi 2.5.0
>  * Submit the action:
>  ** curl -X POST 'http://localhost:8181/cxs/groovyActions' --user karaf:karaf 
> --form file=@hello-world.groovy
>  ** In the logs:
> {code:java}
> 04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
> qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
> org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world 
> has been persisted. 
> 04-jexperience-jcustomer-1      | 2024-08-26T12:16:57,786 | INFO  | 
> qtp656712048-259 | GroovyActionsServiceImpl         | 213 - 
> org.apache.unomi.groovy-actions-services - 2.4.0 |  The script hello-world 
> has been loaded.  {code}
>  * List the actions using the karaf shell: "unomi:action-list"
> {code:java}
> karaf@root()> unomi:action-list                                               
>                                                                               
>                                   
> Id                                      │ Name                                
>     │ System tags
> ────────────────────────────────────────┼─────────────────────────────────────────┼──────────────────────────────────────────────────────────────────
> addToListsAction                        │ addToListsAction                    
>     │ profileTags,availableToEndUser,demographic
> allEventToProfilePropertiesAction       │ allEventToProfilePropertiesAction   
>     │ profileTags,event
> copyPropertiesAction                    │ copyPropertiesAction                
>     │ profileTags,event
> evaluateProfileAgeAction                │ evaluateProfileAgeAction            
>     │ profileTags,event
> evaluateProfileSegmentsAction           │ evaluateProfileSegmentsAction       
>     │ profileTags,event
> evaluateVisitPropertiesAction           │ evaluateVisitPropertiesAction       
>     │ profileTags
> eventToProfilePropertyAction            │ eventToProfilePropertyAction        
>     │ profileTags,event
> helloWorldGroovyAction                  │ helloWorldGroovyAction              
>     │
> incrementPropertyAction                 │ incrementPropertyAction             
>     │ profileTags
> mergeProfilesOnPropertyAction           │ mergeProfilesOnPropertyAction       
>     │ profileTags,demographic
> modifyConsentAction                     │ modifyConsentAction                 
>     │ profileTags,demographic
> requestHeaderToProfilePropertyAction    │ 
> requestHeaderToProfilePropertyAction    │ profileTags,event
> requestParameterToProfilePropertyAction │ 
> requestParameterToProfilePropertyAction │ profileTags,event
> sendEventAction                         │ sendEventAction                     
>     │ profileTags,event
> sendMailAction                          │ sendMailAction                      
>     │ allowMultipleInstances,profileTags,availableToEndUser,event
> setEventOccurenceCountAction            │ setEventOccurenceCountAction        
>     │ profileTags,demographic
> setPropertyAction                       │ setPropertyAction                   
>     │ allowMultipleInstances,profileTags,availableToEndUser,demographic
> setRemoteHostInfoAction                 │ setRemoteHostInfoAction             
>     │ profileTags,event
> updatePropertiesAction                  │ updatePropertiesAction              
>     │ profileTags,demographic {code}
>  
>  * Notice the action is now listed as: "helloWorldGroovyAction"
>  * Delete the action:
>  ** curl -X DELETE 
> 'http://localhost:8181/cxs/groovyActions/helloWorldGroovyAction' --user 
> karaf:karaf
>  * List the actions using the karaf shell: "unomi:action-list"
>  ** {color:#ff0000}*The action is still listed, no errors in unomi to 
> indicate that the deletion failed*{color}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to