Author: andreas
Date: Sun Mar 2 11:21:36 2008
New Revision: 632810
URL: http://svn.apache.org/viewvc?rev=632810&view=rev
Log:
Allow to override user ID for tests, attach session to request when logging in again.
Modified:
lenya/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
Modified: lenya/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java?rev=632810&r1=632809&r2=632810&view=diff
==============================================================================
--- lenya/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java (original)
+++ lenya/trunk/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java Sun Mar 2 11:21:36 2008
@@ -55,6 +55,7 @@
throws AccessControlException {
Session session = new SessionImpl(null, true, getManager(), getLogger());
+ getRequest().setAttribute(Session.class.getName(), session);
DefaultAccessController ac = getAccessController(session, TEST_PUB_ID);
AccreditableManager acMgr = ac.getAccreditableManager();
@@ -145,7 +146,7 @@
super.tearDown();
}
- protected static final String USERNAME = "lenya";
+ protected static final String USER_ID = "lenya";
/**
* Returns the policy manager.
@@ -181,12 +182,16 @@
protected Session getSession() {
if (this.session == null) {
try {
- this.session = login("lenya");
+ this.session = login(getUserId());
} catch (AccessControlException e) {
throw new RuntimeException(e);
}
}
return this.session;
+ }
+
+ protected String getUserId() {
+ return USER_ID;
}
protected Publication getPublication(Session session, String pubId) throws PublicationException {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.