001package org.eclipse.aether.internal.impl; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.eclipse.aether.artifact.Artifact; 023import org.eclipse.aether.artifact.DefaultArtifact; 024import org.eclipse.aether.repository.RemoteRepository; 025import org.junit.Test; 026 027import static org.junit.Assert.assertEquals; 028 029public class EnhancedSplitLocalRepositoryManagerTest extends EnhancedLocalRepositoryManagerTest 030{ 031 032 @Override 033 protected EnhancedLocalRepositoryManager getManager() 034 { 035 session.setConfigProperty( "aether.enhancedLocalRepository.split", Boolean.TRUE.toString() ); 036 return new EnhancedLocalRepositoryManager( 037 basedir, 038 new DefaultLocalPathComposer(), 039 "_remote.repositories", 040 trackingFileManager, 041 new DefaultLocalPathPrefixComposerFactory().createComposer( session ) 042 ); 043 } 044 045 @Test 046 @Override 047 public void testGetPathForLocalArtifact() 048 { 049 Artifact artifact = new DefaultArtifact( "g.i.d:a.i.d:1.0-SNAPSHOT" ); 050 assertEquals( "1.0-SNAPSHOT", artifact.getBaseVersion() ); 051 assertEquals( "installed/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar", manager.getPathForLocalArtifact( artifact ) ); 052 053 artifact = new DefaultArtifact( "g.i.d:a.i.d:1.0-20110329.221805-4" ); 054 assertEquals( "1.0-SNAPSHOT", artifact.getBaseVersion() ); 055 assertEquals( "installed/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar", manager.getPathForLocalArtifact( artifact ) ); 056 } 057 058 @Test 059 @Override 060 public void testGetPathForRemoteArtifact() 061 { 062 RemoteRepository remoteRepo = new RemoteRepository.Builder( "repo", "default", "ram:/void" ).build(); 063 064 Artifact artifact = new DefaultArtifact( "g.i.d:a.i.d:1.0-SNAPSHOT" ); 065 assertEquals( "1.0-SNAPSHOT", artifact.getBaseVersion() ); 066 assertEquals( "cached/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-SNAPSHOT.jar", 067 manager.getPathForRemoteArtifact( artifact, remoteRepo, "" ) ); 068 069 artifact = new DefaultArtifact( "g.i.d:a.i.d:1.0-20110329.221805-4" ); 070 assertEquals( "1.0-SNAPSHOT", artifact.getBaseVersion() ); 071 assertEquals( "cached/g/i/d/a.i.d/1.0-SNAPSHOT/a.i.d-1.0-20110329.221805-4.jar", 072 manager.getPathForRemoteArtifact( artifact, remoteRepo, "" ) ); 073 } 074}