Search in sources :

Example 1 with FileNotFoundDetectableResult

use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.

the class DartPubDepDetectable method extractable.

@Override
public DetectableResult extractable() throws DetectableException {
    if (!pubspecLock.isPresent() && pubspecYaml.isPresent()) {
        return new PubSpecLockNotFoundDetectableResult(environment.getDirectory().getAbsolutePath());
    } else if (pubspecLock.isPresent() && !pubspecYaml.isPresent()) {
        return new FileNotFoundDetectableResult(PUBSPEC_LOCK_FILENAME);
    }
    dartExe = dartResolver.resolveDart();
    flutterExe = flutterResolver.resolveFlutter();
    if (dartExe == null && flutterExe == null) {
        return new ExecutablesNotFoundDetectableResult(Arrays.asList("dart", "flutter"));
    }
    return new PassedDetectableResult();
}
Also used : ExecutablesNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.ExecutablesNotFoundDetectableResult) FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) PubSpecLockNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.PubSpecLockNotFoundDetectableResult) PassedDetectableResult(com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)

Example 2 with FileNotFoundDetectableResult

use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.

the class PubDepsDetectableTest method testThrowExceptionWhenLockFilePresentButNotYaml.

@Test
public void testThrowExceptionWhenLockFilePresentButNotYaml() throws DetectableException {
    FileFinder fileFinder = Mockito.mock(FileFinder.class);
    Mockito.when(fileFinder.findFile(null, "pubspec.yaml")).thenReturn(null);
    Mockito.when(fileFinder.findFile(null, "pubspec.lock")).thenReturn(new File(""));
    DartPubDepDetectable dartPubDepDetectable = new DartPubDepDetectable(new DetectableEnvironment(null), fileFinder, null, null, null, null);
    DetectableResult applicable = dartPubDepDetectable.applicable();
    Assertions.assertTrue(applicable.getPassed());
    DetectableResult extractable = dartPubDepDetectable.extractable();
    Assertions.assertTrue(extractable instanceof FileNotFoundDetectableResult);
}
Also used : FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) DetectableResult(com.synopsys.integration.detectable.detectable.result.DetectableResult) FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) FileFinder(com.synopsys.integration.common.util.finder.FileFinder) File(java.io.File) DetectableEnvironment(com.synopsys.integration.detectable.DetectableEnvironment) DartPubDepDetectable(com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable) Test(org.junit.jupiter.api.Test)

Example 3 with FileNotFoundDetectableResult

use of com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult in project synopsys-detect by blackducksoftware.

the class ConanCliDetectable method applicable.

@Override
public DetectableResult applicable() {
    PassedResultBuilder passedResultBuilder = new PassedResultBuilder();
    File conanTxtFile = fileFinder.findFile(environment.getDirectory(), CONANFILETXT);
    if (conanTxtFile == null) {
        File conanPyFile = fileFinder.findFile(environment.getDirectory(), CONANFILEPY);
        if (conanPyFile == null) {
            return new FileNotFoundDetectableResult(CONANFILETXT);
        } else {
            passedResultBuilder.foundFile(conanPyFile);
        }
    } else {
        passedResultBuilder.foundFile(conanTxtFile);
    }
    return passedResultBuilder.build();
}
Also used : PassedResultBuilder(com.synopsys.integration.detectable.detectable.PassedResultBuilder) FileNotFoundDetectableResult(com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult) File(java.io.File)

Aggregations

FileNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.FileNotFoundDetectableResult)3 File (java.io.File)2 FileFinder (com.synopsys.integration.common.util.finder.FileFinder)1 DetectableEnvironment (com.synopsys.integration.detectable.DetectableEnvironment)1 PassedResultBuilder (com.synopsys.integration.detectable.detectable.PassedResultBuilder)1 DetectableResult (com.synopsys.integration.detectable.detectable.result.DetectableResult)1 ExecutablesNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.ExecutablesNotFoundDetectableResult)1 PassedDetectableResult (com.synopsys.integration.detectable.detectable.result.PassedDetectableResult)1 PubSpecLockNotFoundDetectableResult (com.synopsys.integration.detectable.detectable.result.PubSpecLockNotFoundDetectableResult)1 DartPubDepDetectable (com.synopsys.integration.detectable.detectables.dart.pubdep.DartPubDepDetectable)1 Test (org.junit.jupiter.api.Test)1