]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.osgiboot/src/test/java/org/argeo/slc/osgiboot/OsgiBootNoRuntimeTest.java
remove empty packages
[gpl/argeo-slc.git] / runtime / org.argeo.slc.osgiboot / src / test / java / org / argeo / slc / osgiboot / OsgiBootNoRuntimeTest.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 package org.argeo.slc.osgiboot;
18
19 import java.io.File;
20 import java.util.List;
21
22 import junit.framework.TestCase;
23
24 import org.argeo.slc.osgiboot.OsgiBoot;
25
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.*";
29
30 public void testLocations() {
31 String baseUrl = "file:";
32 String locations = "/mydir/myfile" + File.pathSeparator
33 + "/myotherdir/myotherfile";
34
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));
40 }
41
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());
50
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());
56 }
57 }