Skip to content

Commit 508d223

Browse files
committed
remove login to console
1 parent d9364ca commit 508d223

File tree

2 files changed

+15
-33
lines changed

2 files changed

+15
-33
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModelsScale.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void testScaleClustersByPatchingClusterResource(String domainType) {
266266
assertDoesNotThrow(()
267267
-> verifyAdminServerRESTAccess("localhost", TRAEFIK_INGRESS_HTTP_HOSTPORT, false, hostHeader));
268268
} else {
269-
verifyAdminConsoleLoginUsingAdminNodePort(domainUid, domainNamespace);
269+
verifyReadyAppUsingAdminNodePort(domainUid, domainNamespace);
270270
// verify admin console login using ingress controller
271271
verifyReadyAppUsingIngressController(domainUid, domainNamespace);
272272
}
@@ -328,7 +328,7 @@ void testScaleClustersWithRestApi(String domainType) {
328328
assertDoesNotThrow(()
329329
-> verifyAdminServerRESTAccess("localhost", TRAEFIK_INGRESS_HTTP_HOSTPORT, false, hostHeader));
330330
} else {
331-
verifyAdminConsoleLoginUsingAdminNodePort(domainUid, domainNamespace);
331+
verifyReadyAppUsingAdminNodePort(domainUid, domainNamespace);
332332
// verify admin console login using ingress controller
333333
verifyReadyAppUsingIngressController(domainUid, domainNamespace);
334334
}
@@ -392,7 +392,7 @@ void testScaleClustersWithWLDF(String domainType) {
392392
assertDoesNotThrow(()
393393
-> verifyAdminServerRESTAccess("localhost", TRAEFIK_INGRESS_HTTP_HOSTPORT, false, hostHeader));
394394
} else {
395-
verifyAdminConsoleLoginUsingAdminNodePort(domainUid, domainNamespace);
395+
verifyReadyAppUsingAdminNodePort(domainUid, domainNamespace);
396396
// verify admin console login using ingress controller
397397
verifyReadyAppUsingIngressController(domainUid, domainNamespace);
398398
}
@@ -796,7 +796,7 @@ private static void startDomainAndVerify(String domainNamespace,
796796
}
797797

798798
// verify the admin console login using admin node port
799-
private void verifyAdminConsoleLoginUsingAdminNodePort(String domainUid, String domainNamespace) {
799+
private void verifyReadyAppUsingAdminNodePort(String domainUid, String domainNamespace) {
800800

801801
String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE;
802802
logger.info("Getting node port for default channel");
@@ -807,13 +807,13 @@ private void verifyAdminConsoleLoginUsingAdminNodePort(String domainUid, String
807807
// In OKD cluster, we need to get the routeHost for the external admin service
808808
String routeHost = getRouteHost(domainNamespace, getExternalServicePodName(adminServerPodName));
809809

810-
logger.info("Validating WebLogic admin server access by login to console");
810+
logger.info("Validating WebLogic readyapp");
811811
testUntil(
812812
assertDoesNotThrow(() -> {
813813
return adminNodePortAccessible(serviceNodePort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, routeHost);
814814
}, "Access to admin server node port failed"),
815815
logger,
816-
"Console login validation");
816+
"readyapp validation");
817817
}
818818

819819
// Verify admin console login using ingress controller

integration-tests/src/test/java/oracle/weblogic/kubernetes/assertions/impl/Domain.java

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
package oracle.weblogic.kubernetes.assertions.impl;
55

66
import java.io.IOException;
7+
import java.net.http.HttpResponse;
78
import java.time.OffsetDateTime;
89

9-
import com.gargoylesoftware.htmlunit.WebClient;
10-
import com.gargoylesoftware.htmlunit.html.HtmlElement;
11-
import com.gargoylesoftware.htmlunit.html.HtmlForm;
12-
import com.gargoylesoftware.htmlunit.html.HtmlPage;
1310
import io.kubernetes.client.openapi.ApiException;
1411
import io.kubernetes.client.openapi.Configuration;
1512
import io.kubernetes.client.openapi.apis.ApiextensionsV1Api;
@@ -19,7 +16,7 @@
1916
import oracle.weblogic.domain.DomainResource;
2017
import oracle.weblogic.kubernetes.actions.impl.primitive.Command;
2118
import oracle.weblogic.kubernetes.actions.impl.primitive.CommandParams;
22-
import oracle.weblogic.kubernetes.logging.LoggingFacade;
19+
import oracle.weblogic.kubernetes.utils.OracleHttpClient;
2320

2421
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
2522
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
@@ -32,7 +29,6 @@
3229
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
3330
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
3431
import static org.junit.jupiter.api.Assertions.assertNotNull;
35-
import static org.junit.jupiter.api.Assertions.assertTrue;
3632

3733
public class Domain {
3834

@@ -146,41 +142,27 @@ public static boolean adminT3ChannelAccessible(String domainUid, String namespac
146142
}
147143

148144
/**
149-
* Verify admin node port(default/t3channel) is accessible by login to WebLogic console
150-
* using the node port and validate its the Home page.
145+
* Verify admin node port(default/t3channel) is accessible with readyapp url.
151146
*
152147
* @param nodePort the node port that needs to be tested for access
153148
* @param userName WebLogic administration server user name
154149
* @param password WebLogic administration server password
155150
* @param routeHost For OKD - name of the route for external admin service. Can be empty for non OKD env
156-
* @return true if login to WebLogic administration console is successful
151+
* @return true if /weblogic/ready returns 200 http status
157152
* @throws IOException when connection to console fails
158153
*/
159154
public static boolean adminNodePortAccessible(int nodePort, String userName, String password, String routeHost)
160-
throws IOException {
161-
162-
LoggingFacade logger = getLogger();
163-
155+
throws Exception {
164156
String hostAndPort = getHostAndPort(routeHost, nodePort);
165157
String readyAppUrl = new StringBuffer()
166158
.append("http://")
167159
.append(hostAndPort)
168160
.append("/weblogic/ready").toString();
169161

170-
getLogger().info("Accessing WebLogic console with url {0}", readyAppUrl);
171-
final WebClient webClient = new WebClient();
172-
//final HtmlPage loginPage = assertDoesNotThrow(() -> webClient.getPage(readyAppUrl),
173-
final HtmlPage loginPage = assertDoesNotThrow(() -> webClient.getPage(readyAppUrl),
174-
"connection to the WebLogic admin console failed");
175-
HtmlForm form = loginPage.getFormByName("loginData");
176-
form.getInputByName("j_username").type(userName);
177-
form.getInputByName("j_password").type(password);
178-
HtmlElement submit = form.getOneHtmlElementByAttribute("input", "type", "submit");
179-
getLogger().info("Clicking login button");
180-
HtmlPage home = submit.click();
181-
assertTrue(home.asNormalizedText().contains("Persistent Stores"), "Home does not contain Persistent Stores text");
182-
getLogger().info("Console login passed");
183-
return true;
162+
getLogger().info("Accessing WebLogic readyapp with url {0}", readyAppUrl);
163+
HttpResponse<String> response;
164+
response = OracleHttpClient.get(readyAppUrl, null, true);
165+
return response.statusCode() == 200;
184166
}
185167

186168
/**

0 commit comments

Comments
 (0)