Author: hibou
Date: Fri Nov 19 14:13:40 2010
New Revision: 1036863
URL: http://svn.apache.org/viewvc?rev=1036863&view=rev
Log:
Setup of the unit tests of the OSGi mapping
Modified:
ant/ivy/core/trunk/build.xml
ant/ivy/core/trunk/ivy.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/IvyIntegrationTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/JarHandlingRepositoryTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiIvyParserTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiManifestParserTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoResolverTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/util/ArtifactTokensTest.java
ant/ivy/core/trunk/test/test-bundles/build.xml
ant/ivy/core/trunk/test/test-repo/build.xml
Modified: ant/ivy/core/trunk/build.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/build.xml?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/build.xml (original)
+++ ant/ivy/core/trunk/build.xml Fri Nov 19 14:13:40 2010
@@ -426,8 +426,13 @@
</fileset>
</copy>
</target>
-
- <target name="test-internal" depends="build-test, init-tests"
unless="skip.test">
+
+ <target name="prepare-test" depends="resolve" unless="skip.test">
+ <ant dir="${basedir}/test/test-repo" target="generate-bundles" />
+ <ant dir="${basedir}/test/test-bundles" target="build-all" />
+ </target>
+
+ <target name="test-internal" depends="build-test, init-tests"
unless="skip.test">
<mkdir dir="${test.xml.dir}" />
<junit
Modified: ant/ivy/core/trunk/ivy.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/ivy.xml?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/ivy.xml (original)
+++ ant/ivy/core/trunk/ivy.xml Fri Nov 19 14:13:40 2010
@@ -57,12 +57,13 @@
<dependency org="junit" name="junit" rev="3.8.2"
conf="test->default" />
<dependency org="commons-lang" name="commons-lang"
rev="[1.0,3.0[" conf="test->default" />
<dependency org="org.apache.ant" name="ant-testutil"
rev="1.7.0" conf="test->default" transitive="false" />
- <dependency org="ant" name="ant-launcher" rev="1.6.2"
conf="test->default" transitive="false"/>
+ <dependency org="ant" name="ant-launcher" rev="1.6.2"
conf="test->default" transitive="false"/>
+ <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"
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" />
</dependencies>
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/IvyIntegrationTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/IvyIntegrationTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/IvyIntegrationTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/IvyIntegrationTest.java
Fri Nov 19 14:13:40 2010
@@ -37,7 +37,7 @@ import org.apache.ivy.plugins.parser.Abs
public class IvyIntegrationTest extends AbstractModuleDescriptorParserTester {
private URL getTestResource(String resource) throws MalformedURLException {
- return new File("java/test-ivy/" + resource).toURI().toURL();
+ return new File("test/test-ivy/" + resource).toURI().toURL();
}
public void testAcmeResolveAlpha() throws Exception {
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/JarHandlingRepositoryTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/JarHandlingRepositoryTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/JarHandlingRepositoryTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/JarHandlingRepositoryTest.java
Fri Nov 19 14:13:40 2010
@@ -27,7 +27,7 @@ public class JarHandlingRepositoryTest e
public void test() throws IOException {
final JarEntryResource resource = new JarEntryResource(
-
"java/test-bundles/jars/com.acme.alpha-1.0.0.20080101.jar!META-INF/MANIFEST.MF");
+
"test/test-bundles/jars/com.acme.alpha-1.0.0.20080101.jar!META-INF/MANIFEST.MF");
assertNotNull(resource.openStream());
assertTrue(resource.isLocal());
assertTrue(resource.exists());
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiIvyParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiIvyParserTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiIvyParserTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiIvyParserTest.java
Fri Nov 19 14:13:40 2010
@@ -34,10 +34,10 @@ public class OsgiIvyParserTest extends T
public void testSimple() throws Exception {
IvySettings settings = new IvySettings();
- settings.load(new File("java/test-ivy/include/ivysettings.xml"));
+ settings.load(new File("test/test-ivy/include/ivysettings.xml"));
URLResource includingResource = new URLResource(
- new File("java/test-ivy/include/ivy.xml").toURL());
+ new File("test/test-ivy/include/ivy.xml").toURL());
ModuleDescriptorParser includingParser =
ModuleDescriptorParserRegistry.getInstance()
.getParser(includingResource);
assertTrue(includingParser instanceof OsgiIvyParser);
@@ -47,7 +47,7 @@ public class OsgiIvyParserTest extends T
assertNotNull(includingMd);
URLResource resultResource = new URLResource(new File(
- "java/test-ivy/include/ivy-result.xml").toURL());
+ "test/test-ivy/include/ivy-result.xml").toURL());
ModuleDescriptorParser resultParser =
ModuleDescriptorParserRegistry.getInstance()
.getParser(resultResource);
ModuleDescriptor resultMd = resultParser.parseDescriptor(settings,
resultResource.getURL(),
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiManifestParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiManifestParserTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiManifestParserTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/ivy/OsgiManifestParserTest.java
Fri Nov 19 14:13:40 2010
@@ -42,7 +42,7 @@ import org.apache.ivy.util.FileUtil;
public class OsgiManifestParserTest extends
AbstractModuleDescriptorParserTester {
private URL getTestResource(String resource) throws MalformedURLException {
- return new File("java/test-ivy/" + resource).toURI().toURL();
+ return new File("test/test-ivy/" + resource).toURI().toURL();
}
public void testAccept() throws Exception {
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java Fri
Nov 19 14:13:40 2010
@@ -31,7 +31,7 @@ public class OBRParserTest extends TestC
public void testParse() throws Exception {
BundleRepo repo = OBRXMLParser
- .parse(new FileInputStream(new File("java/test-obr/obr.xml")));
+ .parse(new FileInputStream(new File("test/test-obr/obr.xml")));
assertNotNull(repo);
System.out.println(repo.getBundles().size() + " bundles successfully
parsed, "
+ Message.getProblems().size() + " errors");
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoResolverTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoResolverTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoResolverTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoResolverTest.java
Fri Nov 19 14:13:40 2010
@@ -93,14 +93,14 @@ public class BundleRepoResolverTest exte
settings = new IvySettings();
bundleResolver = new BundleRepoResolver();
- bundleResolver.setRepoXmlFile(new
File("java/test-repo/bundlerepo/repo.xml")
+ bundleResolver.setRepoXmlFile(new
File("test/test-repo/bundlerepo/repo.xml")
.getAbsolutePath());
bundleResolver.setName("bundle");
bundleResolver.setSettings(settings);
settings.addResolver(bundleResolver);
bundleUrlResolver = new BundleRepoResolver();
- bundleUrlResolver.setRepoXmlURL(new
File("java/test-repo/bundlerepo/repo.xml").toURI()
+ bundleUrlResolver.setRepoXmlURL(new
File("test/test-repo/bundlerepo/repo.xml").toURI()
.toURL().toExternalForm());
bundleUrlResolver.setName("bundleurl");
bundleUrlResolver.setSettings(settings);
@@ -108,12 +108,12 @@ public class BundleRepoResolverTest exte
dualResolver = new DualResolver();
BundleRepoResolver resolver = new BundleRepoResolver();
- resolver.setRepoXmlFile("java/test-repo/ivyrepo/repo.xml");
+ resolver.setRepoXmlFile("test/test-repo/ivyrepo/repo.xml");
resolver.setName("dual-bundle");
resolver.setSettings(settings);
dualResolver.add(resolver);
dualResolver.setName("dual");
- File ivyrepo = new File("java/test-repo/ivyrepo");
+ File ivyrepo = new File("test/test-repo/ivyrepo");
FileSystemResolver fileSystemResolver = new FileSystemResolver();
fileSystemResolver.addIvyPattern(ivyrepo.getAbsolutePath()
+ "/[organisation]/[module]/[revision]/ivy.xml");
@@ -270,7 +270,7 @@ public class BundleRepoResolverTest exte
private void genericTestResolve(String jarName, String conf,
ModuleRevisionId[] expectedMrids)
throws Exception {
- JarInputStream in = new JarInputStream(new
FileInputStream("java/test-repo/bundlerepo/"
+ JarInputStream in = new JarInputStream(new
FileInputStream("test/test-repo/bundlerepo/"
+ jarName));
BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
DefaultModuleDescriptor md =
BundleInfoAdapter.toModuleDescriptor(bundleInfo, null);
@@ -291,7 +291,7 @@ public class BundleRepoResolverTest exte
}
private void genericTestFailingResolve(String jarName, String conf) throws
Exception {
- JarInputStream in = new JarInputStream(new
FileInputStream("java/test-repo/bundlerepo/"
+ JarInputStream in = new JarInputStream(new
FileInputStream("test/test-repo/bundlerepo/"
+ jarName));
BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
DefaultModuleDescriptor md =
BundleInfoAdapter.toModuleDescriptor(bundleInfo, null);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/repo/BundleRepoTest.java
Fri Nov 19 14:13:40 2010
@@ -42,24 +42,24 @@ import org.xml.sax.SAXException;
public class BundleRepoTest extends TestCase {
public void testFS() throws Exception {
- FSManifestIterable it = new FSManifestIterable(new
File("java/test-repo/bundlerepo"), "");
+ FSManifestIterable it = new FSManifestIterable(new
File("test/test-repo/bundlerepo"), "");
BundleRepo repo = new BundleRepo();
repo.populate(it);
BundleRepo repo2 = OBRXMLParser.parse(new FileInputStream(
- "java/test-repo/bundlerepo/repo.xml"));
+ "test/test-repo/bundlerepo/repo.xml"));
assertEquals(repo, repo2);
}
public void testFileRepo() throws Exception {
RepositoryManifestIterable it = new RepositoryManifestIterable(new
FileRepository(new File(
- "java/test-repo/bundlerepo")));
+ "test/test-repo/bundlerepo")));
BundleRepo repo = new BundleRepo();
repo.populate(it);
BundleRepo repo2 = OBRXMLParser.parse(new FileInputStream(
- "java/test-repo/bundlerepo/repo.xml"));
+ "test/test-repo/bundlerepo/repo.xml"));
assertEquals(repo, repo2);
}
@@ -67,7 +67,7 @@ public class BundleRepoTest extends Test
public void testResolver() throws Exception {
FileSystemResolver fileSystemResolver = new FileSystemResolver();
fileSystemResolver.setName("test");
- File ivyrepo = new File("java/test-repo/ivyrepo");
+ File ivyrepo = new File("test/test-repo/ivyrepo");
fileSystemResolver.addIvyPattern(ivyrepo.getAbsolutePath()
+ "/[organisation]/[module]/[revision]/ivy.xml");
fileSystemResolver.addArtifactPattern(ivyrepo.getAbsolutePath()
@@ -78,13 +78,13 @@ public class BundleRepoTest extends Test
repo.populate(it);
BundleRepo repo2 = OBRXMLParser
- .parse(new FileInputStream("java/test-repo/ivyrepo/repo.xml"));
+ .parse(new FileInputStream("test/test-repo/ivyrepo/repo.xml"));
assertEquals(repo, repo2);
}
public void testXMLSerialisation() throws SAXException, ParseException,
IOException {
- FSManifestIterable it = new FSManifestIterable(new
File("java/test-repo/bundlerepo"), "");
+ FSManifestIterable it = new FSManifestIterable(new
File("test/test-repo/bundlerepo"), "");
BundleRepo repo = new BundleRepo();
repo.populate(it);
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/util/ArtifactTokensTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/util/ArtifactTokensTest.java?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/util/ArtifactTokensTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/util/ArtifactTokensTest.java
Fri Nov 19 14:13:40 2010
@@ -22,9 +22,9 @@ import junit.framework.TestCase;
public class ArtifactTokensTest extends TestCase {
public void testGoodMatching() {
- final String repoResource =
"java/test-ivy/osgi/eclipse/plugins/org.eclipse.datatools.connectivity.ui_1.0.1.v200808121010";
+ final String repoResource =
"test/test-ivy/osgi/eclipse/plugins/org.eclipse.datatools.connectivity.ui_1.0.1.v200808121010";
final ArtifactTokens tokens = new ArtifactTokens(repoResource);
- assertEquals("java/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
+ assertEquals("test/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
assertEquals("org.eclipse.datatools.connectivity.ui", tokens.module);
assertEquals("1.0.1", tokens.version.numbersAsString());
assertEquals("v200808121010", tokens.version.qualifier());
@@ -32,9 +32,9 @@ public class ArtifactTokensTest extends
}
public void testGoodMatching2() {
- final String repoResource =
"java/test-ivy/osgi/eclipse/plugins/org.eclipse.datatools.connectivity.ui_1.0.1";
+ final String repoResource =
"test/test-ivy/osgi/eclipse/plugins/org.eclipse.datatools.connectivity.ui_1.0.1";
final ArtifactTokens tokens = new ArtifactTokens(repoResource);
- assertEquals("java/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
+ assertEquals("test/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
assertEquals("org.eclipse.datatools.connectivity.ui", tokens.module);
assertEquals("1.0.1", tokens.version.numbersAsString());
assertEquals("", tokens.version.qualifier());
@@ -42,9 +42,9 @@ public class ArtifactTokensTest extends
}
public void testGoodMatching3() {
- final String repoResource =
"java/test-ivy/osgi/eclipse/plugins/org.myorg.module.one_3.21.100.v20070530";
+ final String repoResource =
"test/test-ivy/osgi/eclipse/plugins/org.myorg.module.one_3.21.100.v20070530";
final ArtifactTokens tokens = new ArtifactTokens(repoResource);
- assertEquals("java/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
+ assertEquals("test/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
assertEquals("org.myorg.module.one", tokens.module);
assertEquals("3.21.100", tokens.version.numbersAsString());
assertEquals("v20070530", tokens.version.qualifier());
@@ -52,11 +52,11 @@ public class ArtifactTokensTest extends
}
public void testGoodMatching4() {
- final String repoResource =
"java/test-ivy/osgi/eclipse/plugins/org.eclipse.mylyn.tasks.ui_3.0.1.v20080721-2100-e33.jar";
+ final String repoResource =
"test/test-ivy/osgi/eclipse/plugins/org.eclipse.mylyn.tasks.ui_3.0.1.v20080721-2100-e33.jar";
// String repoResource =
- //
"java/test-ivy/osgi/eclipse/plugins/org.eclipse.mylyn.tasks.ui_3.0.1.v20080721.jar";
+ //
"test/test-ivy/osgi/eclipse/plugins/org.eclipse.mylyn.tasks.ui_3.0.1.v20080721.jar";
final ArtifactTokens tokens = new ArtifactTokens(repoResource);
- assertEquals("java/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
+ assertEquals("test/test-ivy/osgi/eclipse/plugins/", tokens.prefix);
assertEquals("org.eclipse.mylyn.tasks.ui", tokens.module);
assertEquals("3.0.1", tokens.version.numbersAsString());
assertEquals("v20080721-2100-e33", tokens.version.qualifier());
@@ -64,7 +64,7 @@ public class ArtifactTokensTest extends
}
public void testBadMatching() {
- final String repoResource = "java/test-ivy/osgi/eclipse/plugins/fake";
+ final String repoResource = "test/test-ivy/osgi/eclipse/plugins/fake";
final ArtifactTokens tokens = new ArtifactTokens(repoResource);
assertNull(tokens.prefix);
assertNull(tokens.module);
Modified: ant/ivy/core/trunk/test/test-bundles/build.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/test-bundles/build.xml?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/test-bundles/build.xml (original)
+++ ant/ivy/core/trunk/test/test-bundles/build.xml Fri Nov 19 14:13:40 2010
@@ -71,6 +71,7 @@
<property name="bundle.bin" value="${bundle.dir}/bin" />
<property name="bundle.manifest"
value="${bundle.dir}/META-INF/MANIFEST.MF" />
+ <mkdir dir="${bundle.bin}" />
<javac destdir="${bundle.bin}" srcdir="${bundle.src}" />
<jar
destfile="${jars.dir}/com.acme.${bundle.name}-${bundle.version}.jar"
basedir="${bundle.bin}" manifest="${bundle.manifest}" />
@@ -85,13 +86,14 @@
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant">
<classpath>
- <pathelement location="${basedir}/../../lib/ivy*.jar"/>
+ <pathelement location="${basedir}/../../build/classes/core" />
+ <pathelement location="${basedir}/../../build/classes/bootstrap" />
</classpath>
</taskdef>
<target name="ivy">
<ivy:settings file="${basedir}/../test-ivy/acme-ivysettings.xml" />
<ivy:resolve file="${basedir}/../test-ivy/acme-ivy.xml" />
- <ivy:retrieve
pattern="${basedir}/../../target/test-data/bundles/[artifact]-[revision].[ext]"/>
+ <ivy:retrieve
pattern="${basedir}/../../build/test-data/bundles/[artifact]-[revision].[ext]"/>
</target>
</project>
\ No newline at end of file
Modified: ant/ivy/core/trunk/test/test-repo/build.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/test-repo/build.xml?rev=1036863&r1=1036862&r2=1036863&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/test-repo/build.xml (original)
+++ ant/ivy/core/trunk/test/test-repo/build.xml Fri Nov 19 14:13:40 2010
@@ -18,11 +18,9 @@
-->
<project basedir="." default="generate-bundles" name="ivy-osgi-test-repo">
- <echo message="${basedir}"/>
-
<!-- Need ant contrib ! -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
- <classpath location="${basedir}/../../lib/test/ant-contrib.jar"/>
+ <classpath location="${basedir}/../../lib/ant-contrib.jar"/>
</taskdef>
<target name="generate-bundles">