Statistics
| Revision:

root / trunk / libraries / libGPE / src-test / org / gvsig / gpe / writers / schemas / GPENotSupportedChildLayerTest.java @ 12418

History | View | Annotate | Download (3.35 KB)

1 12418 jorpiell
package org.gvsig.gpe.writers.schemas;
2
3
import org.gvsig.gpe.containers.Layer;
4
import org.gvsig.gpe.warnings.NotSupportedLayerWarning;
5
6
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
7
 *
8
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
23
 *
24
 * For more information, contact:
25
 *
26
 *  Generalitat Valenciana
27
 *   Conselleria d'Infraestructures i Transport
28
 *   Av. Blasco Ib??ez, 50
29
 *   46010 VALENCIA
30
 *   SPAIN
31
 *
32
 *      +34 963862235
33
 *   gvsig@gva.es
34
 *      www.gvsig.gva.es
35
 *
36
 *    or
37
 *
38
 *   IVER T.I. S.A
39
 *   Salamanca 50
40
 *   46005 Valencia
41
 *   Spain
42
 *
43
 *   +34 963163400
44
 *   dac@iver.es
45
 */
46
/* CVS MESSAGES:
47
 *
48
 * $Id$
49
 * $Log$
50
 * Revision 1.1  2007-06-29 12:19:14  jorpiell
51
 * The schema validation is made independently of the concrete writer
52
 *
53
 *
54
 */
55
/**
56
 * @author Jorge Piera LLodr? (jorge.piera@iver.es)
57
 */
58
public abstract class GPENotSupportedChildLayerTest  extends GPENotSupportedSchema{
59
        private String layer1Id = "l1";
60
        private String layer1Name = "Parent layer";
61
        private String layer1Description = "This is a test of a wrong layer feature";
62
        private String layer1Srs = "EPSG:23030";
63
        private String layer1XsElementName = "cities";
64
        private String layer2Id = "l2";
65
        private String layer2Name = "Child layer";
66
        private String layer2Description = "This is a test of a wrong layer feature";
67
        private String layer2Srs = "EPSG:23030";
68
        private String layer2XsElementName = "postal codes";
69
        private String feature1Name = "city";
70
        private String feature1Id = "f1";
71
        //Schema
72
        private String xsFeature1Name = "river";
73
74
        /*
75
         * (non-Javadoc)
76
         * @see org.gvsig.gpe.writers.GPEWriterBaseTest#readObjects()
77
         */
78
        public void readObjects() {
79
                Layer[] layers = getLayers();
80
                assertEquals(layers.length, 1);
81
                Layer layer = layers[0];
82
83
                assertEquals(layer.getLayers().size(),0);
84
85
                //Two warinings
86
                assertEquals(getErrorHandler().getWarningsSize(),1);
87
                for (int i=0 ; i<getErrorHandler().getWarningsSize() ; i++){
88
                        assertTrue(getErrorHandler().getWarningAt(i) instanceof NotSupportedLayerWarning);
89
                        System.out.println(getErrorHandler().getWarningAt(i));
90
                }
91
        }
92
93
        /*
94
         * (non-Javadoc)
95
         * @see org.gvsig.gpe.writers.GPEWriterBaseTest#writeObjects()
96
         */
97
        public void writeObjects() {
98
                getWriterHandler().initialize();
99
                getWriterHandler().startLayer(layer1Id, layer1Name, layer1Description, layer1Srs, layer1XsElementName);
100
                getWriterHandler().startLayer(layer2Id, layer2Name, layer2Description, layer2Srs, layer2XsElementName);
101
                getWriterHandler().startFeature(feature1Id,feature1Name, xsFeature1Name);
102
                getWriterHandler().endFeature();
103
                getWriterHandler().endLayer();
104
                getWriterHandler().endLayer();
105
                getWriterHandler().close();
106
        }
107
108
}