Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src-test / com / iver / cit / gvsig / panelGroup / TestPanelGroupLoaderFromExtensionPoint.java @ 24964

History | View | Annotate | Download (2.48 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
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.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19

    
20
package com.iver.cit.gvsig.panelGroup;
21

    
22
import java.util.ArrayList;
23

    
24
import junit.framework.TestCase;
25

    
26
import org.gvsig.gui.beans.panelGroup.panels.IPanel;
27

    
28
import com.iver.cit.gvsig.panelGroup.loaders.PanelGroupLoaderFromExtensionPoint;
29
import com.iver.cit.gvsig.panelGroup.samples.Samples_ExtensionPointsOfIPanels;
30

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

    
39
        /*
40
         * (non-Javadoc)
41
         * @see junit.framework.TestCase#setUp()
42
         */
43
        protected void setUp() throws Exception {
44
                super.setUp();
45
        }
46

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

    
65
                        loader.loadPanels(panels);
66

    
67
                        // Check that has loaded all panels
68
                        assertEquals(Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES.length, panels.size());
69
                        
70
                        int i = 0;
71

    
72
                        while (i < Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS2_CLASSES.length) {
73
                                // Check order and class types
74
                                assertTrue(panels.get(i).getClass() == (Samples_ExtensionPointsOfIPanels.EXTENSIONPOINTS1_CLASSES[i++]));
75
                        }
76

    
77
                } catch (Exception e) {
78
                        e.printStackTrace();
79
                        fail();
80
                }
81
        }
82
}