directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r292669 - /directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
Date Fri, 30 Sep 2005 07:58:35 GMT
Author: trustin
Date: Fri Sep 30 00:58:31 2005
New Revision: 292669

URL: http://svn.apache.org/viewcvs?rev=292669&view=rev
Log:
Added DummyAttributeTypeRegistry to test RelatedProtectedItemFilter.

Added:
    directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
  (with props)

Added: directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java?rev=292669&view=auto
==============================================================================
--- directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
(added)
+++ directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
Fri Sep 30 00:58:31 2005
@@ -0,0 +1,231 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.authz.support;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.naming.NamingException;
+
+import org.apache.ldap.common.schema.AttributeType;
+import org.apache.ldap.common.schema.MatchingRule;
+import org.apache.ldap.common.schema.Syntax;
+import org.apache.ldap.common.schema.UsageEnum;
+import org.apache.ldap.server.schema.AttributeTypeRegistry;
+
+/**
+ * A mock {@link AttributeTypeRegistry} to test {@link ACITupleFilter} implementations.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ *
+ */
+public class DummyAttributeTypeRegistry implements AttributeTypeRegistry
+{
+    private final boolean returnOperational;
+
+    public DummyAttributeTypeRegistry( boolean returnOperational )
+    {
+        this.returnOperational = returnOperational;
+    }
+
+    public void register( String schema, AttributeType attributeType ) throws NamingException
+    {
+    }
+
+    public AttributeType lookup( final String id ) throws NamingException
+    {
+        if( returnOperational )
+        {
+            return new AttributeType()
+            {
+                public boolean isSingleValue()
+                {
+                    return false;
+                }
+
+                public boolean isCanUserModify()
+                {
+                    return false;
+                }
+
+                public boolean isCollective()
+                {
+                    return false;
+                }
+
+                public UsageEnum getUsage()
+                {
+                    return null;
+                }
+
+                public AttributeType getSuperior() throws NamingException
+                {
+                    return null;
+                }
+
+                public Syntax getSyntax() throws NamingException
+                {
+                    return null;
+                }
+
+                public int getLength()
+                {
+                    return 0;
+                }
+
+                public MatchingRule getEquality() throws NamingException
+                {
+                    return null;
+                }
+
+                public MatchingRule getOrdering() throws NamingException
+                {
+                    return null;
+                }
+
+                public MatchingRule getSubstr() throws NamingException
+                {
+                    return null;
+                }
+
+                public boolean isObsolete()
+                {
+                    return false;
+                }
+
+                public String getOid()
+                {
+                    return String.valueOf( id.hashCode() );
+                }
+
+                public String[] getNames()
+                {
+                    return new String[] { id };
+                }
+
+                public String getName()
+                {
+                    return id;
+                }
+
+                public String getDescription()
+                {
+                    return id;
+                }
+            };
+        }
+        else
+        {
+            return new AttributeType()
+            {
+                public boolean isSingleValue()
+                {
+                    return false;
+                }
+
+                public boolean isCanUserModify()
+                {
+                    return true;
+                }
+
+                public boolean isCollective()
+                {
+                    return false;
+                }
+
+                public UsageEnum getUsage()
+                {
+                    return null;
+                }
+
+                public AttributeType getSuperior() throws NamingException
+                {
+                    return null;
+                }
+
+                public Syntax getSyntax() throws NamingException
+                {
+                    return null;
+                }
+
+                public int getLength()
+                {
+                    return 0;
+                }
+
+                public MatchingRule getEquality() throws NamingException
+                {
+                    return null;
+                }
+
+                public MatchingRule getOrdering() throws NamingException
+                {
+                    return null;
+                }
+
+                public MatchingRule getSubstr() throws NamingException
+                {
+                    return null;
+                }
+
+                public boolean isObsolete()
+                {
+                    return false;
+                }
+
+                public String getOid()
+                {
+                    return String.valueOf( id.hashCode() );
+                }
+
+                public String[] getNames()
+                {
+                    return new String[] { id };
+                }
+
+                public String getName()
+                {
+                    return id;
+                }
+
+                public String getDescription()
+                {
+                    return id;
+                }
+            };
+        }
+    }
+
+    public String getSchemaName( String id ) throws NamingException
+    {
+        return "dummy";
+    }
+
+    public boolean hasAttributeType( String id )
+    {
+        return true;
+    }
+
+    public Iterator list()
+    {
+        return new ArrayList().iterator();
+    }
+
+}

Propchange: directory/apacheds/trunk/core/src/test/org/apache/ldap/server/authz/support/DummyAttributeTypeRegistry.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision



Mime
View raw message