Package org.jfrog.build.api

Examples of org.jfrog.build.api.Dependency


                    project.log(
                            "[buildinfo:collect] Artifact Download Report for configuration: " + configuration + " : " + artifactsReport,
                            Project.MSG_DEBUG);
                    ModuleRevisionId id = artifactsReport.getArtifact().getModuleRevisionId();
                    String type = getType(artifactsReport.getArtifact());
                    Dependency dependency = findDependencyInList(id, type, moduleDependencies);
                    if (dependency == null) {
                        DependencyBuilder dependencyBuilder = new DependencyBuilder();
                        dependencyBuilder.type(type).scopes(Lists.newArrayList(configuration));
                        String idString = getModuleIdString(id.getOrganisation(),
                                id.getName(), id.getRevision());
                        dependencyBuilder.id(idString);
                        File file = artifactsReport.getLocalFile();
                        Map<String, String> checksums;
                        try {
                            checksums = FileChecksumCalculator.calculateChecksums(file, MD5, SHA1);
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                        String md5 = checksums.get(MD5);
                        String sha1 = checksums.get(SHA1);
                        dependencyBuilder.md5(md5).sha1(sha1);
                        dependency = dependencyBuilder.build();
                        moduleDependencies.add(dependency);
                        project.log(
                                "[buildinfo:collect] Added dependency '" + dependency.getId() + "'", Project.MSG_DEBUG);
                    } else {
                        if (!dependency.getScopes().contains(configuration)) {
                            dependency.getScopes().add(configuration);
                            project.log(
                                    "[buildinfo:collect] Added scope " + configuration +
                                            " to dependency '" + dependency.getId() + "'", Project.MSG_DEBUG);
                        } else {
                            project.log(
                                    "[buildinfo:collect] Find same dependency twice in configuration '" + configuration +
                                            "' for dependency '" + artifactsReport + "'", Project.MSG_WARN);
                        }
View Full Code Here


     * Assembles the dependency class
     *
     * @return Assembled dependency
     */
    public Dependency build() {
        Dependency dependency = new Dependency();
        dependency.setId(id);
        dependency.setType(type);
        dependency.setScopes(scopes);
        dependency.setSha1(sha1);
        dependency.setMd5(md5);
        dependency.setRequiredBy(requiredBy);
        dependency.setProperties(properties);
        return dependency;
    }
View Full Code Here

    /**
     * Validates the dependency values when using the defaults
     */
    public void testDefaultBuild() {
        Dependency dependency = new DependencyBuilder().build();

        assertNull(dependency.getId(), "Unexpected default dependency ID.");
        assertNull(dependency.getType(), "Unexpected default dependency type.");
        assertNull(dependency.getScopes(), "Default dependency scopes should not have been initialized.");
        assertNull(dependency.getSha1(), "Default dependency SHA1 checksum should be null.");
        assertNull(dependency.getMd5(), "Default dependency MD5 checksum should be null.");
        assertNull(dependency.getRequiredBy(), "Default dependency required by should not have been initialized.");
        assertNull(dependency.getProperties(), "Default dependency properties should be null.");
    }
View Full Code Here

        String sha1 = "pop";
        String md5 = "shmop";
        List<String> requiredBy = Lists.newArrayList("pitzi");
        Properties properties = new Properties();

        Dependency dependency = new DependencyBuilder().id(id).type(type).scopes(scopes).sha1(sha1).md5(md5).
                requiredBy(requiredBy).properties(properties).build();

        assertEquals(dependency.getId(), id, "Unexpected dependency ID.");
        assertEquals(dependency.getType(), type, "Unexpected dependency type.");
        assertEquals(dependency.getScopes(), scopes, "Unexpected dependency scopes.");
        assertEquals(dependency.getSha1(), sha1, "Unexpected dependency SHA1 checksum.");
        assertEquals(dependency.getMd5(), md5, "Unexpected dependency SHA1 checksum.");
        assertEquals(dependency.getRequiredBy(), requiredBy, "Unexpected dependency required by.");
        assertEquals(dependency.getProperties(), properties, "Unexpected dependency properties.");
        assertTrue(dependency.getProperties().isEmpty(), "Dependency properties list should not have been populated.");
    }
View Full Code Here

    public void testBuilderAddMethods() {
        String requiredBy = "requiredMoo";
        String propertyKey = "key";
        String propertyValue = "value";

        Dependency dependency = new DependencyBuilder().addRequiredBy(requiredBy).
                addProperty(propertyKey, propertyValue).build();
        List<String> requiredByList = dependency.getRequiredBy();
        assertFalse(requiredByList.isEmpty(), "A dependency requirement should have been added.");
        assertEquals(requiredByList.get(0), requiredBy, "Unexpected dependency requirement.");
        assertTrue(dependency.getProperties().containsKey(propertyKey),
                "A dependency property should have been added.");
        assertEquals(dependency.getProperties().get(propertyKey), propertyValue,
                "Unexpected dependency property value.");
    }
View Full Code Here

    /**
     * Validates the module values after using the builder add methods
     */
    public void testBuilderAddMethods() {
        Artifact artifact = new Artifact();
        Dependency dependency = new Dependency();
        String propertyKey = "key";
        String propertyValue = "value";

        Module module = new ModuleBuilder().id("test").addArtifact(artifact).addDependency(dependency).
                addProperty(propertyKey, propertyValue).build();
View Full Code Here

    public List<Dependency> downloadDependencies(Set<DownloadableArtifact> downloadableArtifacts) throws IOException {
        List<Dependency> dependencies = Lists.newArrayList();
        Set<DownloadableArtifact> downloadedArtifacts = Sets.newHashSet();
        for (DownloadableArtifact downloadableArtifact : downloadableArtifacts) {
            Dependency dependency = downloadArtifact(downloadableArtifact);
            if (dependency != null) {
                dependencies.add(dependency);
                downloadedArtifacts.add(downloadableArtifact);
            }
        }
View Full Code Here

        downloader.removeUnusedArtifactsFromLocal(allResolvesFiles, forDeletionFiles);
    }


    private Dependency downloadArtifact(DownloadableArtifact downloadableArtifact) throws IOException {
        Dependency dependencyResult = null;
        String filePath = downloadableArtifact.getFilePath();
        String matrixParams = downloadableArtifact.getMatrixParameters();
        final String uri = downloadableArtifact.getRepoUrl() + '/' + filePath;
        final String uriWithParams = (StringUtils.isBlank(matrixParams) ? uri : uri + ';' + matrixParams);
        String fileDestination = downloader.getTargetDir(downloadableArtifact.getTargetDirPath(),
View Full Code Here

     *
     * @param uriWithParams The uri for the artifact to perform HEAD request to
     * @param filePath      The locally file path
     */
    private Dependency getDependencyLocally(String uriWithParams, String filePath) throws IOException {
        Dependency dependencyResult = null;
        HttpResponse artifactChecksums = downloader.getClient().getArtifactChecksums(uriWithParams);
        String md5 = getMD5ChecksumFromResponse(artifactChecksums);
        String sha1 = getSHA1ChecksumFromResponse(artifactChecksums);

        if (downloader.isFileExistsLocally(filePath, md5, sha1)) {
View Full Code Here

TOP

Related Classes of org.jfrog.build.api.Dependency

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.