1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.test.ui

File AbstractExtensionAdminAuthenticatedTest.java

 

Coverage histogram

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

Code metrics

2
7
3
1
66
29
4
0.57
2.33
3
1.33

Classes

Class Line # Actions
AbstractExtensionAdminAuthenticatedTest 32 7 0% 4 1
0.916666791.7%
 

Contributing tests

This file is covered by 1 test. .

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    package org.xwiki.test.ui;
21   
22    import org.junit.Before;
23    import org.junit.BeforeClass;
24    import org.junit.Rule;
25    import org.xwiki.repository.test.RepositoryTestUtils;
26   
27    /**
28    * Base class for admin tests that need to manipulate a repository of extensions.
29    *
30    * @version $Id: 94630593e04cd67aa88215a0abe6b29c7d489bb7 $
31    */
 
32    public abstract class AbstractExtensionAdminAuthenticatedTest extends AbstractTest
33    {
34    @Rule
35    public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil());
36   
 
37  1 toggle @Before
38    public void setUp() throws Exception
39    {
40    // Make sure to have the proper token
41  1 getUtil().recacheSecretToken();
42   
43    // Save admin credentials
44  1 getUtil().setDefaultCredentials(TestUtils.SUPER_ADMIN_CREDENTIALS);
45    }
46   
 
47  1 toggle @BeforeClass
48    public static void init() throws Exception
49    {
50    // Require some AbstractTest initialization
51  1 AbstractTest.init();
52   
53    // Make sure repository and extension utils are initialized and set.
54  1 RepositoryTestUtils repositoryTestUtils = getRepositoryTestUtils();
55   
56    // This will not be null if we are in the middle of allTests
57  1 if (repositoryTestUtils == null) {
58  1 AllTests.initExtensions(context);
59    }
60    }
61   
 
62  9 toggle protected static RepositoryTestUtils getRepositoryTestUtils()
63    {
64  9 return (RepositoryTestUtils) context.getProperties().get(RepositoryTestUtils.PROPERTY_KEY);
65    }
66    }