Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml (revision 1523006)
+++ lucene/common-build.xml (working copy)
@@ -1884,7 +1884,7 @@
     <sequential>
       <subant target="@{target}" failonerror="@{failonerror}" inheritall="false">
         <propertyset refid="uptodate.and.compiled.properties"/>
-        <fileset dir="." includes="*/build.xml" excludes="build/**,core/**,test-framework/**,tools/**"/>
+        <fileset dir="." includes="*/build.xml" excludes="build/**,core/**,test-framework/**"/>
       </subant>
     </sequential>
   </macrodef>
Index: lucene/tools/build.xml
===================================================================
--- lucene/tools/build.xml  (revision 1523006)
+++ lucene/tools/build.xml  (working copy)
@@ -28,6 +28,24 @@
 
   <path id="classpath">
   </path>
+  
+  <path id="test.classpath">
+    <pathelement location="${build.dir}/classes/java"/>
+    <pathelement location="${build.dir}/classes/test"/>
+    <pathelement location="${common.dir}/build/test-framework/classes/java"/>
+    <pathelement location="${common.dir}/build/core/classes/java"/>
+    <pathelement location="${common.dir}/build/codecs/classes/java"/>
+    
+    <path refid="junit-path"/>
+    <fileset dir="${common.dir}/test-framework/lib">
+      <include name="*.jar"/>
+      <exclude name="junit*.jar" />
+    </fileset>
+  </path>
+  
+  <path id="junit.classpath" refid="test.classpath"/>
+
+  <target name="build-artifacts-and-tests"/>
 
   <!--  
       Specialize compile-core to not depend on clover, to exclude a 
Index: lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java
===================================================================
--- lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java  (revision 0)
+++ lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java  (working copy)
@@ -0,0 +1,105 @@
+package org.apache.lucene.validation;
+
+import java.io.File;
+import java.io.FileFilter;
+
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.util.IdentityMapper;
+import org.junit.Test;
+
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TestLicenseCheckTask extends LuceneTestCase {
+
+  private static final String RESOURCES_DIR;  
+  static {
+    if (new File("../../../../tools/src/resources").exists()) {
+      RESOURCES_DIR = "../../../../tools/src/resources";
+    } else {
+      RESOURCES_DIR = "lucene/tools/src/resources";
+    }
+  }
+  
+  private Project p = new Project();
+  
+  @Test
+  public void testLicenseCheckTask() {
+    File resources = new File(RESOURCES_DIR);
+    File[] dirs = resources.listFiles(new FileFilter(){
+
+      @Override
+      public boolean accept(File pathname) {
+        return pathname.getName().startsWith("good_") || pathname.getName().startsWith("bad_");
+      }});
+    for (File dir : dirs) {
+      if (dir.getName().startsWith("good_")) {
+        testShouldPass(dir.getName());
+      } else {
+        testShouldFail(dir.getName());
+      }
+    }
+
+  }
+
+  private void testShouldFail(String licenseDir) {
+    LicenseCheckTask lct = getLct();
+    lct.setLicenseDirectory(new File(RESOURCES_DIR, licenseDir));
+    FileSet fileSet = getFileSet(lct);
+    fileSet.setDir(new File(RESOURCES_DIR, licenseDir));
+    try {
+      lct.execute();
+      fail("This should fail: " + licenseDir);
+    } catch (BuildException e) {
+      
+    }
+  }
+  
+  private FileSet getFileSet(LicenseCheckTask lct) {
+    FileSet fileSet = new FileSet();
+    fileSet.setProject(p);
+    fileSet.setCaseSensitive(false);
+    fileSet.setIncludes("**/*.jar");
+    fileSet.setExcludes("");
+    lct.add(fileSet);
+    return fileSet;
+  }
+
+  private void testShouldPass(String licenseDir) {
+    LicenseCheckTask lct = getLct();
+    lct.setLicenseDirectory(new File(RESOURCES_DIR, licenseDir));
+    FileSet fileSet = getFileSet(lct);
+    fileSet.setDir(new File(RESOURCES_DIR, licenseDir));
+    lct.execute();
+  }
+  
+  public LicenseCheckTask getLct() {
+    LicenseCheckTask lct = new LicenseCheckTask();
+    p.setName("LicenseChecker");
+    Mapper mapper = new Mapper(p);
+    mapper.add(new IdentityMapper() );
+    lct.addConfiguredLicenseMapper(mapper);
+
+    // lct.setVerbose(true);
+    return lct;
+  }
+}
Index: lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java
===================================================================
--- lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java  (revision 0)
+++ lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java  (working copy)

Property changes on: lucene/tools/src/test/org/apache/lucene/validation/TestLicenseCheckTask.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_just_jar/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/bad_just_jar/test.jar
===================================================================
--- lucene/tools/src/resources/bad_just_jar/test.jar  (revision 0)
+++ lucene/tools/src/resources/bad_just_jar/test.jar  (working copy)

Property changes on: lucene/tools/src/resources/bad_just_jar/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar
===================================================================
--- lucene/tools/src/resources/bad_wrong_checksum/test.jar  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_checksum/test.jar  (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_checksum/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar-LICENSE-ASL.txt
===================================================================
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar-LICENSE-ASL.txt
===================================================================
--- lucene/tools/src/resources/bad_wrong_checksum/test.jar-LICENSE-ASL.txt  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_checksum/test.jar-LICENSE-ASL.txt  (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_checksum/test.jar-LICENSE-ASL.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar-NOTICE.txt
===================================================================
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar-NOTICE.txt
===================================================================
--- lucene/tools/src/resources/bad_wrong_checksum/test.jar-NOTICE.txt (revision 0)
+++ lucene/tools/src/resources/bad_wrong_checksum/test.jar-NOTICE.txt (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_checksum/test.jar-NOTICE.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1 (working copy)
@@ -0,0 +1 @@
+da39a3ee5e6b4b0d3255bfef95666690afd80709
\ No newline at end of file
Index: lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1 (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_checksum/test.jar.sha1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_wrong_license/test.jar-NOTICE.txt
===================================================================
Index: lucene/tools/src/resources/bad_wrong_license/test.jar-NOTICE.txt
===================================================================
--- lucene/tools/src/resources/bad_wrong_license/test.jar-NOTICE.txt  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_license/test.jar-NOTICE.txt  (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_license/test.jar-NOTICE.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_wrong_license/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/bad_wrong_license/test.jar
===================================================================
--- lucene/tools/src/resources/bad_wrong_license/test.jar (revision 0)
+++ lucene/tools/src/resources/bad_wrong_license/test.jar (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_license/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/bad_wrong_license/test.jar-LICENSE-MSPL.txt
===================================================================
Index: lucene/tools/src/resources/bad_wrong_license/test.jar-LICENSE-MSPL.txt
===================================================================
--- lucene/tools/src/resources/bad_wrong_license/test.jar-LICENSE-MSPL.txt  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_license/test.jar-LICENSE-MSPL.txt  (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_license/test.jar-LICENSE-MSPL.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_wrong_license/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_wrong_license/test.jar.sha1  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_license/test.jar.sha1  (working copy)
@@ -0,0 +1 @@
+da39a3ee5e6b4b0d3255bfef95601890afd80709
\ No newline at end of file
Index: lucene/tools/src/resources/bad_wrong_license/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_wrong_license/test.jar.sha1  (revision 0)
+++ lucene/tools/src/resources/bad_wrong_license/test.jar.sha1  (working copy)

Property changes on: lucene/tools/src/resources/bad_wrong_license/test.jar.sha1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_no_license/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_no_license/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/bad_no_license/test.jar.sha1 (working copy)
@@ -0,0 +1 @@
+da39a3ee5e6b4b0d3255bfef95601890afd80709
\ No newline at end of file
Index: lucene/tools/src/resources/bad_no_license/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_no_license/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/bad_no_license/test.jar.sha1 (working copy)

Property changes on: lucene/tools/src/resources/bad_no_license/test.jar.sha1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_no_license/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/bad_no_license/test.jar
===================================================================
--- lucene/tools/src/resources/bad_no_license/test.jar  (revision 0)
+++ lucene/tools/src/resources/bad_no_license/test.jar  (working copy)

Property changes on: lucene/tools/src/resources/bad_no_license/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar-LICENSE-ASL.txt
===================================================================
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar-LICENSE-ASL.txt
===================================================================
--- lucene/tools/src/resources/bad_asl_no_notice/test.jar-LICENSE-ASL.txt (revision 0)
+++ lucene/tools/src/resources/bad_asl_no_notice/test.jar-LICENSE-ASL.txt (working copy)

Property changes on: lucene/tools/src/resources/bad_asl_no_notice/test.jar-LICENSE-ASL.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1  (revision 0)
+++ lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1  (working copy)
@@ -0,0 +1 @@
+da39a3ee5e6b4b0d3255bfef95601890afd80709
\ No newline at end of file
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1  (revision 0)
+++ lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1  (working copy)

Property changes on: lucene/tools/src/resources/bad_asl_no_notice/test.jar.sha1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/bad_asl_no_notice/test.jar
===================================================================
--- lucene/tools/src/resources/bad_asl_no_notice/test.jar (revision 0)
+++ lucene/tools/src/resources/bad_asl_no_notice/test.jar (working copy)

Property changes on: lucene/tools/src/resources/bad_asl_no_notice/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/good_asl/test.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: lucene/tools/src/resources/good_asl/test.jar
===================================================================
--- lucene/tools/src/resources/good_asl/test.jar  (revision 0)
+++ lucene/tools/src/resources/good_asl/test.jar  (working copy)

Property changes on: lucene/tools/src/resources/good_asl/test.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
Index: lucene/tools/src/resources/good_asl/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/good_asl/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/good_asl/test.jar.sha1 (working copy)
@@ -0,0 +1 @@
+da39a3ee5e6b4b0d3255bfef95601890afd80709
\ No newline at end of file
Index: lucene/tools/src/resources/good_asl/test.jar.sha1
===================================================================
--- lucene/tools/src/resources/good_asl/test.jar.sha1 (revision 0)
+++ lucene/tools/src/resources/good_asl/test.jar.sha1 (working copy)

Property changes on: lucene/tools/src/resources/good_asl/test.jar.sha1
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/good_asl/test.jar-LICENSE-ASL.txt
===================================================================
Index: lucene/tools/src/resources/good_asl/test.jar-LICENSE-ASL.txt
===================================================================
--- lucene/tools/src/resources/good_asl/test.jar-LICENSE-ASL.txt  (revision 0)
+++ lucene/tools/src/resources/good_asl/test.jar-LICENSE-ASL.txt  (working copy)

Property changes on: lucene/tools/src/resources/good_asl/test.jar-LICENSE-ASL.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: lucene/tools/src/resources/good_asl/test.jar-NOTICE.txt
===================================================================
Index: lucene/tools/src/resources/good_asl/test.jar-NOTICE.txt
===================================================================
--- lucene/tools/src/resources/good_asl/test.jar-NOTICE.txt (revision 0)
+++ lucene/tools/src/resources/good_asl/test.jar-NOTICE.txt (working copy)

Property changes on: lucene/tools/src/resources/good_asl/test.jar-NOTICE.txt
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
Index: solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java
===================================================================
--- solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java  (revision 1523006)
+++ solr/core/src/test/org/apache/solr/cloud/AliasIntegrationTest.java  (working copy)
@@ -87,13 +87,8 @@
 
     del("*:*");
     
-    createCollection("collection2", 2, 1, 10);
-    
-    List<Integer> numShardsNumReplicaList = new ArrayList<Integer>(2);
-    numShardsNumReplicaList.add(2);
-    numShardsNumReplicaList.add(1);
-    checkForCollection("collection2", numShardsNumReplicaList, null);
-    waitForRecoveriesToFinish("collection2", true);
+    createCollection("collection2");
+    createCollection("collection3");
     
     cloudClient.setDefaultCollection("collection1");
     
@@ -187,6 +182,12 @@
     res = cloudClient.query(query);
     assertEquals(2, res.getResults().getNumFound());
     
+    createAlias("testalias", "collection1");
+    query = new SolrQuery("*:*");
+    query.set("collection", "testalias");
+    res = cloudClient.query(query);
+    assertEquals(3, res.getResults().getNumFound());
+    
     // set alias to two collections
     createAlias("testalias", "collection1,collection2");
     //checkForAlias("testalias", "collection1,collection2");
@@ -235,6 +236,17 @@
     assertTrue(sawException);
   }
 
+  private void createCollection(String name) throws SolrServerException, IOException,
+      Exception {
+    createCollection(name, 2, 1, 10);
+    
+    List<Integer> numShardsNumReplicaList = new ArrayList<Integer>(2);
+    numShardsNumReplicaList.add(2);
+    numShardsNumReplicaList.add(1);
+    checkForCollection(name, numShardsNumReplicaList, null);
+    waitForRecoveriesToFinish(name, true);
+  }
+
   private void createAlias(String alias, String collections) throws SolrServerException, IOException {
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.set("collections", collections);
Index: build.xml
===================================================================
--- build.xml (revision 1523006)
+++ build.xml (working copy)
@@ -205,7 +205,7 @@
     </copy>
     
     <pathconvert property="eclipse.fileset.sourcefolders" pathsep="|" dirsep="/">
-      <dirset dir="${basedir}/lucene" includes="**/src/java, **/src/resources, **/src/test, **/src/test-files, **/src/examples" excludes="tools/**, build/**, backwards/**" />
+      <dirset dir="${basedir}/lucene" includes="**/src/java, **/src/resources, **/src/test, **/src/test-files, **/src/examples" excludes="build/**, backwards/**" />
       <dirset dir="${basedir}/solr" includes="**/src/java, **/src/resources, **/src/test, **/src/test-files, **/src/examples" excludes="build/**" />
       <map from="${basedir}/" to=""/>
     </pathconvert>
