Skip to content

Commit

Permalink
LPS-40833 Use propertyregex, and move things around
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchandotcom committed Oct 2, 2013
1 parent 0eea9a1 commit a01ef0e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 58 deletions.
8 changes: 7 additions & 1 deletion build-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,13 @@ Please set the environment variable ANT_OPTS to the recommended value of
</then>
</if>

<propertyregex property="test.class" input="${test.package}." regexp="\." replace="/" global="true" />
<propertyregex
global="true"
input="${test.package}."
property="test.class"
regexp="\."
replace="/"
/>

<ant target="test-class">
<property name="test.class" value="${test.class}**/*Test" />
Expand Down
63 changes: 56 additions & 7 deletions build-test-tck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,55 @@
work.dir=${basedir.unix}/tools/tck/work</echo>
</target>

<target name="record-test-tck-packages">
<ant antfile="build-test-tck.xml" target="prepare-tck-286" />

<script classpathref="project.classpath" language="beanshell">
import com.liferay.portal.kernel.util.OSDetector;
import com.liferay.portal.kernel.util.StringUtil;

import org.apache.tools.ant.DirectoryScanner;

DirectoryScanner directoryScanner = new DirectoryScanner();

directoryScanner.setBasedir(project.getBaseDir());
directoryScanner.setIncludes(new String[] {"**/com/sun/ts/tests/**/*.war"});

directoryScanner.scan();

String[] fileNames = directoryScanner.getIncludedFiles();

Arrays.sort(fileNames);

Set packageNames = new TreeSet();

for (String fileName : fileNames) {
int x = fileName.indexOf("com/");
int y = fileName.lastIndexOf("/");

if (OSDetector.isWindows()) {
x = fileName.indexOf("com\\");
y = fileName.lastIndexOf("\\");
}

String packageName = fileName.substring(x, y);

if (packageName.endsWith("PortletSessionSecondapp")) {
continue;
}

packageName = StringUtil.replace(packageName, "/", ".");
packageName = StringUtil.replace(packageName, "\\", ".");

packageNames.add(packageName);
}

project.setProperty("test.tck.packages", StringUtil.merge(packageNames, " "));
</script>

<echo file="test-tck-packages">${test.tck.packages}</echo>
</target>

<target name="run-tck-286-tomcat">
<antcall target="prepare-portal-ext-properties">
<param name="tck.url" value="true" />
Expand Down Expand Up @@ -61,13 +110,13 @@ work.dir=${basedir.unix}/tools/tck/work</echo>
</then>
</if>

<script classpathref="project.classpath" language="beanshell">
import com.liferay.portal.kernel.util.StringUtil;

String testPackage = project.getProperty("test.package");

project.setProperty("test.directory", StringUtil.replace(testPackage, ".", "/"));
</script>
<propertyregex
global="true"
input="${test.package}."
property="test.directory"
regexp="\."
replace="/"
/>

<copy todir="${user.home}/liferay/deploy" flatten="true">
<fileset
Expand Down
57 changes: 7 additions & 50 deletions build-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2463,55 +2463,6 @@ custom.sql.function.isnotnull=CONVERT(VARCHAR,?) IS NOT NULL</echo>
<echo file="test-packages">${test.packages}</echo>
</target>

<target name="record-test-tck-packages">
<ant antfile="build-test-tck.xml" target="prepare-tck-286" />

<script classpathref="project.classpath" language="beanshell">
import com.liferay.portal.kernel.util.OSDetector;
import com.liferay.portal.kernel.util.StringUtil;

import org.apache.tools.ant.DirectoryScanner;

DirectoryScanner directoryScanner = new DirectoryScanner();

directoryScanner.setBasedir(project.getBaseDir());
directoryScanner.setIncludes(new String[] {"**/com/sun/ts/tests/**/*.war"});

directoryScanner.scan();

String[] fileNames = directoryScanner.getIncludedFiles();

Arrays.sort(fileNames);

Set packageNames = new TreeSet();

for (String fileName : fileNames) {
int x = fileName.indexOf("com/");
int y = fileName.lastIndexOf("/");

if (OSDetector.isWindows()) {
x = fileName.indexOf("com\\");
y = fileName.lastIndexOf("\\");
}

String packageName = fileName.substring(x, y);

if (packageName.endsWith("PortletSessionSecondapp")) {
continue;
}

packageName = StringUtil.replace(packageName, "/", ".");
packageName = StringUtil.replace(packageName, "\\", ".");

packageNames.add(packageName);
}

project.setProperty("test.tck.packages", StringUtil.merge(packageNames, " "));
</script>

<echo file="test-tck-packages">${test.tck.packages}</echo>
</target>

<target name="replace-remote-file">
<tstamp>
<format property="tstamp.value" pattern="yyyyMMddkkmmssSSS" />
Expand Down Expand Up @@ -3110,7 +3061,13 @@ Please set "ie.driver.zip" in test.properties to point to "IEDriverServer_x64_2.
</target>

<target name="test-package">
<propertyregex property="test.class" input="${test.package}." regexp="\." replace="/" global="true" />
<propertyregex
global="true"
input="${test.package}."
property="test.class"
regexp="\."
replace="/"
/>

<resourcecount property="test.portal-impl.count">
<fileset dir="portal-impl/test" includes="**/${test.class}**/*Test.java" />
Expand Down

0 comments on commit a01ef0e

Please sign in to comment.