use of com.blackducksoftware.integration.hub.detect.workflow.search.rules.DetectorSearchRuleSet in project hub-detect by blackducksoftware.
the class DetectorFactoryTest method testNewBomToolsCreatedEveryTime.
@Test
public void testNewBomToolsCreatedEveryTime() {
DetectorFactory detectorFactory = runContext.getBean(DetectorFactory.class);
DetectorSearchProvider provider = new DetectorSearchProvider(detectorFactory);
DetectorEnvironment mockEnv = Mockito.mock(DetectorEnvironment.class);
DetectorSearchRuleSet ruleSet1 = provider.createBomToolSearchRuleSet(mockEnv);
DetectorSearchRuleSet ruleSet2 = provider.createBomToolSearchRuleSet(mockEnv);
Detector detector1 = ruleSet1.getOrderedBomToolRules().get(0).getDetector();
Detector detector2 = ruleSet2.getOrderedBomToolRules().get(0).getDetector();
// Sanity check they are the same class
Assert.assertTrue(detector1.getClass().isInstance(detector2));
// And check they are not the same instance
Assert.assertFalse(detector1 == detector2);
}
use of com.blackducksoftware.integration.hub.detect.workflow.search.rules.DetectorSearchRuleSet in project hub-detect by blackducksoftware.
the class DetectorFinder method processDirectory.
private List<DetectorEvaluation> processDirectory(final File directory, final Set<Detector> appliedBefore, final int depth, final DetectorFinderOptions options) {
final DetectorEnvironment environment = new DetectorEnvironment(directory, appliedBefore, depth, options.getDetectorFilter(), options.getForceNestedSearch());
final DetectorSearchRuleSet bomToolSet = options.getDetectorSearchProvider().createBomToolSearchRuleSet(environment);
final List<DetectorEvaluation> evaluations = options.getDetectorSearchEvaluator().evaluate(bomToolSet, options.getEventSystem());
return evaluations;
}
Aggregations