]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootNoRuntimeTest.java
2 * Copyright (C) 2007-2012 Argeo GmbH
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.
16 package org
.argeo
.osgi
.boot
;
19 import java
.util
.List
;
21 import junit
.framework
.TestCase
;
23 import org
.argeo
.osgi
.boot
.OsgiBoot
;
25 /** Tests which do not require a runtime. */
26 @SuppressWarnings("rawtypes")
27 public class OsgiBootNoRuntimeTest
extends TestCase
{
28 public final static String BUNDLES
= "src/test/bundles/some;in=*;ex=excluded,"
29 + "src/test/bundles/others;in=**/org.argeo.*";
31 /** Tests that location lists are properly parsed. */
32 public void testLocations() {
33 String baseUrl
= "file:";
34 String locations
= "/mydir/myfile" + File
.pathSeparator
35 + "/myotherdir/myotherfile";
37 OsgiBoot osgiBoot
= new OsgiBoot(null);
38 osgiBoot
.setExcludeSvn(true);
39 List urls
= osgiBoot
.getLocationsUrls(baseUrl
, locations
);
40 assertEquals(2, urls
.size());
41 assertEquals("file:/mydir/myfile", urls
.get(0));
42 assertEquals("file:/myotherdir/myotherfile", urls
.get(1));
45 /** Tests that bundle lists are properly parsed. */
46 public void testBundles() {
47 String baseUrl
= "file:";
48 String bundles
= BUNDLES
;
49 OsgiBoot osgiBoot
= new OsgiBoot(null);
50 osgiBoot
.setExcludeSvn(true);
51 List urls
= osgiBoot
.getBundlesUrls(baseUrl
, bundles
);
52 for (int i
= 0; i
< urls
.size(); i
++)
53 System
.out
.println(urls
.get(i
));
54 assertEquals(3, urls
.size());
56 List jarUrls
= osgiBoot
.getBundlesUrls(baseUrl
,
57 "src/test/bundles/jars;in=*.jar");
58 for (int i
= 0; i
< jarUrls
.size(); i
++)
59 System
.out
.println(jarUrls
.get(i
));
60 assertEquals(1, jarUrls
.size());