Clover Coverage Report - ARESTC 0.1.7-SNAPSHOT
Coverage timestamp: Fri Aug 27 2010 19:12:04 CEST
15   98   5   5
0   40   0.33   3
3     1.67  
1    
 
  ConfigurationFactoryTest       Line # 37 15 0% 5 4 77.8% 0.7777778
 
  (1)
 
1    /*
2    *
3    * (C)opyright 2010, Nikolaos Georgosopoulos
4    *
5    * This file is part of ARESTC.
6   
7    ARESTC is free software: you can redistribute it and/or modify
8    it under the terms of the Lesser General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11   
12    ARESTC is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    GNU General Public License for more details.
16   
17    You should have received a copy of the Lesser General Public License
18    along with ARESTC. If not, see <http://www.gnu.org/licenses/>.
19   
20    */
21    package net.sf.arestc.communication;
22   
23    import junit.framework.TestCase;
24    import net.sf.arestc.configuration.ClientConfigurationFactory;
25   
26    import org.apache.commons.configuration.ConfigurationException;
27    import org.apache.commons.httpclient.HttpClient;
28    import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
29    import org.apache.log4j.Logger;
30   
31    // TODO: Auto-generated Javadoc
32    /**
33    * The Class ConfigurationFactoryTest.
34    *
35    * @author georgosn
36    */
 
37    public class ConfigurationFactoryTest extends TestCase {
38   
39    /** The Constant LOGGER. */
40    private static final Logger LOGGER = Logger.getLogger(ConfigurationFactoryTest.class
41    .getName());
42   
43    /** The client. */
44    private HttpClient client;
45   
46    /*
47    * (non-Javadoc)
48    *
49    * @see junit.framework.TestCase#setUp()
50    */
 
51  1 toggle @Override
52    protected void setUp() throws Exception {
53  1 super.setUp();
54  1 client = new HttpClient(new MultiThreadedHttpConnectionManager());
55   
56    }
57   
58    /*
59    * (non-Javadoc)
60    *
61    * @see junit.framework.TestCase#tearDown()
62    */
 
63  1 toggle @Override
64    protected void tearDown() throws Exception {
65  1 client = null;
66  1 super.tearDown();
67    }
68   
69    /**
70    * Test method for.
71    *
72    * {@link ClientConfigurationFactory.ng.urlchecker.communication.ConfigurationFactory#configure(org.apache.commons.httpclient.HttpClient, java.lang.String)}
73    * .
74    */
 
75  1 toggle public void testConfigureHttpClientString() {
76    // try configuration
77  1 try {
78  1 ClientConfigurationFactory.getInstance().configure(client, null);
79  1 assertFalse(null == client);
80    } catch (final ConfigurationException e) {
81  0 LOGGER.error(e);
82  0 fail("configuration failed to lunch the default when passed null for file name");
83    }
84   
85    // try configuration with an apsolute path
86  1 final String path = this.getClass().getClassLoader()
87    .getResource("httpconfiguration.xml").getPath();
88  1 try {
89  1 ClientConfigurationFactory.getInstance().configure(client, path);
90  1 assertFalse(null == client);
91    } catch (final ConfigurationException e) {
92  0 LOGGER.error(e);
93  0 fail("configuration failed find the config file with absolute path");
94    }
95   
96    }
97   
98    }