@@ -0,0 +1,2584 @@
+package io.github.greyp9.arwo.core.file.zip.test;%0A%0Aimport io.github.greyp9.arwo.core.date.DateX;%0Aimport io.github.greyp9.arwo.core.date.XsdDateU;%0Aimport io.github.greyp9.arwo.core.file.FileU;%0Aimport io.github.greyp9.arwo.core.file.find.FindInFolderQuery;%0Aimport io.github.greyp9.arwo.core.file.group.FileGrouper;%0Aimport io.github.greyp9.arwo.core.file.zip.ZipAppender;%0Aimport io.github.greyp9.arwo.core.lang.SystemU;%0Aimport junit.framework.TestCase;%0A%0Aimport java.io.File;%0Aimport java.util.Collection;%0Aimport java.util.Date;%0Aimport java.util.Map;%0Aimport java.util.logging.Logger;%0A%0Apublic class ZipArchiveTest extends TestCase %7B%0A    private final Logger logger = Logger.getLogger(getClass().getName());%0A%0A    public void testCategorize() throws Exception %7B%0A        boolean isEnabledCreateZip = System.getProperties().isEmpty();%0A        final String comment = XsdDateU.toXSDZMillis(new Date());%0A        // source files%0A        final File folderSource = new File(SystemU.tempDir());%0A        logger.info(folderSource.getAbsolutePath());%0A        Collection%3CFile%3E files = new FindInFolderQuery(folderSource, %22*.*%22, false).getFound();%0A        logger.info(%22%22 + files.size());%0A        // group files%0A        FileGrouper fileGrouper = new FileGrouper(%22PT1H%22);%0A        fileGrouper.add(files.toArray(new File%5Bfiles.size()%5D));%0A        // results%0A        final Map%3CDate, Collection%3CFile%3E%3E groupings = fileGrouper.getGroupings();%0A        for (final Map.Entry%3CDate, Collection%3CFile%3E%3E entry : groupings.entrySet()) %7B%0A            final Date dateEntry = entry.getKey();%0A            final Collection%3CFile%3E grouping = entry.getValue();%0A            // target file%0A            final String filename = String.format(%22%25s.%25s.zip%22,%0A                    getClass().getSimpleName(), DateX.toFilename(dateEntry));%0A            final File fileTarget = new File(folderSource, filename);%0A            ZipAppender appender = new ZipAppender(fileTarget);%0A            logger.finest(%22---------=---------=%22);%0A            logger.finest(XsdDateU.toXSDZ(dateEntry));%0A            if (isEnabledCreateZip) %7B%0A                boolean success = appender.append(comment, grouping.toArray(new File%5Bgrouping.size()%5D));%0A                logger.finest(%22%22 + success);%0A                if (success) %7B%0A                    for (File file : grouping) %7B%0A                        success &= FileU.delete(file);%0A                    %7D%0A                %7D%0A                logger.finest(%22%22 + success);%0A            %7D%0A            // debug%0A            for (File file : grouping) %7B%0A                logger.finest(file.getName());%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

support for Irby job GroupFileRunnable