use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.
the class ApkPackageManagerTest method canParseArchitecture.
@Test
public void canParseArchitecture() throws ExecutableRunnerException {
final String exampleOutput = "x86_64\n";
DetectableExecutableRunner executableRunner = Mockito.mock(DetectableExecutableRunner.class);
Mockito.when(executableRunner.execute(null, "apk", Arrays.asList("info", "--print-arch"))).thenReturn(new ExecutableOutput(0, exampleOutput, ""));
ApkArchitectureResolver architectureResolver = new ApkArchitectureResolver();
Optional<String> architecture = architectureResolver.resolveArchitecture(new ClangPackageManagerInfoFactory().apk(), null, executableRunner);
assertTrue(architecture.isPresent());
Assertions.assertEquals("x86_64", architecture.get());
}
use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.
the class DockerExtractorTest method getDetectableExecutableRunner.
@NotNull
private DetectableExecutableRunner getDetectableExecutableRunner() throws ExecutableRunnerException {
DetectableExecutableRunner executableRunner = Mockito.mock(DetectableExecutableRunner.class);
ExecutableOutput executableOutput = Mockito.mock(ExecutableOutput.class);
Mockito.when(executableOutput.getReturnCode()).thenReturn(0);
Mockito.when(executableRunner.execute(Mockito.any(Executable.class))).thenReturn(executableOutput);
return executableRunner;
}
use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.
the class CondaCliDetectableTest method setup.
@Override
protected void setup() throws IOException {
addFile("environment.yml");
ExecutableOutput condaListOutput = createStandardOutput("[", " {", " \"base_url\": null,", " \"build_number\": 0,", " \"build_string\": \"0\",", " \"channel\": \"defaults\",", " \"dist_name\": \"mkl-2017.0.3-0\",", " \"name\": \"mkl\",", " \"platform\": null,", " \"version\": \"2017.0.3\",", " \"with_features_depends\": null", " },", " {", " \"base_url\": null,", " \"build_number\": 0,", " \"build_string\": \"py36_0\",", " \"channel\": \"defaults\",", " \"dist_name\": \"numpy-1.13.1-py36_0\",", " \"name\": \"numpy\",", " \"platform\": null,", " \"version\": \"1.13.1\",", " \"with_features_depends\": null", " }", "]");
addExecutableOutput(condaListOutput, "conda", "list", "-n", "conda-env", "--json");
ExecutableOutput condaInfoOutput = createStandardOutput("{", " \"conda_build_version\": \"not installed\",", " \"conda_env_version\": \"4.3.22\",", " \"conda_location\": \"/usr/local/miniconda3/lib/python3.6/site-packages/conda\",", " \"conda_prefix\": \"/usr/local/miniconda3\",", " \"conda_private\": false,", " \"conda_version\": \"4.3.22\",", " \"default_prefix\": \"/usr/local/miniconda3\",", " \"platform\": \"osx-64\"", "}");
addExecutableOutput(getOutputDirectory(), condaInfoOutput, "conda", "info", "--json");
}
use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.
the class CpanCliDetectableTest method setup.
@Override
protected void setup() throws IOException {
// TODO: The difference between LIST and SHOWDEPS is not clear from this test.
addFile("Makefile.PL");
ExecutableOutput cpanListOutput = createStandardOutput("ExtUtils::MakeMaker\t7.24", "perl\t5.1", "Test::More\t1.3");
addExecutableOutput(getOutputDirectory(), cpanListOutput, "cpan", "-l");
ExecutableOutput cpanmShowDepsOutput = createStandardOutput("--> Working on .", "Configuring App-cpanminus-1.7043 ... OK", "ExtUtils::MakeMaker~6.58", "Test::More", "perl~5.008001", "ExtUtils::MakeMaker");
addExecutableOutput(getOutputDirectory(), cpanmShowDepsOutput, "cpanm", "--showdeps", ".");
}
use of com.synopsys.integration.executable.ExecutableOutput in project synopsys-detect by blackducksoftware.
the class GoModDetectableTest method setup.
@Override
protected void setup() throws IOException {
addFile(Paths.get("go.mod"));
ExecutableOutput goListOutput = createStandardOutputFromResource("/go/go-list.xout");
addExecutableOutput(goListOutput, "go", "list", "-m", "-json");
ExecutableOutput goVersionOutput = createStandardOutput("go version go1.16.5 darwin/amd64");
addExecutableOutput(goVersionOutput, "go", "version");
ExecutableOutput goListUJsonOutput = createStandardOutputFromResource("/go/go-list-all.xout");
addExecutableOutput(goListUJsonOutput, "go", "list", "-mod=readonly", "-m", "-json", "all");
ExecutableOutput goModGraphOutput = createStandardOutput("github.com/gin-gonic/gin golang.org/x/text@v0.3.0", "github.com/gin-gonic/gin sigs.k8s.io/yaml@v1.2.0", "golang.org/x/text@v0.3.0 golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e", "gopkg.in/yaml.v2@v2.2.8 gopkg.in/check.v1@v0.0.0-20161208181325-20d25e280405", "sigs.k8s.io/yaml@v1.2.0 github.com/davecgh/go-spew@v1.1.1", "sigs.k8s.io/yaml@v1.2.0 gopkg.in/yaml.v2@v2.2.8");
addExecutableOutput(goModGraphOutput, "go", "mod", "graph");
}
Aggregations