Merge pull request #123 from eric-milles/IVY-1410-test

rewrite test case to specify files inline
This commit is contained in:
Maarten Coene 2026-06-17 21:51:23 +02:00 committed by GitHub
commit 749dca3c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 70 deletions

View File

@ -48,25 +48,6 @@ public class DeliverTest {
cacheDir.mkdirs(); cacheDir.mkdirs();
} }
/**
* Test case for <a href="https://issues.apache.org/jira/browse/IVY-1410">IVY-1410</a>.
*/
@Test
public void testDeliver1410() throws Exception {
Project project = ivyDeliver.getProject();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
File ivyFile = new File(new URI(DeliverTest.class.getResource("ivy-1410.xml").toString()));
resolve(ivyFile);
ivyDeliver.setReplacedynamicrev(true);
ivyDeliver.doExecute();
String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
assertTrue(deliverContent.contains("org=\"org1\" name=\"mod1.1\" rev=\"1.1\""));
assertTrue(deliverContent.contains("org=\"org2\" name=\"mod2.1\" rev=\"0.7\""));
}
private void resolve(File ivyFile) { private void resolve(File ivyFile) {
IvyResolve ivyResolve = new IvyResolve(); IvyResolve ivyResolve = new IvyResolve();
ivyResolve.setProject(ivyDeliver.getProject()); ivyResolve.setProject(ivyDeliver.getProject());
@ -144,6 +125,43 @@ public class DeliverTest {
assertTrue(ivyFile.contains("org=\"junit\" name=\"junit\" rev=\"4.4\" revConstraint=\"latest.integration\"")); assertTrue(ivyFile.contains("org=\"junit\" name=\"junit\" rev=\"4.4\" revConstraint=\"latest.integration\""));
} }
/**
* Test case for <a href="https://issues.apache.org/jira/browse/IVY-1410">IVY-1410</a>.
*/
@Test
public void testDeliver1410() throws Exception {
ivyDeliver.getProject().setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
String ivyFile
= "<ivy-module version='2.0'>\n"
+ " <info organisation='org' module='xxx'/>\n"
+ " <dependencies>\n"
+ " <dependency org='org1' name='mod1.1' rev='1.+'/>\n"
+ " </dependencies>\n"
+ "</ivy-module>\n";
ivyFile
= "<ivy-module version='2.0'>\n"
+ " <info organisation='org' module='yyy' revision='1.0'>\n"
+ " <extends organisation='org' module='xxx' extendType='dependencies'\n"
+ " location='" + writeFile(ivyFile).getName() + "' revision='latest'/>\n"
+ " </info>\n"
+ " <dependencies>\n"
+ " <dependency org='org2' name='mod2.1' rev='0.+'/>\n"
+ " </dependencies>\n"
+ "</ivy-module>\n";
resolve(writeFile(ivyFile));
ivyDeliver.setReplacedynamicrev(true);
ivyDeliver.doExecute();
ivyFile = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
assertTrue(ivyFile.contains("org=\"org1\" name=\"mod1.1\" rev=\"1.1\""));
assertTrue(ivyFile.contains("org=\"org2\" name=\"mod2.1\" rev=\"0.7\""));
}
/** /**
* Test case for <a href="https://issues.apache.org/jira/browse/IVY-1658">IVY-1658</a>. * Test case for <a href="https://issues.apache.org/jira/browse/IVY-1658">IVY-1658</a>.
*/ */

View File

@ -1,24 +0,0 @@
<!--
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
https://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.
-->
<ivy-module version="2.0">
<info organisation="org" module="xxx"/>
<dependencies>
<dependency org="org1" name="mod1.1" rev="1.+"/>
</dependencies>
</ivy-module>

View File

@ -1,27 +0,0 @@
<!--
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
https://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.
-->
<ivy-module version="2.0">
<info organisation="org" module="yyy" revision="1.0">
<extends organisation="org" module="xxx" extendType="dependencies"
location="ivy-1410-parent.xml" revision="latest"/>
</info>
<dependencies>
<dependency org="org2" name="mod2.1" rev="0.+"/>
</dependencies>
</ivy-module>