Skip to content

Commit

Permalink
[WFLY-2321] Don't copy the file, instead just reference the existing …
Browse files Browse the repository at this point in the history
…file.
  • Loading branch information
darranl authored and bstansberry committed Oct 17, 2013
1 parent c1dcec1 commit 9ce7b66
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;

import org.jboss.as.domain.management.security.adduser.AddUser;
import org.junit.Test;

/**
Expand All @@ -43,20 +40,8 @@ public class PasswordCheckUtilTestCase {
@Test
public void testInitRestriction() throws URISyntaxException, IOException {
final URL resource = PasswordCheckUtilTestCase.class.getResource("add-user.properties");
File configFile = new File(resource.toURI());

File addUser = new File(AddUser.CONFIG_FILE);
InputStream is = resource.openStream();
FileOutputStream fos = new FileOutputStream(addUser);
byte[] temp = new byte[1024];
int count = -1;
while ((count = is.read(temp)) > 0) {
fos.write(temp, 0, count);
}
fos.close();
is.close();

System.setProperty(AddUser.CONFIG_FILE, configFile.getAbsolutePath());
File addUser = new File(resource.getFile());
final List<PasswordRestriction> passwordRestrictions = PasswordCheckUtil.create(addUser).getPasswordRestrictions("ggrossetie");
assertPasswordRejected(passwordRestrictions, "ggrossetie", "Password must not match username");
assertPasswordRejected(passwordRestrictions, "abc12", "Password must have at least 8 characters");
Expand Down

0 comments on commit 9ce7b66

Please sign in to comment.