Skip to content

Commit

Permalink
Fixes applications tests on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Pinčuk <alexander.v.pinchuk@gmail.com>
  • Loading branch information
avpinchuk committed Feb 25, 2024
1 parent 3b692c4 commit 3a5f8a8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -67,9 +68,10 @@ public class HttpServletBasicAuthTest {
@BeforeAll
public static void prepareDeployment() {
keyFile = getDomain1Directory().resolve(Path.of("config", "keyfile123.txt")).toFile();
assertThat(ASADMIN.exec("create-auth-realm", "--classname",
"com.sun.enterprise.security.auth.realm.file.FileRealm", "--property",
"file=" + keyFile.getAbsolutePath() + ":jaas-context=fileRealm", "--target", "server", FILE_REALM_NAME),
assertThat(ASADMIN.exec("create-auth-realm",
"--classname", "com.sun.enterprise.security.auth.realm.file.FileRealm",
"--property", "file=" + keyFile.getAbsolutePath().replaceAll("([\\\\:])", "\\\\$1") + ":jaas-context=fileRealm",
"--target", "server", FILE_REALM_NAME),
asadminOK());
createFileUser(FILE_REALM_NAME, USER_NAME, USER_PASSWORD, "mygroup");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -72,9 +73,10 @@ public class HttpServletChallengeAuthTest {
@BeforeAll
public static void prepareDeployment() {
keyFile = getDomain1Directory().resolve(Path.of("config", "file123.txt")).toFile();
assertThat(ASADMIN.exec("create-auth-realm", "--classname",
"com.sun.enterprise.security.auth.realm.file.FileRealm", "--property",
"file=" + keyFile.getAbsolutePath() + ":jaas-context=fileRealm", "--target", "server", FILE_REALM_NAME),
assertThat(ASADMIN.exec("create-auth-realm",
"--classname", "com.sun.enterprise.security.auth.realm.file.FileRealm",
"--property", "file=" + keyFile.getAbsolutePath().replaceAll("([\\\\:])", "\\\\$1") + ":jaas-context=fileRealm",
"--target", "server", FILE_REALM_NAME),
asadminOK());
createFileUser(FILE_REALM_NAME, USER_NAME, USER_PASSWORD, "mygroup");
createFileUser(FILE_REALM_NAME, USER_NAME2, USER_PASSWORD2, "mygroup");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -76,9 +77,10 @@ public class HttpSoapEmbeddedAuthTest {
@BeforeAll
public static void prepareDeployment() {
keyFile = getDomain1Directory().resolve(Path.of("config", "file123.txt")).toFile();
assertThat(ASADMIN.exec("create-auth-realm", "--classname",
"com.sun.enterprise.security.auth.realm.file.FileRealm", "--property",
"file=" + keyFile.getAbsolutePath() + ":jaas-context=fileRealm", "--target", "server", FILE_REALM_NAME),
assertThat(ASADMIN.exec("create-auth-realm",
"--classname", "com.sun.enterprise.security.auth.realm.file.FileRealm",
"--property", "file=" + keyFile.getAbsolutePath().replaceAll("([\\\\:])", "\\\\$1") + ":jaas-context=fileRealm",
"--target", "server", FILE_REALM_NAME),
asadminOK());
createFileUser(FILE_REALM_NAME, USER_NAME, USER_PASSWORD, "mygroup");
createFileUser(FILE_REALM_NAME, USER_NAME2, USER_PASSWORD2, "mygroup");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -231,7 +232,7 @@ private void check200(String relativePath, String user) throws IOException {
try {
assertThat(connection.getResponseCode(), equalTo(200));
final String text = readResponseBody(connection);
assertThat(text, equalTo("Hello " + relativePath + "\n"));
assertThat(text, equalTo("Hello " + relativePath + System.lineSeparator()));
} finally {
connection.disconnect();
}
Expand Down

0 comments on commit 3a5f8a8

Please sign in to comment.