I need to import impex lines through cronjob for which I have written below code,
Code
I am writing this code in public PerformResult perform(final CronJobModel arg0). If I import this impex manaully from hac, it gets imported successfully. Following is the error I am getting on logs,
log error
Thanks...
I would strongly recommend using ModelService for implementations like this.
secFilingsComponent.setName("2014 Filings 1");
secFilingsComponent.setUrlLink("#");
secFilingsComponent.setSlots(CollectionUtils.union(oldSlots, newSlots));
modelService.save(secFilingsComponent);
If the changes you want to do should only be executed once, I would recommend using hmc/backoffice and do them manually or execute the Impex in the hac:
https://localhost:9002/hac/console/impex/import
I think that you have to replace cmsComponents(&componentRef) by cmsComponents(uid,$contentCV) in the first INSERT_UPDATE.
Related
I am using LoadUI 2.6.8 and SoapUI 5.0.
I have been able to do Property Transfers into Test Case properties that are successfully passed between SoapUI Runners in LoadUI as described here: http://www.loadui.org/soapui-integration/passing-along-testcase-properties.html
The problem I am having is that one of the properties I am setting via a Groovy Script like this:
def tc = testRunner.testCase.testSuite.getTestCaseByName("Auth and Start Up")
tc.setPropertyValue("Cookie","$jsesid")
is not being updated in LoadUI (when the groovy script runs) and thus not being passed around properly.
I have to use a groovy script because the cookie comes in as part of the response header and the normal Property Transfer Step doesn't allow me to do the transfer.
Has anyone encountered this before? Any insight into why this would be happening?
Thanks!
UPDATE: I managed to get around this issue by updating the Authentication API response to include the cookie as part of the response body (instead of just the header) and thus I was able to use the Property Transfer step which seems to work. This is still a workaround though.
Thanks for the link SiKing, I think I actually ran across that while trying to figure out the cookies, which I eventually managed to get working by setting the headers manually using the script. In order to test if it was a cookie issue I used another property. I added the following line to the groovy script:
tc.setPropertyValue("testprop","blah")
ran it in SoapUI and the property value is set ok. I then changed the value of the test case property "testprop" in the SoapUI test case to "a" manually and saved the project.
In LoadUI I ran the SoapUI Runner and the output for this property shows as "a" eventhough the groovy script ran fine. The more I play around with it the more I think its some kind of bug in LoadUI :(
I have a question very similar to this: Reading file from Workspace in Jenkins with Groovy script
However I need to read the file from a System Groovy script so the solution of using Text-finder or the Groovy PostBuild plugin will not work.
How can I get the workspace path from a system groovy script? I have tried the following:
System.getenv('WORKSPACE')
System.getProperty("WORKSPACE")
build.buildVariableResolver.resolve("WORKSPACE")
Thanks!
If you have a file called "a.txt" in your workspace, along with a script called "sysgvy.groovy" that you want to execute as a system groovy script. Suppose your "sysgvy.groovy" script needs to read the file "a.txt".
The issue of this topic is that if your script read "a.txt" directly without providing any path, "sysgvy.groovy" executes and will throw an error saying cannot find "a.txt".
I have tested and found that the following method works good.
def build = Thread.currentThread().executable
Then use
build.workspace.toString()+"\\a.txt"
as the full location string to replace "a.txt".
It's also important to run on the Jenkins master machine by placing "a.txt" and "sysgvy.groovy" onto Jenkins master machine's workspace. Executing on slave machine does not work.
Try it, the file should be found and get read in the script without any problem.
If there is problem with variable Thread, it is just that some modules need to be imported. So add these lines to the start of code:
import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*
Each build has a workspace, so you need to find the desired project first. (The terms "job" and "project" are used rather interchangeable in Jenkins - also in the API.)
After that, you can either cross your fingers and just call getWorkspace(), which is deprecated (see JavaDoc for details).
Or you can find a specific build (e.g. the last), which can give you the workspace used for that specific build via the getWorkspace() method as it is defined in the AbstractBuild class.
Example code:
Jenkins.instance.getJob('<job-name>').lastBuild.workspace;
Just use
build.workspace
The "build" variable is available keyword in System Groovy Script.
I'm using the Groovy Grails Tool Suite to practice Groovy. I want to run a Groovy Shell, but when I create a new shell and try to run it, I get this error:
Could not find $jarName on the class path. Please add it manually
What does this mean, and how do I resolve this?
I believe this is happening because JLine can't be found on your classpath. I submitted a PR to make the error message in this case actually useful.
I had a similar problem with this exact same message, but the reason was that I was attempting to run the script without specifying which script to run. Ensure you have the script open in the editing window and trying running it again - that got rid of the message for me.
I have a set of 60 testcases in a project in SoapUI that I want to run concurrently. Each testcase needs to use a value to work. The values are stored in an external file (spreadsheet or textfile). Each testcase needs to get a value from this file and use it. However when I run the testsuite, multiple tests are picking up the same value however only one value can be used for a test (same value cannot be used in more than 1 test at the same time). I would like the external file to be accessed by one testcase at a time in soapUI. Does this involve locking or some sort of queueing system or what groovyscript could I use? thanks
I can't figure out how to get this to work with your external file, but I can think of another way only using SoapUI. Here's my suggestion for a solution:
Create a new TestCase containing only a DataGen TestStep.
Configure it so that it generates the numbers you want.
Change its mode to "READ", so that it will generate a new value every time the test step is run.
Now, wherever you want one of these values, instead of accessing your external file, add a Run TestCase TestStep to run your new DataGen test case, and make sure to return the generated number as a property. Use it where you need the generated number.
As I'm typing this, I just realized this only works with the pro version of SoapUI. If you don't have a license you can get a trial from the website.
I'd like to run an individual test method instead of the entire test class in Groovy on the cli - is this possible?
So instead of all the test methods in MyTestClass, I'd like to run just the testArbitrary method in MyTestClass.
Any help appreciated.
In Intellij Idea you could create run configuration, that will start single test method. Command will be copied to output panel and will look like so
com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit3 package.TestClass,testMethod
Like this, you can create your custom JUnitStarter class as described here https://stackoverflow.com/a/9288513/1601606
Natively, there is no such class, but it's pretty simple to create it.