From 834aeef34d15692ccb2fd8c8ccf3a866436e83b8 Mon Sep 17 00:00:00 2001 From: Jon Hawkes Date: Fri, 22 Nov 2024 10:28:46 +0000 Subject: [PATCH] Remove ClearResourcesServlet --- .../com/ibm/ws/wsat/fat/util/WSATTest.java | 22 ------------ .../src/client/RecoverySetupServlet.java | 8 +++-- .../src/server/ClearResourcesServlet.java | 36 ------------------- .../src/tests/ReroutePeerRecoveryTest.java | 2 +- .../fat/src/tests/SingleRecoveryTest.java | 10 +----- 5 files changed, 8 insertions(+), 70 deletions(-) delete mode 100644 dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryServer/src/server/ClearResourcesServlet.java diff --git a/dev/com.ibm.ws.transaction.fat.util/src/com/ibm/ws/wsat/fat/util/WSATTest.java b/dev/com.ibm.ws.transaction.fat.util/src/com/ibm/ws/wsat/fat/util/WSATTest.java index e0700d7f8d2..c6b12fc6db7 100644 --- a/dev/com.ibm.ws.transaction.fat.util/src/com/ibm/ws/wsat/fat/util/WSATTest.java +++ b/dev/com.ibm.ws.transaction.fat.util/src/com/ibm/ws/wsat/fat/util/WSATTest.java @@ -85,26 +85,4 @@ public static void deleteStateFiles(LibertyServer... servers) throws Exception { server.deleteFileFromLibertyServerRoot(stateFile); } } - - public static void callClearResourcesServlet(String app, LibertyServer... servers) throws Exception{ - final String method = "callClearResourcesServlet"; - int expectedConnectionCode = HttpURLConnection.HTTP_OK; - String servletName = "ClearResourcesServlet"; - - for (LibertyServer server : servers) { - String urlStr = "http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + app + "/" + servletName; - - Log.info(WSATTest.class, method, "callClearResourcesServlet URL: " + urlStr); - HttpURLConnection con = HttpUtils.getHttpConnection(new URL(urlStr), - expectedConnectionCode, REQUEST_TIMEOUT); - try { - HttpUtils.getConnectionStream(con).readLine(); - } finally { - con.disconnect(); - } - - server.setMarkToEndOfLog(); - server.setTraceMarkToEndOfDefaultTrace(); - } - } } \ No newline at end of file diff --git a/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryClient/src/client/RecoverySetupServlet.java b/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryClient/src/client/RecoverySetupServlet.java index 3582d3c918e..fa55151ee0f 100644 --- a/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryClient/src/client/RecoverySetupServlet.java +++ b/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryClient/src/client/RecoverySetupServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2023 IBM Corporation and others. + * Copyright (c) 2020, 2024 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 @@ -25,6 +25,7 @@ import javax.xml.ws.BindingProvider; import com.ibm.tx.jta.ut.util.TxTestUtils; +import com.ibm.tx.jta.ut.util.XAResourceImpl; @WebServlet({ "/RecoverySetupServlet" }) public class RecoverySetupServlet extends HttpServlet { @@ -37,10 +38,13 @@ public class RecoverySetupServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - TxTestUtils.setTestResourcesFile(); int number = Integer.parseInt(request.getParameter("number").trim()); System.out.println("==============RecoverySetupServlet Test Number: " + number + "================"); + + TxTestUtils.setTestResourcesFile(); + XAResourceImpl.clear(); + String BASE_URL = request.getParameter("baseurl"); if (BASE_URL == null || BASE_URL.equals("")){ BASE_URL = "http://localhost:"+Integer.parseInt(System.getProperty("HTTP_secondary")); diff --git a/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryServer/src/server/ClearResourcesServlet.java b/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryServer/src/server/ClearResourcesServlet.java deleted file mode 100644 index 63674567600..00000000000 --- a/dev/com.ibm.ws.wsat.recovery_fat.lps/test-applications/recoveryServer/src/server/ClearResourcesServlet.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2020, 2023 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 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package server; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.ibm.tx.jta.ut.util.TxTestUtils; -import com.ibm.tx.jta.ut.util.XAResourceImpl; - -@SuppressWarnings("serial") -@WebServlet({ "/ClearResourcesServlet" }) -public class ClearResourcesServlet extends HttpServlet { - - protected void doGet(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - TxTestUtils.setTestResourcesFile(); - System.out.println("==============ClearResourcesServlet================"); - XAResourceImpl.clear(); - } -} diff --git a/dev/com.ibm.ws.wsat.recovery_fat.multi.9/fat/src/tests/ReroutePeerRecoveryTest.java b/dev/com.ibm.ws.wsat.recovery_fat.multi.9/fat/src/tests/ReroutePeerRecoveryTest.java index 5d80910cb44..0491a3e0fba 100644 --- a/dev/com.ibm.ws.wsat.recovery_fat.multi.9/fat/src/tests/ReroutePeerRecoveryTest.java +++ b/dev/com.ibm.ws.wsat.recovery_fat.multi.9/fat/src/tests/ReroutePeerRecoveryTest.java @@ -121,8 +121,8 @@ public void after() throws Exception { @Before public void before() throws Exception { Log.info(ReroutePeerRecoveryTest.class, "before", ""); + WSATTest.deleteStateFiles(server3, server5); FATUtils.startServers(runner, server1, server2, server3, server4, server5, server6); - WSATTest.callClearResourcesServlet(recoveryServer, server3, server5); server3.setTraceMarkToEndOfDefaultTrace(); server5.setTraceMarkToEndOfDefaultTrace(); } diff --git a/dev/com.ibm.ws.wsat.recovery_fat.single.1/fat/src/tests/SingleRecoveryTest.java b/dev/com.ibm.ws.wsat.recovery_fat.single.1/fat/src/tests/SingleRecoveryTest.java index 43cbd515f18..29d97edf626 100644 --- a/dev/com.ibm.ws.wsat.recovery_fat.single.1/fat/src/tests/SingleRecoveryTest.java +++ b/dev/com.ibm.ws.wsat.recovery_fat.single.1/fat/src/tests/SingleRecoveryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022, 2023 IBM Corporation and others. + * Copyright (c) 2022, 2024 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 @@ -58,11 +58,6 @@ public static void beforeTests() throws Exception { FATUtils.startServers(server1); } - - @Before - public void before() throws Exception { - WSATTest.callClearResourcesServlet("recoveryServer", server1); - } @AfterClass public static void tearDown() throws Exception { @@ -70,9 +65,6 @@ public static void tearDown() throws Exception { } protected void recoveryTest(String id) throws Exception { -// Log.info(this.getClass(), "recoveryTest", "We are in "+new File(".").getCanonicalPath()); -// Log.info(this.getClass(), "recoveryTest", "Printing "+new File("../../").getCanonicalPath()); -// Log.info(this.getClass(), "recoveryTest", printDirectoryTree(new File("../../"))); final String method = "recoveryTest"; String result = null; String logKeyword = "Jordan said in test: ";