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

File AbstractROMTestCase.java

 

Coverage histogram

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

Code metrics

0
14
7
1
99
53
7
0.5
2
7
1

Classes

Class Line # Actions
AbstractROMTestCase 35 14 0% 7 0
1.0100%
 

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.observation.remote.test;
21   
22    import org.junit.Before;
23    import org.junit.Rule;
24    import org.xwiki.component.embed.EmbeddableComponentManager;
25    import org.xwiki.observation.ObservationManager;
26    import org.xwiki.test.internal.MockConfigurationSource;
27    import org.xwiki.test.jmock.JMockRule;
28    import org.xwiki.test.jmock.XWikiComponentInitializer;
29   
30    /**
31    * Base class to easily emulate two instances of observation manager communicate with each other by network.
32    *
33    * @version $Id: c65a4d0c766eecda34f73371fedd2adc7a5a8e9e $
34    */
 
35    public abstract class AbstractROMTestCase
36    {
37    @Rule
38    public final JMockRule mockery = new JMockRule();
39   
40    private XWikiComponentInitializer initializer1 = new XWikiComponentInitializer();
41   
42    private XWikiComponentInitializer initializer2 = new XWikiComponentInitializer();
43   
44    private ObservationManager observationManager1;
45   
46    private ObservationManager observationManager2;
47   
 
48  1 toggle @Before
49    public void setUp() throws Exception
50    {
51  1 this.initializer1.initializeConfigurationSource();
52  1 this.initializer1.initializeExecution();
53   
54  1 this.initializer2.initializeConfigurationSource();
55  1 this.initializer2.initializeExecution();
56   
57  1 getConfigurationSource1().setProperty("observation.remote.enabled", Boolean.TRUE);
58  1 getConfigurationSource2().setProperty("observation.remote.enabled", Boolean.TRUE);
59   
60  1 this.observationManager1 = getComponentManager1().getInstance(ObservationManager.class);
61  1 this.observationManager2 = getComponentManager2().getInstance(ObservationManager.class);
62    }
63   
 
64  1 toggle public EmbeddableComponentManager getComponentManager1() throws Exception
65    {
66  1 return this.initializer1.getComponentManager();
67    }
68   
 
69  2 toggle public EmbeddableComponentManager getComponentManager2() throws Exception
70    {
71  2 return this.initializer2.getComponentManager();
72    }
73   
74    /**
75    * @return a modifiable mock configuration source
76    */
 
77  2 toggle public MockConfigurationSource getConfigurationSource1()
78    {
79  2 return this.initializer1.getConfigurationSource();
80    }
81   
82    /**
83    * @return a modifiable mock configuration source
84    */
 
85  1 toggle public MockConfigurationSource getConfigurationSource2()
86    {
87  1 return this.initializer2.getConfigurationSource();
88    }
89   
 
90  4 toggle public ObservationManager getObservationManager1()
91    {
92  4 return this.observationManager1;
93    }
94   
 
95  1 toggle public ObservationManager getObservationManager2()
96    {
97  1 return this.observationManager2;
98    }
99    }