portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r693080 - /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
Date Mon, 08 Sep 2008 12:44:13 GMT
Author: woonsan
Date: Mon Sep  8 05:44:12 2008
New Revision: 693080

URL: http://svn.apache.org/viewvc?rev=693080&view=rev
Log:
Flattening the Principal API.
Modified profiler test case to use new flattened security APIs.

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java?rev=693080&r1=693079&r2=693080&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-profiler/src/test/java/org/apache/jetspeed/profiler/TestProfiler.java
Mon Sep  8 05:44:12 2008
@@ -39,8 +39,8 @@
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.jetspeed.security.PrincipalsSet;
 import org.apache.jetspeed.security.SecurityHelper;
-import org.apache.jetspeed.security.impl.RolePrincipalImpl;
-import org.apache.jetspeed.security.impl.UserPrincipalImpl;
+import org.apache.jetspeed.security.impl.RoleImpl;
+import org.apache.jetspeed.security.impl.UserImpl;
 import org.apache.jetspeed.serializer.JetspeedSerializer;
 
 /**
@@ -204,10 +204,20 @@
         Set publicCredentials = new HashSet();
         Set privateCredentials = new HashSet();
         
-        principals.add(new UserPrincipalImpl("david"));
-        principals.add(new RolePrincipalImpl("ATP"));
-        principals.add(new RolePrincipalImpl("NB"));        
-        principals.add(new RolePrincipalImpl("ATP-NB"));        
+        UserImpl user = new UserImpl();
+        user.setName("david");
+        RoleImpl roleATP = new RoleImpl();
+        roleATP.setName("ATP");
+        RoleImpl roleNB = new RoleImpl();
+        roleATP.setName("NB");
+        RoleImpl roleATPNB = new RoleImpl();
+        roleATPNB.setName("ATP-NB");
+        
+        principals.add(user);
+        principals.add(roleATP);
+        principals.add(roleNB);        
+        principals.add(roleATPNB);
+        
         Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);
       
         return subject;
     }
@@ -218,9 +228,17 @@
         Set publicCredentials = new HashSet();
         Set privateCredentials = new HashSet();
         
-        principals.add(new UserPrincipalImpl("david"));
-        principals.add(new RolePrincipalImpl("ATP"));
-        principals.add(new RolePrincipalImpl("NB"));        
+        UserImpl user = new UserImpl();
+        user.setName("david");
+        RoleImpl roleATP = new RoleImpl();
+        roleATP.setName("ATP");
+        RoleImpl roleNB = new RoleImpl();
+        roleATP.setName("NB");
+
+        principals.add(user);
+        principals.add(roleATP);
+        principals.add(roleNB);
+        
         Subject subject = new Subject(true, principals, publicCredentials, privateCredentials);
       
         return subject;
     }
@@ -241,7 +259,9 @@
         assertTrue("default rule class not mapped", rule instanceof StandardProfilingRule);
 
         // Test anonymous principal-rule
-        ProfilingRule anonRule = profiler.getRuleForPrincipal(new UserPrincipalImpl("anon"),
+        UserImpl user = new UserImpl();
+        user.setName("anon");
+        ProfilingRule anonRule = profiler.getRuleForPrincipal(user,
                 ProfileLocator.PAGE_LOCATOR);
         assertNotNull("anonymous rule is null", anonRule);
         assertTrue("anonymous rule is j1", anonRule.getId().equals(DEFAULT_RULE));
@@ -485,7 +505,9 @@
     public void testGetLocatorNames() throws Exception
     {
         assertNotNull("profiler service is null", profiler);
-        String[] result = profiler.getLocatorNamesForPrincipal(new UserPrincipalImpl("guest"));
+        UserImpl user = new UserImpl();
+        user.setName("guest");
+        String[] result = profiler.getLocatorNamesForPrincipal(user);
         for (int ix = 0; ix < result.length; ix++)
         {
             System.out.println("$$$ result = " + result[ix]);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message