-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
690 additions
and
117 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
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
45 changes: 45 additions & 0 deletions
45
...curity/src/test/java/org/schoellerfamily/gedbrowser/security/test/SecurityTestHelper.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,45 @@ | ||
package org.schoellerfamily.gedbrowser.security.test; | ||
|
||
import java.io.BufferedOutputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
|
||
/** | ||
* @author dick | ||
*/ | ||
public final class SecurityTestHelper { | ||
/** Logger. */ | ||
private static final transient Log LOGGER = | ||
LogFactory.getLog(SecurityTestHelper.class); | ||
|
||
/** | ||
* Private constructor. | ||
*/ | ||
private SecurityTestHelper() { | ||
// Empty | ||
} | ||
/** | ||
* @param userFile the path of the file to reset | ||
*/ | ||
public static void resetUserFile(final String userFile) { | ||
LOGGER.info("resetting " + userFile); | ||
final String[] strings = { | ||
"schoeller@comcast.net,Richard,Schoeller," | ||
+ "schoeller@comcast.net,HAHANOWAY,USER,ADMIN\n", | ||
"guest,,,,guest,USER\n" }; | ||
try (FileOutputStream fstream = new FileOutputStream(userFile); | ||
BufferedOutputStream bstream = new BufferedOutputStream( | ||
fstream)) { | ||
for (final String string : strings) { | ||
bstream.write(string.getBytes(StandardCharsets.UTF_8)); | ||
} | ||
} catch (IOException e) { | ||
LOGGER.error("Problem writing user file", e); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.