ad9f8480c8e08b95d6c217ec4a126bd93b7f376a,tests/python/pants_test/backend/jvm/targets/test_jvm_app.py,BundleTest,test_multiple_bundles,#BundleTest#,312

Before Change



  def test_multiple_bundles(self):
    self.create_dir("src/java/org/archimedes/volume/config/stone")
    self.create_file("src/java/org/archimedes/volume/config/stone/dense.xml")
    self.create_dir("src/java/org/archimedes/volume/config")
    self.create_file("src/java/org/archimedes/volume/config/metal/dense.xml")
    self.add_to_build_file("src/java/org/archimedes/volume/BUILD", dedent("""
      jvm_binary(name="unused")
    """))
    self.add_to_build_file("src/java/org/archimedes/volume/BUILD", dedent("""
      jvm_app(name="volume",
        dependencies=[":unused"],
        bundles=[
          bundle(relative_to="config", fileset="config/stone/dense.xml")
        ]
      )

      jvm_app(name="bathtub",
        dependencies=[":unused"],
        bundles=[
          bundle(fileset="config/metal/dense.xml")
        ]
      )
    """))

    app1 = self.target("src/java/org/archimedes/volume")
    self.assertEquals(1, len(app1.bundles))
    for k in app1.bundles[0].filemap.keys():
      if k.endswith("archimedes/volume/config/stone/dense.xml"):
        stonexml_key = k
    self.assertEquals(app1.bundles[0].filemap[stonexml_key], "stone/dense.xml")

    app2 = self.target("src/java/org/archimedes/volume:bathtub")
    self.assertEquals(1, len(app2.bundles))
    for k in app2.bundles[0].filemap.keys():
      if k.endswith("archimedes/volume/config/metal/dense.xml"):
        stonexml_key = k
    self.assertEquals(app2.bundles[0].filemap[stonexml_key], "config/metal/dense.xml")

  def test_globs_relative_to_build_root(self):
    self.add_to_build_file("y/BUILD", dedent("""

After Change


                     app.bundles[0].filemap)

  def test_multiple_bundles(self):
    spec_path = "src/java/org/archimedes/volume"
    stone_dense = self.create_file(os.path.join(spec_path, "config/stone/dense.xml"))
    metal_dense = self.create_file(os.path.join(spec_path, "config/metal/dense.xml"))
    unused = self.make_target(Address(spec_path, "unused").spec, JvmBinary)

    self.add_to_build_file("src/java/org/archimedes/volume/BUILD", dedent("""
      jvm_app(name="volume",
        dependencies=[":unused"],
        bundles=[
          bundle(relative_to="config", fileset="config/stone/dense.xml")
        ]
      )

      jvm_app(name="bathtub",
        dependencies=[":unused"],
        bundles=[
          bundle(fileset="config/metal/dense.xml")
        ]
      )
    """))

    app1 = self.make_target(Address(spec_path, "app1").spec,
                            JvmApp,
                            dependencies=[unused],
                            bundles=[self.create_bundle(spec_path,
                                                        relative_to="config",
                                                        fileset="config/stone/dense.xml")])

    app2 = self.make_target(Address(spec_path, "app2").spec,
                            JvmApp,
                            dependencies=[unused],
                            bundles=[self.create_bundle(spec_path,
                                                        fileset="config/metal/dense.xml")])

    self.assertEqual(1, len(app1.bundles))
    self.assertEqual({stone_dense: "stone/dense.xml"}, app1.bundles[0].filemap)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 30

Instances


Project Name: pantsbuild/pants
Commit Name: ad9f8480c8e08b95d6c217ec4a126bd93b7f376a
Time: 2015-08-31
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/jvm/targets/test_jvm_app.py
Class Name: BundleTest
Method Name: test_multiple_bundles


Project Name: pantsbuild/pants
Commit Name: ad9f8480c8e08b95d6c217ec4a126bd93b7f376a
Time: 2015-08-31
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/jvm/targets/test_jvm_app.py
Class Name: BundleTest
Method Name: test_bundle_filemap_dest_remap


Project Name: pantsbuild/pants
Commit Name: ad9f8480c8e08b95d6c217ec4a126bd93b7f376a
Time: 2015-08-31
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/jvm/targets/test_jvm_app.py
Class Name: BundleTest
Method Name: test_multiple_bundles


Project Name: pantsbuild/pants
Commit Name: ad9f8480c8e08b95d6c217ec4a126bd93b7f376a
Time: 2015-08-31
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/backend/jvm/targets/test_jvm_app.py
Class Name: BundleTest
Method Name: test_bundle_add