Revision 33790
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Dimension; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link DimensionPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author gvSIG team |
|
41 |
*/ |
|
42 |
public class DimensionPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private DimensionPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Dimension dimension; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (DimensionPersistenceFactory) persistenceManager |
|
54 |
.getFactories().get(Dimension.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
dimension = new Dimension(320, 200); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Test method for |
|
62 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
63 |
* . |
|
64 |
*/ |
|
65 |
public void testCreateFromState() throws Exception { |
|
66 |
stateControl.expectAndReturn(state |
|
67 |
.getDouble(DimensionPersistenceFactory.FIELD_WIDTH), dimension |
|
68 |
.getWidth()); |
|
69 |
stateControl.expectAndReturn(state |
|
70 |
.getDouble(DimensionPersistenceFactory.FIELD_HEIGHT), dimension |
|
71 |
.getHeight()); |
|
72 |
stateControl.replay(); |
|
73 |
|
|
74 |
Dimension newDimension = (Dimension) factory.createFromState(state); |
|
75 |
assertTrue(newDimension.equals(dimension)); |
|
76 |
|
|
77 |
stateControl.verify(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Test method for |
|
82 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
83 |
* . |
|
84 |
*/ |
|
85 |
public void testSaveToState() throws Exception { |
|
86 |
state |
|
87 |
.set(DimensionPersistenceFactory.FIELD_WIDTH, dimension |
|
88 |
.getWidth()); |
|
89 |
state.set(DimensionPersistenceFactory.FIELD_HEIGHT, dimension |
|
90 |
.getHeight()); |
|
91 |
stateControl.replay(); |
|
92 |
|
|
93 |
factory.saveToState(state, dimension); |
|
94 |
|
|
95 |
stateControl.verify(); |
|
96 |
} |
|
97 |
|
|
98 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Font; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link FontPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class FontPersistenceFactoryTest extends AbstractLibraryAutoInitTestCase { |
|
43 |
|
|
44 |
private FontPersistenceFactory factory; |
|
45 |
private MockControl stateControl; |
|
46 |
private PersistentState state; |
|
47 |
private Font font; |
|
48 |
|
|
49 |
protected void doSetUp() throws Exception { |
|
50 |
PersistenceManager persistenceManager = ToolsLocator |
|
51 |
.getPersistenceManager(); |
|
52 |
factory = (FontPersistenceFactory) persistenceManager.getFactories() |
|
53 |
.get(Font.class); |
|
54 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
55 |
state = (PersistentState) stateControl.getMock(); |
|
56 |
font = new Font("Arial", Font.BOLD, 18); |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Test method for |
|
61 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
62 |
* . |
|
63 |
*/ |
|
64 |
public void testCreateFromState() throws Exception { |
|
65 |
stateControl.expectAndReturn(state |
|
66 |
.getString(FontPersistenceFactory.FIELD_NAME), font.getName()); |
|
67 |
stateControl.expectAndReturn(state |
|
68 |
.getInt(FontPersistenceFactory.FIELD_STYLE), font.getStyle()); |
|
69 |
stateControl.expectAndReturn(state |
|
70 |
.getInt(FontPersistenceFactory.FIELD_SIZE), font.getSize()); |
|
71 |
stateControl.replay(); |
|
72 |
|
|
73 |
Font newFont = (Font) factory.createFromState(state); |
|
74 |
assertTrue(newFont.equals(font)); |
|
75 |
|
|
76 |
stateControl.verify(); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Test method for |
|
81 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
82 |
* . |
|
83 |
*/ |
|
84 |
public void testSaveToState() throws Exception { |
|
85 |
state.set(FontPersistenceFactory.FIELD_NAME, font.getName()); |
|
86 |
state.set(FontPersistenceFactory.FIELD_STYLE, font.getStyle()); |
|
87 |
state.set(FontPersistenceFactory.FIELD_SIZE, font.getSize()); |
|
88 |
stateControl.replay(); |
|
89 |
|
|
90 |
factory.saveToState(state, font); |
|
91 |
|
|
92 |
stateControl.verify(); |
|
93 |
} |
|
94 |
|
|
95 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.geom.Rectangle2D; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link Rectangle2DPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class Rectangle2DPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private Rectangle2DPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Rectangle2D rectangle; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (Rectangle2DPersistenceFactory) persistenceManager |
|
54 |
.getFactories().get(Rectangle2D.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
double x = Math.random() * 1000d; |
|
58 |
double y = Math.random() * 1000d; |
|
59 |
rectangle = new Rectangle2D.Double(x, y, 320, 200); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Test method for |
|
64 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#createFromState(PersistentState, Class)} |
|
65 |
* . |
|
66 |
*/ |
|
67 |
public void testCreateFromState() throws Exception { |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_X), rectangle |
|
70 |
.getX()); |
|
71 |
stateControl.expectAndReturn(state |
|
72 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_Y), rectangle |
|
73 |
.getY()); |
|
74 |
stateControl.expectAndReturn(state |
|
75 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_WIDTH), |
|
76 |
rectangle.getWidth()); |
|
77 |
stateControl.expectAndReturn(state |
|
78 |
.getDouble(Rectangle2DPersistenceFactory.FIELD_HEIGHT), |
|
79 |
rectangle.getHeight()); |
|
80 |
stateControl.replay(); |
|
81 |
|
|
82 |
Rectangle2D newRectangle = (Rectangle2D) factory.createFromState(state); |
|
83 |
|
|
84 |
System.out.println("Orig x = " + rectangle.getX() + " - New x = " |
|
85 |
+ newRectangle.getX()); |
|
86 |
assertEquals(rectangle.getX(), newRectangle.getX(), 0.0d); |
|
87 |
System.out.println("Orig y = " + rectangle.getY() + " - New y = " |
|
88 |
+ newRectangle.getY()); |
|
89 |
assertEquals(rectangle.getY(), newRectangle.getY(), 0.0d); |
|
90 |
System.out.println("Orig width = " + rectangle.getWidth() |
|
91 |
+ " - New width = " + newRectangle.getWidth()); |
|
92 |
assertEquals(rectangle.getWidth(), newRectangle.getWidth(), 0.0d); |
|
93 |
System.out.println("Orig height = " + rectangle.getHeight() |
|
94 |
+ " - New height = " + newRectangle.getHeight()); |
|
95 |
assertEquals(rectangle.getHeight(), newRectangle.getHeight(), 0.0d); |
|
96 |
|
|
97 |
assertTrue(newRectangle.equals(rectangle)); |
|
98 |
|
|
99 |
stateControl.verify(); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* Test method for |
|
104 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
105 |
* . |
|
106 |
*/ |
|
107 |
public void testSaveToState() throws Exception { |
|
108 |
state.set(Rectangle2DPersistenceFactory.FIELD_X, rectangle.getX()); |
|
109 |
state.set(Rectangle2DPersistenceFactory.FIELD_Y, rectangle.getY()); |
|
110 |
state.set(Rectangle2DPersistenceFactory.FIELD_WIDTH, rectangle |
|
111 |
.getWidth()); |
|
112 |
state.set(Rectangle2DPersistenceFactory.FIELD_HEIGHT, rectangle |
|
113 |
.getHeight()); |
|
114 |
stateControl.replay(); |
|
115 |
|
|
116 |
factory.saveToState(state, rectangle); |
|
117 |
|
|
118 |
stateControl.verify(); |
|
119 |
} |
|
120 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.Color; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link ColorPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author gvSIG team |
|
41 |
*/ |
|
42 |
public class ColorPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private ColorPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Color color; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (ColorPersistenceFactory) persistenceManager.getFactories() |
|
54 |
.get(Color.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
color = Color.magenta; |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Test method for |
|
62 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)} |
|
63 |
* . |
|
64 |
*/ |
|
65 |
public void testCreateFromState() throws Exception { |
|
66 |
stateControl.expectAndReturn(state |
|
67 |
.getInt(ColorPersistenceFactory.FIELD_RED), color.getRed()); |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getInt(ColorPersistenceFactory.FIELD_GREEN), color.getGreen()); |
|
70 |
stateControl.expectAndReturn(state |
|
71 |
.getInt(ColorPersistenceFactory.FIELD_BLUE), color.getBlue()); |
|
72 |
stateControl.expectAndReturn(state |
|
73 |
.getInt(ColorPersistenceFactory.FIELD_ALPHA), color.getAlpha()); |
|
74 |
stateControl.replay(); |
|
75 |
|
|
76 |
Color newColor = (Color) factory.createFromState(state); |
|
77 |
assertTrue(newColor.equals(color)); |
|
78 |
|
|
79 |
stateControl.verify(); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Test method for |
|
84 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
85 |
* . |
|
86 |
*/ |
|
87 |
public void testSaveToState() throws Exception { |
|
88 |
state.set(ColorPersistenceFactory.FIELD_RED, color.getRed()); |
|
89 |
state.set(ColorPersistenceFactory.FIELD_GREEN, color.getGreen()); |
|
90 |
state.set(ColorPersistenceFactory.FIELD_BLUE, color.getBlue()); |
|
91 |
state.set(ColorPersistenceFactory.FIELD_ALPHA, color.getAlpha()); |
|
92 |
stateControl.replay(); |
|
93 |
|
|
94 |
factory.saveToState(state, color); |
|
95 |
|
|
96 |
stateControl.verify(); |
|
97 |
} |
|
98 |
|
|
99 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Gobernment (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.tools.persistence; |
|
28 |
|
|
29 |
import java.awt.geom.Point2D; |
|
30 |
|
|
31 |
import org.easymock.MockControl; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
34 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
35 |
import org.gvsig.tools.persistence.PersistentState; |
|
36 |
|
|
37 |
/** |
|
38 |
* Unit tests for the class {@link Point2DPersistenceFactory}. |
|
39 |
* |
|
40 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
41 |
*/ |
|
42 |
public class Point2DPersistenceFactoryTest extends |
|
43 |
AbstractLibraryAutoInitTestCase { |
|
44 |
|
|
45 |
private Point2DPersistenceFactory factory; |
|
46 |
private MockControl stateControl; |
|
47 |
private PersistentState state; |
|
48 |
private Point2D point; |
|
49 |
|
|
50 |
protected void doSetUp() throws Exception { |
|
51 |
PersistenceManager persistenceManager = ToolsLocator |
|
52 |
.getPersistenceManager(); |
|
53 |
factory = (Point2DPersistenceFactory) persistenceManager.getFactories() |
|
54 |
.get(Point2D.class); |
|
55 |
stateControl = MockControl.createNiceControl(PersistentState.class); |
|
56 |
state = (PersistentState) stateControl.getMock(); |
|
57 |
double x = Math.random() * 1000d; |
|
58 |
double y = Math.random() * 1000d; |
|
59 |
point = new Point2D.Double(x, y); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Test method for |
|
64 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#createFromState(PersistentState, Class)} |
|
65 |
* . |
|
66 |
*/ |
|
67 |
public void testCreateFromState() throws Exception { |
|
68 |
stateControl.expectAndReturn(state |
|
69 |
.getDouble(Point2DPersistenceFactory.FIELD_X), point.getX()); |
|
70 |
stateControl.expectAndReturn(state |
|
71 |
.getDouble(Point2DPersistenceFactory.FIELD_Y), point.getY()); |
|
72 |
stateControl.replay(); |
|
73 |
|
|
74 |
Point2D newPoint = (Point2D) factory.createFromState(state); |
|
75 |
assertTrue(newPoint.equals(point)); |
|
76 |
|
|
77 |
stateControl.verify(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Test method for |
|
82 |
* {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)} |
|
83 |
* . |
|
84 |
*/ |
|
85 |
public void testSaveToState() throws Exception { |
|
86 |
state.set(Point2DPersistenceFactory.FIELD_X, point.getX()); |
|
87 |
state.set(Point2DPersistenceFactory.FIELD_Y, point.getY()); |
|
88 |
stateControl.replay(); |
|
89 |
|
|
90 |
factory.saveToState(state, point); |
|
91 |
|
|
92 |
stateControl.verify(); |
|
93 |
} |
|
94 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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 2 |
|
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 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {DiSiD Technologies} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.impl; |
|
28 |
|
|
29 |
import java.awt.Graphics2D; |
|
30 |
import java.awt.image.BufferedImage; |
|
31 |
import java.util.Map; |
|
32 |
|
|
33 |
import org.cresques.cts.ICoordTrans; |
|
34 |
import org.gvsig.compat.print.PrintAttributes; |
|
35 |
import org.gvsig.fmap.crs.CRSFactory; |
|
36 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
37 |
import org.gvsig.fmap.dal.feature.Feature; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
40 |
import org.gvsig.fmap.mapcontext.MapContextDrawer; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
42 |
import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
|
43 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
45 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
46 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
47 |
import org.gvsig.fmap.mapcontext.rendering.legend.LegendException; |
|
48 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
|
49 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
|
50 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
|
51 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent; |
|
52 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
53 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
54 |
import org.gvsig.tools.observer.Observer; |
|
55 |
import org.gvsig.tools.persistence.PersistentState; |
|
56 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
57 |
import org.gvsig.tools.task.Cancellable; |
|
58 |
|
|
59 |
/** |
|
60 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
61 |
*/ |
|
62 |
public class DefaultMapContextManagerTest extends |
|
63 |
AbstractLibraryAutoInitTestCase { |
|
64 |
|
|
65 |
private DefaultMapContextManager manager; |
|
66 |
|
|
67 |
protected void doSetUp() throws Exception { |
|
68 |
manager = new DefaultMapContextManager(); |
|
69 |
|
|
70 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
|
71 |
manager.setDefaultVectorLegend("DummyLegend"); |
|
72 |
manager.registerLegendReader("Dummy", DummyLegendReader.class); |
|
73 |
manager.registerLegendWriter("DummyLegend", "Dummy", DummyLegendWriter.class); |
|
74 |
} |
|
75 |
|
|
76 |
protected void tearDown() throws Exception { |
|
77 |
super.tearDown(); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Test method for |
|
82 |
* {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#createDefaultMapContextDrawerInstance()} |
|
83 |
* . |
|
84 |
*/ |
|
85 |
public void testGetDefaultMapContextDrawerInstance() throws Exception { |
|
86 |
|
|
87 |
manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class); |
|
88 |
|
|
89 |
MapContextDrawer drawer = manager |
|
90 |
.createDefaultMapContextDrawerInstance(); |
|
91 |
|
|
92 |
assertNotNull("The created MapContextDrawer instance can't be null", |
|
93 |
drawer); |
|
94 |
assertTrue( |
|
95 |
"The created MapContextDrawer is not instance of the registered class" |
|
96 |
+ DummyMapContextDrawer.class, |
|
97 |
drawer instanceof DummyMapContextDrawer); |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Test method for |
|
102 |
* {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#setDefaultMapContextDrawer(java.lang.Class)} |
|
103 |
* . |
|
104 |
*/ |
|
105 |
public void testSetDefaultMapContextDrawer() throws Exception { |
|
106 |
|
|
107 |
// First, try to register an invalid class |
|
108 |
try { |
|
109 |
manager.setDefaultMapContextDrawer(Object.class); |
|
110 |
fail("Error, a class that does not implement the MapContextDrawer " |
|
111 |
+ "interface has been accepted"); |
|
112 |
} catch (MapContextRuntimeException e) { |
|
113 |
// OK |
|
114 |
} |
|
115 |
|
|
116 |
// Next, try to register a valid class |
|
117 |
manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class); |
|
118 |
} |
|
119 |
|
|
120 |
public void testCreateGraphicsLayer() throws Exception { |
|
121 |
assertNotNull(manager.createGraphicsLayer(CRSFactory.getCRS("EPSG:23030"))); |
|
122 |
} |
|
123 |
|
|
124 |
public void testCreateDefaultVectorLegend() throws Exception { |
|
125 |
|
|
126 |
IVectorLegend legend = manager.createDefaultVectorLegend(1); |
|
127 |
assertNotNull(legend); |
|
128 |
assertTrue(legend instanceof DummyVectorLegend); |
|
129 |
} |
|
130 |
|
|
131 |
public void testRegisterCreateLegend() throws Exception { |
|
132 |
|
|
133 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
|
134 |
|
|
135 |
ILegend legend = manager.createLegend("DummyLegend"); |
|
136 |
assertNotNull(legend); |
|
137 |
assertTrue(legend instanceof DummyVectorLegend); |
|
138 |
|
|
139 |
assertNull(manager.createLegend("NONE")); |
|
140 |
} |
|
141 |
|
|
142 |
public void testRegisterCreateLegendReader() throws Exception { |
|
143 |
|
|
144 |
manager.registerLegendReader("Dummy", DummyLegendReader.class); |
|
145 |
|
|
146 |
ILegendReader legendReader = manager.createLegendReader("Dummy"); |
|
147 |
assertNotNull(legendReader); |
|
148 |
assertTrue(legendReader instanceof DummyLegendReader); |
|
149 |
|
|
150 |
assertNull(manager.createLegendReader("NONE")); |
|
151 |
} |
|
152 |
|
|
153 |
public void testRegisterCreateLegendWriter() throws Exception { |
|
154 |
|
|
155 |
manager.registerLegend("DummyLegend", DummyVectorLegend.class); |
|
156 |
|
|
157 |
manager.registerLegendWriter("DummyLegend", "Dummy", |
|
158 |
DummyLegendWriter.class); |
|
159 |
|
|
160 |
// Test the registered writer is created |
|
161 |
ILegendWriter legendWriter = manager.createLegendWriter("DummyLegend", |
|
162 |
"Dummy"); |
|
163 |
assertNotNull(legendWriter); |
|
164 |
assertTrue(legendWriter instanceof DummyLegendWriter); |
|
165 |
|
|
166 |
// Test non registered cases |
|
167 |
assertNull(manager.createLegendWriter("NONE", "Dummy")); |
|
168 |
assertNull(manager.createLegendWriter("DummyLegend", "NONE")); |
|
169 |
assertNull(manager.createLegendWriter("NONE", "NONE")); |
|
170 |
} |
|
171 |
|
|
172 |
public static class DummyMapContextDrawer implements MapContextDrawer { |
|
173 |
|
|
174 |
public void dispose() { |
|
175 |
} |
|
176 |
|
|
177 |
public void draw(FLayers root, BufferedImage image, Graphics2D g, |
|
178 |
Cancellable cancel, double scale) throws ReadException { |
|
179 |
} |
|
180 |
|
|
181 |
public void print(FLayers root, Graphics2D g, Cancellable cancel, |
|
182 |
double scale, PrintAttributes properties) throws ReadException { |
|
183 |
} |
|
184 |
|
|
185 |
public void setMapContext(MapContext mapContext) { |
|
186 |
} |
|
187 |
|
|
188 |
public void setViewPort(ViewPort viewPort) { |
|
189 |
} |
|
190 |
|
|
191 |
} |
|
192 |
|
|
193 |
public static class DummyLegendReader implements ILegendReader { |
|
194 |
|
|
195 |
} |
|
196 |
|
|
197 |
public static class DummyLegendWriter implements ILegendWriter { |
|
198 |
|
|
199 |
} |
|
200 |
|
|
201 |
public static class DummyVectorLegend implements IVectorLegend { |
|
202 |
|
|
203 |
public void draw(BufferedImage image, Graphics2D graphics2d, |
|
204 |
ViewPort viewPort, Cancellable cancel, double scale, |
|
205 |
Map queryParameters, ICoordTrans coordTrans, |
|
206 |
FeatureStore featureStore) throws LegendException { |
|
207 |
// Empty method |
|
208 |
} |
|
209 |
|
|
210 |
public int getShapeType() { |
|
211 |
// Empty method |
|
212 |
return 0; |
|
213 |
} |
|
214 |
|
|
215 |
public ISymbol getSymbolByFeature(Feature feat) |
|
216 |
throws MapContextException { |
|
217 |
// Empty method |
|
218 |
return null; |
|
219 |
} |
|
220 |
|
|
221 |
public boolean isSuitableForShapeType(int shapeType) { |
|
222 |
// Empty method |
|
223 |
return false; |
|
224 |
} |
|
225 |
|
|
226 |
public boolean isUseDefaultSymbol() { |
|
227 |
// Empty method |
|
228 |
return false; |
|
229 |
} |
|
230 |
|
|
231 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
232 |
double scale, Map queryParameters, ICoordTrans coordTrans, |
|
233 |
FeatureStore featureStore, PrintAttributes properties) |
|
234 |
throws LegendException { |
|
235 |
// Empty method |
|
236 |
} |
|
237 |
|
|
238 |
public void setDefaultSymbol(ISymbol s) { |
|
239 |
// Empty method |
|
240 |
} |
|
241 |
|
|
242 |
public void setShapeType(int shapeType) { |
|
243 |
// Empty method |
|
244 |
} |
|
245 |
|
|
246 |
public void useDefaultSymbol(boolean b) { |
|
247 |
// Empty method |
|
248 |
} |
|
249 |
|
|
250 |
public void addLegendListener(LegendContentsChangedListener listener) { |
|
251 |
// Empty method |
|
252 |
} |
|
253 |
|
|
254 |
public ILegend cloneLegend() { |
|
255 |
// Empty method |
|
256 |
return null; |
|
257 |
} |
|
258 |
|
|
259 |
public Object clone() throws CloneNotSupportedException { |
|
260 |
// TODO Auto-generated method stub |
|
261 |
return super.clone(); |
|
262 |
} |
|
263 |
|
|
264 |
public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) { |
|
265 |
// Empty method |
|
266 |
} |
|
267 |
|
|
268 |
public ISymbol getDefaultSymbol() { |
|
269 |
// Empty method |
|
270 |
return null; |
|
271 |
} |
|
272 |
|
|
273 |
public LegendContentsChangedListener[] getListeners() { |
|
274 |
// Empty method |
|
275 |
return null; |
|
276 |
} |
|
277 |
|
|
278 |
public void removeLegendListener(LegendContentsChangedListener listener) { |
|
279 |
// Empty method |
|
280 |
} |
|
281 |
|
|
282 |
public void loadFromState(PersistentState state) |
|
283 |
throws PersistenceException { |
|
284 |
// Empty method |
|
285 |
} |
|
286 |
|
|
287 |
public void saveToState(PersistentState state) |
|
288 |
throws PersistenceException { |
|
289 |
// Empty method |
|
290 |
} |
|
291 |
|
|
292 |
public void addDrawingObserver(Observer observer) { |
|
293 |
// Empty method |
|
294 |
} |
|
295 |
|
|
296 |
public void deleteDrawingObserver(Observer observer) { |
|
297 |
// Empty method |
|
298 |
} |
|
299 |
|
|
300 |
public void deleteDrawingObservers() { |
|
301 |
// Empty method |
|
302 |
} |
|
303 |
} |
|
304 |
} |
tags/v2_0_0_Build_2020/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.persistence; |
|
2 |
|
|
3 |
import java.text.DateFormat; |
|
4 |
import java.util.Iterator; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Set; |
|
7 |
|
|
8 |
import org.cresques.cts.IProjection; |
|
9 |
|
|
10 |
import org.gvsig.fmap.dal.DataQuery; |
|
11 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
12 |
import org.gvsig.fmap.dal.DataSet; |
|
13 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
14 |
import org.gvsig.fmap.dal.exception.DataException; |
|
15 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
16 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
17 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
18 |
import org.gvsig.fmap.dal.feature.Feature; |
|
19 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
20 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
|
21 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
|
22 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
|
23 |
import org.gvsig.fmap.dal.feature.FeatureLocks; |
|
24 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
25 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
26 |
import org.gvsig.fmap.dal.feature.FeatureRules; |
|
27 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
32 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
33 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
|
34 |
import org.gvsig.fmap.geom.Geometry; |
|
35 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
36 |
import org.gvsig.tools.ToolsLocator; |
|
37 |
import org.gvsig.tools.dataTypes.CoercionException; |
|
38 |
import org.gvsig.tools.dataTypes.DataType; |
|
39 |
import org.gvsig.tools.dynobject.DynClass; |
|
40 |
import org.gvsig.tools.dynobject.DynField; |
|
41 |
import org.gvsig.tools.dynobject.DynMethod; |
|
42 |
import org.gvsig.tools.dynobject.DynObject; |
|
43 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
44 |
import org.gvsig.tools.dynobject.DynStruct; |
|
45 |
import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException; |
|
46 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
47 |
import org.gvsig.tools.dynobject.exception.DynFieldValidateException; |
|
48 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
49 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
|
50 |
import org.gvsig.tools.evaluator.Evaluator; |
|
51 |
import org.gvsig.tools.exception.BaseException; |
|
52 |
import org.gvsig.tools.observer.Observer; |
|
53 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
54 |
import org.gvsig.tools.persistence.PersistentState; |
|
55 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
56 |
import org.gvsig.tools.undo.RedoException; |
|
57 |
import org.gvsig.tools.undo.UndoException; |
|
58 |
import org.gvsig.tools.visitor.Visitor; |
|
59 |
|
|
60 |
public class DummyFileFeatureStore implements FeatureStore { |
|
61 |
|
|
62 |
public static class DummyFeatureAttributeDescriptor implements |
|
63 |
FeatureAttributeDescriptor { |
|
64 |
|
|
65 |
public boolean allowNull() { |
|
66 |
// TODO Auto-generated method stub |
|
67 |
return false; |
|
68 |
} |
|
69 |
|
|
70 |
public Object getAdditionalInfo(String infoName) { |
|
71 |
// TODO Auto-generated method stub |
|
72 |
return null; |
|
73 |
} |
|
74 |
|
|
75 |
public FeatureAttributeDescriptor getCopy() { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
return null; |
|
78 |
} |
|
79 |
|
|
80 |
public DataType getDataType() { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return null; |
|
83 |
} |
|
84 |
|
|
85 |
public String getDataTypeName() { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
public DateFormat getDateFormat() { |
|
91 |
// TODO Auto-generated method stub |
|
92 |
return null; |
|
93 |
} |
|
94 |
|
|
95 |
public Object getDefaultValue() { |
|
96 |
// TODO Auto-generated method stub |
|
97 |
return null; |
|
98 |
} |
|
99 |
|
|
100 |
public Evaluator getEvaluator() { |
|
101 |
// TODO Auto-generated method stub |
|
102 |
return null; |
|
103 |
} |
|
104 |
|
|
105 |
public int getGeometrySubType() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return 0; |
|
108 |
} |
|
109 |
|
|
110 |
public int getGeometryType() { |
|
111 |
return Geometry.TYPES.POINT; |
|
112 |
} |
|
113 |
|
|
114 |
public int getIndex() { |
|
115 |
// TODO Auto-generated method stub |
|
116 |
return 0; |
|
117 |
} |
|
118 |
|
|
119 |
public int getMaximumOccurrences() { |
|
120 |
// TODO Auto-generated method stub |
|
121 |
return 0; |
|
122 |
} |
|
123 |
|
|
124 |
public int getMinimumOccurrences() { |
|
125 |
// TODO Auto-generated method stub |
|
126 |
return 0; |
|
127 |
} |
|
128 |
|
|
129 |
public String getName() { |
|
130 |
// TODO Auto-generated method stub |
|
131 |
return null; |
|
132 |
} |
|
133 |
|
|
134 |
public Class getObjectClass() { |
|
135 |
// TODO Auto-generated method stub |
|
136 |
return null; |
|
137 |
} |
|
138 |
|
|
139 |
public int getPrecision() { |
|
140 |
// TODO Auto-generated method stub |
|
141 |
return 0; |
|
142 |
} |
|
143 |
|
|
144 |
public IProjection getSRS() { |
|
145 |
// TODO Auto-generated method stub |
|
146 |
return null; |
|
147 |
} |
|
148 |
|
|
149 |
public int getSize() { |
|
150 |
// TODO Auto-generated method stub |
|
151 |
return 0; |
|
152 |
} |
|
153 |
|
|
154 |
public int getType() { |
|
155 |
// TODO Auto-generated method stub |
|
156 |
return 0; |
|
157 |
} |
|
158 |
|
|
159 |
public boolean isAutomatic() { |
|
160 |
// TODO Auto-generated method stub |
|
161 |
return false; |
|
162 |
} |
|
163 |
|
|
164 |
public boolean isPrimaryKey() { |
|
165 |
// TODO Auto-generated method stub |
|
166 |
return false; |
|
167 |
} |
|
168 |
|
|
169 |
public boolean isReadOnly() { |
|
170 |
// TODO Auto-generated method stub |
|
171 |
return false; |
|
172 |
} |
|
173 |
|
|
174 |
public String getSubtype() { |
|
175 |
// TODO Auto-generated method stub |
|
176 |
return null; |
|
177 |
} |
|
178 |
|
|
179 |
public int getTheTypeOfAvailableValues() { |
|
180 |
// TODO Auto-generated method stub |
|
181 |
return 0; |
|
182 |
} |
|
183 |
|
|
184 |
public boolean isContainer() { |
|
185 |
// TODO Auto-generated method stub |
|
186 |
return false; |
|
187 |
} |
|
188 |
|
|
189 |
public boolean isHidden() { |
|
190 |
// TODO Auto-generated method stub |
|
191 |
return false; |
|
192 |
} |
|
193 |
|
|
194 |
public boolean isMandatory() { |
|
195 |
// TODO Auto-generated method stub |
|
196 |
return false; |
|
197 |
} |
|
198 |
|
|
199 |
public boolean isPersistent() { |
|
200 |
// TODO Auto-generated method stub |
|
201 |
return false; |
|
202 |
} |
|
203 |
|
|
204 |
public DynField setAvailableValues(DynObjectValueItem[] values) { |
|
205 |
// TODO Auto-generated method stub |
|
206 |
return null; |
|
207 |
} |
|
208 |
|
|
209 |
public DynField setAvailableValues(List values) { |
|
210 |
// TODO Auto-generated method stub |
|
211 |
return null; |
|
212 |
} |
|
213 |
|
|
214 |
public DynField setClassOfItems(Class theClass) |
|
215 |
throws DynFieldIsNotAContainerException { |
|
216 |
// TODO Auto-generated method stub |
|
217 |
return null; |
|
218 |
} |
|
219 |
|
|
220 |
public DynField setClassOfValue(Class theClass) |
|
221 |
throws DynFieldIsNotAContainerException { |
|
222 |
// TODO Auto-generated method stub |
|
223 |
return null; |
|
224 |
} |
|
225 |
|
|
226 |
public DynField setDefaultDynValue(Object defaultValue) { |
|
227 |
// TODO Auto-generated method stub |
|
228 |
return null; |
|
229 |
} |
|
230 |
|
|
231 |
public DynField setDefaultFieldValue(Object defaultValue) { |
|
232 |
// TODO Auto-generated method stub |
|
233 |
return null; |
|
234 |
} |
|
235 |
|
|
236 |
public DynField setDescription(String description) { |
|
237 |
// TODO Auto-generated method stub |
|
238 |
return null; |
|
239 |
} |
|
240 |
|
|
241 |
public DynField setElementsType(int type) |
|
242 |
throws DynFieldIsNotAContainerException { |
|
243 |
// TODO Auto-generated method stub |
|
244 |
return null; |
|
245 |
} |
|
246 |
|
|
247 |
public DynField setElementsType(DynStruct type) |
|
248 |
throws DynFieldIsNotAContainerException { |
|
249 |
// TODO Auto-generated method stub |
|
250 |
return null; |
|
251 |
} |
|
252 |
|
|
253 |
public DynField setGroup(String groupName) { |
|
254 |
// TODO Auto-generated method stub |
|
255 |
return null; |
|
256 |
} |
|
257 |
|
|
258 |
public DynField setHidden(boolean hidden) { |
|
259 |
// TODO Auto-generated method stub |
|
260 |
return null; |
|
261 |
} |
|
262 |
|
|
263 |
public DynField setMandatory(boolean mandatory) { |
|
264 |
// TODO Auto-generated method stub |
|
265 |
return null; |
|
266 |
} |
|
267 |
|
|
268 |
public DynField setMaxValue(Object maxValue) { |
|
269 |
// TODO Auto-generated method stub |
|
270 |
return null; |
|
271 |
} |
|
272 |
|
|
273 |
public DynField setMinValue(Object minValue) { |
|
274 |
// TODO Auto-generated method stub |
|
275 |
return null; |
|
276 |
} |
|
277 |
|
|
278 |
public DynField setOrder(int order) { |
|
279 |
// TODO Auto-generated method stub |
|
280 |
return null; |
|
281 |
} |
|
282 |
|
|
283 |
public DynField setPersistent(boolean persistent) { |
|
284 |
// TODO Auto-generated method stub |
|
285 |
return null; |
|
286 |
} |
|
287 |
|
|
288 |
public DynField setReadOnly(boolean isReadOnly) { |
|
289 |
// TODO Auto-generated method stub |
|
290 |
return null; |
|
291 |
} |
|
292 |
|
|
293 |
public DynField setSubtype(String subtype) { |
|
294 |
// TODO Auto-generated method stub |
|
295 |
return null; |
|
296 |
} |
|
297 |
|
|
298 |
public DynField setTheTypeOfAvailableValues(int type) { |
|
299 |
// TODO Auto-generated method stub |
|
300 |
return null; |
|
301 |
} |
|
302 |
|
|
303 |
public DynField setType(int type) { |
|
304 |
// TODO Auto-generated method stub |
|
305 |
return null; |
|
306 |
} |
|
307 |
|
|
308 |
public DynField setType(DataType type) { |
|
309 |
// TODO Auto-generated method stub |
|
310 |
return null; |
|
311 |
} |
|
312 |
|
|
313 |
public void validate(Object value) throws DynFieldValidateException { |
|
314 |
// TODO Auto-generated method stub |
|
315 |
|
|
316 |
} |
|
317 |
|
|
318 |
public Object coerce(Object value) throws CoercionException { |
|
319 |
// TODO Auto-generated method stub |
|
320 |
return null; |
|
321 |
} |
|
322 |
|
|
323 |
public DynObjectValueItem[] getAvailableValues() { |
|
324 |
// TODO Auto-generated method stub |
|
325 |
return null; |
|
326 |
} |
|
327 |
|
|
328 |
public Class getClassOfItems() { |
|
329 |
// TODO Auto-generated method stub |
|
330 |
return null; |
|
331 |
} |
|
332 |
|
|
333 |
public Class getClassOfValue() { |
|
334 |
// TODO Auto-generated method stub |
|
335 |
return null; |
|
336 |
} |
|
337 |
|
|
338 |
public String getDescription() { |
|
339 |
// TODO Auto-generated method stub |
|
340 |
return null; |
|
341 |
} |
|
342 |
|
|
343 |
public DynField getElementsType() { |
|
344 |
// TODO Auto-generated method stub |
|
345 |
return null; |
|
346 |
} |
|
347 |
|
|
348 |
public String getGroup() { |
|
349 |
// TODO Auto-generated method stub |
|
350 |
return null; |
|
351 |
} |
|
352 |
|
|
353 |
public Object getMaxValue() { |
|
354 |
// TODO Auto-generated method stub |
|
355 |
return null; |
|
356 |
} |
|
357 |
|
|
358 |
public Object getMinValue() { |
|
359 |
// TODO Auto-generated method stub |
|
360 |
return null; |
|
361 |
} |
|
362 |
|
|
363 |
public int getOder() { |
|
364 |
// TODO Auto-generated method stub |
|
365 |
return 0; |
|
366 |
} |
|
367 |
|
|
368 |
} |
|
369 |
|
|
370 |
public static class DummyFeatureType implements FeatureType { |
|
371 |
|
|
372 |
public boolean allowAutomaticValues() { |
|
373 |
// TODO Auto-generated method stub |
|
374 |
return false; |
|
375 |
} |
|
376 |
|
|
377 |
public Object get(String name) { |
|
378 |
// TODO Auto-generated method stub |
|
379 |
return null; |
|
380 |
} |
|
381 |
|
|
382 |
public Object get(int index) { |
|
383 |
// TODO Auto-generated method stub |
|
384 |
return null; |
|
385 |
} |
|
386 |
|
|
387 |
public FeatureAttributeDescriptor getAttributeDescriptor(String name) { |
|
388 |
// TODO Auto-generated method stub |
|
389 |
return null; |
|
390 |
} |
|
391 |
|
|
392 |
public FeatureAttributeDescriptor getAttributeDescriptor(int index) { |
|
393 |
return new DummyFeatureAttributeDescriptor(); |
|
394 |
} |
|
395 |
|
|
396 |
public FeatureAttributeDescriptor[] getAttributeDescriptors() { |
|
397 |
// TODO Auto-generated method stub |
|
398 |
return null; |
|
399 |
} |
|
400 |
|
|
401 |
public FeatureType getCopy() { |
|
402 |
// TODO Auto-generated method stub |
|
403 |
return null; |
|
404 |
} |
|
405 |
|
|
406 |
public FeatureAttributeDescriptor getDefaultGeometryAttribute() { |
|
407 |
// TODO Auto-generated method stub |
|
408 |
return null; |
|
409 |
} |
|
410 |
|
|
411 |
public int getDefaultGeometryAttributeIndex() { |
|
412 |
return 0; |
|
413 |
} |
|
414 |
|
|
415 |
public String getDefaultGeometryAttributeName() { |
|
416 |
// TODO Auto-generated method stub |
|
417 |
return null; |
|
418 |
} |
|
419 |
|
|
420 |
public IProjection getDefaultSRS() { |
|
421 |
// TODO Auto-generated method stub |
|
422 |
return null; |
|
423 |
} |
|
424 |
|
|
425 |
public EditableFeatureType getEditable() { |
|
426 |
// TODO Auto-generated method stub |
|
427 |
return null; |
|
428 |
} |
|
429 |
|
|
430 |
public String getId() { |
|
431 |
// TODO Auto-generated method stub |
|
432 |
return null; |
|
433 |
} |
|
434 |
|
|
435 |
public int getIndex(String name) { |
|
436 |
// TODO Auto-generated method stub |
|
437 |
return 0; |
|
438 |
} |
|
439 |
|
|
440 |
public FeatureAttributeDescriptor[] getPrimaryKey() { |
|
441 |
// TODO Auto-generated method stub |
|
442 |
return null; |
|
443 |
} |
|
444 |
|
|
445 |
public FeatureRules getRules() { |
|
446 |
// TODO Auto-generated method stub |
|
447 |
return null; |
|
448 |
} |
|
449 |
|
|
450 |
public List getSRSs() { |
|
451 |
// TODO Auto-generated method stub |
|
452 |
return null; |
|
453 |
} |
|
454 |
|
|
455 |
public boolean hasEvaluators() { |
|
456 |
// TODO Auto-generated method stub |
|
457 |
return false; |
|
458 |
} |
|
459 |
|
|
460 |
public boolean hasOID() { |
|
461 |
// TODO Auto-generated method stub |
|
462 |
return false; |
|
463 |
} |
|
464 |
|
|
465 |
public Iterator iterator() { |
|
466 |
// TODO Auto-generated method stub |
|
467 |
return null; |
|
468 |
} |
|
469 |
|
|
470 |
public int size() { |
|
471 |
// TODO Auto-generated method stub |
|
472 |
return 0; |
|
473 |
} |
|
474 |
|
|
475 |
public DynClass[] getSuperDynClasses() { |
|
476 |
// TODO Auto-generated method stub |
|
477 |
return null; |
|
478 |
} |
|
479 |
|
|
480 |
public void removeDynMethod(String name) { |
|
481 |
// TODO Auto-generated method stub |
|
482 |
|
|
483 |
} |
|
484 |
|
|
485 |
public DynField addDynField(String name) { |
|
486 |
// TODO Auto-generated method stub |
|
487 |
return null; |
|
488 |
} |
|
489 |
|
|
490 |
public DynField addDynFieldArray(String name) { |
|
491 |
// TODO Auto-generated method stub |
|
492 |
return null; |
|
493 |
} |
|
494 |
|
|
495 |
public DynField addDynFieldBoolean(String name) { |
|
496 |
// TODO Auto-generated method stub |
|
497 |
return null; |
|
498 |
} |
|
499 |
|
|
500 |
public DynField addDynFieldChoice(String name, int type, |
|
501 |
Object defaultValue, DynObjectValueItem[] values, |
|
502 |
boolean mandatory, boolean persistent) { |
|
503 |
// TODO Auto-generated method stub |
|
504 |
return null; |
|
505 |
} |
|
506 |
|
|
507 |
public DynField addDynFieldChoice(String name, int type, |
|
508 |
Object defaultValue, DynObjectValueItem[] values) { |
|
509 |
// TODO Auto-generated method stub |
|
510 |
return null; |
|
511 |
} |
|
512 |
|
|
513 |
public DynField addDynFieldDate(String name) { |
|
514 |
// TODO Auto-generated method stub |
|
515 |
return null; |
|
516 |
} |
|
517 |
|
|
518 |
public DynField addDynFieldDouble(String name) { |
|
519 |
// TODO Auto-generated method stub |
|
520 |
return null; |
|
521 |
} |
|
522 |
|
|
523 |
public DynField addDynFieldFile(String name) { |
|
524 |
// TODO Auto-generated method stub |
|
525 |
return null; |
|
526 |
} |
|
527 |
|
|
528 |
public DynField addDynFieldFloat(String name) { |
|
529 |
// TODO Auto-generated method stub |
|
530 |
return null; |
|
531 |
} |
|
532 |
|
|
533 |
public DynField addDynFieldFolder(String name) { |
|
534 |
// TODO Auto-generated method stub |
|
535 |
return null; |
|
536 |
} |
|
537 |
|
|
538 |
public DynField addDynFieldInt(String name) { |
|
539 |
// TODO Auto-generated method stub |
|
540 |
return null; |
|
541 |
} |
|
542 |
|
|
543 |
public DynField addDynFieldList(String name) { |
|
544 |
// TODO Auto-generated method stub |
|
545 |
return null; |
|
546 |
} |
|
547 |
|
|
548 |
public DynField addDynFieldLong(String name) { |
|
549 |
// TODO Auto-generated method stub |
|
550 |
return null; |
|
551 |
} |
|
552 |
|
|
553 |
public DynField addDynFieldMap(String name) { |
|
554 |
// TODO Auto-generated method stub |
|
555 |
return null; |
|
556 |
} |
|
557 |
|
|
558 |
public DynField addDynFieldObject(String name) { |
|
559 |
// TODO Auto-generated method stub |
|
560 |
return null; |
|
561 |
} |
|
562 |
|
|
563 |
public DynField addDynFieldRange(String name, int type, |
|
564 |
Object defaultValue, Object min, Object max, boolean mandatory, |
|
565 |
boolean persistent) { |
|
566 |
// TODO Auto-generated method stub |
|
567 |
return null; |
|
568 |
} |
|
569 |
|
|
570 |
public DynField addDynFieldRange(String name, int type, |
|
571 |
Object defaultValue, Object min, Object max) { |
|
572 |
// TODO Auto-generated method stub |
|
573 |
return null; |
|
574 |
} |
|
575 |
|
|
576 |
public DynField addDynFieldSet(String name) { |
|
577 |
// TODO Auto-generated method stub |
|
578 |
return null; |
|
579 |
} |
|
580 |
|
|
581 |
public DynField addDynFieldSingle(String name, int type, |
|
582 |
Object defaultValue, boolean mandatory, boolean persistent) { |
|
583 |
// TODO Auto-generated method stub |
|
584 |
return null; |
|
585 |
} |
|
586 |
|
|
587 |
public DynField addDynFieldSingle(String name, int type, |
|
588 |
Object defaultValue) { |
|
589 |
// TODO Auto-generated method stub |
|
590 |
return null; |
|
591 |
} |
|
592 |
|
|
593 |
public DynField addDynFieldString(String name) { |
|
594 |
// TODO Auto-generated method stub |
|
595 |
return null; |
|
596 |
} |
|
597 |
|
|
598 |
public DynField addDynFieldURI(String name) { |
|
599 |
// TODO Auto-generated method stub |
|
600 |
return null; |
|
601 |
} |
|
602 |
|
|
603 |
public DynField addDynFieldURL(String name) { |
|
604 |
// TODO Auto-generated method stub |
|
605 |
return null; |
|
606 |
} |
|
607 |
|
|
608 |
public void extend(DynStruct struct) { |
|
609 |
// TODO Auto-generated method stub |
|
610 |
|
|
611 |
} |
|
612 |
|
|
613 |
public void extend(String namespace, String structName) { |
|
614 |
// TODO Auto-generated method stub |
|
615 |
|
|
616 |
} |
|
617 |
|
|
618 |
public void extend(String structName) { |
|
619 |
// TODO Auto-generated method stub |
|
620 |
|
|
621 |
} |
|
622 |
|
|
623 |
public DynField getDeclaredDynField(String name) { |
|
624 |
// TODO Auto-generated method stub |
|
625 |
return null; |
|
626 |
} |
|
627 |
|
|
628 |
public DynField[] getDeclaredDynFields() { |
|
629 |
// TODO Auto-generated method stub |
|
630 |
return null; |
|
631 |
} |
|
632 |
|
|
633 |
public String getDescription() { |
|
634 |
// TODO Auto-generated method stub |
|
635 |
return null; |
|
636 |
} |
|
637 |
|
|
638 |
public DynField getDynField(String name) { |
|
639 |
// TODO Auto-generated method stub |
|
640 |
return null; |
|
641 |
} |
|
642 |
|
|
643 |
public DynField[] getDynFields() { |
|
644 |
// TODO Auto-generated method stub |
|
645 |
return null; |
|
646 |
} |
|
647 |
|
|
648 |
public String getFullName() { |
|
649 |
// TODO Auto-generated method stub |
|
650 |
return null; |
Also available in: Unified diff