Skip to content

Commit 8031487

Browse files
committed
Added test #1872
Signed-off-by: Chin Yeung Li <tli@nexb.com>
1 parent 4ff1156 commit 8031487

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

scanpipe/tests/pipes/test_d2d.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ def test_scanpipe_pipes_d2d_java_ignore_pattern(self):
475475
make_resource_file(self.project1, path="to/META-INF/MANIFEST.MF")
476476
make_resource_file(self.project1, path="to/test.class")
477477
make_resource_file(self.project1, path="to/META-INF/others.txt")
478+
make_resource_file(
479+
self.project1, path="to/META-INF/spring-configuration-metadata.json"
480+
)
481+
make_resource_file(self.project1, path="to/OSGI-INF/test.xml")
482+
make_resource_file(self.project1, path="to/OSGI-INF/test.json")
483+
make_resource_file(self.project1, path="to/OSGI-INF/test.class")
478484
buffer = io.StringIO()
479485

480486
java_config = d2d_config.get_ecosystem_config(ecosystem="Java")
@@ -483,7 +489,7 @@ def test_scanpipe_pipes_d2d_java_ignore_pattern(self):
483489
patterns_to_ignore=java_config.deployed_resource_path_exclusions,
484490
logger=buffer.write,
485491
)
486-
expected = "Ignoring 3 to/ resources with ecosystem specific configurations."
492+
expected = "Ignoring 6 to/ resources with ecosystem specific configurations."
487493
self.assertIn(expected, buffer.getvalue())
488494

489495
def test_scanpipe_pipes_d2d_map_jar_to_java_source(self):
@@ -584,6 +590,21 @@ def test_scanpipe_pipes_d2d_map_jar_to_scala_source(self):
584590
self.assertEqual(from2, relation.from_resource)
585591
self.assertEqual(to_jar, relation.to_resource)
586592

593+
def test_scanpipe_pipes_d2d_scala_ignore_pattern(self):
594+
make_resource_file(self.project1, path="to/META-INF/MANIFEST.MF")
595+
make_resource_file(self.project1, path="to/test.class")
596+
make_resource_file(self.project1, path="to/META-INF/others.txt")
597+
buffer = io.StringIO()
598+
599+
scala_config = d2d_config.get_ecosystem_config(ecosystem="Scala")
600+
d2d.ignore_unmapped_resources_from_config(
601+
project=self.project1,
602+
patterns_to_ignore=scala_config.deployed_resource_path_exclusions,
603+
logger=buffer.write,
604+
)
605+
expected = "Ignoring 2 to/ resources with ecosystem specific configurations."
606+
self.assertIn(expected, buffer.getvalue())
607+
587608
def test_scanpipe_pipes_d2d_map_jar_to_kotlin_source(self):
588609
from1 = make_resource_file(
589610
self.project1,
@@ -633,6 +654,23 @@ def test_scanpipe_pipes_d2d_map_jar_to_kotlin_source(self):
633654
self.assertEqual(from2, relation.from_resource)
634655
self.assertEqual(to_jar, relation.to_resource)
635656

657+
def test_scanpipe_pipes_d2d_kotlin_ignore_pattern(self):
658+
make_resource_file(self.project1, path="to/META-INF/test.knm")
659+
make_resource_file(self.project1, path="to/test.class")
660+
make_resource_file(
661+
self.project1, path="to/META-INF/kotlin-project-structure-metadata.json"
662+
)
663+
buffer = io.StringIO()
664+
665+
kotlin_config = d2d_config.get_ecosystem_config(ecosystem="Kotlin")
666+
d2d.ignore_unmapped_resources_from_config(
667+
project=self.project1,
668+
patterns_to_ignore=kotlin_config.deployed_resource_path_exclusions,
669+
logger=buffer.write,
670+
)
671+
expected = "Ignoring 2 to/ resources with ecosystem specific configurations."
672+
self.assertIn(expected, buffer.getvalue())
673+
636674
def test_scanpipe_pipes_d2d_map_jar_to_source_works_for_jar(self):
637675
from1 = make_resource_file(
638676
self.project1,

0 commit comments

Comments
 (0)