def test_package(qibuild_action, qimvn_action, local_repository): """ Test if Maven project is correctly built """ qibuild_action.add_test_project("hellojavajni") hellojava = qibuild_action.add_test_project("hellojava") add_repository(hellojava, local_repository) qibuild_action("configure", "hellojavajni") qibuild_action("make", "hellojavajni") jar.jar("hellojavajni.jar", ["hellojavajni"], get_paths()) deploy.deploy("com.test", "1.0-SNAPSHOT", "hellojavajni", "hellojavajni.jar", local_repository) assert package.package(hellojava) == 0 path = hellojava.path built_jar = os.path.join(path, "target/hellojava-1.0-SNAPSHOT.jar") assert os.path.exists(built_jar)
def test_failing_deploy(qibuild_action, local_repository): """ Test exceptions. """ qibuild_action.add_test_project("hellojavajni") qibuild_action("configure", "hellojavajni") qibuild_action("make", "hellojavajni") jarname = "test.jar" jarpath = jar.jar(jarname, ["hellojavajni"], get_paths()) assert jarpath deploy_path = local_repository.replace("file://", "") artifactId = "hellojavajni" ver = "1.0" # pylint: disable-msg=E1101 with pytest.raises(CommandFailedException) as e: deploy.deploy("", ver, artifactId, jarname, local_repository) assert e.value.returncode == 1 # pylint: disable-msg=E1101 with pytest.raises(CommandFailedException) as e: deploy.deploy("com.test", ver, "", jarname, local_repository) assert e.value.returncode == 1 # pylint: disable-msg=E1101 with pytest.raises(CommandFailedException) as e: deploy.deploy("com.test", ver, artifactId, jarname, deploy_path) assert e.value.returncode == 1
def test_deploy(qibuild_action, local_repository): """ Test if directory where jar must be deployed exists. """ qibuild_action.add_test_project("hellojavajni") qibuild_action("configure", "hellojavajni") qibuild_action("make", "hellojavajni") jarname = "test.jar" jarpath = jar.jar(jarname, ["hellojavajni"], get_paths()) assert jarpath deploy_path = local_repository.replace("file://", "") artifactId = "hellojavajni" ver = "1.0" assert deploy.deploy("com.test", ver, artifactId, jarname, local_repository) == 0 deploy_path = os.path.join(deploy_path, "com/test") deploy_path = os.path.join(deploy_path, artifactId) deploy_path = os.path.join(deploy_path, ver) deployed_jar = os.path.join(deploy_path, artifactId + "-" + ver + ".jar") assert os.path.exists(deployed_jar)
def do(args): """Main entry point """ return deploy.deploy(args.group_id, args.version, args.artifact_id, args.package, args.url, args.packaging)