1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program 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.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.core.setup;
16
17 import junit.framework.Test;
18 import junit.framework.TestCase;
19 import junit.framework.TestSuite;
20 /**
21 * JUnit test case for testing ApplicationConfig.
22 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
23 * @version $Revision: 1.2 $
24 */
25 public class ApplicationConfigTest extends TestCase{
26
27
28
29 /** The application config object to test. */
30 protected ApplicationConfig config = null;
31
32
33
34
35 /** Default constructor. Build a test case using a name. */
36 public ApplicationConfigTest(String testName){
37 super(testName);
38 }
39
40
41
42
43 /**
44 * Make this class a TestSuite.
45 * @return A TestSuite containing this TestCase.
46 */
47 public static Test suite(){
48 TestSuite suite = new TestSuite(ApplicationConfigTest.class);
49 return suite;
50 }
51
52 /** Setup the tests fixture. */
53 public void setUp(){
54 config = new ApplicationConfig();
55 }
56
57
58
59
60 /** Test standard setup check methods */
61 public void testIsStandardSetup(){
62
63 config.setProperty(ApplicationConfig.SETUP_TYPE, "Standard");
64 assertFalse("Setup is not complete", config.isSetupComplete());
65
66 config.setSetupComplete(true);
67 assertTrue("Setup is a standard one", config.isStandardSetup());
68 assertFalse("Setup is not a custom one", config.isCustomSetup());
69 assertTrue("This side of app is both synchronous and asynchronous", config.isSynchronousSide());
70 assertTrue("This side of app is both synchronous and asynchronous", config.isAsynchronousSide());
71 }
72
73 /** Test custom setup check methods */
74 public void testIsCustomSetup(){
75
76 config.setProperty(ApplicationConfig.SETUP_TYPE, "Custom");
77 assertFalse("Setup is not complete", config.isSetupComplete());
78
79 config.setSetupComplete(true);
80 assertTrue("Setup is a custom one", config.isCustomSetup());
81 assertFalse("Setup is not a standard one", config.isStandardSetup());
82 assertTrue("This side of app is both synchronous and asynchronous", config.isSynchronousSide());
83 assertTrue("This side of app is both synchronous and asynchronous", config.isAsynchronousSide());
84
85 config.setProperty(ApplicationConfig.SYNCH_SIDE, "true");
86 assertTrue("This side of app is synchronous", config.isSynchronousSide());
87 assertFalse("This side of app is not asynchronous", config.isAsynchronousSide());
88
89 config.setProperty(ApplicationConfig.SYNCH_SIDE, "false");
90 assertTrue("This side of app is asynchronous", config.isAsynchronousSide());
91 assertFalse("This side of app is not synchronous", config.isSynchronousSide());
92 }
93 }