Example usage for java.io FilenameFilter FilenameFilter

List of usage examples for java.io FilenameFilter FilenameFilter

Introduction

In this page you can find the example usage for java.io FilenameFilter FilenameFilter.

Prototype

FilenameFilter

Source Link

Usage

From source file:com.flexive.tests.embedded.persistence.BinaryTest.java

private void binaryTest(boolean sendLength, boolean transitFS, long binThreshold, long prevThreshold)
        throws Exception {
    File testFile = new File(TEST_BINARY);
    if (!testFile.exists())
        Assert.fail("Test binary [" + testFile.getAbsolutePath() + "] not found!");

    EJBLookup.getConfigurationEngine().put(SystemParameters.BINARY_TRANSIT_DB, !transitFS);
    EJBLookup.getConfigurationEngine().put(SystemParameters.BINARY_DB_THRESHOLD, binThreshold);
    EJBLookup.getConfigurationEngine().put(SystemParameters.BINARY_DB_PREVIEW_THRESHOLD, prevThreshold);

    FxType type = CacheAdmin.getEnvironment().getType(IMAGE_TYPE);

    FileInputStream fis = new FileInputStream(testFile);
    BinaryDescriptor binary;/*from ww w.  j a v  a2 s .  c o  m*/
    if (sendLength)
        binary = new BinaryDescriptor(testFile.getName(), testFile.length(), fis);
    else
        binary = new BinaryDescriptor(testFile.getName(), fis);

    FxContent img = co.initialize(type.getId());
    img.setValue("/File", new FxBinary(false, binary));
    img.setValue("/Filename", new FxString(false, "Exif.JPG"));
    FxPK pk = null;
    try {
        if (transitFS) {
            //perform an optional prepareSave to be able to retrieve the transit handle
            img = co.prepareSave(img);
            final String handle = ((BinaryDescriptor) img.getValue("/File").getBestTranslation()).getHandle();
            File transStore = new File(
                    FxBinaryUtils.getTransitDirectory() + File.separatorChar + String.valueOf(divisionId));
            Assert.assertTrue(transStore.exists() && transStore.isDirectory(),
                    "transit directory [" + transStore.getAbsolutePath() + "] does not exist!");
            File[] found = transStore.listFiles(new FilenameFilter() {
                @Override
                public boolean accept(File dir, String name) {
                    return name.startsWith(handle + "__");
                }
            });
            Assert.assertTrue(found != null && found.length == 1 && found[0].exists(),
                    "Transit file not found!");
            Assert.assertTrue(FxFileUtils.fileCompare(testFile, found[0]),
                    "Transit file does not match test file!");
        }
        pk = co.save(img);

        FxContent loaded = co.load(pk);
        FxBinary bin = (FxBinary) loaded.getValue("/File");
        File comp = File.createTempFile("Exif", "JPG");
        FileOutputStream fos = new FileOutputStream(comp);
        bin.getBestTranslation().download(fos);
        fos.close();
        Assert.assertTrue(FxFileUtils.fileCompare(comp, testFile), "Files do not match!");
        final BinaryDescriptor desc = ((BinaryDescriptor) img.getValue("/File").getBestTranslation());
        if (binThreshold > testFile.length()) {
            //binary is expected to be stored on the filesystem
            File binFile = FxBinaryUtils.getBinaryFile(divisionId, desc.getId(), desc.getVersion(),
                    desc.getQuality(), PreviewSizes.ORIGINAL.getBlobIndex());
            Assert.assertTrue(binFile != null && binFile.exists(),
                    "Binary file for binary id [" + desc.getId() + "] does not exist!");
            Assert.assertTrue(FxFileUtils.fileCompare(testFile, binFile),
                    "Binary file does not match test file!");
        }
        if (prevThreshold >= 0) {
            checkPreviewFile(prevThreshold, desc, bin, PreviewSizes.PREVIEW1);
            checkPreviewFile(prevThreshold, desc, bin, PreviewSizes.PREVIEW2);
            checkPreviewFile(prevThreshold, desc, bin, PreviewSizes.PREVIEW3);
        }

        InputStream is = FxStreamUtils.getBinaryStream(desc, PreviewSizes.ORIGINAL);
        File tmp = File.createTempFile("testTmpIS", "");
        FxFileUtils.copyStream2File(desc.getSize(), is, tmp);
        Assert.assertTrue(FxFileUtils.fileCompare(comp, tmp), "Files do not match!");
        FxFileUtils.removeFile(tmp);
        FxFileUtils.removeFile(comp);
        //create a new version and remove the first
        FxPK pkV2 = co.createNewVersion(loaded);
        co.removeVersion(pkV2);
    } catch (Exception e) {
        LOG.error(e);
        e.printStackTrace();
    } finally {
        if (pk != null)
            co.remove(pk);
    }
}

From source file:io.fabric8.maven.core.util.KubernetesResourceUtil.java

public static File[] listResourceFragments(File resourceDir) {
    final Pattern filenamePattern = Pattern.compile(FILENAME_PATTERN);
    final Pattern exludePattern = Pattern.compile(PROFILES_PATTERN);
    return resourceDir.listFiles(new FilenameFilter() {
        @Override//from  w  ww . j  a v a 2s. c o m
        public boolean accept(File dir, String name) {
            return filenamePattern.matcher(name).matches() && !exludePattern.matcher(name).matches();
        }
    });
}

From source file:de.freese.base.swing.mac_os_x.MyApp.java

/**
 * @see//from  w  w  w.  ja  v  a  2  s .c  o  m
 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
@Override
public void actionPerformed(final ActionEvent e) {
    Object source = e.getSource();

    if (source == this.quitMI) {
        quit();
    } else {
        if (source == this.optionsMI) {
            preferences();
        } else {
            if (source == this.aboutMI) {
                about();
            } else {
                if (source == this.openMI) {
                    // File:Open action shows a FileDialog for loading displayable images
                    FileDialog openDialog = new FileDialog(this);
                    openDialog.setMode(FileDialog.LOAD);
                    openDialog.setFilenameFilter(new FilenameFilter() {
                        /**
                         * @see java.io.FilenameFilter#accept(java.io.File,
                         * java.lang.String)
                         */
                        @Override
                        public boolean accept(final File dir, final String name) {
                            String[] supportedFiles = ImageIO.getReaderFormatNames();

                            for (String supportedFile : supportedFiles) {
                                if (name.endsWith(supportedFile)) {
                                    return true;
                                }
                            }

                            return false;
                        }
                    });

                    openDialog.setVisible(true);
                    String filePath = openDialog.getDirectory() + openDialog.getFile();

                    if (filePath.length() > 0) {
                        loadImageFile(filePath);
                    }
                }
            }
        }
    }
}

From source file:it.geosolutions.geobatch.figis.intersection.Utilities.java

/*****
 * This method takes a wfs url, download the layername features, save it in
 * the figisTmpDir directory and return its SimpleFEatureCollection
 *
 * @param textUrl//  www .  j a v  a  2s . c om
 * @param filename
 * @param destDir
 * @throws IOException
 * @throws MalformedURLException
 */
static String getShapeFileFromURLbyZIP(String textUrl, String figisTmpDir, String layername)
        throws MalformedURLException, IOException {
    // init the folder name where to save and uncompress the zip file
    String destDir = figisTmpDir + "/" + layername;

    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Destination dir " + destDir);
    }

    File finalDestDir = new File(destDir);

    if (!finalDestDir.exists()) // check if the temp dir exist, if not:
                                // create it, download the zip and
                                // uncompress the files
    {
        finalDestDir.mkdir();
        try {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("downloading from : " + textUrl);
            }
            saveZipToLocal(textUrl, destDir, layername);
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("download completed successfully");
            }
        } catch (Exception e) {
            LOGGER.error("Error downloading the zip file", e);
            throw new IOException("Error downloading the zip file", e);
        }
        try {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Extracting the zip file " + destDir + "/" + layername + ".zip");
            }
            Extract.extract(destDir + "/" + layername + ".zip");
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Extraction completed successfully");
            }
        } catch (Exception e) {
            // some exception during the file extraction, return a null
            // value
            LOGGER.error("Error extracting the zip file", e);
            throw new IOException("Error extracting the zip file", e);
        }
        // extractZipFile(destDir, layername);
    }

    // return the simple feature collection from the uncompressed shp file
    // name
    String shpfilename = figisTmpDir + "/" + layername + "/" + layername + "/" + layername + ".shp";
    File shpFile = new File(shpfilename);
    if (shpFile.exists() && shpFile.canRead() && shpFile.isFile()) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Shpfilename: " + shpfilename);
        }
        return shpfilename;
    } else {
        File shpFileDir = new File(figisTmpDir + "/" + layername + "/" + layername);
        if (shpFileDir.exists() && shpFileDir.isDirectory()) {
            File[] shpFiles = shpFileDir.listFiles(new FilenameFilter() {

                public boolean accept(File dir, String name) {
                    if (FilenameUtils.getExtension(name).equalsIgnoreCase("shp"))
                        return true;
                    return false;
                }
            });

            if (shpFiles != null && shpFiles.length == 1) {
                if (LOGGER.isTraceEnabled()) {
                    LOGGER.trace("Shpfilename: " + shpfilename);
                }
                return shpFiles[0].getAbsolutePath();
            } else {
                LOGGER.error("Could not download shapefile from GeoServer");
                throw new IOException("Could not download shapefile from GeoServer");
            }
        } else {
            LOGGER.error("Could not download shapefile from GeoServer");
            throw new IOException("Could not download shapefile from GeoServer");
        }
    }
}

From source file:de.mprengemann.intellij.plugin.androidicons.forms.MaterialIconsImporter.java

private void fillAssets() {
    assetSpinner.removeAllItems();/*from   w ww .ja  v a  2s. c o  m*/
    if (this.assetRoot.getCanonicalPath() == null) {
        return;
    }
    File assetRoot = new File(this.assetRoot.getCanonicalPath());
    assetRoot = new File(assetRoot, (String) categorySpinner.getSelectedItem());
    assetRoot = new File(assetRoot, DEFAULT_RESOLUTION);
    final FilenameFilter drawableFileNameFiler = new FilenameFilter() {
        @Override
        public boolean accept(File file, String s) {
            if (!FilenameUtils.isExtension(s, "png")) {
                return false;
            }
            String filename = FilenameUtils.removeExtension(s);
            return filename.startsWith("ic_") && filename.endsWith("_black_48dp");
        }
    };
    File[] assets = assetRoot.listFiles(drawableFileNameFiler);
    if (assets == null) {
        return;
    }
    for (File asset : assets) {
        String assetName = FilenameUtils.removeExtension(asset.getName());
        assetName = assetName.replace("_black_48dp", "");
        assetName = assetName.replace("ic_", "");
        assetSpinner.addItem(assetName);
    }
}

From source file:eu.udig.omsbox.OmsBoxPlugin.java

public String getClasspathJars() throws Exception {
    try {//from ww  w.ja  v  a  2  s  .  co  m
        StringBuilder sb = new StringBuilder();
        sb.append(".");
        sb.append(File.pathSeparator);

        String sysClassPath = System.getProperty("java.class.path");
        if (sysClassPath != null && sysClassPath.length() > 0 && !sysClassPath.equals("null")) {
            addPath(sysClassPath, sb);
            sb.append(File.pathSeparator);
        }

        // add this plugins classes
        Bundle omsBundle = Platform.getBundle(OmsBoxPlugin.PLUGIN_ID);
        String pluginPath = getPath(omsBundle, "/");
        if (pluginPath != null) {
            addPath(pluginPath, sb);
            sb.append(File.pathSeparator);
            addPath(pluginPath + File.separator + "bin", sb);
        }
        // add udig libs
        Bundle udigLibsBundle = Platform.getBundle("net.refractions.udig.libs");
        String udigLibsFolderPath = getPath(udigLibsBundle, "lib");
        if (udigLibsFolderPath != null) {
            sb.append(File.pathSeparator);
            addPath(udigLibsFolderPath + File.separator + "*", sb);

            File libsPluginPath = new File(udigLibsFolderPath).getParentFile();
            File[] toolsJararray = libsPluginPath.listFiles(new FilenameFilter() {
                public boolean accept(File dir, String name) {
                    return name.startsWith("tools_") && name.endsWith(".jar");
                }
            });
            if (toolsJararray.length == 1) {
                sb.append(File.pathSeparator);
                addPath(toolsJararray[0].getAbsolutePath(), sb);
            }
        }

        // add custom libs from plugins
        addCustomLibs(sb);

        // add jars in the default folder
        File extraSpatialtoolboxLibsFolder = getExtraSpatialtoolboxLibsFolder();
        if (extraSpatialtoolboxLibsFolder != null) {
            File[] extraJars = extraSpatialtoolboxLibsFolder.listFiles(new FilenameFilter() {
                public boolean accept(File dir, String name) {
                    return name.endsWith(".jar");
                }
            });
            for (File extraJar : extraJars) {
                sb.append(File.pathSeparator);
                addPath(extraJar.getAbsolutePath(), sb);
            }
        }

        // add loaded jars
        String[] retrieveSavedJars = retrieveSavedJars();
        for (String file : retrieveSavedJars) {
            sb.append(File.pathSeparator);
            addPath(file, sb);
        }

        return sb.toString();

    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}

From source file:com.joliciel.jochre.search.JochreIndexBuilderImpl.java

private void updateDocumentInternal(File documentDir) {
    try {/*from  ww w. ja v  a 2s .com*/
        LOG.info("Updating index for " + documentDir.getName());

        File zipFile = new File(documentDir, documentDir.getName() + ".zip");
        if (!zipFile.exists()) {
            LOG.info("Nothing to index in " + documentDir.getName());
            return;
        }
        long zipDate = zipFile.lastModified();

        this.deleteDocumentInternal(documentDir);

        File[] offsetFiles = documentDir.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".obj");
            }
        });

        for (File offsetFile : offsetFiles) {
            offsetFile.delete();
        }

        int i = 0;

        Map<String, String> fields = new TreeMap<String, String>();
        File metaDataFile = new File(documentDir, "metadata.txt");
        Scanner scanner = new Scanner(
                new BufferedReader(new InputStreamReader(new FileInputStream(metaDataFile), "UTF-8")));
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            String key = line.substring(0, line.indexOf('\t'));
            String value = line.substring(line.indexOf('\t'));
            fields.put(key, value);
        }
        scanner.close();

        JochreXmlDocument xmlDoc = this.searchService.newDocument();
        JochreXmlReader reader = this.searchService.getJochreXmlReader(xmlDoc);

        ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));
        ZipEntry ze = null;
        while ((ze = zis.getNextEntry()) != null) {
            LOG.debug("Adding zipEntry " + i + ": " + ze.getName());
            String baseName = ze.getName().substring(0, ze.getName().lastIndexOf('.'));
            UnclosableInputStream uis = new UnclosableInputStream(zis);
            reader.parseFile(uis, baseName);
            i++;
        }
        zis.close();

        i = 0;
        StringBuilder sb = new StringBuilder();
        coordinateStorage = searchService.getCoordinateStorage();
        offsetLetterMap = new HashMap<Integer, JochreXmlLetter>();
        int startPage = -1;
        int endPage = -1;
        int docCount = 0;
        int wordCount = 0;
        int cumulWordCount = 0;
        for (JochreXmlImage image : xmlDoc.getImages()) {
            if (startPage < 0)
                startPage = image.getPageIndex();
            endPage = image.getPageIndex();
            int remainingWords = xmlDoc.wordCount() - (cumulWordCount + wordCount);
            LOG.debug("Word count: " + wordCount + ", cumul word count: " + cumulWordCount
                    + ", total xml words: " + xmlDoc.wordCount() + ", remaining words: " + remainingWords);
            if (wordsPerDoc > 0 && wordCount >= wordsPerDoc && remainingWords >= wordsPerDoc) {
                LOG.debug("Creating new index doc: " + docCount);
                JochreIndexDocument indexDoc = searchService.newJochreIndexDocument(documentDir, docCount, sb,
                        coordinateStorage, startPage, endPage, fields);
                indexDoc.save(indexWriter);
                docCount++;

                sb = new StringBuilder();
                coordinateStorage = searchService.getCoordinateStorage();
                startPage = image.getPageIndex();
                offsetLetterMap = new HashMap<Integer, JochreXmlLetter>();
                cumulWordCount += wordCount;
                wordCount = 0;
            }

            LOG.debug("Processing page: " + image.getFileNameBase());

            File imageFile = null;
            for (String imageExtension : imageExtensions) {
                imageFile = new File(documentDir, image.getFileNameBase() + "." + imageExtension);
                if (imageFile.exists())
                    break;
                imageFile = null;
            }
            if (imageFile == null)
                throw new RuntimeException("No image found in directory " + documentDir.getAbsolutePath()
                        + ", baseName " + image.getFileNameBase());

            coordinateStorage.addImage(sb.length(), imageFile.getName(), image.getPageIndex());

            for (JochreXmlParagraph par : image.getParagraphs()) {
                coordinateStorage.addParagraph(sb.length(),
                        new Rectangle(par.getLeft(), par.getTop(), par.getRight(), par.getBottom()));
                for (JochreXmlRow row : par.getRows()) {
                    coordinateStorage.addRow(sb.length(),
                            new Rectangle(row.getLeft(), row.getTop(), row.getRight(), row.getBottom()));
                    int k = 0;
                    for (JochreXmlWord word : row.getWords()) {
                        wordCount++;
                        for (JochreXmlLetter letter : word.getLetters()) {
                            offsetLetterMap.put(sb.length(), letter);
                            if (letter.getText().length() > 1) {
                                for (int j = 1; j < letter.getText().length(); j++) {
                                    offsetLetterMap.put(sb.length() + j, letter);
                                }
                            }
                            sb.append(letter.getText());
                        }
                        k++;
                        boolean finalDash = false;
                        if (k == row.getWords().size() && word.getText().endsWith("-")
                                && word.getText().length() > 1)
                            finalDash = true;
                        if (!finalDash)
                            sb.append(" ");
                    }
                }
                sb.append("\n");
            }
            i++;
        }
        JochreIndexDocument indexDoc = searchService.newJochreIndexDocument(documentDir, docCount, sb,
                coordinateStorage, startPage, endPage, fields);
        indexDoc.save(indexWriter);

        File lastIndexDateFile = new File(documentDir, "indexDate.txt");

        Writer writer = new BufferedWriter(
                new OutputStreamWriter(new FileOutputStream(lastIndexDateFile, false), "UTF8"));
        writer.write("" + zipDate);
        writer.flush();

        writer.close();
    } catch (IOException ioe) {
        LogUtils.logError(LOG, ioe);
        throw new RuntimeException(ioe);
    }
}

From source file:eu.asterics.ape.packaging.Packager.java

/**
 * Copies the services jars which are found in either the subfolder APE.projectDir/custom//bin/ARE/profile or in ARE.baseURI/profile 
 * @param targetSubDir/*from w  ww.j av a2 s  .  co m*/
 */
public Collection<URI> copyServices(File targetSubDir) {
    List<URI> servicesJars = new ArrayList<URI>();

    //Use two-phase approach.
    //1) search in relative custom/bin/ARE/profile folder for files starting with services (excluding config.ini and other files)
    //2) if no files were found there, use the services files of the ARE.baseURI
    File servicesFileDir = ResourceRegistry.resolveRelativeFilePath(projectDir,
            CUSTOM_BIN_ARE_FOLDER + ResourceRegistry.PROFILE_FOLDER);

    FilenameFilter servicesFilesFilter = new FilenameFilter() {

        @Override
        public boolean accept(File dir, String name) {
            String lowerName = name.toLowerCase();
            return lowerName.startsWith("services") && lowerName.endsWith(".ini");
        }
    };

    Collection<URI> servicesFilesURIs = ComponentUtils.findFiles(servicesFileDir.toURI(), false, 1,
            servicesFilesFilter);

    URI areBaseURIProfileFolder = ResourceRegistry.resolveRelativeFilePath(
            ResourceRegistry.getInstance().getAREBaseURI(), ResourceRegistry.PROFILE_FOLDER).toURI();
    String message = "Using services files in " + areBaseURIProfileFolder;
    if (servicesFilesURIs.size() == 0) {
        servicesFilesURIs = ComponentUtils.findFiles(areBaseURIProfileFolder, false, 1, servicesFilesFilter);
    } else {
        message = "Using custom services files in " + servicesFileDir;
    }
    Notifier.info(message);
    Notifier.debug("Found services file URIs: " + servicesFilesURIs, null);
    for (URI servicesFile : servicesFilesURIs) {
        try (BufferedReader in = new BufferedReader(new FileReader(new File(servicesFile)));) {
            String path = null;
            while ((path = in.readLine()) != null) {
                //sanity check, ignore empty lines and .jar entries
                path = path.trim();
                //Skipping comments
                if (path.startsWith("#") || path.isEmpty() || !path.endsWith(".jar")) {
                    continue;
                }

                try {
                    URI jarURI = ResourceRegistry.getInstance().getResource(path, RES_TYPE.JAR);
                    servicesJars.add(jarURI);
                    copyURI(jarURI, targetSubDir, false);
                } catch (URISyntaxException e) {
                    Notifier.warning("Cannot create servicesJarURI for path: " + path, e);
                } catch (IOException e) {
                    Notifier.warning("Can not copy service jar: : " + path, e);
                }
            }
        } catch (IOException e) {
            Notifier.warning("Cannot open services-ini file: " + servicesFile, e);
        }
    }
    return servicesJars;
}

From source file:cn.calm.osgi.conter.FelixOsgiHost.java

protected List<String> getBundlesInDir(String dir) {
    List<String> bundleJars = new ArrayList<String>();
    try {//w  w  w .jav  a  2 s .c  o  m
        URL url = resource.find(dir);
        if (url != null) {
            if ("file".equals(url.getProtocol())) {
                File bundlesDir = new File(url.toURI());
                File[] bundles = bundlesDir.listFiles(new FilenameFilter() {
                    public boolean accept(File file, String name) {
                        return StringUtils.endsWith(name, ".jar");
                    }
                });

                if (bundles != null && bundles.length > 0) {
                    // add all the bundles to the list
                    for (File bundle : bundles) {
                        String externalForm = bundle.toURI().toURL().toExternalForm();
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("Adding bundle [#0]", externalForm);
                        }
                        bundleJars.add(externalForm);
                    }

                } else if (LOG.isDebugEnabled()) {
                    LOG.debug("No bundles found under the [#0] directory", dir);
                }
            } else if (LOG.isWarnEnabled())
                LOG.warn("Unable to read [#0] directory", dir);
        } else if (LOG.isWarnEnabled())
            LOG.warn("The [#0] directory was not found", dir);
    } catch (Exception e) {
        if (LOG.isWarnEnabled())
            LOG.warn("Unable load bundles from the [#0] directory", e, dir);
    }
    return bundleJars;
}

From source file:hudson.maven.RedeployPublisherTest.java

@Test
public void testTarGzUniqueVersionTrueMaven3() throws Exception {
    MavenModuleSet m3 = j.createMavenProject();
    MavenInstallation mvn = j.configureMaven3();
    m3.setMaven(mvn.getName());/*from  ww  w  .ja  v  a  2 s  .  c  o m*/
    File repo = tmp.getRoot();
    // a fake build
    m3.setScm(new SingleFileSCM("pom.xml", getClass().getResource("targz-artifact.pom")));
    m3.getPublishersList().add(new RedeployPublisher("", repo.toURI().toString(), true, false));

    MavenModuleSetBuild b = m3.scheduleBuild2(0).get();
    j.assertBuildStatus(Result.SUCCESS, b);

    assertTrue(MavenUtil.maven3orLater(b.getMavenVersionUsed()));

    File artifactDir = new File(repo, "test/test/0.1-SNAPSHOT/");
    String[] files = artifactDir.list(new FilenameFilter() {

        public boolean accept(File dir, String name) {
            return name.contains("-bin.tar.gz") || name.endsWith(".jar") || name.endsWith("-bin.zip");
        }
    });
    System.out.println("deployed files " + Arrays.asList(files));
    assertFalse("tar.gz doesn't exist",
            new File(repo, "test/test/0.1-SNAPSHOT/test-0.1-SNAPSHOT-bin.tar.gz").exists());
    assertTrue("tar.gz doesn't exist", !files[0].contains("SNAPSHOT"));
    for (String file : files) {
        if (file.endsWith("-bin.tar.gz")) {
            String ver = StringUtils.remove(file, "-bin.tar.gz");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals("-bin.tar.gz not ended with 1 , file " + file, "1", ver);
        }
        if (file.endsWith(".jar")) {
            String ver = StringUtils.remove(file, ".jar");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals(".jar not ended with 1 , file " + file, "1", ver);
        }
        if (file.endsWith("-bin.zip")) {
            String ver = StringUtils.remove(file, "-bin.zip");
            ver = ver.substring(ver.length() - 1, ver.length());
            assertEquals("-bin.zip not ended with 1 , file " + file, "1", ver);
        }
    }
}