]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootNoRuntimeTest.java
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.argeo
.slc
.osgiboot
;
20 import java
.util
.List
;
22 import junit
.framework
.TestCase
;
24 import org
.argeo
.osgi
.boot
.OsgiBoot
;
26 public class OsgiBootNoRuntimeTest
extends TestCase
{
27 public final static String BUNDLES
= "src/test/bundles/some;in=*;ex=excluded,"
28 + "src/test/bundles/others;in=**/org.argeo.*";
30 public void testLocations() {
31 String baseUrl
= "file:";
32 String locations
= "/mydir/myfile" + File
.pathSeparator
33 + "/myotherdir/myotherfile";
35 OsgiBoot osgiBoot
= new OsgiBoot(null);
36 List urls
= osgiBoot
.getLocationsUrls(baseUrl
, locations
);
37 assertEquals(2, urls
.size());
38 assertEquals("file:/mydir/myfile", urls
.get(0));
39 assertEquals("file:/myotherdir/myotherfile", urls
.get(1));
42 public void testBundles() {
43 String baseUrl
= "file:";
44 String bundles
= BUNDLES
;
45 OsgiBoot osgiBoot
= new OsgiBoot(null);
46 List urls
= osgiBoot
.getBundlesUrls(baseUrl
, bundles
);
47 for (int i
= 0; i
< urls
.size(); i
++)
48 System
.out
.println(urls
.get(i
));
49 assertEquals(3, urls
.size());
51 List jarUrls
= osgiBoot
.getBundlesUrls(baseUrl
,
52 "src/test/bundles/jars;in=*.jar");
53 for (int i
= 0; i
< jarUrls
.size(); i
++)
54 System
.out
.println(jarUrls
.get(i
));
55 assertEquals(1, jarUrls
.size());