Exception while try to get jmeter directory - csv

I would like to start jmeter load test via console but it's Data Driven Load Test, so I need to read some information from csv files. I found a solution to include into User Parameters row to get the path to the place where the script was launched:
${__BeanShell(newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toString()).getParent())}
but I got an error in logs:
2013/06/11 15:23:54 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Sourced file: inline evaluation of:
``newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toStrin
. . . '' : Command not found: newFile( java.lang.String )
2013/06/11 15:23:54 WARN - jmeter.functions.BeanShell: Error running
BSH script org.apache.jorphan.util.JMeterException: Error invoking bsh
method: eval Sourced file: inline evaluation of:
``newFile(org.apache.jmeter.gui.GuiPackage.getInstance().getTestPlanFile().toStrin
. . . '' : Command not found: newFile( java.lang.String ) at
org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:192)
What's wrong with this method?

The issue is you have:
newFile
instead of:
new File

Related

Extra character placed in path of DSC config - Azure PS

I'm trying to work out why I'm getting the error below; the path to the configuration.ps1 file should be configuration\configuration.ps1, however its failing as its reading it as configuration.0\configuration.ps1.
the whole error message is below, has anyone else come across this?
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "VMExtensionProvisioningError",
"message": "VM has reported a failure when processing extension 'CreateADPDC'. Error message: \"The DSC Extension received an incorrect input: An error occurred while
executing script or module 'configuration.ps1': The term 'C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.77.0.0\\bin\\..\\DSCWork\\configuration.0\\configuration.ps1' is not
recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again..\nPlease correct the input and retry executing the extension.\"."
}
]
}
}'
At line:4 char:14
+ ... New-AzureRmResourceGroupDeployment -Name "coredeployment1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 18:31:08 - VM has reported a failure when processing extension 'CreateADPDC'. Error message: "The DSC Extension received an incorrect input: An
error occurred while executing script or module 'configuration.ps1': The term
'C:\Packages\Plugins\Microsoft.Powershell.DSC\2.77.0.0\bin\..\DSCWork\configuration.0\configuration.ps1' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again..
Please correct the input and retry executing the extension.".
Thanks in advance :)

Running WinRM quickconfig for remote servers

I am writing a PowerShell script that reads in a list of hosts from a file. I have tried two separate methods, having issues with both.
First Method:
$WinRM = Invoke-Command -Computer $server -ScriptBlock { WinRM quickconfig }
This gives the following error message on some of the hosts:
WSManFault
+ CategoryInfo : NotSpecified: (WSManFault:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : svclebetapool01.lehi.micron.com
Message = Access is denied.
Error number: -2147024891 0x80070005
Access is denied.
Second Method:
$WinRM = C:\PSTools\PsExec.exe \\$server -s winrm.cmd quickconfig -q
This sets $WinRM to the exit code (1 on successful execution). If I redirect the output with > or >>, then it displays the PsExec copyright. I am looking for the exact message that is created by the WinRM quickconfig command so that I know how to handle it in different situations.
if your intention is to enable PowerShell remoting, then you can
C:\PSTools\PsExec.exe \\$server PowerShell.exe -c "Enable-PSRemoting -Force"
or
wmic /node:$Server process call create "PowerShell.exe -c 'Enable-PSRemoting -Force'"

GRAILS-2.5 Handling syntax errors on external configuration

I have application developed using Grails 2.5.
In the the "Config.groovy" file i have included external configuration file like this:
grails.config.locations = []
def locationAdder = ConfigFinder.&addLocation.curry(grails.config.locations)
[CONFIG-1 : "base_config.groovy",
CONFIG-2 : "app_configuration.groovy"
].each { envName, defaultFileName -> locationAdder(envName, defaultFileName) }
In the "app_configuration.groovy" file i have all the application level configuration.
My question is how to catch the "syntax errors" when server is loading this configuration files, like ex.:
if i have configuration like
some_configuration=["key": "value"]
and if it has an syntax errors like
some_configuration=["key": "value
Notice that above it missed double quote and ending bracket, in this case the server will not load all the configurations.
If any one know that how to catch exception and reload the configurations with corrected configuration.
You can not catch Exception in external config. You may just add some log which in case of failure, at least have got some clue where it is failed.
println "External config: Part 1 loaded "
println "External Config: Part n loaded "
....

What is causing this error when I call apoc.load.csv?

CALL apoc.load.csv('FILE:///Neo4j_AttributeProvenance.csv',{sep:","})
The error is:
Failed to invoke procedure apoc.load.csv: Caused by:
java.lang.RuntimeException: Can't read CSV from URL
file:/Neo4j_AttributeProvenance.csv
I am able to read from this csv file using this statement:
LOAD CSV WITH HEADERS FROM "FILE:///Neo4j_AttributeProvenance.csv" AS CSVLine CREATE (q:car { })
I have already added this line to the neo4j.conf:
apoc.import.file.enabled=true

Collection runs in Postman, and not in Newman - Invalid URI error

I have a collection that runs in Postman, and not in Newman.
This is the error -
newman -c Products.postman_collection.json -e Products.postman_environment.json
Iteration 1 of 1
RequestError: [d395a91e-4220-4c2c-81bd-cff20cac63b8] 'Product Detail' terminated. Complete error:
Error: Invalid URI "http:///%7B%7BbaseUrl%7D%7D/shop/%7B%7BapiVer%7D%7D/products/samsung-ypk3?client_id=%7B%7BclientId%7D%7D"
at Request.init (/usr/local/lib/node_modules/newman/node_modules/request/request.js:288:31)
at new Request (/usr/local/lib/node_modules/newman/node_modules/request/request.js:142:8)
at request (/usr/local/lib/node_modules/newman/node_modules/request/index.js:55:10)
at Object.jsface.Class._execute (/usr/local/lib/node_modules/newman/src/runners/RequestRunner.js:181:26)
at Timeout._onTimeout (/usr/local/lib/node_modules/newman/src/runners/RequestRunner.js:87:20)
at tryOnTimeout (timers.js:224:11)
at Timer.listOnTimeout (timers.js:198:5)
RequestError: [f909ee1b-334a-40ed-94ec-4398c12bd442] 'Product Images' terminated. Complete error:
Error: Invalid URI "http:///%7B%7BbaseUrl%7D%7D/shop/%7B%7BapiVer%7D%7D/products/samsung-ypk3/images?client_id=%7B%7BclientId%7D%7D"
at Request.init (/usr/local/lib/node_modules/newman/node_modules/request/request.js:288:31)
at new Request (/usr/local/lib/node_modules/newman/node_modules/request/request.js:142:8)
at request (/usr/local/lib/node_modules/newman/node_modules/request/index.js:55:10)
at Object.jsface.Class._execute (/usr/local/lib/node_modules/newman/src/runners/RequestRunner.js:181:26)
at Timeout._onTimeout (/usr/local/lib/node_modules/newman/src/runners/RequestRunner.js:222:20)
at tryOnTimeout (timers.js:224:11)
at Timer.listOnTimeout (timers.js:198:5)
The URI in Postman looks like this -
http://{{baseUrl}}/{{apiType}}/{{apiVer}}/products/{{productId}}?client_id={{clientId}}
When I open the collection's JSON file, this is what that the URI looks like -
"url": "http://{{baseUrl}}/{{apiType}}/{{apiVer}}/products/{{productId}}?client_id={{clientId}}"
Any ideas on what could be causing the Invalid URI error?
Updated the newman invocation to the following -
newman -c Products.postman_collection.json -e globals.postman_globals.json -e Products.postman_environment.json
where the first env var file is the Postman globals, and the second env var file is the collection specific env vars. Still seeing the same error.
Had to pass the globals file with a -g option. So the final command looks like -
newman -c Products.postman_collection.json -g globals.postman_globals.json -e Products.postman_environment.json