Search in sources :

Example 1 with IntermediateStepParseReplaceInEachLine

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine in project synopsys-detect by blackducksoftware.

the class IntermediateStepParseReplaceInEachLineTest method testRemoveLeadingAtSignMixedTags.

@Test
public void testRemoveLeadingAtSignMixedTags() throws IntegrationException, ExecutableFailedException {
    List<String> input = Arrays.asList("  tags = [\"__SOME_OTHER_TAG__\", \"maven_coordinates=com.company.thing:thing-common-client:2.100.0\"],", "  tags = [\"maven_coordinates=com.google.code.findbugs:jsr305:3.0.2\"],");
    IntermediateStep intermediateStep1 = new IntermediateStepParseReplaceInEachLine(".*\"maven_coordinates=", "");
    IntermediateStep intermediateStep2 = new IntermediateStepParseReplaceInEachLine("\".*", "");
    List<String> intermediate = intermediateStep1.process(input);
    List<String> output = intermediateStep2.process(intermediate);
    assertEquals(2, output.size());
    assertEquals("com.company.thing:thing-common-client:2.100.0", output.get(0));
    assertEquals("com.google.code.findbugs:jsr305:3.0.2", output.get(1));
}
Also used : IntermediateStepParseReplaceInEachLine(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine) IntermediateStep(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep) Test(org.junit.jupiter.api.Test)

Example 2 with IntermediateStepParseReplaceInEachLine

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine in project synopsys-detect by blackducksoftware.

the class IntermediateStepParseReplaceInEachLineTest method testRemoveLeadingAtSign.

@Test
public void testRemoveLeadingAtSign() throws IntegrationException, ExecutableFailedException {
    List<String> input = Arrays.asList("@org_apache_commons_commons_io//jar:jar", "@com_google_guava_guava//jar:jar");
    IntermediateStep intermediateStep = new IntermediateStepParseReplaceInEachLine("^@", "");
    List<String> output = intermediateStep.process(input);
    assertEquals(2, output.size());
    assertEquals("org_apache_commons_commons_io//jar:jar", output.get(0));
    assertEquals("com_google_guava_guava//jar:jar", output.get(1));
}
Also used : IntermediateStepParseReplaceInEachLine(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine) IntermediateStep(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep) Test(org.junit.jupiter.api.Test)

Example 3 with IntermediateStepParseReplaceInEachLine

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine in project synopsys-detect by blackducksoftware.

the class IntermediateStepParseReplaceInEachLineTest method testInsertPrefix.

@Test
public void testInsertPrefix() throws IntegrationException, ExecutableFailedException {
    List<String> input = Arrays.asList("org_apache_commons_commons_io", "com_google_guava_guava");
    IntermediateStep intermediateStep = new IntermediateStepParseReplaceInEachLine("^", "//external:");
    List<String> output = intermediateStep.process(input);
    assertEquals(2, output.size());
    assertEquals("//external:org_apache_commons_commons_io", output.get(0));
    assertEquals("//external:com_google_guava_guava", output.get(1));
}
Also used : IntermediateStepParseReplaceInEachLine(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine) IntermediateStep(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep) Test(org.junit.jupiter.api.Test)

Example 4 with IntermediateStepParseReplaceInEachLine

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine in project synopsys-detect by blackducksoftware.

the class IntermediateStepParseReplaceInEachLineTest method testMavenInstallBuildOutputExtractMavenCoordinates.

@Test
public void testMavenInstallBuildOutputExtractMavenCoordinates() throws IntegrationException, ExecutableFailedException {
    List<String> input = Arrays.asList("  tags = [\"maven_coordinates=com.google.guava:guava:27.0-jre\"],");
    IntermediateStep intermediateStepOne = new IntermediateStepParseReplaceInEachLine("^\\s*tags\\s*\\s*=\\s*\\[\\s*\"maven_coordinates=", "");
    List<String> stepOneOutput = intermediateStepOne.process(input);
    IntermediateStep intermediateStepTwo = new IntermediateStepParseReplaceInEachLine("\".*", "");
    List<String> output = intermediateStepTwo.process(stepOneOutput);
    assertEquals(1, output.size());
    assertEquals("com.google.guava:guava:27.0-jre", output.get(0));
}
Also used : IntermediateStepParseReplaceInEachLine(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine) IntermediateStep(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep) Test(org.junit.jupiter.api.Test)

Example 5 with IntermediateStepParseReplaceInEachLine

use of com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine in project synopsys-detect by blackducksoftware.

the class IntermediateStepParseReplaceInEachLineTest method testRemoveTrailingJunk.

@Test
public void testRemoveTrailingJunk() throws IntegrationException, ExecutableFailedException {
    List<String> input = Arrays.asList("org_apache_commons_commons_io//jar:jar", "com_google_guava_guava//jar:jar");
    IntermediateStep intermediateStep = new IntermediateStepParseReplaceInEachLine("//.*", "");
    List<String> output = intermediateStep.process(input);
    assertEquals(2, output.size());
    assertEquals("org_apache_commons_commons_io", output.get(0));
    assertEquals("com_google_guava_guava", output.get(1));
}
Also used : IntermediateStepParseReplaceInEachLine(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine) IntermediateStep(com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep) Test(org.junit.jupiter.api.Test)

Aggregations

IntermediateStep (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStep)5 IntermediateStepParseReplaceInEachLine (com.synopsys.integration.detectable.detectables.bazel.pipeline.step.IntermediateStepParseReplaceInEachLine)5 Test (org.junit.jupiter.api.Test)5