reverted to junit 3
This commit is contained in:
parent
630efbf536
commit
0f32b3fc40
|
@ -1,10 +1,8 @@
|
|||
package org.springframework.security.acls.domain;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.AccessDeniedException;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
|
@ -24,15 +22,19 @@ import org.springframework.security.providers.TestingAuthenticationToken;
|
|||
*
|
||||
* @author Andrei Stefan
|
||||
*/
|
||||
public class AclImplementationSecurityCheckTests {
|
||||
@Before
|
||||
@After
|
||||
public void clearContext() {
|
||||
public class AclImplementationSecurityCheckTests extends TestCase {
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void securityCheckNoACEs() {
|
||||
protected void tearDown() throws Exception {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
public void testSecurityCheckNoACEs() {
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] {
|
||||
new GrantedAuthorityImpl("ROLE_GENERAL"), new GrantedAuthorityImpl("ROLE_AUDITING"),
|
||||
new GrantedAuthorityImpl("ROLE_OWNERSHIP") });
|
||||
|
@ -96,8 +98,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void securityCheckWithMultipleACEs() {
|
||||
public void testSecurityCheckWithMultipleACEs() {
|
||||
// Create a simple authentication with ROLE_GENERAL
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") });
|
||||
|
@ -198,8 +199,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void securityCheckWithInheritableACEs() {
|
||||
public void testSecurityCheckWithInheritableACEs() {
|
||||
// Create a simple authentication with ROLE_GENERAL
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password",
|
||||
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_GENERAL") });
|
||||
|
@ -257,8 +257,7 @@ public class AclImplementationSecurityCheckTests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void securityCheckPrincipalOwner() {
|
||||
public void testSecurityCheckPrincipalOwner() {
|
||||
Authentication auth = new TestingAuthenticationToken("user", "password", new GrantedAuthority[] {
|
||||
new GrantedAuthorityImpl("ROLE_ONE"), new GrantedAuthorityImpl("ROLE_ONE"),
|
||||
new GrantedAuthorityImpl("ROLE_ONE") });
|
||||
|
|
|
@ -5,10 +5,8 @@ import java.io.PrintStream;
|
|||
import java.io.Serializable;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.acls.AccessControlEntry;
|
||||
import org.springframework.security.acls.Acl;
|
||||
import org.springframework.security.acls.AuditableAccessControlEntry;
|
||||
|
@ -20,24 +18,25 @@ import org.springframework.security.acls.sid.Sid;
|
|||
*
|
||||
* @author Andrei Stefan
|
||||
*/
|
||||
public class AuditLoggerTests {
|
||||
public class AuditLoggerTests extends TestCase {
|
||||
//~ Instance fields ================================================================================================
|
||||
|
||||
private PrintStream console;
|
||||
|
||||
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void onSetUp() {
|
||||
public void setUp() throws Exception {
|
||||
console = System.out;
|
||||
System.setOut(new PrintStream(bytes));
|
||||
}
|
||||
|
||||
@After
|
||||
public void onTearDown() {
|
||||
public void tearDown() throws Exception {
|
||||
System.setOut(console);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loggingTests() {
|
||||
public void testLoggingTests() {
|
||||
ConsoleAuditLogger logger = new ConsoleAuditLogger();
|
||||
MockAccessControlEntryImpl auditableAccessControlEntry = new MockAccessControlEntryImpl();
|
||||
|
||||
|
@ -68,9 +67,8 @@ public class AuditLoggerTests {
|
|||
Assert.assertTrue(bytes.size() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock {@link AuditableAccessControlEntry}.
|
||||
*/
|
||||
//~ Inner Classes ==================================================================================================
|
||||
|
||||
private class MockAccessControlEntryImpl implements AuditableAccessControlEntry {
|
||||
private boolean auditFailure = false;
|
||||
|
||||
|
@ -113,9 +111,6 @@ public class AuditLoggerTests {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock {@link AccessControlEntry}.
|
||||
*/
|
||||
private class MockAccessControlEntry implements AccessControlEntry {
|
||||
|
||||
public Acl getAcl() {
|
||||
|
|
Loading…
Reference in New Issue