Search in sources :

Example 1 with DetectOverrideableFilter

use of com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter in project hub-detect by blackducksoftware.

the class AllAndNoneExcludedIncludedFilterTest method testOverridableNormalExcludeList.

// Overridable
@Test
public void testOverridableNormalExcludeList() {
    DetectFilter filter = new DetectOverrideableFilter("docker,rubygems", "");
    assertFalse(filter.shouldInclude("docker"));
    assertFalse(filter.shouldInclude("rubygems"));
    assertTrue(filter.shouldInclude("gradle"));
}
Also used : DetectOverrideableFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter) DetectFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectFilter) Test(org.junit.Test)

Example 2 with DetectOverrideableFilter

use of com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter in project hub-detect by blackducksoftware.

the class AllAndNoneExcludedIncludedFilterTest method testOverridableAllExcluded.

@Test
public void testOverridableAllExcluded() {
    DetectFilter filter = new DetectOverrideableFilter("ALL", "");
    assertFalse(filter.shouldInclude("docker"));
    assertFalse(filter.shouldInclude("rubygems"));
    assertFalse(filter.shouldInclude("gradle"));
}
Also used : DetectOverrideableFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter) DetectFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectFilter) Test(org.junit.Test)

Example 3 with DetectOverrideableFilter

use of com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter in project hub-detect by blackducksoftware.

the class AllAndNoneExcludedIncludedFilterTest method testOverridableAllExcludedWithIgnoredIncludes.

@Test
public void testOverridableAllExcludedWithIgnoredIncludes() {
    DetectFilter filter = new DetectOverrideableFilter("ALL", "docker,rubygems");
    assertFalse(filter.shouldInclude("docker"));
    assertFalse(filter.shouldInclude("rubygems"));
    assertFalse(filter.shouldInclude("gradle"));
}
Also used : DetectOverrideableFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter) DetectFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectFilter) Test(org.junit.Test)

Example 4 with DetectOverrideableFilter

use of com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter in project hub-detect by blackducksoftware.

the class AllAndNoneExcludedIncludedFilterTest method testOverridableNormalIncludeList.

@Test
public void testOverridableNormalIncludeList() {
    DetectFilter filter = new DetectOverrideableFilter("", "docker,rubygems");
    assertTrue(filter.shouldInclude("docker"));
    assertTrue(filter.shouldInclude("rubygems"));
    assertFalse(filter.shouldInclude("gradle"));
}
Also used : DetectOverrideableFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter) DetectFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectFilter) Test(org.junit.Test)

Example 5 with DetectOverrideableFilter

use of com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter in project hub-detect by blackducksoftware.

the class DetectConfigurationFactory method createSearchOptions.

public SearchOptions createSearchOptions(final File directory) {
    final List<String> excludedDirectories = Arrays.asList(detectConfiguration.getStringArrayProperty(DetectProperty.DETECT_DETECTOR_SEARCH_EXCLUSION, PropertyAuthority.None));
    final List<String> excludedDirectoryPatterns = Arrays.asList(detectConfiguration.getStringArrayProperty(DetectProperty.DETECT_DETECTOR_SEARCH_EXCLUSION_PATTERNS, PropertyAuthority.None));
    final boolean forceNestedSearch = detectConfiguration.getBooleanProperty(DetectProperty.DETECT_DETECTOR_SEARCH_CONTINUE, PropertyAuthority.None);
    final int maxDepth = detectConfiguration.getIntegerProperty(DetectProperty.DETECT_DETECTOR_SEARCH_DEPTH, PropertyAuthority.None);
    final String excluded = detectConfiguration.getProperty(DetectProperty.DETECT_EXCLUDED_DETECTOR_TYPES, PropertyAuthority.None).toUpperCase();
    final String included = detectConfiguration.getProperty(DetectProperty.DETECT_INCLUDED_DETECTOR_TYPES, PropertyAuthority.None).toUpperCase();
    final DetectOverrideableFilter bomToolFilter = new DetectOverrideableFilter(excluded, included);
    return new SearchOptions(directory, excludedDirectories, excludedDirectoryPatterns, forceNestedSearch, maxDepth, bomToolFilter);
}
Also used : DetectOverrideableFilter(com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter) SearchOptions(com.blackducksoftware.integration.hub.detect.workflow.search.SearchOptions)

Aggregations

DetectOverrideableFilter (com.blackducksoftware.integration.hub.detect.util.filter.DetectOverrideableFilter)5 DetectFilter (com.blackducksoftware.integration.hub.detect.util.filter.DetectFilter)4 Test (org.junit.Test)4 SearchOptions (com.blackducksoftware.integration.hub.detect.workflow.search.SearchOptions)1