OSGi OSGi Blueprint Integrationstests

borobudur

Aktives Mitglied
Hallo, hat jemand schon einmal integrationstest im osgi-blueprint umfeld umgesetzt?

Ich habe das problem, dass ich meine bundels mit dependency-injection "via blueprint" erstelle. Nun versuche ich einen integrationstest zu bauen (auch ein bundel) und dieses mit maven zu installieren. Das geht aber nicht, da maven zuerst die tests laufen lässt und damit mit einem error endet. Das framework hat die instanzen nicht injected!
 
M

maki

Gast
Kenne blueprint jetzt nciht im Detail, hab immer mit SpringDM gearbeitet ;)

Welche Phase nutzt du denn für eine Integrationstests, welches Maven plugin um diese auszuführen?
Dass Integrationstests in einem eigenen Maven Modul ausgelagert sein sollten ist selbstredend und wird von mir vorausgesetzt ;)
 

borobudur

Aktives Mitglied
[XML]<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>compiled-bundle-settings</artifactId>
<groupId>ch.fhnw.athene.store.build</groupId>
<version>0.1.0</version>
<relativePath>../poms/compiled/</relativePath>
</parent>
<groupId>ch.fhnw.athene.store</groupId>
<artifactId>athene-store-test</artifactId>
<version>0.1.0</version>
<name>Pax Exam based Testproject</name>
<properties>
<skipTests>false</skipTests>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>maven-paxexam-plugin</artifactId>
<version>1.2.3</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>depends-maven-plugin</artifactId>
<version>1.2</version>
<type>maven-plugin</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.fhnw.athene.store</groupId>
<artifactId>ch.fhnw.athene.store.triple</artifactId>
<version>0.1.0</version>
<type>bundle</type>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
[/XML]
 
M

maki

Gast
Für Integrationstests am besten die integrations-test pahse nutzen, zusammen mit dem failsafe plugin (Maven Failsafe Plugin - Introduction) anstatt des surefire plugins.

Wir wohl dein konkretes Problem nicht lösen, ist aber zumindest mal ein Schritt in die richtige Richtung.

Wie gesagt, nutze kein blueprint sondern SpringDM, aber solltest du das pam-exam test nicht noch konfigurieren (Quellcode)?
 

borobudur

Aktives Mitglied
Java:
    @Configuration
    public static Option[] configure() {
        return CoreOptions.options(CoreOptions.provision(
                // Infrastructure bundles
                CoreOptions.mavenBundle().groupId("org.osgi").artifactId("osgi_R4_core"),
                CoreOptions.mavenBundle().groupId("org.osgi").artifactId("osgi_R4_compendium"),
                CoreOptions.mavenBundle().groupId("com.hp.hpl.jena").artifactId("sdb"),
                // Project bundles
                CoreOptions.mavenBundle().groupId("ch.fhnw.athene.store").artifactId("ch.fhnw.athene.store.triple")
                        .versionAsInProject()));
    }

    @Test
    public void saveOntologyTest() {
        ASOntology asOntology = (ASOntology) bundleContext.getServiceReference(ASOntology.class.getName());
        Assert.assertNotNull(asOntology);
    }
 

borobudur

Aktives Mitglied
Ich gehe davon aus, dass das noch niemand umgesetzt hat. Hab nix gefunden, so dass meine bundles resp. meine beans/services beim integrationstest instanziiert werden.
 
M

maki

Gast
Wie gesaagt, kenne Felix nicht und auch nicht die pax-exam-junit Bundles.

Für mich als Equinoxer mit SpringDM stellt sich die Sache, also ein Integrationstest, so dar:
Man erstellt eine targetplattform, die nur die bundles enthält die man für den I-test braucht, startet diese, und dann lässt man Tests gegen die zu testende Konponente laufen.

Deswegen verstehe ich nciht, das du sagst das deine Services/Beans beim I-Test nicht instanziiert werden, müsste doch genauso funzen wie bei einem normalen "Run" der App.

SpringDM bietet auch Unterstützung für Pseudo I-Tests, kommt dem richtigen I-Test recht nahe, ist aber eher ein Unittest (Bundles werden on-the-fly erzeugt, Mocks, etc.)
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
F OSGi und root rechte Plattformprogrammierung 2
Z MySQL-Treiber in RAP-Anwendung für Jetty im OSGI- Equinox- Maven-Dschungel Plattformprogrammierung 0
Shams Antbuild - Problem bei OSGi Anfängertutorial Plattformprogrammierung 0
T OSGi OSGI bundle bauen org.apache.xerces Plattformprogrammierung 3
G OSGi Bundle-ClassPath Plattformprogrammierung 3
P OSGi registerService Plattformprogrammierung 3
H OSGi OSGi + Logback + slf4j - Eclipse Run Configuration Plattformprogrammierung 7
G OSGI bundleChanged Plattformprogrammierung 2
E OSGi Equinox HttpService only supports servlet 2.1 specification. Plattformprogrammierung 2
X Probleme mit dem OSGi-Framework Plattformprogrammierung 3
S OSGi Declarative Service Cardinality Plattformprogrammierung 6
Kr0e OSGI - Anfängerfragen Plattformprogrammierung 3
K OSGi Verteilte Anwendung? Plattformprogrammierung 9
B OSGi Einsteiger OSGi-Applikation Plattformprogrammierung 9
S (OSGI - EQUINOX) Welche Eclipse IDE? Plattformprogrammierung 3
N OSGi: Ressourcen gezielt aus bestimmten Modulen laden? Plattformprogrammierung 4
S OSGi Filter Syntax Plattformprogrammierung 2
N OSGi Dependency Loading Plattformprogrammierung 2
S OSGi Bibliothek für alle Plattformprogrammierung 5
H OSGI mit Eclipse und Maven Plattformprogrammierung 5
X OSGi Splash ohne product Plattformprogrammierung 2
G OSGi: Service registrieren Plattformprogrammierung 2
lumo OSGI Service - ServiceReference Plattformprogrammierung 3
G [osgi] bundle spezifische properties Plattformprogrammierung 5
DEvent [osgi] Services implementieren Plattformprogrammierung 2
C RCP Applikation starten als OSGi Bundle Plattformprogrammierung 2
B equinox OSGi EclipseStarter.startup NullPointerException Plattformprogrammierung 3
B OSGi, Euqinox, innherhalb vom Bundle Pfad des zugehörigen jar-files ermitteln Plattformprogrammierung 6
B OSGi, Equinox, Exceptions werden "ignoriert" Plattformprogrammierung 21
C OSGi, Hibernate und welche Datenbank? Plattformprogrammierung 4
astralarse Custom OSGi Launcher mit config.ini Plattformprogrammierung 6
C Eclipse - Externe OSGi bundles adden Plattformprogrammierung 7
F OSGi Anwendungsdesign Plattformprogrammierung 3
N OSGI in Netbeans? Plattformprogrammierung 5
X OSGi und RCP Plattformprogrammierung 15
C OSGi shutdown Plattformprogrammierung 4
D Problem mit Synth Painter und OSGi (Equinox) Plattformprogrammierung 8
D OSGi JSR296 (Swing Application Framework) - Konzeptionsfrage Plattformprogrammierung 2
G Osgi Plattformprogrammierung 5
A Plugin konzepte: OSGI oder JPF? Plattformprogrammierung 5
S OSGI Framework Knopflerfish Plattformprogrammierung 11
Robertop Gemini Blueprint und Spring inkompatible Versionen Plattformprogrammierung 2
H OSGi Deklarative Services oder Blueprint Plattformprogrammierung 2
E OSGi Blueprint Depends-On Plattformprogrammierung 2

Ähnliche Java Themen

Neue Themen


Oben