Skip to content

Add tcpOptions inactivityTimeout FAT #31159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class TcpOptions extends ConfigElement {
private String addressExcludeList;
private String hostNameIncludeList;
private String hostNameExcludeList;
private String inactivityTimeout;
private Integer maxOpenConnections;
private Integer portOpenRetries;
private Integer soLinger;
Expand All @@ -48,6 +49,10 @@ public String getHostNameExcludeList() {
return hostNameExcludeList;
}

public String getInactivityTimeout() {
return inactivityTimeout;
}

public Integer getMaxOpenConnections() {
return maxOpenConnections;
}
Expand Down Expand Up @@ -85,6 +90,11 @@ public void setHostNameExcludeList(String hostNameExcludeList) {
this.hostNameExcludeList = hostNameExcludeList;
}

@XmlAttribute
public void setInactivityTimeout(String inactivityTimeout) {
this.inactivityTimeout = inactivityTimeout;
}

@XmlAttribute
public void setMaxOpenConnections(Integer maxOpenConnections) {
this.maxOpenConnections = maxOpenConnections;
Expand Down Expand Up @@ -114,6 +124,8 @@ public String toString() {
buf.append("hostNameIncludeList=\"" + hostNameIncludeList + "\" ");
if (getHostNameExcludeList() != null)
buf.append("hostNameExcludeList=\"" + hostNameExcludeList + "\" ");
if (getInactivityTimeout() != null)
buf.append("inactivityTimeout=\"" + inactivityTimeout + "\" ");
if (getMaxOpenConnections() != null)
buf.append("maxOpenConnections=\"" + maxOpenConnections + "\" ");
if (getPortOpenRetries() != null)
Expand Down
1 change: 1 addition & 0 deletions dev/io.openliberty.transport.http_fat/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="src" output="bin" path="fat/src"/>
<classpathentry kind="src" path="test-applications/app1/src"/>
<classpathentry kind="src" path="test-applications/InactivityTimeout.war/src"/>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
Expand Down
3 changes: 2 additions & 1 deletion dev/io.openliberty.transport.http_fat/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ bVersion=1.0
src: \
fat/src,\
test-applications/app1/src,\
test-applications/contentTypeApp/src
test-applications/contentTypeApp/src,\
test-applications/InactivityTimeout.war/src

fat.project: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@RunWith(Suite.class)
@SuiteClasses({
AccessListsTests.class,
InactivityTimeoutTests.class,
MaxOpenConnectionsTests.class,
PortOpenRetriesTests.class,
SoLingerTests.class,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public static void setup() throws Exception {

runningNetty = tcpChannelMessage.contains(NETTY_TCP_CLASS_NAME);
LOG.info("Running Netty? " + runningNetty);

}

@AfterClass
Expand Down Expand Up @@ -178,7 +177,7 @@ public void testMaxOpenConnections_invalid() throws Exception {
assertNotNull("CWWKO0211E was not found and should have been!", server.waitForStringInLogUsingMark("CWWKO0211E"));
assertNotNull("CWWKO0029E was not found and should have been!", server.waitForStringInLogUsingMark("CWWKO0029E"));

assertTrue("There were not at least two FFDCs created!", server.waitForMultipleStringsInLogUsingMark(2, "FFDC1015I") == 2);
assertTrue("There were not two FFDCs created!", server.waitForMultipleStringsInLogUsingMark(2, "FFDC1015I") == 2);

List<String> ffdcFileNames = server.listFFDCFiles(server.getServerName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,15 @@ public void testHostNameIncludeList_default() throws Exception {
// Validate that hostNameIncludeList default null.
assertNotNull("The default value of hostNameIncludeList was not null!", server.waitForStringInTrace("hostNameIncludeList: null"));
}

/**
* The test will check the default value of inactivityTimeout by searching the trace file.
*
* The default value is 60 seconds will be logged as 60000 miliseconds.
*/
@Test
public void testInactivityTimeout_default() throws Exception {
// Validate that inActivityTimeout default is 60s.
assertNotNull("The default value of inactivityTimeout was not: 60000!", server.waitForStringInTraceUsingMark("inactivityTimeout: 60000"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
###############################################################################
# Copyright (c) 2025 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
###############################################################################
bootstrap.include=../testports.properties
com.ibm.ws.logging.trace.specification=*=info:TCPChannel=all:HTTPChannel=all
com.ibm.ws.logging.max.file.size=100
com.ibm.ws.logging.max.files=10
com.ibm.ws.logging.trace.format=BASIC
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Copyright (c) 2025 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0
-->
<server description="Test tcpOptions inactivityTimeout configuration.">

<include location="../fatTestCommon.xml"/>

<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="${bvt.prop.HTTP_default}"
httpsPort="${bvt.prop.HTTP_default.secure}">
<tcpOptions portOpenRetries="60"/>
<!-- Set the readTimeout, and writeTimeout to 0 to force the use of the inactivityTimeout. -->
<httpOptions readTimeout="0" writeTimeout="0"/>
</httpEndpoint>

<featureManager>
<feature>servlet-3.1</feature>
</featureManager>

</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2025 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package io.openliberty.transport.http.inactivity.timeout.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Simple Servlet for testing the tcpOptions inactivityTimeout.
*/
@WebServlet("/InactivityTimeoutServlet")
public class InactivityTimeoutServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter writer = response.getWriter();
writer.println("Response from InactivityTimeoutServlet!");

writer.flush();
writer.close();
}
}