protected void initAuFeatureMap() { if (definitionMap.containsKey(DefinableArchivalUnit.KEY_AU_FEATURE_URL_MAP)) { Map<String, ?> featMap = definitionMap.getMap(DefinableArchivalUnit.KEY_AU_FEATURE_URL_MAP); for (Map.Entry ent : featMap.entrySet()) { Object val = ent.getValue(); if (val instanceof Map) { ent.setValue(MapUtil.expandAlternativeKeyLists((Map) val)); } } } }
public void testFindLeastFullRepository() throws Exception { Map repoMap = MapUtil.map( "local:one", new MyDF("/one", 1000), "local:two", new MyDF("/two", 3000), "local:three", new MyDF("/three", 2000)); mgr.setRepoMap(repoMap); assertEquals("local:two", mgr.findLeastFullRepository()); }
public void testSubstanceState() { AuState aus = new AuState(mau, historyRepo); assertEquals(SubstanceChecker.State.Unknown, aus.getSubstanceState()); assertFalse(aus.hasNoSubstance()); aus.setSubstanceState(SubstanceChecker.State.Yes); assertEquals(1, historyRepo.getAuStateStoreCount()); assertEquals(SubstanceChecker.State.Yes, aus.getSubstanceState()); assertFalse(aus.hasNoSubstance()); aus.setSubstanceState(SubstanceChecker.State.No); assertEquals(2, historyRepo.getAuStateStoreCount()); assertEquals(SubstanceChecker.State.No, aus.getSubstanceState()); assertTrue(aus.hasNoSubstance()); assertNotEquals("2", aus.getFeatureVersion(Plugin.Feature.Substance)); mplug.setFeatureVersionMap(MapUtil.map(Plugin.Feature.Substance, "2")); aus.setSubstanceState(SubstanceChecker.State.Yes); // changing both the substance state and feature version should store // only once assertEquals(3, historyRepo.getAuStateStoreCount()); assertEquals(SubstanceChecker.State.Yes, aus.getSubstanceState()); assertEquals("2", aus.getFeatureVersion(Plugin.Feature.Substance)); }