19 package org.sleuthkit.autopsy.integrationtesting.config;
21 import com.fasterxml.jackson.annotation.JsonCreator;
22 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import java.util.Collections;
25 import java.util.HashMap;
26 import java.util.HashSet;
27 import java.util.List;
30 import java.util.stream.Collectors;
31 import org.apache.commons.collections4.CollectionUtils;
32 import org.apache.commons.collections4.MapUtils;
37 @JsonIgnoreProperties(ignoreUnknown =
true)
52 @JsonProperty(
"excludeAllExcept") List<ParameterizedResourceConfig> excludeAllExcept,
53 @JsonProperty(
"includeAllExcept") List<String> includeAllExcept) {
56 List<ParameterizedResourceConfig> safeExcludeAllExcept = ((excludeAllExcept == null) ? Collections.emptyList() : excludeAllExcept);
59 this.excludeAllExcept = safeExcludeAllExcept
61 .collect(Collectors.toMap(
62 (res) -> res.getResource() == null ?
"" : res.getResource().toUpperCase(),
65 Map<String, Object> mergedArgs =
new HashMap<>();
66 mergedArgs.putAll(res1.getParameters());
67 mergedArgs.putAll(res2.getParameters());
72 List<String> safeIncludeAllExcept = ((includeAllExcept == null) ? Collections.emptyList() : includeAllExcept);
73 this.includeAllExcept = safeIncludeAllExcept
75 .map(String::toUpperCase)
76 .collect(Collectors.toSet());
84 return excludeAllExcept == null ? Collections.emptySet() :
new HashSet<>(excludeAllExcept.values());
93 return includeAllExcept == null ? Collections.emptySet() : Collections.unmodifiableSet(includeAllExcept);
105 return resource == null ? Collections.emptyMap() :
new HashMap<>(resource.
getParameters());
115 if (itemType == null) {
120 if (!CollectionUtils.isEmpty(includeAllExcept) && includeAllExcept.contains(itemType.toUpperCase())) {
125 if (!MapUtils.isEmpty(excludeAllExcept)) {
126 return excludeAllExcept.containsKey(itemType.toUpperCase());
Map< String, Object > getParameters()
boolean hasIncludedTest(String itemType)
Set< ParameterizedResourceConfig > getExcludeAllExcept()
final Map< String, ParameterizedResourceConfig > excludeAllExcept
TestingConfig(@JsonProperty("excludeAllExcept") List< ParameterizedResourceConfig > excludeAllExcept,@JsonProperty("includeAllExcept") List< String > includeAllExcept)
Map< String, Object > getParameters(String itemType)
final Set< String > includeAllExcept
Set< String > getIncludeAllExcept()