Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / test / java / org / gvsig / app / panelGroup / TestPanelGroupLoaderFromExtensionPoint.java @ 40558

History | View | Annotate | Download (2.56 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.app.panelGroup;
25

    
26
import java.util.ArrayList;
27

    
28
import junit.framework.TestCase;
29

    
30
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
31

    
32
import org.gvsig.app.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint;
33
import org.gvsig.app.panelGroup.samples.Samples_ExtensionPointsOfIPanels;
34

    
35
/**
36
 * <p>Tests {@link PanelGroupLoaderFromExtensionPoint PanelGroupLoaderFromExtensionPoint}.</p>
37
 * 
38
 * @version 16/10/2007
39
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es) 
40
 */
41
public class TestPanelGroupLoaderFromExtensionPoint extends TestCase {
42

    
43
        /*
44
         * (non-Javadoc)
45
         * @see junit.framework.TestCase#setUp()
46
         */
47
        protected void setUp() throws Exception {
48
                super.setUp();
49
        }
50

    
51
        /*
52
         * (non-Javadoc)
53
         * @see junit.framework.TestCase#tearDown()
54
         */
55
        protected void tearDown() throws Exception {
56
                super.tearDown();
57
        }
58
        
59
        /**
60
         * <p>Test, results must be valid.</p>
61
         */
62
        public void test() {
63
                try {
64
                        Samples_ExtensionPointsOfIPanels.loadSample();
65
                        
66
                        PanelGroupLoaderFromExtensionPoint loader = new PanelGroupLoaderFromExtensionPoint(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINT1_NAME);
67
                        ArrayList<IPanel> panels = new ArrayList<IPanel>();
68

    
69
                        loader.loadPanels(panels);
70

    
71
                        // Check that has loaded all panels
72
                        assertEquals(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES.length, panels.size());
73
                        
74
                        int i = 0;
75

    
76
                        while (i < Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS2_CLASSES.length) {
77
                                // Check order and class types
78
                                assertTrue(panels.get(i).getClass() == (Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES[i++]));
79
                        }
80

    
81
                } catch (Exception e) {
82
                        e.printStackTrace();
83
                        fail();
84
                }
85
        }
86
}