當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSet.setFile方法代碼示例

本文整理匯總了Java中org.apache.tools.ant.types.FileSet.setFile方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSet.setFile方法的具體用法?Java FileSet.setFile怎麽用?Java FileSet.setFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.tools.ant.types.FileSet的用法示例。


在下文中一共展示了FileSet.setFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testPathsOneFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的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)));
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:25,代碼來源:CheckstyleAntTaskTest.java

示例2: testFileSet

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public final void testFileSet() throws IOException {
    TestRootModuleChecker.reset();
    final CheckstyleAntTask antTask = getCheckstyleAntTask(CUSTOM_ROOT_CONFIG_FILE);
    final FileSet examinationFileSet = new FileSet();
    examinationFileSet.setFile(new File(getPath(FLAWLESS_INPUT)));
    antTask.addFileset(examinationFileSet);
    antTask.execute();

    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)));
}
 
開發者ID:rnveach,項目名稱:checkstyle-backport-jre6,代碼行數:18,代碼來源:CheckstyleAntTaskTest.java

示例3: testExecuteSingleFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testExecuteSingleFile() throws FileNotFoundException,
        IOException {
    UploadFileSetToS3Task task = new UploadFileSetToS3Task();
    task.setProject(new Project());
    FileSet fileset = new FileSet();
    fileset.setDir(testFile1.getParentFile());
    fileset.setFile(testFile1);
    task.addFileset(fileset);
    task.setBucketName(BUCKET_NAME);
    task.setKeyPrefix(KEY_PREFIX);
    task.execute();
    resFile1 = File.createTempFile(RES_FILE_1, TESTFILE_SUFFIX);
    client.getObject(new GetObjectRequest(BUCKET_NAME, KEY_PREFIX
            + fileName1), resFile1);
    assertTrue(FileUtils.contentEquals(testFile1, resFile1));
}
 
開發者ID:awslabs,項目名稱:aws-ant-tasks,代碼行數:18,代碼來源:UploadFileSetToS3TaskTests.java

示例4: downloadBinaries

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void downloadBinaries(boolean clean) {
    DownloadBinaries task = new DownloadBinaries();
    task.setProject(new Project());
    task.setCache(cache);
    task.setClean(clean);
    task.setServer(server.toURI().toString());
    FileSet manifest = new FileSet();
    manifest.setFile(list);
    task.addManifest(manifest);
    task.execute();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:DownloadBinariesTest.java

示例5: testBuildCob2XsdWithAppendBaseFileNameOption

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Generate an ant script with append base file name option and run it to
 * produce an XML Schema.
 * 
 * @throws Exception if ant cannot be generated
 */
public void testBuildCob2XsdWithAppendBaseFileNameOption() throws Exception {

    final Project project = new Project();
    project.addBuildListener(new TestLogger());
    project.setCoreLoader(this.getClass().getClassLoader());
    project.init();
    Cob2XsdTask task = new Cob2XsdTask();
    task.setProject(project);
    FileSet fileset = task.createFileset();
    fileset.setProject(project);
    fileset.setFile(new File(COBOL_SAMPLES_DIR + "/LSFILEAE"));
    File targetXsdFile = new File(GEN_XSD_DIR, "lsfileae.xsd");
    task.setTarget(targetXsdFile);
    task.setTargetNamespace("http://legstar.com/test/coxb");
    task.setAppendBaseFileNameToNamespace(true);
    task.setAddLegStarAnnotations(true);
    /* Backward compatibility */
    task.setElementNamesStartWithUppercase(true);
    task.setQuoteIsQuote(false);

    task.execute();

    Document result = getXMLSchemaAsDoc(targetXsdFile);
    Document expected = getXMLSchemaAsDoc(new File(XSD_SAMPLES_DIR,
            "LSFILEAE.xsd"));
    compare(targetXsdFile.getName(), expected, result);
}
 
開發者ID:legsem,項目名稱:legstar-cob2xsd,代碼行數:34,代碼來源:Cob2XsdTaskTest.java

示例6: createFileSetForJarFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private FileSet createFileSetForJarFile(File jarFile, Project prj)
{
    FileSet fileSet = new FileSet();
    fileSet.setProject(prj);
    fileSet.setFile(jarFile);
    return fileSet;
}
 
開發者ID:HuaweiBigData,項目名稱:StreamCQL,代碼行數:8,代碼來源:JarExpander.java

示例7: createUnifiedSources

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * clone our filesets vector, and patch in the jar attribute as a new
 * fileset, if is defined
 * @return a vector of FileSet instances
 */
protected Vector<FileSet> createUnifiedSources() {
    Vector<FileSet> sources = new Vector<>(filesets);
    if (jar != null) {
        //we create a fileset with the source file.
        //this lets us combine our logic for handling output directories,
        //mapping etc.
        FileSet sourceJar = new FileSet();
        sourceJar.setProject(getProject());
        sourceJar.setFile(jar);
        sources.add(sourceJar);
    }
    return sources;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:19,代碼來源:AbstractJarSignerTask.java

示例8: toFileSetFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
protected FileSet toFileSetFile( File file ) {
    FileSet fileSet = new FileSet();
    fileSet.setFile( file );
    return fileSet;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:6,代碼來源:JavaBuildCommand.java

示例9: runSim

import org.apache.tools.ant.types.FileSet; //導入方法依賴的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();
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:42,代碼來源:JavaProject.java

示例10: addBuildFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
private void addBuildFile(Path path, File buildFile) {
    FileSet fs = new FileSet();
    fs.setFile(buildFile);
    path.addFileset(fs);
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:6,代碼來源:IvyBuildList.java

示例11: setFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * Set the file which should have its access attributes modified.
 * @param src the file to modify
 */
public void setFile(File src) {
    FileSet fs = new FileSet();
    fs.setFile(src);
    addFileset(fs);
}
 
開發者ID:apache,項目名稱:ant,代碼行數:10,代碼來源:AbstractAccessTask.java

示例12: setFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * A file to be attribed.
 * @param src a file
 */
public void setFile(File src) {
    FileSet fs = new FileSet();
    fs.setFile(src);
    addFileset(fs);
}
 
開發者ID:apache,項目名稱:ant,代碼行數:10,代碼來源:Attrib.java

示例13: setFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
 * The file or single directory of which the permissions must be changed.
 * @param src the source file or directory.
 */
public void setFile(File src) {
    FileSet fs = new FileSet();
    fs.setFile(src);
    addFileset(fs);
}
 
開發者ID:apache,項目名稱:ant,代碼行數:10,代碼來源:Chmod.java

示例14: testFrames

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Test
public void testFrames() throws Exception {
    // For now, skip this test on JDK 6 (and below); see below for why:
    try {
        Class.forName("java.nio.file.Files");
    } catch (ClassNotFoundException x) {
        Assume.assumeNoException("Skip test on JDK 6 and below", x);
    }
    final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
    if (d.exists()) {
        new Delete() {
            { removeDir(d); }
        }; // is there no utility method for this?
    }
    assertTrue(d.getAbsolutePath(), d.mkdir());
    File xml = new File(d, "x.xml");
    PrintWriter pw = new PrintWriter(new FileOutputStream(xml));
    try {
        pw.println("<testsuite errors='0' failures='0' name='my.UnitTest' tests='1'>");
        pw.println(" <testcase classname='my.UnitTest' name='testSomething'/>");
        pw.println("</testsuite>");
        pw.flush();
    } finally {
        pw.close();
    }
    XMLResultAggregator task = new XMLResultAggregator();
    task.setTodir(d);
    Project project = new Project();
    DefaultLogger logger = new DefaultLogger();
    logger.setOutputPrintStream(System.out);
    logger.setErrorPrintStream(System.err);
    logger.setMessageOutputLevel(Project.MSG_INFO);
    project.addBuildListener(logger);
    project.init();
    task.setProject(project);
    AggregateTransformer report = task.createReport();
    report.setTodir(d);
    FileSet fs = new FileSet();
    fs.setFile(xml);
    task.addFileSet(fs);
    /* getResourceAsStream override unnecessary on JDK 7.
     * Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
    Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
        public InputStream getResourceAsStream(String name) {
            if (name.startsWith("META-INF/services/")) {
                return new ByteArrayInputStream(new byte[0]);
            }
            return super.getResourceAsStream(name);
        }
    });
    */
    // Use the JRE's Xerces, not lib/optional/xerces.jar:
    Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
    // Tickle #51668:
    System.setSecurityManager(new SecurityManager() {
        public void checkPermission(Permission perm) {
        }
    });
    task.execute();
    assertTrue(new File(d, "index.html").isFile());
}
 
開發者ID:apache,項目名稱:ant,代碼行數:62,代碼來源:XMLResultAggregatorTest.java

示例15: setFile

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public void setFile(final String fileName) throws FileNotFoundException {
    FileSet f = new FileSet();
    f.setFile(launcher.resolveFile(null, fileName));
    filesets.add(f);
}
 
開發者ID:scriptella,項目名稱:scriptella-etl,代碼行數:6,代碼來源:EtlExecuteTask.java


注:本文中的org.apache.tools.ant.types.FileSet.setFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。