View Javadoc
1   package org.apache.archiva.metadata.repository.storage.maven2;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import junit.framework.TestCase;
23  import org.apache.archiva.common.utils.FileUtil;
24  import org.apache.archiva.configuration.ArchivaConfiguration;
25  import org.apache.archiva.configuration.Configuration;
26  import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
27  import org.apache.archiva.configuration.ProxyConnectorConfiguration;
28  import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
29  import org.apache.archiva.configuration.RepositoryGroupConfiguration;
30  import org.apache.archiva.metadata.model.ArtifactMetadata;
31  import org.apache.archiva.metadata.model.Dependency;
32  import org.apache.archiva.metadata.model.License;
33  import org.apache.archiva.metadata.model.MailingList;
34  import org.apache.archiva.metadata.model.ProjectVersionMetadata;
35  import org.apache.archiva.metadata.repository.filter.AllFilter;
36  import org.apache.archiva.metadata.repository.filter.Filter;
37  import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
38  import org.apache.archiva.proxy.common.WagonFactory;
39  import org.apache.archiva.proxy.common.WagonFactoryRequest;
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;
47  
48  import javax.inject.Inject;
49  import javax.inject.Named;
50  import java.io.File;
51  import java.io.IOException;
52  import java.util.ArrayList;
53  import java.util.Arrays;
54  import java.util.List;
55  
56  import static org.mockito.Mockito.mock;
57  import static org.mockito.Mockito.when;
58  
59  
60  @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
61  @ContextConfiguration ( { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
62  public class Maven2RepositoryMetadataResolverMRM1411RepoGroupTest
63      extends TestCase
64  {
65      private static final Filter<String> ALL = new AllFilter<String>();
66  
67      @Inject
68      @Named ( "repositoryStorage#maven2")
69      private Maven2RepositoryStorage storage;
70  
71      private static final String TEST_REPO_ID = "test";
72  
73      private static final String TEST_SNAP_REPO_ID = "tests";
74  
75      private static final String TEST_REPO_GROUP_ID = "testrg";
76  
77      private static final String TEST_REMOTE_REPO_ID = "central";
78  
79      private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/";
80  
81      private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/";
82  
83      private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/";
84  
85      private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/";
86  
87      private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/";
88  
89      private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/";
90  
91      private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e";
92  
93      private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709";
94  
95      @Inject
96      @Named ( "archivaConfiguration#default" )
97      private ArchivaConfiguration configuration;
98  
99      private WagonFactory wagonFactory;
100 
101     ManagedRepositoryConfiguration testRepo;
102 
103     ManagedRepositoryConfiguration testRepoS;
104 
105     Configuration c;
106 
107     @Before
108     @Override
109     public void setUp()
110         throws Exception
111     {
112         super.setUp();
113 
114         c = new Configuration();
115 
116         testRepo = new ManagedRepositoryConfiguration();
117         testRepo.setId( TEST_REPO_ID );
118         testRepo.setLocation( new File( "target/test-repository" ).getAbsolutePath() );
119         testRepo.setReleases( true );
120         testRepo.setSnapshots( false );
121         c.addManagedRepository( testRepo );
122 
123         testRepoS = new ManagedRepositoryConfiguration();
124         testRepoS.setId( TEST_SNAP_REPO_ID );
125         testRepoS.setLocation( new File( "target/test-repositorys" ).getAbsolutePath() );
126         testRepoS.setReleases( false );
127         testRepoS.setSnapshots( true );
128         c.addManagedRepository( testRepoS );
129 
130         RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration();
131         testRemoteRepo.setId( TEST_REMOTE_REPO_ID );
132         testRemoteRepo.setLayout( "default" );
133         testRemoteRepo.setName( "Central Repository" );
134         testRemoteRepo.setUrl( "http://central.repo.com/maven2" );
135         testRemoteRepo.setTimeout( 10 );
136         c.addRemoteRepository( testRemoteRepo );
137 
138         ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration();
139         proxyConnector.setSourceRepoId( TEST_REPO_ID );
140         proxyConnector.setTargetRepoId( TEST_REMOTE_REPO_ID );
141         proxyConnector.setDisabled( false );
142         c.addProxyConnector( proxyConnector );
143 
144         ProxyConnectorConfiguration proxyConnectors = new ProxyConnectorConfiguration();
145         proxyConnectors.setSourceRepoId( TEST_SNAP_REPO_ID );
146         proxyConnectors.setTargetRepoId( TEST_REMOTE_REPO_ID );
147         proxyConnectors.setDisabled( false );
148         c.addProxyConnector( proxyConnectors );
149 
150         List<String> repos = new ArrayList<>();
151         repos.add( TEST_REPO_ID );
152         repos.add( TEST_SNAP_REPO_ID );
153 
154         RepositoryGroupConfiguration repoGroup = new RepositoryGroupConfiguration();
155         repoGroup.setId( TEST_REPO_GROUP_ID );
156         repoGroup.setRepositories( repos );
157         c.addRepositoryGroup( repoGroup );
158 
159         configuration.save( c );
160 
161         assertFalse( c.getManagedRepositories().get( 0 ).isSnapshots() );
162         assertTrue( c.getManagedRepositories().get( 0 ).isReleases() );
163 
164         assertTrue( c.getManagedRepositories().get( 1 ).isSnapshots() );
165         assertFalse( c.getManagedRepositories().get( 1 ).isReleases() );
166 
167         wagonFactory = mock( WagonFactory.class );
168 
169         storage.setWagonFactory( wagonFactory );
170 
171         Wagon wagon = new MockWagon();
172         when( wagonFactory.getWagon( new WagonFactoryRequest().protocol( "wagon#http" ) ) ).thenReturn( wagon );
173     }
174 
175     // Tests for MRM-1411 - START
176     @Test
177     public void testGetProjectVersionMetadataWithParentSuccessful()
178         throws Exception
179     {
180         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
181                                     "target/test-repository/com/example/test/test-artifact-module-a" );
182 
183         ReadMetadataRequest readMetadataRequest =
184             new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
185                 "test-artifact-module-a" ).projectVersion( "1.0" );
186         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
187 
188         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
189         assertEquals( "jar", facet.getPackaging() );
190         assertEquals( "http://maven.apache.org", metadata.getUrl() );
191         assertEquals( "com.example.test", facet.getParent().getGroupId() );
192         assertEquals( "test-artifact-root", facet.getParent().getArtifactId() );
193         assertEquals( "1.0", facet.getParent().getVersion() );
194         assertEquals( "test-artifact-module-a", facet.getArtifactId() );
195         assertEquals( "com.example.test", facet.getGroupId() );
196         assertNull( metadata.getCiManagement() );
197         assertNotNull( metadata.getDescription() );
198 
199         checkApacheLicense( metadata );
200 
201         assertEquals( "1.0", metadata.getId() );
202         assertEquals( "Test Artifact :: Module A", metadata.getName() );
203         String path = "test-artifact/trunk/test-artifact-module-a";
204         assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
205         assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
206         assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
207 
208         List<Dependency> dependencies = metadata.getDependencies();
209         assertEquals( 2, dependencies.size() );
210         assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
211         assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
212 
213         List<String> paths = new ArrayList<>();
214         paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
215         paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
216         paths.add( "target/test-repository/com/example/test/test-artifact-root" );
217 
218         deleteTestArtifactWithParent( paths );
219     }
220 
221     @Test
222     public void testGetProjectVersionMetadataWithParentNoRemoteReposConfigured()
223         throws Exception
224     {
225         // remove configuration
226         Configuration config = configuration.getConfiguration();
227         RemoteRepositoryConfiguration remoteRepo = config.findRemoteRepositoryById( TEST_REMOTE_REPO_ID );
228         config.removeRemoteRepository( remoteRepo );
229 
230         configuration.save( config );
231 
232         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
233                                     "target/test-repository/com/example/test/test-artifact-module-a" );
234 
235         ReadMetadataRequest readMetadataRequest =
236             new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
237                 "test-artifact-module-a" ).projectVersion( "1.0" );
238         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
239         assertEquals( "1.0", metadata.getId() );
240 
241         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
242         assertNotNull( facet );
243         assertEquals( "com.example.test", facet.getGroupId() );
244         assertEquals( "test-artifact-module-a", facet.getArtifactId() );
245         assertEquals( "jar", facet.getPackaging() );
246 
247         List<String> paths = new ArrayList<>();
248         paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
249         paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
250         paths.add( "target/test-repository/com/example/test/test-artifact-root" );
251 
252         deleteTestArtifactWithParent( paths );
253     }
254 
255     @Test
256     public void testGetProjectVersionMetadataWithParentNotInAnyRemoteRepo()
257         throws Exception
258     {
259         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-a",
260                                     "target/test-repository/com/example/test/test-artifact-module-a" );
261 
262         ReadMetadataRequest readMetadataRequest =
263             new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
264                 "missing-parent" ).projectVersion( "1.1" );
265 
266         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
267 
268         assertEquals( "1.1", metadata.getId() );
269 
270         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
271         assertNotNull( facet );
272         assertEquals( "com.example.test", facet.getGroupId() );
273         assertEquals( "missing-parent", facet.getArtifactId() );
274         assertEquals( "jar", facet.getPackaging() );
275 
276         List<String> paths = new ArrayList<>();
277         paths.add( "target/test-repository/com/example/test/test-artifact-module-a" );
278         paths.add( "target/test-repository/com/example/test/test-artifact-parent" );
279         paths.add( "target/test-repository/com/example/test/test-artifact-root" );
280 
281         deleteTestArtifactWithParent( paths );
282     }
283 
284     @Test
285     public void testGetProjectVersionMetadataWithParentSnapshotVersion()
286         throws Exception
287     {
288         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
289                                     "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
290         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-root",
291                                     "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
292 
293         ReadMetadataRequest readMetadataRequest =
294             new ReadMetadataRequest( TEST_SNAP_REPO_ID, "com.example.test", "test-snapshot-artifact-module-a",
295                                      "1.1-SNAPSHOT" );
296 
297         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
298 
299         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
300         assertEquals( "jar", facet.getPackaging() );
301         assertEquals( "com.example.test", facet.getParent().getGroupId() );
302         assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
303         assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
304         assertEquals( "test-snapshot-artifact-module-a", facet.getArtifactId() );
305         assertEquals( "com.example.test", facet.getGroupId() );
306         assertNull( metadata.getCiManagement() );
307         assertNotNull( metadata.getDescription() );
308 
309         checkApacheLicense( metadata );
310 
311         assertEquals( "1.1-SNAPSHOT", metadata.getId() );
312         assertEquals( "Test Snapshot Artifact :: Module A", metadata.getName() );
313         String path = "test-snapshot-artifact/trunk/test-snapshot-artifact-module-a";
314         assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
315         assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
316         assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
317 
318         List<Dependency> dependencies = metadata.getDependencies();
319         assertEquals( 2, dependencies.size() );
320         assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
321         assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
322 
323         List<String> paths = new ArrayList<>();
324         paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
325         paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
326         deleteTestArtifactWithParent( paths );
327     }
328 
329     @Test
330     public void testGetProjectVersionMetadataWithParentSnapshotVersionAndSnapNotAllowed()
331         throws Exception
332     {
333         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-snapshot-artifact-module-a",
334                                     "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
335 
336         ReadMetadataRequest readMetadataRequest =
337             new ReadMetadataRequest().repositoryId( TEST_SNAP_REPO_ID ).namespace( "com.example.test" ).projectId(
338                 "test-snapshot-artifact-module-a" ).projectVersion( "1.1-SNAPSHOT" );
339         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
340 
341         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
342         assertEquals( "jar", facet.getPackaging() );
343         assertEquals( "com.example.test", facet.getParent().getGroupId() );
344         assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
345         assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
346         assertEquals( "test-snapshot-artifact-module-a", facet.getArtifactId() );
347         assertEquals( "com.example.test", facet.getGroupId() );
348         assertNull( metadata.getCiManagement() );
349         assertNotNull( metadata.getDescription() );
350 
351         checkApacheLicense( metadata );
352 
353         assertEquals( "1.1-SNAPSHOT", metadata.getId() );
354         assertEquals( "Test Snapshot Artifact :: Module A", metadata.getName() );
355         String path = "test-snapshot-artifact/trunk/test-snapshot-artifact-module-a";
356         assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
357         assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
358         assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
359 
360         List<Dependency> dependencies = metadata.getDependencies();
361         assertEquals( 2, dependencies.size() );
362         assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
363         assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
364 
365         List<String> paths = new ArrayList<>();
366         paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-module-a" );
367         paths.add( "target/test-repositorys/com/example/test/test-snapshot-artifact-root" );
368 
369         deleteTestArtifactWithParent( paths );
370     }
371 
372     @Test
373     public void testGetProjectVersionMetadataWithParentSnapshotVersionAndSnapNotAllowed2()
374         throws Exception
375     {
376         copyTestArtifactWithParent( "target/test-classes/com/example/test/test-artifact-module-b",
377                                     "target/test-repository/com/example/test/test-artifact-module-b" );
378 
379         ReadMetadataRequest readMetadataRequest =
380             new ReadMetadataRequest().repositoryId( TEST_REPO_ID ).namespace( "com.example.test" ).projectId(
381                 "test-artifact-module-b" ).projectVersion( "1.0" );
382 
383         ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( readMetadataRequest );
384 
385         MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID );
386         assertEquals( "jar", facet.getPackaging() );
387         assertEquals( "com.example.test", facet.getParent().getGroupId() );
388         assertEquals( "test-snapshot-artifact-root", facet.getParent().getArtifactId() );
389         assertEquals( "1.1-SNAPSHOT", facet.getParent().getVersion() );
390         assertEquals( "test-artifact-module-b", facet.getArtifactId() );
391         assertEquals( "com.example.test", facet.getGroupId() );
392         assertNull( metadata.getCiManagement() );
393         assertNotNull( metadata.getDescription() );
394 
395         checkApacheLicense( metadata );
396 
397         assertEquals( "1.0", metadata.getId() );
398         assertEquals( "Test Artifact :: Module B", metadata.getName() );
399         String path = "test-snapshot-artifact/trunk/test-artifact-module-b";
400         assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() );
401         assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() );
402         assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() );
403 
404         List<Dependency> dependencies = metadata.getDependencies();
405         assertEquals( 2, dependencies.size() );
406         assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" );
407         assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" );
408 
409         List<String> paths = new ArrayList<>();
410         paths.add( "target/test-repository/com/example/test/test-artifact-module-b" );
411         paths.add( "target/test-repository/com/example/test/test-snapshot-artifact-root" );
412 
413         deleteTestArtifactWithParent( paths );
414     }
415     // Tests for MRM-1411 - END
416 
417     private void assertDependency( Dependency dependency, String groupId, String artifactId, String version )
418     {
419         assertDependency( dependency, groupId, artifactId, version, "compile" );
420     }
421 
422     private void assertDependency( Dependency dependency, String groupId, String artifactId, String version,
423                                    String scope )
424     {
425         assertEquals( artifactId, dependency.getArtifactId() );
426         assertEquals( "jar", dependency.getType() );
427         assertEquals( version, dependency.getVersion() );
428         assertEquals( groupId, dependency.getGroupId() );
429         assertEquals( scope, dependency.getScope() );
430         assertNull( dependency.getClassifier() );
431         assertNull( dependency.getSystemPath() );
432     }
433 
434     private void assertArtifact( ArtifactMetadata artifact, String id, int size, String sha1, String md5 )
435     {
436         assertEquals( id, artifact.getId() );
437         assertEquals( md5, artifact.getMd5() );
438         assertEquals( sha1, artifact.getSha1() );
439         assertEquals( size, artifact.getSize() );
440         assertEquals( "org.codehaus.plexus", artifact.getNamespace() );
441         assertEquals( "plexus-spring", artifact.getProject() );
442         assertEquals( "1.2", artifact.getVersion() );
443         assertEquals( TEST_REPO_ID, artifact.getRepositoryId() );
444     }
445 
446     private void assertMailingList( MailingList mailingList, String name, String archive, String post, String subscribe,
447                                     String unsubscribe, List<String> otherArchives, boolean allowPost )
448     {
449         assertEquals( archive, mailingList.getMainArchiveUrl() );
450         if ( allowPost )
451         {
452             assertEquals( post, mailingList.getPostAddress() );
453         }
454         else
455         {
456             assertNull( mailingList.getPostAddress() );
457         }
458         assertEquals( subscribe, mailingList.getSubscribeAddress() );
459         assertEquals( unsubscribe, mailingList.getUnsubscribeAddress() );
460         assertEquals( name, mailingList.getName() );
461         assertEquals( otherArchives, mailingList.getOtherArchives() );
462     }
463 
464     private void assertMailingList( String prefix, MailingList mailingList, String name, boolean allowPost,
465                                     String nabbleUrl )
466     {
467         List<String> otherArchives = new ArrayList<>();
468         otherArchives.add( "http://www.mail-archive.com/" + prefix + "@archiva.apache.org" );
469         if ( nabbleUrl != null )
470         {
471             otherArchives.add( nabbleUrl );
472         }
473         otherArchives.add( "http://markmail.org/list/org.apache.archiva." + prefix );
474         assertMailingList( mailingList, name, "http://mail-archives.apache.org/mod_mbox/archiva-" + prefix + "/",
475                            prefix + "@archiva.apache.org", prefix + "-subscribe@archiva.apache.org",
476                            prefix + "-unsubscribe@archiva.apache.org", otherArchives, allowPost );
477     }
478 
479     private void checkApacheLicense( ProjectVersionMetadata metadata )
480     {
481         assertEquals( Arrays.asList( new License( "The Apache Software License, Version 2.0",
482                                                   "http://www.apache.org/licenses/LICENSE-2.0.txt" ) ),
483                       metadata.getLicenses() );
484     }
485 
486     private void checkOrganizationApache( ProjectVersionMetadata metadata )
487     {
488         assertEquals( "The Apache Software Foundation", metadata.getOrganization().getName() );
489         assertEquals( "http://www.apache.org/", metadata.getOrganization().getUrl() );
490     }
491 
492     private void deleteTestArtifactWithParent( List<String> pathsToBeDeleted )
493         throws IOException
494     {
495         for ( String path : pathsToBeDeleted )
496         {
497             File dir = new File( FileUtil.getBasedir(), path );
498             FileUtils.deleteDirectory( dir );
499 
500             assertFalse( dir.exists() );
501         }
502         File dest = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-module-a" );
503         File parentPom =
504             new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-parent" );
505         File rootPom = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-root" );
506 
507         FileUtils.deleteDirectory( dest );
508         FileUtils.deleteDirectory( parentPom );
509         FileUtils.deleteDirectory( rootPom );
510 
511         assertFalse( dest.exists() );
512         assertFalse( parentPom.exists() );
513         assertFalse( rootPom.exists() );
514     }
515 
516     private File copyTestArtifactWithParent( String srcPath, String destPath )
517         throws IOException
518     {
519         File src = new File( FileUtil.getBasedir(), srcPath );
520         File dest = new File( FileUtil.getBasedir(), destPath );
521 
522         FileUtils.copyDirectory( src, dest );
523         assertTrue( dest.exists() );
524         return dest;
525     }
526 
527 }