Esempio n. 1
0
    def test_workflow_sets_up_resolvers(self):
        workflow = JavaGradleWorkflow("source", "artifacts", "scratch_dir",
                                      "manifest")

        resolvers = workflow.get_resolvers()
        self.assertEqual(len(resolvers), 1)

        self.assertIsInstance(resolvers[0], GradleResolver)
Esempio n. 2
0
    def test_workflow_sets_up_validators(self):
        workflow = JavaGradleWorkflow("source", "artifacts", "scratch_dir",
                                      "manifest")

        validators = workflow.get_validators()
        self.assertEqual(len(validators), 1)

        self.assertIsInstance(validators[0], GradleValidator)
Esempio n. 3
0
 def test_workflow_sets_up_gradle_actions(self):
     workflow = JavaGradleWorkflow("source", "artifacts", "scratch_dir",
                                   "manifest")
     self.assertEqual(len(workflow.actions), 2)
     self.assertIsInstance(workflow.actions[0], JavaGradleBuildAction)
     self.assertIsInstance(workflow.actions[1],
                           JavaGradleCopyArtifactsAction)
Esempio n. 4
0
 def test_computes_correct_build_dir(self):
     workflow = JavaGradleWorkflow("source", "artifacts", "scratch_dir",
                                   "manifest")
     sha1 = hashlib.sha1()
     sha1.update(os.path.abspath(workflow.source_dir).encode("utf8"))
     expected_build_dir = os.path.join(workflow.scratch_dir,
                                       sha1.hexdigest())
     self.assertEqual(expected_build_dir, workflow.build_output_dir)
Esempio n. 5
0
    def test_must_validate_architecture(self):
        workflow = JavaGradleWorkflow(
            "source",
            "artifacts",
            "scratch",
            "manifest",
            options={"artifact_executable_name": "foo"},
        )
        workflow_with_arm = JavaGradleWorkflow(
            "source",
            "artifacts",
            "scratch",
            "manifest",
            options={"artifact_executable_name": "foo"},
            architecture=ARM64,
        )

        self.assertEqual(workflow.architecture, "x86_64")
        self.assertEqual(workflow_with_arm.architecture, "arm64")
Esempio n. 6
0
    def test_workflow_sets_up_gradle_actions_for_layers(self):
        workflow = JavaGradleWorkflow(
            "source",
            "artifacts",
            "scratch_dir",
            "manifest",
            is_building_layer=True,
        )

        self.assertEqual(len(workflow.actions), 2)

        self.assertIsInstance(workflow.actions[0], JavaGradleBuildAction)

        self.assertIsInstance(workflow.actions[1],
                              JavaGradleCopyLayerArtifactsAction)
Esempio n. 7
0
    def test_workflow_sets_up_gradle_actions_with_combine_dependencies(self):
        workflow = JavaGradleWorkflow("source",
                                      "artifacts",
                                      "scratch_dir",
                                      "manifest",
                                      dependencies_dir="dep",
                                      combine_dependencies=True)

        self.assertEqual(len(workflow.actions), 4)

        self.assertIsInstance(workflow.actions[0], JavaGradleBuildAction)

        self.assertIsInstance(workflow.actions[1],
                              JavaGradleCopyArtifactsAction)

        self.assertIsInstance(workflow.actions[2], CleanUpAction)

        self.assertIsInstance(workflow.actions[3], JavaCopyDependenciesAction)