1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.security.authorization.testwikis.internal.entities

File DefaultTestSpace.java

 

Coverage histogram

../../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
8
7
1
94
48
7
0.88
1.14
7
1

Classes

Class Line # Actions
DefaultTestSpace 39 8 0% 7 0
1.0100%
 

Contributing tests

This file is covered by 15 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20   
21    package org.xwiki.security.authorization.testwikis.internal.entities;
22   
23    import java.util.Collection;
24   
25    import org.xwiki.model.EntityType;
26    import org.xwiki.model.reference.DocumentReference;
27    import org.xwiki.model.reference.EntityReference;
28    import org.xwiki.model.reference.SpaceReference;
29    import org.xwiki.security.authorization.testwikis.TestDocument;
30    import org.xwiki.security.authorization.testwikis.TestEntity;
31    import org.xwiki.security.authorization.testwikis.TestSpace;
32   
33    /**
34    * Entity representing a space.
35    *
36    * @version $Id: acea8f8e50e100d84c6b484d89041d323af8156e $
37    * @since 5.0M2
38    */
 
39    public class DefaultTestSpace extends AbstractSecureTestEntity implements TestSpace
40    {
41    /** The type of reference used by this class. */
42    public static final EntityType TYPE = EntityType.SPACE;
43   
44    /** The alternate description of this entity. */
45    private final String description;
46   
47    /**
48    * Create a new space entity.
49    * @param reference reference of document represented by this entity.
50    * @param description alternate description of this entity.
51    * @param parent parent entity of this entity.
52    */
 
53  98 toggle public DefaultTestSpace(EntityReference reference, String description, TestEntity parent) {
54  98 super(reference, parent);
55   
56  98 this.description = description;
57    }
58   
 
59  13 toggle @Override
60    public EntityType getType()
61    {
62  13 return TYPE;
63    }
64   
 
65  1 toggle @Override
66    public SpaceReference getSpaceReference()
67    {
68  1 return new SpaceReference(getReference());
69    }
70   
 
71  1 toggle @Override
72    public TestDocument getDocument(String name)
73    {
74  1 return getDocument(new DocumentReference(name, getSpaceReference()));
75    }
76   
 
77  85 toggle @Override
78    public TestDocument getDocument(DocumentReference reference)
79    {
80  85 return (TestDocument) getEntity(reference);
81    }
82   
 
83  1 toggle @Override
84    public Collection<TestDocument> getDocuments()
85    {
86  1 return TypeFilteredCollection.getNewInstance(getEntities(), TestDocument.class);
87    }
88   
 
89  1 toggle @Override
90    public String getDescription()
91    {
92  1 return description;
93    }
94    }