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

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


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

        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


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

        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")));

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

        awaitRefreshPackagesEvent();
View Full Code Here

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

        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")));

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

    /**
     * Tests that if a resource is installed which mentions a RP that does not belong to the same package, a rollback takes place.
     */
    @Test
    public void testInstallResourceWithForeignCustomizerFail() throws Exception {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .add(dpBuilder.createResourceProcessorResource().setUrl(getTestBundle("rp1")));

        installDeploymentPackage(dpBuilder);

        awaitRefreshPackagesEvent();
       
        assertEquals("Expected no deployment package?!", 1, countDeploymentPackages());
        assertBundleExists(getSymbolicName("rp1"), "1.0.0");

        dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .disableVerification()
            .add(dpBuilder.createResource().setResourceProcessorPID(TEST_FAILING_BUNDLE_RP1).setUrl(getTestResource("test-config1.xml")));

        try {
            installDeploymentPackage(dpBuilder);
            fail("Succeeded into installing a resource with an non-existing RP?!");
        }
View Full Code Here

    /**
     * Tests that if a resource is installed which mentions a RP that does not exist a rollback takes place.
     */
    @Test
    public void testInstallResourceWithNonAvailableCustomizerFail() throws Exception {
        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
        dpBuilder
            .disableVerification()
            .add(dpBuilder.createResource().setResourceProcessorPID("my.unknown.rp").setUrl(getTestResource("test-config1.xml")));

        try {
            installDeploymentPackage(dpBuilder);
            fail("Succeeded into installing a resource with an non-existing RP?!");
        }
View Full Code Here

    /**
     * Tests that we can build a deployment package with a bundle resource.
     */
    @Test
    public void testCreateMissingBundleResourceOk() throws Exception {
        DeploymentPackageBuilder dpBuilder = DeploymentPackageBuilder.create("dp-test", "1.0.0");
        dpBuilder
            .setFixPackage()
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle1")).setMissing()
            );

        JarInputStream jis = new JarInputStream(dpBuilder.generate());
        assertNotNull(jis);

        Manifest manifest = jis.getManifest();
        assertManifestHeader(manifest, "DeploymentPackage-SymbolicName", "dp-test");
        assertManifestHeader(manifest, "DeploymentPackage-Version", "1.0.0");
View Full Code Here

    /**
     * Tests that we can build a deployment package with a bundle resource.
     */
    @Test
    public void testCreateMinimalSingleBundleResourceOk() throws Exception {
        DeploymentPackageBuilder dpBuilder = DeploymentPackageBuilder.create("dp-test", "1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle1"))
            );

        JarInputStream jis = new JarInputStream(dpBuilder.generate());
        assertNotNull(jis);

        Manifest manifest = jis.getManifest();
        assertManifestHeader(manifest, "DeploymentPackage-SymbolicName", "dp-test");
        assertManifestHeader(manifest, "DeploymentPackage-Version", "1.0.0");
View Full Code Here

    /**
     * Tests that we can filter a resource.
     */
    @Test
    public void testResourceFilterOk() throws Exception {
        DeploymentPackageBuilder dpBuilder = DeploymentPackageBuilder.create("dp-test", "1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle2")))
            .add(dpBuilder.createBundleResource()
                .setVersion("1.1.0")
                .setFilter(new JarManifestManipulatingFilter("Bundle-Version", "1.1.0", "Foo", "bar"))
                .setUrl(getTestBundle("bundle1")));

        JarInputStream jis = new JarInputStream(dpBuilder.generate());
        assertNotNull(jis);

        Manifest manifest = jis.getManifest();
        assertManifestHeader(manifest, "DeploymentPackage-SymbolicName", "dp-test");
        assertManifestHeader(manifest, "DeploymentPackage-Version", "1.0.0");
View Full Code Here

    /**
     * Tests that we can build a deployment package with a "plain" resource and resource processor.
     */
    @Test
    public void testCreateMinimalSingleResourceAndProcessorOk() throws Exception {
        DeploymentPackageBuilder dpBuilder = DeploymentPackageBuilder.create("dp-test", "1.0.0");
        dpBuilder
            .add(dpBuilder.createResourceProcessorResource()
                .setUrl(getTestBundle("rp1")))
            .add(dpBuilder.createResource()
                .setResourceProcessorPID("org.apache.felix.deploymentadmin.test.rp1")
                .setUrl(getTestResource("test-config1.xml"))
            );

        JarInputStream jis = new JarInputStream(dpBuilder.generate());
        assertNotNull(jis);

        Manifest manifest = jis.getManifest();
        assertManifestHeader(manifest, "DeploymentPackage-SymbolicName", "dp-test");
        assertManifestHeader(manifest, "DeploymentPackage-Version", "1.0.0");
View Full Code Here

    /**
     * Tests that we can build a deployment package with two bundle resources.
     */
    @Test
    public void testCreateMinimalTwoBundleResourcesOk() throws Exception {
        DeploymentPackageBuilder dpBuilder = DeploymentPackageBuilder.create("dp-test", "1.0.0");
        dpBuilder
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle1"))
            )
            .add(dpBuilder.createBundleResource()
                .setUrl(getTestBundle("bundle2"))
            );

        JarInputStream jis = new JarInputStream(dpBuilder.generate());
        assertNotNull(jis);

        Manifest manifest = jis.getManifest();
        assertManifestHeader(manifest, "DeploymentPackage-SymbolicName", "dp-test");
        assertManifestHeader(manifest, "DeploymentPackage-Version", "1.0.0");
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.