-
Notifications
You must be signed in to change notification settings - Fork 2
Writing System Objects
The Following guidelines provide the necessary steps required to write and implement system objects.
-
The System object class should extend the class
jsystem.framework.system.SystemObjectImpl
-
The “system object” must have a default constructor.
-
The system object class members should be exposed with setters and getters.
-
The system object initialization should be implemented in the
public void init() throws Exception
method. If there is no need for specific system object initialization, do not implement the method. If it is required then call thesuper.init()
method. -
The system Object resource release and finalization should be implemented in the
public void close()
method. If there is no need to finalize a specific system object, do not implement the method. If it is required call thesuper.close()
method. -
All system object operations should be exposed as plain public java methods.
-
As with java objects, system objects can be initialized directly by developer code, in order to enjoy the SUT independence and lifecycle management services let the system instantiate the system object by calling the
system.getSystemObject(“name”)
method.
Note: The purpose of the system object is to hide the complexity of SUT interaction, enabling test authors the ability to avoid dealing with these complexities. In order to stream line testing operations only expose simple and well documented methods to the user.
package com.aqua.services.demo;
import jsystem.framework.system.SystemObjectImpl;
import com.aqua.sysobj.conn.CliCommand;
import com.aqua.sysobj.conn.CliConnectionImpl;
import com.aqua.sysobj.conn.WindowsDefaultCliConnection;
public class SimpleWindowsStation extends SystemObjectImpl {
private String host;
private String userName;
private String password;
private CliConnectionImpl cliConnection;
public void init() throws Exception {
super.init();
cliConnection = new WindowsDefaultCliConnection(getHost(),getUserName(),getPassword());
cliConnection.init();
report.step("In init method");
}
public void close(){
report.step("In close method");
cliConnection.close();
super.close();
}
public void mkdir(String folderName) throws Exception {
CliCommand cmd = new CliCommand("mkdir " + folderName);
cmd.addErrors("unknown command");
cliConnection.handleCliCommand("created dir " + folderName, cmd);
setTestAgainstObject(cliConnection.getTestAgainstObject());
}
public void dir(String folderName) throws Exception {
CliCommand cmd = new CliCommand("dir " + folderName);
cmd.addErrors("unknown command");
cliConnection.handleCliCommand("dir " + folderName, cmd);
setTestAgainstObject(cmd.getResult());
}
public void ping(String host) throws Exception {
CliCommand cmd = new CliCommand("ping " + host);
cmd.addErrors("unknown command");
cliConnection.handleCliCommand("ping " + host, cmd);
setTestAgainstObject(cliConnection.getTestAgainstObject());
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
Copyright (c) 2021 JSystem Software
- Introduction
- Interface Overview
- Building Blocks
- System Objects
- Framework Services
- Advanced Functionality
- Core System Objects
- Cli (SSH/Telnet/RS323)