Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Weber2014-06-02 06:55:34 -0400
committerJan Sievers2014-08-19 10:22:27 -0400
commitee45d8b04f1c08aebf69b000f32bb9a2a146e33b (patch)
tree1d2e2143cd6c1eb70401f6a1b873db3aa5437511
parent6ae8b7a22d82ab10928c3937977cdd7cec40bb9f (diff)
downloadorg.eclipse.tycho.nexus-ee45d8b04f1c08aebf69b000f32bb9a2a146e33b.tar.gz
org.eclipse.tycho.nexus-ee45d8b04f1c08aebf69b000f32bb9a2a146e33b.tar.xz
org.eclipse.tycho.nexus-ee45d8b04f1c08aebf69b000f32bb9a2a146e33b.zip
432793 Unzip Repository Plugin for Nexus OSS 2.9.0
- works with nexus versions from 2.8.0-05 to 2.9.0-04 - Changed all Google-Guice to Java inject annotations. - Load unzip-repo.js as a Nexus WebResource and implements the default UiContributor to load this js and the unzip-repository-plugin-boot.js instead of loading the defaults resources. - for backward compatibility DefaultUnzipRepository must be @Typed(UnzipRepository.class) - delayed registration of unzip repos that have a group as master via configuration. Integration tests check that. Bug: 432793 Change-Id: I625f1046f3c0ef0e6e924405c5e4b2593c9685fb Signed-off-by: Stephan Weber <stephan.weber@sap.com> Also-by: Angel Lopez-Cima <angellopezcima@hotmail.com>
-rw-r--r--pom.xml45
-rw-r--r--unzip-repository-plugin-its/pom.xml4
-rw-r--r--unzip-repository-plugin/pom.xml90
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepository.java130
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipPlugin.java30
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryConfigurator.java12
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryHtmlCustomizer.java41
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryResourceBundle.java31
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryTemplateProvider.java17
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipUiContributor.java32
-rw-r--r--unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCache.java26
-rw-r--r--unzip-repository-plugin/src/main/resources/resources/js/unzip-repo.js46
-rw-r--r--unzip-repository-plugin/src/main/resources/static/js/unzip-repo.js54
-rw-r--r--unzip-repository-plugin/src/main/resources/static/js/unzip-repository-plugin-boot.js16
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryAgainstHostedRepositoryTest.java24
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryTest.java14
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCacheTest.java81
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/storage/ZippedItemTest.java12
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/RepositoryMock.java8
-rw-r--r--unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/UnzipRepositoryMock.java18
20 files changed, 374 insertions, 357 deletions
diff --git a/pom.xml b/pom.xml
index 7b73cb5..ca64885 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - Copyright (c) 2010, 2013 SAP AG and others.
+ - Copyright (c) 2010, 2014 SAP SE and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- - SAP AG - initial API and implementation
+ - SAP SE - initial API and implementation
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<groupId>org.eclipse.tycho.nexus</groupId>
<artifactId>unzip-repository-plugin-parent</artifactId>
<version>0.14.0-SNAPSHOT</version>
@@ -27,7 +26,7 @@
</scm>
<ciManagement>
<system>hudson</system>
- <url>https://hudson.eclipse.org/hudson</url>
+ <url>https://hudson.eclipse.org/tycho</url>
</ciManagement>
<licenses>
<license>
@@ -71,11 +70,11 @@
<properties>
<!-- nexus version we compile against -->
- <nexus.version>2.7.0-01</nexus.version>
+ <nexus.version>2.8.0-05</nexus.version>
<!-- minimum nexus version to run ITs against -->
<nexus.test.min.version>${nexus.version}</nexus.test.min.version>
<!-- maximum nexus version to run ITs against -->
- <nexus.test.max.version>2.7.2-03</nexus.test.max.version>
+ <nexus.test.max.version>2.9.0-04</nexus.test.max.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
@@ -95,24 +94,24 @@
<modules>
<module>unzip-repository-plugin</module>
- <module>unzip-repository-plugin-its</module>
+ <module>unzip-repository-plugin-its</module>
</modules>
<dependencyManagement>
<dependencies>
- <!-- plexus-utils are provided by Nexus -> mark as "provided", otherwise
- they will be packaged into the plugin archive and this can lead to runtime
- version mismatches! -->
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>2.0.5</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
- <version>3.0.4</version>
+ <version>3.0.5</version>
+ </dependency>
+ <!-- avoid maven-artifact dragging in plexus-utils. plexus-utils is provided by Nexus -> mark as "provided", otherwise
+ they will be packaged into the plugin archive and this can lead to runtime
+ version mismatches! -->
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>2.0.6</version>
+ <scope>provided</scope>
</dependency>
<!-- Main plugin API, pulling in what is needed -->
<dependency>
@@ -121,6 +120,12 @@
<version>${nexus.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-ui-extjs3-plugin</artifactId>
+ <version>${nexus.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.sonatype.nexus</groupId>
@@ -160,6 +165,12 @@
<target>1.7</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-bundle-maven-plugin</artifactId>
+ <version>1.2</version>
+ <extensions>true</extensions>
+ </plugin>
</plugins>
</pluginManagement>
</build>
diff --git a/unzip-repository-plugin-its/pom.xml b/unzip-repository-plugin-its/pom.xml
index 5e4ef40..94e61ba 100644
--- a/unzip-repository-plugin-its/pom.xml
+++ b/unzip-repository-plugin-its/pom.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - Copyright (c) 2013 SAP AG and others.
+ - Copyright (c) 2010, 2014 SAP SE and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- - SAP AG - initial API and implementation
+ - SAP SE - initial API and implementation
-->
<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/maven-v4_0_0.xsd">
diff --git a/unzip-repository-plugin/pom.xml b/unzip-repository-plugin/pom.xml
index 028966a..42faa23 100644
--- a/unzip-repository-plugin/pom.xml
+++ b/unzip-repository-plugin/pom.xml
@@ -1,24 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - Copyright (c) 2010, 2013 SAP AG and others.
+ - Copyright (c) 2010, 2014 SAP SE and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- - SAP AG - initial API and implementation
+ - SAP SE - initial API and implementation
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.eclipse.tycho.nexus</groupId>
<artifactId>unzip-repository-plugin-parent</artifactId>
<version>0.14.0-SNAPSHOT</version>
</parent>
-
<artifactId>unzip-repository-plugin</artifactId>
<name>Nexus Unzip Plugin (Incubation)</name>
@@ -32,6 +30,12 @@
<dependency>
<groupId>org.sonatype.nexus</groupId>
<artifactId>nexus-plugin-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-ui-extjs3-plugin</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -44,89 +48,17 @@
<dependency>
<groupId>org.sonatype.nexus</groupId>
<artifactId>nexus-test-common</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
- <!-- Needed for custom packaging -->
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>app-lifecycle-maven-plugin</artifactId>
- <version>1.7</version>
- <extensions>true</extensions>
- <dependencies>
- <dependency>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>app-lifecycle-nexus</artifactId>
- <version>1.7</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.2.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!-- Generate components.xml to use Plexus style of dependency injection -->
<plugin>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-metadata</artifactId>
- <version>1.5.5</version>
- <executions>
- <execution>
- <id>process-classes</id>
- <goals>
- <goal>generate-metadata</goal>
- </goals>
- </execution>
- <execution>
- <id>process-test-classes</id>
- <goals>
- <goal>generate-test-metadata</goal>
- </goals>
- </execution>
- </executions>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-bundle-maven-plugin</artifactId>
</plugin>
</plugins>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>app-lifecycle-maven-plugin</artifactId>
- <goals>
- <goal>check-dependencies</goal>
- <goal>generate-metadata</goal>
- </goals>
- <versionRange>[1.0,)</versionRange>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
</build>
</project>
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepository.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepository.java
index 550dd8e..512f0ab 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepository.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepository.java
@@ -1,32 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
+ * Angel Lopez-Cima - convert from plexus to javax.inject annotations (bug 432793)
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
import java.io.File;
import java.util.Arrays;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
+import javax.enterprise.inject.Typed;
+import javax.inject.Inject;
+import javax.inject.Named;
+
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.sisu.Description;
import org.eclipse.tycho.nexus.internal.plugin.cache.ConversionResult;
import org.eclipse.tycho.nexus.internal.plugin.cache.RequestPathConverter;
import org.eclipse.tycho.nexus.internal.plugin.cache.UnzipCache;
import org.eclipse.tycho.nexus.internal.plugin.storage.Util;
import org.eclipse.tycho.nexus.internal.plugin.storage.ZipAwareStorageCollectionItem;
import org.eclipse.tycho.nexus.internal.plugin.storage.ZippedItem;
+import org.slf4j.Logger;
+import org.sonatype.configuration.ConfigurationException;
import org.sonatype.nexus.ApplicationStatusSource;
import org.sonatype.nexus.SystemState;
-import org.sonatype.nexus.configuration.Configurator;
import org.sonatype.nexus.configuration.model.CRepository;
import org.sonatype.nexus.configuration.model.CRepositoryExternalConfigurationHolderFactory;
+import org.sonatype.nexus.plugins.RepositoryType;
import org.sonatype.nexus.proxy.IllegalOperationException;
import org.sonatype.nexus.proxy.ItemNotFoundException;
import org.sonatype.nexus.proxy.LocalStorageException;
@@ -38,6 +44,8 @@ import org.sonatype.nexus.proxy.item.StorageCollectionItem;
import org.sonatype.nexus.proxy.item.StorageItem;
import org.sonatype.nexus.proxy.item.StorageLinkItem;
import org.sonatype.nexus.proxy.registry.ContentClass;
+import org.sonatype.nexus.proxy.registry.RepositoryRegistry;
+import org.sonatype.nexus.proxy.repository.AbstractRepositoryConfigurator;
import org.sonatype.nexus.proxy.repository.AbstractShadowRepository;
import org.sonatype.nexus.proxy.repository.DefaultRepositoryKind;
import org.sonatype.nexus.proxy.repository.IncompatibleMasterRepositoryException;
@@ -60,39 +68,39 @@ import com.google.common.eventbus.Subscribe;
* 2. files and folders in an archive can be browsed under the path of the archive + slash + path
* within archive
*/
-/*
- * Within Nexus 1.6 the plugin worked without the annotation. Within Nexus 1.7 is still working, but
- * a warning is logged that the plugin misses to register it's type correctly.
- *
- * Reference: Nexus Book - Chapter 18. Developing Nexus Plugins -
- * http://www.sonatype.com/books/nexus-book/reference/plugdev.html The documentation describes to
- * tag the repository interface (UnzipRepository) with the RepositoryType annotation. This does not
- * work as described. (Neither with 1.6, nor with 1.7) Tagging the implementation class works in
- * Nexus 1.7 as described. (incl. the promised repository appearance in .../nexus/content..) Within
- * Nexus 1.6 an exception will be logged during startup, but the plugin still works functional
- * correct.
- */
-@Component(role = UnzipRepository.class, hint = DefaultUnzipRepository.REPOSITORY_HINT, instantiationStrategy = "per-lookup", description = "Unzip Repository")
+@Named(DefaultUnzipRepository.REPOSITORY_HINT)
+@Description("Unzip Repository")
+@Typed(UnzipRepository.class)
+@RepositoryType(pathPrefix = "unzip")
public class DefaultUnzipRepository extends AbstractShadowRepository implements UnzipRepository {
static final String REPOSITORY_HINT = "org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository";
- @Requirement
- private UnzipRepositoryConfigurator configurator;
+ private final UnzipRepositoryConfigurator configurator;
- @Requirement(hint = "maven2")
- private ContentClass contentClass;
+ private final ContentClass contentClass;
- @Requirement(hint = "maven2")
- private ContentClass masterContentClass;
+ private final ContentClass masterContentClass;
- @Requirement
- private ApplicationStatusSource statusSource;
+ private final ApplicationStatusSource statusSource;
private RepositoryKind repositoryKind;
private UnzipCache cache;
private boolean processedNexusStartedEvent = false;
private boolean isMasterAvailable = false;
+ private final RepositoryRegistry repositoryRegistry;
+
+ @Inject
+ public DefaultUnzipRepository(final RepositoryRegistry repositoryRegistry,
+ final UnzipRepositoryConfigurator configurator, @Named("maven2") final ContentClass contentClass,
+ @Named("maven2") final ContentClass masterContentClass, final ApplicationStatusSource statusSource) {
+ this.repositoryRegistry = repositoryRegistry;
+ this.configurator = configurator;
+ this.contentClass = contentClass;
+ this.masterContentClass = masterContentClass;
+ this.statusSource = statusSource;
+ }
+
// If a class instance of DefaultUnzipRepository is created before Nexus startup finished the field statusSource gets
// and keeps an invalid proxy instance from plexus which always throws an IllegalStateException if being asked
// for the current Nexus state. All these instances get the NexusStartedEvent and with it set the MasterRepository
@@ -100,8 +108,8 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
// This is true for all unzip repositories being listed in the nexus.xml file on startup.
//
// If a class instance of DefaultUnzipRepository is created e.g. from the UI after Nexus startup finished it
- // won't ever get a NexusStartedEvent so for these DefaultUnzipRepository instances the field
- // processedNexusStartedEvent will always be false. But the field statusSource is now valid and we can ask for the
+ // won't ever get a NexusStartedEvent so for these DefaultUnzipRepository instances the field
+ // processedNexusStartedEvent will always be false. But the field statusSource is now valid and we can ask for the
// correct state.
private boolean isNexusStarted() {
if (processedNexusStartedEvent) {
@@ -117,7 +125,7 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
}
@Override
- protected Configurator getConfigurator() {
+ protected AbstractRepositoryConfigurator getConfigurator() {
return configurator;
}
@@ -152,10 +160,10 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
}
/*
- * Need to overwrite setMasterRepositoryId(String id) getMasterRepository() getLocalStatus()
- * onEvent(Event<?> evt) in order to allow Unzip repositories in front of repository groups.
- * During Nexus startup repository creation repository groups are explicitly created AFTER all
- * other repositories. see
+ * Need to overwrite setMasterRepository(final Repository masterRepository),
+ * getMasterRepository(), getLocalStatus() onEvent(Event<?> evt), doConfigure() in order to
+ * allow Unzip repositories in front of repository groups. During Nexus startup repository
+ * creation repository groups are explicitly created AFTER all other repositories. see
* org.sonatype.nexus.configuration.application.DefaultNexusConfiguration#createRepositories()
* As a result at creation time of this repository the master is not yet available in case the
* master is a group. After Nexus startup is complete all methods behave like default. In the
@@ -163,24 +171,6 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
* avoiding error logs.
*/
@Override
- public void setMasterRepositoryId(final String id) throws NoSuchRepositoryException,
- IncompatibleMasterRepositoryException {
- try {
- Repository repository = getRepositoryRegistry().getRepository(id);
- super.setMasterRepository(repository);
- isMasterAvailable = true;
- } catch (final NoSuchRepositoryException e) {
- if (isNexusStarted()) {
- throw e;
- } else {
- // NoSuchRepositoryException yet. Just remember the id
- getExternalConfiguration(true).setMasterRepositoryId(id);
- }
- }
- }
-
- // see comment at setMasterRepositoryId(String id)
- @Override
public void setMasterRepository(final Repository masterRepository) throws IncompatibleMasterRepositoryException {
super.setMasterRepository(masterRepository);
isMasterAvailable = true;
@@ -193,7 +183,6 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
return super.getMasterRepository();
}
return null;
-
}
// see comment at setMasterRepositoryId(String id)
@@ -218,23 +207,46 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
if (!isMasterAvailable) {
String repositoryId = getExternalConfiguration(false).getMasterRepositoryId();
try {
- setMasterRepositoryId(repositoryId);
- } catch (NoSuchRepositoryException e) {
- getLogger().error("[" + repositoryId + "] " + "cannot set master repository " + e.getMessage());
-
+ reallyDoConfigure();
} catch (IncompatibleMasterRepositoryException e) {
getLogger().error("[" + repositoryId + "] " + "cannot set master repository " + e.getMessage());
+ } catch (ConfigurationException e) {
+ getLogger().error("[" + repositoryId + "] " + "cannot configure " + e.getMessage());
}
}
processedNexusStartedEvent = true;
}
+ @Override
+ protected void doConfigure() throws ConfigurationException {
+ final String repositoryId = getExternalConfiguration(false).getMasterRepositoryId();
+ try {
+ getRepositoryRegistry().getRepository(repositoryId);
+ reallyDoConfigure();
+ } catch (final NoSuchRepositoryException e) {
+ getLogger().warn("Repository '" + repositoryId + "' not yet present. doConfigure skipped.");
+ }
+ }
+
+ private void reallyDoConfigure() throws ConfigurationException {
+ super.doConfigure();
+ }
+
+ protected Logger getLogger() {
+ return this.log;
+ }
+
+ protected RepositoryRegistry getRepositoryRegistry() {
+ return this.repositoryRegistry;
+ }
+
@Subscribe
public void onRepositoryRegistryEventAdd(RepositoryRegistryEventAdd evt) {
final String eventRepositoryId = evt.getRepository().getId();
if (super.getMasterRepository() != null && eventRepositoryId.equals(super.getMasterRepository().getId())) {
try {
- setMasterRepositoryId(eventRepositoryId);
+ final Repository masterRepository = getRepositoryRegistry().getRepository(eventRepositoryId);
+ setMasterRepository(masterRepository);
} catch (final NoSuchRepositoryException e) {
getLogger().warn("Master Repository not available", e);
} catch (final IncompatibleMasterRepositoryException e) {
@@ -245,7 +257,7 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
/**
* Retrieves an item from the master repository.
- *
+ *
* @param requestPath
* the path to the item be retrieved from the master repository
* @param originalRequest
@@ -324,7 +336,7 @@ public class DefaultUnzipRepository extends AbstractShadowRepository implements
* Checks if the request path represents a zipped item (a file or directory within a zip file)
* and if yes returns it. If the request path does not represent a zipped item <code>null</code>
* is returned
- *
+ *
* @param conversionResult
* the result of the snapshot path conversion, containing the converted path
* @param request
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipPlugin.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipPlugin.java
new file mode 100644
index 0000000..31e774b
--- /dev/null
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipPlugin.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Angel Lopez-Cima and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angel Lopez-Cima - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.nexus.internal.plugin;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.sisu.EagerSingleton;
+import org.sonatype.nexus.plugin.PluginIdentity;
+
+/**
+ * @since 0.14.0
+ */
+@Named
+@EagerSingleton
+public class UnzipPlugin extends PluginIdentity {
+
+ @Inject
+ public UnzipPlugin() throws Exception {
+ super("org.eclipse.tycho.nexus", "unzip-repository-plugin");
+ }
+}
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryConfigurator.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryConfigurator.java
index 2f83b61..9518096 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryConfigurator.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryConfigurator.java
@@ -1,16 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
+ * Angel Lopez-Cima - convert from plexus to javax.inject annotations (bug 432793)
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
-import org.codehaus.plexus.component.annotations.Component;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
import org.sonatype.configuration.ConfigurationException;
import org.sonatype.nexus.configuration.ExternalConfiguration;
import org.sonatype.nexus.configuration.application.ApplicationConfiguration;
@@ -18,7 +21,8 @@ import org.sonatype.nexus.configuration.model.CRepositoryCoreConfiguration;
import org.sonatype.nexus.proxy.repository.AbstractShadowRepositoryConfigurator;
import org.sonatype.nexus.proxy.repository.Repository;
-@Component(role = UnzipRepositoryConfigurator.class)
+@Named
+@Singleton
public class UnzipRepositoryConfigurator extends AbstractShadowRepositoryConfigurator {
@Override
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryHtmlCustomizer.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryHtmlCustomizer.java
deleted file mode 100644
index d2ef5a7..0000000
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryHtmlCustomizer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * SAP AG - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tycho.nexus.internal.plugin;
-
-import org.codehaus.plexus.component.annotations.Component;
-import org.sonatype.nexus.plugins.rest.AbstractNexusIndexHtmlCustomizer;
-import org.sonatype.nexus.plugins.rest.NexusIndexHtmlCustomizer;
-
-@Component(role = NexusIndexHtmlCustomizer.class, hint = "UnzipRepositoryHtmlCustomizer")
-public class UnzipRepositoryHtmlCustomizer extends AbstractNexusIndexHtmlCustomizer {
- /*
- * Normally this script tag should be inserted into the head of the page using
- * getPostHeadContribution, BUT as with the current nexus plugin system it is possible that
- * other plug-ins overwrite the already overwritten JS function with code only fitting to their
- * usage type, e.g. the OBR plug-in of Nexus Pro enhances the Virtual Repository Editor.
- *
- * By writing it in the first part of the Body we ensure for now, that our script is loaded as
- * last one. Works only as long as we are the only one doing this so. The script provided with
- * this ensures that other repository type can still select all available repositories without
- * filtering.
- *
- * Overall this can't be the final solution, possibly it is neccessary to update the way users
- * enhance the Nexus UI in general. In particular useful would be if you can define filtering of
- * choosable repositories for a specific repository type already in the nexus repository model.
- */
- @Override
- public String getPreBodyContribution(final java.util.Map<String, Object> context) {
- final String version = getVersionFromJarFile("/META-INF/maven/org.eclipse.tycho.nexus/unzip-repository-plugin/pom.properties");
-
- return "<script src=\"" + UnzipRepositoryResourceBundle.JS_SCRIPT_PATH + (version == null ? "" : "?" + version)
- + "\" type=\"text/javascript\" charset=\"utf-8\"></script>";
- }
-}
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryResourceBundle.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryResourceBundle.java
index 13afda5..8ee3184 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryResourceBundle.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryResourceBundle.java
@@ -1,32 +1,39 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
+ * Angel Lopez-Cima - convert from plexus to javax.inject annotations (bug 432793)
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
import java.util.ArrayList;
import java.util.List;
-import org.codehaus.plexus.component.annotations.Component;
-import org.sonatype.nexus.plugins.rest.DefaultStaticResource;
-import org.sonatype.nexus.plugins.rest.NexusResourceBundle;
-import org.sonatype.nexus.plugins.rest.StaticResource;
+import javax.inject.Named;
+import javax.inject.Singleton;
-@Component(role = NexusResourceBundle.class, hint = "UnzipRepositoryResourceBundle")
-public class UnzipRepositoryResourceBundle implements NexusResourceBundle {
+import org.sonatype.nexus.plugin.support.UrlWebResource;
+import org.sonatype.nexus.web.WebResource;
+import org.sonatype.nexus.web.WebResourceBundle;
+
+@Named("UnzipRepositoryResourceBundle")
+@Singleton
+public class UnzipRepositoryResourceBundle implements WebResourceBundle {
public static final String JS_SCRIPT_PATH = "js/unzip/unzip-repo.js";
+ public static final String JS_SCRIPT_BOOT_PATH = "unzip-repository-plugin-boot.js";
- public List<StaticResource> getContributedResouces() {
- final List<StaticResource> result = new ArrayList<StaticResource>();
+ public List<WebResource> getResources() {
+ final List<WebResource> result = new ArrayList<WebResource>();
- result.add(new DefaultStaticResource(getClass().getResource("/resources/js/unzip-repo.js"), "/"
- + JS_SCRIPT_PATH, "application/x-javascript"));
+ result.add(new UrlWebResource(getClass().getResource("/static/js/unzip-repo.js"), "/" + JS_SCRIPT_PATH,
+ "application/x-javascript"));
+ result.add(new UrlWebResource(getClass().getResource("/static/js/unzip-repository-plugin-boot.js"), "/"
+ + JS_SCRIPT_BOOT_PATH, "application/x-javascript"));
return result;
}
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryTemplateProvider.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryTemplateProvider.java
index b55db53..51c5b9c 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryTemplateProvider.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipRepositoryTemplateProvider.java
@@ -1,29 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
+ * Angel Lopez-Cima - convert from plexus to javax.inject annotations (bug 432793)
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
-import org.codehaus.plexus.component.annotations.Component;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
import org.sonatype.nexus.templates.TemplateProvider;
import org.sonatype.nexus.templates.TemplateSet;
import org.sonatype.nexus.templates.repository.AbstractRepositoryTemplateProvider;
// Alike org.sonatype.nexus.templates.repository.DefaultRepositoryTemplateProvider
-@Component(role = TemplateProvider.class, hint = "unzipRepo-templates")
-public class UnzipRepositoryTemplateProvider extends AbstractRepositoryTemplateProvider {
+@Named(UnzipRepositoryTemplateProvider.PROVIDER_ID)
+@Singleton
+public class UnzipRepositoryTemplateProvider extends AbstractRepositoryTemplateProvider implements TemplateProvider {
+ static final String PROVIDER_ID = "unzipRepo-templates";
@Override
public TemplateSet getTemplates() {
final TemplateSet templates = new TemplateSet(null);
- final String templateId = "unzipRepo-template";
+ final String templateId = PROVIDER_ID;
final String templateDescription = "Unzip Repository Template";
templates.add(new UnzipRepositoryTemplate(this, templateId, templateDescription));
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipUiContributor.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipUiContributor.java
new file mode 100644
index 0000000..071973a
--- /dev/null
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/UnzipUiContributor.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Angel Lopez-Cima and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Angel Lopez-Cima - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.nexus.internal.plugin;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.sonatype.nexus.plugins.ui.contribution.UiContributionBuilder;
+import org.sonatype.nexus.plugins.ui.contribution.UiContributorSupport;
+
+@Named
+@Singleton
+public class UnzipUiContributor extends UiContributorSupport {
+ @Inject
+ public UnzipUiContributor(final UnzipPlugin owner) {
+ super(owner);
+ }
+
+ protected void customize(final UiContributionBuilder builder) {
+ builder.withDependency(UnzipRepositoryResourceBundle.JS_SCRIPT_PATH);
+ builder.withDependency(UnzipRepositoryResourceBundle.JS_SCRIPT_BOOT_PATH);
+ }
+}
diff --git a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCache.java b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCache.java
index dc11828..ee9426f 100644
--- a/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCache.java
+++ b/unzip-repository-plugin/src/main/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCache.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin.cache;
@@ -26,11 +26,11 @@ import org.sonatype.nexus.proxy.item.StorageItem;
import org.sonatype.nexus.proxy.storage.UnsupportedStorageOperationException;
import org.sonatype.nexus.proxy.storage.local.LocalRepositoryStorage;
import org.sonatype.nexus.proxy.storage.local.fs.DefaultFSLocalRepositoryStorage;
-import org.sonatype.nexus.util.ItemPathUtils;
+import org.sonatype.nexus.util.PathUtils;
public class UnzipCache {
- private final DefaultUnzipRepository repository;
+ final DefaultUnzipRepository repository;
private final LocalRepositoryStorage localStorage;
private final Logger logger;
@@ -43,16 +43,16 @@ public class UnzipCache {
/**
* Returns the requested artifact from the local storage if the artifact was already cached. If
* not it retrieves it from the corresponding repository and stores it in the local storage.
- *
+ *
* @param zipItemPath
* the path to the zip file
* @return the file in the local storage
- *
+ *
* @throws ItemNotFoundException
* thrown if the artifact cannot be found in the repository
- *
+ *
* @throws LocalStorageException
- *
+ *
*/
public File getArchive(final String zipItemPath) throws ItemNotFoundException, LocalStorageException {
final PathLockMonitor folderLock = PathLock.getLock(getRequestPathParent(zipItemPath));
@@ -78,13 +78,13 @@ public class UnzipCache {
/**
* Depending on the conversion result out-dated snapshots are removed from the storage, if
* possible.
- *
- *
+ *
+ *
* @param conversionResult
* if a snapshot conversion took place, old snapshot artifacts are removed from the
* cache. If no snapshot has been found, all snapshot artifacts are removed from the
* cache
- *
+ *
* @throws ItemNotFoundException
* thrown if the artifact cannot be found in the repository
*/
@@ -123,7 +123,7 @@ public class UnzipCache {
// do nothing, as we accept if the file cannot be deleted
} catch (final ItemNotFoundException e) {
// do nothing, as we accept that files might be deleted on OS level
- // e,g localStorage.listItems(repository, parentPathRequest) throws this exception in case
+ // e,g localStorage.listItems(repository, parentPathRequest) throws this exception in case
// the parent folder was removed from the file system
} finally {
PathLock.releaseLock(folderLock);
@@ -132,7 +132,7 @@ public class UnzipCache {
}
private static String getRequestPathParent(final String path) {
- return ItemPathUtils.getParentPath(path) + ItemPathUtils.PATH_SEPARATOR;
+ return PathUtils.getParentPath(path) + PathUtils.PATH_SEPARATOR;
}
private StorageItem retrieveItemFromMaster(final ResourceStoreRequest masterRepositoryRequest)
diff --git a/unzip-repository-plugin/src/main/resources/resources/js/unzip-repo.js b/unzip-repository-plugin/src/main/resources/resources/js/unzip-repo.js
deleted file mode 100644
index 77fb7e9..0000000
--- a/unzip-repository-plugin/src/main/resources/resources/js/unzip-repo.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-Ext.override(Sonatype.repoServer.VirtualRepositoryEditor, {
- afterProviderSelectHandler: function (combo, rec, index) {
- var provider = rec.data.provider;
- var sourceRepoCombo = this.form.findField("shadowOf");
- sourceRepoCombo.clearValue();
- sourceRepoCombo.focus();
- if (provider == "m1-m2-shadow") {
- sourceRepoCombo.store.filterBy(function fn(rec, id) {
- if (rec.data.repoType != "virtual" && rec.data.format == "maven1") {
- return true
- }
- return false
- })
- } else if (provider == "m2-m1-shadow") {
- sourceRepoCombo.store.filterBy(function fn(rec, id) {
- if (rec.data.repoType != "virtual" && rec.data.format == "maven2") {
- return true
- }
- return false
- })
- } else if (provider == "org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository") {
- sourceRepoCombo.store.filterBy(function fn(rec, id) {
- if (rec.data.format == "maven2") {
- return true
- }
- return false
- })
- } else {
- sourceRepoCombo.store.filterBy(function fn(rec, id) {
- return true
- })
- }
- }
-}); \ No newline at end of file
diff --git a/unzip-repository-plugin/src/main/resources/static/js/unzip-repo.js b/unzip-repository-plugin/src/main/resources/static/js/unzip-repo.js
new file mode 100644
index 0000000..eff4f73
--- /dev/null
+++ b/unzip-repository-plugin/src/main/resources/static/js/unzip-repo.js
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+define('Sonatype/repoServer/unzipRepositoryEditContribution', function() {
+
+ (function() {
+ var originalHandler = Sonatype.repoServer.VirtualRepositoryEditor.prototype.afterProviderSelectHandler;
+
+ Ext.override(Sonatype.repoServer.VirtualRepositoryEditor, {
+ afterProviderSelectHandler: function (combo, rec, index) {
+ var provider = rec.data.provider;
+ var sourceRepoCombo = this.form.findField("shadowOf");
+ sourceRepoCombo.clearValue();
+ sourceRepoCombo.focus();
+ if (provider == "m1-m2-shadow") {
+ sourceRepoCombo.store.filterBy(function fn(rec, id) {
+ if (rec.data.repoType != "virtual" && rec.data.format == "maven1") {
+ return true
+ }
+ return false
+ })
+ } else if (provider == "m2-m1-shadow") {
+ sourceRepoCombo.store.filterBy(function fn(rec, id) {
+ if (rec.data.repoType != "virtual" && rec.data.format == "maven2") {
+ return true
+ }
+ return false
+ })
+ } else if (provider == "org.eclipse.tycho.nexus.plugin.DefaultUnzipRepository") {
+ sourceRepoCombo.store.filterBy(function fn(rec, id) {
+ if (rec.data.format == "maven2") {
+ return true
+ }
+ return false
+ })
+ } else {
+ sourceRepoCombo.store.filterBy(function fn(rec, id) {
+ return true
+ })
+ }
+ }
+ });
+ })();
+});
+
diff --git a/unzip-repository-plugin/src/main/resources/static/js/unzip-repository-plugin-boot.js b/unzip-repository-plugin/src/main/resources/static/js/unzip-repository-plugin-boot.js
new file mode 100644
index 0000000..abbdfb1
--- /dev/null
+++ b/unzip-repository-plugin/src/main/resources/static/js/unzip-repository-plugin-boot.js
@@ -0,0 +1,16 @@
+/*
+ * Sonatype Nexus (TM) Open Source Version
+ * Copyright (c) 2007-2014 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.
+ */
+/*global Ext, Sonatype, Nexus*/
+define('unzip-repository-plugin-boot', [
+ 'Sonatype/repoServer/unzipRepositoryEditContribution'
+]); \ No newline at end of file
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryAgainstHostedRepositoryTest.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryAgainstHostedRepositoryTest.java
index 631a6e3..d557944 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryAgainstHostedRepositoryTest.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryAgainstHostedRepositoryTest.java
@@ -1,17 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
-import java.io.IOException;
-
import org.eclipse.tycho.nexus.internal.plugin.storage.Util;
import org.eclipse.tycho.nexus.internal.plugin.storage.ZipAwareStorageCollectionItem;
import org.eclipse.tycho.nexus.internal.plugin.test.RepositoryMock;
@@ -19,16 +17,10 @@ import org.eclipse.tycho.nexus.internal.plugin.test.TestUtil;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Test;
-import org.sonatype.nexus.proxy.AccessDeniedException;
-import org.sonatype.nexus.proxy.IllegalOperationException;
-import org.sonatype.nexus.proxy.ItemNotFoundException;
-import org.sonatype.nexus.proxy.NoSuchResourceStoreException;
import org.sonatype.nexus.proxy.ResourceStoreRequest;
-import org.sonatype.nexus.proxy.item.RepositoryItemUidFactory;
import org.sonatype.nexus.proxy.item.StorageCollectionItem;
import org.sonatype.nexus.proxy.item.StorageItem;
-import org.sonatype.nexus.proxy.item.uid.RepositoryItemUidAttributeManager;
-import org.sonatype.nexus.util.ItemPathUtils;
+import org.sonatype.nexus.util.PathUtils;
/**
* Tests the DefaultUnzipRepository with a hosted repository as master repository.
@@ -41,8 +33,7 @@ public class DefaultUnzipRepositoryAgainstHostedRepositoryTest extends DefaultUn
}
@Test
- public void testRetrieveCollection() throws ItemNotFoundException, IllegalOperationException, IOException,
- AccessDeniedException, NoSuchResourceStoreException {
+ public void testRetrieveCollecton() throws Exception {
final String collectionPath = "/dir";
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath));
Assert.assertTrue(item instanceof ZipAwareStorageCollectionItem);
@@ -52,13 +43,12 @@ public class DefaultUnzipRepositoryAgainstHostedRepositoryTest extends DefaultUn
}
@Test
- public void testRetrieveCollectionWithTrailingSlash() throws ItemNotFoundException, IllegalOperationException,
- IOException, AccessDeniedException, NoSuchResourceStoreException {
+ public void testRetrieveCollectionWithTrailingSlash() throws Exception {
final String collectionPath = "/dir/";
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath));
Assert.assertTrue(item instanceof ZipAwareStorageCollectionItem);
final StorageCollectionItem collectionItem = (StorageCollectionItem) item;
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
TestUtil.assertMembers(new String[] { "/dir/subdir" }, new String[0], collectionItem.list());
}
@@ -82,7 +72,7 @@ public class DefaultUnzipRepositoryAgainstHostedRepositoryTest extends DefaultUn
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath));
Assert.assertTrue(item instanceof ZipAwareStorageCollectionItem);
final StorageCollectionItem collectionItem = (StorageCollectionItem) item;
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
TestUtil.assertMembers( //
new String[] { "/dir/subdir/archive.zip" + Util.UNZIP_TYPE_EXTENSION, //
"/dir/subdir/archive2.zip" + Util.UNZIP_TYPE_EXTENSION },//
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryTest.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryTest.java
index 6282c26..0c1a15c 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryTest.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/DefaultUnzipRepositoryTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin;
@@ -35,7 +35,7 @@ import org.sonatype.nexus.proxy.repository.HostedRepository;
import org.sonatype.nexus.proxy.repository.RepositoryKind;
import org.sonatype.nexus.proxy.repository.ShadowRepository;
import org.sonatype.nexus.proxy.storage.UnsupportedStorageOperationException;
-import org.sonatype.nexus.util.ItemPathUtils;
+import org.sonatype.nexus.util.PathUtils;
public abstract class DefaultUnzipRepositoryTest extends UnzipPluginTestSupport {
protected RepositoryMock repositoryMock;
@@ -51,7 +51,7 @@ public abstract class DefaultUnzipRepositoryTest extends UnzipPluginTestSupport
@Test
public void testGetRepositoryKind() {
- final DefaultUnzipRepository repo = new DefaultUnzipRepository();
+ final DefaultUnzipRepository repo = new DefaultUnzipRepository(null, null, null, null, null);
final RepositoryKind kind = repo.getRepositoryKind();
Assert.assertEquals(UnzipRepository.class, kind.getMainFacet());
Assert.assertTrue(kind.isFacetAvailable(ShadowRepository.class));
@@ -91,7 +91,7 @@ public abstract class DefaultUnzipRepositoryTest extends UnzipPluginTestSupport
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(archivePath));
Assert.assertTrue(item instanceof ZippedStorageCollectionItem);
final ZippedStorageCollectionItem archiveItem = (ZippedStorageCollectionItem) item;
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(archivePath), archiveItem.getPath());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(archivePath), archiveItem.getPath());
TestUtil.assertMembers(new String[] { archivePath + "/dir" }, new String[] { archivePath + "/test.txt" },
archiveItem.list());
}
@@ -134,7 +134,7 @@ public abstract class DefaultUnzipRepositoryTest extends UnzipPluginTestSupport
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath));
Assert.assertTrue(item instanceof ZippedStorageCollectionItem);
final StorageCollectionItem collectionItem = (StorageCollectionItem) item;
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
final Collection<StorageItem> members = collectionItem.list();
TestUtil.assertMembers(new String[] { collectionPath + "subdir" },
new String[] { collectionPath + "test.txt" }, members);
@@ -168,7 +168,7 @@ public abstract class DefaultUnzipRepositoryTest extends UnzipPluginTestSupport
final StorageItem item = unzipRepo.doRetrieveItem(new ResourceStoreRequest(collectionPath));
Assert.assertTrue(item instanceof ZippedStorageCollectionItem);
final StorageCollectionItem collectionItem = (StorageCollectionItem) item;
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(collectionPath), collectionItem.getPath());
final Collection<StorageItem> members = collectionItem.list();
TestUtil.assertMembers(new String[] {}, new String[] { collectionPath + "a.txt" }, members);
final DefaultStorageFileItem fileItem = (DefaultStorageFileItem) TestUtil.findItem(collectionPath + "a.txt",
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCacheTest.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCacheTest.java
index 93e2ba3..4f162f1 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCacheTest.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/cache/UnzipCacheTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin.cache;
@@ -21,9 +21,12 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import org.eclipse.tycho.nexus.internal.plugin.DefaultUnzipRepository;
+import org.eclipse.tycho.nexus.internal.plugin.test.RepositoryMock;
import org.eclipse.tycho.nexus.internal.plugin.test.TestUtil;
import org.eclipse.tycho.nexus.internal.plugin.test.UnzipPluginTestSupport;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sonatype.nexus.proxy.ItemNotFoundException;
@@ -49,82 +52,86 @@ public class UnzipCacheTest extends UnzipPluginTestSupport {
@Before
public void setupTestRepos() throws Exception {
- snapshotRepoUnzipCache = createUnzipRepo(createSnapshotRepo()).getCache();
+ final RepositoryMock snapshotRepoMock = createSnapshotRepo();
+ final DefaultUnzipRepository unzipRepo = createUnzipRepo(snapshotRepoMock);
+ snapshotRepoUnzipCache = unzipRepo.getCache();
+ Assert.assertNotNull(snapshotRepoUnzipCache.repository.getRepositoryItemUidAttributeManager());
oldZip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_ZIP);
+ Assert.assertNotNull(snapshotRepoUnzipCache.repository.getRepositoryItemUidAttributeManager());
oldOtherzip = snapshotRepoUnzipCache.getArchive(PATH_TO_OLD_OTHER_ZIP);
latestOtherZip = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_OTHER_ZIP);
- assertTrue(oldOtherzip.exists());
- assertTrue(oldZip.exists());
- assertTrue(latestOtherZip.exists());
+ Assert.assertTrue(oldOtherzip.exists());
+ Assert.assertTrue(oldZip.exists());
+ Assert.assertTrue(latestOtherZip.exists());
}
@Test
public void testCleanUpOldSnapshots() throws StorageException, ItemNotFoundException {
final File latestZip = new File(oldZip.getParentFile() + File.separator + "archive-1.0.0-20101013-2.zip");
- assertFalse(latestZip.exists());
+ Assert.assertFalse(latestZip.exists());
final ConversionResult conversionResult = new ConversionResult(SNAPSHOT_REQUEST_PATH, PATH_TO_LATEST_ZIP,
LATEST_VERSION, PATH_UP_TO_VERSION);
- assertTrue(conversionResult.isPathConverted());
+ Assert.assertTrue(conversionResult.isPathConverted());
final File latestZipFromCache = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
snapshotRepoUnzipCache.cleanSnapshots(conversionResult);
- assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
+ Assert.assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
- assertFalse(oldZip.exists());
- assertFalse(oldOtherzip.exists());
+ Assert.assertFalse(oldZip.exists());
+ Assert.assertFalse(oldOtherzip.exists());
- assertTrue(latestZip.exists());
- assertTrue(latestOtherZip.exists());
+ Assert.assertTrue(latestZip.exists());
+ Assert.assertTrue(latestOtherZip.exists());
}
@Test
public void testCleanUpOldSnapshotsCurrentSnapshotAlreadyCached() throws StorageException, ItemNotFoundException {
final File latestZip = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
- assertTrue(latestZip.exists());
- assertTrue(oldZip.exists());
- assertTrue(oldOtherzip.exists());
- assertTrue(latestOtherZip.exists());
+ Assert.assertTrue(latestZip.exists());
+ Assert.assertTrue(oldZip.exists());
+ Assert.assertTrue(oldOtherzip.exists());
+ Assert.assertTrue(latestOtherZip.exists());
final ConversionResult conversionResult = new ConversionResult("/ga/1.0.0-SNAPSHOT/archive-1.0.0-SNAPSHOT.zip",
PATH_TO_LATEST_ZIP, "20101013", PATH_UP_TO_VERSION);
- assertTrue(conversionResult.isPathConverted());
+ Assert.assertTrue(conversionResult.isPathConverted());
final File latestZipFromCache = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
snapshotRepoUnzipCache.cleanSnapshots(conversionResult);
- assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
+ Assert.assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
- assertFalse(oldZip.exists());
- assertFalse(oldOtherzip.exists());
+ Assert.assertFalse(oldZip.exists());
+ Assert.assertFalse(oldOtherzip.exists());
- assertTrue(latestZip.exists());
- assertTrue(latestOtherZip.exists());
+ Assert.assertTrue(latestZip.exists());
+ Assert.assertTrue(latestOtherZip.exists());
}
@Test
public void testNoCleanUpOldSnapshotsNoConversion() throws StorageException, ItemNotFoundException {
final File latestZip = new File(oldZip.getParentFile() + File.separator + "archive-1.0.0-20101013-2.zip");
- assertFalse(latestZip.exists());
+ Assert.assertFalse(latestZip.exists());
final ConversionResult conversionResult = new ConversionResult(SNAPSHOT_REQUEST_PATH);
- assertFalse(conversionResult.isPathConverted());
+ Assert.assertFalse(conversionResult.isPathConverted());
final File latestZipFromCache = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
snapshotRepoUnzipCache.cleanSnapshots(conversionResult);
- assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
+ Assert.assertEquals(latestZip.getPath(), latestZipFromCache.getPath());
- assertTrue(oldZip.exists());
- assertTrue(oldOtherzip.exists());
+ Assert.assertTrue(oldZip.exists());
+ Assert.assertTrue(oldOtherzip.exists());
- assertTrue(latestZip.exists());
- assertTrue(latestOtherZip.exists());
+ Assert.assertTrue(latestZip.exists());
+ Assert.assertTrue(latestOtherZip.exists());
}
@Test
@@ -138,17 +145,17 @@ public class UnzipCacheTest extends UnzipPluginTestSupport {
final ConversionResult conversionResult = new ConversionResult(SNAPSHOT_REQUEST_PATH, PATH_UP_TO_VERSION, false);
- assertFalse(conversionResult.isPathConverted());
- assertFalse(conversionResult.isASnapshotAvailable());
+ Assert.assertFalse(conversionResult.isPathConverted());
+ Assert.assertFalse(conversionResult.isASnapshotAvailable());
snapshotRepoUnzipCache.cleanSnapshots(conversionResult);
final File latestZipFromCache2 = snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
- assertTrue("Expected that the file would be deleted and recreated by the cache, but was not.",
+ Assert.assertTrue("Expected that the file would be deleted and recreated by the cache, but was not.",
modifiedFileLength != latestZipFromCache2.length());
- assertFalse(oldZip.exists());
- assertFalse(oldOtherzip.exists());
- assertFalse(latestOtherZip.exists());
+ Assert.assertFalse(oldZip.exists());
+ Assert.assertFalse(oldOtherzip.exists());
+ Assert.assertFalse(latestOtherZip.exists());
}
@@ -227,7 +234,6 @@ public class UnzipCacheTest extends UnzipPluginTestSupport {
final Callable<Void> c2 = new RequestWorker(startSignal, doneSignal, false);
results.add(executor.submit(c2));
}
-
//all threads: GO!
startSignal.countDown();
@@ -270,7 +276,6 @@ public class UnzipCacheTest extends UnzipPluginTestSupport {
}
void doWork() throws StorageException, ItemNotFoundException {
-
if (cleanup) {
snapshotRepoUnzipCache.getArchive(PATH_TO_LATEST_ZIP);
snapshotRepoUnzipCache.cleanSnapshots(new ConversionResult(SNAPSHOT_REQUEST_PATH, PATH_TO_LATEST_ZIP,
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/storage/ZippedItemTest.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/storage/ZippedItemTest.java
index 1ec0d51..cf0f3b8 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/storage/ZippedItemTest.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/storage/ZippedItemTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin.storage;
@@ -26,7 +26,7 @@ import org.sonatype.nexus.proxy.RequestContext;
import org.sonatype.nexus.proxy.ResourceStoreRequest;
import org.sonatype.nexus.proxy.item.DefaultStorageCollectionItem;
import org.sonatype.nexus.proxy.item.DefaultStorageFileItem;
-import org.sonatype.nexus.util.ItemPathUtils;
+import org.sonatype.nexus.util.PathUtils;
@SuppressWarnings("nls")
public class ZippedItemTest extends UnzipPluginTestSupport {
@@ -133,14 +133,14 @@ public class ZippedItemTest extends UnzipPluginTestSupport {
final String pathInZip = "dir/";
final ZippedItem zippedItem = createZippedItem(pathInZip);
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(pathInZip), zippedItem.getPathInZip());
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(pathToUnzippedArchive + "/" + pathInZip),
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(pathInZip), zippedItem.getPathInZip());
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(pathToUnzippedArchive + "/" + pathInZip),
zippedItem.getPath());
Assert.assertNull(zippedItem.getMimeType());
final DefaultStorageCollectionItem zippedStorageItem = (DefaultStorageCollectionItem) zippedItem
.getZippedStorageItem();
- Assert.assertEquals(ItemPathUtils.cleanUpTrailingSlash(pathToUnzippedArchive + "/" + pathInZip),
+ Assert.assertEquals(PathUtils.cleanUpTrailingSlash(pathToUnzippedArchive + "/" + pathInZip),
zippedStorageItem.getPath());
}
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/RepositoryMock.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/RepositoryMock.java
index 53c4d72..cd76bc1 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/RepositoryMock.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/RepositoryMock.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2014 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin.test;
@@ -39,7 +39,7 @@ import org.sonatype.nexus.proxy.item.uid.RepositoryItemUidAttributeManager;
import org.sonatype.nexus.proxy.registry.ContentClass;
import org.sonatype.nexus.proxy.repository.AbstractRepository;
import org.sonatype.nexus.proxy.repository.RepositoryKind;
-import org.sonatype.nexus.util.ItemPathUtils;
+import org.sonatype.nexus.util.PathUtils;
@SuppressWarnings({ "nls", "deprecation" })
public class RepositoryMock extends AbstractRepository {
@@ -119,7 +119,7 @@ public class RepositoryMock extends AbstractRepository {
public StorageItem createStorageItem(final String path) throws StorageException, ItemNotFoundException,
IllegalOperationException {
- final String pathWithoutTrailingSlash = ItemPathUtils.cleanUpTrailingSlash(path);
+ final String pathWithoutTrailingSlash = PathUtils.cleanUpTrailingSlash(path);
final File file = new File("./src/test/resources/" + repositoryId + pathWithoutTrailingSlash);
if (!file.exists()) {
throw new ItemNotFoundException(new ResourceStoreRequest(pathWithoutTrailingSlash));
diff --git a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/UnzipRepositoryMock.java b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/UnzipRepositoryMock.java
index f6a95f2..e3911cb 100644
--- a/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/UnzipRepositoryMock.java
+++ b/unzip-repository-plugin/src/test/java/org/eclipse/tycho/nexus/internal/plugin/test/UnzipRepositoryMock.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 SAP AG and others.
+ * Copyright (c) 2010, 2014 SAP SE and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * SAP AG - initial API and implementation
+ * SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.tycho.nexus.internal.plugin.test;
@@ -15,6 +15,7 @@ import org.eclipse.tycho.nexus.internal.plugin.DefaultUnzipRepository;
import org.sonatype.nexus.proxy.attributes.AttributesHandler;
import org.sonatype.nexus.proxy.item.LinkPersister;
import org.sonatype.nexus.proxy.item.RepositoryItemUidFactory;
+import org.sonatype.nexus.proxy.item.uid.RepositoryItemUidAttributeManager;
import org.sonatype.nexus.proxy.repository.LocalStatus;
import org.sonatype.nexus.proxy.repository.Repository;
import org.sonatype.nexus.proxy.storage.local.LocalRepositoryStorage;
@@ -25,14 +26,19 @@ public class UnzipRepositoryMock extends DefaultUnzipRepository {
private final LocalRepositoryStorage localStorage;
private final RepositoryItemUidFactory repositoryItemUidFactory;
+ @Override
+ public RepositoryItemUidAttributeManager getRepositoryItemUidAttributeManager() {
+ return masterRepository.getRepositoryItemUidAttributeManager();
+ }
+
public static DefaultUnzipRepository createUnzipRepository(final Repository masterRepo,
- LinkPersister linkPersister, RepositoryItemUidFactory repositoryItemUidFactory) {
+ final LinkPersister linkPersister, final RepositoryItemUidFactory repositoryItemUidFactory) {
return new UnzipRepositoryMock(masterRepo, linkPersister, repositoryItemUidFactory);
}
- private UnzipRepositoryMock(final Repository masterRepository, LinkPersister linkPersister,
- RepositoryItemUidFactory repositoryItemUidFactory) {
- super();
+ private UnzipRepositoryMock(final Repository masterRepository, final LinkPersister linkPersister,
+ final RepositoryItemUidFactory repositoryItemUidFactory) {
+ super(null, null, null, null, null);
this.masterRepository = masterRepository;
this.localStorage = new FSLocalRepositoryStorageMock(linkPersister);
this.repositoryItemUidFactory = repositoryItemUidFactory;

Back to the top