This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
172 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...xer-lucene-plugin/src/test/java/org/sonatype/nexus/index/Nexus5525IndexerManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Sonatype Nexus (TM) Open Source Version | ||
* Copyright (c) 2007-2012 Sonatype, Inc. | ||
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, | ||
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. | ||
* | ||
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks | ||
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the | ||
* Eclipse Foundation. All other trademarks are the property of their respective owners. | ||
*/ | ||
package org.sonatype.nexus.index; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
|
||
import org.apache.maven.index.ArtifactInfo; | ||
import org.apache.maven.index.IteratorSearchResponse; | ||
import org.apache.maven.index.SearchType; | ||
import org.junit.Test; | ||
import org.sonatype.nexus.proxy.ResourceStoreRequest; | ||
import org.sonatype.nexus.proxy.maven.MavenHostedRepository; | ||
import org.sonatype.nexus.proxy.maven.packaging.ArtifactPackagingMapper; | ||
import org.sonatype.nexus.proxy.registry.RepositoryRegistry; | ||
|
||
/** | ||
* Custom packaging test. | ||
* | ||
* @author cstamas | ||
*/ | ||
public class Nexus5525IndexerManagerTest | ||
extends AbstractIndexerManagerTest | ||
{ | ||
@Test | ||
public void testDeployOfCustomPackaging() | ||
throws Exception | ||
{ | ||
final File jarFile = getTestFile( "src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.jar" ); | ||
final File pomFile = getTestFile( "src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.pom" ); | ||
final MavenHostedRepository snapshots = | ||
lookup( RepositoryRegistry.class ).getRepositoryWithFacet( "snapshots", MavenHostedRepository.class ); | ||
lookup( ArtifactPackagingMapper.class ).setPropertiesFile( | ||
getTestFile( "src/test/resources/nexus-5525/packaging2extension-mapping.properties" ) ); | ||
|
||
// simulate Maven3 deploy: it happens JAR then POM | ||
snapshots.storeItem( | ||
new ResourceStoreRequest( "/org/sonatype/nexus5525/bundle/1.0-SNAPSHOT/" + jarFile.getName() ), | ||
new FileInputStream( jarFile ), null ); | ||
snapshots.storeItem( | ||
new ResourceStoreRequest( "/org/sonatype/nexus5525/bundle/1.0-SNAPSHOT/" + pomFile.getName() ), | ||
new FileInputStream( pomFile ), null ); | ||
|
||
wairForAsyncEventsToCalmDown(); | ||
|
||
IteratorSearchResponse response = null; | ||
try | ||
{ | ||
// check index | ||
response = | ||
lookup( IndexerManager.class ).searchArtifactIterator( "org.sonatype.nexus5525", "bundle", null, | ||
"bundle", null, snapshots.getId(), null, null, null, false, SearchType.EXACT, null ); | ||
|
||
assertThat( response.getTotalHitsCount(), equalTo( 1 ) ); | ||
final ArtifactInfo ai = response.getResults().next(); | ||
|
||
assertThat( ai.packaging, equalTo( "bundle" ) ); | ||
assertThat( ai.fextension, equalTo( "jar" ) ); | ||
} | ||
finally | ||
{ | ||
if ( response != null ) | ||
{ | ||
response.close(); | ||
} | ||
} | ||
} | ||
} |
Binary file added
BIN
+3.62 KB
...exus-indexer-lucene-plugin/src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.jar
Binary file not shown.
88 changes: 88 additions & 0 deletions
88
...exus-indexer-lucene-plugin/src/test/resources/nexus-5525/bundle-1.0-20130318.131408-1.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<!-- | ||
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. | ||
--> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.sonatype.nexus5525</groupId> | ||
<artifactId>bundle</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>bundle</packaging> | ||
|
||
<name>bundle Bundle</name> | ||
<description> | ||
bundle OSGi bundle project. | ||
</description> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>nexus</id> | ||
<name>Releases</name> | ||
<url>http://localhost:8081/nexus/content/repositories/releases/</url> | ||
<layout>default</layout> | ||
</repository> | ||
<snapshotRepository> | ||
<id>nexus</id> | ||
<name>Snapshots</name> | ||
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url> | ||
<layout>default</layout> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<properties> | ||
<maven-bundle-plugin.version>2.3.7</maven-bundle-plugin.version> | ||
<osgi.version>4.3.1</osgi.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>org.osgi.core</artifactId> | ||
<version>${osgi.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.felix</groupId> | ||
<artifactId>maven-bundle-plugin</artifactId> | ||
<version>${maven-bundle-plugin.version}</version> | ||
<extensions>true</extensions> | ||
<configuration> | ||
<instructions> | ||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> | ||
<Bundle-Version>${project.version}</Bundle-Version> | ||
<Bundle-Activator>org.sonatype.nexus5525.Activator</Bundle-Activator> | ||
<Export-Package> | ||
org.sonatype.nexus5525*;version=${project.version} | ||
</Export-Package> | ||
<Import-Package> | ||
* | ||
</Import-Package> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
3 changes: 3 additions & 0 deletions
3
...ndexer-lucene-plugin/src/test/resources/nexus-5525/packaging2extension-mapping.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Extra mappings | ||
|
||
bundle=jar |