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