View Javadoc

1   package org.apache.maven.index;
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 java.io.File;
23  import java.util.Collection;
24  
25  /** http://issues.sonatype.org/browse/NEXUS-3233" target="alexandria_uri">http://issues.sonatype.org/browse/NEXUS-3233 */
26  public class Nexus3233NexusIndexerTest
27      extends AbstractNexusIndexerTest
28  {
29      protected File repo = new File( getBasedir(), "src/test/nexus-3233" );
30  
31      @Override
32      protected void prepareNexusIndexer( NexusIndexer nexusIndexer )
33          throws Exception
34      {
35          context =
36              nexusIndexer.addIndexingContext( "nexus-3233", "nexus-3233", repo, indexDir, null, null, FULL_CREATORS );
37          nexusIndexer.scan( context );
38      }
39  
40      public void testIdentifyPomPackagingArtifacts()
41          throws Exception
42      {
43          // POM1
44          Collection<ArtifactInfo> ais = nexusIndexer.identify( MAVEN.SHA1, "741ea3998e6db3ce202d8b88aa53889543f050cc" );
45  
46          assertEquals( 1, ais.size() );
47  
48          ArtifactInfo ai = ais.iterator().next();
49  
50          assertNotNull( ai );
51  
52          assertEquals( "cisco.infra.dft", ai.groupId );
53  
54          assertEquals( "dma.maven.plugins", ai.artifactId );
55  
56          assertEquals( "1.0-SNAPSHOT", ai.version );
57  
58          // POM2
59          ais = nexusIndexer.identify( MAVEN.SHA1, "efb52d4ef65452b4e575fc2e7709595915775857" );
60  
61          assertEquals( 1, ais.size() );
62  
63          ai = ais.iterator().next();
64  
65          assertNotNull( ai );
66  
67          assertEquals( "cisco.infra.dft", ai.groupId );
68  
69          assertEquals( "parent.pom", ai.artifactId );
70  
71          assertEquals( "1.0-SNAPSHOT", ai.version );
72      }
73  }