forked from ESAPI/esapi-java-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllTests.java
More file actions
114 lines (100 loc) · 4.25 KB
/
Copy pathAllTests.java
File metadata and controls
114 lines (100 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* OWASP Enterprise Security API (ESAPI)
*
* This file is part of the Open Web Application Security Project (OWASP)
* Enterprise Security API (ESAPI) project. For details, please see
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
*
* Copyright (c) 2007 - The OWASP Foundation
*
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
* LICENSE before you use, modify, and/or redistribute this software.
*
* @author Jeff Williams <a href="http://www.aspectsecurity.com">Aspect Security</a>
* @created 2007
*/
package org.owasp.esapi;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* The Class AllTests.
*
* @author Jeff Williams (jeff.williams@aspectsecurity.com)
*/
public class AllTests extends TestCase {
/**
* Instantiates a new all tests.
*
* @param testName
* the test name
*/
public AllTests(String testName) {
super(testName);
}
/**
* {@inheritDoc}
*/
protected void setUp() throws Exception {
// none
}
/**
* {@inheritDoc}
*/
protected void tearDown() throws Exception {
// none
}
/**
* suite method automatically generated by JUnit module.
*
* @return the test
*/
public static Test suite() {
System.out.println( "INITIALIZING ALL TESTS" );
// The following property must be set in order for the tests to find the resources directory
// You can set it here, or you can launch JUnit with the VM argument
// -Dorg.owasp.esapi.resources="/Users/...ESAPI/test/testresources"
// System.setProperty(SecurityConfiguration.RESOURCE_DIRECTORY, "C:/Users/.../ESAPI/test/testresources");
// clear the User file to prep for tests
File file = new File((ESAPI.securityConfiguration()).getResourceDirectory(), "users.txt");
PrintWriter writer = null;
try {
writer = new PrintWriter(new FileWriter(file));
writer.println("# This is the user file associated with the ESAPI library from http://www.owasp.org");
writer.println("# accountName | hashedPassword | roles | locked | enabled | rememberToken | csrfToken | oldPasswordHashes | lastPasswordChangeTime | lastLoginTime | lastFailedLoginTime | expirationTime | failedLoginCount");
writer.println();
writer.flush();
} catch (IOException e) {
} finally {
if (writer != null) {
writer.close();
}
}
TestSuite suite = new TestSuite("AllTests");
suite.addTest(org.owasp.esapi.reference.LoggerTest.suite());
suite.addTest(org.owasp.esapi.reference.SafeFileTest.suite());
suite.addTest(org.owasp.esapi.reference.UserTest.suite());
suite.addTest(org.owasp.esapi.ESAPITest.suite());
suite.addTest(org.owasp.esapi.reference.RandomizerTest.suite());
suite.addTest(org.owasp.esapi.reference.AccessControllerTest.suite());
suite.addTest(org.owasp.esapi.reference.HTTPUtilitiesTest.suite());
suite.addTest(org.owasp.esapi.reference.ValidatorTest.suite());
suite.addTest(org.owasp.esapi.reference.EncryptorTest.suite());
suite.addTest(org.owasp.esapi.reference.IntrusionDetectorTest.suite());
suite.addTest(org.owasp.esapi.reference.AccessReferenceMapTest.suite());
suite.addTest(org.owasp.esapi.reference.IntegerAccessReferenceMapTest.suite());
suite.addTest(org.owasp.esapi.reference.ExecutorTest.suite());
suite.addTest(org.owasp.esapi.reference.EncoderTest.suite());
suite.addTest(org.owasp.esapi.reference.EncryptedPropertiesTest.suite());
suite.addTest(org.owasp.esapi.reference.AuthenticatorTest.suite());
// exceptions
suite.addTest(org.owasp.esapi.errors.EnterpriseSecurityExceptionTest.suite());
// filters
suite.addTest(org.owasp.esapi.filters.ESAPIFilterTest.suite());
return suite;
}
}