@@ -134,6 +134,53 @@ public void getSourceFromResource_contextAbsoluteFileUrl_locationRelativeUrl_bas
134
134
assertEquals (getClass ().getResource (location ), relativeSource .getKey ());
135
135
}
136
136
137
+ @ Test
138
+ public void getSourceFromResource_contextFolderUrl_locationRelative () throws IOException , PermissionDeniedException {
139
+ final String contextPath = "resource:org/exist/source" ;
140
+ final String location = "library.xqm" ;
141
+
142
+ final Source source = SourceFactory .getSource (null , contextPath , location , false );
143
+
144
+ assertTrue (source instanceof ClassLoaderSource );
145
+ assertEquals (getClass ().getResource ("library.xqm" ), source .getKey ());
146
+ }
147
+
148
+ @ Test
149
+ public void getSourceFromResource_contextFolderUrl_locationAbsoluteUrl () throws IOException , PermissionDeniedException {
150
+ final String contextPath = "resource:org/exist/source" ;
151
+ final String location = "resource:org/exist/source/library.xqm" ;
152
+
153
+ final Source source = SourceFactory .getSource (null , contextPath , location , false );
154
+
155
+ assertTrue (source instanceof ClassLoaderSource );
156
+ assertEquals (getClass ().getResource ("library.xqm" ), source .getKey ());
157
+ }
158
+
159
+ @ Test
160
+ public void getSourceFromResource_contextFolderUrl_locationRelativeUrl () throws IOException , PermissionDeniedException {
161
+ final String contextPath = "resource:org/exist/source" ;
162
+ final String location = "library.xqm" ;
163
+
164
+ final Source source = SourceFactory .getSource (null , contextPath , location , false );
165
+
166
+ assertTrue (source instanceof ClassLoaderSource );
167
+ assertEquals (getClass ().getResource ("library.xqm" ), source .getKey ());
168
+ }
169
+
170
+ @ Test
171
+ public void getSourceFromResource_contextFolderUrl_locationRelativeUrl_basedOnSource () throws IOException , PermissionDeniedException {
172
+ final String contextPath = "resource:org/exist/source" ;
173
+ final String location = "library.xqm" ;
174
+
175
+ final Source mainSource = SourceFactory .getSource (null , "" , contextPath , false );
176
+ assertTrue (mainSource instanceof ClassLoaderSource );
177
+
178
+ final Source relativeSource = SourceFactory .getSource (null , ((ClassLoaderSource )mainSource ).getSource (), location , false );
179
+
180
+ assertTrue (relativeSource instanceof ClassLoaderSource );
181
+ assertEquals (getClass ().getResource (location ), relativeSource .getKey ());
182
+ }
183
+
137
184
@ Test
138
185
public void getSourceFromXmldb_noContext () throws IOException , PermissionDeniedException {
139
186
final String contextPath = null ;
0 commit comments