Skip to content
Browse files

[refactor] Consistent naming of permission function classes

  • Loading branch information...
1 parent 9dd3d5c commit ff030c846f8cd66342bca250511b65137a290881 @adamretter adamretter committed
View
4 ...ritymanager/GroupMembershipFunctions.java → ...uritymanager/GroupMembershipFunction.java
@@ -20,7 +20,7 @@
*
* @author Adam Retter <adam@existsolutions.com>
*/
-public class GroupMembershipFunctions extends BasicFunction {
+public class GroupMembershipFunction extends BasicFunction {
private final static QName qnAddGroupMember = new QName("add-group-member", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX);
private final static QName qnRemoveGroupMember = new QName("remove-group-member", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX);
@@ -108,7 +108,7 @@
new SequenceType(Type.EMPTY, Cardinality.EMPTY)
);
- public GroupMembershipFunctions(final XQueryContext context, final FunctionSignature signature) {
+ public GroupMembershipFunction(final XQueryContext context, final FunctionSignature signature) {
super(context, signature);
}
View
4 ...ions/securitymanager/IsAuthenticated.java → ...uritymanager/IsAuthenticatedFunction.java
@@ -36,7 +36,7 @@
* @author <a href="mailto:shabanovd@gmail.com">Dmitriy Shabanov</a>
*
*/
-public class IsAuthenticated extends BasicFunction {
+public class IsAuthenticatedFunction extends BasicFunction {
public final static FunctionSignature FNS_IS_AUTHENTICATED = new FunctionSignature(
new QName("is-authenticated", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX),
@@ -52,7 +52,7 @@
new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true() if user from the xquery context is authenticated, false() otherwise")
);
- public IsAuthenticated(final XQueryContext context, final FunctionSignature signature) {
+ public IsAuthenticatedFunction(final XQueryContext context, final FunctionSignature signature) {
super(context, signature);
}
View
4 ...securitymanager/PermissionsFunctions.java → .../securitymanager/PermissionsFunction.java
@@ -54,7 +54,7 @@
*
* @author Adam Retter <adam@existsolutions.com>
*/
-public class PermissionsFunctions extends BasicFunction {
+public class PermissionsFunction extends BasicFunction {
private final static QName qnGetPermissions = new QName("get-permissions", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX);
private final static QName qnAddUserACE = new QName("add-user-ace", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX);
@@ -224,7 +224,7 @@
final static char OWNER_GROUP_SEPARATOR = ':';
- public PermissionsFunctions(final XQueryContext context, final FunctionSignature signature) {
+ public PermissionsFunction(final XQueryContext context, final FunctionSignature signature) {
super(context, signature);
}
View
48 src/org/exist/xquery/functions/securitymanager/SecurityManagerModule.java
@@ -79,14 +79,14 @@
new FunctionDef(GroupManagementFunction.FNS_REMOVE_GROUP, GroupManagementFunction.class),
new FunctionDef(GroupManagementFunction.FNS_DELETE_GROUP, GroupManagementFunction.class),
- new FunctionDef(GroupMembershipFunctions.FNS_ADD_GROUP_MEMBER, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_REMOVE_GROUP_MEMBER, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_ADD_GROUP_MANAGER, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_REMOVE_GROUP_MANAGER, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_GET_GROUP_MANAGERS, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_GET_GROUP_MEMBERS, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_IS_DBA, GroupMembershipFunctions.class),
- new FunctionDef(GroupMembershipFunctions.FNS_SET_USER_PRIMARY_GROUP, GroupMembershipFunctions.class),
+ new FunctionDef(GroupMembershipFunction.FNS_ADD_GROUP_MEMBER, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_REMOVE_GROUP_MEMBER, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_ADD_GROUP_MANAGER, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_REMOVE_GROUP_MANAGER, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_GET_GROUP_MANAGERS, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_GET_GROUP_MEMBERS, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_IS_DBA, GroupMembershipFunction.class),
+ new FunctionDef(GroupMembershipFunction.FNS_SET_USER_PRIMARY_GROUP, GroupMembershipFunction.class),
new FunctionDef(FindGroupFunction.FNS_LIST_GROUPS, FindGroupFunction.class),
new FunctionDef(FindGroupFunction.FNS_FIND_GROUPS_BY_GROUPNAME, FindGroupFunction.class),
@@ -96,24 +96,24 @@
new FunctionDef(FindGroupFunction.FNS_GET_USER_PRIMARY_GROUP, FindGroupFunction.class),
new FunctionDef(FindGroupFunction.FNS_GROUP_EXISTS, FindGroupFunction.class),
- new FunctionDef(PermissionsFunctions.FNS_GET_PERMISSIONS, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_ADD_USER_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_ADD_GROUP_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_INSERT_USER_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_INSERT_GROUP_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_MODIFY_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_REMOVE_ACE, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_CLEAR_ACL, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_CHMOD, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_CHOWN, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_CHGRP, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_MODE_TO_OCTAL, PermissionsFunctions.class),
- new FunctionDef(PermissionsFunctions.FNS_OCTAL_TO_MODE, PermissionsFunctions.class),
+ new FunctionDef(PermissionsFunction.FNS_GET_PERMISSIONS, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_ADD_USER_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_ADD_GROUP_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_INSERT_USER_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_INSERT_GROUP_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_MODIFY_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_REMOVE_ACE, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_CLEAR_ACL, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_CHMOD, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_CHOWN, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_CHGRP, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_MODE_TO_OCTAL, PermissionsFunction.class),
+ new FunctionDef(PermissionsFunction.FNS_OCTAL_TO_MODE, PermissionsFunction.class),
//<editor-fold desc="Functions on the broker/context current user">
- new FunctionDef(PermissionsFunctions.FNS_HAS_ACCESS, PermissionsFunctions.class),
- new FunctionDef(IsAuthenticated.FNS_IS_AUTHENTICATED, IsAuthenticated.class),
- new FunctionDef(IsAuthenticated.FNS_IS_EXTERNALLY_AUTHENTICATED, IsAuthenticated.class)
+ new FunctionDef(PermissionsFunction.FNS_HAS_ACCESS, PermissionsFunction.class),
+ new FunctionDef(IsAuthenticatedFunction.FNS_IS_AUTHENTICATED, IsAuthenticatedFunction.class),
+ new FunctionDef(IsAuthenticatedFunction.FNS_IS_EXTERNALLY_AUTHENTICATED, IsAuthenticatedFunction.class)
//</editor-fold>
};
View
4 src/org/exist/xquery/functions/xmldb/XMLDBAddUserToGroup.java
@@ -32,7 +32,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.GroupMembershipFunctions;
+import org.exist.xquery.functions.securitymanager.GroupMembershipFunction;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.FunctionReturnSequenceType;
@@ -59,7 +59,7 @@
new FunctionParameterSequenceType("group", Type.STRING, Cardinality.EXACTLY_ONE, "The group name")
},
new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true() or false() indicating the outcome of the operation"),
- GroupMembershipFunctions.FNS_ADD_GROUP_MEMBER
+ GroupMembershipFunction.FNS_ADD_GROUP_MEMBER
);
/**
View
4 src/org/exist/xquery/functions/xmldb/XMLDBChmodCollection.java
@@ -28,7 +28,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.PermissionsFunctions;
+import org.exist.xquery.functions.securitymanager.PermissionsFunction;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.IntegerValue;
import org.exist.xquery.value.Sequence;
@@ -56,7 +56,7 @@
new FunctionParameterSequenceType("mode", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mode as xs:integer"),
},
new SequenceType(Type.ITEM, Cardinality.EMPTY),
- PermissionsFunctions.FNS_CHMOD
+ PermissionsFunction.FNS_CHMOD
);
View
4 src/org/exist/xquery/functions/xmldb/XMLDBChmodResource.java
@@ -28,7 +28,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.PermissionsFunctions;
+import org.exist.xquery.functions.securitymanager.PermissionsFunction;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.IntegerValue;
import org.exist.xquery.value.Sequence;
@@ -59,7 +59,7 @@
new FunctionParameterSequenceType("mode", Type.INTEGER, Cardinality.EXACTLY_ONE, "The mode as xs:integer"),
},
new SequenceType(Type.ITEM, Cardinality.EMPTY),
- PermissionsFunctions.FNS_CHMOD
+ PermissionsFunction.FNS_CHMOD
);
View
10 src/org/exist/xquery/functions/xmldb/XMLDBGetUserOrGroup.java
@@ -29,7 +29,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.PermissionsFunctions;
+import org.exist.xquery.functions.securitymanager.PermissionsFunction;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.Sequence;
@@ -60,7 +60,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { GROUP_COLLECTION_ARG },
GROUP_RETURN_TYPE,
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
),
new FunctionSignature(
new QName("get-group", XMLDBModule.NAMESPACE_URI, XMLDBModule.PREFIX),
@@ -68,7 +68,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { GROUP_COLLECTION_ARG, RESOURCE_ARG },
GROUP_RETURN_TYPE,
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
)
};
@@ -79,7 +79,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { OWNER_COLLECTION_ARG },
OWNER_RETURN_TYPE,
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
),
new FunctionSignature(
new QName("get-owner", XMLDBModule.NAMESPACE_URI, XMLDBModule.PREFIX),
@@ -87,7 +87,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { OWNER_COLLECTION_ARG, RESOURCE_ARG },
OWNER_RETURN_TYPE,
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
)
};
View
4 src/org/exist/xquery/functions/xmldb/XMLDBGetUsers.java
@@ -33,7 +33,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.GroupMembershipFunctions;
+import org.exist.xquery.functions.securitymanager.GroupMembershipFunction;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.Sequence;
@@ -58,7 +58,7 @@
new FunctionParameterSequenceType("group-name", Type.STRING, Cardinality.EXACTLY_ONE, "The group-name"),
},
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_MORE, "The list of users in the group identified by $group-name"),
- GroupMembershipFunctions.FNS_GET_GROUP_MEMBERS
+ GroupMembershipFunction.FNS_GET_GROUP_MEMBERS
);
public XMLDBGetUsers(XQueryContext context) {
View
4 src/org/exist/xquery/functions/xmldb/XMLDBIsAdmin.java
@@ -33,7 +33,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.GroupMembershipFunctions;
+import org.exist.xquery.functions.securitymanager.GroupMembershipFunction;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.FunctionParameterSequenceType;
@@ -57,7 +57,7 @@
new FunctionParameterSequenceType("user-id", Type.STRING, Cardinality.EXACTLY_ONE, "The user-id"),
},
new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.ZERO_OR_ONE, "true() if user has DBA role, false() otherwise"),
- GroupMembershipFunctions.FNS_IS_DBA
+ GroupMembershipFunction.FNS_IS_DBA
);
public XMLDBIsAdmin(XQueryContext context) {
View
4 src/org/exist/xquery/functions/xmldb/XMLDBIsAuthenticated.java
@@ -29,7 +29,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.IsAuthenticated;
+import org.exist.xquery.functions.securitymanager.IsAuthenticatedFunction;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.Sequence;
@@ -49,7 +49,7 @@
"Returns the true() if current user from the xquery context is authenticated, false() otherwise.",
null,
new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true() if user from the xquery context is authenticated, false() otherwise"),
- IsAuthenticated.FNS_IS_AUTHENTICATED
+ IsAuthenticatedFunction.FNS_IS_AUTHENTICATED
);
public XMLDBIsAuthenticated(final XQueryContext context, final FunctionSignature signature) {
View
6 src/org/exist/xquery/functions/xmldb/XMLDBPermissions.java
@@ -30,7 +30,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.PermissionsFunctions;
+import org.exist.xquery.functions.securitymanager.PermissionsFunction;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.IntegerValue;
@@ -58,7 +58,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { ARG_COLLECTION },
new FunctionReturnSequenceType(Type.INT, Cardinality.ZERO_OR_ONE, "the collection permissions"),
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
),
new FunctionSignature(
new QName("get-permissions", XMLDBModule.NAMESPACE_URI, XMLDBModule.PREFIX),
@@ -67,7 +67,7 @@
XMLDBModule.COLLECTION_URI,
new SequenceType[] { ARG_COLLECTION, ARG_RESOURCE },
new FunctionReturnSequenceType(Type.INT, Cardinality.ZERO_OR_ONE, "the resource permissions"),
- PermissionsFunctions.FNS_GET_PERMISSIONS
+ PermissionsFunction.FNS_GET_PERMISSIONS
)
};
View
6 src/org/exist/xquery/functions/xmldb/XMLDBPermissionsToString.java
@@ -33,7 +33,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.PermissionsFunctions;
+import org.exist.xquery.functions.securitymanager.PermissionsFunction;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.IntegerValue;
@@ -62,7 +62,7 @@
new FunctionParameterSequenceType("permissions", Type.INTEGER, Cardinality.EXACTLY_ONE, "The permissions in xs:integer format")
},
new FunctionReturnSequenceType(Type.STRING, Cardinality.ZERO_OR_ONE, "the permissions as string 'rwu' for, user, group and other"),
- PermissionsFunctions.FNS_OCTAL_TO_MODE
+ PermissionsFunction.FNS_OCTAL_TO_MODE
),
new FunctionSignature(
@@ -74,7 +74,7 @@
new FunctionParameterSequenceType("permissions-string", Type.STRING, Cardinality.EXACTLY_ONE, "The permissions string")
},
new FunctionReturnSequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE, "The permissions integer"),
- PermissionsFunctions.FNS_MODE_TO_OCTAL
+ PermissionsFunction.FNS_MODE_TO_OCTAL
)
};
View
4 src/org/exist/xquery/functions/xmldb/XMLDBRemoveUserFromGroup.java
@@ -33,7 +33,7 @@
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
-import org.exist.xquery.functions.securitymanager.GroupMembershipFunctions;
+import org.exist.xquery.functions.securitymanager.GroupMembershipFunction;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.FunctionReturnSequenceType;
@@ -58,7 +58,7 @@
new FunctionParameterSequenceType("group", Type.STRING, Cardinality.EXACTLY_ONE, "The group name")
},
new FunctionReturnSequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE, "true() or false() indicating the outcome of the operation"),
- GroupMembershipFunctions.FNS_REMOVE_GROUP_MEMBER
+ GroupMembershipFunction.FNS_REMOVE_GROUP_MEMBER
);
/**
View
82 test/src/org/exist/xquery/functions/securitymanager/PermissionFunctionsTest.java
@@ -0,0 +1,82 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-2013 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+package org.exist.xquery.functions.securitymanager;
+
+import org.easymock.classextension.EasyMock;
+import org.exist.xquery.XPathException;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.Sequence;
+import org.exist.xquery.value.StringValue;
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author Adam Retter <adam.retter@googlemail.com>
+ */
+public class PermissionFunctionsTest {
+
+ /**
+ * Test of eval method, of class PermissionsFunctions.
+ */
+ @Test
+ public void modeToOctal() throws XPathException {
+ final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
+
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_MODE_TO_OCTAL);
+ Sequence args[] = {
+ new StringValue("rwxr-x---")
+ };
+
+ final Sequence result = permissionsFunctions.eval(args, null);
+
+ assertEquals(1, result.getItemCount());
+ assertEquals("0750", result.itemAt(0).toString());
+ }
+
+ @Test(expected=XPathException.class)
+ public void modeToOctal_invalidMode() throws XPathException {
+ final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
+
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_MODE_TO_OCTAL);
+ Sequence args[] = {
+ new StringValue("invalid")
+ };
+
+ permissionsFunctions.eval(args, null);
+ }
+
+ @Test
+ public void octalToMode() throws XPathException {
+ final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
+
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_OCTAL_TO_MODE);
+ Sequence args[] = {
+ new StringValue("0750")
+ };
+
+ final Sequence result = permissionsFunctions.eval(args, null);
+
+ assertEquals(1, result.getItemCount());
+ assertEquals("rwxr-x---", result.itemAt(0).toString());
+ }
+}
View
6 test/src/org/exist/xquery/functions/securitymanager/PermissionsFunctionsTest.java
@@ -42,7 +42,7 @@
public void modeToOctal() throws XPathException {
final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
- final PermissionsFunctions permissionsFunctions = new PermissionsFunctions(mckContext, PermissionsFunctions.FNS_MODE_TO_OCTAL);
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_MODE_TO_OCTAL);
Sequence args[] = {
new StringValue("rwxr-x---")
};
@@ -57,7 +57,7 @@ public void modeToOctal() throws XPathException {
public void modeToOctal_invalidMode() throws XPathException {
final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
- final PermissionsFunctions permissionsFunctions = new PermissionsFunctions(mckContext, PermissionsFunctions.FNS_MODE_TO_OCTAL);
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_MODE_TO_OCTAL);
Sequence args[] = {
new StringValue("invalid")
};
@@ -69,7 +69,7 @@ public void modeToOctal_invalidMode() throws XPathException {
public void octalToMode() throws XPathException {
final XQueryContext mckContext = EasyMock.createMock(XQueryContext.class);
- final PermissionsFunctions permissionsFunctions = new PermissionsFunctions(mckContext, PermissionsFunctions.FNS_OCTAL_TO_MODE);
+ final PermissionsFunction permissionsFunctions = new PermissionsFunction(mckContext, PermissionsFunction.FNS_OCTAL_TO_MODE);
Sequence args[] = {
new StringValue("0750")
};

0 comments on commit ff030c8

Please sign in to comment.
Something went wrong with that request. Please try again.