Browse Source

1. Move from optional.repository to tasks.repository

2. rename <libraries>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277054 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
f4c6f96bae
18 changed files with 53 additions and 75 deletions
  1. +7
    -7
      src/etc/testcases/taskdefs/libraries.xml
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/defaults.properties
  3. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/repository/AbsentFilesPolicy.java
  4. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/repository/AssertDownloaded.java
  5. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/repository/BaseLibraryPolicy.java
  6. +2
    -4
      src/main/org/apache/tools/ant/taskdefs/repository/ForceUpdatePolicy.java
  7. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/repository/HttpRepository.java
  8. +5
    -11
      src/main/org/apache/tools/ant/taskdefs/repository/Libraries.java
  9. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/repository/Library.java
  10. +4
    -6
      src/main/org/apache/tools/ant/taskdefs/repository/LibraryPolicy.java
  11. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/repository/MavenRepository.java
  12. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/repository/NoUpdatePolicy.java
  13. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/repository/Repository.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/repository/RepositoryRef.java
  15. +2
    -5
      src/main/org/apache/tools/ant/taskdefs/repository/ScheduledUpdatePolicy.java
  16. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/repository/TimestampPolicy.java
  17. +1
    -1
      src/main/org/apache/tools/ant/types/defaults.properties
  18. +13
    -12
      src/testcases/org/apache/tools/ant/taskdefs/LibrariesTest.java

src/etc/testcases/taskdefs/optional/getlibraries.xml → src/etc/testcases/taskdefs/libraries.xml View File

@@ -13,8 +13,8 @@
value="${commons.logging.project}/jars/${commons.logging.project}-1.0.1.jar"/> value="${commons.logging.project}/jars/${commons.logging.project}-1.0.1.jar"/>


<presetdef name="gl1"> <presetdef name="gl1">
<getlibraries destDir="${lib.dir}">
</getlibraries>
<libraries destDir="${lib.dir}">
</libraries>
</presetdef> </presetdef>


<presetdef name="getlib"> <presetdef name="getlib">
@@ -56,19 +56,19 @@
<target name="teardown" depends="cleanup"/> <target name="teardown" depends="cleanup"/>
<target name="testEmpty" depends="init"> <target name="testEmpty" depends="init">
<getlibraries/>
<libraries/>
</target> </target>


<target name="testEmpty2" depends="init"> <target name="testEmpty2" depends="init">
<getlibraries destDir="${lib.dir}">
<libraries destDir="${lib.dir}">


</getlibraries>
</libraries>
</target> </target>


<target name="testEmpty3" depends="init"> <target name="testEmpty3" depends="init">
<getlibraries destDir="${lib.dir}">
<libraries destDir="${lib.dir}">
<repository/> <repository/>
</getlibraries>
</libraries>
</target> </target>


<target name="testNoRepo" depends="init"> <target name="testNoRepo" depends="init">

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/defaults.properties View File

@@ -80,6 +80,7 @@ defaultexcludes=org.apache.tools.ant.taskdefs.DefaultExcludes
presetdef=org.apache.tools.ant.taskdefs.PreSetDef presetdef=org.apache.tools.ant.taskdefs.PreSetDef
macrodef=org.apache.tools.ant.taskdefs.MacroDef macrodef=org.apache.tools.ant.taskdefs.MacroDef
nice=org.apache.tools.ant.taskdefs.Nice nice=org.apache.tools.ant.taskdefs.Nice
libraries=org.apache.tools.ant.taskdefs.repository.Libraries


# optional tasks # optional tasks
image=org.apache.tools.ant.taskdefs.optional.image.Image image=org.apache.tools.ant.taskdefs.optional.image.Image
@@ -203,7 +204,6 @@ rexec=org.apache.tools.ant.taskdefs.optional.net.RExecTask
scriptdef=org.apache.tools.ant.taskdefs.optional.script.ScriptDef scriptdef=org.apache.tools.ant.taskdefs.optional.script.ScriptDef
ildasm=org.apache.tools.ant.taskdefs.optional.dotnet.Ildasm ildasm=org.apache.tools.ant.taskdefs.optional.dotnet.Ildasm
apt=org.apache.tools.ant.taskdefs.Apt apt=org.apache.tools.ant.taskdefs.Apt
getlibraries=org.apache.tools.ant.taskdefs.optional.repository.GetLibraries


# deprecated ant tasks (kept for back compatibility) # deprecated ant tasks (kept for back compatibility)
starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut starteam=org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut


+ 1
- 3
src/main/org/apache/tools/ant/taskdefs/repository/AbsentFilesPolicy.java View File

@@ -16,8 +16,6 @@
*/ */
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;

import java.util.ListIterator; import java.util.ListIterator;


/** /**
@@ -36,7 +34,7 @@ public class AbsentFilesPolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
owner.markMissingLibrariesForFetch(); owner.markMissingLibrariesForFetch();
return true; return true;
} }


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/repository/AssertDownloaded.java View File

@@ -17,7 +17,6 @@
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;


import java.util.ListIterator; import java.util.ListIterator;


@@ -54,7 +53,7 @@ public class AssertDownloaded extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
if(count==null) { if(count==null) {
throw new BuildException(ERROR_NO_COUNT); throw new BuildException(ERROR_NO_COUNT);
} }
@@ -70,7 +69,7 @@ public class AssertDownloaded extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* *
*/ */
public void afterFetched(GetLibraries owner, ListIterator libraries) {
public void afterFetched(Libraries owner, ListIterator libraries) {
int fetched=owner.calculateDownloadedCount(); int fetched=owner.calculateDownloadedCount();
if(fetched!=count.intValue()) { if(fetched!=count.intValue()) {
throw new BuildException(ERROR_DOWNLOAD_FAILURE throw new BuildException(ERROR_DOWNLOAD_FAILURE


+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/repository/BaseLibraryPolicy.java View File

@@ -16,8 +16,6 @@
*/ */
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;

import java.util.ListIterator; import java.util.ListIterator;


/** /**
@@ -57,7 +55,7 @@ public abstract class BaseLibraryPolicy implements LibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
return true; return true;
} }


@@ -70,7 +68,7 @@ public abstract class BaseLibraryPolicy implements LibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* *
*/ */
public void afterFetched(GetLibraries owner, ListIterator libraries) {
public void afterFetched(Libraries owner, ListIterator libraries) {


} }
} }

+ 2
- 4
src/main/org/apache/tools/ant/taskdefs/repository/ForceUpdatePolicy.java View File

@@ -17,8 +17,6 @@
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;
import org.apache.tools.ant.taskdefs.optional.repository.Library;


import java.util.Iterator; import java.util.Iterator;
import java.util.ListIterator; import java.util.ListIterator;
@@ -47,7 +45,7 @@ public class ForceUpdatePolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
owner.markAllLibrariesForFetch(true); owner.markAllLibrariesForFetch(true);
owner._setUseTimestamp(false); owner._setUseTimestamp(false);
return true; return true;
@@ -62,7 +60,7 @@ public class ForceUpdatePolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* *
*/ */
public void afterFetched(GetLibraries owner, ListIterator libraries) {
public void afterFetched(Libraries owner, ListIterator libraries) {
//here verify that everything came in //here verify that everything came in
Iterator downloaded = owner.enabledLibrariesIterator(); Iterator downloaded = owner.enabledLibrariesIterator();
while (downloaded.hasNext()) { while (downloaded.hasNext()) {


src/main/org/apache/tools/ant/taskdefs/optional/repository/HttpRepository.java → src/main/org/apache/tools/ant/taskdefs/repository/HttpRepository.java View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
* *
*/ */
package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;




import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -62,7 +62,7 @@ public abstract class HttpRepository extends Repository {
/** /**
* owner class * owner class
*/ */
private GetLibraries owner;
private Libraries owner;


/** /**
* retry logic * retry logic
@@ -133,7 +133,7 @@ public abstract class HttpRepository extends Repository {
} }
}*/ }*/


public GetLibraries getOwner() {
public Libraries getOwner() {
return owner; return owner;
} }


@@ -161,7 +161,7 @@ public abstract class HttpRepository extends Repository {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* *
*/ */
public void connect(GetLibraries newOwner) {
public void connect(Libraries newOwner) {
this.owner = newOwner; this.owner = newOwner;
if (!url.endsWith("/")) { if (!url.endsWith("/")) {
url = url + '/'; url = url + '/';
@@ -189,7 +189,7 @@ public abstract class HttpRepository extends Repository {


/** /**
* Test for a repository being reachable. This method is called after {@link * Test for a repository being reachable. This method is called after {@link
* #connect(org.apache.tools.ant.taskdefs.optional.repository.GetLibraries)}
* #connect(org.apache.tools.ant.taskdefs.repository.GetLibraries)}
* is called, before any files are to be retrieved. * is called, before any files are to be retrieved.
* <p/> * <p/>
* If it returns false the repository considers itself offline. Similarly, * If it returns false the repository considers itself offline. Similarly,

src/main/org/apache/tools/ant/taskdefs/optional/repository/GetLibraries.java → src/main/org/apache/tools/ant/taskdefs/repository/Libraries.java View File

@@ -14,19 +14,11 @@
* limitations under the License. * limitations under the License.
* *
*/ */
package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.repository.AbsentFilesPolicy;
import org.apache.tools.ant.taskdefs.repository.AssertDownloaded;
import org.apache.tools.ant.taskdefs.repository.EnabledLibraryElementList;
import org.apache.tools.ant.taskdefs.repository.ForceUpdatePolicy;
import org.apache.tools.ant.taskdefs.repository.LibraryPolicy;
import org.apache.tools.ant.taskdefs.repository.NoUpdatePolicy;
import org.apache.tools.ant.taskdefs.repository.ScheduledUpdatePolicy;
import org.apache.tools.ant.taskdefs.repository.TimestampPolicy;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;


@@ -38,15 +30,17 @@ import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;


/** /**
* This task will retrieve one or more libraries from a repository. <ol>
* This task will retrieve one or more libraries from a repository.
* <ol>
* <li>Users must declare a repository, either inline or by reference</li> * <li>Users must declare a repository, either inline or by reference</li>
* <li>Dependency checking is used (timestamps) unless forceDownload=true</li> * <li>Dependency checking is used (timestamps) unless forceDownload=true</li>
* <li>It is an error if, at the end of the task, a library is missing. * <li>It is an error if, at the end of the task, a library is missing.
* </ol>
* *
* @ant.task * @ant.task
* @since Ant 1.7 * @since Ant 1.7
*/ */
public final class GetLibraries extends Task {
public final class Libraries extends Task {


/** /**
* destination * destination

src/main/org/apache/tools/ant/taskdefs/optional/repository/Library.java → src/main/org/apache/tools/ant/taskdefs/repository/Library.java View File

@@ -15,10 +15,9 @@
* *
*/ */


package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.repository.EnabledLibraryElement;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;



+ 4
- 6
src/main/org/apache/tools/ant/taskdefs/repository/LibraryPolicy.java View File

@@ -17,8 +17,6 @@


package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;

import java.util.ListIterator; import java.util.ListIterator;


/** /**
@@ -29,14 +27,14 @@ import java.util.ListIterator;
* Here is the use * Here is the use
* <ol> * <ol>
* <li>Policies are executed in order of declaration. * <li>Policies are executed in order of declaration.
* <li>The {@link #beforeConnect(org.apache.tools.ant.taskdefs.optional.repository.GetLibraries, java.util.ListIterator)} call,
* <li>The {@link #beforeConnect(org.apache.tools.ant.taskdefs.repository.Libraries, java.util.ListIterator)} call,
* is called before any connection has been initiated; policies can manipulate * is called before any connection has been initiated; policies can manipulate
* the library list, set/reset their toFetch list, rename destination files, etc. * the library list, set/reset their toFetch list, rename destination files, etc.
* <li>If any policy returns false from the method, the connection does not proceed. * <li>If any policy returns false from the method, the connection does not proceed.
* This is not an error, provided the files are actually present. * This is not an error, provided the files are actually present.
* <li>After running through the fetch of all files marked for download, * <li>After running through the fetch of all files marked for download,
* every policy implementation will again be called in order of declaration. * every policy implementation will again be called in order of declaration.
* <li>The {@link #afterFetched(org.apache.tools.ant.taskdefs.optional.repository.GetLibraries, java.util.ListIterator)} method
* <li>The {@link #afterFetched(org.apache.tools.ant.taskdefs.repository.Libraries, java.util.ListIterator)} method
* does not return anything. * does not return anything.
* <li>Either method can throw a BuildException to indicate some kind of error. * <li>Either method can throw a BuildException to indicate some kind of error.
* </ol> * </ol>
@@ -57,7 +55,7 @@ public interface LibraryPolicy extends EnabledLibraryElement {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries);
public boolean beforeConnect(Libraries owner, ListIterator libraries);


/** /**
* method called after a successful connection process. * method called after a successful connection process.
@@ -65,7 +63,7 @@ public interface LibraryPolicy extends EnabledLibraryElement {
* @param libraries * @param libraries
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
*/ */
public void afterFetched(GetLibraries owner,ListIterator libraries);
public void afterFetched(Libraries owner,ListIterator libraries);




} }

src/main/org/apache/tools/ant/taskdefs/optional/repository/MavenRepository.java → src/main/org/apache/tools/ant/taskdefs/repository/MavenRepository.java View File

@@ -15,7 +15,7 @@
* *
*/ */


package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;



+ 1
- 3
src/main/org/apache/tools/ant/taskdefs/repository/NoUpdatePolicy.java View File

@@ -16,8 +16,6 @@
*/ */
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;

import java.util.ListIterator; import java.util.ListIterator;


/** /**
@@ -36,7 +34,7 @@ public class NoUpdatePolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
// mark all files as no Fetch // mark all files as no Fetch
owner.markAllLibrariesForFetch(false); owner.markAllLibrariesForFetch(false);
return true; return true;


src/main/org/apache/tools/ant/taskdefs/optional/repository/Repository.java → src/main/org/apache/tools/ant/taskdefs/repository/Repository.java View File

@@ -15,7 +15,7 @@
* *
*/ */


package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.types.DataType; import org.apache.tools.ant.types.DataType;
@@ -28,7 +28,7 @@ import java.io.IOException;
* that ships with Ant, or one you implement and declare yourself. * that ships with Ant, or one you implement and declare yourself.
* <p/> * <p/>
* The &lt;getlibraries&gt; task lets you supply a repository by reference * The &lt;getlibraries&gt; task lets you supply a repository by reference
* inline {@link GetLibraries#add(Repository)} or on the command line {@link
* inline {@link Libraries#add(Repository)} or on the command line {@link
* GetLibraries#setRepositoryRef(org.apache.tools.ant.types.Reference)} * GetLibraries#setRepositoryRef(org.apache.tools.ant.types.Reference)}
* *
* @since Ant1.7 * @since Ant1.7
@@ -67,7 +67,7 @@ public abstract class Repository extends DataType {
* *
* @throws BuildException * @throws BuildException
*/ */
public void connect(GetLibraries owner) {
public void connect(Libraries owner) {


} }



src/main/org/apache/tools/ant/taskdefs/optional/repository/RepositoryRef.java → src/main/org/apache/tools/ant/taskdefs/repository/RepositoryRef.java View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
* *
*/ */
package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;

+ 2
- 5
src/main/org/apache/tools/ant/taskdefs/repository/ScheduledUpdatePolicy.java View File

@@ -18,9 +18,6 @@ package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;
import org.apache.tools.ant.taskdefs.optional.repository.Library;
import org.apache.tools.ant.taskdefs.optional.repository.Repository;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;


import java.io.BufferedInputStream; import java.io.BufferedInputStream;
@@ -118,7 +115,7 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {


Repository repository=owner.getRepository(); Repository repository=owner.getRepository();
if(markerFile==null) { if(markerFile==null) {
@@ -161,7 +158,7 @@ public class ScheduledUpdatePolicy extends BaseLibraryPolicy {
* @param owner * @param owner
* @param libraries * @param libraries
*/ */
public void afterFetched(GetLibraries owner, ListIterator libraries) {
public void afterFetched(Libraries owner, ListIterator libraries) {


if(markerFileToSave!=null) { if(markerFileToSave!=null) {
//if we get here, we need to save the file //if we get here, we need to save the file


+ 1
- 3
src/main/org/apache/tools/ant/taskdefs/repository/TimestampPolicy.java View File

@@ -16,8 +16,6 @@
*/ */
package org.apache.tools.ant.taskdefs.repository; package org.apache.tools.ant.taskdefs.repository;


import org.apache.tools.ant.taskdefs.optional.repository.GetLibraries;

import java.util.ListIterator; import java.util.ListIterator;


/** /**
@@ -38,7 +36,7 @@ public class TimestampPolicy extends BaseLibraryPolicy {
* @throws org.apache.tools.ant.BuildException * @throws org.apache.tools.ant.BuildException
* if needed * if needed
*/ */
public boolean beforeConnect(GetLibraries owner, ListIterator libraries) {
public boolean beforeConnect(Libraries owner, ListIterator libraries) {
owner.markAllLibrariesForFetch(true); owner.markAllLibrariesForFetch(true);
owner._setUseTimestamp(true); owner._setUseTimestamp(true);
return true; return true;


+ 1
- 1
src/main/org/apache/tools/ant/types/defaults.properties View File

@@ -34,4 +34,4 @@ propertyset=org.apache.tools.ant.types.PropertySet
assertions=org.apache.tools.ant.types.Assertions assertions=org.apache.tools.ant.types.Assertions
concatfilter=org.apache.tools.ant.filters.ConcatFilter concatfilter=org.apache.tools.ant.filters.ConcatFilter
ispingable=org.apache.tools.ant.taskdefs.optional.condition.IsPingable ispingable=org.apache.tools.ant.taskdefs.optional.condition.IsPingable
mavenrepository=org.apache.tools.ant.taskdefs.optional.repository.MavenRepository
mavenrepository=org.apache.tools.ant.taskdefs.repository.MavenRepository

src/testcases/org/apache/tools/ant/taskdefs/optional/repository/GetLibrariesTest.java → src/testcases/org/apache/tools/ant/taskdefs/LibrariesTest.java View File

@@ -14,25 +14,26 @@
* limitations under the License. * limitations under the License.
* *
*/ */
package org.apache.tools.ant.taskdefs.optional.repository;
package org.apache.tools.ant.taskdefs;


import org.apache.tools.ant.BuildFileTest; import org.apache.tools.ant.BuildFileTest;
import org.apache.tools.ant.taskdefs.repository.AssertDownloaded; import org.apache.tools.ant.taskdefs.repository.AssertDownloaded;
import org.apache.tools.ant.taskdefs.repository.Libraries;


/** /**
* test the test libraries stuff. * test the test libraries stuff.
* skip all the tests if we are offline * skip all the tests if we are offline
*/ */
public class GetLibrariesTest extends BuildFileTest {
private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/";
public class LibrariesTest extends BuildFileTest {
private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/";




public GetLibrariesTest(String name) {
public LibrariesTest(String name) {
super(name); super(name);
} }


public void setUp() { public void setUp() {
configureProject(TASKDEFS_DIR + "getlibraries.xml");
configureProject(TASKDEFS_DIR + "libraries.xml");
} }




@@ -45,19 +46,19 @@ public class GetLibrariesTest extends BuildFileTest {
} }


public void testEmpty() { public void testEmpty() {
expectBuildException("testEmpty",GetLibraries.ERROR_NO_DEST_DIR);
expectBuildException("testEmpty",Libraries.ERROR_NO_DEST_DIR);
} }


public void testEmpty2() { public void testEmpty2() {
expectBuildException("testEmpty2", GetLibraries.ERROR_NO_REPOSITORY);
expectBuildException("testEmpty2", Libraries.ERROR_NO_REPOSITORY);
} }


public void testEmpty3() { public void testEmpty3() {
expectBuildException("testEmpty3", GetLibraries.ERROR_NO_LIBRARIES);
expectBuildException("testEmpty3", Libraries.ERROR_NO_LIBRARIES);
} }


public void testNoRepo() { public void testNoRepo() {
expectBuildException("testNoRepo", GetLibraries.ERROR_NO_REPOSITORY);
expectBuildException("testNoRepo", Libraries.ERROR_NO_REPOSITORY);
} }


public void testUnknownReference() { public void testUnknownReference() {
@@ -89,13 +90,13 @@ public class GetLibrariesTest extends BuildFileTest {


public void testTwoRepositories() { public void testTwoRepositories() {
expectBuildException("testTwoRepositories", expectBuildException("testTwoRepositories",
GetLibraries.ERROR_ONE_REPOSITORY_ONLY);
Libraries.ERROR_ONE_REPOSITORY_ONLY);
} }


public void testMavenInlineBadURL() { public void testMavenInlineBadURL() {
expectExceptionIfOnline("testMavenInlineBadURL", expectExceptionIfOnline("testMavenInlineBadURL",
"testMavenInlineBadURL", "testMavenInlineBadURL",
GetLibraries.ERROR_INCOMPLETE_RETRIEVAL);
Libraries.ERROR_INCOMPLETE_RETRIEVAL);
} }


/** /**
@@ -160,7 +161,7 @@ public class GetLibrariesTest extends BuildFileTest {
public void testNoUpdate() { public void testNoUpdate() {
expectExceptionIfOnline("testNoUpdate", expectExceptionIfOnline("testNoUpdate",
"update disabled; dest file missing", "update disabled; dest file missing",
GetLibraries.ERROR_INCOMPLETE_RETRIEVAL);
Libraries.ERROR_INCOMPLETE_RETRIEVAL);
} }


public void testTimestamp() { public void testTimestamp() {

Loading…
Cancel
Save