1 package org.apache.archiva.indexer.search;
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 org.junit.Test;
25 import java.util.Arrays;
26 import java.util.Collections;
27 import java.util.List;
30 * @author Olivier Lamy
32 public class MavenRepositorySearchOSGITest
33 extends AbstractMavenRepositorySearch
37 public void searchFelixWithSymbolicName()
41 createIndex( TEST_REPO_1, Collections.<File>emptyList(), true );
43 List<String> selectedRepos = Arrays.asList( TEST_REPO_1 );
46 archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 );
48 archivaConfigControl.replay();
50 SearchFields searchFields = new SearchFields();
51 searchFields.setBundleSymbolicName( "org.apache.felix.bundlerepository" );
52 searchFields.setBundleVersion( "1.6.6" );
53 searchFields.setRepositories( selectedRepos );
55 SearchResults results = search.search( "user", searchFields, null );
57 archivaConfigControl.verify();
59 assertNotNull( results );
60 assertEquals( 1, results.getTotalHits() );
62 SearchResultHit hit = results.getHits().get( 0 );
63 assertEquals( "org.apache.felix", hit.getGroupId() );
64 assertEquals( "org.apache.felix.bundlerepository", hit.getArtifactId() );
65 assertEquals( "1.6.6", hit.getVersions().get( 0 ) );
67 assertEquals( "org.apache.felix.bundlerepository;uses:=\"org.osgi.framework\";version=\"2.0\"",
68 hit.getBundleExportPackage() );
69 assertEquals( "org.apache.felix.bundlerepository.RepositoryAdmin,org.osgi.service.obr.RepositoryAdmin",
70 hit.getBundleExportService() );
71 assertEquals( "org.apache.felix.bundlerepository", hit.getBundleSymbolicName() );
72 assertEquals( "1.6.6", hit.getBundleVersion() );