Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Virgo OSGi modules integration test
Virgo OSGi modules integration test [message #707363] Mon, 01 August 2011 14:56 Go to next message
Dan  is currently offline Dan
Messages: 4
Registered: August 2011
Location: Minsk, BY
Junior Member
I'm trying to write tests for %subject%.

Something like BundleDeployerIntegrationTests.java

so I wrote similar test.
public class OSGiContainerTest extends AbstractDeployerIntegrationTest {
    private static final String TEST_BUNDLE_TYPE = "bundle";
    private static final String TEST_BUNDLE_SYMBOLIC_NAME = "de.enexoma.dlms-service";
    private static final String TEST_BUNDLE_VERSION = "1.2.0-SNAPSHOT";

    @Test
    public void testDeployer() throws Exception {
        File file = new File("../out/de.enexoma.dlms-service-1.2.0-SNAPSHOT.jar");

        DeploymentIdentity deploymentId = deployer.deploy(file.toURI());

        assertDeploymentIdentityEquals(deploymentId, "testbundle.jar", TEST_BUNDLE_TYPE, TEST_BUNDLE_SYMBOLIC_NAME, TEST_BUNDLE_VERSION);
        assertNotNull(ApplicationContextUtils.getApplicationContext(context, TEST_BUNDLE_SYMBOLIC_NAME));

        deployer.undeploy(deploymentId.getType(), deploymentId.getSymbolicName(), deploymentId.getVersion());
        // Check that the test bundle's application context is destroyed.
        assertNull(ApplicationContextUtils.getApplicationContext(context, TEST_BUNDLE_SYMBOLIC_NAME));
    }
}


Now I need to include in class path org.eclipse.virgo.kernel.deployer.test.AbstractDeployerIntegrationTest.

and i included some dependencies
<dependencies>
    <dependency>
        <groupId>org.eclipse.virgo.kernel</groupId>
        <artifactId>org.eclipse.virgo.kernel.deployer</artifactId>
        <version>2.1.0.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.virgo.kernel</groupId>
        <artifactId>org.eclipse.virgo.kernel.osgi</artifactId>
        <version>2.1.0.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.virgo.test</groupId>
        <artifactId>org.eclipse.virgo.test.framework</artifactId>
        <version>2.1.0.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.virgo.kernel</groupId>
        <artifactId>org.eclipse.virgo.kernel.deployer.test</artifactId>
        <version>2.1.0.RELEASE</version>
        <scope>test</scope>
    </dependency>
</dependencies>


But org.eclipse.virgo.kernel.deployer.test artifact contains no classes, just META-INF dir and org.springframework.beans-2.5.6.A.jar/org.springframework.core-2.5.6.A.jar files.

So if I browsing git repository I see required classes but if I fetch them from repository they are not there.

Can someone help me?
Re: Virgo OSGi modules integration test [message #708213 is a reply to message #707363] Tue, 02 August 2011 15:23 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
The nub of the problem is that Virgo's test projects cannot depend on each other. This is the way Spring Build was designed and Virgo build inherited that design. I raised this issue a while back in bug 334753.

The simplest workaround is probably to copy AbstractDeployerIntegrationTest into your test project. You may even want to rename it and possibly tweak it to suit your own tests.
Re: Virgo OSGi modules integration test [message #708797 is a reply to message #708213] Wed, 03 August 2011 07:23 Go to previous messageGo to next message
Dan  is currently offline Dan
Messages: 4
Registered: August 2011
Location: Minsk, BY
Junior Member
Thanks for response.

Still have some questions. I agree that test projects cannot depend on each other. And it's not good when my test project depends on virgo's one, but: it's case when i'm trying to extend my test from virgo tests like BundleDeployerIntegrationTests or BundleActivationPolicyTests which is not. I'm using abstract class, so why not create separated project with base Abstarct testing facility? Something like

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>org.springframework.test</artifactId>
</dependency>


So other projects and implementations would depend on base testing project, no interdependency.
Re: Virgo OSGi modules integration test [message #708855 is a reply to message #708797] Wed, 03 August 2011 08:15 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I agree something like that is desirable, but we are currently faced with the restriction in virgo-build that test projects cannot depend on runtime projects or other test projects, so there is no way for a test project to depend on a project of any type containing the abstract class.

Please add comments to the bug 334753 if you would like to lobby for it to be implemented.
Re: Virgo OSGi modules integration test [message #708871 is a reply to message #708797] Wed, 03 August 2011 08:44 Go to previous messageGo to next message
Dan  is currently offline Dan
Messages: 4
Registered: August 2011
Location: Minsk, BY
Junior Member
seems my questing is a little bit not correct, because i'm asking about already existing framework

        <dependency>
            <groupId>org.eclipse.virgo.test</groupId>
            <artifactId>org.eclipse.virgo.test.framework</artifactId>
            <version>2.1.0.RELEASE</version>
            <scope>test</scope>
        </dependency>
Re: Virgo OSGi modules integration test [message #708875 is a reply to message #708871] Wed, 03 August 2011 08:47 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn Normington
Messages: 1222
Registered: July 2009
Senior Member
I'm afraid I can't answer that question as I do not profess to understand Maven much. Perhaps someone else could comment?
Re: Virgo OSGi modules integration test [message #708941 is a reply to message #708875] Wed, 03 August 2011 09:56 Go to previous message
Dan  is currently offline Dan
Messages: 4
Registered: August 2011
Location: Minsk, BY
Junior Member
see git.springsource.org/virgo/test/trees/master/org.eclipse.virgo.test.framework

also add http protocol prefix to link above (can't post url until get 5 messages on this forum)

[Updated on: Wed, 03 August 2011 09:58]

Report message to a moderator

Previous Topic:Missing bundle when adding/removing bundles in STS servers view
Next Topic:Install bundles located in the provisioning repositories programmatically
Goto Forum:
  


Current Time: Wed Sep 17 23:48:59 GMT 2014

Powered by FUDForum. Page generated in 0.01811 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software