accounting-aggregator-se-pl.../src/test/java/org/gcube/accounting/aggregator/file/WorkSpaceDirectoryStructure...

40 lines
1.4 KiB
Java

package org.gcube.accounting.aggregator.file;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.gcube.accounting.aggregator.ContextTest;
import org.gcube.accounting.aggregator.aggregation.AggregationType;
import org.gcube.accounting.aggregator.directory.WorkSpaceDirectoryStructure;
import org.gcube.accounting.aggregator.utility.Constant;
import org.gcube.accounting.aggregator.utility.Utility;
import org.gcube.accounting.aggregator.workspace.WorkSpaceManagement;
import org.gcube.common.storagehub.client.dsl.FolderContainer;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WorkSpaceDirectoryStructureTest extends ContextTest {
public static Logger logger = LoggerFactory.getLogger(WorkSpaceDirectoryStructureTest.class);
@Test
public void test() throws Exception{
AggregationType aggregationType = AggregationType.YEARLY;
Date date = Utility.getAggregationStartCalendar(2015, Calendar.JANUARY, 1).getTime();
WorkSpaceDirectoryStructure workSpaceDirectoryStructure = new WorkSpaceDirectoryStructure();
FolderContainer targetFolder = workSpaceDirectoryStructure.getTargetFolder(aggregationType, date);
File file = new File(Constant.ROOT_DIRECTORY, "aux.txt");
List<File> files = new ArrayList<>();
files.add(file);
WorkSpaceManagement.getInstance().zipAndBackupFiles(targetFolder, "Test", files);
}
}