Skip to content
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

[WFLY-19450] mail Quickstarts should have a root webpage similar to helloworld #937

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions mail/src/main/webapp/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
JBoss, Home of Professional Open Source
Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual
Copyright 2024, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.

Expand All @@ -14,10 +14,21 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<!-- Plain HTML page that kicks us into the app -->

<html>
<html lang="en">
<head>
<meta http-equiv="Refresh" content="0; URL=home.jsf">
<meta charset="UTF-8">
<title>mail</title>
</head>
<body>
<div style="text-align:center">

<h1>Hello There! Welcome to WildFly!</h1>
<h2>The mail quickstart application has been deployed and running successfully.</h2>
<a href="home.jsf" title="Go to the application">Access the mail application here</a>

</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.time.Duration;

import static org.junit.Assert.assertEquals;
import static org.jboss.as.quickstarts.mail.TestUtils.getServerHost;

/**
* The very basic runtime integration testing.
Expand All @@ -34,19 +35,10 @@
*/
public class BasicRuntimeIT {

private static final String DEFAULT_SERVER_HOST = "http://localhost:8080/mail";

@Test
public void testHTTPEndpointIsAvailable() throws IOException, InterruptedException, URISyntaxException {
String serverHost = System.getenv("SERVER_HOST");
if (serverHost == null) {
serverHost = System.getProperty("server.host");
}
if (serverHost == null) {
serverHost = DEFAULT_SERVER_HOST;
}
final HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(serverHost))
.uri(new URI(getServerHost()))
.GET()
.build();
final HttpClient client = HttpClient.newBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;

import static org.jboss.as.quickstarts.mail.TestUtils.getServerHost;

import java.time.Duration;

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
Expand All @@ -37,15 +39,7 @@ public void testSetup() {
driver = new ChromeDriver(options);
driver.manage().window().maximize();

String serverHost = System.getenv("SERVER_HOST");
if (serverHost == null) {
serverHost = System.getProperty("server.host");
}
if (serverHost == null) {
serverHost = DEFAULT_SERVER_HOST;
}

driver.get(serverHost);
driver.get(getServerHost());
driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));
}

Expand Down
32 changes: 32 additions & 0 deletions mail/src/test/java/org/jboss/as/quickstarts/mail/TestUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2024 JBoss by Red Hat.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.as.quickstarts.mail;

public class TestUtils {
static final String DEFAULT_SERVER_HOST = "http://localhost:8080/mail";
static final String MAINPAGE_PATH = "/home.jsf";

static String getServerHost() {
String serverHost = System.getenv("SERVER_HOST");
if (serverHost == null) {
serverHost = System.getProperty("server.host");
}
if (serverHost == null) {
serverHost = DEFAULT_SERVER_HOST;
}
return serverHost + MAINPAGE_PATH;
}
}