本文整理汇总了Java中org.apache.tools.ant.types.Path.addFileset方法的典型用法代码示例。如果您正苦于以下问题:Java Path.addFileset方法的具体用法?Java Path.addFileset怎么用?Java Path.addFileset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.types.Path
的用法示例。
在下文中一共展示了Path.addFileset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPathsOneFile
import org.apache.tools.ant.types.Path; //导入方法依赖的package包/类
@Test
public final void testPathsOneFile() throws IOException {
// given
TestRootModuleChecker.reset();
final CheckstyleAntTask antTask = getCheckstyleAntTask(CUSTOM_ROOT_CONFIG_FILE);
final FileSet examinationFileSet = new FileSet();
examinationFileSet.setFile(new File(getPath(FLAWLESS_INPUT)));
final Path sourcePath = new Path(antTask.getProject());
sourcePath.addFileset(examinationFileSet);
antTask.addPath(sourcePath);
// when
antTask.execute();
// then
assertTrue("Checker is not processed",
TestRootModuleChecker.isProcessed());
final List<File> filesToCheck = TestRootModuleChecker.getFilesToCheck();
assertThat("There more files to check then expected",
filesToCheck.size(), is(1));
assertThat("The path of file differs from expected",
filesToCheck.get(0).getAbsolutePath(), is(getPath(FLAWLESS_INPUT)));
}
示例2: runSim
import org.apache.tools.ant.types.Path; //导入方法依赖的package包/类
public void runSim( Locale locale, String simulationName ) {
Java java = new Java();
java.setClassname( getSimulation( simulationName ).getMainclass() );
java.setFork( true );
String args = "-dev";
String[] a = getSimulation( simulationName ).getArgs();
for ( int i = 0; i < a.length; i++ ) {
String s = a[i];
args += " " + s;
}
java.setArgs( args );
org.apache.tools.ant.Project project = new org.apache.tools.ant.Project();
project.init();
Path classpath = new Path( project );
FileSet set = new FileSet();
set.setFile( getDefaultDeployJar() );
classpath.addFileset( set );
java.setClasspath( classpath );
String language = locale.getLanguage();
if ( !language.equals( "en" ) ) {
java.setJvmargs( "-D" + PhetCommonConstants.PROPERTY_PHET_LANGUAGE + "=" + language );
java.setJvmargs( "-Djavaws.phet.locale=" + language ); //XXX #1057, backward compatibility, delete after IOM
}
File file = new File( getTrunk(), BuildToolsPaths.BUILD_TOOLS_DIR + "/test-output.txt" );
java.setOutput( file );
System.out.println( "Launching task, output will be printed after finish." );
new MyAntTaskRunner().runTask( java );
try {
String text = FileUtils.loadFileAsString( file );
System.out.println( "Process finished:\n" + text );
}
catch ( IOException e ) {
e.printStackTrace();
}
}