Package org.apache.ace.deployment.provider

Examples of org.apache.ace.deployment.provider.ArtifactData


    public void testAddedBundleMultipleVersions() throws Exception {
        Collection<ArtifactData> bundleData = m_backend.getBundleData(MULTIPLEVERSIONTARGET, VERSION3, VERSION1);
        assert bundleData.size() == 2 : "Expected two bundle to be found, but found " + bundleData.size();
        Iterator<ArtifactData> it = bundleData.iterator();
        while (it.hasNext()) {
            ArtifactData data = it.next();
            if (data.getSymbolicName().equals("Bundle4")) {
                assert !data.hasChanged() : "The data (Bundle4) should not have been changed.";
            }
            else {
                assert data.hasChanged() : "The data (Bundle3) should have been changed.";
            }
        }
    }
View Full Code Here


    public void testSingleChangedBundleMultipleVersions() throws Exception {
        Collection<ArtifactData> bundleData = m_backend.getBundleData(MULTIPLEVERSIONTARGET, VERSION1, VERSION4);
        assert bundleData.size() == 2 : "Expected two bundles to be found, but found " + bundleData.size();
        Iterator<ArtifactData> it = bundleData.iterator();
        while (it.hasNext()) {
            ArtifactData data = it.next();
            if (data.equals(BUNDLE3_2)) {
                assert !data.hasChanged() : "The data should not have been changed.";
            }
            else if (data.equals(BUNDLE4_2)) {
                assert data.hasChanged() : "The data should have been changed.";
            }
            else {
                assert false : "Unknown bundle found";
            }
        }
View Full Code Here

    public void testMultipleChangedBundlesMultipleVersions() throws Exception {
        Collection<ArtifactData> bundleData = m_backend.getBundleData(MULTIPLEVERSIONTARGET, VERSION1, VERSION2);
        assert bundleData.size() == 2 : "Expected two bundles to be found, but found " + bundleData.size();
        Iterator<ArtifactData> it = bundleData.iterator();
        while (it.hasNext()) {
            ArtifactData data = it.next();
            if (data.equals(BUNDLE4_1)) {
                assert data.hasChanged() : "The data should have been changed.";
            }
            else if (data.equals(BUNDLE5)) {
                assert data.hasChanged() : "The data should have been changed.";
            }
            else {
                assert false : "Unknown bundle found";
            }
        }
View Full Code Here

        Collection<ArtifactData> bundleData = m_backend.getBundleData(RESOURCETARGET, versions.get(0));

        assert bundleData.size() == 4 : "Expected four bundle to be found, but found " + bundleData.size();
        Iterator<ArtifactData> it = bundleData.iterator();
        while (it.hasNext()) {
            ArtifactData data = it.next();
            if (data.equals(BUNDLE1)) {
                // fine
            }
            else if (data.equals(RESOURCEPROCESSOR1)) {
                // fine
            }
            else if (data.equals(ARTIFACT1)) {
                // fine
            }
            else if (data.equals(ARTIFACT2)) {
                // check the filename
                assert data.getFilename().equals("Artifact2");
                assert data.getProcessorPid().equals("my.processor.pid");
            }
            else {
                assert false : "Unknown bundle found";
            }
        }
View Full Code Here

                Iterator<ArtifactData> it = dataVersionTo.iterator();
                while (it.hasNext()) {
                    ArtifactDataImpl bundleDataVersionTo = (ArtifactDataImpl) it.next();
                    // see if there was previously a version of this bundle, and update the 'changed' property accordingly.
                    if (bundleDataVersionTo.isBundle()) {
                        ArtifactData bundleDataVersionFrom = getArtifactData(bundleDataVersionTo.getSymbolicName(), dataVersionFrom);
                        bundleDataVersionTo.setChanged(!bundleDataVersionTo.equals(bundleDataVersionFrom));
                    }
                    else {
                        ArtifactData bundleDataVersionFrom = getArtifactData(bundleDataVersionTo.getUrl(), dataVersionFrom);
                        bundleDataVersionTo.setChanged(bundleDataVersionFrom == null);
                    }
                }
            }
            else {
View Full Code Here

     * @param url The url to be found.
     * @return The <code>ArtifactData</code> object that has this <code>url</code>, or <code>null</code> if none can be
     *         found.
     */
    private ArtifactData getArtifactData(URL url, Collection<ArtifactData> data) {
        ArtifactData bundle = null;
        URI uri = null;
        try {
            uri = url.toURI();
        }
        catch (URISyntaxException e) {
            m_log.log(LogService.LOG_ERROR, "Could not convert URL " + url + " to a URI");
            return null;
        }
        Iterator<ArtifactData> it = data.iterator();
        while (it.hasNext()) {
            bundle = it.next();
            try {
                if (uri.equals(bundle.getUrl().toURI())) {
                    return bundle;
                }
            }
            catch (URISyntaxException e) {
                m_log.log(LogService.LOG_ERROR, "Could not convert bundle URL for " + bundle.getFilename() + " to a URI");
            }
        }
        return null;
    }
View Full Code Here

     * @param symbolicName The symbolic name to be found.
     * @return The <code>ArtifactData</code> object that has this <code>symbolicName</code>, or <code>null</code> if none
     *         can be found.
     */
    private ArtifactData getArtifactData(String symbolicName, Collection<ArtifactData> data) {
        ArtifactData bundle = null;
        Iterator<ArtifactData> it = data.iterator();
        while (it.hasNext()) {
            bundle = it.next();
            String bsn = bundle.getSymbolicName();
            if ((bsn != null) && bsn.equals(symbolicName)) {
                return bundle;
            }
        }
        return null;
View Full Code Here

    @BeforeMethod(alwaysRun = true)
    protected void setUp() throws Exception {
        final Map<String, List<String>> providerVersions = new HashMap<String, List<String>>();
        providerVersions.put("existing", Arrays.asList("2.0.0"));

        final ArtifactData artifactData = createMock(ArtifactData.class);
        expect(artifactData.getSize()).andAnswer(new IAnswer<Long>() {
            @Override
            public Long answer() throws Throwable {
                return DeploymentServletTest.this.m_artifactSize;
            }
        }).anyTimes();
View Full Code Here

            m_fixPack = fixPack;
            next();
        }

        private void next() throws IOException {
            ArtifactData current = (m_iter.hasNext()) ? m_iter.next() : null;

            if (current == null) {
                m_output.close();
            }
            else if (!m_fixPack || current.hasChanged()) {
                m_current = openStream(current);
                m_output.putNextEntry(new ZipEntry(current.getFilename()));
            }
            else {
                next();
            }
        }
View Full Code Here

        // configure file based backend
        configure("org.apache.ace.deployment.provider.filebased", "BaseDirectoryName", m_tempDir.getAbsolutePath());
    }

    private ArtifactData generateBundle(File file, String symbolicName, String version) throws Exception {
        ArtifactData bundle = new ArtifactDataImpl(file.getName(), symbolicName, file.length(), version, file.toURI().toURL(), false);
        BundleStreamGenerator.generateBundle(bundle);
        return bundle;
    }
View Full Code Here

TOP

Related Classes of org.apache.ace.deployment.provider.ArtifactData

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.