Exemplo n.º 1
0
    def test_bundle_filemap_remap_base_not_exists(self):
        # Create directly
        with pytest.raises(DirectoryReMapper.BaseNotExistsError):
            DirectoryReMapper("dummy/src/java/org/archimedes/crown/missing",
                              "dummy")

        # Used in the BUILD
        self.create_dir('src/java/org/archimedes/crown/config')
        self.create_file('src/java/org/archimedes/crown/config/one.xml')
        self.add_to_build_file(
            'src/java/org/archimedes/crown/BUILD',
            dedent('''
      jvm_binary(name='unused')
    '''))
        self.add_to_build_file(
            'src/java/org/archimedes/crown/BUILD',
            dedent('''
      jvm_app(name='crown',
        dependencies=[':unused'],
        bundles=[
          bundle(mapper=DirectoryReMapper('src/java/org/archimedes/crown/missing', 'gold/config'), fileset='config/one.xml')
        ]
      )
    '''))

        with pytest.raises(AddressLookupError):
            self.target('src/java/org/archimedes/crown')
Exemplo n.º 2
0
  def test_bundle_filemap_dest_remap(self):
    spec_path = 'src/java/org/archimedes/crown'
    one = self.create_file(os.path.join(spec_path, 'config/one.xml'))
    unused = self.make_target(Address(spec_path, 'unused').spec, JvmBinary)

    mapper = DirectoryReMapper(os.path.join(spec_path, 'config'), 'gold/config')
    app = self.make_target(spec_path,
                           JvmApp,
                           dependencies=[unused],
                           bundles=[_bundle(spec_path)(mapper=mapper, fileset='config/one.xml')])

    self.assertEqual(1, len(app.bundles))
    self.assertEqual({one: 'gold/config/one.xml'}, app.bundles[0].filemap)
Exemplo n.º 3
0
 def test_bundle_filemap_remap_base_not_exists(self):
     # Create directly
     with self.assertRaises(DirectoryReMapper.NonexistentBaseError):
         DirectoryReMapper("dummy/src/java/org/archimedes/crown/missing",
                           "dummy")