Hi Murali
You can simply import Java classes into your Beanshell script and
use them. Please see this example below.
import com.itko.lisa.vse.stateful.model.TransientResponse;
import com.itko.lisa.vse.stateful.model.Response;
import com.itko.util.ParameterList;
import com.itko.lisa.asset.AssetUtils;
import javax.net.ssl.SSLContext;
import java.security.SecureRandom;
import javax.net.ssl.HttpsURLConnection;
Response response1 = new Response();
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, null, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
response1.setBody(CheckJVMVendor.getJVMVersion());
ParameterList metadata = response1.getMetaData();
metadata.setParameterValue("HTTP-Response-Code","200");
TransientResponse transRsp = response1.createTransientCopy();
testExec.setStateObject("lisa.vse.response", transRsp);
return;
--
regards
Sankar Natarajan
--
This electronic communication and the information and any files transmitted
with it, or attached to it, are confidential and are intended solely for
the use of the individual or entity to whom it is addressed and may contain
information that is confidential, legally privileged, protected by privacy
laws, or otherwise restricted from disclosure to anyone else. If you are
not the intended recipient or the person responsible for delivering the
e-mail to the intended recipient, you are hereby notified that any use,
copying, distributing, dissemination, forwarding, printing, or copying of
this e-mail is strictly prohibited. If you received this e-mail in error,
please return the e-mail to the sender, delete it from your computer, and
destroy any printed copy of it.
Original Message:
Sent: 6/6/2022 4:32:00 AM
From: Muralidharan Saravanan
Subject: Help me in Beanshell Scripting
Hi ,
How can I use java inbuilt methods in Beanshell?
what are the statements/ packages I need to import?
How to spilit a string in Beanshell?
Can anyone help me on this.