Skip to content

Commit

Permalink
release v3.2 (#21)
Browse files Browse the repository at this point in the history
What's new on this minor release

- Wait for disconnect support.
   - Now is possible to assert when a server disconnection occurs.
   > E.g: Makes possible to validate the behave of a LOGOFF command.
- Automatic *Wait for Disconnect* recognition.
  - When using the **Recorder** the **Terminal Emulator** will automatically detect for a server disconnection. Therefore a Wait for Disconnect is recorded and added to the current sampler.
- We have also fixed some issues:
  - Frozen screen when recording TN3270 protocol.
  - Not possible to send spaces as input.
  • Loading branch information
Baraujo25 committed Jun 9, 2021
1 parent e71603c commit 65a950f
Show file tree
Hide file tree
Showing 51 changed files with 998 additions and 271 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ The RTE Sampler fields are:
- *Cursor*. Waits for the cursor to appear at a specific location in the terminal window.
- *Silent*. Waits for the connection to be silent (with no interactions) for a specified amount of time.
- *Text*. Waits for a screen area to match a given specified regex.
- *Disconnect*. Wait for the server to send the disconnection signal.

##### Stable Period
All the "waiters" use a stable timeout value (in milliseconds) which specifies the time to wait for the emulator to remain at the desired state. The default value is 1000 milliseconds, but can be changed by adding the property `RTEConnectionConfig.stableTimeoutMillis=<time_in_millis>` in *jmeter.properties* file. The "Wait for silent" waiter is not affected by this setting since it has an explicit field for such purpose.
Expand Down Expand Up @@ -223,4 +224,4 @@ If you find any issue or something that is not supported by this plugin, please

*Debug log level* could be enabled by configuring the Log4j 2 Configuration File (adding `<Logger name="com.blazemeter.jmeter.rte" level="debug" />`) or via JMeter menu, how to do it from both ways are explained [here](https://www.blazemeter.com/blog/how-to-configure-jmeter-logging).

Otherwise you could [contribute](CONTRIBUTING.md) to the project.
Otherwise you could [contribute](CONTRIBUTING.md) to the project.
7 changes: 6 additions & 1 deletion docs/recorder/terminal-emulator/terminal-emulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

- **Sample name:** As the label says, you can specify the name of the sample in current screen.

**IMPORTANT**

If a disconnection from the server side occurs, <ins>*a disconnect wait condition will be added to the current sampler*</ins>.
However if you consider that the disconnection is not expected, it means that the server has suffer an unexpected error and the connections had to be closed.

### Input By Label Usage

![alt_text](input-by-label-usage.gif)
Expand All @@ -33,4 +38,4 @@

### Recorder Screen Assertion Usage

![alt_text](assertion-usage.gif)
![alt_text](assertion-usage.gif)
Binary file modified docs/rte-sampler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 0 additions & 31 deletions jmeter-plugins-build/Dockerfile

This file was deleted.

33 changes: 0 additions & 33 deletions jmeter-plugins-build/scripts/execute-on-vnc.sh

This file was deleted.

24 changes: 0 additions & 24 deletions jmeter-plugins-build/scripts/release.sh

This file was deleted.

11 changes: 0 additions & 11 deletions jmeter-plugins-build/scripts/set-git-credentials.sh

This file was deleted.

20 changes: 16 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>com.blazemeter.jmeter</groupId>
<artifactId>jmeter-bzm-rte</artifactId>
<packaging>jar</packaging>
<version>3.1.1</version>
<version>3.2</version>
<name>RTEPlugin Sampler as JMeter plugin</name>

<properties>
Expand Down Expand Up @@ -35,30 +35,42 @@
<dependency>
<groupId>com.github.blazemeter</groupId>
<artifactId>xtn5250</artifactId>
<version>3.2.2</version>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>com.github.blazemeter</groupId>
<artifactId>dm3270</artifactId>
<version>0.12.3-lib</version>
<version>0.13-lib</version>
</dependency>
<dependency>
<groupId>com.github.blazemeter</groupId>
<artifactId>jVT220</artifactId>
<version>jvt220-v1.3</version>
<version>jvt220-v1.3.1</version>
</dependency>

<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>${jmeter.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>commons-net</artifactId>
<groupId>commons-net</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>${jmeter.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>commons-net</artifactId>
<groupId>commons-net</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public abstract class BaseProtocolClient implements RteProtocolClient {
private static final Logger LOG = LoggerFactory.getLogger(BaseProtocolClient.class);
protected ExceptionHandler exceptionHandler;
protected ScheduledExecutorService stableTimeoutExecutor;
private ServerDisconnectHandler serverDisconnectHandler;

protected SocketFactory getSocketFactory(SSLType sslType, String server) throws RteIOException {
if (sslType != null && sslType != SSLType.NONE) {
Expand All @@ -41,6 +42,7 @@ protected SocketFactory getSocketFactory(SSLType sslType, String server) throws
@Override
public void send(List<Input> input, AttentionKey attentionKey, long echoTimeoutMillis)
throws RteIOException {
exceptionHandler.throwAnyPendingError();
input.forEach(i -> setField(i, echoTimeoutMillis));
sendAttentionKey(attentionKey);
exceptionHandler.throwAnyPendingError();
Expand Down Expand Up @@ -86,4 +88,27 @@ public void disconnect() throws RteIOException {

protected abstract void doDisconnect();

@Override
public void setDisconnectionHandler(ServerDisconnectHandler serverDisconnectHandler) {
this.serverDisconnectHandler = serverDisconnectHandler;
}

@Override
public boolean isServerDisconnected() {
if (serverDisconnectHandler != null) {
return serverDisconnectHandler.isExpectedDisconnection();
}
exceptionHandler
.setPendingError(new UnsupportedOperationException("No disconnection handler set"));
return false;
}

protected void handleServerDisconnection() {
if (serverDisconnectHandler != null) {
serverDisconnectHandler.onDisconnection(exceptionHandler);
return;
}
exceptionHandler
.setPendingError(new UnsupportedOperationException("No disconnection handler set"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ void send(List<Input> input, AttentionKey attentionKey, long echoTimeoutMillis)
void disconnect() throws RteIOException;

Set<AttentionKey> getSupportedAttentionKeys();

void setDisconnectionHandler(ServerDisconnectHandler serverDisconnectHandler);

boolean isServerDisconnected();
}
10 changes: 10 additions & 0 deletions src/main/java/com/blazemeter/jmeter/rte/core/Screen.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ private String buildHtmlDocumentString(Document doc) {
}
}

public static String replaceTrailingSpacesByNull(String str) {
StringBuilder nulls = new StringBuilder();
int i = str.length() - 1;
while (i >= 0 && str.charAt(i) == ' ') {
nulls.append('\u0000');
i--;
}
return str.substring(0, i + 1) + nulls.toString();
}

@Override
public String toString() {
return getHtml();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.blazemeter.jmeter.rte.core;

import com.blazemeter.jmeter.rte.core.listener.ExceptionHandler;

public abstract class ServerDisconnectHandler {

protected boolean isExpectedDisconnection;

protected ServerDisconnectHandler(boolean isExpectedDisconnection) {
this.isExpectedDisconnection = isExpectedDisconnection;
}

public boolean isExpectedDisconnection() {
return this.isExpectedDisconnection;
}

public abstract void onDisconnection(ExceptionHandler handler);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ public class ConnectionClosedException extends SocketException {
public ConnectionClosedException() {
super("Connection closed by remote end");
}

public ConnectionClosedException(String cause) {
super(cause);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.blazemeter.jmeter.rte.core.wait;

public class DisconnectWaitCondition extends WaitCondition {

public DisconnectWaitCondition(long timeoutMillis) {
super(timeoutMillis, 0);
}

@Override
public String getDescription() {
return "server to be disconnected";
}

@Override
public String toString() {
return "DisconnectWaitCondition{" +
"timeoutMillis=" + timeoutMillis +
'}';
}
}
Loading

0 comments on commit 65a950f

Please sign in to comment.