1 package org.apache.archiva.metadata.repository.storage.maven2;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import junit.framework.TestCase;
23 import org.apache.archiva.configuration.ArchivaConfiguration;
24 import org.apache.archiva.configuration.Configuration;
25 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
26 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
27 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
28 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
29 import org.apache.archiva.metadata.model.ArtifactMetadata;
30 import org.apache.archiva.metadata.model.Dependency;
31 import org.apache.archiva.metadata.model.License;
32 import org.apache.archiva.metadata.model.MailingList;
33 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
34 import org.apache.archiva.filter.AllFilter;
35 import org.apache.archiva.filter.Filter;
36 import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
37 import org.apache.archiva.proxy.maven.WagonFactory;
38 import org.apache.archiva.proxy.maven.WagonFactoryRequest;
39 import org.apache.archiva.repository.RepositoryRegistry;
40 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
41 import org.apache.commons.io.FileUtils;
42 import org.apache.maven.wagon.Wagon;
43 import org.junit.Before;
44 import org.junit.Test;
45 import org.junit.runner.RunWith;
46 import org.springframework.test.context.ContextConfiguration;
48 import javax.inject.Inject;
49 import javax.inject.Named;
50 import java.io.IOException;
51 import java.nio.file.Files;
52 import java.nio.file.Path;
53 import java.nio.file.Paths;
54 import java.util.ArrayList;
55 import java.util.Arrays;
56 import java.util.List;
58 import static org.mockito.Mockito.mock;
59 import static org.mockito.Mockito.when;
62 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
63 @ContextConfiguration ( { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
64 public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest
67 private static final Filter<String> ALL = new AllFilter<String>();
70 @Named ( "repositoryStorage#maven2")
71 private Maven2RepositoryStorage storage;
73 private static final String TEST_REPO_ID = "test";
75 private static final String TEST_SNAP_REPO_ID = "tests";
77 private static final String TEST_REPO_GROUP_ID = "testrg";
79 private static final String TEST_REMOTE_REPO_ID = "central";
81 private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
83 private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
85 private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
87 private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
89 private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
91 private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
93 private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
95 private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
98 @Named ( "archivaConfiguration#default" )
99 private ArchivaConfiguration configuration;
102 RepositoryRegistry repositoryRegistry;
104 private WagonFactory wagonFactory;
106 ManagedRepositoryConfiguration testRepo;
108 ManagedRepositoryConfiguration testRepoS;
119 c = new Configuration();
121 testRepo = new ManagedRepositoryConfiguration();
122 testRepo.setId( TEST_REPO_ID );
123 testRepo.setLocation( Paths.get( "target/test-repository" ).toAbsolutePath().toString() );
124 testRepo.setReleases( true );
125 testRepo.setSnapshots( false );
126 c.addManagedRepository( testRepo );
128 testRepoS = new ManagedRepositoryConfiguration();
129 testRepoS.setId( TEST_SNAP_REPO_ID );
130 testRepoS.setLocation( Paths.get( "target/test-repositorys" ).toAbsolutePath().toString() );
131 testRepoS.setReleases( false );
132 testRepoS.setSnapshots( true );
133 c.addManagedRepository( testRepoS );
135 RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration();
136 testRemoteRepo.setId( TEST_REMOTE_REPO_ID );
137 testRemoteRepo.setLayout( "default" );
138 testRemoteRepo.setName( "Central Repository" );
139 testRemoteRepo.setUrl( "http://central.repo.com/maven2" );
140 testRemoteRepo.setTimeout( 10 );
141 c.addRemoteRepository( testRemoteRepo );
143 ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
144 proxyConnector.setSourceRepoId( TEST_REPO_ID );
145 proxyConnector.setTargetRepoId( TEST_REMOTE_REPO_ID );
146 proxyConnector.setDisabled( false );
147 c.addProxyConnector( proxyConnector );
149 ProxyConnectorConfiguration proxyConnectors = new ProxyConnectorConfiguration();
150 proxyConnectors.setSourceRepoId( TEST_SNAP_REPO_ID );
151 proxyConnectors.setTargetRepoId( TEST_REMOTE_REPO_ID );
152 proxyConnectors.setDisabled( false );
153 c.addProxyConnector( proxyConnectors );
155 List<String> repos = new ArrayList<>();
156 repos.add( TEST_REPO_ID );
157 repos.add( TEST_SNAP_REPO_ID );
159 RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
160 repoGroup.setId( TEST_REPO_GROUP_ID );
161 repoGroup.setRepositories( repos );
162 c.addRepositoryGroup( repoGroup );
164 configuration.save( c );
165 repositoryRegistry.reload();
167 assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
168 assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
170 assertTrue( c.getManagedRepositories().get( 1 ).isSnapshots() );
171 assertFalse( c.getManagedRepositories().get( 1 ).isReleases() );
173 wagonFactory = mock( WagonFactory.class );
175 storage.setWagonFactory( wagonFactory );
177 Wagon wagon = new MockWagon();
178 when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon );
181 // Tests for MRM-1411 - START
183 public void testGetProjectVersionMetadataWithParentSuccessful()
186 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-module-a",
187 "target/test-repository/com/example/test/test-artifact-module-a" );
188 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-root",
189 "target/test-repository/com/example/test/test-artifact-root" );
190 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-parent",
191 "target/test-repository/com/example/test/test-artifact-parent" );
193 ReadMetadataRequest readMetadataRequest =
194 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
195 "test-artifact-module-a" ).projectVersion( "1.0" );
196 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
198 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
199 assertEquals( "jar", facet.getPackaging() );
200 assertEquals( "http://maven.apache.org", metadata.getUrl() );
201 assertEquals( "com.example.test", facet.getParent().getGroupId() );
202 assertEquals( "test-artifact-root", facet.getParent().getArtifactId() );
203 assertEquals( "1.0", facet.getParent().getVersion() );
204 assertEquals( "test-artifact-module-a", facet.getArtifactId() );
205 assertEquals( "com.example.test", facet.getGroupId() );
206 assertNull( metadata.getCiManagement() );
207 assertNotNull( metadata.getDescription() );
209 checkApacheLicense( metadata );
211 assertEquals( "1.0", metadata.getId() );
212 assertEquals( "Test Artifact :: Module A", metadata.getName() );
213 String path = "test-artifact/trunk/test-artifact-module-a";
214 assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
215 assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
216 assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
218 List<Dependency> dependencies = metadata.getDependencies();
219 assertEquals( 2, dependencies.size() );
220 assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
221 assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
223 List<String> paths = new ArrayList<>();
224 paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
225 paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
226 paths.add( "target/test-repository/com/example/test/test-artifact-root" );
228 deleteTestArtifactWithParent( paths );
232 public void testGetProjectVersionMetadataWithParentNoRemoteReposConfigured()
235 // remove configuration
236 Configuration config = configuration.getConfiguration();
237 RemoteRepositoryConfiguration remoteRepo = config.findRemoteRepositoryById( TEST_REMOTE_REPO_ID );
238 config.removeRemoteRepository( remoteRepo );
240 configuration.save( config );
242 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-module-a",
243 "target/test-repository/com/example/test/test-artifact-module-a" );
244 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-root",
245 "target/test-repository/com/example/test/test-artifact-root" );
246 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-parent",
247 "target/test-repository/com/example/test/test-artifact-parent" );
249 ReadMetadataRequest readMetadataRequest =
250 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
251 "test-artifact-module-a" ).projectVersion( "1.0" );
252 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
253 assertEquals( "1.0", metadata.getId() );
255 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
256 assertNotNull( facet );
257 assertEquals( "com.example.test", facet.getGroupId() );
258 assertEquals( "test-artifact-module-a", facet.getArtifactId() );
259 assertEquals( "jar", facet.getPackaging() );
261 List<String> paths = new ArrayList<>();
262 paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
263 paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
264 paths.add( "target/test-repository/com/example/test/test-artifact-root" );
266 deleteTestArtifactWithParent( paths );
270 public void testGetProjectVersionMetadataWithParentNotInAnyRemoteRepo()
273 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-module-a",
274 "target/test-repository/com/example/test/test-artifact-module-a" );
276 ReadMetadataRequest readMetadataRequest =
277 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
278 "missing-parent" ).projectVersion( "1.1" );
280 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
282 assertEquals( "1.1", metadata.getId() );
284 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
285 assertNotNull( facet );
286 assertEquals( "com.example.test", facet.getGroupId() );
287 assertEquals( "missing-parent", facet.getArtifactId() );
288 assertEquals( "jar", facet.getPackaging() );
290 List<String> paths = new ArrayList<>();
291 paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
292 paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
293 paths.add( "target/test-repository/com/example/test/test-artifact-root" );
295 deleteTestArtifactWithParent( paths );
299 public void testGetProjectVersionMetadataWithParentSnapshotVersion()
302 copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
303 "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
304 copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-root",
305 "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
306 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-parent",
307 "target/test-repositorys/com/example/test/test-artifact-parent" );
309 ReadMetadataRequest readMetadataRequest =
310 new ReadMetadataRequest( TEST_SNAP_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
313 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
315 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
316 assertEquals( "jar", facet.getPackaging() );
317 assertEquals( "com.example.test", facet.getParent().getGroupId() );
318 assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
319 assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
320 assertEquals( "test-snapshot-artifact-module-a", facet.getArtifactId() );
321 assertEquals( "com.example.test", facet.getGroupId() );
322 assertNull( metadata.getCiManagement() );
323 assertNotNull( metadata.getDescription() );
325 checkApacheLicense( metadata );
327 assertEquals( "1.1-SNAPSHOT", metadata.getId() );
328 assertEquals( "Test Snapshot Artifact :: Module A", metadata.getName() );
329 String path = "test-snapshot-artifact/trunk/test-snapshot-artifact-module-a";
330 assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
331 assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
332 assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
334 List<Dependency> dependencies = metadata.getDependencies();
335 assertEquals( 2, dependencies.size() );
336 assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
337 assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
339 List<String> paths = new ArrayList<>();
340 paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
341 paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
342 deleteTestArtifactWithParent( paths );
346 public void testGetProjectVersionMetadataWithParentSnapshotVersionAndSnapNotAllowed()
349 copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
350 "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
351 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-parent",
352 "target/test-repositorys/com/example/test/test-artifact-parent" );
353 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-snapshot-artifact-root",
354 "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
356 ReadMetadataRequest readMetadataRequest =
357 new ReadMetadataRequest().repositoryId( TEST_SNAP_REPO_ID ).namespace( "com.example.test" ).projectId(
358 "test-snapshot-artifact-module-a" ).projectVersion( "1.1-SNAPSHOT" );
359 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
361 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
362 assertEquals( "jar", facet.getPackaging() );
363 assertEquals( "com.example.test", facet.getParent().getGroupId() );
364 assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
365 assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
366 assertEquals( "test-snapshot-artifact-module-a", facet.getArtifactId() );
367 assertEquals( "com.example.test", facet.getGroupId() );
368 assertNull( metadata.getCiManagement() );
369 assertNotNull( metadata.getDescription() );
371 checkApacheLicense( metadata );
373 assertEquals( "1.1-SNAPSHOT", metadata.getId() );
374 assertEquals( "Test Snapshot Artifact :: Module A", metadata.getName() );
375 String path = "test-snapshot-artifact/trunk/test-snapshot-artifact-module-a";
376 assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
377 assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
378 assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
380 List<Dependency> dependencies = metadata.getDependencies();
381 assertEquals( 2, dependencies.size() );
382 assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
383 assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
385 List<String> paths = new ArrayList<>();
386 paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
387 paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
389 deleteTestArtifactWithParent( paths );
393 public void testGetProjectVersionMetadataWithParentSnapshotVersionAndSnapNotAllowed2()
396 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-module-b",
397 "target/test-repository/com/example/test/test-artifact-module-b" );
398 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-artifact-parent",
399 "target/test-repository/com/example/test/test-artifact-parent" );
400 copyTestArtifactWithParent( "src/test/resources/com/example/test/test-snapshot-artifact-root",
401 "target/test-repository/com/example/test/test-snapshot-artifact-root" );
403 ReadMetadataRequest readMetadataRequest =
404 new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
405 "test-artifact-module-b" ).projectVersion( "1.0" );
407 ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
409 MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
410 assertEquals( "jar", facet.getPackaging() );
411 assertEquals( "com.example.test", facet.getParent().getGroupId() );
412 assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
413 assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
414 assertEquals( "test-artifact-module-b", facet.getArtifactId() );
415 assertEquals( "com.example.test", facet.getGroupId() );
416 assertNull( metadata.getCiManagement() );
417 assertNotNull( metadata.getDescription() );
419 checkApacheLicense( metadata );
421 assertEquals( "1.0", metadata.getId() );
422 assertEquals( "Test Artifact :: Module B", metadata.getName() );
423 String path = "test-snapshot-artifact/trunk/test-artifact-module-b";
424 assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
425 assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
426 assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
428 List<Dependency> dependencies = metadata.getDependencies();
429 assertEquals( 2, dependencies.size() );
430 assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
431 assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
433 List<String> paths = new ArrayList<>();
434 paths.add( "target/test-repository/com/example/test/test-artifact-module-b" );
435 paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-root" );
437 deleteTestArtifactWithParent( paths );
439 // Tests for MRM-1411 - END
441 private void assertDependency( Dependency dependency, String groupId, String artifactId, String version )
443 assertDependency( dependency, groupId, artifactId, version, "compile" );
446 private void assertDependency( Dependency dependency, String groupId, String artifactId, String version,
449 assertEquals( artifactId, dependency.getArtifactId() );
450 assertEquals( "jar", dependency.getType() );
451 assertEquals( version, dependency.getVersion() );
452 assertEquals( groupId, dependency.getNamespace() );
453 assertEquals( scope, dependency.getScope() );
454 assertNull( dependency.getClassifier() );
455 assertNull( dependency.getSystemPath() );
458 private void assertArtifact( ArtifactMetadata artifact, String id, int size, String sha1, String md5 )
460 assertEquals( id, artifact.getId() );
461 assertEquals( md5, artifact.getMd5() );
462 assertEquals( sha1, artifact.getSha1() );
463 assertEquals( size, artifact.getSize() );
464 assertEquals( "org.codehaus.plexus", artifact.getNamespace() );
465 assertEquals( "plexus-spring", artifact.getProject() );
466 assertEquals( "1.2", artifact.getVersion() );
467 assertEquals( TEST_REPO_ID, artifact.getRepositoryId() );
470 private void assertMailingList( MailingList mailingList, String name, String archive, String post, String subscribe,
471 String unsubscribe, List<String> otherArchives, boolean allowPost )
473 assertEquals( archive, mailingList.getMainArchiveUrl() );
476 assertEquals( post, mailingList.getPostAddress() );
480 assertNull( mailingList.getPostAddress() );
482 assertEquals( subscribe, mailingList.getSubscribeAddress() );
483 assertEquals( unsubscribe, mailingList.getUnsubscribeAddress() );
484 assertEquals( name, mailingList.getName() );
485 assertEquals( otherArchives, mailingList.getOtherArchives() );
488 private void assertMailingList( String prefix, MailingList mailingList, String name, boolean allowPost,
491 List<String> otherArchives = new ArrayList<>();
492 otherArchives.add( "http://www.mail-archive.com/" + prefix + "@archiva.apache.org" );
493 if ( nabbleUrl != null )
495 otherArchives.add( nabbleUrl );
497 otherArchives.add( "http://markmail.org/list/org.apache.archiva." + prefix );
498 assertMailingList( mailingList, name, "http://mail-archives.apache.org/mod_mbox/archiva-" + prefix + "/",
499 prefix + "@archiva.apache.org", prefix + "-subscribe@archiva.apache.org",
500 prefix + "-unsubscribe@archiva.apache.org", otherArchives, allowPost );
503 private void checkApacheLicense( ProjectVersionMetadata metadata )
505 assertEquals( Arrays.asList( new License( "The Apache Software License, Version 2.0",
506 "http://www.apache.org/licenses/LICENSE-2.0.txt" ) ),
507 metadata.getLicenses() );
510 private void checkOrganizationApache( ProjectVersionMetadata metadata )
512 assertEquals( "The Apache Software Foundation", metadata.getOrganization().getName() );
513 assertEquals( "http://www.apache.org/", metadata.getOrganization().getUrl() );
516 private void deleteTestArtifactWithParent( List<String> pathsToBeDeleted )
519 for ( String path : pathsToBeDeleted )
521 Path dir = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
522 org.apache.archiva.common.utils.FileUtils.deleteDirectory( dir );
524 assertFalse( Files.exists(dir) );
526 Path dest = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-repository/com/example/test/test-artifact-module-a" );
527 Path parentPom = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-repository/com/example/test/test-artifact-parent" );
528 Path rootPom = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "target/test-repository/com/example/test/test-artifact-root" );
530 org.apache.archiva.common.utils.FileUtils.deleteDirectory( dest );
531 org.apache.archiva.common.utils.FileUtils.deleteDirectory( parentPom );
532 org.apache.archiva.common.utils.FileUtils.deleteDirectory( rootPom );
534 assertFalse( Files.exists(dest) );
535 assertFalse( Files.exists(parentPom) );
536 assertFalse( Files.exists(rootPom) );
539 private Path copyTestArtifactWithParent( String srcPath, String destPath )
542 Path src = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), srcPath );
543 Path dest = Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), destPath );
545 FileUtils.copyDirectory( src.toFile(), dest.toFile() );
546 assertTrue( Files.exists(dest) );