Execute a XQuery script directly from Gradle instead of from QConsole - gradle

I would like to execute a XQuery script directly from Gradle instead of from QConsole.
How to do that?
Is there a mlGradle task for that? Or we could define a task like running MLCP from gradle?

You can create a custom task that extends the ServerEvalTask.
As demonstrated in the Custom tasks that talk to the Client REST API WIKI page
task myXQueryTask(type: com.marklogic.gradle.task.ServerEvalTask) {
xquery = "my XQuery code here"
}
If you are looking to read the contents of the code from a particular file, instead of a static string, then could instead do something like:
new File('/path/to/file').getText('UTF-8')

Related

LoadRunner Controller XML File - Basic Scheduling mode

I want to create a LoadRunner scenario using XML file that I can execute through CLIControllerApp.exe and possibly in the Jenkins Pipeline. I found the XML structure here https://admhelp.microfocus.com/lr/en/12.60-12.63/help/WebHelp/Content/Controller/scenario-run-cli.htmis. My question is how to write a scheduler with Run Mode = Basic. The documentation says the tag should have <Data> and then a <Duration> tag with a positive integer value. In my case, I would like to run the VuGen script until it is complete just once. What should I write in the <Scheduler><Data><Duration> tag?
Thanks.

Display gradle property in readme.md file

I have a gradle project with a gradle.properties file. One of the properties displays the current version of my project and I would like to include this proprerty in the project's README.md on github. How can I do this?
The Gradle Copy task is capable of such functionality. Simply use its expand method to specify the values to insert. Of course you'll need to define a template somewhere in your project:
task copy(type: Copy) {
from 'src/templates'
into "$buildDir"
include 'projectinfo.html.template'
rename { file -> 'projectinfo.html' }
expand(project: project, title: 'ProjectInfo', generated: new Date())
}
I took this example from a post of Mr. Hakis Blog.
This functionality is based on the Groovy SimpleTemplateEngine. Of course you can simply use this class or any other templating engine to implement the required functionality in your build script on your own.
#KrispyK,
I believe this would be possible. You could write a simple serverless script using webtask (or similar service) that reads your gradle properties file and creates a custom status badge using a badge service like shields.io. Finally, you would only need to add this badge to your markdown file.
Please refer to this webtask script that I created. This calls an external API and uses the data returned by that API to create a custom Shields badge.
I've then used this badge in my readme file.
Hope this helps.

Unable to fetch BasicReport.htm_source.xml in Openscript Test Result folder after execution

I'm trying to create a custom HTML report out of BasicReport.htm_source.xml in the Test Result folder.
I'm not able to access the xml file during script execution. Eventhough I used the XML rendering function in the finish() node.
Is their anyway I can use the BasicReport.htm_source.xml after script execution?
finish section is still execution, in short no way to do this.
if an Oracle customer, use official channel to create ER

Validate Boo script syntactically without running it

I have use BOO as an embedded script language in my own program. And I want to check the syntax errors of a script which a user writes. So I don't need to run the script by something like interpreter.Eval method and I need just running the first steps of compiler in order to discover the syntax error in user's script. Is there any way I can do that?
Thanks
http://boo.codehaus.org/How+To+Compile:
There are basically three ways to compile your boo code:
through the booc utility;
through the booc task (one of the nant tasks);
through the Boo.Lang.Compiler API;

Gradle plugin, how to hook Jacoco agent to jvm

Hello there Gradle gurus!
I'm seeking for your mighty experience and knowledge :)
I have a Gradle plugin that hooks a Jacoco agent to the jvm. Currently my code looks like this:
Task t = project.allTasks.getByPath(project.getName+":"+"test");
t.jvmArgs = ["-javaagent:"+jacocoAgentJar+"=destfile=" + coverageResultFile.getCanonicalPath()];
This is working fine but since dynamic properties are deprecated I want to somehow get rid of them. However... changing the code to t.ext.jvmArgs = ["-javaagent:"+jacocoAgentJar+"=destfile=" + coverageResultFile.getCanonicalPath()]; doesnt work.
Could someone please explain to me how am I supposed to hook the Jacoco agent to the jvm withought using this dynamic property?
Thanks
If you get a "dynamic properties" warning here, there is likely something wrong with your code, and it's not just a style issue. For one thing, the use of getAllTasks (which, by the way, takes a boolean parameter) is inappropriate here. Instead, you should use project.tasks.getByName("test"), which can be abbreviated to project.tasks["test"] or even project.test. Or, if you want to catch all test tasks, project.tasks.withType(Test).
you can configure directly the test task in the build file adding a configuration closure like this:
test{
jvmArgs "javaagent:"+jacocoAgentJar+"=destfile=" + overageResultFile.getCanonicalPath()"
}
Not a direct answer to your question, but you may want to look into the gradle-jacoco plugin.

Resources