Skip to content

Commit f008104

Browse files
RCB-603: add OSGi itests
1 parent 493c2e4 commit f008104

File tree

5 files changed

+228
-0
lines changed

5 files changed

+228
-0
lines changed

osgi-itests/bnd.bnd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Export-Package: ${p}.it
2+
3+
Test-Cases: \
4+
${classes;CONCRETE;ANNOTATED;org.junit.Test}
5+
6+
p = com.basistech.rosette.osgi
7+
8+

osgi-itests/it.bndrun

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-standalone: target/index.xml
2+
# -runtrace: true
3+
-runfw: org.apache.felix.framework;version=5
4+
-runee: JavaSE-1.8
5+
6+
-runsystempackages: \
7+
sun.misc,org.slf4j
8+
9+
-resolve.effective: resolve, active
10+
11+
12+
-runrequires: \
13+
osgi.identity;filter:='(osgi.identity=rosette-api-osgi-itests)',\
14+
osgi.identity;filter:='(osgi.identity=slf4j.api)',\
15+
osgi.identity;filter:='(osgi.identity=slf4j.simple)',\
16+
osgi.identity;filter:='(osgi.identity=osgi.enroute.hamcrest.wrapper)',\
17+
osgi.identity;filter:='(osgi.identity=osgi.enroute.junit.wrapper)'
18+

osgi-itests/pom.xml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?xml version="1.0"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>rosette-api-osgi-itests</artifactId>
5+
<parent>
6+
<groupId>com.basistech.rosette</groupId>
7+
<artifactId>rosette-api-java-binding</artifactId>
8+
<version>1.21.1-SNAPSHOT</version>
9+
</parent>
10+
<properties>
11+
<bundle-repo>target/test-bundles</bundle-repo>
12+
</properties>
13+
<dependencies>
14+
<dependency>
15+
<groupId>com.basistech.rosette</groupId>
16+
<artifactId>rosette-api</artifactId>
17+
<version>1.21.1-SNAPSHOT</version>
18+
</dependency>
19+
<dependency>
20+
<groupId>com.basistech</groupId>
21+
<artifactId>common-api</artifactId>
22+
<version>37.0.1</version>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.apache.felix</groupId>
26+
<artifactId>org.apache.felix.framework</artifactId>
27+
<version>6.0.3</version>
28+
<scope>runtime</scope>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.apache.felix</groupId>
32+
<artifactId>org.apache.felix.configadmin</artifactId>
33+
<version>1.8.10</version>
34+
<scope>compile</scope>
35+
</dependency>
36+
<!--
37+
<dependency>
38+
<groupId>org.apache.felix</groupId>
39+
<artifactId>org.apache.felix.scr</artifactId>
40+
<version>2.0.6</version>
41+
<scope>compile</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.felix</groupId>
45+
<artifactId>org.apache.felix.metatype</artifactId>
46+
<version>1.2.2</version>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.apache.felix</groupId>
50+
<artifactId>org.apache.felix.log</artifactId>
51+
<version>1.0.0</version>
52+
</dependency>
53+
-->
54+
<!-- SLF4J is part of rosette-osgi's system packages. -->
55+
<dependency>
56+
<groupId>org.slf4j</groupId>
57+
<artifactId>slf4j-api</artifactId>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.slf4j</groupId>
61+
<artifactId>slf4j-simple</artifactId>
62+
</dependency>
63+
64+
<dependency>
65+
<groupId>org.osgi</groupId>
66+
<artifactId>osgi.enroute.junit.wrapper</artifactId>
67+
<version>4.12.0</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.osgi</groupId>
71+
<artifactId>osgi.enroute.hamcrest.wrapper</artifactId>
72+
<version>1.3.0</version>
73+
</dependency>
74+
<!--
75+
<dependency>
76+
<groupId>org.osgi</groupId>
77+
<artifactId>osgi.cmpn</artifactId>
78+
<version>6.0.0</version>
79+
</dependency>
80+
-->
81+
<dependency>
82+
<groupId>org.osgi</groupId>
83+
<artifactId>org.osgi.core</artifactId>
84+
<version>6.0.0</version>
85+
</dependency>
86+
</dependencies>
87+
<build>
88+
<plugins>
89+
<!-- Copy all maven dependencies to the test OBR repo, skipping Compendium which is not resolvable. -->
90+
<plugin>
91+
<artifactId>maven-dependency-plugin</artifactId>
92+
<executions>
93+
<execution>
94+
<phase>pre-integration-test</phase>
95+
<id>copy-it-dependencies</id>
96+
<goals>
97+
<goal>copy-dependencies</goal>
98+
</goals>
99+
<configuration>
100+
<outputDirectory>${bundle-repo}</outputDirectory>
101+
<excludeArtifactIds>osgi.cmpn</excludeArtifactIds>
102+
</configuration>
103+
</execution>
104+
</executions>
105+
</plugin>
106+
<!-- Build the OSGi MANIFEST.MF using the 'bnd' tool, reading the contents of bnd.bnd. -->
107+
<plugin>
108+
<groupId>biz.aQute.bnd</groupId>
109+
<artifactId>bnd-maven-plugin</artifactId>
110+
</plugin>
111+
112+
<!-- Custom manifest header rootDirectory has the root directory. -->
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-jar-plugin</artifactId>
116+
<configuration>
117+
<archive>
118+
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
119+
<manifestEntries>
120+
<basedir>${basedir}</basedir>
121+
</manifestEntries>
122+
</archive>
123+
<outputDirectory>${bundle-repo}</outputDirectory>
124+
</configuration>
125+
</plugin>
126+
127+
<!-- Index the test bundle repo as OBR. -->
128+
<plugin>
129+
<groupId>biz.aQute.bnd</groupId>
130+
<artifactId>bnd-indexer-maven-plugin</artifactId>
131+
<version>3.5.0</version>
132+
<configuration>
133+
<inputDir>${bundle-repo}</inputDir>
134+
<includeJar>true</includeJar>
135+
</configuration>
136+
<executions>
137+
<execution>
138+
<id>index-repo</id>
139+
<phase>pre-integration-test</phase>
140+
<goals>
141+
<goal>local-index</goal>
142+
</goals>
143+
</execution>
144+
</executions>
145+
</plugin>
146+
147+
<!-- Invoke the main bundle with the test bundle repository. -->
148+
<plugin>
149+
<groupId>biz.aQute.bnd</groupId>
150+
<artifactId>bnd-testing-maven-plugin</artifactId>
151+
<version>3.5.0</version>
152+
<configuration>
153+
<failOnChanges>false</failOnChanges>
154+
<bndruns>
155+
<bndrun>it.bndrun</bndrun>
156+
</bndruns>
157+
<resolve>true</resolve>
158+
</configuration>
159+
<executions>
160+
<execution>
161+
<phase>integration-test</phase>
162+
<id>it-bnd-testing</id>
163+
<goals>
164+
<goal>testing</goal>
165+
</goals>
166+
</execution>
167+
</executions>
168+
</plugin>
169+
</plugins>
170+
</build>
171+
</project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2022 Basis Technology Corp.
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 com.basistech.rosette.osgi.it;
18+
19+
import com.basistech.rosette.api.HttpRosetteAPI;
20+
import org.junit.Test;
21+
22+
import static org.junit.Assert.assertNotNull;
23+
24+
public class RosetteApiOsgiTest {
25+
@Test
26+
public void smokeTest() {
27+
HttpRosetteAPI api = new HttpRosetteAPI.Builder().build();
28+
assertNotNull(api);
29+
}
30+
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<module>json</module>
6363
<module>common</module>
6464
<module>api</module>
65+
<module>osgi-itests</module>
6566
<module>examples</module>
6667
<module>release</module>
6768
</modules>

0 commit comments

Comments
 (0)