Examples of TinyBundle


Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            } catch (MalformedURLException e) {
                // Ignore it.
            }
        }

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(CheckService.class);
        bundle.add(HelloService.class);
        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "services")
                .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.compatibility.service")
                .build(withBnd());

        try {
View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            } catch (MalformedURLException e) {
                // Ignore it.
            }
        }

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(HelloServiceProvider.class);
        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "iPOJO-Hello-Provider")
                //.set(Constants.IMPORT_PACKAGE, "*")
                .build(IPOJOStrategy.withiPOJO());

        try {
View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            } catch (MalformedURLException e) {
                // Ignore it.
            }
        }

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(HelloServiceConsumer.class);
        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "iPOJO-Hello-Consumer")
                //.set(Constants.IMPORT_PACKAGE, "*")
                .build(IPOJOStrategy.withiPOJO());

        try {
View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            }
        }

        File metadata = new File("src/main/resources/scr", "HelloProvider.xml");

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceProvider.class);
        try {
            bundle.add("scr/provider.xml", new FileInputStream(metadata));
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath());
        }

        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "hello-provider-scr")
                //.set(Constants.IMPORT_PACKAGE, "*")
                .set("Service-Component", "scr/provider.xml")
                .build(withBnd());

View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            }
        }

        File metadata = new File("src/main/resources/scr", "HelloConsumer.xml");

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceConsumer.class);
        try {
            bundle.add("scr/consumer.xml", new FileInputStream(metadata));
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath());
        }

        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "hello-consumer-scr")
               // .set(Constants.IMPORT_PACKAGE, "*")
                .set("Service-Component", "scr/consumer.xml")
                .build(withBnd());

View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            }
        }

        File metadata = new File("src/main/resources/blueprint", "HelloProvider.xml");

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceProvider.class);
        try {
            bundle.add("blueprint/provider.xml", new FileInputStream(metadata));
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath());
        }

        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "hello-provider-blueprint")
               // .set(Constants.IMPORT_PACKAGE, "*")
                .set("Bundle-Blueprint", "blueprint/provider.xml")
                .build(withBnd());

View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            }
        }

        File metadata = new File("src/main/resources/blueprint", "HelloConsumer.xml");

        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceConsumer.class);
        try {
            bundle.add("blueprint/consumer.xml", new FileInputStream(metadata));
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath());
        }

        InputStream inputStream = bundle
                .set(Constants.BUNDLE_SYMBOLICNAME, "hello-consumer-blueprint")
               // .set(Constants.IMPORT_PACKAGE, "*")
                .set("Bundle-Blueprint", "blueprint/consumer.xml")
                .build(withBnd());

View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

    }

    public Option testedBundle() throws MalformedURLException {
        File out = new File("target/tested/bundle.jar");

        TinyBundle tested = TinyBundles.bundle();

        // We look inside target/classes to find the class and resources
        File classes = new File("target/classes");
        Collection<File> files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
        List<File> services = new ArrayList<File>();
        for (File file : files) {
            if (file.isDirectory()) {
                // By convention we export of .services and .service package
                if (file.getName().endsWith("services"|| file.getName().endsWith("service")) {
                    services.add(file);
                }
            } else {
                // We need to compute the path
                String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
                tested.add(path, file.toURI().toURL());
                System.out.println(file.getName() + " added to " + path);
            }
        }

        String export = "";
        for (File file : services) {
            if (export.length() > 0) { export += ", "; }
            String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1);
            String packageName = path.replace('/', '.');
            export += packageName;
        }

        System.out.println("Exported packages : " + export);

        InputStream inputStream = tested
                .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle")
                //.set(Constants.IMPORT_PACKAGE, "*")
                .set(Constants.EXPORT_PACKAGE, export)
                .build(IPOJOStrategy.withiPOJO(new File("src/main/resources")));

View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            return;
        }
        String delegationHeader =
            String.format("%s-%s", org.openengsb.labs.delegation.service.Constants.PROVIDED_CLASSES_HEADER,
                org.openengsb.core.api.Constants.DELEGATION_CONTEXT_MODELS);
        TinyBundle providerTinyBundle = bundle()
            .add(TestModel.class)
            .add(SubModel.class)
            .add(PrimitivePropertyModel.class)
            .add(TestModelProvider.class)
            .set(Constants.BUNDLE_ACTIVATOR, TestModelProvider.class.getName())
            .set(Constants.BUNDLE_SYMBOLICNAME, "test.model.provider")
            .set(Constants.BUNDLE_VERSION, providerVersion)
            .set(Constants.EXPORT_PACKAGE, "org.openengsb.itests.exam.models")
            .set(Constants.IMPORT_PACKAGE,
                "org.openengsb.core.api.model, org.osgi.framework, org.slf4j, "
                        + "org.openengsb.labs.delegation.service")
            .set(delegationHeader, "org.openengsb.itests.exam.models.*")
            .set(org.openengsb.core.api.Constants.PROVIDE_MODELS_HEADER, "true");
        Bundle providerBundle = getBundleContext().installBundle("test://testlocation/test.provider.jar",
            providerTinyBundle.build());
        providerBundle.start();
        providerInstalled = true;
    }
View Full Code Here

Examples of org.ops4j.pax.tinybundles.core.TinyBundle

            streamBundle(createFragmentBundle()).noStart(), junitBundles(), cleanCaches());
    }

    private InputStream createFragmentBundle() {
        try {
            TinyBundle bundle = TinyBundles.bundle(StoreFactory.anonymousStore())
                .set(Constants.FRAGMENT_HOST, "org.ops4j.pax.exam.sample9.pde")
                .set(Constants.BUNDLE_MANIFESTVERSION, "2")
                .set(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment")
                .add("messages.properties", getClass().getResource("/messages.properties"));
            return bundle.build();
        }
        catch (IOException e) {
            throw new TestContainerException(e);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.