Package org.apache.tuscany.sca.deployment

Examples of org.apache.tuscany.sca.deployment.Deployer


    @Test
    public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
        monitor.analyzeProblems();
       
        node.installContribution(contribution, null, true);
        List<String> ics = node.getInstalledContributionURIs();
        Assert.assertEquals(1, ics.size());
View Full Code Here


        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);

        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor);
        monitor.analyzeProblems();
        composite.setURI("helloworld2.composite");
        node.start("foo", composite);
        List<String> dcs = node.getStartedCompositeURIs("foo");
        Assert.assertEquals(1, dcs.size());
View Full Code Here

*/
public class ContributionTestCase {

    @Test
    public void testRead() throws Exception {
        Deployer deployer = new DefaultDeployer();
        File file = new File("../../../samples/learning-more/binding-sca/calculator-contribution/target/sample-binding-sca-calculator-contribution.jar");
        URL url = file.toURI().toURL();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(url.toURI(), url, monitor);
        deployer.build(Arrays.asList(contribution), Arrays.asList(contribution), null, monitor);
       
        // Ferkle around in the contribution verifying it looks as expected
        Assert.assertNotNull(contribution);
        List<Composite> deployables = contribution.getDeployables();
        Assert.assertEquals(2, deployables.size());
View Full Code Here

    @Test
    public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
        NodeFactory nodeFactory = NodeFactory.newInstance();
        Node node = nodeFactory.createNode("myDomain");
       
        Deployer deployer = nodeFactory.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
        monitor.analyzeProblems();
       
        node.installContribution(contribution, null, true);
        List<String> ics = node.getInstalledContributions();
        Assert.assertEquals(1, ics.size());
View Full Code Here

        NodeFactory nodeFactory = NodeFactory.newInstance();
        Node node = nodeFactory.createNode("myDomain");
       
        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);

        Deployer deployer = nodeFactory.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor);
        monitor.analyzeProblems();
        composite.setURI("helloworld2.composite");
        node.addDeploymentComposite("foo", composite);
        List<String> dcs = node.getDeployedComposites("foo");
        Assert.assertEquals(1, dcs.size());
View Full Code Here

*/
public class ContributionTestCase {

    @Test
    public void testRead() throws Exception {
        Deployer deployer = new DefaultDeployer();
        File file = new File("src/test/resources/sample-binding-sca-calculator-contribution.jar");
        URL url = file.toURI().toURL();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(url.toURI(), url, monitor);
        deployer.build(Arrays.asList(contribution), Arrays.asList(contribution), null, monitor);
       
        // Ferkle around in the contribution verifying it looks as expected
        Assert.assertNotNull(contribution);
        List<Composite> deployables = contribution.getDeployables();
        Assert.assertEquals(2, deployables.size());
View Full Code Here

public class SCDLTestCase {

    @Test
    public void testRead() throws ContributionReadException, XMLStreamException {
        ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
        Deployer deployer = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Deployer.class);
       
        URL r = getClass().getResource("/test.composite");
        Composite composite = deployer.loadXMLDocument(r, null);
        Assert.assertNotNull(composite);

        Component JavaComp = composite.getComponent("JavaComponent");
        Assert.assertNotNull(JavaComp);
View Full Code Here

    }
   
    @Test
    public void testBuild() throws Exception {
        ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
        Deployer deployer = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Deployer.class);
        URL r = getClass().getResource("/test.composite");
        r = new URL(r, "../");
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("c1"), r, monitor);
        deployer.build(Arrays.asList(contribution), Arrays.asList(contribution), null, monitor);
        int i = 0;
        for (Problem p : monitor.getProblems()) {
            System.err.println(i + ": " + p);
            i++;
        }
View Full Code Here

import org.apache.tuscany.sca.monitor.ValidationException;

public class DependencyUtils {

    public static List<String> getDependencies(String contributionURI, Map<String, ZipInputStream> possibles) throws ValidationException, IOException, ContributionReadException, XMLStreamException {
        Deployer deployer = TuscanyRuntime.newInstance().getDeployer();

        Map<String, ContributionMetadata> contributionMetaDatas = new HashMap<String, ContributionMetadata>();
        for (String curi : possibles.keySet()) {
            ZipInputStream zis = possibles.get(curi);
            ZipEntry entry;
            while ((entry = zis.getNextEntry()) != null) {
                if (Contribution.SCA_CONTRIBUTION_META.equals(entry.getName())) {

                    byte[] buffer = new byte[2048];
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    BufferedOutputStream bos = new BufferedOutputStream(baos, buffer.length);

                    int size;
                    while ((size = zis.read(buffer, 0, buffer.length)) != -1) {
                        bos.write(buffer, 0, size);
                    }
                    bos.close();
                   
                    contributionMetaDatas.put(curi, (ContributionMetadata)deployer.loadXMLDocument(new StringReader(baos.toString())));                   
                }
           }
           zis.close(); // close it so no one tries to reuse the already read stream
        }
        Monitor monitor = deployer.createMonitor();
        try {
            return deployer.getDependencies(contributionMetaDatas, contributionURI, monitor);
        } finally {
            monitor.analyzeProblems();
        }
    }
View Full Code Here

    @Test
    public void testInstalledContribution() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
        Node node = tuscanyRuntime.createNode("myDomain");
       
        Deployer deployer = tuscanyRuntime.getDeployer();
        Monitor monitor = deployer.createMonitor();
        Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
        monitor.analyzeProblems();
       
        node.installContribution(contribution, null);
        List<String> ics = node.getInstalledContributionURIs();
        Assert.assertEquals(1, ics.size());
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.deployment.Deployer

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.