Revision 2033

View differences:

org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/README.txt
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 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
    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

  
25
The project structure of this project is the following:
26

  
27
Project
28
|-pom.xml:   		Maven 2 configuration file.
29
`-src
30
  |-main:    		Project source code, resources and configuration
31
  | |-java:  		Java source code
32
  | |-resources:	Resources needed by the code (resource bundles, images, etc.)   
33
  | `-javadoc:		Javadoc common resources	
34
  `-test:    		Unit tests source code, resources and configuration
35
    |-java:  		Unit tests java source code
36
    `-resources:	Resources needed by the test code (resource bundles, images, etc.)   
37

  
38
Look at the main folders for a README.txt file with more information on the 
39
contents of each folder.
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/BasicTypes2Test.xml
1
<?xml version="1.0"?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<definitions version="1.0.0">
28
  <classes>
29
    <class name="MyObjectBasicTypes">
30
      <description>MyObjectBasicTypes Persistence definition</description>
31
      <fields>
32
        <field name="a" type="integer"/>
33
        <field name="b" type="long"/>
34
        <field name="c" type="double"/>
35
        <field name="d" type="float"/>
36
        <field name="e" type="boolean"/>
37
        <field name="f" type="string"/>
38
        <field name="g" type="date"/>
39
      </fields>
40
    </class>
41
    <class name="Extends1Test">
42
      <description>Test the extends with namespace</description>
43
      <extends>
44
      	<class name="MyObjectBasicTypes"/>
45
      </extends>
46
      <fields>
47
      </fields>
48
    </class>
49
    <class name="MyObjectComplexTypes">
50
      <description>Test the extends with namespace</description>
51
      <extends>
52
      	<class name="MyObjectBasicTypes"/>
53
      </extends>
54
      <fields>
55
      	<field name="child" type="dynObject" subtype="MyObjectBasicTypes"></field>
56
      </fields>
57
    </class>
58
  </classes>
59
</definitions>  
0 60

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/persistence/DynTypesTest.xml
1
<?xml version= "1.0 "?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<definitions version="1.0.0">
28
  <classes>
29
    <class name="MyObjectDynTypes">
30
      <description>MyObjectMapType Persistence definition</description>
31
      <fields>
32
      	<field>
33
          <name>mapa</name>
34
          <type>Map</type>
35
          <mandatory>true</mandatory>
36
          <classOfItems>java.lang.String</classOfItems>
37
        </field>
38
      	<field>
39
          <name>conjunto</name>
40
          <type>Set</type>
41
          <mandatory>true</mandatory>
42
          <classOfItems>java.lang.String</classOfItems>
43
        </field>
44
      	<field>
45
          <name>lista</name>
46
          <type>List</type>
47
          <mandatory>true</mandatory>
48
          <classOfItems>java.lang.String</classOfItems>
49
        </field>
50
      	<field>
51
          <name>viewPort</name>
52
          <type>Object</type>
53
          <mandatory>true</mandatory>
54
          <classOfItems>org.gvsig.tools.persistence.case1.model.ViewPort</classOfItems>
55
        </field>
56
      </fields>
57
    </class>
58
  </classes>
59
</definitions>  
0 60

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/packageutils/package1.info
1
code=org.gvsig.myplugin
2
name=myplugin
3
description=Test
4
version=1.0.0
5
build=1
6
state=RC1
7
official=true
8
type=plugin
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/DynClassTemplate.xml
1
<?xml version="1.0"?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<definitions>
28
  <version>1.0.0</version>
29
  <classes>
30
    <class>
31
      <name></name>
32
      <namespace></namespace>
33
      <description></description>
34
      <superClassNames>
35
        <superClassName></superClassName>
36
        <superClassName></superClassName>
37
      </superClassNames>
38
      <fields>
39
        <field>
40
          <name></name>
41
          <type></type>
42
          <subtype></subtype>
43
          <description></description>
44
          <isMandatory></isMandatory>
45
          <isPersistent></isPersistent>
46
          <minValue></minValue>
47
          <maxValue></maxValue>
48
          <classOfValue></classOfValue>
49
          <defaultValue></defaultValue>
50
          <group></group>
51
          <availableValues>
52
            <valueItem>
53
              <label></label>
54
              <value></value>
55
            </valueItem>
56
            <valueItem>
57
              <label></label>
58
              <value></value>
59
            </valueItem>
60
          </availableValues>
61
        </field>
62
      </fields>
63
    </class>
64
  </classes>
65
</definitions>  
0 66

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/attrBasedImportDynClassTest.xml
1
<?xml version="1.0"?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<definitions version="1.0.0">
28
  <classes>
29
    <class name="MyObjectBasicTypes">
30
      <description>MyObjectBasicTypes test definition</description>
31
      <fields>
32
        <field	name="a" type="integer" mandatory="true" persistent="true" 
33
        		minValue="0x0" maxValue="100" defaultValue="1"
34
          		group="Numbers" order="12">
35
        </field>
36
        <field	name="b" type="long" mandatory="true" persistent="true" 
37
        		defaultValue="2"
38
          		group="Numbers"/>
39
        <field	name="c" type="double" mandatory="false" persistent="true" 
40
        		defaultValue="1.1" minValue="0.0" maxValue="100.0" 
41
          		group="Numbers"/>
42
        <field	name="d" type="float" mandatory="false" 
43
        		minValue="0.0" maxValue="100.0" 
44
          		group="Numbers">
45
          <persistent>true</persistent>
46
          <defaultValue>1.2</defaultValue>
47
        </field>
48

  
49
        <field	name="e" type="boolean" mandatory="true"> 
50
          <persistent>false</persistent>
51
          <defaultValue>true</defaultValue>
52
          <availableValues>
53
            <value label="True">true</value>
54
            <value label="False">false</value>
55
          </availableValues>
56
        </field>
57

  
58
        <field name="f" type="string" mandatory="true" persistent="true" defaultValue="red">
59
          <availableValues>
60
            <value label="Red">red</value>
61
            <value label="Green">green</value>
62
            <value label="Blue">blue</value>
63
          </availableValues>
64
        </field>
65
        <field name="g" type="date" mandatory="true" persistent="true"/>
66
      </fields>
67
    </class>
68

  
69
    <class name="MyObjectBasicTypes2" namespace="test1">
70
      <extends>
71
        <class name="MyObjectBasicTypes"/>
72
      </extends>
73
      <fields>
74
      </fields>
75
    </class>
76

  
77
    <class name="MyObjectBasicTypes3">
78
      <extends>
79
        <class name="MyObjectBasicTypes2" namespace="test1"/>
80
      </extends>
81
      <fields>
82
      </fields>
83
    </class>
84

  
85
    <class name="MyObjectBasicTypes4">
86
      <extends>
87
        <class name="MyObjectBasicTypes2" namespace="test1"/>
88
      </extends>
89
      <fields>
90
        <field	name="obj" type="Object" classOfValue="org.gvsig.tools.evaluator.Evaluator"/>
91
        <field	name="objs" type="List" classOfItems="org.gvsig.tools.visitor.Visitor"/>
92
      </fields>
93
    </class>
94

  
95
  </classes>
96
</definitions>  
0 97

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/org/gvsig/tools/dynobject/tagBasedImportDynClassTest.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<definitions>
28
  <version>1.0.0</version>
29
  <classes>
30
    <class>
31
      <name>MyObjectBasicTypes</name>
32
      <description>MyObjectBasicTypes test definition</description>
33
      <fields>
34
        <field>
35
          <name>a</name>
36
          <type>integer</type>
37
          <mandatory>true</mandatory>
38
          <persistent>true</persistent>
39
          <minValue>0</minValue>
40
          <maxValue>100</maxValue>
41
          <defaultValue>1</defaultValue>
42
          <group>Numbers</group>
43
          <order>12</order>
44
        </field>
45
        <field>
46
          <name>b</name>
47
          <type>long</type>
48
          <mandatory>true</mandatory>
49
          <persistent>true</persistent>
50
          <defaultValue>2</defaultValue>
51
          <group>Numbers</group>
52
        </field>
53
        <field>
54
          <name>c</name>
55
          <type>double</type>
56
          <mandatory>false</mandatory>
57
          <persistent>true</persistent>
58
          <minValue>0.0</minValue>
59
          <maxValue>100.0</maxValue>
60
          <defaultValue>1.1</defaultValue>
61
          <group>Numbers</group>
62
        </field>
63
        <field>
64
          <name>d</name>
65
          <type>float</type>
66
          <mandatory>false</mandatory>
67
          <persistent>true</persistent>
68
          <defaultValue>1.2</defaultValue>
69
          <group>Numbers</group>
70
        </field>
71
        <field>
72
          <name>e</name>
73
          <type>boolean</type>
74
          <mandatory>true</mandatory>
75
          <persistent>false</persistent>
76
          <defaultValue>true</defaultValue>
77
          <availableValues>
78
            <valueItem>
79
              <label>True</label>
80
              <value>true</value>
81
            </valueItem>
82
            <valueItem>
83
              <label>False</label>
84
              <value>false</value>
85
            </valueItem>
86
          </availableValues>
87
        </field>
88
        <field>
89
          <name>f</name>
90
          <type>string</type>
91
          <mandatory>true</mandatory>
92
          <persistent>true</persistent>
93
          <defaultValue>red</defaultValue>
94
          <availableValues>
95
            <valueItem>
96
              <label>Red</label>
97
              <value>red</value>
98
            </valueItem>
99
            <valueItem>
100
              <label>Green</label>
101
              <value>green</value>
102
            </valueItem>
103
            <valueItem>
104
              <label>Blue</label>
105
              <value>blue</value>
106
            </valueItem>
107
          </availableValues>
108
        </field>
109
        <field>
110
          <name>g</name>
111
          <type>date</type>
112
          <mandatory>true</mandatory>
113
          <persistent>true</persistent>
114
        </field>
115
      </fields>
116
    </class>
117

  
118

  
119
    <class name="MyObjectBasicTypes2" namespace="test1">
120
      <extends>
121
        <class>MyObjectBasicTypes</class>
122
      </extends>
123
      <fields>
124
      </fields>
125
    </class>
126

  
127
    <class name="MyObjectBasicTypes3">
128
      <extends>
129
        <class namespace="test1">MyObjectBasicTypes2</class> 
130
      </extends>
131
      <fields>
132
      </fields>
133
    </class>
134

  
135
    <class name="MyObjectBasicTypes4">
136
      <extends>
137
        <class name="MyObjectBasicTypes2" namespace="test1"/>
138
      </extends>
139
      <fields>
140
        <field>
141
          <name>obj</name>
142
          <type>Object</type>
143
          <classOfValue>org.gvsig.tools.evaluator.Evaluator</classOfValue>
144
        </field>
145
        <field>
146
          <name>objs</name>
147
          <type>List</type>
148
          <classOfItems>org.gvsig.tools.visitor.Visitor</classOfItems>
149
        </field>
150
      </fields>
151
    </class>
152

  
153

  
154
  </classes>
155
</definitions>
0 156

  
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/README.txt
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 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
    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

  
25
#set( $symbol_pound = '#' )
26
#set( $symbol_dollar = '$' )
27
#set( $symbol_escape = '\' )
28
Put into this folder the resources needed by your test classes.
29

  
30
This folder is added to the Tests classpath, so you can load any resources 
31
through the ClassLoader.
32

  
33
By default, in this folder you can find an example of log4j configuration,
34
prepared to log messages through the console, so logging works when you
35
run your tests classes.
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2013 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
28

  
29
<!-- 
30
Log4J configuration file for unit tests execution.
31
 -->
32
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
33

  
34
	<!-- Appender configuration to show logging messages through the console -->
35
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
36
		<layout class="org.apache.log4j.PatternLayout">
37
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]  %m%n" />
38
		</layout>
39
	</appender>
40

  
41
	<!-- 
42
	Activate logging messages of DEBUG level of higher only for the
43
	org.gvsig.tools packages.
44
	You can put full classes names or packages instead, to configure
45
	logging for all the classes and subpackages of the package.
46
	-->
47
	<category name="org.gvsig.tools">
48
		<priority value="TRACE" />
49
	</category>
50

  
51
	<!-- 
52
	By default, show only logging messages of INFO level or higher, 
53
	through the previously configured CONSOLE appender. 
54
	-->
55
	<root>
56
		<priority value="TRACE" />
57
		<appender-ref ref="CONSOLE" />
58
	</root>
59
</log4j:configuration>
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/locator/AbstractLocatorTest.java
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 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
 * 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
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2008 {{Company}}   {{Task}}
27
 */
28
package org.gvsig.tools.locator;
29

  
30
import java.util.Arrays;
31
import java.util.Collection;
32
import java.util.Map;
33

  
34
import junit.framework.TestCase;
35

  
36
/**
37
 * Unit tests for the AbstractLocator class.
38
 * 
39
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
40
 */
41
public class AbstractLocatorTest extends TestCase {
42

  
43
    private TestLocator locator;
44

  
45
    protected void setUp() throws Exception {
46
        super.setUp();
47
        locator = new TestLocator();
48
    }
49

  
50
    protected void tearDown() throws Exception {
51
        super.tearDown();
52
    }
53

  
54
    /**
55
     * Test method for {@link org.gvsig.tools.locator.AbstractLocator#getNames()}.
56
     */
57
    public void testGetNames() {
58
        assertNull("Empty locator must not return any names", locator
59
                .getNames());
60

  
61
        String name1 = "test1";
62
        String name2 = "test2";
63

  
64
        locator.register(name1, String.class);
65
        locator.register(name2, String.class);
66

  
67
        String[] names = locator.getNames();
68

  
69
        assertEquals("Number of registered names incorrect, must be 2", 2,
70
                names.length);
71

  
72
        Collection namesColl = Arrays.asList(names);
73
        assertTrue("The list of names does not contain the registered name: "
74
                + name1, namesColl.contains(name1));
75
        assertTrue("The list of names does not contain the registered name: "
76
                + name2, namesColl.contains(name2));
77
    }
78

  
79
    /**
80
     * Test method for
81
     * {@link org.gvsig.tools.locator.AbstractLocator#get(java.lang.String)} and
82
     * {@link org.gvsig.tools.locator.AbstractLocator#register(java.lang.String, java.lang.Class)}
83
     */
84
    public void testGetAndRegisterClass() {
85
        Class clazz = String.class;
86
        String name = "test";
87

  
88
        locator.register(name, clazz);
89

  
90
        Object ref = locator.get(name);
91

  
92
        assertEquals(clazz, ref.getClass());
93
    }
94

  
95
    /**
96
     * Test method for
97
     * {@link org.gvsig.tools.locator.AbstractLocator#get(java.lang.String)} and
98
     * {@link org.gvsig.tools.locator.AbstractLocator#register(String, LocatorObjectFactory)
99

  
100
     */
101
    public void testGetAndRegisterFactory() {
102
        final Object ref = new Object();
103
        LocatorObjectFactory factory = new LocatorObjectFactory() {
104

  
105
            public Object create() {
106
                return ref;
107
            }
108

  
109
            public Object create(Object[] args) {
110
                return ref;
111
            }
112

  
113
            public Object create(Map args) {
114
                return ref;
115
            }
116
        };
117

  
118
        String name = "test";
119

  
120
        locator.register(name, factory);
121

  
122
        Object locatorRef = locator.get(name);
123

  
124
        assertEquals(ref, locatorRef);
125
    }
126

  
127
    public class TestLocator extends AbstractLocator {
128
        public String getLocatorName() {
129
            return "TestLocator";
130
        }
131
    }
132

  
133
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibrariesInitializerTest.java
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 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
 * 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.tools.library;
25

  
26
import java.util.LinkedHashSet;
27
import java.util.List;
28
import java.util.Set;
29

  
30
import junit.framework.TestCase;
31

  
32
/**
33
 * Tests for the {@link AbstractLibrariesInitializer} class.
34
 * 
35
 * @author gvSIG Team
36
 * @version $Id$
37
 */
38
public class AbstractLibrariesInitializerTest extends TestCase {
39

  
40
    private Library lib1api = new Lib1API();
41
    private Library lib1impl = new Lib1Impl();
42
    private Library lib1prov1 = new Lib1Prov1();
43
    private Library lib1prov2 = new Lib1Prov2();
44
    private Library lib2api = new Lib2API();
45
    private Library lib2impl = new Lib2Impl();
46
    private Library lib2prov1 = new Lib2Prov1();
47
    private Library lib3api = new Lib3API();
48
    private Library lib3impl = new Lib3Impl();
49
    private Library lib4api = new Lib4API();
50
    private Library lib4impl1 = new Lib4Impl1();
51
    private Library lib4impl2 = new Lib4Impl2();
52

  
53
    protected void setUp() throws Exception {
54
        super.setUp();
55
    }
56

  
57
    public void testInitialize() {
58
        // Test with 3 different libs orders just in case
59
        testInitializer(new TestLibrariesInitializer1());
60
        testInitializer(new TestLibrariesInitializer2());
61
        testInitializer(new TestLibrariesInitializer3());
62
    }
63

  
64
    private void testInitializer(AbstractLibrariesInitializer init) {
65
        // This is an ordered set
66
        List libs = init.getLibraries();
67

  
68
        checkOrder(libs);
69
    }
70

  
71
    private void checkOrder(List libs) {
72
        int ilib1api = libs.indexOf(lib1api);
73
        int ilib1impl = libs.indexOf(lib1impl);
74
        int ilib1prov1 = libs.indexOf(lib1prov1);
75
        int ilib1prov2 = libs.indexOf(lib1prov2);
76
        int ilib2api = libs.indexOf(lib2api);
77
        int ilib2impl = libs.indexOf(lib2impl);
78
        int ilib2prov1 = libs.indexOf(lib2prov1);
79
        int ilib3api = libs.indexOf(lib3api);
80
        int ilib3impl = libs.indexOf(lib3impl);
81
        int ilib4api = libs.indexOf(lib4api);
82
        int ilib4impl1 = libs.indexOf(lib4impl1);
83
        int ilib4impl2 = libs.indexOf(lib4impl2);
84

  
85
        // Check all needed libraries have been included into the list
86
        assertTrue("Lib1API is not included in the list", ilib1api > -1);
87
        assertTrue("Lib1Impl is not included in the list", ilib1impl > -1);
88
        assertTrue("Lib1Prov1 is not included in the list", ilib1prov1 > -1);
89
        assertTrue("Lib1Prov2 is not included in the list", ilib1prov2 > -1);
90
        assertTrue("Lib2API is not included in the list", ilib2api > -1);
91
        assertTrue("Lib2Impl is not included in the list", ilib2impl > -1);
92
        assertTrue("Lib2Prov1 is not included in the list", ilib2prov1 > -1);
93
        assertTrue("Lib3API is not included in the list", ilib3api > -1);
94
        assertTrue("Lib3Impl is not included in the list", ilib3impl > -1);
95
        assertTrue("Lib4API is not included in the list", ilib4api > -1);
96

  
97
        // Check implementation priorities
98
        assertEquals(
99
            "Lib4Impl1 has less priority than Lib4Impl2, it must not be initialized",
100
            ilib4impl1, -1);
101
        assertTrue(
102
            "Lib4Impl2 has more priority than Lib4Impl1, it must have been initialized",
103
            ilib4impl2 > -1);
104

  
105
        // Check api-impl-service(provider) relationships:
106
        // first API, next Impl and then services (providers)
107
        assertTrue("Lib1API must be initialized before Lib1Impl",
108
            ilib1api < ilib1impl);
109
        assertTrue("Lib1Impl must be initialized before Lib1Prov1",
110
            ilib1impl < ilib1prov1);
111
        assertTrue("Lib1Impl must be initialized before Lib1Prov2",
112
            ilib1impl < ilib1prov2);
113

  
114
        assertTrue("Lib2API must be initialized before Lib2Impl",
115
            ilib2api < ilib2impl);
116
        assertTrue("Lib2Impl must be initialized before Lib2Prov1",
117
            ilib2impl < ilib2prov1);
118

  
119
        assertTrue("Lib3API must be initialized before Lib3Impl",
120
            ilib3api < ilib3impl);
121

  
122
        assertTrue("Lib4API must be initialized before Lib4Impl",
123
            ilib4api < ilib4impl2);
124

  
125
        // Check dependencies between libraries
126
        assertTrue(
127
            "Lib2Impl dependends on Lib1API, must be initialized after it",
128
            ilib1api < ilib2impl);
129
        assertTrue(
130
            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Impl",
131
            ilib1impl < ilib2impl);
132
        assertTrue(
133
            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Prov1",
134
            ilib1prov1 < ilib2impl);
135
        assertTrue(
136
            "Lib2Impl dependends on Lib1API, must be initialized after Lib1Prov2",
137
            ilib1prov2 < ilib2impl);
138

  
139
        assertTrue(
140
            "Lib2Prov1 dependends on Lib3API, must be initialized afterwards",
141
            ilib3api < ilib2prov1);
142
        assertTrue(
143
            "Lib2Prov1 dependends on Lib3Impl, must be initialized after it",
144
            ilib3impl < ilib2prov1);
145

  
146
        assertTrue(
147
            "Lib4API dependends on Lib2Prov1, must be initialized after it",
148
            ilib4api > ilib2prov1);
149
    }
150

  
151
    private class TestLibrariesInitializer1 extends
152
        AbstractLibrariesInitializer {
153

  
154
        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
155
            Set libs = new LinkedHashSet();
156

  
157
            libs.add(lib4impl1);
158
            libs.add(lib2api);
159
            libs.add(lib2impl);
160
            libs.add(lib2prov1);
161
            libs.add(lib1api);
162
            libs.add(lib1impl);
163
            libs.add(lib4impl2);
164
            libs.add(lib1prov1);
165
            libs.add(lib1prov2);
166
            libs.add(lib3api);
167
            libs.add(lib3impl);
168
            libs.add(lib4api);
169

  
170
            return libs;
171
        }
172

  
173
    }
174

  
175
    private class TestLibrariesInitializer2 extends
176
        AbstractLibrariesInitializer {
177

  
178
        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
179
            Set libs = new LinkedHashSet();
180

  
181
            libs.add(lib2api);
182
            libs.add(lib4impl1);
183
            libs.add(lib2prov1);
184
            libs.add(lib1impl);
185
            libs.add(lib4impl2);
186
            libs.add(lib3impl);
187
            libs.add(lib2impl);
188
            libs.add(lib1api);
189
            libs.add(lib1prov2);
190
            libs.add(lib3api);
191
            libs.add(lib1prov1);
192
            libs.add(lib4api);
193

  
194
            return libs;
195
        }
196

  
197
    }
198

  
199
    private class TestLibrariesInitializer3 extends
200
        AbstractLibrariesInitializer {
201

  
202
        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
203
            Set libs = new LinkedHashSet();
204

  
205
            libs.add(lib4api);
206
            libs.add(lib2prov1);
207
            libs.add(lib2api);
208
            libs.add(lib4impl2);
209
            libs.add(lib3api);
210
            libs.add(lib1api);
211
            libs.add(lib4impl1);
212
            libs.add(lib2impl);
213
            libs.add(lib1prov2);
214
            libs.add(lib3impl);
215
            libs.add(lib1impl);
216
            libs.add(lib1prov1);
217

  
218
            return libs;
219
        }
220

  
221
    }
222

  
223
    private class DummyLibrary extends AbstractLibrary {
224

  
225
        protected void doInitialize() throws LibraryException {
226
            // Nothing to do
227
        }
228

  
229
        protected void doPostInitialize() throws LibraryException {
230
            // Nothing to do
231
        }
232
    }
233

  
234
    private class Lib1API extends DummyLibrary {
235

  
236
        public void doRegistration() {
237
            registerAsAPI(Lib1API.class);
238
        }
239
    }
240

  
241
    private class Lib1Impl extends DummyLibrary {
242

  
243
        public void doRegistration() {
244
            registerAsImplementationOf(Lib1API.class);
245
        }
246
    }
247

  
248
    private class Lib1Prov1 extends DummyLibrary {
249

  
250
        public void doRegistration() {
251
            registerAsServiceOf(Lib1API.class);
252
        }
253
    }
254

  
255
    private class Lib1Prov2 extends DummyLibrary {
256

  
257
        public void doRegistration() {
258
            registerAsServiceOf(Lib1API.class);
259
        }
260
    }
261

  
262
    private class Lib2API extends DummyLibrary {
263

  
264
        public void doRegistration() {
265
            registerAsAPI(Lib2API.class);
266
        }
267
    }
268

  
269
    private class Lib2Impl extends DummyLibrary {
270

  
271
        public void doRegistration() {
272
            registerAsImplementationOf(Lib2API.class);
273
            require(Lib1API.class);
274
        }
275
    }
276

  
277
    private class Lib2Prov1 extends DummyLibrary {
278

  
279
        public void doRegistration() {
280
            registerAsServiceOf(Lib2API.class);
281
            require(Lib3API.class);
282
        }
283
    }
284

  
285
    private class Lib3API extends DummyLibrary {
286

  
287
        public void doRegistration() {
288
            registerAsAPI(Lib3API.class);
289
        }
290
    }
291

  
292
    private class Lib3Impl extends DummyLibrary {
293

  
294
        public void doRegistration() {
295
            registerAsImplementationOf(Lib3API.class);
296
        }
297
    }
298

  
299
    private class Lib4API extends DummyLibrary {
300

  
301
        public void doRegistration() {
302
            registerAsAPI(Lib4API.class);
303
            require(Lib2Prov1.class);
304
        }
305
    }
306

  
307
    private class Lib4Impl1 extends DummyLibrary {
308

  
309
        public void doRegistration() {
310
            registerAsImplementationOf(Lib4API.class);
311
        }
312
    }
313

  
314
    private class Lib4Impl2 extends DummyLibrary {
315

  
316
        public void doRegistration() {
317
            registerAsImplementationOf(Lib4API.class, 10);
318
        }
319
    }
320
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/AbstractLibraryTest.java
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 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
 * 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
/*
25
 * AUTHORS (In addition to CIT):
26
 * 2009 {DiSiD Technologies}  {{Task}}
27
 */
28
package org.gvsig.tools.library;
29

  
30
import junit.framework.TestCase;
31

  
32
/**
33
 * Tests for the {@link AbstractLibrary} class.
34
 * 
35
 * @author gvSIG Team
36
 * @version $Id$
37
 */
38
public class AbstractLibraryTest extends TestCase {
39

  
40
	private AbstractLibrary baseLibrary;
41

  
42
	protected void setUp() throws Exception {
43
		super.setUp();
44
		baseLibrary = new DummyLibrary();
45
	}
46

  
47
	/**
48
	 * Test method for
49
	 * {@link org.gvsig.tools.library.AbstractLibrary.BaseLibrary#initialize()}.
50
	 */
51
	public void testInitialize() {
52
		baseLibrary.initialize();
53

  
54
		// If BaseLibrary is not working as expected, those invocations will
55
		// fail
56
		baseLibrary.initialize();
57
		baseLibrary.initialize();
58
	}
59

  
60
	/**
61
	 * Test method for
62
	 * {@link org.gvsig.tools.library.AbstractLibrary#postInitialize()}.
63
	 */
64
	public void testPostInitialize() {
65
		baseLibrary.postInitialize();
66

  
67
		// If BaseLibrary is not working as expected, those invocations will
68
		// fail
69
		baseLibrary.postInitialize();
70
		baseLibrary.postInitialize();
71
	}
72

  
73
	public static class DummyLibrary extends AbstractLibrary {
74

  
75
		public static boolean alreadyInitialized = false;
76
		public static boolean alreadyPostInitialized = false;
77
		
78
		public void doRegistration() {
79
			super.doRegistration();
80
			registerAsAPI(DummyLibrary.class);
81
		}
82

  
83
		protected void doInitialize() throws LibraryException {
84
			if (alreadyInitialized) {
85
				throw new RuntimeException(
86
						"The DymmyLibrary is already initialized");
87
			}
88
			alreadyInitialized = true;
89
		}
90

  
91
		protected void doPostInitialize() throws LibraryException {
92
			if (alreadyPostInitialized) {
93
				throw new RuntimeException(
94
						"The DymmyLibrary is already postInitialized");
95
			}
96
			alreadyPostInitialized = true;
97
		}
98

  
99
	}
100

  
101
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug67Test.java
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 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
 * 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.tools.library;
25

  
26
import java.util.LinkedHashSet;
27
import java.util.List;
28
import java.util.Set;
29

  
30
import junit.framework.TestCase;
31

  
32
/**
33
 * Unit test for the 16017 bug.
34
 * 
35
 * @author gvSIG Team
36
 * @version $Id$
37
 */
38
public class Bug67Test extends TestCase {
39

  
40
    private Library lib1api = new lib1API();
41
    private Library lib2api = new lib2API();
42
    private Library lib3api = new lib3API();
43
    private Library lib3impl = new lib3Impl();
44
    private Library lib2impl = new lib2Impl();
45
    private Library lib1impl = new lib1Impl();
46
    private Library lib2serv1 = new lib2Serv1();
47
    private Library lib2serv2 = new lib2Serv2();
48
    private Library lib2serv3 = new lib2Serv3();
49
    private Library lib2serv4 = new lib2Serv4();
50

  
51

  
52
    protected void setUp() throws Exception {
53
        super.setUp();
54
    }
55

  
56
    private class DummyLibrary extends AbstractLibrary {
57

  
58
        protected void doInitialize() throws LibraryException {
59
            // Nothing to do
60
        }
61

  
62
        protected void doPostInitialize() throws LibraryException {
63
            // Nothing to do
64
        }
65
    }
66

  
67
    private class lib1API extends DummyLibrary {
68

  
69
        public void doRegistration() {
70
            registerAsAPI(lib1API.class);
71
        }
72
    }
73

  
74
    private class lib1Impl extends DummyLibrary {
75

  
76
        public void doRegistration() {
77
            registerAsImplementationOf(lib1API.class);
78
            require(lib3API.class);
79
        }
80
    }
81

  
82
    private class lib2API extends DummyLibrary {
83

  
84
        public void doRegistration() {
85
            registerAsAPI(lib2API.class);
86
            require(lib1API.class);
87
        }
88
    }
89

  
90
    private class lib2Impl extends DummyLibrary {
91

  
92
        public void doRegistration() {
93
            registerAsImplementationOf(lib2API.class);
94
        }
95
    }
96

  
97
    private class lib2Serv1 extends DummyLibrary {
98

  
99
        public void doRegistration() {
100
            registerAsServiceOf(lib2API.class);
101
        }
102
    }
103

  
104
    private class lib2Serv2 extends DummyLibrary {
105

  
106
        public void doRegistration() {
107
            registerAsServiceOf(lib2API.class);
108
            require(lib2Serv1.class);
109
        }
110
    }
111

  
112
    private class lib2Serv3 extends DummyLibrary {
113

  
114
        public void doRegistration() {
115
            registerAsServiceOf(lib2API.class);
116
            require(lib2Serv2.class);
117
        }
118
    }
119

  
120
    private class lib2Serv4 extends DummyLibrary {
121

  
122
        public void doRegistration() {
123
            registerAsServiceOf(lib2API.class);
124
            require(lib2Serv1.class);
125
            require(lib2Serv3.class);
126
        }
127
    }
128

  
129
    private class lib3API extends DummyLibrary {
130

  
131
        public void doRegistration() {
132
            registerAsAPI(lib3API.class);
133
        }
134
    }
135

  
136
    private class lib3Impl extends DummyLibrary {
137

  
138
        public void doRegistration() {
139
            registerAsImplementationOf(lib3API.class);
140
            require(lib2API.class);
141
        }
142
    }
143

  
144
    private class TestLibraries extends AbstractLibrariesInitializer {
145

  
146
        protected Set findLibraries(Class libraryClass, ClassLoader classLoader) {
147
            Set libs = new LinkedHashSet();
148

  
149
            libs.add(lib1api);
150
            libs.add(lib2api);
151
            libs.add(lib2serv4);
152
            libs.add(lib3api);
153
            libs.add(lib2serv1);
154
            libs.add(lib1impl);
155
            libs.add(lib2serv3);
156
            libs.add(lib3impl);
157
            libs.add(lib2serv2);
158
            libs.add(lib2impl);
159

  
160
            return libs;
161
        }
162

  
163
    }
164

  
165
    public void testInitialize() throws Exception {
166
        TestLibraries init = new TestLibraries();
167
        List libs = init.getLibraries();
168
        checkOrder(libs);
169
    }
170

  
171
    private void checkOrder(List libs) {
172
        int ilib1api = libs.indexOf(lib1api);
173
        int ilib1impl = libs.indexOf(lib1impl);
174
        int ilib2api = libs.indexOf(lib2api);
175
        int ilib2impl = libs.indexOf(lib2impl);
176
        int ilib2serv1 = libs.indexOf(lib2serv1);
177
        int ilib2serv2 = libs.indexOf(lib2serv2);
178
        int ilib2serv3 = libs.indexOf(lib2serv3);
179
        int ilib2serv4 = libs.indexOf(lib2serv4);
180
        int ilib3api = libs.indexOf(lib3api);
181
        int ilib3impl = libs.indexOf(lib3impl);
182

  
183
        // Check all needed libraries have been included into the list
184
        assertTrue("Lib1API is not included in the list", ilib1api > -1);
185
        assertTrue("Lib1Impl is not included in the list", ilib1impl > -1);
186
        assertTrue("Lib2API is not included in the list", ilib2api > -1);
187
        assertTrue("Lib2Impl is not included in the list", ilib2impl > -1);
188
        assertTrue("Lib2Serv1 is not included in the list", ilib2serv1 > -1);
189
        assertTrue("Lib2Serv2 is not included in the list", ilib2serv2 > -1);
190
        assertTrue("Lib2Serv3 is not included in the list", ilib2serv3 > -1);
191
        assertTrue("Lib2Serv4 is not included in the list", ilib2serv4 > -1);
192
        assertTrue("Lib3API is not included in the list", ilib3api > -1);
193
        assertTrue("Lib3Impl is not included in the list", ilib3impl > -1);
194

  
195
        // Check api-impl-service(provider) relationships:
196
        // first API, next Impl and then services (providers)
197
        assertTrue("Lib1API must be initialized before Lib1Impl",
198
                ilib1api < ilib1impl);
199

  
200
        assertTrue("Lib2API must be initialized before Lib2Impl",
201
                ilib2api < ilib2impl);
202
        assertTrue("Lib2Impl must be initialized before Lib2Serv1",
203
            ilib2impl < ilib2serv1);
204
        assertTrue("Lib2Serv1 must be initialized before Lib2Serv2",
205
            ilib2serv1 < ilib2serv2);
206
        assertTrue("Lib2Serv2 must be initialized before Lib2Serv3",
207
            ilib2serv2 < ilib2serv3);
208
        assertTrue("Lib2Serv3 must be initialized before Lib2Serv4",
209
            ilib2serv3 < ilib2serv4);
210

  
211
        assertTrue("Lib3API must be initialized before Lib3Impl",
212
                ilib3api < ilib3impl);
213

  
214
        // Check dependencies between libraries
215
        assertTrue(
216
                "Lib2Impl dependends on Lib1API, must be initialized after it",
217
                ilib1api < ilib2impl);
218
    }
219

  
220
}
org.gvsig.tools/library/tags/org.gvsig.tools-3.0.200/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/library/Bug16017Test.java
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 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
 * 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.tools.library;
25

  
26
import java.util.LinkedHashSet;
27
import java.util.Set;
28

  
29
import junit.framework.TestCase;
30

  
31
/**
32
 * Unit test for the 16017 bug.
33
 * 
34
 * @author gvSIG Team
35
 * @version $Id$
36
 */
37
public class Bug16017Test extends TestCase {
38

  
39
    private Library libCircular1api = new LibCircular1API();
40
    private Library libCircular2api = new LibCircular2API();
41
    private Library libCircular3api = new LibCircular3API();
42
    private Library libCircular3impl = new LibCircular3Impl();
43
    private Library libCircular2impl = new LibCircular2Impl();
44
    private Library libCircular1impl = new LibCircular1Impl();
45

  
46
    protected void setUp() throws Exception {
47
        super.setUp();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff