From d01d01566217bb62d7c1d86e78532fbf23518da5 Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 24 Mar 2024 23:22:02 +0100 Subject: [PATCH] [MSHARED-1367] Improvement in unit tests - use Mockito instead of own mock classes --- pom.xml | 6 + .../apache/maven/archiver/MavenArchiver.java | 3 +- .../maven/archiver/PomPropertiesUtil.java | 23 ++ .../maven/archiver/MavenArchiverTest.java | 300 ++++++++---------- .../apache/maven/archiver/MockArtifact.java | 258 --------------- 5 files changed, 160 insertions(+), 430 deletions(-) delete mode 100644 src/test/java/org/apache/maven/archiver/MockArtifact.java diff --git a/pom.xml b/pom.xml index d917ea1..caeb194 100644 --- a/pom.xml +++ b/pom.xml @@ -114,6 +114,12 @@ 3.25.3 test + + org.mockito + mockito-core + 4.11.0 + test + org.slf4j slf4j-simple diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java index cab5ae9..ad1e0db 100644 --- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java +++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java @@ -565,8 +565,7 @@ public void createArchive( File pomPropertiesFile = new File(dir, "pom.properties"); new PomPropertiesUtil() - .createPomProperties( - session, workingProject, archiver, customPomPropertiesFile, pomPropertiesFile, forced); + .createPomProperties(workingProject, archiver, customPomPropertiesFile, pomPropertiesFile, forced); } // ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java index f105241..1b5b768 100644 --- a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java +++ b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java @@ -103,7 +103,9 @@ private void createPropertiesFile(Properties properties, File outputFile, boolea * @param forceCreation force creation true/false * @throws org.codehaus.plexus.archiver.ArchiverException archiver exception. * @throws java.io.IOException IO exception. + * @deprecated please use {@link #createPomProperties(MavenProject, Archiver, File, File, boolean)} */ + @Deprecated public void createPomProperties( MavenSession session, MavenProject project, @@ -112,6 +114,27 @@ public void createPomProperties( File pomPropertiesFile, boolean forceCreation) throws IOException { + createPomProperties(project, archiver, customPomPropertiesFile, pomPropertiesFile, forceCreation); + } + + /** + * Creates the pom.properties file. + * + * @param project {@link org.apache.maven.project.MavenProject} + * @param archiver {@link org.codehaus.plexus.archiver.Archiver} + * @param customPomPropertiesFile optional custom pom properties file + * @param pomPropertiesFile The pom properties file. + * @param forceCreation force creation true/false + * @throws org.codehaus.plexus.archiver.ArchiverException archiver exception. + * @throws java.io.IOException IO exception. + */ + public void createPomProperties( + MavenProject project, + Archiver archiver, + File customPomPropertiesFile, + File pomPropertiesFile, + boolean forceCreation) + throws IOException { final String groupId = project.getGroupId(); final String artifactId = project.getArtifactId(); final String version = project.getVersion(); diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java index 2ad0176..6c74558 100644 --- a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java +++ b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java @@ -30,9 +30,9 @@ import java.time.Instant; import java.time.format.DateTimeParseException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -46,13 +46,9 @@ import java.util.zip.ZipEntry; import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.DefaultArtifactHandler; -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.DefaultMavenExecutionResult; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenExecutionResult; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Build; import org.apache.maven.model.Model; @@ -60,8 +56,6 @@ import org.apache.maven.project.MavenProject; import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.archiver.jar.ManifestException; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystemSession; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledForJreRange; import org.junit.jupiter.api.condition.JRE; @@ -74,6 +68,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; class MavenArchiverTest { static class ArtifactComparator implements Comparator { @@ -135,12 +131,12 @@ public boolean isAddExtensions() { assertThat(manifest.getMainAttributes().getValue("Extension-List")).isNull(); - MockArtifact artifact1 = new MockArtifact(); - artifact1.setGroupId("org.apache.dummy"); - artifact1.setArtifactId("dummy1"); - artifact1.setVersion("1.0"); - artifact1.setType("dll"); - artifact1.setScope("compile"); + Artifact artifact1 = mock(Artifact.class); + when(artifact1.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact1.getArtifactId()).thenReturn("dummy1"); + when(artifact1.getVersion()).thenReturn("1.0"); + when(artifact1.getType()).thenReturn("dll"); + when(artifact1.getScope()).thenReturn("compile"); artifacts.add(artifact1); @@ -148,12 +144,12 @@ public boolean isAddExtensions() { assertThat(manifest.getMainAttributes().getValue("Extension-List")).isNull(); - MockArtifact artifact2 = new MockArtifact(); - artifact2.setGroupId("org.apache.dummy"); - artifact2.setArtifactId("dummy2"); - artifact2.setVersion("1.0"); - artifact2.setType("jar"); - artifact2.setScope("compile"); + Artifact artifact2 = mock(Artifact.class); + when(artifact2.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact2.getArtifactId()).thenReturn("dummy2"); + when(artifact2.getVersion()).thenReturn("1.0"); + when(artifact2.getType()).thenReturn("jar"); + when(artifact2.getScope()).thenReturn("compile"); artifacts.add(artifact2); @@ -161,12 +157,12 @@ public boolean isAddExtensions() { assertThat(manifest.getMainAttributes().getValue("Extension-List")).isEqualTo("dummy2"); - MockArtifact artifact3 = new MockArtifact(); - artifact3.setGroupId("org.apache.dummy"); - artifact3.setArtifactId("dummy3"); - artifact3.setVersion("1.0"); - artifact3.setScope("test"); - artifact3.setType("jar"); + Artifact artifact3 = mock(Artifact.class); + when(artifact3.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact3.getArtifactId()).thenReturn("dummy3"); + when(artifact3.getVersion()).thenReturn("1.0"); + when(artifact3.getType()).thenReturn("jar"); + when(artifact3.getScope()).thenReturn("test"); artifacts.add(artifact3); @@ -174,12 +170,12 @@ public boolean isAddExtensions() { assertThat(manifest.getMainAttributes().getValue("Extension-List")).isEqualTo("dummy2"); - MockArtifact artifact4 = new MockArtifact(); - artifact4.setGroupId("org.apache.dummy"); - artifact4.setArtifactId("dummy4"); - artifact4.setVersion("1.0"); - artifact4.setType("jar"); - artifact4.setScope("compile"); + Artifact artifact4 = mock(Artifact.class); + when(artifact4.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact4.getArtifactId()).thenReturn("dummy4"); + when(artifact4.getVersion()).thenReturn("1.0"); + when(artifact4.getType()).thenReturn("jar"); + when(artifact4.getScope()).thenReturn("compile"); artifacts.add(artifact4); @@ -327,8 +323,7 @@ private MavenArchiver getMavenArchiver(JarArchiver jarArchiver) { } @Test - void testDashesInClassPath_MSHARED_134() - throws IOException, ManifestException, DependencyResolutionRequiredException { + void testDashesInClassPath_MSHARED_134() throws Exception { File jarFile = new File("target/test/dummyWithDashes.jar"); JarArchiver jarArchiver = getCleanJarArchiver(jarFile); @@ -356,8 +351,7 @@ void testDashesInClassPath_MSHARED_134() } @Test - void testDashesInClassPath_MSHARED_182() - throws IOException, ManifestException, DependencyResolutionRequiredException { + void testDashesInClassPath_MSHARED_182() throws Exception { File jarFile = new File("target/test/dummy.jar"); JarArchiver jarArchiver = getCleanJarArchiver(jarFile); MavenArchiver archiver = getMavenArchiver(jarArchiver); @@ -1148,27 +1142,17 @@ private JarArchiver getCleanJarArchiver(File jarFile) { // common methods for testing // ---------------------------------------- - private MavenProject getDummyProject() { + private MavenProject getDummyProject() throws Exception { MavenProject project = getMavenProject(); - File pomFile = new File("src/test/resources/pom.xml"); - pomFile.setLastModified(System.currentTimeMillis() - 60000L); - project.setFile(pomFile); - Build build = new Build(); - build.setDirectory("target"); - build.setOutputDirectory("target"); - project.setBuild(build); - project.setName("archiver test"); - project.setUrl("https://maven.apache.org"); - Organization organization = new Organization(); - organization.setName("Apache"); - project.setOrganization(organization); - MockArtifact artifact = new MockArtifact(); - artifact.setGroupId("org.apache.dummy"); - artifact.setArtifactId("dummy"); - artifact.setVersion("0.1.1"); - artifact.setBaseVersion("0.1.2"); - artifact.setType("jar"); - artifact.setArtifactHandler(new DefaultArtifactHandler("jar")); + + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact.getArtifactId()).thenReturn("dummy"); + when(artifact.getVersion()).thenReturn("0.1.1"); + when(artifact.getBaseVersion()).thenReturn("0.1.2"); + when(artifact.getSelectedVersion()).thenReturn(new DefaultArtifactVersion("0.1.1")); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getArtifactHandler()).thenReturn(new DefaultArtifactHandler("jar")); project.setArtifact(artifact); Set artifacts = getArtifacts(getMockArtifact1Release(), getMockArtifact2(), getMockArtifact3()); @@ -1187,127 +1171,117 @@ private MavenProject getMavenProject() { project.setExtensionArtifacts(Collections.emptySet()); project.setRemoteArtifactRepositories(Collections.emptyList()); project.setPluginArtifactRepositories(Collections.emptyList()); - return project; - } - - private MockArtifact getMockArtifact3() { - MockArtifact artifact3 = new MockArtifact(); - artifact3.setGroupId("org.apache.dummy.bar"); - artifact3.setArtifactId("dummy3"); - artifact3.setVersion("2.0"); - artifact3.setScope("runtime"); - artifact3.setType("jar"); - artifact3.setClassifier("classifier"); - artifact3.setFile(getClasspathFile(artifact3.getArtifactId() + "-" + artifact3.getVersion() + ".jar")); - return artifact3; - } + project.setName("archiver test"); - private MavenProject getDummyProjectWithSnapshot() { - MavenProject project = getMavenProject(); File pomFile = new File("src/test/resources/pom.xml"); - pomFile.setLastModified(System.currentTimeMillis() - 60000L); project.setFile(pomFile); + Build build = new Build(); build.setDirectory("target"); build.setOutputDirectory("target"); project.setBuild(build); - project.setName("archiver test"); + Organization organization = new Organization(); organization.setName("Apache"); project.setOrganization(organization); - - MockArtifact artifact = new MockArtifact(); - artifact.setGroupId("org.apache.dummy"); - artifact.setArtifactId("dummy"); - artifact.setVersion("0.1.1"); - artifact.setBaseVersion("0.1.1"); - artifact.setType("jar"); - artifact.setArtifactHandler(new DefaultArtifactHandler("jar")); - project.setArtifact(artifact); - - Set artifacts = getArtifacts(getMockArtifact1(), getMockArtifact2(), getMockArtifact3()); - - project.setArtifacts(artifacts); - return project; } - private ArtifactHandler getMockArtifactHandler() { - return new ArtifactHandler() { - - public String getClassifier() { - return null; - } - - public String getDirectory() { - return null; - } - - public String getExtension() { - return "jar"; - } + private Artifact getMockArtifact3() { + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy.bar"); + when(artifact.getArtifactId()).thenReturn("dummy3"); + when(artifact.getVersion()).thenReturn("2.0"); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getScope()).thenReturn("runtime"); + when(artifact.getClassifier()).thenReturn("classifier"); + File file = getClasspathFile(artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar"); + when(artifact.getFile()).thenReturn(file); + ArtifactHandler artifactHandler = mock(ArtifactHandler.class); + when(artifactHandler.isAddedToClasspath()).thenReturn(true); + when(artifactHandler.getExtension()).thenReturn("jar"); + when(artifact.getArtifactHandler()).thenReturn(artifactHandler); + return artifact; + } - public String getLanguage() { - return null; - } + private MavenProject getDummyProjectWithSnapshot() throws Exception { + MavenProject project = getMavenProject(); - public String getPackaging() { - return null; - } + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact.getArtifactId()).thenReturn("dummy"); + when(artifact.getVersion()).thenReturn("0.1.1"); + when(artifact.getBaseVersion()).thenReturn("0.1.1"); + when(artifact.getSelectedVersion()).thenReturn(new DefaultArtifactVersion("0.1.1")); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getScope()).thenReturn("compile"); + when(artifact.getArtifactHandler()).thenReturn(new DefaultArtifactHandler("jar")); + project.setArtifact(artifact); - public boolean isAddedToClasspath() { - return true; - } + Set artifacts = getArtifacts(getMockArtifact1(), getMockArtifact2(), getMockArtifact3()); + project.setArtifacts(artifacts); - public boolean isIncludesDependencies() { - return false; - } - }; + return project; } - private MockArtifact getMockArtifact2() { - MockArtifact artifact2 = new MockArtifact(); - artifact2.setGroupId("org.apache.dummy.foo"); - artifact2.setArtifactId("dummy2"); - artifact2.setVersion("1.5"); - artifact2.setType("jar"); - artifact2.setScope("runtime"); - artifact2.setFile(getClasspathFile(artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar")); - return artifact2; + private Artifact getMockArtifact2() { + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy.foo"); + when(artifact.getArtifactId()).thenReturn("dummy2"); + when(artifact.getVersion()).thenReturn("1.5"); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getScope()).thenReturn("runtime"); + File file = getClasspathFile(artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar"); + when(artifact.getFile()).thenReturn(file); + ArtifactHandler artifactHandler = mock(ArtifactHandler.class); + when(artifactHandler.isAddedToClasspath()).thenReturn(true); + when(artifactHandler.getExtension()).thenReturn("jar"); + when(artifact.getArtifactHandler()).thenReturn(artifactHandler); + return artifact; } - private MockArtifact getArtifactWithDot() { - MockArtifact artifact2 = new MockArtifact(); - artifact2.setGroupId("org.apache.dummy.foo"); - artifact2.setArtifactId("dummy.dot"); - artifact2.setVersion("1.5"); - artifact2.setType("jar"); - artifact2.setScope("runtime"); - artifact2.setFile(getClasspathFile(artifact2.getArtifactId() + "-" + artifact2.getVersion() + ".jar")); - return artifact2; + private Artifact getArtifactWithDot() { + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy.foo"); + when(artifact.getArtifactId()).thenReturn("dummy.dot"); + when(artifact.getVersion()).thenReturn("1.5"); + when(artifact.getScope()).thenReturn("runtime"); + when(artifact.getArtifactHandler()).thenReturn(new DefaultArtifactHandler("jar")); + return artifact; } - private MockArtifact getMockArtifact1() { - MockArtifact artifact1 = new MockArtifact(); - artifact1.setGroupId("org.apache.dummy"); - artifact1.setArtifactId("dummy1"); - artifact1.setSnapshotVersion("1.1-20081022.112233-1", "1.1-SNAPSHOT"); - artifact1.setType("jar"); - artifact1.setScope("runtime"); - artifact1.setFile(getClasspathFile(artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar")); - return artifact1; + private Artifact getMockArtifact1() { + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact.getArtifactId()).thenReturn("dummy1"); + when(artifact.getVersion()).thenReturn("1.1-20081022.112233-1"); + when(artifact.getBaseVersion()).thenReturn("1.1-SNAPSHOT"); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getScope()).thenReturn("runtime"); + File file = getClasspathFile(artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar"); + when(artifact.getFile()).thenReturn(file); + ArtifactHandler artifactHandler = mock(ArtifactHandler.class); + when(artifactHandler.isAddedToClasspath()).thenReturn(true); + when(artifactHandler.getExtension()).thenReturn("jar"); + when(artifact.getArtifactHandler()).thenReturn(artifactHandler); + return artifact; } - private MockArtifact getMockArtifact1Release() { - MockArtifact artifact1 = new MockArtifact(); - artifact1.setGroupId("org.apache.dummy"); - artifact1.setArtifactId("dummy1"); - artifact1.setVersion("1.0"); - artifact1.setBaseVersion("1.0.1"); - artifact1.setType("jar"); - artifact1.setScope("runtime"); - artifact1.setFile(getClasspathFile(artifact1.getArtifactId() + "-" + artifact1.getVersion() + ".jar")); - return artifact1; + private Artifact getMockArtifact1Release() { + Artifact artifact = mock(Artifact.class); + when(artifact.getGroupId()).thenReturn("org.apache.dummy"); + when(artifact.getArtifactId()).thenReturn("dummy1"); + when(artifact.getVersion()).thenReturn("1.0"); + when(artifact.getBaseVersion()).thenReturn("1.0.1"); + when(artifact.getType()).thenReturn("jar"); + when(artifact.getScope()).thenReturn("runtime"); + File file = getClasspathFile(artifact.getArtifactId() + "-" + artifact.getVersion() + ".jar"); + when(artifact.getFile()).thenReturn(file); + ArtifactHandler artifactHandler = mock(ArtifactHandler.class); + when(artifactHandler.isAddedToClasspath()).thenReturn(true); + when(artifactHandler.getExtension()).thenReturn("jar"); + when(artifact.getArtifactHandler()).thenReturn(artifactHandler); + return artifact; } private File getClasspathFile(String file) { @@ -1337,28 +1311,14 @@ private MavenSession getDummySessionWithoutMavenVersion() { } private MavenSession getDummySession(Properties systemProperties) { - Date startTime = new Date(); - - MavenExecutionRequest request = new DefaultMavenExecutionRequest(); - request.setSystemProperties(systemProperties); - request.setGoals(null); - request.setStartTime(startTime); - request.setUserSettingsFile(null); - - MavenExecutionResult result = new DefaultMavenExecutionResult(); - - RepositorySystemSession rss = new DefaultRepositorySystemSession(); - - return new MavenSession(null, rss, request, result); + MavenSession session = mock(MavenSession.class); + when(session.getSystemProperties()).thenReturn(systemProperties); + return session; } private Set getArtifacts(Artifact... artifacts) { - final ArtifactHandler mockArtifactHandler = getMockArtifactHandler(); Set result = new TreeSet<>(new ArtifactComparator()); - for (Artifact artifact : artifacts) { - artifact.setArtifactHandler(mockArtifactHandler); - result.add(artifact); - } + result.addAll(Arrays.asList(artifacts)); return result; } diff --git a/src/test/java/org/apache/maven/archiver/MockArtifact.java b/src/test/java/org/apache/maven/archiver/MockArtifact.java deleted file mode 100644 index a82c751..0000000 --- a/src/test/java/org/apache/maven/archiver/MockArtifact.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.archiver; - -import java.io.File; -import java.util.Collection; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; - -/* - * TODO move to maven-artifact-test - */ -@SuppressWarnings("deprecation") -public class MockArtifact implements Artifact { - private String groupId; - - private String artifactId; - - private String version; - - private File file; - - private String scope; - - private String type; - - private String classifier; - - private String baseVersion; - - private ArtifactHandler artifactHandler; - - private boolean snapshot; - - public String getGroupId() { - return groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String string) { - this.version = string; - } - - public void setSnapshotVersion(String snapshotVersion, String baseVersion) { - snapshot = true; - version = snapshotVersion; - this.baseVersion = baseVersion; - } - - public String getScope() { - return scope; - } - - public String getType() { - return type; - } - - public String getClassifier() { - return classifier; - } - - public boolean hasClassifier() { - return classifier != null; - } - - public File getFile() { - return file; - } - - public void setFile(File file) { - this.file = file; - } - - public String getBaseVersion() { - return baseVersion; - } - - public void setBaseVersion(String string) { - this.baseVersion = string; - } - - public String getId() { - return null; - } - - public String getDependencyConflictId() { - return null; - } - - public void addMetadata(ArtifactMetadata artifactMetadata) {} - - public ArtifactMetadata getMetadata(Class metadataClass) { - return null; - } - - public Collection getMetadataList() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setRepository(ArtifactRepository artifactRepository) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactRepository getRepository() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void updateVersion(String string, ArtifactRepository artifactRepository) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public String getDownloadUrl() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setDownloadUrl(String string) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactFilter getDependencyFilter() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setDependencyFilter(ArtifactFilter artifactFilter) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactHandler getArtifactHandler() { - return artifactHandler; - } - - public List getDependencyTrail() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setDependencyTrail(List list) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public VersionRange getVersionRange() { - return VersionRange.createFromVersion(version); - } - - public void setVersionRange(VersionRange versionRange) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public void selectVersion(String string) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isSnapshot() { - return snapshot; - } - - public void setResolved(boolean b) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isResolved() { - return false; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setResolvedVersion(String string) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public void setArtifactHandler(ArtifactHandler artifactHandler) { - this.artifactHandler = artifactHandler; - } - - public boolean isRelease() { - return false; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setRelease(boolean b) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public List getAvailableVersions() { - return null; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setAvailableVersions(List list) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public boolean isOptional() { - return false; // To change body of implemented methods use File | Settings | File Templates. - } - - public void setOptional(boolean b) { - // To change body of implemented methods use File | Settings | File Templates. - } - - public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException { - return VersionRange.createFromVersion(version).getSelectedVersion(this); - } - - public boolean isSelectedVersionKnown() throws OverConstrainedVersionException { - return VersionRange.createFromVersion(version).isSelectedVersionKnown(this); - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public void setType(String type) { - this.type = type; - } - - public void setClassifier(String classifier) { - this.classifier = classifier; - } - - public void setScope(String string) { - this.scope = string; - } - - public int compareTo(Artifact o) { - return 0; // To change body of implemented methods use File | Settings | File Templates. - } -}