-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from eclipse-ee4j/ondromih-change-passwords
Custom init.sh script, master/admin passwords via ENV vars
- Loading branch information
Showing
12 changed files
with
488 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/test/java/org/glassfish/main/distributions/docker/ChangePasswordsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (c) 2025 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
package org.glassfish.main.distributions.docker; | ||
|
||
import java.net.http.HttpResponse; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.junit.jupiter.Container; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
import static org.glassfish.main.distributions.docker.HttpUtilities.getServerDefaultRoot; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.stringContainsInOrder; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.glassfish.main.distributions.docker.HttpUtilities.getAdminResource; | ||
|
||
/** | ||
* | ||
* @author Ondro Mihalyi | ||
*/ | ||
@Testcontainers | ||
public class ChangePasswordsIT { | ||
|
||
@SuppressWarnings({"rawtypes", "resource"}) | ||
@Container | ||
private final GenericContainer server = new GenericContainer<>(System.getProperty("docker.glassfish.image")) | ||
.withExposedPorts(8080, 4848) | ||
.withEnv("AS_ADMIN_MASTERPASSWORD", "mymasterpassword") | ||
.withEnv("AS_ADMIN_PASSWORD", "myadminpassword") | ||
.withLogConsumer(o -> System.err.print("GF: " + o.getUtf8String())); | ||
|
||
@Test | ||
void rootResourceGivesOkWithDefaultResponse() throws Exception { | ||
final HttpResponse<String> defaultRootResponse = getServerDefaultRoot(server); | ||
assertEquals(200, defaultRootResponse.statusCode(), "Response status code"); | ||
assertThat(defaultRootResponse.body(), stringContainsInOrder("Eclipse GlassFish", "index.html", "production-quality")); | ||
} | ||
|
||
@Test | ||
void customAdminPassword() throws Exception { | ||
final HttpResponse<String> adminResourceResponse = getAdminResource(server, "/management/domain.json", | ||
new UserPassword("admin", "myadminpassword")); | ||
assertEquals(200, adminResourceResponse.statusCode(), "Response status code"); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/test/java/org/glassfish/main/distributions/docker/DefaultIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2025 Contributors to the Eclipse Foundation. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0, which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the | ||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | ||
* version 2 with the GNU Classpath Exception, which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
*/ | ||
|
||
package org.glassfish.main.distributions.docker; | ||
|
||
import java.net.http.HttpResponse; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.junit.jupiter.Container; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
import static org.glassfish.main.distributions.docker.HttpUtilities.getServerDefaultRoot; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.stringContainsInOrder; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@Testcontainers | ||
public class DefaultIT { | ||
|
||
@SuppressWarnings({"rawtypes", "resource"}) | ||
@Container | ||
private final GenericContainer server = new GenericContainer<>(System.getProperty("docker.glassfish.image")) | ||
.withExposedPorts(8080) | ||
.withLogConsumer(o -> System.err.print("GF: " + o.getUtf8String())); | ||
|
||
@Test | ||
void rootResourceGivesOkWithDefaultResponse() throws Exception { | ||
final HttpResponse<String> defaultRootResponse = getServerDefaultRoot(server); | ||
assertEquals(200, defaultRootResponse.statusCode(), "Response status code"); | ||
assertThat(defaultRootResponse.body(), stringContainsInOrder("Eclipse GlassFish", "index.html", "production-quality")); | ||
} | ||
} |
Oops, something went wrong.