I was thinking more along the lines of this example that I copied and
pasted from the internets. I could see where it would be useful to have
the ability to do a simple web request and then potentially handle an
error out of it.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>drop DB => db_name</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>curl</executable>
<arguments>
<argument>-s</argument>
<argument>-S</argument>
<argument>-X</argument>
<argument>DELETE</argument>
<argument>http://${db.server}:${db.port}/db_name</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
--
Jason
On Tue, Dec 19, 2017, at 5:39 PM, Roy Teeuwen wrote:
> Hey Jason,
>
> Yup, thats what I got to at this point, maybe there was a cleaner way,
> but I guess this will do :)>
> Just for ppl for future references, this is my final result (pretty
> long, thats why I was looking for something less bulky, but could
> always make a separate plugin if necessary>
> <*plugin*>
>
>
>
>
> <*groupId*>org.codehaus.groovy.maven</*groupId*>
>
>
>
>
> <*artifactId*>gmaven-plugin</*artifactId*>
>
>
>
>
> <*executions*>
>
>
>
>
> <*execution*>
>
>
>
>
> <*id*>disable-dam-workflows</*id*>
>
>
>
>
> <*phase*>pre-integration-test</*phase*>
>
>
>
>
> <*goals*>
>
>
>
>
> <*goal*>execute</*goal*>
>
>
>
>
> </*goals*>
>
>
>
>
> <*configuration*>
>
>
>
>
> <*source*><![CDATA[
>
>
>
>
> import groovyx.net.http.HTTPBuilder
>
>
>
>
> import static groovyx.net.http.Method.POST
>
>
>
>
> import static groovyx.net.http.ContentType.*
>
>
>
>
>
>
>
>
>
> def setWorkflowEnabled(String resourcePath, Object
> propertyValue) {
>>
>
>
> println "Setting path=${resourcePath} enabled
> property to value=${propertyValue}"
>>
>
>
>
>
>
>
>
> String url = "${cq.protocol}://${cq.user}:${c-
> q.password}@${cq.host}:${cq.port}${cq.context-
> _root}${resourcePath}"
>>
>
>
>
>
>
>
>
> println url
>
>
>
>
> def http = new HTTPBuilder(url)
>
>
>
>
>
>
>
>
>
> http.request(POST) {
>
>
>
>
> requestContentType = URLENC
>
>
>
>
> body = [enabled: "${propertyValue}",
> "enabled@TypeHint": "Boolean"]
>>
>
>
>
>
>
>
>
> response.success = { resp ->
>
>
>
>
> println "POST response status:
> ${resp.statusLine}"
>>
>
>
> assert resp.statusLine.statusCode ==
> 200
>>
>
>
> }
>
>
>
>
> }
>
>
>
>
> }
>
>
>
>
>
>
>
>
>
> println "Disabling dam asset workflows"
>
>
>
>
>
>
>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /dam_xmp_writeback", false)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_create", false)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_create_without_DM", false)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_mod", false)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_mod_without_DM", false)
>>
>
>
> ]]></*source*>
>
>
>
>
> </*configuration*>
>
>
>
>
> </*execution*>
>
>
>
>
> <*execution*>
>
>
>
>
> <*id*>enable-dam-workflows</*id*>
>
>
>
>
> <*phase*>post-integration-test</*phase*>
>
>
>
>
> <*goals*>
>
>
>
>
> <*goal*>execute</*goal*>
>
>
>
>
> </*goals*>
>
>
>
>
> <*configuration*>
>
>
>
>
> <*source*><![CDATA[
>
>
>
>
> import groovyx.net.http.HTTPBuilder
>
>
>
>
> import static groovyx.net.http.Method.POST
>
>
>
>
> import static groovyx.net.http.ContentType.*
>
>
>
>
>
>
>
>
>
> def setWorkflowEnabled(String resourcePath, Object
> propertyValue) {
>>
>
>
> println "Setting path=${resourcePath} enabled
> property to value=${propertyValue}"
>>
>
>
>
>
>
>
>
> String url = "${cq.protocol}://${cq.user}:${c-
> q.password}@${cq.host}:${cq.port}${cq.context-
> _root}${resourcePath}"
>>
>
>
>
>
>
>
>
> println url
>
>
>
>
> def http = new HTTPBuilder(url)
>
>
>
>
>
>
>
>
>
> http.request(POST) {
>
>
>
>
> requestContentType = URLENC
>
>
>
>
> body = [enabled: "${propertyValue}",
> "enabled@TypeHint": "Boolean"]
>>
>
>
>
>
>
>
>
> response.success = { resp ->
>
>
>
>
> println "POST response status:
> ${resp.statusLine}"
>>
>
>
> assert resp.statusLine.statusCode ==
> 200
>>
>
>
> }
>
>
>
>
> }
>
>
>
>
> }
>
>
>
>
>
>
>
>
>
> println "Enabling dam asset workflows"
>
>
>
>
>
>
>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /dam_xmp_writeback", true)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_create", true)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_create_without_DM", true)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_mod", true)
>>
>
>
> setWorkflowEnabled("/etc/workflow/launcher/config-
> /update_asset_mod_without_DM", true)
>>
>
>
> ]]></*source*>
>
>
>
>
> </*configuration*>
>
>
>
>
> </*execution*>
>
>
>
>
> </*executions*>
>
>
>
>
> Greets,
> Roy
>
>> On 19 Dec 2017, at 23:32, Jason E Bailey
>> <[email protected]> wrote:>>
>> Maybe something like maven exec or maven antrun to perform a curl
>> command?>>
>> --
>> Jason
>>
>> On Tue, Dec 19, 2017, at 1:04 PM, Roy Teeuwen wrote:
>>> Hey all,
>>>
>>> I am searching for the fastest way to set and delete a property on a>>>
>>> resource of a specific path. I could use the gmaven-plugin and
>>> write a>>> groovy script to do this, but maybe there is already someone
>>> with a>>> better plugin for this and I don't have to write an ugly script
>>> for it>>> in my pom.xml.
>>>
>>> Just for the people who want to know what I want to achieve: I am
>>> installing my content package with test content(filevault xmls) and>>>
>>> images inside, but before I want to install it, I would like to
>>> disable>>> a workflow (more specifically the update dam asset workflow)
>>> because the>>> renditions are already in the test-content and it slows down
>>> the
>>> system>>> because of the heavy workflow/jobs triggering.
>>>
>>> Greets,
>>> Roy
>>> Email had 1 attachment:
>>> + signature.asc
>>> 1k (application/pgp-signature)
> Email had 1 attachment:
> * signature.asc 1k (application/pgp-signature)