Package org.apache.felix.deploymentadmin.itest.util

Examples of org.apache.felix.deploymentadmin.itest.util.DeploymentPackageBuilder


     * Tests that if an exception is thrown during the stop of a bundle, the installation/update continues and succeeds.
     */
    @Test
    public void testUpdateBundleWithExceptionThrownInStopCauseNoRollbackOk() throws Exception
    {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle1")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle3")));

        DeploymentPackage dp = installDeploymentPackage(dpBuilder);
        assertNotNull("No deployment package returned?!", dp);

        awaitRefreshPackagesEvent();

        assertBundleExists(getSymbolicName("bundle3"), "1.0.0");

        System.setProperty("bundle3", "stop");

        dpBuilder = createDeploymentPackageBuilder(dpBuilder.getSymbolicName(), "1.0.1");
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle1")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle2")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle3")));

        dp = installDeploymentPackage(dpBuilder);
        assertNotNull("No deployment package returned?!", dp);

        assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
View Full Code Here


@RunWith(PaxExam.class)
public class ResourceSharingTest extends BaseIntegrationTest {

    @Test
    public void testBundleCanBelongToOneDeploymentPackageOnly() throws Exception {
        DeploymentPackageBuilder dpBuilder1 = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder1
            .add(dpBuilder1.createBundleResource()
                .setUrl(getTestBundle("bundle1"))
            )
            .add(dpBuilder1.createBundleResource()
                .setUrl(getTestBundle("bundle2"))
            );

        DeploymentPackageBuilder dpBuilder2 = createNewDeploymentPackageBuilder("0.8.0");
        dpBuilder2
            .add(dpBuilder2.createBundleResource()
                .setUrl(getTestBundle("bundle1"))
            );

        DeploymentPackage dp1 = installDeploymentPackage(dpBuilder1);
        assertNotNull("No deployment package returned?!", dp1);
View Full Code Here

        Bundle result = m_context.installBundle(getTestBundle("bundle1").toExternalForm());
        assertNotNull(result);
       
        assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
       
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle1"))
            )
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle2"))
            );

        try {
            // should fail: valid-bundle1 is installed, but does not belong to any DP...
View Full Code Here

        long bundleId = result.getBundleId();

        assertBundleExists(getSymbolicName("bundle1"), "1.0.0");
        assertTrue(isBundleInstalled(result));

        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource()
                .setVersion("1.1.0")
                .setUrl(getTestBundle("bundle1"))
                .setFilter(new JarManifestManipulatingFilter("Bundle-Version", "1.1.0"))
            )
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle2"))
            );
       
        // should succeed: valid-bundle1 is installed, but has a different version than the one in our DP...
        DeploymentPackage dp = installDeploymentPackage(dpBuilder);
View Full Code Here

     * FELIX-4466 - test that an event is fired when an installation of a DP fails.
     */
    @Test
    public void testFailedInstallationCausesCompletionEventOk() throws Exception
    {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        // incluse two different versions of the same bundle (with the same BSN), this is *not* allowed per the DA spec...
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi1", "bundleapi1", "1.0.0")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi2", "bundleapi2", "2.0.0")));

        final AtomicReference<Event> completionEventRef = new AtomicReference<Event>();
        final AtomicReference<Event> installEventRef = new AtomicReference<Event>();
        final CountDownLatch cdl = new CountDownLatch(1);

View Full Code Here

     * FELIX-4466 - test that an event is fired when an installation of a DP succeeds.
     */
    @Test
    public void testSuccessfulInstallationCausesCompletionEventOk() throws Exception
    {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi1", "bundleapi1", "1.0.0")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleimpl1", "bundleimpl1", "1.0.0")));

        final AtomicReference<Event> completionEventRef = new AtomicReference<Event>();
        final AtomicReference<Event> installEventRef = new AtomicReference<Event>();
        final CountDownLatch cdl = new CountDownLatch(2);
       
View Full Code Here

     * FELIX-4466 - test that an event is fired when a DP is uninstalled.
     */
    @Test
    public void testSuccessfulUninstallationCausesCompletionEventOk() throws Exception
    {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleapi1", "bundleapi1", "1.0.0")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundleimpl1", "bundleimpl1", "1.0.0")));

        final AtomicReference<Event> completionEventRef = new AtomicReference<Event>();
        final AtomicReference<Event> uninstallEventRef = new AtomicReference<Event>();
        final CountDownLatch cdl = new CountDownLatch(2);
       
View Full Code Here

     * FELIX-4466 - test that an event is fired when a DP is uninstalled, but fails.
     */
    @Test
    public void testFailedUninstallationCausesCompletionEventOk() throws Exception
    {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle1")))
            .add(dpBuilder.createResourceProcessorResource().setUrl(getTestBundle("rp1")))
            .add(dpBuilder.createResource().setResourceProcessorPID(TEST_FAILING_BUNDLE_RP1).setUrl(getTestResource("test-config1.xml")));

        final AtomicReference<Event> completionEventRef = new AtomicReference<Event>();
        final AtomicReference<Event> uninstallEventRef = new AtomicReference<Event>();
        final CountDownLatch cdl = new CountDownLatch(2);

View Full Code Here

     */
    @Test
    public void testInstallBundleWithExceptionThrowingInCommitCauseNoRollbackOk() throws Exception {
        System.setProperty("rp1", "commit");

        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createResourceProcessorResource().setUrl(getTestBundle("rp1")))
            .add(dpBuilder.createResource().setResourceProcessorPID(TEST_FAILING_BUNDLE_RP1).setUrl(getTestResource("test-config1.xml")))
            .add(dpBuilder.createBundleResource().setUrl(getTestBundle("bundle3")));

        DeploymentPackage dp = installDeploymentPackage(dpBuilder);
        assertNotNull("No deployment package returned?!", dp);

        awaitRefreshPackagesEvent();
View Full Code Here

     */
    @Test
    public void testInstallBundleWithExceptionThrowingInPrepareCausesRollbackOk() throws Exception {
        System.setProperty("rp1", "prepare");

        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createResourceProcessorResource().setUrl(getTestBundle("rp1")))
            .add(dpBuilder.createResource().setResourceProcessorPID(TEST_FAILING_BUNDLE_RP1).setUrl(getTestResource("test-config1.xml")));

        try {
            installDeploymentPackage(dpBuilder);
            fail("Succeeded into installing a failing deployment package?!");
        }
View Full Code Here

TOP

Related Classes of org.apache.felix.deploymentadmin.itest.util.DeploymentPackageBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.