mirror of https://github.com/apache/ant-ivy
Convert tests to JUnit 4, clean up code
This commit is contained in:
parent
239bc0b04a
commit
1543f52896
32
ivy.xml
32
ivy.xml
|
|
@ -44,29 +44,27 @@
|
|||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant->default"/>
|
||||
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.0" conf="default,httpclient->runtime,master" />
|
||||
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="default,httpclient->runtime,master"/>
|
||||
<dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
|
||||
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default" />
|
||||
<dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp->default" />
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp->default" />
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp->default" />
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp->default" />
|
||||
<dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default" />
|
||||
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default" />
|
||||
<dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default"/>
|
||||
<dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp->default"/>
|
||||
<dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default"/>
|
||||
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default"/>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency org="junit" name="junit" rev="3.8.2" conf="test->default" />
|
||||
<dependency org="commons-lang" name="commons-lang" rev="2.6" conf="test->default" />
|
||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test->default" transitive="false" />
|
||||
<dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
|
||||
<dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test->default"/>
|
||||
<dependency org="commons-lang" name="commons-lang" rev="2.6" conf="test->default"/>
|
||||
<dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test->default" transitive="false"/>
|
||||
<dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test->default" transitive="false"/>
|
||||
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test->default" transitive="false"/>
|
||||
<dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test->default" transitive="false"/>
|
||||
|
||||
<!-- This dependency is necessary for having validation in junit tests when running with JDK1.4 -->
|
||||
<dependency org="xerces" name="xercesImpl" rev="2.6.2" conf="test->default" />
|
||||
<dependency org="xerces" name="xmlParserAPIs" rev="2.6.2" conf="test->default" />
|
||||
|
||||
<!-- Global exclude for junit -->
|
||||
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant" />
|
||||
<!-- Global exclude for junit and hamcrest -->
|
||||
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>
|
||||
<exclude org="org.hamcrest" module="hamcrest-core" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
|
|||
|
|
@ -25,13 +25,18 @@ import org.apache.ivy.core.resolve.ResolveOptions;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.util.CacheCleaner;
|
||||
import org.apache.ivy.util.MockMessageLogger;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class IvyTest extends TestCase {
|
||||
public class IvyTest {
|
||||
private File cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
}
|
||||
|
|
@ -41,10 +46,12 @@ public class IvyTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleInstances() throws Exception {
|
||||
// this test checks that IvyContext is properly set and unset when using multiple instances
|
||||
// of Ivy. We also check logging, because it heavily relies on IvyContext.
|
||||
|
|
|
|||
|
|
@ -23,25 +23,33 @@ import org.apache.ivy.util.CacheCleaner;
|
|||
import org.apache.ivy.util.cli.CommandLine;
|
||||
import org.apache.ivy.util.cli.ParseException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MainTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class MainTest {
|
||||
|
||||
private File cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
cache = new File("build/cache");
|
||||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHelp() throws Exception {
|
||||
run(new String[] {"-?"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadOption() throws Exception {
|
||||
try {
|
||||
run(new String[] {"-bad"});
|
||||
|
|
@ -51,6 +59,7 @@ public class MainTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMissingParameter() throws Exception {
|
||||
try {
|
||||
run(new String[] {"-ivy"});
|
||||
|
|
@ -60,24 +69,28 @@ public class MainTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveSimple() throws Exception {
|
||||
run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-ivy",
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"});
|
||||
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveSimpleWithConfs() throws Exception {
|
||||
run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-ivy",
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "-confs", "default"});
|
||||
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveSimpleWithConfs2() throws Exception {
|
||||
run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs", "default",
|
||||
"-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"});
|
||||
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtraParams1() throws Exception {
|
||||
String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
|
||||
"default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "foo1",
|
||||
|
|
@ -90,6 +103,7 @@ public class MainTest extends TestCase {
|
|||
assertEquals("foo2", leftOver[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtraParams2() throws Exception {
|
||||
String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
|
||||
"default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "--",
|
||||
|
|
@ -102,6 +116,7 @@ public class MainTest extends TestCase {
|
|||
assertEquals("foo2", leftOver[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtraParams3() throws Exception {
|
||||
String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
|
||||
"default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.apache.ivy;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -38,18 +37,21 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource;
|
|||
* Example of use:
|
||||
*
|
||||
* <pre>
|
||||
* public class MyTest extends TestCase {
|
||||
* public class MyTest {
|
||||
* private TestFixture fixture;
|
||||
*
|
||||
* protected void setUp() throws Exception {
|
||||
*
|
||||
* @Before
|
||||
* public void setUp() throws Exception {
|
||||
* fixture = new TestFixture();
|
||||
* // additional setup here
|
||||
* }
|
||||
*
|
||||
* protected void tearDown() throws Exception {
|
||||
*
|
||||
* @After
|
||||
* public void tearDown() throws Exception {
|
||||
* fixture.clean();
|
||||
* }
|
||||
*
|
||||
*
|
||||
* @Test
|
||||
* public void testXXX() throws Exception {
|
||||
* fixture.addMD("#A;1-> { #B;[1.5,1.6] #C;2.5 }").addMD("#B;1.5->#D;2.0")
|
||||
* .addMD("#B;1.6->#D;2.0").addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5")
|
||||
|
|
@ -115,7 +117,7 @@ public class TestFixture {
|
|||
return ((FileResource) r.getResource()).getFile();
|
||||
}
|
||||
|
||||
public ResolveReport resolve(String mrid) throws MalformedURLException, ParseException,
|
||||
public ResolveReport resolve(String mrid) throws ParseException,
|
||||
IOException {
|
||||
return ivy.resolve(getIvyFile(mrid), TestHelper.newResolveOptions(getSettings()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import org.apache.tools.ant.DefaultLogger;
|
|||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestHelper {
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public class TestHelper {
|
|||
public static void assertModuleRevisionIds(String expectedMrids,
|
||||
Collection/* <ModuleRevisionId> */mrids) {
|
||||
Collection expected = parseMrids(expectedMrids);
|
||||
Assert.assertEquals(expected, mrids);
|
||||
assertEquals(expected, mrids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -284,8 +284,7 @@ public class TestHelper {
|
|||
|
||||
/**
|
||||
* Cleans up the test repository and cache.
|
||||
*
|
||||
* @see #newTestSettings()
|
||||
*
|
||||
*/
|
||||
public static void cleanTest() {
|
||||
cleanTestRepository();
|
||||
|
|
|
|||
|
|
@ -24,13 +24,18 @@ import org.apache.ivy.ant.AntWorkspaceResolver.WorkspaceArtifact;
|
|||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.report.DownloadStatus;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AntBuildResolverTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class AntBuildResolverTest {
|
||||
|
||||
private static final ModuleRevisionId MRID_MODULE1 = ModuleRevisionId.newInstance("org.acme",
|
||||
"module1", "1.1");
|
||||
|
|
@ -44,8 +49,8 @@ public class AntBuildResolverTest extends TestCase {
|
|||
|
||||
private WorkspaceArtifact wa;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.cleanCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
|
|
@ -67,11 +72,12 @@ public class AntBuildResolverTest extends TestCase {
|
|||
configure.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoProject() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -84,6 +90,7 @@ public class AntBuildResolverTest extends TestCase {
|
|||
assertEquals(MRID_MODULE1, report.getDependencies().get(0).getResolvedId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProject() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -105,6 +112,7 @@ public class AntBuildResolverTest extends TestCase {
|
|||
report.getArtifactsReports(MRID_PROJECT1)[0].getLocalFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProjectFolder() throws Exception {
|
||||
wa.setPath("target/classes");
|
||||
|
||||
|
|
@ -127,6 +135,7 @@ public class AntBuildResolverTest extends TestCase {
|
|||
report.getArtifactsReports(MRID_PROJECT1)[0].getLocalFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencyArtifact() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -148,6 +157,7 @@ public class AntBuildResolverTest extends TestCase {
|
|||
report.getArtifactsReports(MRID_PROJECT1)[0].getLocalFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachePath() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -169,6 +179,7 @@ public class AntBuildResolverTest extends TestCase {
|
|||
path.list()[1]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCachePathFolder() throws Exception {
|
||||
wa.setPath("target/classes");
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,14 @@ import org.apache.ivy.Ivy;
|
|||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AntBuildTriggerTest extends TestCase {
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class AntBuildTriggerTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
assertFalse(new File("test/triggers/ant-build/A/A.jar").exists());
|
||||
|
||||
|
|
@ -39,7 +44,8 @@ public class AntBuildTriggerTest extends TestCase {
|
|||
assertTrue(new File("test/triggers/ant-build/local/A/A.jar").exists());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(new File("test/triggers/ant-build/local/A"));
|
||||
FileUtil.forceDelete(new File("test/triggers/ant-build/cache"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,16 @@
|
|||
*/
|
||||
package org.apache.ivy.ant;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.BuildLogger;
|
||||
import org.apache.tools.ant.DefaultLogger;
|
||||
|
|
@ -34,9 +38,11 @@ import org.apache.tools.ant.ProjectHelper;
|
|||
import org.apache.tools.ant.input.DefaultInputHandler;
|
||||
import org.apache.tools.ant.input.InputHandler;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AntCallTriggerTest extends TestCase {
|
||||
public class AntCallTriggerTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
assertFalse(new File("test/triggers/ant-call/A/out/foo.txt").exists());
|
||||
runAnt(new File("test/triggers/ant-call/A/build.xml"), "resolve");
|
||||
|
|
@ -44,7 +50,8 @@ public class AntCallTriggerTest extends TestCase {
|
|||
assertTrue(new File("test/triggers/ant-call/A/out/foo.txt").exists());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(new File("test/triggers/ant-call/A/out"));
|
||||
FileUtil.forceDelete(new File("test/triggers/ant-call/cache"));
|
||||
}
|
||||
|
|
@ -173,6 +180,7 @@ public class AntCallTriggerTest extends TestCase {
|
|||
* @param project
|
||||
* the project instance.
|
||||
* @param inputHandlerClassname
|
||||
* String
|
||||
* @exception BuildException
|
||||
* if a specified InputHandler implementation could not be loaded.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,22 +17,26 @@
|
|||
*/
|
||||
package org.apache.ivy.ant;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.osgi.obr.xml.OBRXMLParser;
|
||||
import org.apache.ivy.osgi.repo.BundleRepoDescriptor;
|
||||
import org.apache.ivy.util.CollectionUtils;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class BuildOBRTaskTest extends TestCase {
|
||||
public class BuildOBRTaskTest {
|
||||
|
||||
private File cache;
|
||||
|
||||
|
|
@ -40,7 +44,8 @@ public class BuildOBRTaskTest extends TestCase {
|
|||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
project = TestHelper.newProject();
|
||||
|
||||
|
|
@ -54,12 +59,12 @@ public class BuildOBRTaskTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
private BundleRepoDescriptor readObr(File obrFile) throws FileNotFoundException,
|
||||
ParseException, IOException, SAXException {
|
||||
private BundleRepoDescriptor readObr(File obrFile) throws IOException, SAXException {
|
||||
BundleRepoDescriptor obr;
|
||||
FileInputStream in = new FileInputStream(obrFile);
|
||||
try {
|
||||
|
|
@ -70,6 +75,7 @@ public class BuildOBRTaskTest extends TestCase {
|
|||
return obr;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDir() throws Exception {
|
||||
buildObr.setBaseDir(new File("test/test-repo/bundlerepo"));
|
||||
File obrFile = new File("build/cache/obr.xml");
|
||||
|
|
|
|||
|
|
@ -26,17 +26,24 @@ import org.apache.ivy.TestHelper;
|
|||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class FixDepsTaskTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class FixDepsTaskTest {
|
||||
|
||||
private FixDepsTask fixDeps;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -46,10 +53,12 @@ public class FixDepsTaskTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
|
||||
|
|
@ -78,6 +87,7 @@ public class FixDepsTaskTest extends TestCase {
|
|||
assertEquals("2.0", md.getDependencies()[0].getDependencyRevisionId().getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMulticonf() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
|
||||
|
||||
|
|
@ -124,6 +134,7 @@ public class FixDepsTaskTest extends TestCase {
|
|||
assertEquals("default", md.getDependencies()[1].getDependencyConfigurations("compile")[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransitivity() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-transitive.xml");
|
||||
|
||||
|
|
@ -181,6 +192,7 @@ public class FixDepsTaskTest extends TestCase {
|
|||
assertEquals("*", md.getDependencies()[2].getDependencyConfigurations("compile")[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedResolve() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-transitive.xml");
|
||||
|
||||
|
|
|
|||
|
|
@ -18,50 +18,66 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.tools.ant.BuildFileTest;
|
||||
|
||||
public class IvyAntSettingsBuildFileTest extends BuildFileTest {
|
||||
import org.apache.tools.ant.BuildFileRule;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyAntSettingsBuildFileTest {
|
||||
|
||||
@Rule
|
||||
public final BuildFileRule buildRule = new BuildFileRule();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
buildRule.configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideNotSpecified() {
|
||||
executeTarget("testOverrideNotSpecified");
|
||||
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
|
||||
buildRule.executeTarget("testOverrideNotSpecified");
|
||||
ResolveReport report = buildRule.getProject().getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideSetToFalse() {
|
||||
executeTarget("testOverrideSetToFalse");
|
||||
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
|
||||
buildRule.executeTarget("testOverrideSetToFalse");
|
||||
ResolveReport report = buildRule.getProject().getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnnecessaryDefaultIvyInstance() {
|
||||
executeTarget("testUnnecessaryDefaultIvyInstance");
|
||||
assertNull("Default ivy.instance settings shouldn't have been loaded", getProject()
|
||||
.getReference("ivy.instance"));
|
||||
buildRule.executeTarget("testUnnecessaryDefaultIvyInstance");
|
||||
assertNull("Default ivy.instance settings shouldn't have been loaded",
|
||||
buildRule.getProject().getReference("ivy.instance"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSettingsWithIdIvyInstance() {
|
||||
// IVY-925
|
||||
executeTarget("testSettingsWithPropertyAsId");
|
||||
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
|
||||
buildRule.executeTarget("testSettingsWithPropertyAsId");
|
||||
ResolveReport report = buildRule.getProject().getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStackOverflow() {
|
||||
// IVY-924
|
||||
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
|
||||
executeTarget("testStackOverflow");
|
||||
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
|
||||
buildRule.configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
|
||||
buildRule.executeTarget("testStackOverflow");
|
||||
ResolveReport report = buildRule.getProject().getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
|
|
|
|||
|
|
@ -20,18 +20,26 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyArtifactPropertyTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class IvyArtifactPropertyTest {
|
||||
|
||||
private IvyArtifactProperty prop;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -41,10 +49,12 @@ public class IvyArtifactPropertyTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
prop.setName("[module].[artifact]-[revision]");
|
||||
|
|
@ -56,6 +66,7 @@ public class IvyArtifactPropertyTest extends TestCase {
|
|||
new File(val).getCanonicalPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveId() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -80,6 +91,7 @@ public class IvyArtifactPropertyTest extends TestCase {
|
|||
new File(val).getCanonicalPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdWithoutResolve() throws Exception {
|
||||
try {
|
||||
prop.setName("[module].[artifact]-[revision]");
|
||||
|
|
|
|||
|
|
@ -20,17 +20,23 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyArtifactReportTest extends TestCase {
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyArtifactReportTest {
|
||||
|
||||
private IvyArtifactReport prop;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -40,10 +46,12 @@ public class IvyArtifactReportTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
prop.setTofile(new File("build/test-artifact-report.xml"));
|
||||
prop.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
|
|
|
|||
|
|
@ -24,16 +24,23 @@ import java.util.List;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
// CheckStyle:MagicNumber| OFF
|
||||
// The test very often use MagicNumber. Using a constant is less expressive.
|
||||
|
||||
public class IvyBuildListTest extends TestCase {
|
||||
public class IvyBuildListTest {
|
||||
|
||||
private File cache;
|
||||
|
||||
|
|
@ -41,7 +48,8 @@ public class IvyBuildListTest extends TestCase {
|
|||
|
||||
private IvyBuildList buildlist;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
|
||||
project = TestHelper.newProject();
|
||||
|
|
@ -53,7 +61,8 @@ public class IvyBuildListTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
cleanCache();
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +101,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
* C B has no dependency C -> B D -> A , B E has no dependency F -> G G -> F
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testSimple() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -108,6 +118,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReverse() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -125,6 +136,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"E", "D", "A", "C", "B"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRoot() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -142,6 +154,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B", "C"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRootCircular() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -156,6 +169,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertEquals(2, files.length); // F and G should be in the list
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithTwoRoots() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -173,6 +187,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B", "C", "E"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRootExclude() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -191,6 +206,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRootAndOnlyDirectDep() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -209,6 +225,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"C", "A"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithLeaf() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -226,6 +243,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithLeafCircular() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -240,6 +258,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertEquals(2, files.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithTwoLeafs() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -257,6 +276,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D", "E"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithLeafExclude() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -275,6 +295,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"A", "D"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithLeafAndOnlyDirectDep() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -293,6 +314,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"C", "A"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestartFrom() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -310,6 +332,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"C", "A", "D", "E"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMissingDescriptor() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -326,6 +349,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E", "H"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnMissingDescriptor2() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -342,6 +366,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D", "E"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithModuleWithSameNameAndDifferentOrg() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlist"));
|
||||
|
|
@ -368,6 +393,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
other.get(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoParents() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlists/testNoParents"));
|
||||
|
|
@ -385,6 +411,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
"ireland", "germany", "master-parent", "croatia"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneParent() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlists/testOneParent"));
|
||||
|
|
@ -402,6 +429,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
"master-parent", "croatia", "ireland", "germany"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoParents() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlists/testTwoParents"));
|
||||
|
|
@ -419,6 +447,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
"master-parent", "croatia", "ireland", "germany"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePathToParent() {
|
||||
FileSet fs = new FileSet();
|
||||
fs.setDir(new File("test/buildlists/testRelativePathToParent"));
|
||||
|
|
@ -436,6 +465,7 @@ public class IvyBuildListTest extends TestCase {
|
|||
"bootstrap-parent", "master-parent", "croatia", "ireland", "germany"}, files);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbsolutePathToParent() {
|
||||
project.setProperty("master-parent.dir", new File(
|
||||
"test/buildlists/testAbsolutePathToParent/master-parent").getAbsolutePath());
|
||||
|
|
@ -457,4 +487,4 @@ public class IvyBuildListTest extends TestCase {
|
|||
}
|
||||
|
||||
}
|
||||
// CheckStyle:MagicNumber| ON
|
||||
// CheckStyle:MagicNumber| ON
|
||||
|
|
|
|||
|
|
@ -18,15 +18,21 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyBuildNumberTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class IvyBuildNumberTest {
|
||||
|
||||
private IvyBuildNumber buildNumber;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -35,10 +41,12 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
buildNumber.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("newmod");
|
||||
|
|
@ -49,6 +57,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("0", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault2() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("newmod");
|
||||
|
|
@ -60,6 +69,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault3() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("newmod");
|
||||
|
|
@ -71,6 +81,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals(null, buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatest() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.1");
|
||||
|
|
@ -81,6 +92,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatest2() throws Exception {
|
||||
buildNumber.setOrganisation("orgbn");
|
||||
buildNumber.setModule("buildnumber");
|
||||
|
|
@ -91,6 +103,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrefix() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.1");
|
||||
|
|
@ -102,6 +115,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("test.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildNumber() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.1");
|
||||
|
|
@ -113,6 +127,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("2", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildNumber2() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.5");
|
||||
|
|
@ -124,6 +139,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildNumber3() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.1");
|
||||
|
|
@ -135,6 +151,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildNumber4() throws Exception {
|
||||
buildNumber.setOrganisation("org1");
|
||||
buildNumber.setModule("mod1.1");
|
||||
|
|
@ -146,6 +163,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("0", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithBadChecksum() throws Exception {
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-checksums.xml");
|
||||
|
|
@ -162,6 +180,7 @@ public class IvyBuildNumberTest extends TestCase {
|
|||
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChainResolver() throws Exception {
|
||||
// IVY-1037
|
||||
Project project = TestHelper.newProject();
|
||||
|
|
|
|||
|
|
@ -20,21 +20,32 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
public class IvyCacheFilesetTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyCacheFilesetTest {
|
||||
|
||||
private IvyCacheFileset fileset;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Rule
|
||||
public ExpectedException expExc = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -44,10 +55,12 @@ public class IvyCacheFilesetTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
fileset.setSetid("simple-setid");
|
||||
|
|
@ -76,6 +89,7 @@ public class IvyCacheFilesetTest extends TestCase {
|
|||
revision, artifact, type, ext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyConf() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-108.xml");
|
||||
fileset.setSetid("emptyconf-setid");
|
||||
|
|
@ -90,30 +104,24 @@ public class IvyCacheFilesetTest extends TestCase {
|
|||
assertEquals(0, directoryScanner.getIncludedFiles().length);
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
fileset.setSetid("failure-setid");
|
||||
fileset.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raised an exception
|
||||
}
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
fileset.setSetid("failure-setid");
|
||||
fileset.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testInvalidPattern() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.settings.file",
|
||||
"test/repositories/ivysettings-invalidcachepattern.xml");
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
fileset.setSetid("simple-setid");
|
||||
fileset.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raise an exception
|
||||
}
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-invalidcachepattern.xml");
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
fileset.setSetid("simple-setid");
|
||||
fileset.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
|
|
@ -125,6 +133,7 @@ public class IvyCacheFilesetTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithoutPreviousResolveAndNonDefaultCache() throws Exception {
|
||||
File cache2 = new File("build/cache2");
|
||||
cache2.mkdirs();
|
||||
|
|
@ -152,6 +161,7 @@ public class IvyCacheFilesetTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBaseDir() {
|
||||
File base = null;
|
||||
base = fileset.getBaseDir(base, new File("x/aa/b/c"));
|
||||
|
|
|
|||
|
|
@ -20,19 +20,25 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyCachePathTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyCachePathTest {
|
||||
|
||||
private IvyCachePath path;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -42,10 +48,12 @@ public class IvyCachePathTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
path.setPathid("simple-pathid");
|
||||
|
|
@ -59,6 +67,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
.getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline1() throws Exception {
|
||||
// we first resolve another ivy file
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
|
|
@ -84,6 +93,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
.getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline2() throws Exception {
|
||||
// we first resolve a dependency directly
|
||||
path.setOrganisation("org1");
|
||||
|
|
@ -109,6 +119,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.2", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyConf() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-108.xml");
|
||||
path.setPathid("emptyconf-pathid");
|
||||
|
|
@ -121,17 +132,15 @@ public class IvyCachePathTest extends TestCase {
|
|||
assertEquals(0, p.size());
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
path.setPathid("failure-pathid");
|
||||
path.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raised an exception
|
||||
}
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
path.setPathid("failure-pathid");
|
||||
path.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
|
|
@ -143,6 +152,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveId() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -169,6 +179,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
.getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdWithoutResolve() throws Exception {
|
||||
Project otherProject = TestHelper.newProject();
|
||||
otherProject.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -199,6 +210,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
.getAbsolutePath(), new File(p.list()[0]).getAbsolutePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndMissingConfs() throws Exception {
|
||||
Project otherProject = TestHelper.newProject();
|
||||
otherProject.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -225,6 +237,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
path.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnpack() throws Exception {
|
||||
project.setProperty("ivy.dep.file",
|
||||
"test/repositories/1/packaging/module1/ivys/ivy-1.0.xml");
|
||||
|
|
@ -238,6 +251,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
assertTrue(new File(p.list()[0]).isDirectory());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOSGi() throws Exception {
|
||||
project.setProperty("ivy.dep.file",
|
||||
"test/repositories/1/packaging/module5/ivys/ivy-1.0.xml");
|
||||
|
|
@ -257,6 +271,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
assertEquals(new File(unpacked, "lib/ant-apache-log4j.jar"), new File(p.list()[3]));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOSGi2() throws Exception {
|
||||
project.setProperty("ivy.dep.file",
|
||||
"test/repositories/1/packaging/module6/ivys/ivy-1.0.xml");
|
||||
|
|
@ -273,6 +288,7 @@ public class IvyCachePathTest extends TestCase {
|
|||
assertEquals(unpacked, new File(p.list()[0]));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackedOSGi() throws Exception {
|
||||
project.setProperty("ivy.dep.file",
|
||||
"test/repositories/1/packaging/module8/ivys/ivy-1.0.xml");
|
||||
|
|
|
|||
|
|
@ -20,12 +20,21 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
public class IvyCleanCacheTest extends TestCase {
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class IvyCleanCacheTest {
|
||||
private IvyCleanCache cleanCache;
|
||||
|
||||
private File cacheDir;
|
||||
|
|
@ -36,7 +45,11 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
|
||||
private File resolutionCache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Rule
|
||||
public ExpectedException expExc = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Project p = TestHelper.newProject();
|
||||
cacheDir = new File("build/cache");
|
||||
p.setProperty("cache", cacheDir.getAbsolutePath());
|
||||
|
|
@ -56,6 +69,7 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
repoCache2.mkdirs();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCleanAll() throws Exception {
|
||||
cleanCache.perform();
|
||||
assertFalse(resolutionCache.exists());
|
||||
|
|
@ -63,6 +77,7 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
assertFalse(repoCache2.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolutionOnly() throws Exception {
|
||||
cleanCache.setCache(IvyCleanCache.NONE);
|
||||
cleanCache.perform();
|
||||
|
|
@ -71,6 +86,7 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
assertTrue(repoCache2.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepositoryOnly() throws Exception {
|
||||
cleanCache.setResolution(false);
|
||||
cleanCache.perform();
|
||||
|
|
@ -79,6 +95,7 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
assertFalse(repoCache2.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneRepositoryOnly() throws Exception {
|
||||
cleanCache.setResolution(false);
|
||||
cleanCache.setCache("mycache");
|
||||
|
|
@ -88,14 +105,13 @@ public class IvyCleanCacheTest extends TestCase {
|
|||
assertTrue(repoCache2.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnknownCache() throws Exception {
|
||||
expExc.expect(BuildException.class);
|
||||
expExc.expectMessage("unknown cache 'yourcache'");
|
||||
cleanCache.setResolution(false);
|
||||
cleanCache.setCache("yourcache");
|
||||
try {
|
||||
cleanCache.perform();
|
||||
fail("clean cache should have raised an exception with unkown cache");
|
||||
} catch (BuildException e) {
|
||||
assertTrue(e.getMessage().indexOf("yourcache") != -1);
|
||||
}
|
||||
cleanCache.perform();
|
||||
fail("clean cache should have raised an exception with unknown cache");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,18 +25,23 @@ import org.apache.ivy.core.settings.IvySettings;
|
|||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
import org.apache.ivy.plugins.resolver.IBiblioResolver;
|
||||
import org.apache.ivy.plugins.resolver.IvyRepResolver;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.Reference;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyConfigureTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyConfigureTest {
|
||||
private IvyConfigure configure;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("myproperty", "myvalue");
|
||||
|
||||
|
|
@ -44,6 +49,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
configure.setProject(project);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private Ivy getIvyInstance() {
|
||||
IvyTask task = new IvyTask() {
|
||||
public void doExecute() throws BuildException {
|
||||
|
|
@ -58,6 +64,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
return task.getIvyInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultCacheDir() {
|
||||
// test with an URL
|
||||
configure.setUrl(getClass().getResource("ivysettings-defaultCacheDir.xml"));
|
||||
|
|
@ -90,6 +97,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertNotNull(project.getProperty("ivy.cache.dir.test3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault() throws Exception {
|
||||
// by default settings look in the current directory for an ivysettings.xml file...
|
||||
// but Ivy itself has one, and we don't want to use it
|
||||
|
|
@ -106,6 +114,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertTrue(ibiblio.isM2compatible());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault14() throws Exception {
|
||||
// by default settings look in the current directory for an ivysettings.xml file...
|
||||
// but Ivy itself has one, and we don't want to use it
|
||||
|
|
@ -120,6 +129,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertTrue(publicResolver instanceof IvyRepResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFile() throws Exception {
|
||||
configure.setFile(new File("test/repositories/ivysettings.xml"));
|
||||
|
||||
|
|
@ -141,6 +151,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testURL() throws Exception {
|
||||
String confUrl = new File("test/repositories/ivysettings-url.xml").toURI().toURL()
|
||||
.toExternalForm();
|
||||
|
|
@ -160,6 +171,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAntProperties() throws Exception {
|
||||
String confUrl = IvyConfigureTest.class.getResource("ivysettings-test.xml")
|
||||
.toExternalForm();
|
||||
|
|
@ -174,6 +186,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getDefaultResolver().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideVariables() throws Exception {
|
||||
String confUrl = IvyConfigureTest.class.getResource("ivysettings-props.xml")
|
||||
.toExternalForm();
|
||||
|
|
@ -188,6 +201,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
settings.getVariables().getVariable("ivy.retrieve.pattern"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExposeAntProperties() throws Exception {
|
||||
String confUrl = IvyConfigureTest.class.getResource("ivysettings-props.xml")
|
||||
.toExternalForm();
|
||||
|
|
@ -202,6 +216,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertEquals("value", configure.getProject().getProperty("ivy.test.variable.this.id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeTwice() throws Exception {
|
||||
// IVY-601
|
||||
configure.setFile(new File("test/java/org/apache/ivy/ant/ivysettings-include-twice.xml"));
|
||||
|
|
@ -211,6 +226,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertNotNull(getIvyInstance());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideTrue() throws Exception {
|
||||
configure.setFile(new File("test/repositories/ivysettings.xml"));
|
||||
configure.execute();
|
||||
|
|
@ -228,6 +244,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertTrue(ivy != getIvyInstance());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideFalse() throws Exception {
|
||||
configure.setFile(new File("test/repositories/ivysettings.xml"));
|
||||
configure.execute();
|
||||
|
|
@ -244,6 +261,7 @@ public class IvyConfigureTest extends TestCase {
|
|||
assertTrue(ivy == getIvyInstance());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideNotAllowed() throws Exception {
|
||||
configure.setFile(new File("test/repositories/ivysettings.xml"));
|
||||
configure.execute();
|
||||
|
|
@ -261,17 +279,18 @@ public class IvyConfigureTest extends TestCase {
|
|||
fail("calling settings twice with the same id with "
|
||||
+ "override=notallowed should raise an exception");
|
||||
} catch (BuildException e) {
|
||||
assertTrue(e.getMessage().indexOf("notallowed") != -1);
|
||||
assertTrue(e.getMessage().indexOf(configure.getSettingsId()) != -1);
|
||||
assertTrue(e.getMessage().contains("notallowed"));
|
||||
assertTrue(e.getMessage().contains(configure.getSettingsId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidOverride() throws Exception {
|
||||
try {
|
||||
configure.setOverride("unknown");
|
||||
fail("settings override with invalid value should raise an exception");
|
||||
} catch (Exception e) {
|
||||
assertTrue(e.getMessage().indexOf("unknown") != -1);
|
||||
assertTrue(e.getMessage().contains("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,10 @@ import java.io.File;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyConvertPomTest extends TestCase {
|
||||
public class IvyConvertPomTest {
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
IvyConvertPom task = new IvyConvertPom();
|
||||
task.setProject(TestHelper.newProject());
|
||||
|
|
|
|||
|
|
@ -35,18 +35,25 @@ import org.apache.ivy.core.module.id.ModuleRevisionId;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyDeliverTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyDeliverTest {
|
||||
|
||||
private IvyDeliver deliver;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
cleanTestDir();
|
||||
cleanRetrieveDir();
|
||||
cleanRep();
|
||||
|
|
@ -61,7 +68,8 @@ public class IvyDeliverTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
cleanTestDir();
|
||||
cleanRetrieveDir();
|
||||
|
|
@ -89,6 +97,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
del.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeParent() throws IOException, ParseException {
|
||||
// publish the parent descriptor first, so that it can be found while
|
||||
// we are reading the child descriptor.
|
||||
|
|
@ -148,6 +157,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -173,6 +183,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDynamicConstraintDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotGenerateRevConstraint() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -199,6 +210,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDynamicConstraintDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveId() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -230,6 +242,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdInAnotherBuild() throws Exception {
|
||||
// create a new build
|
||||
Project other = TestHelper.newProject();
|
||||
|
|
@ -267,6 +280,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceBranchInfo() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -287,6 +301,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
md.getModuleRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithBranch() throws Exception {
|
||||
// test case for IVY-404
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-branch.xml");
|
||||
|
|
@ -311,6 +326,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceBranch() throws Exception {
|
||||
IvyConfigure settings = new IvyConfigure();
|
||||
settings.setProject(project);
|
||||
|
|
@ -346,6 +362,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDynamicConstraintDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithExtraAttributes() throws Exception {
|
||||
// test case for IVY-415
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-extra.xml");
|
||||
|
|
@ -374,6 +391,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithDynEvicted() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-dyn-evicted.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -419,6 +437,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
expectedFileSet, actualFileSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithDynEvicted2() throws Exception {
|
||||
// same as previous but dynamic dependency is placed after the one causing the conflict
|
||||
// test case for IVY-707
|
||||
|
|
@ -467,6 +486,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
list.delete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceImportedConfigurations() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-import-confs.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -483,11 +503,12 @@ public class IvyDeliverTest extends TestCase {
|
|||
String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
|
||||
deliveredIvyFile)));
|
||||
assertTrue("import not replaced: import can still be found in file",
|
||||
deliveredFileContent.indexOf("import") == -1);
|
||||
!deliveredFileContent.contains("import"));
|
||||
assertTrue("import not replaced: conf1 cannot be found in file",
|
||||
deliveredFileContent.indexOf("conf1") != -1);
|
||||
deliveredFileContent.contains("conf1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceVariables() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-with-variables.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -506,11 +527,12 @@ public class IvyDeliverTest extends TestCase {
|
|||
String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
|
||||
deliveredIvyFile)));
|
||||
assertTrue("variable not replaced: myvar can still be found in file",
|
||||
deliveredFileContent.indexOf("myvar") == -1);
|
||||
!deliveredFileContent.contains("myvar"));
|
||||
assertTrue("variable not replaced: myvalue cannot be found in file",
|
||||
deliveredFileContent.indexOf("myvalue") != -1);
|
||||
deliveredFileContent.contains("myvalue"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoReplaceDynamicRev() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -535,6 +557,7 @@ public class IvyDeliverTest extends TestCase {
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDifferentRevisionsForSameModule() throws Exception {
|
||||
project.setProperty("ivy.dep.file",
|
||||
"test/java/org/apache/ivy/ant/ivy-different-revisions.xml");
|
||||
|
|
|
|||
|
|
@ -21,16 +21,24 @@ import java.io.File;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.ant.testutil.AntTaskTestCase;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class IvyDependencyTreeTest extends AntTaskTestCase {
|
||||
|
||||
private IvyDependencyTree dependencyTree;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = configureProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -40,10 +48,12 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
dependencyTree.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
dependencyTree.execute();
|
||||
|
|
@ -51,6 +61,7 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
assertLogContaining("\\- org1#mod1.2;2.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmpty() throws Exception {
|
||||
dependencyTree.setFile(new File("test/java/org/apache/ivy/ant/ivy-empty.xml"));
|
||||
dependencyTree.execute();
|
||||
|
|
@ -58,6 +69,7 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
assertLogNotContaining("\\-");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveId() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -76,6 +88,7 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
assertLogContaining("\\- org1#mod1.2;latest.integration");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdWithoutResolve() throws Exception {
|
||||
try {
|
||||
dependencyTree.execute();
|
||||
|
|
@ -85,6 +98,7 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithEvictedModule() throws Exception {
|
||||
dependencyTree.setFile(new File("test/java/org/apache/ivy/ant/ivy-dyn-evicted.xml"));
|
||||
dependencyTree.execute();
|
||||
|
|
@ -95,6 +109,7 @@ public class IvyDependencyTreeTest extends AntTaskTestCase {
|
|||
assertLogContaining("\\- org1#mod1.2;2.2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShowEvictedModule() throws Exception {
|
||||
dependencyTree.setFile(new File("test/java/org/apache/ivy/ant/ivy-dyn-evicted.xml"));
|
||||
dependencyTree.setShowEvicted(true);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,22 @@ import java.io.File;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.ant.testutil.AntTaskTestCase;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
||||
|
||||
private IvyDependencyUpdateChecker dependencyUpdateChecker;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = configureProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -39,10 +47,16 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
dependencyUpdateChecker.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
private Ivy getIvy() {
|
||||
return dependencyUpdateChecker.getIvyInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
// depends on org="org1" name="mod1.1" rev="1.0"
|
||||
// has transitive dependency on org="org1" name="mod1.2" rev="2.0"
|
||||
|
|
@ -57,6 +71,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
assertLogNotContaining("org1#mod1.2 (transitive)\t2.0 -> 2.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleAndShowTransitiveDependencies() throws Exception {
|
||||
// depends on org="org1" name="mod1.1" rev="1.0"
|
||||
// has transitive dependency on org="org1" name="mod1.2" rev="2.0"
|
||||
|
|
@ -72,6 +87,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
assertLogContaining("org1#mod1.2 (transitive)\t2.0 -> 2.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithoutIvyFile() throws Exception {
|
||||
// depends on org="org1" name="mod1.2" rev="2.0"
|
||||
|
||||
|
|
@ -84,6 +100,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
assertLogContaining("org1#mod1.2\t2.0 -> 2.2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline() throws Exception {
|
||||
// same as before, but expressing dependency directly without ivy file
|
||||
dependencyUpdateChecker.setOrganisation("org1");
|
||||
|
|
@ -97,31 +114,26 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testInlineForNonExistingModule() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker.setOrganisation("org1XXYZ");
|
||||
dependencyUpdateChecker.setModule("mod1.2");
|
||||
dependencyUpdateChecker.setRevision("2.0");
|
||||
dependencyUpdateChecker.setInline(true);
|
||||
dependencyUpdateChecker.setHaltonfailure(true);
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raise an exception
|
||||
}
|
||||
dependencyUpdateChecker.setOrganisation("org1XXYZ");
|
||||
dependencyUpdateChecker.setModule("mod1.2");
|
||||
dependencyUpdateChecker.setRevision("2.0");
|
||||
dependencyUpdateChecker.setInline(true);
|
||||
dependencyUpdateChecker.setHaltonfailure(true);
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailure() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker
|
||||
.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raise an exception
|
||||
}
|
||||
dependencyUpdateChecker
|
||||
.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailureWithMissingConfigurations() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker
|
||||
|
|
@ -130,32 +142,27 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
dependencyUpdateChecker.execute();
|
||||
fail("missing configurations didn't raised an exception");
|
||||
} catch (BuildException ex) {
|
||||
assertTrue(ex.getMessage().indexOf("unknown") != -1);
|
||||
assertTrue(ex.getMessage().contains("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailureOnBadDependencyIvyFile() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker.setFile(new File(
|
||||
"test/java/org/apache/ivy/ant/ivy-failure2.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raise an exception
|
||||
}
|
||||
dependencyUpdateChecker.setFile(new File(
|
||||
"test/java/org/apache/ivy/ant/ivy-failure2.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailureOnBadStatusInDependencyIvyFile() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker.setFile(new File(
|
||||
"test/java/org/apache/ivy/ant/ivy-failure3.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raise an exception
|
||||
}
|
||||
dependencyUpdateChecker.setFile(new File(
|
||||
"test/java/org/apache/ivy/ant/ivy-failure3.xml"));
|
||||
dependencyUpdateChecker.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnFailure() throws Exception {
|
||||
try {
|
||||
dependencyUpdateChecker
|
||||
|
|
@ -168,6 +175,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcludedConf() throws Exception {
|
||||
dependencyUpdateChecker.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
|
||||
dependencyUpdateChecker.setConf("*,!default");
|
||||
|
|
@ -182,9 +190,10 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
assertLogContaining("All dependencies are up to date");
|
||||
// test the properties
|
||||
Project project = dependencyUpdateChecker.getProject();
|
||||
assertFalse(project.getProperty("ivy.resolved.configurations").indexOf("default") > -1);
|
||||
assertFalse(project.getProperty("ivy.resolved.configurations").contains("default"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithAbsoluteFile() {
|
||||
// IVY-396
|
||||
File ivyFile = new File("test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
|
|
@ -195,6 +204,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
// ModuleRevisionId.newInstance("apache", "resolve-simple", "1.0")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithRelativeFile() {
|
||||
// IVY-396
|
||||
dependencyUpdateChecker.getProject().setProperty("ivy.dep.file",
|
||||
|
|
@ -208,10 +218,7 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
assertLogContaining("org1#mod1.2\t2.0 -> 2.2");
|
||||
}
|
||||
|
||||
private Ivy getIvy() {
|
||||
return dependencyUpdateChecker.getIvyInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleExtends() throws Exception {
|
||||
dependencyUpdateChecker.setFile(new File(
|
||||
"test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml"));
|
||||
|
|
@ -233,7 +240,6 @@ public class IvyDependencyUpdateCheckerTest extends AntTaskTestCase {
|
|||
|
||||
// inherited from parent
|
||||
assertLogContaining("org1#mod1.2\t2.0 -> 2.2");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,15 +18,21 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyFindRevisionTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class IvyFindRevisionTest {
|
||||
|
||||
private IvyFindRevision findRevision;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -35,10 +41,12 @@ public class IvyFindRevisionTest extends TestCase {
|
|||
findRevision.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProperty() throws Exception {
|
||||
findRevision.setOrganisation("org1");
|
||||
findRevision.setModule("mod1.1");
|
||||
|
|
@ -48,6 +56,7 @@ public class IvyFindRevisionTest extends TestCase {
|
|||
assertEquals("1.0", findRevision.getProject().getProperty("test.revision"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatest() throws Exception {
|
||||
findRevision.setOrganisation("org1");
|
||||
findRevision.setModule("mod1.1");
|
||||
|
|
@ -56,6 +65,7 @@ public class IvyFindRevisionTest extends TestCase {
|
|||
assertEquals("2.0", findRevision.getProject().getProperty("ivy.revision"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestSubversion() throws Exception {
|
||||
findRevision.setOrganisation("org1");
|
||||
findRevision.setModule("mod1.1");
|
||||
|
|
|
|||
|
|
@ -18,15 +18,21 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyInfoRepositoryTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class IvyInfoRepositoryTest {
|
||||
|
||||
private IvyInfo info;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -35,10 +41,12 @@ public class IvyInfoRepositoryTest extends TestCase {
|
|||
info.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProperty() throws Exception {
|
||||
info.setOrganisation("org1");
|
||||
info.setModule("mod1.1");
|
||||
|
|
@ -52,6 +60,7 @@ public class IvyInfoRepositoryTest extends TestCase {
|
|||
assertEquals("default", info.getProject().getProperty("test.configurations"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatest() throws Exception {
|
||||
info.setOrganisation("org1");
|
||||
info.setModule("mod1.1");
|
||||
|
|
@ -64,6 +73,7 @@ public class IvyInfoRepositoryTest extends TestCase {
|
|||
assertEquals("default", info.getProject().getProperty("ivy.configurations"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestSubversion() throws Exception {
|
||||
info.setOrganisation("org1");
|
||||
info.setModule("mod1.1");
|
||||
|
|
|
|||
|
|
@ -20,20 +20,28 @@ package org.apache.ivy.ant;
|
|||
import java.io.File;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyInfoTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyInfoTest {
|
||||
private IvyInfo info;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
Project project = TestHelper.newProject();
|
||||
|
||||
info = new IvyInfo();
|
||||
info.setProject(project);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
info.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
info.execute();
|
||||
|
|
@ -45,6 +53,7 @@ public class IvyInfoTest extends TestCase {
|
|||
assertEquals("default", info.getProject().getProperty("ivy.public.configurations"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAll() throws Exception {
|
||||
info.setFile(new File("test/java/org/apache/ivy/ant/ivy-info-all.xml"));
|
||||
info.execute();
|
||||
|
|
@ -66,6 +75,7 @@ public class IvyInfoTest extends TestCase {
|
|||
assertNull(info.getProject().getProperty("ivy.configuration.private.desc"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY726() throws Exception {
|
||||
info.setFile(new File("test/java/org/apache/ivy/ant/ivy-info-all.xml"));
|
||||
info.execute();
|
||||
|
|
@ -73,6 +83,7 @@ public class IvyInfoTest extends TestCase {
|
|||
assertTrue(info.getProject().getProperty("ivy.extra.branch") == null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY395() throws Exception {
|
||||
info.setFile(new File("test/java/org/apache/ivy/ant/ivy-artifact-info.xml"));
|
||||
info.execute();
|
||||
|
|
|
|||
|
|
@ -21,19 +21,28 @@ import java.io.File;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyInstallTest extends TestCase {
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
||||
public class IvyInstallTest {
|
||||
private File cache;
|
||||
|
||||
private IvyInstall install;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
cleanInstall();
|
||||
|
||||
|
|
@ -49,7 +58,8 @@ public class IvyInstallTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
cleanCache();
|
||||
cleanInstall();
|
||||
}
|
||||
|
|
@ -63,6 +73,7 @@ public class IvyInstallTest extends TestCase {
|
|||
FileUtil.forceDelete(new File("build/test/install2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallDummyDefault() {
|
||||
project.setProperty("ivy.settings.file",
|
||||
"test/repositories/ivysettings-dummydefaultresolver.xml");
|
||||
|
|
@ -84,6 +95,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithAnyType() {
|
||||
project.setProperty("ivy.settings.file",
|
||||
"test/repositories/ivysettings-dummydefaultresolver.xml");
|
||||
|
|
@ -99,6 +111,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org8/mod8.1/a-1.1.txt").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithMultipleType() {
|
||||
project.setProperty("ivy.settings.file",
|
||||
"test/repositories/ivysettings-dummydefaultresolver.xml");
|
||||
|
|
@ -117,6 +130,7 @@ public class IvyInstallTest extends TestCase {
|
|||
/**
|
||||
* Normal case; no confs set (should use the default->* configuration).
|
||||
*/
|
||||
@Test
|
||||
public void testInstallWithConfsDefaultSettings() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/IVY-1313/ivysettings.xml");
|
||||
install.setOrganisation("org1");
|
||||
|
|
@ -136,6 +150,7 @@ public class IvyInstallTest extends TestCase {
|
|||
/**
|
||||
* Test retrieving artifacts under only the master and runtime configuration.
|
||||
*/
|
||||
@Test
|
||||
public void testInstallWithConfsRuntimeOnly() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/IVY-1313/ivysettings.xml");
|
||||
install.setOrganisation("org1");
|
||||
|
|
@ -153,6 +168,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertFalse(new File("build/test/install/org1/mod3/jars/mod3-1.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithClassifiers() throws Exception {
|
||||
// IVY-1324
|
||||
project.setProperty("ivy.settings.url", new File("test/repositories/m2/ivysettings.xml")
|
||||
|
|
@ -175,6 +191,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org.apache/test-sources/ivy-1.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithUnusedType() {
|
||||
project.setProperty("ivy.settings.file",
|
||||
"test/repositories/ivysettings-dummydefaultresolver.xml");
|
||||
|
|
@ -190,6 +207,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertFalse(new File("build/test/install/org8/mod8.1/a-1.1.txt").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithOriginalMetadata() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
install.setOrganisation("org.apache");
|
||||
|
|
@ -219,6 +237,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY843() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-IVY843.xml");
|
||||
install.setOrganisation("org1");
|
||||
|
|
@ -238,6 +257,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install2/org1/mod1.4/ivy-1.0.1.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithBranch() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/branches/ivysettings.xml");
|
||||
install.setOrganisation("foo");
|
||||
|
|
@ -252,6 +272,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/foo/foo1/branch1/ivy-2.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithNamespace() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/namespace/ivysettings.xml");
|
||||
install.setOrganisation("systemorg");
|
||||
|
|
@ -267,6 +288,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/systemorg/systemmod/ivy-1.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithNamespace2() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/namespace/ivysettings.xml");
|
||||
install.setOrganisation("A");
|
||||
|
|
@ -284,6 +306,7 @@ public class IvyInstallTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstallWithNamespace3() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/namespace/ivysettings.xml");
|
||||
install.setOrganisation("*");
|
||||
|
|
@ -299,6 +322,7 @@ public class IvyInstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/systemorg/systemmod/ivy-1.0.xml").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencyNotFoundFailure() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
install.setOrganisation("xxx");
|
||||
|
|
@ -315,6 +339,7 @@ public class IvyInstallTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencyNotFoundSuccess() {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
install.setOrganisation("xxx");
|
||||
|
|
|
|||
|
|
@ -18,15 +18,21 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyListModulesTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class IvyListModulesTest {
|
||||
|
||||
private IvyListModules findModules;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -35,10 +41,12 @@ public class IvyListModulesTest extends TestCase {
|
|||
findModules.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExact() throws Exception {
|
||||
findModules.setOrganisation("org1");
|
||||
findModules.setModule("mod1.1");
|
||||
|
|
@ -49,6 +57,7 @@ public class IvyListModulesTest extends TestCase {
|
|||
assertEquals("org1/mod1.1/1.0", findModules.getProject().getProperty("found"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllRevs() throws Exception {
|
||||
findModules.setOrganisation("org1");
|
||||
findModules.setModule("mod1.1");
|
||||
|
|
|
|||
|
|
@ -22,19 +22,25 @@ import java.io.File;
|
|||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.ivy.util.CacheCleaner;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyPostResolveTaskTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyPostResolveTaskTest {
|
||||
private File cache;
|
||||
|
||||
private IvyPostResolveTask task;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -53,10 +59,12 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPreviousResolveInSameBuildAndLessConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -75,6 +83,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
reportAfter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPreviousResolveInSameBuildAndSameConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -93,6 +102,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
reportAfter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPreviousResolveInSameBuildAndWildcard() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -111,6 +121,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
reportAfter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPreviousResolveInSameBuildAndBothWildcard() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -129,6 +140,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
reportAfter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPreviousResolveInSameBuildAndMoreConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -150,6 +162,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithoutKeep() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -172,6 +185,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineWithoutKeep() throws Exception {
|
||||
task.setOrganisation("org1");
|
||||
task.setModule("mod1.1");
|
||||
|
|
@ -187,6 +201,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineWithKeep() throws Exception {
|
||||
task.setOrganisation("org1");
|
||||
task.setModule("mod1.1");
|
||||
|
|
@ -203,6 +218,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndPreviousResolveInSameBuildAndLessConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -237,6 +253,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
report2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndPreviousResolveInSameBuildAndSameConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -271,6 +288,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
report2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndPreviousResolveInSameBuildAndWildcard() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -305,6 +323,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
report2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndPreviousResolveInSameBuildAndBothWildcard() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
@ -339,6 +358,7 @@ public class IvyPostResolveTaskTest extends TestCase {
|
|||
report2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveIdAndPreviousResolveInSameBuildAndMoreConfs() throws Exception {
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
resolve.setProject(project);
|
||||
|
|
|
|||
|
|
@ -31,21 +31,27 @@ import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
|||
import org.apache.ivy.util.DefaultMessageLogger;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.apache.tools.ant.taskdefs.Echo;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyPublishTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyPublishTest {
|
||||
private File cache;
|
||||
|
||||
private IvyPublish publish;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
cleanTestDir();
|
||||
cleanRep();
|
||||
createCache();
|
||||
|
|
@ -66,7 +72,8 @@ public class IvyPublishTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
cleanCache();
|
||||
cleanTestDir();
|
||||
cleanRep();
|
||||
|
|
@ -88,6 +95,7 @@ public class IvyPublishTest extends TestCase {
|
|||
del.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeParent() throws IOException, ParseException {
|
||||
// publish the parent descriptor first, so that it can be found while
|
||||
// we are reading the child descriptor.
|
||||
|
|
@ -126,6 +134,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-merged.xml")));
|
||||
|
|
@ -134,7 +143,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -147,6 +156,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeParentWithoutPublishingParent() throws IOException, ParseException {
|
||||
// here we directly publish a module extending ivy-multiconf.xml,
|
||||
// the module parent is not published not yet in cache
|
||||
|
|
@ -174,6 +184,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-merged.xml")));
|
||||
|
|
@ -182,7 +193,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -195,8 +206,9 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public void testMergeParentWithoutPublishingParentForceDeliver() throws IOException,
|
||||
ParseException {
|
||||
@Test
|
||||
public void testMergeParentWithoutPublishingParentForceDeliver()
|
||||
throws IOException, ParseException {
|
||||
// here we directly publish a module extending ivy-multiconf.xml,
|
||||
// the module parent is not published not yet in cache
|
||||
// See : IVY-1248
|
||||
|
|
@ -228,6 +240,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-merged.xml")));
|
||||
|
|
@ -236,7 +249,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -249,6 +262,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeParentWithoutLocationAttribute() throws IOException, ParseException {
|
||||
// See : IVY-XXX
|
||||
|
||||
|
|
@ -276,6 +290,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("extends/child1/ivy-child1-merged.xml")));
|
||||
|
|
@ -284,7 +299,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -297,6 +312,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinimalMerge() throws IOException, ParseException {
|
||||
// publish the parent descriptor first, so that it can be found while
|
||||
// we are reading the child descriptor.
|
||||
|
|
@ -334,6 +350,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-minimal-merged.xml")));
|
||||
|
|
@ -342,7 +359,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -355,6 +372,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeExtraAttributes() throws IOException, ParseException {
|
||||
// publish the parent descriptor first, so that it can be found while
|
||||
// we are reading the child descriptor.
|
||||
|
|
@ -398,6 +416,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-extra-attributes-merged.xml")));
|
||||
|
|
@ -406,7 +425,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -419,6 +438,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeExtraAttributesFromParent() throws IOException, ParseException {
|
||||
// publish the parent descriptor first, so that it can be found while
|
||||
// we are reading the child descriptor.
|
||||
|
|
@ -463,6 +483,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
int lineNo = 1;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
BufferedReader merged = new BufferedReader(new FileReader(published));
|
||||
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
|
||||
.getResourceAsStream("ivy-extends-extra-attributes-merged.xml")));
|
||||
|
|
@ -471,7 +492,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.readLine()) {
|
||||
|
||||
// strip timestamps for the comparison
|
||||
if (mergeLine.indexOf("<info") >= 0) {
|
||||
if (mergeLine.contains("<info")) {
|
||||
mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
|
||||
}
|
||||
// discard whitespace-only lines
|
||||
|
|
@ -484,6 +505,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -512,6 +534,7 @@ public class IvyPublishTest extends TestCase {
|
|||
assertEquals("1.2", md.getModuleRevisionId().getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnMissing() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -525,8 +548,8 @@ public class IvyPublishTest extends TestCase {
|
|||
publish.execute();
|
||||
fail("publish with haltonmissing and a missing artifact should raise an exception");
|
||||
} catch (BuildException ex) {
|
||||
assertTrue(ex.getMessage().indexOf("missing") != -1);
|
||||
assertTrue(ex.getMessage().indexOf("resolve-simple.jar") != -1);
|
||||
assertTrue(ex.getMessage().contains("missing"));
|
||||
assertTrue(ex.getMessage().contains("resolve-simple.jar"));
|
||||
// should have do the ivy delivering
|
||||
assertTrue(new File("build/test/publish/ivy-1.2.xml").exists());
|
||||
|
||||
|
|
@ -539,6 +562,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnMissing2() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-publish-multi.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -556,8 +580,8 @@ public class IvyPublishTest extends TestCase {
|
|||
publish.execute();
|
||||
fail("publish with haltonmissing and a missing artifact should raise an exception");
|
||||
} catch (BuildException ex) {
|
||||
assertTrue(ex.getMessage().indexOf("missing") != -1);
|
||||
assertTrue(ex.getMessage().indexOf("multi2.jar") != -1);
|
||||
assertTrue(ex.getMessage().contains("missing"));
|
||||
assertTrue(ex.getMessage().contains("multi2.jar"));
|
||||
|
||||
// should have do the ivy delivering
|
||||
assertTrue(new File("build/test/publish/ivy-1.2.xml").exists());
|
||||
|
|
@ -567,6 +591,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnMissing3() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-publish-multi.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -584,8 +609,8 @@ public class IvyPublishTest extends TestCase {
|
|||
publish.execute();
|
||||
fail("publish with haltonmissing and a missing artifact should raise an exception");
|
||||
} catch (BuildException ex) {
|
||||
assertTrue(ex.getMessage().indexOf("missing") != -1);
|
||||
assertTrue(ex.getMessage().indexOf("multi2.jar") != -1);
|
||||
assertTrue(ex.getMessage().contains("missing"));
|
||||
assertTrue(ex.getMessage().contains("multi2.jar"));
|
||||
|
||||
// should have do the ivy delivering
|
||||
assertTrue(new File("build/test/publish/ivy-1.2.xml").exists());
|
||||
|
|
@ -595,6 +620,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPublishNotAllConfigs() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -630,6 +656,7 @@ public class IvyPublishTest extends TestCase {
|
|||
assertEquals("Compile configuration not present", "compile", configs[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiPatterns() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-publish-multi.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -655,6 +682,7 @@ public class IvyPublishTest extends TestCase {
|
|||
assertTrue(new File("test/repositories/1/apache/multi/jars/multi2-1.2.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPublishPublicConfigsByWildcard() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-publish-public.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -678,6 +706,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustom() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-custom.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -720,6 +749,7 @@ public class IvyPublishTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoDeliver() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -754,6 +784,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoDeliverWithBranch() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -791,6 +822,7 @@ public class IvyPublishTest extends TestCase {
|
|||
.getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testForceDeliver() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -822,6 +854,7 @@ public class IvyPublishTest extends TestCase {
|
|||
assertEquals("1.3", md.getModuleRevisionId().getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadNoDeliver() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -845,6 +878,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadonly() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -885,6 +919,7 @@ public class IvyPublishTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverwrite() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
@ -920,6 +955,7 @@ public class IvyPublishTest extends TestCase {
|
|||
reader.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverwriteReadOnly() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
IvyResolve res = new IvyResolve();
|
||||
|
|
|
|||
|
|
@ -22,17 +22,23 @@ import java.util.Locale;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyReportTest extends TestCase {
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyReportTest {
|
||||
|
||||
private IvyReport report;
|
||||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -43,10 +49,12 @@ public class IvyReportTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
@ -70,6 +78,7 @@ public class IvyReportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithLatest() throws Exception {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
@ -99,6 +108,7 @@ public class IvyReportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyCssIfTodirNotSet() {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
@ -123,6 +133,7 @@ public class IvyReportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoRevisionInOutputPattern() throws Exception {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
@ -147,6 +158,7 @@ public class IvyReportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleConfigurations() throws Exception {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
@ -171,6 +183,7 @@ public class IvyReportTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegularCircular() throws Exception {
|
||||
Locale oldLocale = Locale.getDefault();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,15 +23,21 @@ import java.io.FileReader;
|
|||
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyRepositoryReportTest extends TestCase {
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyRepositoryReportTest {
|
||||
|
||||
private IvyRepositoryReport report;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
|
||||
|
|
@ -41,10 +47,12 @@ public class IvyRepositoryReportTest extends TestCase {
|
|||
System.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
report.setOrganisation("org1");
|
||||
report.setOutputname("testsimple");
|
||||
|
|
@ -56,14 +64,15 @@ public class IvyRepositoryReportTest extends TestCase {
|
|||
String g = FileUtil.readEntirely(new BufferedReader(new FileReader(reportFile)));
|
||||
|
||||
// check presence of the modules
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.1\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.2\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.3\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.4\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.5\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.6\"") != -1);
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.1\""));
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.2\""));
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.3\""));
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.4\""));
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.5\""));
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.6\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBranchBeforeModule() throws Exception {
|
||||
report.getProject().setProperty("ivy.settings.file",
|
||||
"test/repositories/IVY-716/ivysettings.xml");
|
||||
|
|
@ -76,13 +85,14 @@ public class IvyRepositoryReportTest extends TestCase {
|
|||
String g = FileUtil.readEntirely(new BufferedReader(new FileReader(reportFile)));
|
||||
|
||||
// check presence of the modules
|
||||
assertTrue(g.indexOf("<module organisation=\"org1\" name=\"mod1.1\"") != -1);
|
||||
assertTrue(g.contains("<module organisation=\"org1\" name=\"mod1.1\""));
|
||||
|
||||
// check presence of the branches
|
||||
assertTrue(g.indexOf("<revision name=\"1.0\" branch=\"branch1\"") != -1);
|
||||
assertTrue(g.indexOf("<revision name=\"1.0\" branch=\"branch2\"") != -1);
|
||||
assertTrue(g.contains("<revision name=\"1.0\" branch=\"branch1\""));
|
||||
assertTrue(g.contains("<revision name=\"1.0\" branch=\"branch2\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPatternWithoutOrganisation() throws Exception {
|
||||
report.getProject().setProperty("ivy.settings.file",
|
||||
"test/repositories/IVY-729/ivysettings.xml");
|
||||
|
|
@ -95,8 +105,8 @@ public class IvyRepositoryReportTest extends TestCase {
|
|||
String g = FileUtil.readEntirely(new BufferedReader(new FileReader(reportFile)));
|
||||
|
||||
// check presence of the modules
|
||||
assertTrue(g.indexOf("<module organisation=\"null\" name=\"a\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"null\" name=\"b\"") != -1);
|
||||
assertTrue(g.indexOf("<module organisation=\"null\" name=\"c\"") != -1);
|
||||
assertTrue(g.contains("<module organisation=\"null\" name=\"a\""));
|
||||
assertTrue(g.contains("<module organisation=\"null\" name=\"b\""));
|
||||
assertTrue(g.contains("<module organisation=\"null\" name=\"c\""));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,26 @@ import org.apache.ivy.Ivy;
|
|||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Parallel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyResolveTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvyResolveTest {
|
||||
|
||||
private Project project;
|
||||
|
||||
private IvyResolve resolve;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -45,10 +52,12 @@ public class IvyResolveTest extends TestCase {
|
|||
resolve.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY1455() throws Exception {
|
||||
project.setProperty("ivy.settings.file", "test/repositories/IVY-1455/ivysettings.xml");
|
||||
resolve.setFile(new File("test/repositories/IVY-1455/ivy.xml"));
|
||||
|
|
@ -56,7 +65,9 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
|
||||
/* disabled: Ivy is not thread-safe, and this usage is not supported at this time */
|
||||
public void disabledIVY1454() throws Exception {
|
||||
@Test
|
||||
@Ignore
|
||||
public void disabledIVY1454() {
|
||||
// run init in parent thread, then resolve in children
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-with-nio.xml");
|
||||
project.setProperty("ivy.log.locking", "true");
|
||||
|
|
@ -71,6 +82,7 @@ public class IvyResolveTest extends TestCase {
|
|||
parallel.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY779() throws Exception {
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.local.default.root",
|
||||
|
|
@ -90,6 +102,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertEquals(1, report.getArtifacts().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
// depends on org="org1" name="mod1.2" rev="2.0"
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
|
|
@ -104,6 +117,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithoutIvyFile() throws Exception {
|
||||
// IVY-630
|
||||
resolve.getProject().setProperty("ivy.settings.file",
|
||||
|
|
@ -133,6 +147,7 @@ public class IvyResolveTest extends TestCase {
|
|||
return getIvy().getResolutionCacheManager().getResolvedIvyFileInCache(id);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline() throws Exception {
|
||||
// same as before, but expressing dependency directly without ivy file
|
||||
resolve.setOrganisation("org1");
|
||||
|
|
@ -147,6 +162,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineWithResolveId() throws Exception {
|
||||
// same as before, but expressing dependency directly without ivy file
|
||||
resolve.setOrganisation("org1");
|
||||
|
|
@ -163,6 +179,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineForNonExistingModule() throws Exception {
|
||||
resolve.setOrganisation("org1XX");
|
||||
resolve.setModule("mod1.2");
|
||||
|
|
@ -174,10 +191,10 @@ public class IvyResolveTest extends TestCase {
|
|||
|
||||
// the resolve must have failed -> the failure property must be set
|
||||
String failure = resolve.getProject().getProperty("failure.property");
|
||||
assertTrue("Failure property must have been specified!", Boolean.valueOf(failure)
|
||||
.booleanValue());
|
||||
assertTrue("Failure property must have been specified!", Boolean.valueOf(failure));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithSlashes() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/core/resolve/ivy-198.xml"));
|
||||
resolve.execute();
|
||||
|
|
@ -197,6 +214,7 @@ public class IvyResolveTest extends TestCase {
|
|||
"jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDepsChanged() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.execute();
|
||||
|
|
@ -208,6 +226,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertEquals("false", getIvy().getVariable("ivy.deps.changed"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDontCheckIfChanged() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.setCheckIfChanged(false);
|
||||
|
|
@ -219,6 +238,7 @@ public class IvyResolveTest extends TestCase {
|
|||
// but this would require a too big refactoring to inject a mock object
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConflictingDepsChanged() throws Exception {
|
||||
resolve.setFile(new File("test/repositories/2/mod4.1/ivy-4.1.xml"));
|
||||
resolve.execute();
|
||||
|
|
@ -230,6 +250,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertEquals("false", getIvy().getVariable("ivy.deps.changed"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDouble() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.execute();
|
||||
|
|
@ -244,6 +265,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertEquals("1.1", getIvy().getVariable("ivy.revision"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure() throws Exception {
|
||||
try {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure.xml"));
|
||||
|
|
@ -254,6 +276,7 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIvyLogModulesInUseWithFailure() throws Exception {
|
||||
resolve.getProject().setProperty("ivy.log.modules.in.use", "true");
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure.xml"));
|
||||
|
|
@ -263,6 +286,7 @@ public class IvyResolveTest extends TestCase {
|
|||
// we did manage to get here, so no NPE has been thrown (IVY-961)
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailureWithMissingConfigurations() throws Exception {
|
||||
try {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
|
|
@ -270,10 +294,11 @@ public class IvyResolveTest extends TestCase {
|
|||
resolve.execute();
|
||||
fail("missing configurations didn't raised an exception");
|
||||
} catch (BuildException ex) {
|
||||
assertTrue(ex.getMessage().indexOf("unknown") != -1);
|
||||
assertTrue(ex.getMessage().contains("unknown"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailureOnBadDependencyIvyFile() throws Exception {
|
||||
try {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure2.xml"));
|
||||
|
|
@ -284,6 +309,7 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailureOnBadStatusInDependencyIvyFile() throws Exception {
|
||||
try {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure3.xml"));
|
||||
|
|
@ -294,6 +320,7 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnFailure() throws Exception {
|
||||
try {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-failure.xml"));
|
||||
|
|
@ -305,6 +332,7 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithResolveId() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.setResolveId("testWithResolveId");
|
||||
|
|
@ -343,6 +371,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertNotNull(project.getReference("ivy.resolved.configurations.ref.testWithResolveId"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoubleResolveWithResolveId() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.setResolveId("testWithResolveId");
|
||||
|
|
@ -376,6 +405,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertNotNull(project.getReference("ivy.resolved.configurations.ref.testWithResolveId"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDifferentResolveWithSameResolveId() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml"));
|
||||
resolve.setResolveId("testWithResolveId");
|
||||
|
|
@ -410,6 +440,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertNotNull(project.getReference("ivy.resolved.configurations.ref.testWithResolveId"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExcludedConf() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
|
||||
resolve.setConf("*,!default");
|
||||
|
|
@ -422,9 +453,10 @@ public class IvyResolveTest extends TestCase {
|
|||
|
||||
// test the properties
|
||||
Project project = resolve.getProject();
|
||||
assertFalse(project.getProperty("ivy.resolved.configurations").indexOf("default") > -1);
|
||||
assertFalse(project.getProperty("ivy.resolved.configurations").contains("default"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithAbsoluteFile() {
|
||||
// IVY-396
|
||||
File ivyFile = new File("test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
|
|
@ -435,6 +467,7 @@ public class IvyResolveTest extends TestCase {
|
|||
ModuleRevisionId.newInstance("apache", "resolve-simple", "1.0")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveWithRelativeFile() {
|
||||
// IVY-396
|
||||
resolve.getProject().setProperty("ivy.dep.file",
|
||||
|
|
@ -449,6 +482,7 @@ public class IvyResolveTest extends TestCase {
|
|||
return resolve.getIvyInstance();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsSimple() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -460,6 +494,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsMultiple() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -480,6 +515,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsMultipleWithConf() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -499,6 +535,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.7", "mod2.1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsMultipleWithConf2() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -519,6 +556,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org1", "mod1.1", "1.0", "mod1.1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsExclude() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -542,6 +580,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.7", "mod2.1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsDependencyExclude() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -564,6 +603,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org2", "mod2.1", "0.7", "mod2.1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsDependencyInclude() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -584,6 +624,7 @@ public class IvyResolveTest extends TestCase {
|
|||
assertTrue(getArchiveFileInCache("org2", "mod2.2", "0.9", "art22-1", "jar", "jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChildsFail() throws Exception {
|
||||
IvyDependency dependency = resolve.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -598,6 +639,7 @@ public class IvyResolveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleExtends() throws Exception {
|
||||
resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml"));
|
||||
resolve.execute();
|
||||
|
|
|
|||
|
|
@ -24,17 +24,25 @@ import java.util.List;
|
|||
|
||||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.resources.FileResource;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyResourcesTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class IvyResourcesTest {
|
||||
|
||||
private IvyResources resources;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
Project project = TestHelper.newProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");
|
||||
|
|
@ -44,7 +52,8 @@ public class IvyResourcesTest extends TestCase {
|
|||
resources.setProject(project);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
|
|
@ -69,6 +78,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
return resources;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -81,6 +91,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
files.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiple() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -106,6 +117,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleWithConf() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -128,6 +140,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleWithConf2() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -152,6 +165,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExclude() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -178,6 +192,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencyExclude() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -203,6 +218,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencyInclude() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
@ -225,6 +241,7 @@ public class IvyResourcesTest extends TestCase {
|
|||
"jar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFail() throws Exception {
|
||||
IvyDependency dependency = resources.createDependency();
|
||||
dependency.setOrg("org1");
|
||||
|
|
|
|||
|
|
@ -18,17 +18,30 @@
|
|||
package org.apache.ivy.ant;
|
||||
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.tools.ant.BuildFileTest;
|
||||
|
||||
public class IvyRetrieveBuildFileTest extends BuildFileTest {
|
||||
import org.apache.tools.ant.BuildFileRule;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class IvyRetrieveBuildFileTest {
|
||||
@Rule
|
||||
public final BuildFileRule buildRule = new BuildFileRule();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
buildRule.configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleInlineRetrievesWithCacheCleaning() {
|
||||
executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
|
||||
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
|
||||
buildRule.executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
|
||||
ResolveReport report = buildRule.getProject().getReference("ivy.resolved.report");
|
||||
assertNotNull(report);
|
||||
assertFalse(report.hasError());
|
||||
assertEquals(1, report.getDependencies().size());
|
||||
|
|
|
|||
|
|
@ -23,12 +23,19 @@ import java.io.IOException;
|
|||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.IvyPatternHelper;
|
||||
import org.apache.ivy.util.CacheCleaner;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyRetrieveTest extends TestCase {
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class IvyRetrieveTest {
|
||||
private static final String IVY_RETRIEVE_PATTERN = "build/test/lib/[organisation]/[module]/ivy-[revision].xml";
|
||||
|
||||
private static final String RETRIEVE_PATTERN = "build/test/lib/[conf]/[artifact]-[revision].[type]";
|
||||
|
|
@ -39,7 +46,8 @@ public class IvyRetrieveTest extends TestCase {
|
|||
|
||||
private Project project;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
createCache();
|
||||
CacheCleaner.deleteDir(new File("build/test/lib"));
|
||||
project = TestHelper.newProject();
|
||||
|
|
@ -56,11 +64,13 @@ public class IvyRetrieveTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
CacheCleaner.deleteDir(new File("build/test/lib"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
|
||||
retrieve.execute();
|
||||
|
|
@ -68,6 +78,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrievePrivateWithWildcard() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-381.xml");
|
||||
retrieve.setConf("*");
|
||||
|
|
@ -78,6 +89,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod3.2", "jar", "jar", "private")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateInIvySettings() throws Exception {
|
||||
// cfr IVY-992
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest-extra.xml");
|
||||
|
|
@ -88,6 +100,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar", "default")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInline() throws Exception {
|
||||
// we first resolve another ivy file
|
||||
IvyResolve resolve = new IvyResolve();
|
||||
|
|
@ -107,6 +120,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithConf() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
|
||||
retrieve.execute();
|
||||
|
|
@ -119,6 +133,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar", "extension")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSync() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
|
||||
retrieve.setSync(true);
|
||||
|
|
@ -133,8 +148,8 @@ public class IvyRetrieveTest extends TestCase {
|
|||
new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org6", "mod6.1", "unknown",
|
||||
"mod6.1", "jar", "jar", "default")), // unknown revision
|
||||
};
|
||||
for (int i = 0; i < old.length; i++) {
|
||||
touch(old[i]);
|
||||
for (File of : old) {
|
||||
touch(of);
|
||||
}
|
||||
retrieve.execute();
|
||||
|
||||
|
|
@ -144,13 +159,14 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod6.1", "jar", "jar", "extension")).exists());
|
||||
assertTrue(new File(IvyPatternHelper.substitute(RETRIEVE_PATTERN, "org1", "mod1.2", "2.1",
|
||||
"mod1.2", "jar", "jar", "extension")).exists());
|
||||
for (int i = 0; i < old.length; i++) {
|
||||
assertFalse(old[i] + " should have been deleted by sync", old[i].exists());
|
||||
for (File of : old) {
|
||||
assertFalse(of + " should have been deleted by sync", of.exists());
|
||||
}
|
||||
assertFalse(new File("build/test/lib/unknown").exists()); // even conf directory should
|
||||
// have been deleted
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyncWithIgnoreList() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
|
||||
retrieve.setSync(true);
|
||||
|
|
@ -164,6 +180,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
assertTrue(new File("build/test/lib/.svn/test.txt").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithAPreviousResolve() throws Exception {
|
||||
// first we do a resolve in another project
|
||||
Project project = TestHelper.newProject();
|
||||
|
|
@ -183,6 +200,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithAPreviousResolveAndResolveId() throws Exception {
|
||||
// first we do a resolve in another project
|
||||
Project project = TestHelper.newProject();
|
||||
|
|
@ -204,6 +222,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseOrigin() throws Exception {
|
||||
// test case for IVY-304
|
||||
// first we do a resolve with useOrigin=true in another project
|
||||
|
|
@ -227,6 +246,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"mod1.2", "jar", "jar")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUseOriginWithIvyPattern() throws Exception {
|
||||
// mod2.5 depends on virtual mod2.3 which depends on mod2.1 which depends on mod1.1 which
|
||||
// depends on mod1.2
|
||||
|
|
@ -248,6 +268,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"ivy", "ivy", "xml")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveWithOriginalNamePattern() throws Exception {
|
||||
retrieve.setFile(new File("test/java/org/apache/ivy/ant/ivy-631.xml"));
|
||||
retrieve.setConf("default");
|
||||
|
|
@ -258,29 +279,24 @@ public class IvyRetrieveTest extends TestCase {
|
|||
assertTrue(new File("build/test/lib/default/mod1.2-2.2.jar").exists());
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailureWithoutAPreviousResolve() throws Exception {
|
||||
// we do a retrieve with the module information whereas no resolve has been previously done
|
||||
try {
|
||||
retrieve.setOrganisation("apache");
|
||||
retrieve.setModule("resolve-simple");
|
||||
retrieve.setConf("default");
|
||||
retrieve.execute();
|
||||
fail("retrieve without previous resolve should have thrown an exception");
|
||||
} catch (Exception ex) {
|
||||
// OK
|
||||
}
|
||||
retrieve.setOrganisation("apache");
|
||||
retrieve.setModule("resolve-simple");
|
||||
retrieve.setConf("default");
|
||||
retrieve.execute();
|
||||
fail("retrieve without previous resolve should have thrown an exception");
|
||||
}
|
||||
|
||||
@Test(expected = BuildException.class)
|
||||
public void testFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
retrieve.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
} catch (BuildException ex) {
|
||||
// ok => should raised an exception
|
||||
}
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
retrieve.execute();
|
||||
fail("failure didn't raised an exception with default haltonfailure setting");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHaltOnFailure() throws Exception {
|
||||
try {
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-failure.xml");
|
||||
|
|
@ -292,6 +308,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomIvyPattern() throws Exception {
|
||||
// mod2.5 depends on virtual mod2.3 which depends on mod2.1 which depends on mod1.1 which
|
||||
// depends on mod1.2
|
||||
|
|
@ -312,6 +329,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"ivy", "ivy", "xml")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomIvyPatternWithConf() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
|
||||
|
||||
|
|
@ -328,6 +346,7 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"ivy", "ivy", "xml", "extension")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyncWithIvyPattern() throws Exception {
|
||||
project.setProperty("ivy.dep.file", "test/repositories/1/org6/mod6.2/ivys/ivy-0.4.xml");
|
||||
|
||||
|
|
@ -347,8 +366,8 @@ public class IvyRetrieveTest extends TestCase {
|
|||
new File(IvyPatternHelper.substitute(ivyPattern, "unknown", "mod6.1", "0.4", "ivy",
|
||||
"ivy", "xml", "default")), // unknown organisation for ivy
|
||||
};
|
||||
for (int i = 0; i < old.length; i++) {
|
||||
touch(old[i]);
|
||||
for (File of : old) {
|
||||
touch(of);
|
||||
}
|
||||
|
||||
retrieve.execute();
|
||||
|
|
@ -359,14 +378,15 @@ public class IvyRetrieveTest extends TestCase {
|
|||
"ivy", "xml", "extension")).exists());
|
||||
assertFalse(new File(IvyPatternHelper.substitute(ivyPattern, "org1", "mod1.2", "2.1",
|
||||
"ivy", "ivy", "xml", "extension")).exists());
|
||||
for (int i = 0; i < old.length; i++) {
|
||||
assertFalse(old[i] + " should have been deleted by sync", old[i].exists());
|
||||
for (File of : old) {
|
||||
assertFalse(of + " should have been deleted by sync", of.exists());
|
||||
}
|
||||
assertFalse(new File("build/test/lib/unknown").exists());
|
||||
assertFalse(new File("build/test/lib/unk").exists());
|
||||
assertFalse(new File("build/test/lib/default/unknown").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoubleRetrieveWithDifferentConfigurations() {
|
||||
// IVY-315
|
||||
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-doubleretrieve.xml");
|
||||
|
|
|
|||
|
|
@ -23,14 +23,19 @@ import java.net.MalformedURLException;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.Reference;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyTaskTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class IvyTaskTest {
|
||||
|
||||
@Test
|
||||
public void testDefaultSettings() throws MalformedURLException {
|
||||
Project p = TestHelper.newProject();
|
||||
p.setBasedir("test/repositories");
|
||||
|
|
@ -60,6 +65,8 @@ public class IvyTaskTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void testReferencedSettings() throws MalformedURLException {
|
||||
Project p = TestHelper.newProject();
|
||||
p.setProperty("myproperty", "myvalue");
|
||||
|
|
@ -92,6 +99,7 @@ public class IvyTaskTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIvyVersionAsAntProperty() {
|
||||
Project p = TestHelper.newProject();
|
||||
p.setBasedir("test/repositories");
|
||||
|
|
|
|||
|
|
@ -20,9 +20,13 @@ package org.apache.ivy.ant;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvyVarTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class IvyVarTest {
|
||||
@Test
|
||||
public void testSimple() {
|
||||
IvyVar task = new IvyVar();
|
||||
task.setProject(TestHelper.newProject());
|
||||
|
|
@ -34,6 +38,7 @@ public class IvyVarTest extends TestCase {
|
|||
assertEquals("myvalue", ivy.getVariable("mytest"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrefix() {
|
||||
IvyVar task = new IvyVar();
|
||||
task.setProject(TestHelper.newProject());
|
||||
|
|
@ -46,6 +51,7 @@ public class IvyVarTest extends TestCase {
|
|||
assertEquals("myvalue", ivy.getVariable("myprefix.mytest"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testURL() {
|
||||
IvyVar task = new IvyVar();
|
||||
task.setProject(TestHelper.newProject());
|
||||
|
|
@ -57,6 +63,7 @@ public class IvyVarTest extends TestCase {
|
|||
assertEquals("myvalue2", ivy.getVariable("mytest2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testURLPrefix() {
|
||||
IvyVar task = new IvyVar();
|
||||
task.setProject(TestHelper.newProject());
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
package org.apache.ivy.ant.testutil;
|
||||
|
||||
import org.apache.ivy.TestHelper;
|
||||
|
||||
import org.apache.tools.ant.Project;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class AntTaskTestCase extends TestCase {
|
||||
public class AntTaskTestCase {
|
||||
|
||||
private AntTestListener antTestListener;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,31 +17,37 @@
|
|||
*/
|
||||
package org.apache.ivy.core;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class NormalRelativeUrlResolverTest extends TestCase {
|
||||
public class NormalRelativeUrlResolverTest {
|
||||
|
||||
private NormalRelativeUrlResolver t = new NormalRelativeUrlResolver();
|
||||
|
||||
@Test
|
||||
public void testRelativeHttpURL() throws MalformedURLException {
|
||||
URL base = new URL("http://xxx/file.txt");
|
||||
assertEquals(new URL("http://xxx/file2.txt"), t.getURL(base, "file2.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelativeFileURL() throws MalformedURLException {
|
||||
URL base = new URL("file://xxx/file.txt");
|
||||
assertEquals(new URL("file://xxx/file2.txt"), t.getURL(base, "file2.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelativeMixedURL() throws MalformedURLException {
|
||||
URL base = new URL("http://xxx/file.txt");
|
||||
assertEquals(new URL("file://file2.txt"), t.getURL(base, "file://file2.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileAndUrlWithAbsoluteFile() throws MalformedURLException {
|
||||
URL base = new URL("file://xxx/file.txt");
|
||||
File absFile = new File(".").getAbsoluteFile();
|
||||
|
|
@ -50,6 +56,7 @@ public class NormalRelativeUrlResolverTest extends TestCase {
|
|||
assertEquals(absFile.toURI().toURL(), t.getURL(base, absFile.toString(), "somthing.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileAndUrlWithRelativeFile() throws MalformedURLException {
|
||||
URL base = new URL("file://xxx/file.txt");
|
||||
assertEquals(new URL("file://xxx/file2.txt"), t.getURL(base, "file2.txt", null));
|
||||
|
|
@ -58,6 +65,7 @@ public class NormalRelativeUrlResolverTest extends TestCase {
|
|||
t.getURL(base, "sub/file2.txt", "something"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileAndUrlWithAbsoluteUrl() throws MalformedURLException {
|
||||
URL base = new URL("file://xxx/file.txt");
|
||||
URL otherBase = new URL("http://localhost:80/otherfile.txt");
|
||||
|
|
@ -66,6 +74,7 @@ public class NormalRelativeUrlResolverTest extends TestCase {
|
|||
assertEquals(new URL(absUrl), t.getURL(otherBase, null, absUrl));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileAndUrlWithRelativeUrl() throws MalformedURLException {
|
||||
URL base = new URL("file://xxx/file.txt");
|
||||
URL otherBase = new URL("http://localhost:80/otherfile.txt");
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
|||
import org.apache.ivy.util.FileUtil;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Not a Junit test, performance depends on the machine on which the test is run...
|
||||
|
|
@ -56,11 +59,13 @@ public class TestPerformance {
|
|||
ivy.getSettings().setDefaultResolver("def");
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +123,7 @@ public class TestPerformance {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPerfs() throws Exception {
|
||||
generateModules(70, 2, 5, 2, 15);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,20 +45,26 @@ import org.apache.ivy.util.DefaultMessageLogger;
|
|||
import org.apache.ivy.util.Message;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @see DefaultResolutionCacheManager
|
||||
*/
|
||||
public class DefaultRepositoryCacheManagerTest extends TestCase {
|
||||
public class DefaultRepositoryCacheManagerTest {
|
||||
|
||||
private DefaultRepositoryCacheManager cacheManager;
|
||||
private Artifact artifact;
|
||||
private ArtifactOrigin origin;
|
||||
private Ivy ivy;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
File f = File.createTempFile("ivycache", ".dir");
|
||||
ivy = new Ivy();
|
||||
ivy.configureDefault();
|
||||
|
|
@ -81,7 +87,8 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
cacheManager.saveArtifactOrigin(artifact, origin);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
IvyContext.popContext();
|
||||
Delete del = new Delete();
|
||||
del.setProject(new Project());
|
||||
|
|
@ -89,6 +96,7 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
del.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArtifactOrigin() {
|
||||
ArtifactOrigin found = cacheManager.getSavedArtifactOrigin(artifact);
|
||||
assertEquals(origin, found);
|
||||
|
|
@ -99,6 +107,7 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
assertTrue(ArtifactOrigin.isUnknown(found));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUniqueness() {
|
||||
cacheManager.saveArtifactOrigin(artifact, origin);
|
||||
|
||||
|
|
@ -127,8 +136,9 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
assertTrue(ArtifactOrigin.isUnknown(found));
|
||||
}
|
||||
|
||||
//TODO
|
||||
public void disableTestLatestIntegrationIsCachedPerResolver() throws Exception {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testLatestIntegrationIsCachedPerResolver() throws Exception {
|
||||
// given a module org#module
|
||||
ModuleId mi = new ModuleId("org", "module");
|
||||
|
||||
|
|
@ -140,10 +150,10 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
CacheMetadataOptions options = new CacheMetadataOptions().setCheckTTL(false);
|
||||
|
||||
// setup resolver1 to download the static content so we can call cacheModuleDescriptor
|
||||
MockResolver resolver1 = new MockResolver();
|
||||
resolver1.setName("resolver1");
|
||||
resolver1.setSettings(ivy.getSettings());
|
||||
ivy.getSettings().addResolver(resolver1);
|
||||
MockResolver resolver = new MockResolver();
|
||||
resolver.setName("resolver1");
|
||||
resolver.setSettings(ivy.getSettings());
|
||||
ivy.getSettings().addResolver(resolver);
|
||||
ResourceDownloader downloader = new ResourceDownloader() {
|
||||
public void download(Artifact artifact, Resource resource, File dest)
|
||||
throws IOException {
|
||||
|
|
@ -170,8 +180,8 @@ public class DefaultRepositoryCacheManagerTest extends TestCase {
|
|||
ResolvedResource mdRef11 = new ResolvedResource(resource11, "1.1");
|
||||
|
||||
// tell the cache about 1.1
|
||||
ResolvedModuleRevision rmr11 = cacheManager.cacheModuleDescriptor(resolver1, mdRef11, dd11, artifact11, downloader, options);
|
||||
cacheManager.originalToCachedModuleDescriptor(resolver1, mdRef11, artifact11, rmr11, writer);
|
||||
ResolvedModuleRevision rmr11 = cacheManager.cacheModuleDescriptor(resolver, mdRef11, dd11, artifact11, downloader, options);
|
||||
cacheManager.originalToCachedModuleDescriptor(resolver, mdRef11, artifact11, rmr11, writer);
|
||||
// and use the new overload that passes in resolver name
|
||||
cacheManager.saveResolvedRevision("resolver1", mridLatest, "1.1");
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@ import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
|||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.ParserSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
||||
|
||||
public class ModuleDescriptorMemoryCacheTest {
|
||||
|
||||
ModuleDescriptorMemoryCache cache = new ModuleDescriptorMemoryCache(2);
|
||||
|
||||
|
|
@ -38,11 +40,11 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
|
||||
IvySettings ivySettings2 = new IvySettings();
|
||||
|
||||
File url1 = new File("file://cached/file.txt");;
|
||||
File url1 = new File("file://cached/file.txt");
|
||||
|
||||
File url2 = new File("file://cached/file2.txt");;
|
||||
File url2 = new File("file://cached/file2.txt");
|
||||
|
||||
File url3 = new File("file://cached/file3.txt");;
|
||||
File url3 = new File("file://cached/file3.txt");
|
||||
|
||||
ModuleRevisionId mrid1 = ModuleRevisionId.newInstance("org", "name", "rev");
|
||||
|
||||
|
|
@ -56,6 +58,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
|
||||
ModuleDescriptor md3 = DefaultModuleDescriptor.newDefaultInstance(mrid3);
|
||||
|
||||
@Test
|
||||
public void testUseModuleDescriptorProviderWhenModuleNotCached() throws ParseException,
|
||||
IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
|
|
@ -63,6 +66,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
providerMock.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheResultOfModuleDescriptorProvider() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = null;
|
||||
|
|
@ -70,15 +74,16 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
assertEquals(md1, cache.get(url1, ivySettings, false, providerMock2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationClearInvalidatedCache() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = new ModuleDescriptorProviderMock(md1);
|
||||
;
|
||||
assertEquals(md1, cache.get(url1, ivySettings, false, providerMock));
|
||||
assertEquals(md1, cache.get(url1, ivySettings, true, providerMock2));
|
||||
providerMock2.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidationDontClearvalidatedCache() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = null;
|
||||
|
|
@ -86,7 +91,8 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
assertEquals(md1, cache.get(url1, ivySettings, false, providerMock2));
|
||||
}
|
||||
|
||||
public void testSizeIsLimitied() throws ParseException, IOException {
|
||||
@Test
|
||||
public void testSizeIsLimited() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock1b = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = new ModuleDescriptorProviderMock(md2);
|
||||
|
|
@ -98,6 +104,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
providerMock1b.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLastRecentlyUsedIsFlushedWhenSizeExceed() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = new ModuleDescriptorProviderMock(md2);
|
||||
|
|
@ -112,6 +119,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
providerMock2b.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariableChangeInvalidateEntry() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = new ModuleDescriptorProviderMock(md1);
|
||||
|
|
@ -121,6 +129,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
providerMock2.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetStaleDontReadFromCache() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = new ModuleDescriptorProviderMock(md2);
|
||||
|
|
@ -129,6 +138,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
providerMock2.assertCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetStaleStoreResultInCache() throws ParseException, IOException {
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
ModuleDescriptorProviderMock providerMock2 = null;
|
||||
|
|
@ -136,6 +146,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
assertEquals(md1, cache.get(url1, ivySettings, false, providerMock2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testASizeOf0MeansNoCache() throws ParseException, IOException {
|
||||
cache = new ModuleDescriptorMemoryCache(0);
|
||||
ModuleDescriptorProviderMock providerMock = new ModuleDescriptorProviderMock(md1);
|
||||
|
|
@ -165,7 +176,7 @@ public class ModuleDescriptorMemoryCacheTest extends TestCase {
|
|||
}
|
||||
|
||||
public void assertCalled() {
|
||||
Assert.assertTrue(called);
|
||||
assertTrue(called);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,17 +28,21 @@ import org.apache.ivy.ant.IvyDeliver;
|
|||
import org.apache.ivy.ant.IvyResolve;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class DeliverTest extends TestCase {
|
||||
public class DeliverTest {
|
||||
private File cache;
|
||||
|
||||
private File deliverDir;
|
||||
|
||||
private IvyDeliver ivyDeliver;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
cache = new File("build/cache");
|
||||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
createCache();
|
||||
|
|
@ -55,7 +59,8 @@ public class DeliverTest extends TestCase {
|
|||
+ "/[type]s/[artifact]-[revision](-[classifier]).[ext]");
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(cache);
|
||||
FileUtil.forceDelete(deliverDir);
|
||||
}
|
||||
|
|
@ -64,6 +69,7 @@ public class DeliverTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY1111() throws Exception {
|
||||
Project project = ivyDeliver.getProject();
|
||||
project.setProperty("ivy.settings.file", "test/repositories/IVY-1111/ivysettings.xml");
|
||||
|
|
@ -75,8 +81,8 @@ public class DeliverTest extends TestCase {
|
|||
ivyDeliver.doExecute();
|
||||
|
||||
String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
|
||||
assertTrue(deliverContent.indexOf("rev=\"latest.integration\"") == -1);
|
||||
assertTrue(deliverContent.indexOf("name=\"b\" rev=\"1.5\"") >= 0);
|
||||
assertTrue(!deliverContent.contains("rev=\"latest.integration\""));
|
||||
assertTrue(deliverContent.contains("name=\"b\" rev=\"1.5\""));
|
||||
}
|
||||
|
||||
private void resolve(File ivyFile) {
|
||||
|
|
@ -87,14 +93,14 @@ public class DeliverTest extends TestCase {
|
|||
}
|
||||
|
||||
private String readFile(String fileName) throws IOException {
|
||||
StringBuffer retval = new StringBuffer();
|
||||
StringBuilder retval = new StringBuilder();
|
||||
|
||||
File ivyFile = new File(fileName);
|
||||
BufferedReader reader = new BufferedReader(new FileReader(ivyFile));
|
||||
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
retval.append(line + "\n");
|
||||
retval.append(line).append("\n");
|
||||
}
|
||||
|
||||
reader.close();
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@ import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
|
|||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IvyEventFilterTest extends TestCase {
|
||||
public class IvyEventFilterTest {
|
||||
|
||||
private ModuleDescriptor md = null;
|
||||
|
||||
|
|
@ -38,6 +41,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
|
||||
private ModuleDescriptor md4 = null;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("foo", "bar", "1.0"),
|
||||
"integration", new Date());
|
||||
|
|
@ -49,6 +53,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
"integration", new Date());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() {
|
||||
IvyEventFilter f = new IvyEventFilter("pre-resolve", null, null);
|
||||
|
||||
|
|
@ -57,6 +62,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
new ResolveReport(md))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleExpression() {
|
||||
IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo", null);
|
||||
|
||||
|
|
@ -79,6 +85,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
assertTrue(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAndExpression() {
|
||||
IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo AND module = bar",
|
||||
null);
|
||||
|
|
@ -95,6 +102,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOrExpression() {
|
||||
IvyEventFilter f = new IvyEventFilter("pre-resolve", "organisation = foo3 OR module = bar",
|
||||
null);
|
||||
|
|
@ -105,6 +113,7 @@ public class IvyEventFilterTest extends TestCase {
|
|||
assertFalse(f.accept(new StartResolveEvent(md4, new String[] {"default"})));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotExpression() {
|
||||
IvyEventFilter f = new IvyEventFilter("pre-resolve", "NOT organisation = foo", null);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,16 @@ import org.apache.ivy.core.report.ResolveReport;
|
|||
import org.apache.ivy.plugins.matcher.PatternMatcher;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class InstallTest extends TestCase {
|
||||
public class InstallTest {
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -42,6 +47,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidate() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -54,10 +60,12 @@ public class InstallTest extends TestCase {
|
|||
.exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaven() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
ResolveReport rr = ivy.install(ModuleRevisionId.newInstance("org.apache", "test", "1.0"),
|
||||
ivy.getSettings().getDefaultResolver().getName(), "install", new InstallOptions());
|
||||
|
||||
|
|
@ -75,6 +83,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org.apache/test/test-1.0.pom").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoValidate() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -87,6 +96,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/orgfailure/modfailure/modfailure-1.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleWithoutDefaultResolver() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
|
||||
|
|
@ -98,6 +108,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencies() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -112,6 +123,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestDependenciesNoDefaultResolver() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings-nodefaultresolver.xml"));
|
||||
|
|
@ -128,6 +140,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestDependenciesDummyDefaultResolver() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings-dummydefaultresolver.xml"));
|
||||
|
|
@ -144,6 +157,7 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.2/mod1.2-2.2.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotTransitive() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -159,6 +173,7 @@ public class InstallTest extends TestCase {
|
|||
assertFalse(new File("build/test/install/org1/mod1.2/mod1.2-2.0.jar").exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegexpMatcher() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
|
|
@ -185,11 +200,13 @@ public class InstallTest extends TestCase {
|
|||
assertTrue(new File("build/test/install/org1/mod1.4/ivy-1.0.1.xml").exists());
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
TestHelper.createCache();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
cleanInstall();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,18 +18,23 @@
|
|||
|
||||
package org.apache.ivy.core.module.descriptor;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.JUnitCore;
|
||||
|
||||
public class DefaultDependencyDescriptorTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class DefaultDependencyDescriptorTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(DefaultDependencyDescriptorTest.class);
|
||||
JUnitCore.runClasses(DefaultDependencyDescriptorTest.class);
|
||||
}
|
||||
|
||||
/*
|
||||
* Test method for
|
||||
* 'org.apache.ivy.DefaultDependencyDescriptor.replaceSelfFallbackPattern(String, String)'
|
||||
*/
|
||||
@Test
|
||||
public void testReplaceSelfFallbackPattern() {
|
||||
String replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@(default)",
|
||||
"compile");
|
||||
|
|
@ -47,6 +52,7 @@ public class DefaultDependencyDescriptorTest extends TestCase {
|
|||
* Test method for
|
||||
* 'org.apache.ivy.DefaultDependencyDescriptor.replaceThisFallbackPattern(String, String)'
|
||||
*/
|
||||
@Test
|
||||
public void testReplaceThisFallbackPattern() {
|
||||
String replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#(default)",
|
||||
"compile");
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@
|
|||
*/
|
||||
package org.apache.ivy.core.module.id;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ModuleIdTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ModuleIdTest {
|
||||
|
||||
@Test
|
||||
public void testModuleId() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -30,6 +33,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertEquals(name, moduleId.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModuleIdIllegalArgumentException() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -48,6 +52,7 @@ public class ModuleIdTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsObjectTrue() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -59,6 +64,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertTrue(moduleId2.equals(moduleId));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsObjectFalse() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -70,6 +76,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertFalse(moduleId2.equals(moduleId));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeToString() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -78,6 +85,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertEquals(org + ModuleId.ENCODE_SEPARATOR + name, moduleId.encodeToString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -87,6 +95,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertEquals(moduleId, moduleId2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareToNullObject() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -100,6 +109,7 @@ public class ModuleIdTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareToEqual() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -108,6 +118,7 @@ public class ModuleIdTest extends TestCase {
|
|||
assertTrue(moduleId.compareTo(new ModuleId(org, name)) == 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareToLessThan() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
|
|
@ -119,7 +130,8 @@ public class ModuleIdTest extends TestCase {
|
|||
assertTrue(moduleId.compareTo(moduleId2) < 0);
|
||||
}
|
||||
|
||||
public void testCompareToGreatherThan() {
|
||||
@Test
|
||||
public void testCompareToGreaterThan() {
|
||||
String org = "apache";
|
||||
String name = "some-new-module";
|
||||
ModuleId moduleId = new ModuleId(org, name);
|
||||
|
|
|
|||
|
|
@ -17,13 +17,18 @@
|
|||
*/
|
||||
package org.apache.ivy.core.module.id;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ModuleRevisionIdTest extends TestCase {
|
||||
public class ModuleRevisionIdTest {
|
||||
|
||||
@Test
|
||||
public void testParse() throws Exception {
|
||||
testParse("#A;1.0");
|
||||
testParse("org#module;2.0");
|
||||
|
|
@ -44,10 +49,11 @@ public class ModuleRevisionIdTest extends TestCase {
|
|||
ModuleRevisionId.parse(mrid);
|
||||
fail("ModuleRevisionId.parse is supposed to raise an exception with " + mrid);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertTrue(ex.getMessage().indexOf(mrid) != -1);
|
||||
assertTrue(ex.getMessage().contains(mrid));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeDecodeToString() {
|
||||
testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", "revision"));
|
||||
testEncodeDecodeToString(ModuleRevisionId.newInstance("org", "name", ""));
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
package org.apache.ivy.core.module.id;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -26,15 +28,16 @@ import org.apache.ivy.plugins.matcher.MapMatcher;
|
|||
import org.apache.ivy.plugins.matcher.PatternMatcher;
|
||||
import org.apache.ivy.util.filter.Filter;
|
||||
import org.apache.ivy.util.filter.NoFilter;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class ModuleRulesTest extends TestCase {
|
||||
public class ModuleRulesTest {
|
||||
private ModuleRules rules;
|
||||
|
||||
private Object[] rule;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
rules = new ModuleRules();
|
||||
rule = new Object[10];
|
||||
for (int i = 0; i < rule.length; i++) {
|
||||
|
|
@ -42,8 +45,7 @@ public class ModuleRulesTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
// tests
|
||||
|
||||
@Test
|
||||
public void testGetRule() throws Exception {
|
||||
// fixture
|
||||
rules.defineRule(mapMatcher().organization("apache").build(), rule[0]);
|
||||
|
|
@ -56,6 +58,7 @@ public class ModuleRulesTest extends TestCase {
|
|||
assertRule(null, "unknown#module1;1.5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRuleWithFilter() throws Exception {
|
||||
// fixture
|
||||
rules.defineRule(mapMatcher().organization("apache").build(), rule[0]);
|
||||
|
|
|
|||
|
|
@ -37,18 +37,27 @@ import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
|
|||
import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PublishEngineTest extends TestCase {
|
||||
protected void setUp() throws Exception {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class PublishEngineTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
|
||||
FileUtil.forceDelete(new File("build/test/publish"));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(new File("build/test/publish"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAtomicity() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
final PublishEngine engine = new PublishEngine(settings, new EventManager());
|
||||
|
|
|
|||
|
|
@ -38,9 +38,13 @@ import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
|||
import org.apache.ivy.plugins.resolver.MockResolver;
|
||||
import org.apache.ivy.plugins.trigger.AbstractTrigger;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PublishEventsTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PublishEventsTest {
|
||||
|
||||
// maps ArtifactRevisionId to PublishTestCase instance.
|
||||
private HashMap expectedPublications;
|
||||
|
|
@ -82,9 +86,8 @@ public class PublishEventsTest extends TestCase {
|
|||
|
||||
private PublishEngine publishEngine;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
// reset test case state.
|
||||
resetCounters();
|
||||
|
||||
|
|
@ -134,9 +137,8 @@ public class PublishEventsTest extends TestCase {
|
|||
IvyContext.getContext().push(PublishEventsTest.class.getName(), this);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
// reset test state.
|
||||
resetCounters();
|
||||
|
||||
|
|
@ -173,6 +175,7 @@ public class PublishEventsTest extends TestCase {
|
|||
/**
|
||||
* Test a simple artifact publish, without errors or overwrite settings.
|
||||
*/
|
||||
@Test
|
||||
public void testPublishNoOverwrite() throws IOException {
|
||||
// no modifications to input required for this case -- call out to the resolver, and verify
|
||||
// that
|
||||
|
|
@ -191,6 +194,7 @@ public class PublishEventsTest extends TestCase {
|
|||
/**
|
||||
* Test a simple artifact publish, with overwrite set to true.
|
||||
*/
|
||||
@Test
|
||||
public void testPublishWithOverwrite() throws IOException {
|
||||
// we expect the overwrite settings to be passed through the event listeners and into the
|
||||
// publisher.
|
||||
|
|
@ -213,6 +217,7 @@ public class PublishEventsTest extends TestCase {
|
|||
/**
|
||||
* Test an attempted publish with an invalid data file path.
|
||||
*/
|
||||
@Test
|
||||
public void testPublishMissingFile() throws IOException {
|
||||
// delete the datafile. the publish should fail
|
||||
// and the ivy artifact should still publish successfully.
|
||||
|
|
@ -237,6 +242,7 @@ public class PublishEventsTest extends TestCase {
|
|||
/**
|
||||
* Test an attempted publish in which the target resolver throws an IOException.
|
||||
*/
|
||||
@Test
|
||||
public void testPublishWithException() {
|
||||
// set an error to be thrown during publication of the data file.
|
||||
this.publishError = new IOException("boom!");
|
||||
|
|
@ -347,9 +353,8 @@ public class PublishEventsTest extends TestCase {
|
|||
assertEquals("event declares correct value for " + attributes[i], values[i],
|
||||
event.getAttributes().get(attributes[i]));
|
||||
}
|
||||
// we test file separately, since it is hard to guaranteean exact path match, but we
|
||||
// want
|
||||
// to make sure that both paths point to the same canonical location on the
|
||||
// we test file separately, since it is hard to guarantee an exact path match, but we
|
||||
// want to make sure that both paths point to the same canonical location on the
|
||||
// filesystem
|
||||
String filePath = event.getAttributes().get("file").toString();
|
||||
assertEquals("event declares correct value for file",
|
||||
|
|
@ -487,4 +492,4 @@ public class PublishEventsTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,13 @@ import org.apache.ivy.core.settings.IvySettings;
|
|||
import org.apache.ivy.util.CacheCleaner;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ResolveReportTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ResolveReportTest {
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
|
|
@ -43,7 +47,8 @@ public class ResolveReportTest extends TestCase {
|
|||
|
||||
private File workDir;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
cache = new File("build/cache");
|
||||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
createCache();
|
||||
|
|
@ -62,7 +67,8 @@ public class ResolveReportTest extends TestCase {
|
|||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
FileUtil.forceDelete(deliverDir);
|
||||
FileUtil.forceDelete(workDir);
|
||||
|
|
@ -84,6 +90,7 @@ public class ResolveReportTest extends TestCase {
|
|||
new HashSet<String>(Arrays.asList(dep.getDependencyConfigurations(conf))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdSimple() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
|
||||
|
|
@ -103,6 +110,7 @@ public class ResolveReportTest extends TestCase {
|
|||
new String[] {"*"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdTransitiveDependencies() throws Exception {
|
||||
// mod2.1 depends on mod1.1 which depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
|
|
@ -126,6 +134,7 @@ public class ResolveReportTest extends TestCase {
|
|||
new String[] {"*"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdMultipleExtends() throws Exception {
|
||||
// mod6.2 has two confs default and extension
|
||||
// mod6.2 depends on mod6.1 in conf (default->extension)
|
||||
|
|
@ -158,6 +167,7 @@ public class ResolveReportTest extends TestCase {
|
|||
new String[] {"default"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdRange() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
|
||||
|
|
@ -180,6 +190,7 @@ public class ResolveReportTest extends TestCase {
|
|||
new String[] {"default"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdKeep() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
|
||||
|
|
@ -203,6 +214,7 @@ public class ResolveReportTest extends TestCase {
|
|||
"compile", new String[] {"default"});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFixedMdTransitiveKeep() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org2/mod2.9/ivys/ivy-0.6.xml"),
|
||||
|
|
|
|||
|
|
@ -25,24 +25,31 @@ import org.apache.ivy.core.search.SearchEngine;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.core.sort.SortEngine;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class RepositoryManagementEngineTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RepositoryManagementEngineTest {
|
||||
private RepositoryManagementEngine repository;
|
||||
|
||||
private TestFixture fixture;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
fixture = new TestFixture();
|
||||
IvySettings settings = fixture.getSettings();
|
||||
repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
|
||||
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
fixture.clean();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoad() throws Exception {
|
||||
fixture.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3").addMD("o1#B;1")
|
||||
.addMD("o1#B;2->o1#A;2").addMD("o2#C;1->{o1#B;1 o1#A;1}").init();
|
||||
|
|
@ -52,6 +59,7 @@ public class RepositoryManagementEngineTest extends TestCase {
|
|||
assertEquals(6, repository.getRevisionsNumber());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOrphans() throws Exception {
|
||||
fixture.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3").addMD("o1#B;1")
|
||||
.addMD("o1#B;2->o1#A;2").addMD("o2#C;1->{o1#B;1 o1#A;1}").init();
|
||||
|
|
|
|||
|
|
@ -30,15 +30,22 @@ import org.apache.ivy.core.report.DownloadStatus;
|
|||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.ivy.util.CacheCleaner;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ResolveEngineTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ResolveEngineTest {
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
private File cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
cache = new File("build/cache");
|
||||
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
|
||||
createCache();
|
||||
|
|
@ -47,10 +54,12 @@ public class ResolveEngineTest extends TestCase {
|
|||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineResolveWithNonExistingModule() throws Exception {
|
||||
ResolveEngine engine = new ResolveEngine(ivy.getSettings(), ivy.getEventManager(),
|
||||
ivy.getSortEngine());
|
||||
|
|
@ -65,6 +74,7 @@ public class ResolveEngineTest extends TestCase {
|
|||
assertTrue(report.hasError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocateThenDownload() throws Exception {
|
||||
ResolveEngine engine = new ResolveEngine(ivy.getSettings(), ivy.getEventManager(),
|
||||
ivy.getSortEngine());
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -25,7 +25,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.IvyPatternHelper;
|
||||
|
|
@ -44,21 +43,26 @@ import org.apache.ivy.util.Message;
|
|||
import org.apache.ivy.util.MockMessageLogger;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Delete;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class RetrieveTest extends TestCase {
|
||||
public class RetrieveTest {
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/ivysettings.xml"));
|
||||
TestHelper.createCache();
|
||||
Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
TestHelper.cleanCache();
|
||||
Delete del = new Delete();
|
||||
del.setProject(new Project());
|
||||
|
|
@ -66,10 +70,11 @@ public class RetrieveTest extends TestCase {
|
|||
del.execute();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveSimple() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -86,10 +91,11 @@ public class RetrieveTest extends TestCase {
|
|||
"jar", "jar", "default")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveSameFileConflict() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.4/ivys/ivy-1.0.1.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.4/ivys/ivy-1.0.1.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -104,9 +110,10 @@ public class RetrieveTest extends TestCase {
|
|||
mockLogger.assertLogDoesntContain("conflict on");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveDifferentArtifactsOfSameModuleToSameFile() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURL(),
|
||||
"test/repositories/1/org2/mod2.2/ivys/ivy-0.5.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -117,16 +124,17 @@ public class RetrieveTest extends TestCase {
|
|||
Message.setDefaultLogger(mockLogger);
|
||||
try {
|
||||
ivy.retrieve(md.getModuleRevisionId(), pattern, getRetrieveOptions());
|
||||
fail("Exeption should have been thrown!");
|
||||
fail("Exception should have been thrown!");
|
||||
} catch (RuntimeException e) {
|
||||
// expected!
|
||||
}
|
||||
mockLogger.assertLogDoesntContain("multiple artifacts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvent() throws Exception {
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
|
||||
final List events = new ArrayList();
|
||||
|
|
@ -157,10 +165,11 @@ public class RetrieveTest extends TestCase {
|
|||
assertEquals(1, ev.getNbUpToDate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveOverwrite() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -180,10 +189,11 @@ public class RetrieveTest extends TestCase {
|
|||
file.lastModified());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveWithSymlinks() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -202,8 +212,9 @@ public class RetrieveTest extends TestCase {
|
|||
"jar", "default"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveWithSymlinksMass() throws Exception {
|
||||
if (SystemUtils.IS_OS_WINDOWS) {
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +249,7 @@ public class RetrieveTest extends TestCase {
|
|||
String os = System.getProperty("os.name");
|
||||
if (os.equals("Linux") || os.equals("Solaris") || os.equals("FreeBSD")
|
||||
|| os.equals("Mac OS X")) {
|
||||
// these OS should support symnlink, so check that the file is actually a symlink.
|
||||
// these OS should support symlink, so check that the file is actually a symlink.
|
||||
// this is done be checking that the canonical path is different from the absolute
|
||||
// path.
|
||||
File absFile = file.getAbsoluteFile();
|
||||
|
|
@ -247,11 +258,12 @@ public class RetrieveTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveWithVariable() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ivy.setVariable("retrieve.dir", "retrieve");
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURL(),
|
||||
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -270,10 +282,11 @@ public class RetrieveTest extends TestCase {
|
|||
"jar", "jar", "default")).exists());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRetrieveReport() throws Exception {
|
||||
// mod1.1 depends on mod1.2
|
||||
ResolveReport report = ivy.resolve(new File(
|
||||
"test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml").toURL(),
|
||||
"test/repositories/1/org20/mod20.1/ivys/ivy-1.2.xml").toURI().toURL(),
|
||||
getResolveOptions(new String[] {"*"}));
|
||||
assertNotNull(report);
|
||||
ModuleDescriptor md = report.getModuleDescriptor();
|
||||
|
|
@ -297,6 +310,7 @@ public class RetrieveTest extends TestCase {
|
|||
assertEquals(3, artifactsToCopy.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnpack() throws Exception {
|
||||
ResolveOptions roptions = getResolveOptions(new String[] {"*"});
|
||||
|
||||
|
|
@ -324,6 +338,7 @@ public class RetrieveTest extends TestCase {
|
|||
assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnpackSync() throws Exception {
|
||||
ResolveOptions roptions = getResolveOptions(new String[] {"*"});
|
||||
|
||||
|
|
@ -358,6 +373,7 @@ public class RetrieveTest extends TestCase {
|
|||
* @throws Exception
|
||||
* @see <a href="https://issues.apache.org/jira/browse/IVY-1478">IVY-1478</a>
|
||||
*/
|
||||
@Test
|
||||
public void testUnpackExt() throws Exception {
|
||||
final ResolveOptions roptions = getResolveOptions(new String[] {"*"});
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@ import org.apache.ivy.core.module.id.ModuleRevisionId;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.matcher.PatternMatcher;
|
||||
import org.apache.ivy.plugins.resolver.IBiblioResolver;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class SearchTest extends TestCase {
|
||||
public class SearchTest {
|
||||
@Test
|
||||
public void testListInMavenRepo() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
|
||||
|
|
@ -48,6 +51,7 @@ public class SearchTest extends TestCase {
|
|||
new HashSet(Arrays.asList(revs)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListInMavenRepo2() throws Exception {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
|
||||
|
|
@ -62,6 +66,7 @@ public class SearchTest extends TestCase {
|
|||
Arrays.asList(revs)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListModulesWithExtraAttributes() throws ParseException, IOException {
|
||||
Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
|
||||
|
|
|
|||
|
|
@ -26,9 +26,14 @@ import org.apache.ivy.plugins.resolver.DependencyResolver;
|
|||
import org.apache.ivy.plugins.resolver.IBiblioResolver;
|
||||
import org.apache.ivy.plugins.resolver.IvyRepResolver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ConfigureTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ConfigureTest {
|
||||
@Test
|
||||
public void testDefault() throws ParseException, IOException {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configureDefault();
|
||||
|
|
@ -43,6 +48,7 @@ public class ConfigureTest extends TestCase {
|
|||
assertTrue(ibiblio.isM2compatible());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefault14() throws ParseException, IOException {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configureDefault14();
|
||||
|
|
@ -54,6 +60,7 @@ public class ConfigureTest extends TestCase {
|
|||
assertTrue(publicResolver instanceof IvyRepResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedefWithCustomClasspath() throws Exception {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.setVariable("ivy.custom.test.dir", new File("test/java/org/apache/ivy/core/settings")
|
||||
|
|
@ -65,6 +72,7 @@ public class ConfigureTest extends TestCase {
|
|||
assertEquals("org.apache.ivy.plugins.resolver.CustomResolver", custom.getClass().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedefWithCustomClasspathWithFile() throws Exception {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.setVariable("ivy.custom.test.dir",
|
||||
|
|
|
|||
|
|
@ -23,10 +23,13 @@ import java.text.ParseException;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IvySettingsTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class IvySettingsTest {
|
||||
|
||||
@Test
|
||||
public void testChangeDefaultResolver() throws ParseException, IOException {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configureDefault();
|
||||
|
|
@ -45,6 +48,7 @@ public class IvySettingsTest extends TestCase {
|
|||
assertEquals("resolver changed successfully", "public", newDefault.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariables() throws Exception {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configureDefault();
|
||||
|
|
|
|||
|
|
@ -26,14 +26,18 @@ import org.apache.ivy.util.url.URLHandler;
|
|||
import org.apache.ivy.util.url.URLHandlerDispatcher;
|
||||
import org.apache.ivy.util.url.URLHandlerRegistry;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* split from XmlIvyConfigurationParserTest due to dependency on network resource
|
||||
*/
|
||||
public class OnlineXmlSettingsParserTest extends TestCase {
|
||||
public class OnlineXmlSettingsParserTest {
|
||||
// remote.test
|
||||
|
||||
@Test
|
||||
public void testIncludeHttpUrl() throws Exception {
|
||||
configureURLHandler();
|
||||
IvySettings settings = new IvySettings();
|
||||
|
|
@ -45,6 +49,7 @@ public class OnlineXmlSettingsParserTest extends TestCase {
|
|||
assertTrue(resolver instanceof IvyRepResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeHttpRelativeUrl() throws Exception {
|
||||
// Use a settings file via http that use an include with relative url
|
||||
configureURLHandler();
|
||||
|
|
@ -58,6 +63,7 @@ public class OnlineXmlSettingsParserTest extends TestCase {
|
|||
assertTrue(resolver instanceof IvyRepResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeHttpRelativeFile() throws Exception {
|
||||
// Use a settings file via http that use an include with relative file
|
||||
configureURLHandler();
|
||||
|
|
@ -71,6 +77,7 @@ public class OnlineXmlSettingsParserTest extends TestCase {
|
|||
assertTrue(resolver instanceof IvyRepResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeHttpAbsoluteFile() throws Exception {
|
||||
// Use a settings file via http that use an include with absolute file
|
||||
// WARNING : this test will only work if the test are launched from the project root
|
||||
|
|
|
|||
|
|
@ -46,13 +46,15 @@ import org.apache.ivy.plugins.resolver.packager.PackagerResolver;
|
|||
import org.apache.ivy.plugins.version.ChainVersionMatcher;
|
||||
import org.apache.ivy.plugins.version.MockVersionMatcher;
|
||||
import org.apache.ivy.plugins.version.VersionMatcher;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* TODO write javadoc
|
||||
*/
|
||||
public class XmlSettingsParserTest extends TestCase {
|
||||
public class XmlSettingsParserTest {
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -121,6 +123,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
settings.getResolver(ModuleRevisionId.newInstance("apache", "ivyde", "1.0")).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypedef() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -144,6 +147,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(subresolvers.get(1) instanceof MockResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStatuses() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -158,6 +162,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals(true, settings.getStatusManager().isIntegration("bronze"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConflictManager() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -168,6 +173,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("all", settings.getConflictManager(new ModuleId("apache", "ant")).getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveMode() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -179,6 +185,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("default", settings.getResolveMode(new ModuleId("apache", "ant")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtraModuleAttribute() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -188,6 +195,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("default", settings.getResolveMode(new ModuleId("apache", "ivy")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCache() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -240,6 +248,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals(c, settings.getResolver("B").getRepositoryCacheManager());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidCache() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -248,10 +257,11 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-cache-invalid.xml"));
|
||||
fail("resolver referencing a non existent cache should raise an exception");
|
||||
} catch (ParseException e) {
|
||||
assertTrue(e.getMessage().indexOf("mycache") != -1);
|
||||
assertTrue(e.getMessage().contains("mycache"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVersionMatchers1() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -270,6 +280,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(chain.getMatchers().contains(settings.getVersionMatcher("latest")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVersionMatchers2() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -286,6 +297,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(chain.getMatchers().contains(mock));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRef() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -324,6 +336,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
ivyPatterns.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacro() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -374,6 +387,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
ivyPatterns.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroAndRef() throws Exception {
|
||||
// test case for IVY-319
|
||||
IvySettings settings = new IvySettings();
|
||||
|
|
@ -396,6 +410,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(shared instanceof FileSystemResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMacroAndRef2() throws Exception {
|
||||
// test case for IVY-860
|
||||
IvySettings settings = new IvySettings();
|
||||
|
|
@ -417,6 +432,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals(testResolver, subresolvers.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesMissingFile() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -429,6 +445,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("libraries", defaultResolver.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInclude() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -473,6 +490,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariable("ivy.test.prop"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeAbsoluteFile() throws Exception {
|
||||
// WARNING : this test will only work if the test are launched from the project root
|
||||
// directory
|
||||
|
|
@ -486,6 +504,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(inc instanceof ChainResolver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeMissingFile() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -498,6 +517,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIncludeSpecialCharInName() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -542,6 +562,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals("myvalue", settings.getVariable("ivy.test.prop"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelativePropertiesFile() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -551,6 +572,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertLocationEquals("lib", settings.getVariable("libraries.dir"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParser() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -559,6 +581,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
ModuleDescriptorParserRegistry.getInstance().getParsers()[0].getClass().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOutputter() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -571,6 +594,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(testOutputter instanceof MyOutputter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLockingStrategies() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
XmlSettingsParser parser = new XmlSettingsParser(settings);
|
||||
|
|
@ -581,6 +605,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertTrue(lockStrategy instanceof MyLockStrategy);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileAttribute() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
File basedir = new File("test").getAbsoluteFile();
|
||||
|
|
@ -596,6 +621,7 @@ public class XmlSettingsParserTest extends TestCase {
|
|||
assertEquals(new File(basedir, "packager/cache"), packager.getResourceCache());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBaseDirVariables() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
settings.setBaseDir(new File("test/base/dir"));
|
||||
|
|
|
|||
|
|
@ -35,10 +35,13 @@ import org.apache.ivy.plugins.circular.WarnCircularDependencyStrategy;
|
|||
import org.apache.ivy.plugins.version.ExactVersionMatcher;
|
||||
import org.apache.ivy.plugins.version.LatestVersionMatcher;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SortTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class SortTest {
|
||||
|
||||
private DefaultModuleDescriptor md1;
|
||||
|
||||
|
|
@ -54,16 +57,11 @@ public class SortTest extends TestCase {
|
|||
|
||||
private SilentNonMatchingVersionReporter nonMatchReporter;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see junit.framework.TestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
md1 = createModuleDescriptorToSort("md1", null); // The revison is often not set in the
|
||||
@Before
|
||||
public void setUp() {
|
||||
md1 = createModuleDescriptorToSort("md1", null); // The revision is often not set in the
|
||||
// ivy.xml file that are ordered
|
||||
md2 = createModuleDescriptorToSort("md2", "rev2"); // But somtimes they are set
|
||||
md2 = createModuleDescriptorToSort("md2", "rev2"); // But sometimes they are set
|
||||
md3 = createModuleDescriptorToSort("md3", "rev3");
|
||||
md4 = createModuleDescriptorToSort("md4", "rev4");
|
||||
|
||||
|
|
@ -76,13 +74,14 @@ public class SortTest extends TestCase {
|
|||
nonMatchReporter = new SilentNonMatchingVersionReporter();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSort() throws Exception {
|
||||
addDependency(md2, "md1", "rev1");
|
||||
addDependency(md3, "md2", "rev2");
|
||||
addDependency(md4, "md3", "rev3");
|
||||
|
||||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {{md1, md2,
|
||||
md3, md4}};
|
||||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
|
|
@ -96,6 +95,7 @@ public class SortTest extends TestCase {
|
|||
* only. However the sort respect the transitive order when it is unambiguous. (if A depends
|
||||
* transitively of B, but B doesn't depends transitively on A then B always comes before A).
|
||||
*/
|
||||
@Test
|
||||
public void testCircularDependency() throws Exception {
|
||||
addDependency(md1, "md4", "rev4");
|
||||
addDependency(md2, "md1", "rev1");
|
||||
|
|
@ -113,15 +113,16 @@ public class SortTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCircularDependency2() throws Exception {
|
||||
addDependency(md2, "md3", "rev3");
|
||||
addDependency(md2, "md1", "rev1");
|
||||
addDependency(md3, "md2", "rev2");
|
||||
addDependency(md4, "md3", "rev3");
|
||||
DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md3, md2, md4}, {md1, md2, md3, md4} // ,
|
||||
// {md3, md1, md2, md4} //we don't have this solution. The loops apear has one contigous
|
||||
// element.
|
||||
{md1, md3, md2, md4}, {md1, md2, md3, md4}
|
||||
// {md3, md1, md2, md4}
|
||||
// we don't have this solution. The loops appear has one contiguous element.
|
||||
};
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
|
|
@ -131,6 +132,7 @@ public class SortTest extends TestCase {
|
|||
}
|
||||
|
||||
// Test IVY-624
|
||||
@Test
|
||||
public void testCircularDependencyInfiniteLoop() throws Exception {
|
||||
addDependency(md1, "md2", "rev2");
|
||||
addDependency(md1, "md3", "rev3");
|
||||
|
|
@ -146,6 +148,7 @@ public class SortTest extends TestCase {
|
|||
/**
|
||||
* In case of Circular dependency a warning is generated.
|
||||
*/
|
||||
@Test
|
||||
public void testCircularDependencyReport() {
|
||||
addDependency(md2, "md3", "rev3");
|
||||
addDependency(md2, "md1", "rev1");
|
||||
|
|
@ -163,7 +166,7 @@ public class SortTest extends TestCase {
|
|||
public void handleCircularDependency(ModuleRevisionId[] mrids) {
|
||||
assertEquals("handleCircularDependency is expected to be called only once", 0,
|
||||
nbOfCall);
|
||||
String assertMsg = "incorrect cicular dependency invocation"
|
||||
String assertMsg = "incorrect circular dependency invocation"
|
||||
+ CircularDependencyHelper.formatMessage(mrids);
|
||||
final int expectedLength = 3;
|
||||
assertEquals(assertMsg, expectedLength, mrids.length);
|
||||
|
|
@ -179,7 +182,7 @@ public class SortTest extends TestCase {
|
|||
}
|
||||
|
||||
public void validate() {
|
||||
Assert.assertEquals("handleCircularDependency has nor been called", 1, nbOfCall);
|
||||
assertEquals("handleCircularDependency has not been called", 1, nbOfCall);
|
||||
}
|
||||
}
|
||||
CircularDependencyReporterMock circularDepReportMock = new CircularDependencyReporterMock();
|
||||
|
|
@ -195,6 +198,7 @@ public class SortTest extends TestCase {
|
|||
* The dependency can ask for the latest integration. It should match whatever the version
|
||||
* declared in the modules to order.
|
||||
*/
|
||||
@Test
|
||||
public void testLatestIntegration() {
|
||||
|
||||
addDependency(md2, "md1", "latest.integration");
|
||||
|
|
@ -203,8 +207,8 @@ public class SortTest extends TestCase {
|
|||
|
||||
settings.setVersionMatcher(new LatestVersionMatcher());
|
||||
|
||||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {{md1, md2,
|
||||
md3, md4}};
|
||||
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
|
|
@ -216,9 +220,10 @@ public class SortTest extends TestCase {
|
|||
|
||||
/**
|
||||
* When the version asked by a dependency is not compatible with the version declared in the
|
||||
* module to order, the two modules should be considered as independant NB: I'm sure of what
|
||||
* module to order, the two modules should be considered as independent NB: I'm sure of what
|
||||
* 'compatible' means !
|
||||
*/
|
||||
@Test
|
||||
public void testDifferentVersionNotConsidered() {
|
||||
// To test it, I use a 'broken' loop (in one step, I change the revision) in such a way that
|
||||
// I get only one solution. If the loop was
|
||||
|
|
@ -229,8 +234,8 @@ public class SortTest extends TestCase {
|
|||
addDependency(md3, "md2", "rev2");
|
||||
addDependency(md4, "md3", "rev3");
|
||||
|
||||
DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {{md1, md2,
|
||||
md3, md4}};
|
||||
DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
|
||||
{md1, md2, md3, md4}};
|
||||
|
||||
Collection permutations = getAllLists(md1, md3, md2, md4);
|
||||
for (Iterator it = permutations.iterator(); it.hasNext();) {
|
||||
|
|
@ -243,6 +248,7 @@ public class SortTest extends TestCase {
|
|||
/**
|
||||
* In case of Different version a warning is generated.
|
||||
*/
|
||||
@Test
|
||||
public void testDifferentVersionWarning() {
|
||||
final DependencyDescriptor md4OtherDep = addDependency(md1, "md4", "rev4-other");
|
||||
addDependency(md2, "md1", "rev1");
|
||||
|
|
@ -255,15 +261,15 @@ public class SortTest extends TestCase {
|
|||
|
||||
public void reportNonMatchingVersion(DependencyDescriptor descriptor,
|
||||
ModuleDescriptor md) {
|
||||
Assert.assertEquals("reportNonMatchingVersion should be invokded only once", 0,
|
||||
assertEquals("reportNonMatchingVersion should be invoked only once", 0,
|
||||
nbOfCall);
|
||||
Assert.assertEquals(md4OtherDep, descriptor);
|
||||
Assert.assertEquals(md4, md);
|
||||
assertEquals(md4OtherDep, descriptor);
|
||||
assertEquals(md4, md);
|
||||
nbOfCall++;
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
Assert.assertEquals("reportNonMatchingVersion has not be called", 1, nbOfCall);
|
||||
assertEquals("reportNonMatchingVersion has not been called", 1, nbOfCall);
|
||||
}
|
||||
}
|
||||
NonMatchingVersionReporterMock nonMatchingVersionReporterMock = new NonMatchingVersionReporterMock();
|
||||
|
|
@ -316,7 +322,7 @@ public class SortTest extends TestCase {
|
|||
}
|
||||
}
|
||||
// failed, build a nice message
|
||||
StringBuffer errorMessage = new StringBuffer();
|
||||
StringBuilder errorMessage = new StringBuilder();
|
||||
errorMessage.append("Unexpected order : \n{ ");
|
||||
for (int i = 0; i < sorted.size(); i++) {
|
||||
if (i > 0) {
|
||||
|
|
@ -324,7 +330,7 @@ public class SortTest extends TestCase {
|
|||
}
|
||||
errorMessage.append(((DefaultModuleDescriptor) sorted.get(i)).getModuleRevisionId());
|
||||
}
|
||||
errorMessage.append("}\nEpected : \n");
|
||||
errorMessage.append("}\nExpected : \n");
|
||||
for (int i = 0; i < listOfPossibleSort.length; i++) {
|
||||
DefaultModuleDescriptor[] expectedList = listOfPossibleSort[i];
|
||||
if (i > 0) {
|
||||
|
|
|
|||
|
|
@ -38,10 +38,13 @@ import org.apache.ivy.osgi.repo.AbstractOSGiResolver.RequirementStrategy;
|
|||
import org.apache.ivy.osgi.repo.AggregatedOSGiResolver;
|
||||
import org.apache.ivy.osgi.updatesite.UpdateSiteResolver;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class AggregatedOSGiResolverTest extends TestCase {
|
||||
public class AggregatedOSGiResolverTest {
|
||||
|
||||
private IvySettings settings;
|
||||
|
||||
|
|
@ -53,6 +56,7 @@ public class AggregatedOSGiResolverTest extends TestCase {
|
|||
|
||||
private AggregatedOSGiResolver resolver;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
|
|
@ -104,8 +108,8 @@ public class AggregatedOSGiResolverTest extends TestCase {
|
|||
|
||||
ivy.getResolutionCacheManager().clean();
|
||||
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
|
||||
for (int i = 0; i < caches.length; i++) {
|
||||
caches[i].clean();
|
||||
for (RepositoryCacheManager cache : caches) {
|
||||
cache.clean();
|
||||
}
|
||||
|
||||
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
|
||||
|
|
@ -143,18 +147,21 @@ public class AggregatedOSGiResolverTest extends TestCase {
|
|||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveInUpdatesite() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy", "2.0.0.final_20090108225011");
|
||||
genericTestResolveDownload(resolver, mrid);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveInObr() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy.osgi.testbundle", "1.2.3");
|
||||
genericTestResolveDownload(resolver, mrid);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrossResolve() throws Exception {
|
||||
ModuleRevisionId mrid1 = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy.osgi.testbundle1", "1.2.3");
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.core;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ExecutionEnvironmentProfileLoaderTest extends TestCase {
|
||||
public class ExecutionEnvironmentProfileLoaderTest {
|
||||
|
||||
@Test
|
||||
public void testLoad() throws Exception {
|
||||
Map<String, ExecutionEnvironmentProfile> profiles = ExecutionEnvironmentProfileProvider
|
||||
.loadDefaultProfileList();
|
||||
|
|
|
|||
|
|
@ -17,12 +17,16 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.core;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ManifestHeaderTest extends TestCase {
|
||||
public class ManifestHeaderTest {
|
||||
|
||||
@Test
|
||||
public void testNormal() throws Exception {
|
||||
ManifestHeaderElement simpleValue = new ManifestHeaderElement();
|
||||
simpleValue.addValue("value");
|
||||
|
|
@ -76,6 +80,7 @@ public class ManifestHeaderTest extends TestCase {
|
|||
assertEquals(new ManifestHeaderValue(v1), new ManifestHeaderValue(v2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpaceAndQuote() throws Exception {
|
||||
genericTestEquals("value1;att=value2;att2=other", "value1;att='value2';att2=other");
|
||||
genericTestEquals("value1;att=value2;att2=other", "value1;att= 'value2' ;att2=other");
|
||||
|
|
@ -84,6 +89,7 @@ public class ManifestHeaderTest extends TestCase {
|
|||
genericTestEquals("value1;att=value2;att2=other", "value1;att=\"value2\";att2=other");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReflexivity() throws Exception {
|
||||
genericTestEquals("value1;value2", "value2;value1");
|
||||
genericTestEquals("value1,value2", "value2,value1");
|
||||
|
|
@ -93,6 +99,7 @@ public class ManifestHeaderTest extends TestCase {
|
|||
genericTestEquals("value1;version=1.2.3;color:=red", "value1;color:=red;version=1.2.3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyntaxError() throws Exception {
|
||||
genericTestSyntaxError("value1=");
|
||||
genericTestSyntaxError("value1;version=1;value2");
|
||||
|
|
@ -113,6 +120,7 @@ public class ManifestHeaderTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpaceInValue() throws Exception {
|
||||
ManifestHeaderValue value = new ManifestHeaderValue("glassfish javax.servlet.3.1.0.b33");
|
||||
assertEquals("glassfish javax.servlet.3.1.0.b33", value.getSingleValue());
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.ivy.osgi.util.VersionRange;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ManifestParserTest extends TestCase {
|
||||
public class ManifestParserTest {
|
||||
|
||||
@Test
|
||||
public void testParseManifest() throws Exception {
|
||||
BundleInfo bundleInfo;
|
||||
|
||||
|
|
@ -49,8 +51,8 @@ public class ManifestParserTest extends TestCase {
|
|||
assertNull(bundleInfo.getClasspath());
|
||||
|
||||
final String importsList = bundleInfo.getImports().toString();
|
||||
assertTrue(importsList.indexOf("com.acme.bravo") != -1);
|
||||
assertTrue(importsList.indexOf("com.acme.delta") != -1);
|
||||
assertTrue(importsList.contains("com.acme.bravo"));
|
||||
assertTrue(importsList.contains("com.acme.delta"));
|
||||
|
||||
bundleInfo = ManifestParser.parseJarManifest(getClass().getResourceAsStream(
|
||||
"com.acme.bravo-2.0.0.20080202.jar"));
|
||||
|
|
@ -63,11 +65,12 @@ public class ManifestParserTest extends TestCase {
|
|||
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.charlie",
|
||||
new VersionRange("3.0.0"), null));
|
||||
assertEquals(1, bundleInfo.getExports().size());
|
||||
assertTrue(bundleInfo.getExports().toString().indexOf("com.acme.bravo") != -1);
|
||||
assertTrue(bundleInfo.getExports().toString().contains("com.acme.bravo"));
|
||||
assertEquals(1, bundleInfo.getImports().size());
|
||||
assertTrue(bundleInfo.getImports().toString().indexOf("com.acme.charlie") != -1);
|
||||
assertTrue(bundleInfo.getImports().toString().contains("com.acme.charlie"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClasspath() throws Exception {
|
||||
InputStream in = this.getClass().getResourceAsStream(
|
||||
"/org/apache/ivy/osgi/core/MANIFEST_classpath.MF");
|
||||
|
|
@ -97,6 +100,7 @@ public class ManifestParserTest extends TestCase {
|
|||
assertEquals(Arrays.asList(new String[] {"."}), cp);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatLines() throws Exception {
|
||||
assertEquals("foo bar\n", ManifestParser.formatLines("foo bar"));
|
||||
assertEquals(
|
||||
|
|
|
|||
|
|
@ -31,11 +31,19 @@ import org.apache.ivy.plugins.repository.file.FileResource;
|
|||
import org.apache.ivy.util.DefaultMessageLogger;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class OSGiManifestParserTest extends AbstractModuleDescriptorParserTester {
|
||||
|
||||
private IvySettings settings;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN));
|
||||
|
||||
settings = new IvySettings();
|
||||
|
|
@ -43,6 +51,7 @@ public class OSGiManifestParserTest extends AbstractModuleDescriptorParserTester
|
|||
settings.setDefaultCache(new File("build/cache"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
ModuleDescriptor md = OSGiManifestParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("MANIFEST_classpath.MF"), true);
|
||||
|
|
@ -69,6 +78,7 @@ public class OSGiManifestParserTest extends AbstractModuleDescriptorParserTester
|
|||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFileResource() throws Exception {
|
||||
final File manifestFile = new File("test/repositories/osgi/module1/META-INF/MANIFEST.MF");
|
||||
assertTrue("Manifest file is either missing or not a file at " + manifestFile.getAbsolutePath(), manifestFile.isFile());
|
||||
|
|
|
|||
|
|
@ -24,11 +24,14 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.ivy.plugins.latest.ArtifactInfo;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class OsgiLatestStrategyTest extends TestCase {
|
||||
public class OsgiLatestStrategyTest {
|
||||
|
||||
@Test
|
||||
public void testComparator() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2.0.a", "0.2.0.b", "0.2.0.final", "1.0",
|
||||
"1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012",
|
||||
|
|
@ -40,6 +43,7 @@ public class OsgiLatestStrategyTest extends TestCase {
|
|||
assertEquals(Arrays.asList(revs), shuffled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSort() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2.0.a", "0.2.0.b", "0.2.0.final", "1.0",
|
||||
"1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012",
|
||||
|
|
@ -54,6 +58,7 @@ public class OsgiLatestStrategyTest extends TestCase {
|
|||
assertEquals(Arrays.asList(revs), sorted);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindLatest() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2.0.a", "0.2.0.b", "0.2.0.rc1",
|
||||
"0.2.0.final", "1.0.0.dev1", "1.0.0.dev2", "1.0.0.alpha1", "1.0.0.alpha2",
|
||||
|
|
@ -102,4 +107,4 @@ public class OsgiLatestStrategyTest extends TestCase {
|
|||
}
|
||||
return artifactInfos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,14 @@ package org.apache.ivy.osgi.filter;
|
|||
import java.text.ParseException;
|
||||
|
||||
import org.apache.ivy.osgi.filter.CompareFilter.Operator;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class OSGiFilterTest extends TestCase {
|
||||
public class OSGiFilterTest {
|
||||
|
||||
@Test
|
||||
public void testParser() throws Exception {
|
||||
assertParseFail("c>2");
|
||||
assertParseFail("");
|
||||
|
|
@ -56,7 +58,7 @@ public class OSGiFilterTest extends TestCase {
|
|||
private void assertParseFail(String toParse) {
|
||||
try {
|
||||
OSGiFilterParser.parse(toParse);
|
||||
Assert.fail("Expecting a ParseException");
|
||||
fail("Expecting a ParseException");
|
||||
} catch (ParseException e) {
|
||||
// OK
|
||||
}
|
||||
|
|
@ -64,6 +66,6 @@ public class OSGiFilterTest extends TestCase {
|
|||
|
||||
private void checkParse(OSGiFilter expected, String toParse) throws ParseException {
|
||||
OSGiFilter parsed = OSGiFilterParser.parse(toParse);
|
||||
Assert.assertEquals(expected, parsed);
|
||||
assertEquals(expected, parsed);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.obr;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -26,13 +29,13 @@ import org.apache.ivy.osgi.obr.xml.OBRXMLParser;
|
|||
import org.apache.ivy.osgi.repo.BundleRepoDescriptor;
|
||||
import org.apache.ivy.osgi.repo.ModuleDescriptorWrapper;
|
||||
import org.apache.ivy.util.CollectionUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
public class OBRParserTest {
|
||||
|
||||
public class OBRParserTest extends TestCase {
|
||||
|
||||
private File testObr = new File("test/test-obr");
|
||||
private final File testObr = new File("test/test-obr");
|
||||
|
||||
@Test
|
||||
public void testParse() throws Exception {
|
||||
BundleRepoDescriptor repo = OBRXMLParser.parse(testObr.toURI(), new FileInputStream(
|
||||
new File(testObr, "obr.xml")));
|
||||
|
|
@ -41,6 +44,7 @@ public class OBRParserTest extends TestCase {
|
|||
assertEquals("1253581430652", repo.getLastModified());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSource() throws Exception {
|
||||
BundleRepoDescriptor repo = OBRXMLParser.parse(testObr.toURI(), new FileInputStream(
|
||||
new File(testObr, "sources.xml")));
|
||||
|
|
|
|||
|
|
@ -53,10 +53,12 @@ import org.apache.ivy.plugins.resolver.DependencyResolver;
|
|||
import org.apache.ivy.plugins.resolver.DualResolver;
|
||||
import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class OBRResolverTest extends TestCase {
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class OBRResolverTest {
|
||||
|
||||
private static final ModuleRevisionId MRID_TEST_BUNDLE = ModuleRevisionId.newInstance(
|
||||
BundleInfo.BUNDLE_TYPE, "org.apache.ivy.osgi.testbundle", "1.2.3");
|
||||
|
|
@ -101,6 +103,7 @@ public class OBRResolverTest extends TestCase {
|
|||
private ExecutionEnvironmentProfileProvider profileProvider = ExecutionEnvironmentProfileProvider
|
||||
.getInstance();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
|
|
@ -148,25 +151,28 @@ public class OBRResolverTest extends TestCase {
|
|||
|
||||
ivy.getResolutionCacheManager().clean();
|
||||
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
|
||||
for (int i = 0; i < caches.length; i++) {
|
||||
caches[i].clean();
|
||||
for (RepositoryCacheManager cache : caches) {
|
||||
cache.clean();
|
||||
}
|
||||
|
||||
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleResolve() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy.osgi.testbundle", "1.2.3");
|
||||
genericTestResolveDownload(bundleResolver, mrid);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleUrlResolve() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy.osgi.testbundle", "1.2.3");
|
||||
genericTestResolveDownload(bundleUrlResolver, mrid);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveDual() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy.osgi.testbundle", "1.2.3");
|
||||
|
|
@ -205,11 +211,13 @@ public class OBRResolverTest extends TestCase {
|
|||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImporting() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {MRID_TEST_BUNDLE});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportingOptional() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.optional_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {});
|
||||
|
|
@ -218,6 +226,7 @@ public class OBRResolverTest extends TestCase {
|
|||
new ModuleRevisionId[] {MRID_TEST_BUNDLE});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportingTransitiveOptional() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.transitiveoptional_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {});
|
||||
|
|
@ -227,39 +236,46 @@ public class OBRResolverTest extends TestCase {
|
|||
MRID_TEST_BUNDLE, MRID_TEST_BUNDLE_IMPORTING_OPTIONAL});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportingVersion() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.version_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {MRID_TEST_BUNDLE});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportingRangeVersion() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.rangeversion_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {MRID_TEST_BUNDLE});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveUse() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.use_2.2.2.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportingUse() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.use_3.2.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {MRID_TEST_BUNDLE_USE,
|
||||
MRID_TEST_BUNDLE_IMPORTING, MRID_TEST_BUNDLE});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveRequire() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.require_1.1.1.jar";
|
||||
genericTestResolve(jarName, "default", new ModuleRevisionId[] {MRID_TEST_BUNDLE,
|
||||
MRID_TEST_BUNDLE_IMPORTING_VERSION});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveOptionalConf() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.require_1.1.1.jar";
|
||||
genericTestResolve(jarName, "optional", new ModuleRevisionId[] {MRID_TEST_BUNDLE,
|
||||
MRID_TEST_BUNDLE_IMPORTING_VERSION});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportAmbiguity() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.ambiguity_3.2.1.jar";
|
||||
bundleResolver.setRequirementStrategy(RequirementStrategy.first);
|
||||
|
|
@ -268,12 +284,14 @@ public class OBRResolverTest extends TestCase {
|
|||
MRID_TEST_BUNDLE, MRID_TEST_BUNDLE_IMPORTING_VERSION});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveImportNoAmbiguity() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.importing.ambiguity_3.2.1.jar";
|
||||
bundleResolver.setRequirementStrategy(RequirementStrategy.noambiguity);
|
||||
genericTestFailingResolve(jarName, "default");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveRequireAmbiguity() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.require.ambiguity_1.1.1.jar";
|
||||
bundleResolver.setRequirementStrategy(RequirementStrategy.noambiguity);
|
||||
|
|
@ -281,6 +299,7 @@ public class OBRResolverTest extends TestCase {
|
|||
MRID_TEST_BUNDLE_IMPORTING_VERSION});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveRequireJre() throws Exception {
|
||||
String jarName = "org.apache.ivy.osgi.testbundle.requirejre_2.2.2.jar";
|
||||
bundleResolver.setRequirementStrategy(RequirementStrategy.noambiguity);
|
||||
|
|
@ -293,6 +312,7 @@ public class OBRResolverTest extends TestCase {
|
|||
genericTestResolve(jarName, conf, expectedMrids, null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private void genericTestResolve(String jarName, String conf, ModuleRevisionId[] expectedMrids,
|
||||
ModuleRevisionId[] expected2Mrids) throws Exception {
|
||||
Manifest manifest = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
|
||||
|
|
@ -319,7 +339,7 @@ public class OBRResolverTest extends TestCase {
|
|||
Arrays.asList(expected2Mrids));
|
||||
assertEquals(expected2, actual);
|
||||
return; // test passed
|
||||
} catch (AssertionFailedError e) {
|
||||
} catch (AssertionError e) {
|
||||
// too bad, let's continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.obr;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -33,11 +36,12 @@ import org.apache.ivy.osgi.repo.BundleRepoDescriptor;
|
|||
import org.apache.ivy.osgi.repo.ModuleDescriptorWrapper;
|
||||
import org.apache.ivy.osgi.util.Version;
|
||||
import org.apache.ivy.util.CollectionUtils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.xml.sax.ContentHandler;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class OBRXMLWriterTest extends TestCase {
|
||||
public class OBRXMLWriterTest {
|
||||
|
||||
private static final Version BUNDLE_VERSION = new Version(1, 2, 3, null);
|
||||
|
||||
|
|
@ -45,6 +49,7 @@ public class OBRXMLWriterTest extends TestCase {
|
|||
|
||||
private static final String BUNDLE_2 = "org.apache.ivy.test2";
|
||||
|
||||
@Test
|
||||
public void testWriteWithSource() throws Exception {
|
||||
List<BundleInfo> bundles = new ArrayList<BundleInfo>();
|
||||
|
||||
|
|
@ -61,8 +66,8 @@ public class OBRXMLWriterTest extends TestCase {
|
|||
File obrFile = new File("build/test-files/obr-sources.xml");
|
||||
FileOutputStream out = new FileOutputStream(obrFile);
|
||||
try {
|
||||
ContentHandler hanlder = OBRXMLWriter.newHandler(out, "UTF-8", true);
|
||||
OBRXMLWriter.writeBundles(bundles, hanlder);
|
||||
ContentHandler handler = OBRXMLWriter.newHandler(out, "UTF-8", true);
|
||||
OBRXMLWriter.writeBundles(bundles, handler);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,15 @@ import org.apache.ivy.core.resolve.ResolvedModuleRevision;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.osgi.core.BundleInfo;
|
||||
import org.apache.ivy.osgi.updatesite.UpdateSiteResolver;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class P2DescriptorTest extends TestCase {
|
||||
public class P2DescriptorTest {
|
||||
|
||||
private File cache;
|
||||
|
||||
|
|
@ -53,7 +58,8 @@ public class P2DescriptorTest extends TestCase {
|
|||
|
||||
private ResolveData data;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
p2SourceResolver = new UpdateSiteResolver();
|
||||
|
|
@ -85,18 +91,19 @@ public class P2DescriptorTest extends TestCase {
|
|||
|
||||
ivy.getResolutionCacheManager().clean();
|
||||
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
|
||||
for (int i = 0; i < caches.length; i++) {
|
||||
caches[i].clean();
|
||||
for (RepositoryCacheManager cache : caches) {
|
||||
cache.clean();
|
||||
}
|
||||
|
||||
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
ivy.getLoggerEngine().sumupProblems();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveSource() throws Exception {
|
||||
settings.setDefaultResolver("p2-sources");
|
||||
|
||||
|
|
@ -139,6 +146,7 @@ public class P2DescriptorTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveNotZipped() throws Exception {
|
||||
settings.setDefaultResolver("p2-zipped");
|
||||
|
||||
|
|
@ -168,6 +176,7 @@ public class P2DescriptorTest extends TestCase {
|
|||
assertNull(ar.getUnpackedLocalFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolveZipped() throws Exception {
|
||||
settings.setDefaultResolver("p2-zipped");
|
||||
|
||||
|
|
@ -204,6 +213,7 @@ public class P2DescriptorTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolvePacked() throws Exception {
|
||||
settings.setDefaultResolver("p2-with-packed");
|
||||
|
||||
|
|
|
|||
|
|
@ -36,16 +36,18 @@ import org.apache.ivy.osgi.obr.xml.OBRXMLWriter;
|
|||
import org.apache.ivy.plugins.repository.file.FileRepository;
|
||||
import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class BundleRepoTest extends TestCase {
|
||||
public class BundleRepoTest {
|
||||
|
||||
private File bundlerepo = new File("test/test-repo/bundlerepo");
|
||||
|
||||
private File ivyrepo = new File("test/test-repo/ivyrepo");
|
||||
|
||||
@Test
|
||||
public void testFS() throws Exception {
|
||||
FSManifestIterable it = new FSManifestIterable(bundlerepo);
|
||||
BundleRepoDescriptor repo = new BundleRepoDescriptor(bundlerepo.toURI(),
|
||||
|
|
@ -58,6 +60,7 @@ public class BundleRepoTest extends TestCase {
|
|||
assertEquals(repo, repo2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFileRepo() throws Exception {
|
||||
RepositoryManifestIterable it = new RepositoryManifestIterable(new FileRepository(
|
||||
bundlerepo.getAbsoluteFile()));
|
||||
|
|
@ -71,6 +74,7 @@ public class BundleRepoTest extends TestCase {
|
|||
assertEquals(repo, repo2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolver() throws Exception {
|
||||
FileSystemResolver fileSystemResolver = new FileSystemResolver();
|
||||
fileSystemResolver.setName("test");
|
||||
|
|
@ -90,6 +94,7 @@ public class BundleRepoTest extends TestCase {
|
|||
assertEquals(repo, repo2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXMLSerialisation() throws SAXException, ParseException, IOException {
|
||||
FSManifestIterable it = new FSManifestIterable(bundlerepo);
|
||||
BundleRepoDescriptor repo = new BundleRepoDescriptor(bundlerepo.toURI(),
|
||||
|
|
|
|||
|
|
@ -32,10 +32,12 @@ import org.apache.ivy.core.settings.IvySettings;
|
|||
import org.apache.ivy.osgi.core.BundleInfo;
|
||||
import org.apache.ivy.plugins.resolver.ChainResolver;
|
||||
import org.apache.ivy.plugins.resolver.IBiblioResolver;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class UpdateSiteAndIbiblioResolverTest extends TestCase {
|
||||
public class UpdateSiteAndIbiblioResolverTest {
|
||||
|
||||
private IvySettings settings;
|
||||
|
||||
|
|
@ -51,6 +53,7 @@ public class UpdateSiteAndIbiblioResolverTest extends TestCase {
|
|||
|
||||
ChainResolver chain;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
|
|
@ -87,13 +90,14 @@ public class UpdateSiteAndIbiblioResolverTest extends TestCase {
|
|||
|
||||
ivy.getResolutionCacheManager().clean();
|
||||
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
|
||||
for (int i = 0; i < caches.length; i++) {
|
||||
caches[i].clean();
|
||||
for (RepositoryCacheManager cache : caches) {
|
||||
cache.clean();
|
||||
}
|
||||
|
||||
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArtifactRef() throws ParseException {
|
||||
|
||||
// Simple Dependency for ibiblio
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.updatesite;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
|
@ -31,17 +34,22 @@ import org.apache.ivy.osgi.repo.ModuleDescriptorWrapper;
|
|||
import org.apache.ivy.osgi.repo.RepoDescriptor;
|
||||
import org.apache.ivy.util.CacheCleaner;
|
||||
import org.apache.ivy.util.CollectionUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class UpdateSiteLoaderTest extends TestCase {
|
||||
public class UpdateSiteLoaderTest {
|
||||
|
||||
private UpdateSiteLoader loader;
|
||||
|
||||
private File cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
IvySettings ivySettings = new IvySettings();
|
||||
cache = new File("build/cache");
|
||||
cache.mkdirs();
|
||||
|
|
@ -50,10 +58,12 @@ public class UpdateSiteLoaderTest extends TestCase {
|
|||
loader = new UpdateSiteLoader(ivySettings.getDefaultRepositoryCacheManager(), null, options);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
CacheCleaner.deleteDir(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIvyDE() throws IOException, ParseException, SAXException, URISyntaxException {
|
||||
RepoDescriptor site = loader.load(new URI(
|
||||
"http://www.apache.org/dist/ant/ivyde/updatesite/"));
|
||||
|
|
@ -65,6 +75,7 @@ public class UpdateSiteLoaderTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testM2Eclipse() throws IOException, ParseException, SAXException,
|
||||
URISyntaxException {
|
||||
RepoDescriptor site = loader.load(new URI(
|
||||
|
|
@ -72,12 +83,15 @@ public class UpdateSiteLoaderTest extends TestCase {
|
|||
assertTrue(CollectionUtils.toList(site.getModules()).size() > 20);
|
||||
}
|
||||
|
||||
public void _disabled_testHeliosEclipse() throws IOException, ParseException, SAXException,
|
||||
@Ignore
|
||||
@Test
|
||||
public void testHeliosEclipse() throws IOException, ParseException, SAXException,
|
||||
URISyntaxException {
|
||||
RepoDescriptor site = loader.load(new URI("http://download.eclipse.org/releases/helios/"));
|
||||
assertTrue(CollectionUtils.toList(site.getModules()).size() > 900);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComposite() throws Exception {
|
||||
RepoDescriptor site = loader.load(new File("test/test-p2/composite/").toURI());
|
||||
assertEquals(8, CollectionUtils.toList(site.getModules()).size());
|
||||
|
|
|
|||
|
|
@ -37,10 +37,14 @@ import org.apache.ivy.core.search.OrganisationEntry;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.osgi.core.BundleInfo;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class UpdateSiteResolverTest extends TestCase {
|
||||
public class UpdateSiteResolverTest {
|
||||
|
||||
private IvySettings settings;
|
||||
|
||||
|
|
@ -52,6 +56,7 @@ public class UpdateSiteResolverTest extends TestCase {
|
|||
|
||||
private ResolveData data;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
|
|
@ -73,13 +78,14 @@ public class UpdateSiteResolverTest extends TestCase {
|
|||
|
||||
ivy.getResolutionCacheManager().clean();
|
||||
RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
|
||||
for (int i = 0; i < caches.length; i++) {
|
||||
caches[i].clean();
|
||||
for (RepositoryCacheManager cache : caches) {
|
||||
cache.clean();
|
||||
}
|
||||
|
||||
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListOrganization() throws Exception {
|
||||
OrganisationEntry[] orgs = resolver.listOrganisations();
|
||||
assertEquals(2, orgs.length);
|
||||
|
|
@ -89,6 +95,7 @@ public class UpdateSiteResolverTest extends TestCase {
|
|||
.getOrganisation().equals(BundleInfo.BUNDLE_TYPE)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListModules() throws Exception {
|
||||
ModuleEntry[] modules = resolver.listModules(new OrganisationEntry(resolver,
|
||||
BundleInfo.BUNDLE_TYPE));
|
||||
|
|
@ -129,6 +136,7 @@ public class UpdateSiteResolverTest extends TestCase {
|
|||
assertEquals(DownloadStatus.NO, ar.getDownloadStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResolve() throws Exception {
|
||||
ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
|
||||
"org.apache.ivy", "2.0.0.final_20090108225011");
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ParseUtilTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class ParseUtilTest {
|
||||
|
||||
@Test
|
||||
public void testParse() {
|
||||
final String[] result = ParseUtil.parseDelimitedString(
|
||||
"bravo;bundle-version=\"1.0.0\", delta;bundle-version=\"1.0.0\"", ",");
|
||||
|
|
|
|||
|
|
@ -17,10 +17,15 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class VersionRangeTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class VersionRangeTest {
|
||||
|
||||
@Test
|
||||
public void testParse() throws Exception {
|
||||
assertEquals(new VersionRange(false, new Version("1.0.0"), false, null), new VersionRange(
|
||||
"1.0.0"));
|
||||
|
|
@ -40,6 +45,7 @@ public class VersionRangeTest extends TestCase {
|
|||
new VersionRange("1.0.0.A"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContains() throws Exception {
|
||||
assertFalse(new VersionRange("1").contains("0.9"));
|
||||
assertTrue(new VersionRange("1").contains("1"));
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@
|
|||
*/
|
||||
package org.apache.ivy.osgi.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class VersionTest extends TestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class VersionTest {
|
||||
|
||||
@Test
|
||||
public void testParsing() throws Exception {
|
||||
Version v;
|
||||
|
||||
|
|
@ -41,6 +45,7 @@ public class VersionTest extends TestCase {
|
|||
assertEquals("abc", v.qualifier());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareTo() throws Exception {
|
||||
assertTrue(new Version("1.2.3").compareTo(new Version("1.2.3")) == 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,27 +20,32 @@ package org.apache.ivy.plugins.circular;
|
|||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.util.Message;
|
||||
import org.apache.ivy.util.MockMessageLogger;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class IgnoreCircularDependencyStrategyTest extends TestCase {
|
||||
public class IgnoreCircularDependencyStrategyTest {
|
||||
private CircularDependencyStrategy strategy;
|
||||
|
||||
private MockMessageLogger mockMessageImpl;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
strategy = IgnoreCircularDependencyStrategy.getInstance();
|
||||
|
||||
mockMessageImpl = new MockMessageLogger();
|
||||
Message.setDefaultLogger(mockMessageImpl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLog() throws Exception {
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
|
||||
|
||||
mockMessageImpl.assertLogVerboseContains("circular dependency found: #A;1.0->#B;1.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveDuplicates() throws Exception {
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
|
||||
|
|
|
|||
|
|
@ -27,15 +27,18 @@ import org.apache.ivy.core.settings.IvySettings;
|
|||
import org.apache.ivy.core.sort.SortEngine;
|
||||
import org.apache.ivy.util.Message;
|
||||
import org.apache.ivy.util.MockMessageLogger;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class WarnCircularDependencyStrategyTest extends TestCase {
|
||||
public class WarnCircularDependencyStrategyTest {
|
||||
private CircularDependencyStrategy strategy;
|
||||
|
||||
private MockMessageLogger mockMessageImpl;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
strategy = WarnCircularDependencyStrategy.getInstance();
|
||||
|
||||
resetLogger();
|
||||
|
|
@ -46,12 +49,14 @@ public class WarnCircularDependencyStrategyTest extends TestCase {
|
|||
Message.setDefaultLogger(mockMessageImpl);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLog() throws Exception {
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
|
||||
|
||||
mockMessageImpl.assertLogWarningContains("circular dependency found: #A;1.0->#B;1.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveDuplicates() throws Exception {
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
|
||||
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
|
||||
|
|
@ -60,6 +65,7 @@ public class WarnCircularDependencyStrategyTest extends TestCase {
|
|||
assertEquals(1, mockMessageImpl.getLogs().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveDuplicates2() throws Exception {
|
||||
setResolveContext("1");
|
||||
resetLogger();
|
||||
|
|
|
|||
|
|
@ -25,23 +25,31 @@ import org.apache.ivy.TestFixture;
|
|||
import org.apache.ivy.TestHelper;
|
||||
import org.apache.ivy.core.report.ConfigurationResolveReport;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class LatestCompatibleConflictManagerTest extends TestCase {
|
||||
public class LatestCompatibleConflictManagerTest {
|
||||
private TestFixture fixture;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
fixture = new TestFixture();
|
||||
LatestCompatibleConflictManager cm = new LatestCompatibleConflictManager();
|
||||
fixture.getSettings().addConfigured(cm);
|
||||
fixture.getSettings().setDefaultConflictManager(cm);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
fixture.clean();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitFromSettings() throws Exception {
|
||||
Ivy ivy = new Ivy();
|
||||
ivy.configure(LatestCompatibleConflictManagerTest.class
|
||||
|
|
@ -50,12 +58,14 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
assertTrue(cm instanceof LatestCompatibleConflictManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve1() throws Exception {
|
||||
fixture.addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }").addMD("#B;1.4->#D;1.5")
|
||||
.addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5").addMD("#D;1.6").init();
|
||||
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve2() throws Exception {
|
||||
fixture.addMD("#A;2-> { #B;[1.0,1.5] #C;[2.0,2.5] }").addMD("#B;1.4->#D;1.5")
|
||||
.addMD("#B;1.5->#D;2.0").addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5")
|
||||
|
|
@ -63,6 +73,7 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;2", "#B;1.4, #C;2.5, #D;1.5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve3() throws Exception {
|
||||
fixture.addMD("#A;3-> { #B;[2.0,2.5] #C;[3.0,3.5] }").addMD("#B;2.3-> { #D;1.5 #E;1.0 }")
|
||||
.addMD("#B;2.4-> { #D;1.5 #E;2.0 }").addMD("#B;2.5-> { #D;2.0 }")
|
||||
|
|
@ -72,6 +83,7 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;3", "#B;2.3, #C;3.4, #D;1.5, #E;1.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve4() throws Exception {
|
||||
fixture.addMD("#A;4-> { #B;[1.0,1.5] #C;[2.0,2.5] #F;[1.0,1.1] }").addMD("#B;1.4->#D;1.5")
|
||||
.addMD("#B;1.5->#D;2.0").addMD("#C;2.5->#D;[1.0,1.6]").addMD("#F;1.0->#D;1.5")
|
||||
|
|
@ -79,6 +91,7 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;4", "#B;1.4, #C;2.5, #D;1.5, #F;1.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve5() throws Exception {
|
||||
fixture.addMD("#A;5->{ #B;[1.0,1.5] #C;2.6 }").addMD("#B;1.3->{ }").addMD("#B;1.4->#D;1.5")
|
||||
.addMD("#B;1.5->#D;2.0").addMD("#C;2.6->#D;1.6").addMD("#D;1.5").addMD("#D;1.6")
|
||||
|
|
@ -86,12 +99,14 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;5", "#B;1.3, #C;2.6, #D;1.6");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolve6() throws Exception {
|
||||
fixture.addMD("#A;1-> { #C;[2.0,2.5] #B;1.4 }").addMD("#B;1.4->#D;1.5")
|
||||
.addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5").addMD("#D;1.6").init();
|
||||
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolveCircularDependency1() throws Exception {
|
||||
fixture.addMD("#A;6->{ #B;[3.0,3.5] #C;4.6 }").addMD("#B;3.4->#D;2.5")
|
||||
.addMD("#B;3.5->#D;3.0").addMD("#C;4.6->#D;2.5").addMD("#D;3.0->#B;3.5") // circular
|
||||
|
|
@ -101,6 +116,7 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;6", "#B;3.4, #C;4.6, #D;2.5");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolveCircularDependency2() throws Exception {
|
||||
fixture.addMD("#A;1->#C;2").addMD("#C;1->#B;1").addMD("#C;2->#B;2").addMD("#C;3->#B;3")
|
||||
.addMD("#B;1->#C;latest.integration") // circular dependency
|
||||
|
|
@ -110,6 +126,7 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;1", "#B;2, #C;2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompatibilityResolveCircularDependency3() throws Exception {
|
||||
// same as 2, but A depends on B
|
||||
fixture.addMD("#A;1->#B;2").addMD("#C;1->#B;1").addMD("#C;2->#B;2").addMD("#C;3->#B;3")
|
||||
|
|
@ -120,34 +137,28 @@ public class LatestCompatibleConflictManagerTest extends TestCase {
|
|||
resolveAndAssert("#A;1", "#B;2, #C;2");
|
||||
}
|
||||
|
||||
@Test(expected = StrictConflictException.class)
|
||||
public void testConflict() throws Exception {
|
||||
try {
|
||||
fixture.addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }").addMD("#B;1.5->#D;2.0")
|
||||
.addMD("#B;1.6->#D;2.0").addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5")
|
||||
.addMD("#D;1.6").addMD("#D;2.0").init();
|
||||
fixture.resolve("#A;conflict");
|
||||
fixture.addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }").addMD("#B;1.5->#D;2.0")
|
||||
.addMD("#B;1.6->#D;2.0").addMD("#C;2.5->#D;[1.0,1.6]").addMD("#D;1.5")
|
||||
.addMD("#D;1.6").addMD("#D;2.0").init();
|
||||
fixture.resolve("#A;conflict");
|
||||
|
||||
fail("Resolve should have failed with a conflict");
|
||||
} catch (StrictConflictException e) {
|
||||
// this is expected
|
||||
}
|
||||
fail("Resolve should have failed with a conflict");
|
||||
}
|
||||
|
||||
@Test(expected = StrictConflictException.class)
|
||||
public void testDynamicRootConflict() throws Exception {
|
||||
try {
|
||||
fixture.addMD("#A;conflict-> {#B;[1.2,2.0[ #C;pCC.main.+ #D;[1.5,1.7[ }")
|
||||
.addMD("#B;1.0.0->#D;[1.6.1,2.0[").addMD("#B;1.1.0->#D;[1.6.1,2.0[")
|
||||
.addMD("#B;pCC.main.0.0->#D;[1.6.1,2.0[")
|
||||
.addMD("#C;1.0.0-> {#B;[1.0,2.0[ #D;[1.6.0,1.7[ }")
|
||||
.addMD("#C;1.1.0-> {#B;[1.1,2.0[ #D;[1.6.0,1.7[ }")
|
||||
.addMD("#C;pCC.main.1.9-> {#B;pCC.main.+ #D;[1.6.0,1.7[ }").addMD("#D;1.6.1")
|
||||
.init();
|
||||
fixture.resolve("#A;conflict");
|
||||
fixture.addMD("#A;conflict-> {#B;[1.2,2.0[ #C;pCC.main.+ #D;[1.5,1.7[ }")
|
||||
.addMD("#B;1.0.0->#D;[1.6.1,2.0[").addMD("#B;1.1.0->#D;[1.6.1,2.0[")
|
||||
.addMD("#B;pCC.main.0.0->#D;[1.6.1,2.0[")
|
||||
.addMD("#C;1.0.0-> {#B;[1.0,2.0[ #D;[1.6.0,1.7[ }")
|
||||
.addMD("#C;1.1.0-> {#B;[1.1,2.0[ #D;[1.6.0,1.7[ }")
|
||||
.addMD("#C;pCC.main.1.9-> {#B;pCC.main.+ #D;[1.6.0,1.7[ }").addMD("#D;1.6.1")
|
||||
.init();
|
||||
fixture.resolve("#A;conflict");
|
||||
|
||||
fail("Resolve should have failed with a conflict");
|
||||
} catch (StrictConflictException e) {
|
||||
// this is expected }
|
||||
}
|
||||
fail("Resolve should have failed with a conflict");
|
||||
}
|
||||
|
||||
private void resolveAndAssert(String mrid, String expectedModuleSet) throws ParseException,
|
||||
|
|
|
|||
|
|
@ -28,27 +28,34 @@ import org.apache.ivy.core.report.ResolveReport;
|
|||
import org.apache.ivy.core.resolve.IvyNode;
|
||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class LatestConflictManagerTest extends TestCase {
|
||||
public class LatestConflictManagerTest {
|
||||
|
||||
private Ivy ivy;
|
||||
|
||||
private File _cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest.xml"));
|
||||
_cache = new File("build/cache");
|
||||
_cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(_cache);
|
||||
}
|
||||
|
||||
// Test case for issue IVY-388
|
||||
@Test
|
||||
public void testIvy388() throws Exception {
|
||||
ResolveReport report = ivy.resolve(
|
||||
LatestConflictManagerTest.class.getResource("ivy-388.xml"), getResolveOptions());
|
||||
|
|
@ -73,6 +80,7 @@ public class LatestConflictManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
// Test case for issue IVY-383
|
||||
@Test
|
||||
public void testIvy383() throws Exception {
|
||||
ResolveReport report = ivy.resolve(
|
||||
LatestConflictManagerTest.class.getResource("ivy-383.xml"), getResolveOptions());
|
||||
|
|
@ -89,6 +97,7 @@ public class LatestConflictManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
// Test case for issue IVY-407
|
||||
@Test
|
||||
public void testLatestTime1() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time.xml"));
|
||||
|
|
@ -116,6 +125,7 @@ public class LatestConflictManagerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLatestTime2() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(LatestConflictManagerTest.class.getResource("ivysettings-latest-time.xml"));
|
||||
|
|
@ -150,6 +160,7 @@ public class LatestConflictManagerTest extends TestCase {
|
|||
* ok and publish D-1.0.0 5) E needs D-1.0.0 and A-1.0.0 (D before A in ivy file) retrieve
|
||||
* failed to get C-1.0.2 from A (get apparently C-1.0.1 from D)
|
||||
*/
|
||||
@Test
|
||||
public void testLatestTimeTransitivity() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(LatestConflictManagerTest.class
|
||||
|
|
@ -203,6 +214,7 @@ public class LatestConflictManagerTest extends TestCase {
|
|||
* MyCompany#C;1
|
||||
* conflicting-dependency#dep;1
|
||||
*/
|
||||
@Test
|
||||
public void testEvictedModules() throws Exception {
|
||||
ivy.configure(LatestConflictManagerTest.class
|
||||
.getResource("ivysettings-evicted.xml"));
|
||||
|
|
|
|||
|
|
@ -22,25 +22,32 @@ import java.io.File;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class RegexpConflictManagerTest extends TestCase {
|
||||
public class RegexpConflictManagerTest {
|
||||
private Ivy ivy;
|
||||
|
||||
private File _cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(RegexpConflictManagerTest.class.getResource("ivysettings-regexp-test.xml"));
|
||||
_cache = new File("build/cache");
|
||||
_cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(_cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoApiConflictResolve() throws Exception {
|
||||
try {
|
||||
ivy.resolve(RegexpConflictManagerTest.class.getResource("ivy-no-regexp-conflict.xml"),
|
||||
|
|
@ -50,6 +57,7 @@ public class RegexpConflictManagerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConflictResolve() throws Exception {
|
||||
try {
|
||||
ivy.resolve(RegexpConflictManagerTest.class.getResource("ivy-conflict.xml"),
|
||||
|
|
@ -60,14 +68,12 @@ public class RegexpConflictManagerTest extends TestCase {
|
|||
// this is expected
|
||||
assertTrue(
|
||||
"bad exception message: " + e.getMessage(),
|
||||
e.getMessage().indexOf(
|
||||
"org1#mod1.2;2.0.0:2.0 (needed by [apache#resolve-noconflict;1.0])") != -1);
|
||||
e.getMessage().contains("org1#mod1.2;2.0.0:2.0 (needed by [apache#resolve-noconflict;1.0])"));
|
||||
assertTrue("bad exception message: " + e.getMessage(),
|
||||
e.getMessage().indexOf("conflicts with") != -1);
|
||||
e.getMessage().contains("conflicts with"));
|
||||
assertTrue(
|
||||
"bad exception message: " + e.getMessage(),
|
||||
e.getMessage().indexOf(
|
||||
"org1#mod1.2;2.1.0:2.1 (needed by [apache#resolve-noconflict;1.0])") != -1);
|
||||
e.getMessage().contains("org1#mod1.2;2.1.0:2.1 (needed by [apache#resolve-noconflict;1.0])"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,40 +22,50 @@ import java.io.File;
|
|||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class StrictConflictManagerTest extends TestCase {
|
||||
public class StrictConflictManagerTest {
|
||||
private Ivy ivy;
|
||||
|
||||
private File cache;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ivy = new Ivy();
|
||||
ivy.configure(StrictConflictManagerTest.class.getResource("ivysettings-strict-test.xml"));
|
||||
cache = new File("build/cache");
|
||||
cache.mkdirs();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(cache);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitFromConf() throws Exception {
|
||||
ConflictManager cm = ivy.getSettings().getDefaultConflictManager();
|
||||
assertTrue(cm instanceof StrictConflictManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoConflictResolve() throws Exception {
|
||||
ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-noconflict.xml"),
|
||||
getResolveOptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoConflictWithDynamicRevisionResolve() throws Exception {
|
||||
ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-noconflict-dynamic.xml"),
|
||||
getResolveOptions());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConflictResolve() throws Exception {
|
||||
try {
|
||||
ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-conflict.xml"),
|
||||
|
|
@ -67,6 +77,7 @@ public class StrictConflictManagerTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConflictWithDynamicRevisionResolve() throws Exception {
|
||||
try {
|
||||
ivy.resolve(StrictConflictManagerTest.class.getResource("ivy-conflict-dynamic.xml"),
|
||||
|
|
|
|||
|
|
@ -17,15 +17,19 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.latest;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class LatestRevisionStrategyTest extends TestCase {
|
||||
public class LatestRevisionStrategyTest {
|
||||
@Test
|
||||
public void testComparator() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2a", "0.2_b", "0.2rc1", "0.2-final",
|
||||
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
|
||||
|
|
@ -37,6 +41,7 @@ public class LatestRevisionStrategyTest extends TestCase {
|
|||
assertEquals(Arrays.asList(revs), shuffled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSort() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2a", "0.2_b", "0.2rc1", "0.2-final",
|
||||
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
|
||||
|
|
@ -51,6 +56,7 @@ public class LatestRevisionStrategyTest extends TestCase {
|
|||
assertEquals(Arrays.asList(revs), sorted);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindLatest() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.2a", "0.2_b", "0.2rc1", "0.2-final",
|
||||
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
|
||||
|
|
@ -66,6 +72,7 @@ public class LatestRevisionStrategyTest extends TestCase {
|
|||
assertEquals("2.0", latest.getRevision());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpecialMeaningComparator() {
|
||||
ArtifactInfo[] revs = toMockAI(new String[] {"0.1", "0.2-pre", "0.2-dev", "0.2-rc1",
|
||||
"0.2-final", "0.2-QA", "1.0-dev1"});
|
||||
|
|
|
|||
|
|
@ -37,18 +37,25 @@ import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
|||
import org.apache.ivy.util.CopyProgressEvent;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.apache.ivy.util.Message;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class ArtifactLockStrategyTest extends TestCase {
|
||||
protected void setUp() throws Exception {
|
||||
public class ArtifactLockStrategyTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
FileUtil.forceDelete(new File("build/test/cache"));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
FileUtil.forceDelete(new File("build/test/cache"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentResolve() throws Exception {
|
||||
// we use different settings because Ivy do not support multi thread resolve with the same
|
||||
// settings yet and this is not what this test is about: the focus of this test is running
|
||||
|
|
|
|||
|
|
@ -17,20 +17,23 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.matcher;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Base test classes for PatternMatcher testcase implementation
|
||||
*/
|
||||
public abstract class AbstractPatternMatcherTest extends TestCase {
|
||||
public abstract class AbstractPatternMatcherTest {
|
||||
protected PatternMatcher patternMatcher;
|
||||
|
||||
protected abstract void setUp() throws Exception;
|
||||
|
||||
// used by setUp() in subclasses
|
||||
protected void setUp(PatternMatcher matcher) {
|
||||
this.patternMatcher = matcher;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAnyExpression() {
|
||||
Matcher matcher = patternMatcher.getMatcher("*");
|
||||
assertTrue(matcher.matches(""));
|
||||
|
|
@ -38,6 +41,7 @@ public abstract class AbstractPatternMatcherTest extends TestCase {
|
|||
assertTrue(matcher.matches(" "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsExact() {
|
||||
// '*' is a special matcher
|
||||
Matcher matcher = patternMatcher.getMatcher("*");
|
||||
|
|
@ -69,27 +73,22 @@ public abstract class AbstractPatternMatcherTest extends TestCase {
|
|||
|
||||
protected abstract String[] getInexactExpressions();
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testNullInput() {
|
||||
Matcher matcher = patternMatcher.getMatcher("some expression");
|
||||
try {
|
||||
matcher.matches(null);
|
||||
fail("Should fail for null input");
|
||||
} catch (NullPointerException expected) {
|
||||
|
||||
}
|
||||
matcher.matches(null);
|
||||
fail("Should fail for null input");
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testNullExpression() {
|
||||
try {
|
||||
patternMatcher.getMatcher(null);
|
||||
fail("Should fail for null expression");
|
||||
} catch (NullPointerException expected) {
|
||||
|
||||
}
|
||||
patternMatcher.getMatcher(null);
|
||||
fail("Should fail for null expression");
|
||||
}
|
||||
|
||||
public abstract void testImplementation();
|
||||
|
||||
@Test
|
||||
public void testLoadTestMatches() {
|
||||
Matcher matcher = patternMatcher.getMatcher("this.is.an.expression");
|
||||
String[] inputs = {"this.is.an.expression", "this:is:an:expression",
|
||||
|
|
@ -100,6 +99,7 @@ public abstract class AbstractPatternMatcherTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadTestGetMatcher() {
|
||||
String[] inputs = {"this.is.an.expression", "this:is:an:expression",
|
||||
"this is an expression", "whatever this is", "maybe, maybe not"};
|
||||
|
|
|
|||
|
|
@ -17,14 +17,22 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.matcher;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ExactOrRegexpPatternMatcherTest extends AbstractPatternMatcherTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
setUp(new ExactOrRegexpPatternMatcher());
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +44,7 @@ public class ExactOrRegexpPatternMatcherTest extends AbstractPatternMatcherTest
|
|||
return new String[] {"abc+", "12.3", "abc-123*", "abc_123\\d"};
|
||||
}
|
||||
|
||||
@Test(expected = PatternSyntaxException.class)
|
||||
public void testImplementation() {
|
||||
Matcher matcher = patternMatcher.getMatcher(".");
|
||||
assertFalse(matcher.isExact());
|
||||
|
|
@ -54,11 +63,7 @@ public class ExactOrRegexpPatternMatcherTest extends AbstractPatternMatcherTest
|
|||
matcher = patternMatcher.getMatcher("abc-123_ABC");
|
||||
assertTrue(matcher.isExact());
|
||||
|
||||
try {
|
||||
matcher = patternMatcher.getMatcher("(");
|
||||
fail("Should fail on invalid regexp syntax");
|
||||
} catch (PatternSyntaxException e) {
|
||||
|
||||
}
|
||||
matcher = patternMatcher.getMatcher("(");
|
||||
fail("Should fail on invalid regexp syntax");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,19 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.matcher;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @see ExactPatternMatcher
|
||||
*/
|
||||
public class ExactPatternMatcherTest extends AbstractPatternMatcherTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
setUp(new ExactPatternMatcher());
|
||||
}
|
||||
|
||||
|
|
@ -34,6 +41,7 @@ public class ExactPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
return new String[0]; // there are no inexact expressions possible
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImplementation() {
|
||||
Matcher matcher = patternMatcher.getMatcher(".");
|
||||
assertFalse(matcher.matches(""));
|
||||
|
|
|
|||
|
|
@ -17,14 +17,22 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.matcher;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @see GlobPatternMatcher
|
||||
*/
|
||||
public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
setUp(new GlobPatternMatcher());
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +44,7 @@ public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
return new String[] {"abc*", "12?3", "abc[123]"};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidRegexpSyntaxAsNormalCharacter() {
|
||||
Matcher matcher = patternMatcher.getMatcher(".");
|
||||
assertTrue(matcher.isExact());
|
||||
|
|
@ -45,6 +54,7 @@ public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
assertFalse(matcher.matches("aa"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRegexpSyntaxAndGlob() {
|
||||
Matcher matcher = patternMatcher.getMatcher(".*");
|
||||
assertFalse(matcher.isExact());
|
||||
|
|
@ -56,11 +66,13 @@ public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
assertTrue(matcher.matches(".abcdef"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImplementation() {
|
||||
Matcher matcher = patternMatcher.getMatcher("abc-123_ABC");
|
||||
assertTrue(matcher.isExact());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuoteMeta() {
|
||||
Matcher matcher = patternMatcher.getMatcher("\\*");
|
||||
assertTrue(matcher.matches("*"));
|
||||
|
|
@ -68,11 +80,13 @@ public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
assertFalse(matcher.matches("Xsfsdfsd"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidRegexpSyntaxAsNormalCharacter() {
|
||||
Matcher matcher = patternMatcher.getMatcher("(");
|
||||
assertTrue(matcher.matches("("));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGlob() {
|
||||
Matcher matcher = patternMatcher.getMatcher("*ivy*");
|
||||
assertTrue(matcher.matches("ivy"));
|
||||
|
|
@ -81,12 +95,9 @@ public class GlobPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
assertTrue(matcher.matches("abcdefivy"));
|
||||
}
|
||||
|
||||
@Test(expected = PatternSyntaxException.class)
|
||||
public void testInvalidSyntax() {
|
||||
try {
|
||||
patternMatcher.getMatcher("[");
|
||||
fail("Should fail on invalid regexp syntax");
|
||||
} catch (PatternSyntaxException e) {
|
||||
|
||||
}
|
||||
patternMatcher.getMatcher("[");
|
||||
fail("Should fail on invalid regexp syntax");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,21 @@
|
|||
*/
|
||||
package org.apache.ivy.plugins.matcher;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* @see RegexpPatternMatcher
|
||||
*/
|
||||
public class RegexpPatternMatcherTest extends AbstractPatternMatcherTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
setUp(new RegexpPatternMatcher());
|
||||
}
|
||||
|
||||
|
|
@ -36,6 +43,7 @@ public class RegexpPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
return new String[] {"abc+", "12.3", "abc-123*", "abc_123\\d"};
|
||||
}
|
||||
|
||||
@Test(expected = PatternSyntaxException.class)
|
||||
public void testImplementation() {
|
||||
Matcher matcher = patternMatcher.getMatcher(".*");
|
||||
assertTrue(matcher.matches(".*"));
|
||||
|
|
@ -43,11 +51,7 @@ public class RegexpPatternMatcherTest extends AbstractPatternMatcherTest {
|
|||
assertTrue(matcher.matches("a"));
|
||||
assertTrue(matcher.matches("aa"));
|
||||
|
||||
try {
|
||||
matcher = patternMatcher.getMatcher("(");
|
||||
fail("Should fail on invalid syntax");
|
||||
} catch (PatternSyntaxException e) {
|
||||
|
||||
}
|
||||
matcher = patternMatcher.getMatcher("(");
|
||||
fail("Should fail on invalid syntax");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@
|
|||
package org.apache.ivy.plugins.namespace;
|
||||
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class MRIDTransformationRuleTest extends TestCase {
|
||||
public class MRIDTransformationRuleTest {
|
||||
|
||||
@Test
|
||||
public void testTransformation() {
|
||||
MRIDTransformationRule r = new MRIDTransformationRule();
|
||||
r.addSrc(new MRIDRule("apache", "commons.+", null));
|
||||
|
|
|
|||
|
|
@ -24,10 +24,12 @@ import org.apache.ivy.core.module.descriptor.Artifact;
|
|||
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
|
||||
import org.apache.ivy.core.module.id.ArtifactRevisionId;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class NameSpaceHelperTest extends TestCase {
|
||||
public class NameSpaceHelperTest {
|
||||
@Test
|
||||
public void testTransformArtifactWithExtraAttributes() throws Exception {
|
||||
Artifact artifact = new DefaultArtifact(ArtifactRevisionId.newInstance(
|
||||
ModuleRevisionId.parse("org.apache#test;1.0"), "test", "jar", "jar",
|
||||
|
|
|
|||
|
|
@ -28,15 +28,17 @@ import org.apache.ivy.core.module.descriptor.ExcludeRule;
|
|||
import org.apache.ivy.core.module.descriptor.IncludeRule;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
||||
public abstract class AbstractModuleDescriptorParserTester {
|
||||
protected DependencyDescriptor getDependency(DependencyDescriptor[] dependencies, String name) {
|
||||
for (int i = 0; i < dependencies.length; i++) {
|
||||
assertNotNull(dependencies[i]);
|
||||
assertNotNull(dependencies[i].getDependencyId());
|
||||
if (name.equals(dependencies[i].getDependencyId().getName())) {
|
||||
return dependencies[i];
|
||||
for (DependencyDescriptor dependency : dependencies) {
|
||||
assertNotNull(dependency);
|
||||
assertNotNull(dependency.getDependencyId());
|
||||
if (name.equals(dependency.getDependencyId().getName())) {
|
||||
return dependency;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -45,16 +47,16 @@ public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
|||
protected void assertArtifacts(Artifact[] artifacts, String[] artifactsNames) {
|
||||
assertNotNull(artifacts);
|
||||
assertEquals(artifactsNames.length, artifacts.length);
|
||||
for (int i = 0; i < artifactsNames.length; i++) {
|
||||
for (String artifactsName : artifactsNames) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < artifacts.length; j++) {
|
||||
assertNotNull(artifacts[j]);
|
||||
if (artifacts[j].getName().equals(artifactsNames[i])) {
|
||||
for (Artifact artifact : artifacts) {
|
||||
assertNotNull(artifact);
|
||||
if (artifact.getName().equals(artifactsName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue("artifact not found: " + artifactsNames[i], found);
|
||||
assertTrue("artifact not found: " + artifactsName, found);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -63,16 +65,16 @@ public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
|||
DependencyArtifactDescriptor[] dads = dd.getDependencyArtifacts(confs);
|
||||
assertNotNull(dads);
|
||||
assertEquals(artifactsNames.length, dads.length);
|
||||
for (int i = 0; i < artifactsNames.length; i++) {
|
||||
for (String artifactsName : artifactsNames) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < dads.length; j++) {
|
||||
assertNotNull(dads[j]);
|
||||
if (dads[j].getName().equals(artifactsNames[i])) {
|
||||
for (DependencyArtifactDescriptor dad : dads) {
|
||||
assertNotNull(dad);
|
||||
if (dad.getName().equals(artifactsName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue("dependency artifact not found: " + artifactsNames[i], found);
|
||||
assertTrue("dependency artifact not found: " + artifactsName, found);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -81,16 +83,16 @@ public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
|||
IncludeRule[] dads = dd.getIncludeRules(confs);
|
||||
assertNotNull(dads);
|
||||
assertEquals(artifactsNames.length, dads.length);
|
||||
for (int i = 0; i < artifactsNames.length; i++) {
|
||||
for (String artifactsName : artifactsNames) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < dads.length; j++) {
|
||||
assertNotNull(dads[j]);
|
||||
if (dads[j].getId().getName().equals(artifactsNames[i])) {
|
||||
for (IncludeRule dad : dads) {
|
||||
assertNotNull(dad);
|
||||
if (dad.getId().getName().equals(artifactsName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue("dependency include not found: " + artifactsNames[i], found);
|
||||
assertTrue("dependency include not found: " + artifactsName, found);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,16 +101,16 @@ public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
|||
ExcludeRule[] rules = dd.getExcludeRules(confs);
|
||||
assertNotNull(rules);
|
||||
assertEquals(artifactsNames.length, rules.length);
|
||||
for (int i = 0; i < artifactsNames.length; i++) {
|
||||
for (String artifactsName : artifactsNames) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < rules.length; j++) {
|
||||
assertNotNull(rules[j]);
|
||||
if (rules[j].getId().getName().equals(artifactsNames[i])) {
|
||||
for (ExcludeRule rule : rules) {
|
||||
assertNotNull(rule);
|
||||
if (rule.getId().getName().equals(artifactsName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue("dependency exclude not found: " + artifactsNames[i], found);
|
||||
assertTrue("dependency exclude not found: " + artifactsName, found);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,16 +119,16 @@ public abstract class AbstractModuleDescriptorParserTester extends TestCase {
|
|||
ExcludeRule[] rules = dd.getExcludeRules(confs);
|
||||
assertNotNull(rules);
|
||||
assertEquals(moduleNames.length, rules.length);
|
||||
for (int i = 0; i < moduleNames.length; i++) {
|
||||
for (String moduleName : moduleNames) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < rules.length; j++) {
|
||||
assertNotNull(rules[j]);
|
||||
if (rules[j].getId().getModuleId().getName().equals(moduleNames[i])) {
|
||||
for (ExcludeRule rule : rules) {
|
||||
assertNotNull(rule);
|
||||
if (rule.getId().getModuleId().getName().equals(moduleName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue("dependency module exclude not found: " + moduleNames[i], found);
|
||||
assertTrue("dependency module exclude not found: " + moduleName, found);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
|||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class ModuleDescriptorParserRegistryTest extends TestCase {
|
||||
public class ModuleDescriptorParserRegistryTest {
|
||||
public static class MyParser extends AbstractModuleDescriptorParser {
|
||||
public ModuleDescriptor parseDescriptor(ParserSettings ivy, URL descriptorURL,
|
||||
Resource res, boolean validate) throws ParseException, IOException {
|
||||
|
|
@ -49,6 +51,7 @@ public class ModuleDescriptorParserRegistryTest extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddConfigured() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
settings.addConfigured(new MyParser());
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParserTest;
|
|||
import org.apache.ivy.plugins.repository.url.URLResource;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
import org.apache.ivy.plugins.resolver.MockResolver;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParserTester {
|
||||
// junit test -- DO NOT REMOVE used by ant to know it's a junit test
|
||||
|
|
@ -55,8 +60,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
throws ParseException {
|
||||
// TODO make it a real mock and check that dd and data are the one that are expected
|
||||
final ModuleDescriptor moduleDesc = getModuleDescriptor(dd);
|
||||
ResolvedModuleRevision r = new ResolvedModuleRevision(this, this, moduleDesc, null);
|
||||
return r;
|
||||
return new ResolvedModuleRevision(this, this, moduleDesc, null);
|
||||
}
|
||||
|
||||
protected ModuleDescriptor getModuleDescriptor(final DependencyDescriptor dependencyDescriptor) {
|
||||
|
|
@ -68,9 +72,9 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
|
||||
private MockResolver mockedResolver = new MockedDependencyResolver();
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
@Before
|
||||
public void setUp() {
|
||||
settings.setDictatorResolver(mockedResolver);
|
||||
super.setUp();
|
||||
if (dest.exists()) {
|
||||
dest.delete();
|
||||
}
|
||||
|
|
@ -79,12 +83,14 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
}
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (dest.exists()) {
|
||||
dest.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() throws Exception {
|
||||
assertTrue(PomModuleDescriptorParser.getInstance().accept(
|
||||
new URLResource(getClass().getResource("test-simple.pom"))));
|
||||
|
|
@ -92,6 +98,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
new URLResource(XmlModuleDescriptorParserTest.class.getResource("test.xml"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-simple.pom"), false);
|
||||
|
|
@ -112,6 +119,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("jar", artifact[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargePom() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-large-pom.pom"), false);
|
||||
|
|
@ -121,6 +129,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals(mrid, md.getModuleRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackaging() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-packaging.pom"), false);
|
||||
|
|
@ -137,6 +146,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("war", artifact[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEjbPackaging() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-ejb-packaging.pom"), false);
|
||||
|
|
@ -153,6 +163,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("ejb", artifact[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEjbType() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-ejb-type.pom"), false);
|
||||
|
|
@ -173,6 +184,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("ejb", artifacts[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParent() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-parent.pom"), false);
|
||||
|
|
@ -187,16 +199,18 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("test", artifact[0].getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentNotFound() throws Exception {
|
||||
try {
|
||||
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(),
|
||||
getClass().getResource("test-parent-not-found.pom"), false);
|
||||
fail("IOException should have been thrown!");
|
||||
} catch (IOException e) {
|
||||
assertTrue(e.getMessage().indexOf("Impossible to load parent") != -1);
|
||||
assertTrue(e.getMessage().contains("Impossible to load parent"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParent2() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-parent2.pom"), false);
|
||||
|
|
@ -211,6 +225,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("test", artifact[0].getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentVersion() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-parent.version.pom"), false);
|
||||
|
|
@ -225,6 +240,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("test", artifact[0].getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentGroupId() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-parent.groupid.pom"), false);
|
||||
|
|
@ -239,6 +255,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("test", artifact[0].getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProjectParentVersion() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-project.parent.version.pom"), false);
|
||||
|
|
@ -253,6 +270,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("test", artifact[0].getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependencies() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencies.pom"), false);
|
||||
|
|
@ -270,6 +288,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getAllDependencyArtifacts().length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithClassifier() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencies-with-classifier.pom"), true);
|
||||
|
|
@ -307,6 +326,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals(extraAtt, dds[0].getAllDependencyArtifacts()[0].getExtraAttributes());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithType() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencies-with-type.pom"), true);
|
||||
|
|
@ -325,6 +345,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("dll", dds[0].getAllDependencyArtifacts()[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithVersionPropertyAndPropertiesTag() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-version.pom"), false);
|
||||
|
|
@ -340,6 +361,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
}
|
||||
|
||||
// IVY-392
|
||||
@Test
|
||||
public void testDependenciesWithInactiveProfile() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencies-with-profile.pom"), false);
|
||||
|
|
@ -355,6 +377,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithoutVersion() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-without-version.pom"), false);
|
||||
|
|
@ -369,6 +392,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProperties() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-properties.pom"), false);
|
||||
|
|
@ -384,6 +408,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReal() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("commons-lang-1.0.pom"), false);
|
||||
|
|
@ -399,6 +424,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReal2() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("wicket-1.3-incubating-SNAPSHOT.pom"), false);
|
||||
|
|
@ -409,6 +435,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
md.getModuleRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariables() throws Exception {
|
||||
// test case for IVY-425
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
|
|
@ -426,6 +453,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[10].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesInProfile() throws Exception {
|
||||
// test case for IVY-423
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
|
|
@ -437,6 +465,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
md.getModuleRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIVY424() throws Exception {
|
||||
// test case for IVY-424
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
|
|
@ -448,6 +477,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
md.getModuleRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOptional() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-optional.pom"), false);
|
||||
|
|
@ -488,6 +518,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithScope() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -526,6 +557,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
new HashSet(Arrays.asList(dds[2].getDependencyConfigurations("runtime"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExclusion() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-exclusion.pom"), false);
|
||||
|
|
@ -582,6 +614,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertFalse("Dependency " + excludeAllTransitiveDepsDescriptor + " was expected to have transitive=false", excludeAllTransitiveDepsDescriptor.isTransitive());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithPlugins() throws Exception {
|
||||
// test case for IVY-417
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
|
|
@ -596,6 +629,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals(0, dds.length);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHomeAndDescription() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("mule-1.3.3.pom"), false);
|
||||
|
|
@ -613,6 +647,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
.replaceAll("\r\n", "\n").replace('\r', '\n'));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLicense() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("spring-hibernate3-2.0.2.pom"), false);
|
||||
|
|
@ -625,11 +660,12 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that if a module doesn't have a license specified, then parent pom's license (if any) is used for the child
|
||||
* module
|
||||
* Tests that if a module doesn't have a license specified, then parent pom's license (if any)
|
||||
* is used for the child module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testLicenseFromParent() throws Exception {
|
||||
final IvySettings customIvySettings = createIvySettingsForParentLicenseTesting("test-parent-with-licenses.pom",
|
||||
"org.apache", "test-ivy-license-parent");
|
||||
|
|
@ -645,11 +681,12 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that if a project explicitly specifies the licenses, then the licenses (if any) from its parent pom
|
||||
* aren't applied to the child project
|
||||
* Tests that if a project explicitly specifies the licenses, then the licenses (if any) from
|
||||
* its parent pom aren't applied to the child project
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testOverriddenLicense() throws Exception {
|
||||
final IvySettings customIvySettings = createIvySettingsForParentLicenseTesting("test-parent-with-licenses.pom",
|
||||
"org.apache", "test-ivy-license-parent");
|
||||
|
|
@ -664,8 +701,8 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("Unexpected license URL", "http://www.apache.org/licenses/LICENSE-2.0.txt", licenses[0].getUrl());
|
||||
}
|
||||
|
||||
|
||||
public void testDependencyManagment() throws ParseException, IOException {
|
||||
@Test
|
||||
public void testDependencyManagement() throws ParseException, IOException {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencyMgt.pom"), false);
|
||||
assertNotNull(md);
|
||||
|
|
@ -682,7 +719,8 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals(4, md.getExtraInfos().size());
|
||||
}
|
||||
|
||||
public void testDependencyManagmentWithScope() throws ParseException, IOException {
|
||||
@Test
|
||||
public void testDependencyManagementWithScope() throws ParseException, IOException {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-dependencyMgt-with-scope.pom"), false);
|
||||
assertNotNull(md);
|
||||
|
|
@ -701,6 +739,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("The configuration must be test", "test", dds[0].getModuleConfigurations()[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentDependencyMgt() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -740,7 +779,9 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("jms", excludes[1].getId().getModuleId().getName());
|
||||
}
|
||||
|
||||
public void testOverrideParentVersionPropertyDependencyMgt() throws ParseException, IOException {
|
||||
@Test
|
||||
public void testOverrideParentVersionPropertyDependencyMgt()
|
||||
throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
throws ParseException {
|
||||
|
|
@ -780,6 +821,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("jms", excludes[1].getId().getModuleId().getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentProperties() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -810,6 +852,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
// parent
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideParentProperties() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -838,6 +881,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[1].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideGrandparentProperties() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -873,12 +917,14 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[2].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPomWithEntity() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-entity.pom"), true);
|
||||
assertNotNull(md);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModel() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(settings,
|
||||
getClass().getResource("test-model.pom"), false);
|
||||
|
|
@ -899,6 +945,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
assertEquals("jar", artifact[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentBomImport() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -928,6 +975,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[0].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGrandparentBomImport() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
@ -960,6 +1008,7 @@ public class PomModuleDescriptorParserTest extends AbstractModuleDescriptorParse
|
|||
dds[1].getDependencyRevisionId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentProfileBomImport() throws ParseException, IOException {
|
||||
settings.setDictatorResolver(new MockResolver() {
|
||||
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
|
||||
|
|
|
|||
|
|
@ -27,10 +27,14 @@ import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PomModuleDescriptorWriterTest extends TestCase {
|
||||
public class PomModuleDescriptorWriterTest {
|
||||
private static String LICENSE;
|
||||
static {
|
||||
try {
|
||||
|
|
@ -43,6 +47,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
|
||||
private File _dest = new File("build/test/test-write.xml");
|
||||
|
||||
@Test
|
||||
public void testSimple() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-simple.pom"), false);
|
||||
|
|
@ -56,6 +61,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleDependencies() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies.pom"), false);
|
||||
|
|
@ -69,6 +75,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithScope() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -82,6 +89,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithType() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-type.pom"), false);
|
||||
|
|
@ -95,6 +103,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDependenciesWithClassifier() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-classifier.pom"),
|
||||
|
|
@ -109,6 +118,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOptional() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-optional.pom"), false);
|
||||
|
|
@ -122,6 +132,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransitive() throws Exception {
|
||||
ModuleDescriptor md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-transitive.xml"), false);
|
||||
|
|
@ -136,6 +147,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPackaging() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-packaging.pom"), false);
|
||||
|
|
@ -149,6 +161,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteCompileConfigurationOnly() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -163,6 +176,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteRuntimeConfigurationOnly() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -177,6 +191,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAllConfiguration() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -190,6 +205,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
assertEquals(expected, wrote);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteAllExceptRuntimeConfiguration() throws Exception {
|
||||
ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getClass().getResource("test-dependencies-with-scope.pom"), false);
|
||||
|
|
@ -213,6 +229,7 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
return (new PomWriterOptions()).setLicenseHeader(LICENSE).setPrintIvyInfo(false);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
if (_dest.exists()) {
|
||||
_dest.delete();
|
||||
|
|
@ -222,7 +239,8 @@ public class PomModuleDescriptorWriterTest extends TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@After
|
||||
public void tearDown() {
|
||||
if (_dest.exists()) {
|
||||
_dest.delete();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue