org.gradle.api.artifacts.ResolvedArtifact Java Examples

The following examples show how to use org.gradle.api.artifacts.ResolvedArtifact. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjectorExtension.java    From Injector with Apache License 2.0 6 votes vote down vote up
public Map<String, List<ResolvedArtifact>> getDexes(List<? extends ResolvedArtifact> artifacts) {
	Map<String, List<ResolvedArtifact>> dexMap = new HashMap<>();
	artifacts.forEach(resolvedArtifact -> {
		List<String> names = getDexName(resolvedArtifact);
		names.forEach(name -> {
			if (dexMap.containsKey(name)) {
				dexMap.get(name).add(resolvedArtifact);
			} else {
				List<ResolvedArtifact> list = new ArrayList<>();
				list.add(resolvedArtifact);
				dexMap.put(name, list);
			}
		});
	});
	return dexMap;
}
 
Example #2
Source File: MavenHelper.java    From cyclonedx-gradle-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Extracts a pom from an artifacts jar file and creates a MavenProject from it.
 * @param artifact the artifact to extract the pom from
 * @return a Maven project
 */
MavenProject extractPom(ResolvedArtifact artifact) {
    if (!isDescribedArtifact(artifact)) {
        return null;
    }
    if (artifact.getFile() != null) {
        try {
            final JarFile jarFile = new JarFile(artifact.getFile());
            final ModuleVersionIdentifier mid = artifact.getModuleVersion().getId();
            final JarEntry entry = jarFile.getJarEntry("META-INF/maven/"+ mid.getGroup() + "/" + mid.getName() + "/pom.xml");
            if (entry != null) {
                try (final InputStream input = jarFile.getInputStream(entry)) {
                    return readPom(input);
                }
            }
        } catch (IOException e) {
            logger.error("An error occurred attempting to extract POM from artifact", e);
        }
    }
    return null;
}
 
Example #3
Source File: AtlasDepHelper.java    From atlas with Apache License 2.0 6 votes vote down vote up
@NonNull
public static String computeArtifactPath(@NonNull ModuleVersionIdentifier moduleVersion,
                                         @NonNull ResolvedArtifact artifact) {
    StringBuilder pathBuilder = new StringBuilder();

    pathBuilder.append(normalize(moduleVersion, moduleVersion.getGroup()))
        .append("/")
        .append(normalize(moduleVersion, moduleVersion.getName()))
        .append("/")
        .append(normalize(moduleVersion, moduleVersion.getVersion()));

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        pathBuilder.append("/")
            .append(normalize(moduleVersion, artifact.getClassifier()));
    }

    return pathBuilder.toString();
}
 
Example #4
Source File: CycloneDxTask.java    From cyclonedx-gradle-plugin with Apache License 2.0 6 votes vote down vote up
private String generatePackageUrl(final ResolvedArtifact artifact) {
    try {
        TreeMap<String, String> qualifiers = null;
        if (artifact.getType() != null || artifact.getClassifier() != null) {
            qualifiers = new TreeMap<>();
            if (artifact.getType() != null) {
                qualifiers.put("type", artifact.getType());
            }
            if (artifact.getClassifier() != null) {
                qualifiers.put("classifier", artifact.getClassifier());
            }
        }
        return new PackageURL(PackageURL.StandardTypes.MAVEN,
                artifact.getModuleVersion().getId().getGroup(),
                artifact.getModuleVersion().getId().getName(),
                artifact.getModuleVersion().getId().getVersion(),
                qualifiers, null).canonicalize();
    } catch (MalformedPackageURLException e) {
        getLogger().warn("An unexpected issue occurred attempting to create a PackageURL for "
                + artifact.getModuleVersion().getId().getGroup() + ":"
                + artifact.getModuleVersion().getId().getName()
                + ":" + artifact.getModuleVersion().getId().getVersion(), e);
    }
    return null;
}
 
Example #5
Source File: DefaultResolvedDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public int compare(ResolvedArtifact artifact1, ResolvedArtifact artifact2) {
    int diff = artifact1.getName().compareTo(artifact2.getName());
    if (diff != 0) {
        return diff;
    }
    diff = ObjectUtils.compare(artifact1.getClassifier(), artifact2.getClassifier());
    if (diff != 0) {
        return diff;
    }
    diff = artifact1.getExtension().compareTo(artifact2.getExtension());
    if (diff != 0) {
        return diff;
    }
    diff = artifact1.getType().compareTo(artifact2.getType());
    if (diff != 0) {
        return diff;
    }
    // Use an arbitrary ordering when the artifacts have the same public attributes
    return artifact1.hashCode() - artifact2.hashCode();
}
 
Example #6
Source File: DependencyManager.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
private String computeArtifactPath(
        @NonNull ModuleVersionIdentifier moduleVersion,
        @NonNull ResolvedArtifact artifact) {
    StringBuilder pathBuilder = new StringBuilder();

    pathBuilder.append(normalize(logger, moduleVersion, moduleVersion.getGroup()))
            .append('/')
            .append(normalize(logger, moduleVersion, moduleVersion.getName()))
            .append('/')
            .append(normalize(logger, moduleVersion,
                    moduleVersion.getVersion()));

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        pathBuilder.append('/').append(normalize(logger, moduleVersion,
                artifact.getClassifier()));
    }

    return pathBuilder.toString();
}
 
Example #7
Source File: DependencyManager.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
private static String computeArtifactName(
        @NonNull ModuleVersionIdentifier moduleVersion,
        @NonNull ResolvedArtifact artifact) {
    StringBuilder nameBuilder = new StringBuilder();

    nameBuilder.append(moduleVersion.getGroup())
            .append(':')
            .append(moduleVersion.getName())
            .append(':')
            .append(moduleVersion.getVersion());

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        nameBuilder.append(':').append(artifact.getClassifier());
    }

    return nameBuilder.toString();
}
 
Example #8
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 6 votes vote down vote up
private Set<ResolvedArtifact> prepareArtifactSet(int start, int count) {
  Set<ResolvedArtifact> artifacts = new HashSet<>();
  String namePrefix = "artifact";
  String groupPrefix = "group";
  String locationPrefix = "location";
  String versionPostfix = ".0";
  for (int i = start; i < start + count; i++) {
    String index = String.valueOf(i);
    artifacts.add(
        prepareArtifact(
            namePrefix + index,
            groupPrefix + index,
            locationPrefix + index,
            index + versionPostfix));
  }
  return artifacts;
}
 
Example #9
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 6 votes vote down vote up
private ResolvedArtifact prepareArtifact(
    String name, String group, String filePath, String version) {
  ModuleVersionIdentifier moduleId = mock(ModuleVersionIdentifier.class);
  when(moduleId.getGroup()).thenReturn(group);
  when(moduleId.getVersion()).thenReturn(version);

  ResolvedModuleVersion moduleVersion = mock(ResolvedModuleVersion.class);
  when(moduleVersion.getId()).thenReturn(moduleId);

  File artifactFile = mock(File.class);
  when(artifactFile.getAbsolutePath()).thenReturn(filePath);

  ResolvedArtifact artifact = mock(ResolvedArtifact.class);
  when(artifact.getName()).thenReturn(name);
  when(artifact.getFile()).thenReturn(artifactFile);
  when(artifact.getModuleVersion()).thenReturn(moduleVersion);

  return artifact;
}
 
Example #10
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetResolvedArtifacts_isPackagedInHierarchy() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.getName()).thenReturn("random");
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  Configuration parent = mock(Configuration.class);
  when(parent.getName()).thenReturn("compile");
  Set<Configuration> hierarchy = new HashSet<>();
  hierarchy.add(parent);
  when(configuration.getHierarchy()).thenReturn(hierarchy);

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSet));
}
 
Example #11
Source File: CreateInjectDexes.java    From Injector with Apache License 2.0 6 votes vote down vote up
@Inject
public CreateInjectDexes(InjectorExtension extension,
                         String projectPackageName,
                         String variantName,
                         String buildDirectory,
                         Set<? extends AndroidArchiveLibrary> androidArchiveLibraries,
                         Set<? extends ResolvedArtifact> jarFiles,
                         int minApiLevel,
                         JavaVersion sourceCompatibilityVersion,
                         JavaVersion targetCompatibilityVersion) {
	this.sourceCompatibilityVersion = sourceCompatibilityVersion;
	this.targetCompatibilityVersion = targetCompatibilityVersion;
	this.minApiLevel = minApiLevel;
	this.variantName = variantName;
	this.projectPackageName = projectPackageName;
	this.buildDirectory = buildDirectory;
	this.androidArchiveLibraries = new HashSet<>(androidArchiveLibraries);
	this.jarFiles = new HashSet<>(jarFiles);
	this.extension = extension;
}
 
Example #12
Source File: GradleDependencyResolutionHelper.java    From thorntail with Apache License 2.0 6 votes vote down vote up
/**
 * Translate the given {@link ResolvedDependency resolved dependency} in to a {@link DependencyDescriptor} reference.
 *
 * @param scope      the scope to assign to the descriptor.
 * @param dependency the resolved dependency reference.
 * @return an instance of {@link DependencyDescriptor}.
 */
private static DependencyDescriptor asDescriptor(String scope, ResolvedDependency dependency) {

    Set<ResolvedArtifact> artifacts = dependency.getModuleArtifacts();

    // Let us use the first artifact's type for determining the type.
    // I am not sure under what circumstances, would we need to check for multiple artifacts.
    String type = "jar";
    String classifier = null;
    File file = null;

    if (!artifacts.isEmpty()) {
        ResolvedArtifact ra = artifacts.iterator().next();
        type = ra.getType();
        classifier = ra.getClassifier();
        file = ra.getFile();
    }
    return new DefaultDependencyDescriptor(scope, dependency.getModuleGroup(), dependency.getModuleName(),
                                           dependency.getModuleVersion(), type, classifier, file);
}
 
Example #13
Source File: DefaultResolvedDependency.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public int compare(ResolvedArtifact artifact1, ResolvedArtifact artifact2) {
    int diff = artifact1.getName().compareTo(artifact2.getName());
    if (diff != 0) {
        return diff;
    }
    diff = ObjectUtils.compare(artifact1.getClassifier(), artifact2.getClassifier());
    if (diff != 0) {
        return diff;
    }
    diff = artifact1.getExtension().compareTo(artifact2.getExtension());
    if (diff != 0) {
        return diff;
    }
    diff = artifact1.getType().compareTo(artifact2.getType());
    if (diff != 0) {
        return diff;
    }
    // Use an arbitrary ordering when the artifacts have the same public attributes
    return artifact1.hashCode() - artifact2.hashCode();
}
 
Example #14
Source File: DefaultResolvedDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Set<ResolvedArtifact> getAllArtifacts(ResolvedDependency parent) {
    if (allArtifactsCache.get(parent) == null) {
        Set<ResolvedArtifact> allArtifacts = new LinkedHashSet<ResolvedArtifact>();
        allArtifacts.addAll(getArtifacts(parent));
        for (ResolvedDependency childResolvedDependency : getChildren()) {
            for (ResolvedDependency childParent : childResolvedDependency.getParents()) {
                allArtifacts.addAll(childResolvedDependency.getAllArtifacts(childParent));
            }
        }
        allArtifactsCache.put(parent, allArtifacts);
    }
    return allArtifactsCache.get(parent);
}
 
Example #15
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_libraryProject_returnsArtifacts() {
  ResolvedDependency libraryResolvedDependency = mock(ResolvedDependency.class);
  when(libraryResolvedDependency.getModuleVersion())
          .thenReturn(DependencyTask.LOCAL_LIBRARY_VERSION);
  ResolvedDependency libraryChildResolvedDependency = mock(ResolvedDependency.class);
  Set<ResolvedArtifact> libraryChildArtifactSet =
          prepareArtifactSet(/* start= */ 0, /* count= */ 2);
  when(libraryChildResolvedDependency.getAllModuleArtifacts())
          .thenReturn(libraryChildArtifactSet);
  when(libraryResolvedDependency.getChildren())
          .thenReturn(Collections.singleton(libraryChildResolvedDependency));

  Set<ResolvedArtifact> appArtifactSet = prepareArtifactSet(/* start= */ 2, /* count= */ 2);
  ResolvedDependency appResolvedDependency = mock(ResolvedDependency.class);
  when(appResolvedDependency.getAllModuleArtifacts()).thenReturn(appArtifactSet);

  Set<ResolvedDependency> resolvedDependencySet = new HashSet<>(
          Arrays.asList(libraryResolvedDependency, appResolvedDependency));
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfigurationFromDependencySet(
          resolvedDependencySet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.getName()).thenReturn("compile");
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  Set<ResolvedArtifact> artifactSuperSet = new HashSet<>();
  artifactSuperSet.addAll(appArtifactSet);
  artifactSuperSet.addAll(libraryChildArtifactSet);
  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSuperSet));
  // Calling getAllModuleArtifacts on a library will cause an exception.
  verify(libraryResolvedDependency, never()).getAllModuleArtifacts();
}
 
Example #16
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testAddArtifacts_willNotAddDuplicate() {
  Set<ResolvedArtifact> artifacts = prepareArtifactSet(2);

  String[] keySets = new String[] {"location1", "location2"};
  dependencyTask.artifactSet = new HashSet<>(Arrays.asList(keySets));
  dependencyTask.addArtifacts(artifacts);

  assertThat(dependencyTask.artifactInfos.size(), is(1));
}
 
Example #17
Source File: DefaultResolvedDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void addParentSpecificArtifacts(ResolvedDependency parent, Set<ResolvedArtifact> artifacts) {
    Set<ResolvedArtifact> parentArtifacts = this.parentArtifacts.get(parent);
    if (parentArtifacts == null) {
        parentArtifacts = new TreeSet<ResolvedArtifact>(new ResolvedArtifactComparator());
        this.parentArtifacts.put(parent, parentArtifacts);
    }
    parentArtifacts.addAll(artifacts);
    moduleArtifacts.addAll(artifacts);
}
 
Example #18
Source File: DependencyManager.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void collectArtifacts(
        Configuration configuration,
        Map<ModuleVersionIdentifier,
                List<ResolvedArtifact>> artifacts) {

    Set<ResolvedArtifact> allArtifacts;
    if (extraModelInfo.getMode() != STANDARD) {
        allArtifacts = configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts(
                Specs.satisfyAll());
    } else {
        allArtifacts = configuration.getResolvedConfiguration().getResolvedArtifacts();
    }

    for (ResolvedArtifact artifact : allArtifacts) {
        ModuleVersionIdentifier id = artifact.getModuleVersion().getId();
        List<ResolvedArtifact> moduleArtifacts = artifacts.get(id);

        if (moduleArtifacts == null) {
            moduleArtifacts = Lists.newArrayList();
            artifacts.put(id, moduleArtifacts);
        }

        if (!moduleArtifacts.contains(artifact)) {
            moduleArtifacts.add(artifact);
        }
    }
}
 
Example #19
Source File: PlayApplicationPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
@Override
public FileCollectionInternal createDelegate() {
    Set<File> files = new HashSet<>();
    for (ResolvedArtifact artifact : configuration.getResolvedConfiguration().getResolvedArtifacts()) {
        if ((artifact.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier) == matchProjectComponents) {
            files.add(artifact.getFile());
        }
    }
    return ImmutableFileCollection.of(Collections.unmodifiableSet(files));
}
 
Example #20
Source File: AppModelGradleResolver.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public static AppArtifact toAppArtifact(ResolvedArtifact a) {
    final String[] split = a.getModuleVersion().toString().split(":");
    final AppArtifact appArtifact = new AppArtifact(split[0], split[1], a.getClassifier(), a.getType(),
            split.length > 2 ? split[2] : null);
    if (a.getFile().exists()) {
        appArtifact.setPath(a.getFile().toPath());
    }
    return appArtifact;
}
 
Example #21
Source File: MavenHelper.java    From cyclonedx-gradle-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Resolves meta for an artifact. This method essentially does what an 'effective pom' would do,
 * but for an artifact instead of a project. This method will attempt to resolve metadata at
 * the lowest level of the inheritance tree and work its way up.
 * @param artifact the artifact to resolve metadata for
 * @param project the associated project for the artifact
 * @param component the component to populate data for
 */
void getClosestMetadata(ResolvedArtifact artifact, MavenProject project, Component component) {
    extractMetadata(project, component);
    if (project.getParent() != null) {
        getClosestMetadata(artifact, project.getParent(), component);
    } else if (project.getModel().getParent() != null) {
        final MavenProject parentProject = retrieveParentProject(artifact, project);
        if (parentProject != null) {
            getClosestMetadata(artifact, parentProject, component);
        }
    }
}
 
Example #22
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_isPackagedCompile() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  when(configuration.getName()).thenReturn("compile");

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSet));
}
 
Example #23
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_isPackagedImplementation() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  when(configuration.getName()).thenReturn("implementation");

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSet));
}
 
Example #24
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_isPackagedApi() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  when(configuration.getName()).thenReturn("api");

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSet));
}
 
Example #25
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_isTest() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  when(configuration.getName()).thenReturn("testCompile");

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(nullValue()));
}
 
Example #26
Source File: PackageTask.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
private void walk(final ResolvedDependency dep) {
    Set<ResolvedArtifact> artifacts = dep.getModuleArtifacts();
    for (ResolvedArtifact each : artifacts) {
        String[] parts = dep.getName().split(":");
        String groupId = parts[0];
        String artifactId = parts[1];
        String version = parts[2];
        this.tool.dependency("compile", groupId, artifactId, version, each.getExtension(),
                             each.getClassifier(), each.getFile());
    }

    dep.getChildren().forEach(this::walk);
}
 
Example #27
Source File: Utils.java    From Injector with Apache License 2.0 5 votes vote down vote up
public static Dependency createDependencyFrom(ResolvedArtifact resolvedArtifact) {
	ModuleVersionIdentifier identifier = resolvedArtifact.getModuleVersion().getId();
	return identifier.getGroup().isEmpty() ? new DefaultSelfResolvingDependency(
			resolvedArtifact.getId().getComponentIdentifier(),
			new DefaultFileCollectionFactory(new IdentityFileResolver(), null).fixed(resolvedArtifact.getFile())
	) : new DefaultExternalModuleDependency(
			identifier.getGroup(),
			identifier.getName(),
			identifier.getVersion());
}
 
Example #28
Source File: AndroidArchiveLibrary.java    From Injector with Apache License 2.0 5 votes vote down vote up
public AndroidArchiveLibrary(Project project, ResolvedArtifact artifact) {
	if (!"aar".equals(artifact.getType())) {
		throw new IllegalArgumentException("artifact must be aar type");
	}
	this.project = project;
	this.artifact = artifact;
}
 
Example #29
Source File: DependencyResolver.java    From atlas with Apache License 2.0 5 votes vote down vote up
public DependencyResolver(Project project, VariantDependencies variantDeps,
                              Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts,
                              Map<String, Set<String>> bundleProvidedMap, Map<String,Set<DependencyResult>>bundleCompileMap) {
        this.project = project;
        this.variantDeps = variantDeps;
        this.artifacts = artifacts;
        this.bundleProvidedMap = bundleProvidedMap;
        this.bundleCompileMap = bundleCompileMap;
        if (artifacts!= null){
            for (ModuleVersionIdentifier moduleVersionIdentifier:artifacts.keySet()){
               ids.add(moduleVersionIdentifier.getGroup()+":"+moduleVersionIdentifier.getName());
            }
        }
//        this.apDependencies = apDependencies;
    }
 
Example #30
Source File: DependencyTaskTest.java    From play-services-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetResolvedArtifacts_returnArtifact() {
  Set<ResolvedArtifact> artifactSet = prepareArtifactSet(2);
  ResolvedConfiguration resolvedConfiguration = mockResolvedConfiguration(artifactSet);

  Configuration configuration = mock(Configuration.class);
  when(configuration.getName()).thenReturn("compile");
  when(configuration.isCanBeResolved()).thenReturn(true);
  when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);

  assertThat(dependencyTask.getResolvedArtifacts(configuration), is(artifactSet));
}