Update of /var/cvs/tests/bridge/org/mmbase/bridge
In directory james.mmbase.org:/tmp/cvs-serv18960

Modified Files:
        NodeTest.java 
Log Message:
rmmci compatible way to check wheter security impelentation allows certain tests


See also: http://cvs.mmbase.org/viewcvs/tests/bridge/org/mmbase/bridge


Index: NodeTest.java
===================================================================
RCS file: /var/cvs/tests/bridge/org/mmbase/bridge/NodeTest.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- NodeTest.java       13 Jun 2008 10:05:24 -0000      1.21
+++ NodeTest.java       17 Jul 2008 16:02:04 -0000      1.22
@@ -12,6 +12,7 @@
 
 import java.util.Iterator;
 import org.mmbase.tests.*;
+import org.mmbase.security.AuthenticationData;
 
 /**
  * Basic test class to test <code>Node</code> from the bridge package.
@@ -283,9 +284,7 @@
         node.commit();
         // look it up again
         boolean found = false;
-        Iterator i = node.getAliases().iterator();
-        while (i.hasNext()) {
-            String alias = (String)i.next();
+        for (String alias : node.getAliases()) {
             if ("node_alias".equals(alias)) found = true;
         }
         assertTrue(found);
@@ -305,7 +304,8 @@
 
 
     public void testSetContext() {
-        if 
(org.mmbase.module.core.MMBase.getMMBase().getMMBaseCop().getAuthorization() 
instanceof org.mmbase.security.implementation.context.ContextAuthorization) {
+
+        if 
(Boolean.TRUE.equals(getCloudContext().getAuthentication().getAttribute(AuthenticationData.STORES_CONTEXT_IN_OWNER)))
 {
             String context = node.getContext();
             String otherContext = getOtherContext(node);
 
@@ -324,12 +324,12 @@
             assertEquals("Context did not change '" + otherContext + "' != '" 
+ node.getContext() + "'", otherContext, node.getContext());
             assertEquals(node.getContext(), node.getValue("owner"));
         } else {
-            System.err.println("Warning: could not execute 'set context' test, 
because security authorization implemention is no instance of 
ContextAuthorization");
+            System.err.println("Warning: could not execute 'set owner' test, 
because security authorization implemention does not store context in owner 
field");
         }
     }
 
     public void testSetOwner() {
-        if 
(org.mmbase.module.core.MMBase.getMMBase().getMMBaseCop().getAuthorization() 
instanceof org.mmbase.security.implementation.context.ContextAuthorization) {
+        if 
(Boolean.TRUE.equals(getCloudContext().getAuthentication().getAttribute(AuthenticationData.STORES_CONTEXT_IN_OWNER)))
 {
             String context = node.getContext();
             String otherContext = getOtherContext(node);
 
@@ -349,7 +349,7 @@
             assertEquals("Context did not change '" + otherContext + "' != '" 
+ node.getContext() + "'", otherContext, node.getContext());
             assertEquals(node.getContext(), node.getValue("owner"));
         } else {
-            System.err.println("Warning: could not execute 'set owner' test, 
because security authorization implemention is no instance of 
ContextAuthorization");
+            System.err.println("Warning: could not execute 'set owner' test, 
because security authorization implemention does not store context in owner 
field");
         }
 
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to