Author: xavier Date: Fri Jan 4 02:30:24 2008 New Revision: 608795 URL: http://svn.apache.org/viewvc?rev=608795&view=rev Log: add resolve test with multiple caches
Added: ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml (with props) Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=608795&r1=608794&r2=608795&view=diff ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Fri Jan 4 02:30:24 2008 @@ -515,6 +515,38 @@ assertTrue(new File(cache, "repository/mod1.2.jar").exists()); } + public void testMultipleCache() throws Exception { + Ivy ivy = new Ivy(); + ivy.configure(new File("test/repositories/ivysettings-multicache.xml")); + + // mod2.1 depends on mod1.1 which depends on mod1.2 + ResolveReport report = ivy.resolve( + new File("test/repositories/1/org2/mod2.1/ivys/ivy-0.3.xml").toURL(), + getResolveOptions(new String[] {"*"})); + assertNotNull(report); + assertFalse(report.hasError()); + + // dependencies + DefaultArtifact depArtifact = + TestHelper.newArtifact("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar"); + ModuleRevisionId depMrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"); + DefaultRepositoryCacheManager cacheMgr1 = + (DefaultRepositoryCacheManager)ivy.getSettings().getDefaultRepositoryCacheManager(); + DefaultRepositoryCacheManager cacheMgr2 = + (DefaultRepositoryCacheManager)ivy.getSettings().getRepositoryCacheManager("cache2"); + + // ivy file should be cached in default cache, and artifact in cache2 + assertTrue(cacheMgr1.getIvyFileInCache(depMrid).exists()); + assertFalse(cacheMgr1.getArchiveFileInCache(depArtifact).exists()); + assertEquals(new File(cache, "repo1/mod1.1/ivy-1.0.xml"), + cacheMgr1.getIvyFileInCache(depMrid)); + + assertFalse(cacheMgr2.getIvyFileInCache(depMrid).exists()); + assertTrue(cacheMgr2.getArchiveFileInCache(depArtifact).exists()); + assertEquals(new File(cache, "repo2/mod1.1-1.0/mod1.1.jar"), + cacheMgr2.getArchiveFileInCache(depArtifact)); + } + public void testResolveExtends() throws Exception { // mod6.1 depends on mod1.2 2.0 in conf default, and conf extension extends default ResolveReport report = ivy.resolve(new File( Added: ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml?rev=608795&view=auto ============================================================================== --- ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml (added) +++ ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml Fri Jan 4 02:30:24 2008 @@ -0,0 +1,49 @@ +<!-- + 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. +--> +<ivysettings> + <properties file="${ivy.settings.dir}/ivysettings.properties" /> + <settings defaultResolver="test"/> + <cacheDefaults repositoryDir="${cache.dir}/repo1" resolutionDir="${cache.dir}/wkspace" + repositoryIvyPattern="[module]/ivy-[revision].xml"/> + <caches> + <cache name="cache2" basedir="${cache.dir}/repo2" + artifactPattern="[module]-[revision]/[artifact].[ext]"/> + </caches> + <resolvers> + <chain name="test"> + <dual name="1"> + <filesystem name="1-ivy"> + <ivy pattern="${ivy.settings.dir}/1/[organisation]/[module]/ivys/ivy-[revision].xml"/> + </filesystem> + <filesystem name="1-artifact" cache="cache2"> + <artifact pattern="${ivy.settings.dir}/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/> + </filesystem> + </dual> + <dual name="2"> + <filesystem name="2-ivy"> + <ivy pattern="${ivy.settings.dir}/2/[module]/ivy-[revision].xml"/> + </filesystem> + <filesystem name="2-artifact"> + <artifact pattern="${ivy.settings.dir}/2/[module]/[artifact]-[revision].[ext]"/> + <artifact pattern="${ivy.settings.dir}/2/[module]/[artifact].[ext]"/> + </filesystem> + </dual> + </chain> + </resolvers> +</ivysettings> Propchange: ant/ivy/core/trunk/test/repositories/ivysettings-multicache.xml ------------------------------------------------------------------------------ svn:eol-style = native