DBFit - Could not invoke constructor for Connect[4] - dbfit

My script:
!contents -R2 -g -p -f -h
!path lib/*.jar
|import |
|dbfit.SqlServerTest|
!|dbfit.SqlServerTest|
!|Connect|SUKHI-PC\SQLEXPRESS|SUKHI-PC\XXX|XXX|XXX|
Masked a few details but the error message is:
Could not invoke constructor for Connect[4].
Don't understand. From what I've read online it may be that my Path is not correct but no idea what it's looking for as Connect is a command not fixture. Any help would be appreciated.

I know its an old post, but for future reference purposes; "Could not invoke constructor for Connect[4]" error is thrown by fitnesse when I was trying to connect to a sql server in a dbfit test using slim server without calling DatabaseEnvironment constructor. you can overcome this error by planning your dbfit test something like below..
!define TEST_SYSTEM {fit}
|Import |
|dbfit.fixture|
|dbfit.SqlServerTest|
!|DatabaseEnvironment|sqlserver |
|Connect |11.11.11.11:8888|username|password|databasename|

Related

How to Use Command Line Parameters by using JMeter?

I'm using Jmeter for testing APIs and I want to parametrize the project's path from the terminal and then I want to use this parameter in JMeter. I set testurl = test.com in basic terminal and i want to get this url by using testurl. The parameter that I've sent via Command Line : ./jmeter -n -t your_script.jmx -l -Jurl=$testurl in homebrew terminal. The parameter that I've used in httpsRequest --> Server name or IP; ${__P(url)}. But when I run my automation in the homebrew terminal, my test scripts are not going to URL that's been defined. Please help me!! Thanks.
From first impression it seems what you are trying should work, but devil is in the detail. I would suggest you try:
Verify if the environment variable is set correctly use export testurl=test.com (removed spaces). Try verify using echo $testurl
Try debug sampler which should help you verify if JMeter is picking up the var correctly: https://www.blazemeter.com/blog/how-debug-your-apache-jmeter-script/
Hope this helps.

JMeter- property values are not substituted when running from CLI

I am currently using JMeter 5.1.1 on a Mac and have developed a very simple JMeter project to test out property value substitutions via Command Line. My JMeter project is pretty simple with a Dummy Sampler trying to print out the following
${__P(resources.folder)}, ${__P(propertiesfile)} and ${__property(propertiesfile)}
Link to JMeter project image
I am trying to run this project via CLI using the command
jmeter -n -t TestProj.jmx -l jmeter/TestProjResults.jtl -j jmeter/TestProj.log -Dresources.folder=/Users/h244955/Coding/bga/spogdashboard/tests/perf -Dpropertiesfile=baforgeperfproperties
The values are not getting substituted and I am seeing the following in the log:
2019-10-22 20:48:09,531 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: ${__P(resources.folder)}
${__P(propertiesfile)}
${__property(propertiesfile)}
2019-10-22 20:48:09,533 DEBUG o.a.j.t.p.AbstractProperty: Not running version, return raw function string
2019-10-22 20:48:09,533 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: ${__P(resources.folder)}
${__P(propertiesfile)}
${__property(propertiesfile)}
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: Dummy Sampler used to simulate requests and responses
without actual network activity. This helps debugging tests.
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: Dummy Sampler used to simulate requests and responses
without actual network activity. This helps debugging tests.
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: About to replace in property of type: class org.apache.jmeter.testelement.property.StringProperty: ${__Random(50,500)}
2019-10-22 20:48:09,534 DEBUG o.a.j.t.p.AbstractProperty: Not running version, return raw function string
2019-10-22 20:48:09,534 DEBUG o.a.j.e.u.ValueReplacer: Replacement result: ${__Random(50,500)}
However, when I run this project from GUI with the help of declaring the same properties using a JSR223 Sampler, the values are getting substituted in the Dummy Sampler as expected. I tried looking around for answers for the highlighted log above, but in vain.
You need to override JMeter property using -J:
jmeter -n -t TestProj.jmx -Jresources.folder=/Users/h244955/Coding/bga/spogdashboard/tests/perf -Jpropertiesfile=baforgeperfproperties -l jmeter/TestProjResults.jtl -j jmeter/TestProj.log
-D[prop_name]=[value]
defines a java system property value.
-J[prop_name]=[value]
defines a local JMeter property.
To add additional JMeter property file use -q
-q, --addprop <argument>
additional JMeter property file(s)
I cannot reproduce the issue:
so my expectation is that your JMeter installation is broken somehow, i.e. make sure that ApacheJMeter_functions.jar file is present in "lib/ext" folder of your JMeter installation
Make sure to get JMeter from the official downloads page and check the downloaded archive integrity, check How to Get Started With JMeter: Part 1 - Installation & Test Plans article for details.
Make sure to launch JMeter from its "bin" folder, to wit
cd /path/where/jmeter/lives/bin
./jmeter -Dpropertiesfile=baforgeperfproperties -n -t test.jmx ....
this ./jmeter bit is important to ensure that you launch JMeter from the current folder, not from another folder in your MacOS PATH

Publishing an .apk into IBM Application Center from Application Center command-line tools

I'm trying to publish an .apk into my Application Center through console. I've followed this note but it doesn't work in my environment:
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/moving-production/distributing-mobile-applications-with-application-center/#cmdLineTools
If I type :
./acdeploytool.sh /home/miguel/Downloads/HelloWorldMyHelloAndroid.apk
I get this error message:
FWLAC0803E: Unable to connect:
Connection refused
Perhaps the server or context is wrongly specified.
File:/home/myUser/Downloads/HelloWorldMyHelloAndroid.apk
And if I try another way using this java command:
java com.ibm.appcenter.Upload -f http://localhost:9080 -c applicationcenter -u demo -p demo /home/myUser/Downloads/HelloWorldMyHelloAndroid.apk
I get this one:
Error: Could not find or load main class com.ibm.appcenter.Upload
I don't get any errors when I do this 'publish' operation directly in Application Center or through MobileFirst Studio.
Miguel, whether you use the script or the Java command, you need to specify the arguments to use. Please try the following:
./acdeploytool.sh -s http://localhost:9080 -c applicationcenter -u demo -p demo /home/miguel/Downloads/HelloWorldMyHelloAndroid.apk
I tried a similar command in my environment and was able to successfully deploy the apk to Application Center. If the command still does not work, make sure that the host/port that you are using are correct, and that the username and password are valid.
For the Java command that you executed, I see a few problems. First, the -cp argument needs to be specified in order to add the applicationcenterdeploytool.jar and json4j.jar files to the classpath. Next, the command shows "-f", but it should be "-s" to specify the server. Lastly, the path that was specified for the .apk is different than what you specified in the first command: myUser vs. miguel. So make sure that the correct path is used. If there are any further questions, let me know. Thanks.

Running the WLST interpreter silently

I am trying to figure out a way to make the weblogic WLST terminal run in silent mode.
When i start the terminal with the java weblogic.WLST command, it prints the lines:
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Is there a command line flag or some unknown witchcraft to make the interpreter not write these lines?
I wishfully tried -s for silent, to no avail.
And all my googling lead me to an -i flag that does something completely different.
EDIT:
To clarify my purpose:
I need the interpreter to run a python script, and i do need the output from that. The welcome message is useless clutter however, that i would like to be rid of.
Limited to:
The only problem i have is the first lines written by the interpreter itself. Once inside the python script i have no problem handling what send to the output. My only problem is the welcome lines written above. These are written by the interpreter itself, and not the python code.
To solve the problem, I did something little differente..
I put a grep -v in the output .. like this:
java weblogic.WLST script.py $ARGS | grep -v "Initializing WebLogic
Scripting Tool (WLST) ..." | grep -v "Welcome to WebLogic Server
Administration Scripting Shell" | grep -v "Type help() for help on
available commands" | grep -v "Successfully connected to Admin Server
\"AdminServer\" that belongs to domain \"domain\"." | grep -v
"Warning: An insecure protocol was used to connect to the server." |
grep -v "To ensure on-the-wire security, the SSL port or Admin port
should be used instead." | grep -v "Location changed to domainRuntime
tree. This is a read-only tree" | grep -v "with DomainMBean as the
root MBean." | grep -v "For more help, use help('domainRuntime')" |
grep -v "Successfully connected to Admin Server" | grep -v "Connecting
to t3://"
Try this:
Like you said "it's a hack", but it's a fairly elegant hack.
Create the file runwlst.sh:
#!/bin/bash
. ${WLS_HOME}/server/bin/setWLSEnv.sh >/dev/null 2>&1
FILENAME=$1
shift
java weblogic.WLST ${FILENAME} "$#" | sed -e "1,7 d"
WLS_HOME needs to be set, or use the absolute path to setWLSEnv.sh.
Then create your WLST scripts as "shell" scripts like so (I like to use the ".wlsh" extension for my scripts):
#!/bin/bash /absolute_path_to_runwlst.sh/runwlst.sh
# your WLST Python code starts here
import ...
This obviously the sed script used in runwlst.sh only works if the "Initializing" banner is 7 lines long, which could change with new releases or patches of WLS.
The benefit of this solution is that now you can just run your WLST scripts from the command line like so:
$ createManagedServer.wlsh domain servername
Or use WLST scripts is other shell scipts like so:
#!/bin/bash
PORT=`./getPortForManagedServer.wlsh domain server`
echo ${PORT}
you get the picture
I wanted for it to only show me lines that I print inside the script, so I did it simple - prepended special char sequence to all lines I wanted to see in logs (it was print('--> ...') in my case) and launched it like that:
wlst.sh changePassword.wlst.py "$#" | grep -- "-->"
Sample output:
Executing WLST script for domain SampleDomain
--> Executing credential change for SampleDomain
--> Changing DB password for DSTYPE1
--> Changing password for DataSource SampleDS1
--> Successfully changed DB credentials!
--> Changing password for DataSource SampleDS2
--> No JDBC resource with name SampleDS2 found, skipping...
--> Changing password for DataSource SampleDS3
--> No JDBC resource with name SampleDS3 found, skipping...
--> Changing password for DataSource SampleDS4
--> Successfully changed DB credentials!
Completed execution for domain SampleDomain
Bit of a long shot but you could also silence the entire JVM output by capturing stdout and stderr into a different stream and then print values captured from the weblogic mbeans to the console streams. I had to do something similar a while back after writing an ansible module which required me to return pure JSON to stdout without any message banners or other stuff printed to the terminal.
A possible solution for your needs would involve writing a python script that first changes the OutputStreams as in this example and then starts a WSLT session. Just remember to keep a "copy" of the console out streams and use these to write your results to.

DB2 generate DLL error

Earlier this morning I trying to create DLL for my DB2 database but it kept giving the following message:
The DB2 Administration Server encountered a script error. Script
error code "1".
Explanation:
A script error was encountered while the DB2 Administration server was
executing the script. The script exited with error code "".
User response:
Verify that the script is correct.
If you continue to receive this error message after attempting the
suggested response, refer to the DB2 Administration Server's First
Failure Data Capture Log for additional information or contact IBM
Support.
can anyone help me on this?
my user is ROOT and schema is SQLJ
command is db2look -d OBDB -z SQLJ -u ROOT -e -l -x -c ;
Error code is SQL22220.
i once too had this problem. may be you are trying to generate dll for more than 30 tables at a time. reduce the no. of tables and see if this works. worked for me though but errors can be due to other reason as well, plz let me know.... :)