001/* 002 * The contents of this file are subject to the license and copyright detailed 003 * in the LICENSE and NOTICE files at the root of the source tree. 004 */ 005package org.duraspace.bagit; 006 007import static org.junit.Assert.assertEquals; 008import static org.junit.Assert.assertNotNull; 009import static org.junit.Assert.assertTrue; 010 011import java.io.File; 012import java.util.Map; 013 014import org.junit.Test; 015 016/** 017 * @author dbernstein 018 * @since Dec 14, 2016 019 */ 020public class BagConfigTest { 021 022 @Test 023 public void testFromFile() { 024 final File testFile = new File("src/test/resources/configs/bagit-config.yml"); 025 final BagConfig config = new BagConfig(testFile); 026 027 final Map<String, String> bagInfo = config.getBagInfo(); 028 assertNotNull(bagInfo); 029 assertNotNull(bagInfo.get(BagConfig.SOURCE_ORGANIZATION_KEY)); 030 031 assertTrue(config.hasTagFile("aptrust-info.txt")); 032 final Map<String, String> customTags = config.getFieldsForTagFile("aptrust-info.txt"); 033 assertNotNull(customTags); 034 assertEquals(customTags.get(BagConfig.ACCESS_KEY).toUpperCase(), BagConfig.AccessTypes.RESTRICTED.name()); 035 036 } 037 038}