Package org.apache.ivy.plugins.repository

Examples of org.apache.ivy.plugins.repository.BasicResource


        XmlModuleDescriptorUpdater.update(settingsUrl, new BufferedOutputStream(buffer, 1024),
            getUpdateOptions("release", "mynewrev"));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] dependencies = updatedMd.getDependencies();
        assertNotNull(dependencies);
        assertEquals(3, dependencies.length);
View Full Code Here


        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Configuration[] configs = updatedMd.getConfigurations();
        assertNotNull("Configurations shouldn't be null", configs);
View Full Code Here

            getUpdateOptions("release", "mynewrev").setConfsToExclude(
                new String[] {"myconf2", "conf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Configuration[] configs = updatedMd.getConfigurations();
        assertNotNull("Configurations shouldn't be null", configs);
View Full Code Here

        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        // test the number of configurations
        Artifact[] artifacts = updatedMd.getAllArtifacts();
        assertNotNull("Published artifacts shouldn't be null", artifacts);
View Full Code Here

        XmlModuleDescriptorUpdater.update(settingsUrl, buffer,
            getUpdateOptions("release", "mynewrev").setConfsToExclude(new String[] {"myconf2"}));

        XmlModuleDescriptorParser parser = XmlModuleDescriptorParser.getInstance();
        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] deps = updatedMd.getDependencies();
        assertNotNull("Dependencies shouldn't be null", deps);
        assertEquals("Number of dependencies is incorrect", 8, deps.length);
View Full Code Here

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        XmlModuleDescriptorUpdater.update(url, buffer, getUpdateOptions("release", "mynewrev")
                .setMerge(true).setMergedDescriptor(md));

        ModuleDescriptor updatedMd = parser.parseDescriptor(new IvySettings(),
            new ByteArrayInputStream(buffer.toByteArray()), new BasicResource("test", false, 0, 0,
                    false), true);

        DependencyDescriptor[] deps = updatedMd.getDependencies();
        assertNotNull("Dependencies shouldn't be null", deps);
        assertEquals("Number of dependencies is incorrect", 2, deps.length);
View Full Code Here

     * @param responseLine
     * @return
     */
    protected Resource lslToResource(String file, String responseLine) {
        if (responseLine == null || responseLine.startsWith("ls")) {
            return new BasicResource(file, false, 0, 0, false);
        } else {
            String[] parts = responseLine.split("\\s+");
            if (parts.length != LS_PARTS_NUMBER) {
                Message.debug("unrecognized ls format: " + responseLine);
                return new BasicResource(file, false, 0, 0, false);
            } else {
                try {
                    long contentLength = Long.parseLong(parts[LS_SIZE_INDEX]);
                    String date = parts[LS_DATE_INDEX1] + " " + parts[LS_DATE_INDEX2] + " "
                            + parts[LS_DATE_INDEX3] + " " + parts[LS_DATE_INDEX4];
                    return new BasicResource(file, true, contentLength, FORMAT.parse(date)
                            .getTime(), false);
                } catch (Exception ex) {
                    Message.warn("impossible to parse server response: " + responseLine, ex);
                    return new BasicResource(file, false, 0, 0, false);
                }
            }
        }
    }
View Full Code Here

                for (Iterator iter = r.iterator(); iter.hasNext();) {
                    Object obj = iter.next();
                    if (obj instanceof LsEntry) {
                        LsEntry entry = (LsEntry) obj;
                        SftpATTRS attrs = entry.getAttrs();
                        return new BasicResource(path, true, attrs.getSize(), attrs.getMTime()
                                * MILLIS_PER_SECOND, false);
                    }
                }
            }
        } catch (Exception e) {
            Message.debug("Error while resolving resource " + path, e);
            // silent fail, return unexisting resource
        }

        return new BasicResource(path, false, 0, 0, false);
    }
View Full Code Here

            } catch (Exception e) {
                logFailed(repository, e);
            }
        }
        // resource that basically doesn't exists
        return new BasicResource(source, false, 0, 0, true);
    }
View Full Code Here

     * @param responseLine
     * @return
     */
    protected Resource lslToResource(String file, String responseLine) {
        if (responseLine == null || responseLine.startsWith("ls")) {
            return new BasicResource(file, false, 0, 0, false);
        } else {
            String[] parts = responseLine.split("\\s+");
            if (parts.length != 9) {
                Message.debug("unrecognized ls format: " + responseLine);
                return new BasicResource(file, false, 0, 0, false);
            } else {
                try {
                    long contentLength = Long.parseLong(parts[3]);
                    String date = parts[4] + " " + parts[5] + " " + parts[6] + " " + parts[7];
                    return new BasicResource(file, true, contentLength, FORMAT.parse(date)
                            .getTime(), false);
                } catch (Exception ex) {
                    Message
                            .warn("impossible to parse server response: " + responseLine + ": "
                                    + ex);
                    return new BasicResource(file, false, 0, 0, false);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.plugins.repository.BasicResource

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.