You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by vt...@apache.org on 2004/11/10 22:45:43 UTC
svn commit: rev 57382 - incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel
Author: vtence
Date: Wed Nov 10 13:45:42 2004
New Revision: 57382
Added:
incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/
incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Groups.java
incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Subjects.java
incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Usernames.java
Log:
Common model for test cases
Added: incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Groups.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Groups.java Wed Nov 10 13:45:42 2004
@@ -0,0 +1,37 @@
+/*
+ * 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.janus.testmodel;
+
+import org.apache.janus.authentication.group.GroupPrincipal;
+
+public class Groups
+{
+ public static GroupPrincipal canadians()
+ {
+ return new GroupPrincipal( "canadians" );
+ }
+
+ public static GroupPrincipal geeks()
+ {
+ return new GroupPrincipal( "geeks" );
+ }
+
+ public static GroupPrincipal men()
+ {
+ return new GroupPrincipal( "men" );
+ }
+}
Added: incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Subjects.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Subjects.java Wed Nov 10 13:45:42 2004
@@ -0,0 +1,63 @@
+/*
+ * 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.janus.testmodel;
+
+import javax.security.auth.Subject;
+import java.security.Principal;
+
+public class Subjects
+{
+ public static Subject joeBlow()
+ {
+ return with( Usernames.joe() );
+ }
+
+ public static Subject with( Principal p )
+ {
+ Subject s = new Subject();
+ s.getPrincipals().add( p );
+ return s;
+ }
+
+ public static Subject with( Principal p1, Principal p2 )
+ {
+ Subject s = new Subject();
+ s.getPrincipals().add( p1 );
+ s.getPrincipals().add( p2 );
+ return s;
+ }
+
+ public static Subject with( Principal p1, Principal p2, Principal p3 )
+ {
+ Subject s = new Subject();
+ s.getPrincipals().add( p1 );
+ s.getPrincipals().add( p2 );
+ s.getPrincipals().add( p3 );
+ return s;
+ }
+
+ public static Subject with( Principal[] principals )
+ {
+ Subject s = new Subject();
+ for ( int i = 0; i < principals.length; i++ )
+ {
+ Principal p = principals[i];
+ s.getPrincipals().add( p );
+ }
+ return s;
+ }
+}
Added: incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Usernames.java
==============================================================================
--- (empty file)
+++ incubator/directory/janus/trunk/sandbox/src/test/org/apache/janus/testmodel/Usernames.java Wed Nov 10 13:45:42 2004
@@ -0,0 +1,27 @@
+/*
+ * 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.janus.testmodel;
+
+import org.apache.janus.authentication.realm.UsernamePrincipal;
+
+public class Usernames
+{
+ public static UsernamePrincipal joe()
+ {
+ return new UsernamePrincipal( "jblow" );
+ }
+}