1
/***********************************************************************
4
* Copyright (C) 2005 Novell, Inc.
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
16
* You should have received a copy of the GNU General Public
17
* License along with this program; if not, write to the Free
18
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
* Author: Mike Lasky <mlasky@novell.com>
22
***********************************************************************/
29
namespace Simias.Storage.Tests
32
/// Class used to test the collection owner functionality.
34
public class CollectionOwnerTests
50
/// <param name="store">Handle to the store.</param>
51
public CollectionOwnerTests( Store store )
58
#region Private Methods
60
private void NoOwnerTest()
62
Collection c = new Collection( store, "NoOwnerTest", store.LocalDomain );
68
throw new ApplicationException( "Collection was created without an owner." );
70
catch ( SimiasException )
74
private void DeleteOwnerTest()
76
Collection c = new Collection( store, "DeleteOwnerTest", store.LocalDomain );
83
c.Commit( c.Delete( c.Owner ) );
84
throw new ApplicationException( "Collection owner was deleted." );
86
catch ( SimiasException )
91
c.Commit( c.Delete() );
95
private void MultiOwnerTest()
97
Collection c = new Collection( store, "MultiOwnerTest", store.LocalDomain );
102
Member member = new Member( "DuplicateMember", Guid.NewGuid().ToString(), Access.Rights.ReadOnly );
103
member.IsOwner = true;
108
throw new ApplicationException( "More than one collection owner exists." );
110
catch ( SimiasException )
115
c.Commit( c.Delete() );
119
private void ChangeOwnerTest()
121
Collection c = new Collection( store, "ChangeOwnerTest", store.LocalDomain );
126
Member member = new Member( "NewOwner", Guid.NewGuid().ToString(), Access.Rights.ReadOnly );
128
c.Commit( c.ChangeOwner( member, Access.Rights.ReadOnly ) );
132
c.Commit( c.Delete() );
136
private void ChangeOwnerRights()
138
Collection c = new Collection( store, "ChangeOwnerRightsTest", store.LocalDomain );
143
Member owner = c.Owner;
144
owner.Rights = Access.Rights.ReadOnly;
148
throw new ApplicationException( "Downgraded collection owner's rights." );
150
catch ( SimiasException )
155
c.Commit( c.Delete() );
161
#region Public Methods
164
/// Runs the collection owner tests.
166
public void RunTests()
168
// Create a collection without an owner.
171
// Delete the collection owner.
174
// Create more than one collection owner.
177
// Change the collection owner.
180
// Try and change the owner rights.
b'\\ No newline at end of file'