diff --git a/src/ploigos_step_runner/__init__.py b/src/ploigos_step_runner/__init__.py
index a091485c..9810cf4f 100644
--- a/src/ploigos_step_runner/__init__.py
+++ b/src/ploigos_step_runner/__init__.py
@@ -320,7 +320,7 @@
}
unit-test:
- - implementer: Maven
+ - implementer: MavenTest
config: {
# Optional.
# fail-on-no-tests: true
@@ -330,7 +330,7 @@
}
package:
- - implementer: Maven
+ - implementer: MavenPackage
config: {
# Optional.
#pom-file: 'pom.xml'
@@ -343,7 +343,7 @@
}
push-artifacts:
- - implementer: Maven
+ - implementer: MavenDeploy
config: {
# Required.
# URL to the artifact repository to push the artifact to.
@@ -503,7 +503,7 @@
}
uat:
- - implementer: MavenSeleniumCucumber
+ - implementer: MavenTestSeleniumCucumber
config: {}
# TODO: not yet implemented
@@ -820,7 +820,7 @@
readiness-probe-path: ''
uat:
- - implementer: MavenSeleniumCucumber
+ - implementer: MavenTestSeleniumCucumber
config: {}
# TODO: not yet implemented
diff --git a/src/ploigos_step_runner/step_implementers/package/__init__.py b/src/ploigos_step_runner/step_implementers/package/__init__.py
index f3fb78ef..347d1429 100644
--- a/src/ploigos_step_runner/step_implementers/package/__init__.py
+++ b/src/ploigos_step_runner/step_implementers/package/__init__.py
@@ -1,4 +1,5 @@
"""`StepImplementers` for the `package` step.
"""
+from ploigos_step_runner.step_implementers.package.maven_package import MavenPackage
from ploigos_step_runner.step_implementers.package.maven import Maven
diff --git a/src/ploigos_step_runner/step_implementers/package/maven.py b/src/ploigos_step_runner/step_implementers/package/maven.py
index 4e7c4fd5..a495d1b1 100644
--- a/src/ploigos_step_runner/step_implementers/package/maven.py
+++ b/src/ploigos_step_runner/step_implementers/package/maven.py
@@ -1,85 +1,16 @@
-"""`StepImplementer` for the `package` step using Maven.
-
-Notes
------
-
-.. Important::
-
- If package not specified in pom will default to jar in result.
-
-Step Configuration
-------------------
-Step configuration expected as input to this step.
-Could come from:
-
- * static configuration
- * runtime configuration
- * previous step results
-
-Configuration Key | Required? | Default | Description
------------------------------|-----------|---------|-----------
-`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
-`tls-verify` | No | `True` | Disables TLS Verification if set to False
-`maven-profiles` | No | `[]` | List of maven profiles to use.
-`maven-no-transfer-progress` | No | `True` | \
- `True` to suppress the transfer progress of packages maven downloads.
- `False` to have the transfer progress printed.\
- See https://maven.apache.org/ref/current/maven-embedder/cli.html
-`maven-additional-arguments` | No | `['-Dmaven.test.skip=true']` \
- | List of additional arguments to use. \
- Skipping tests by default because assuming \
- a previous step already ran them.
-`maven-servers` | No | | Dictionary of dictionaries of \
- id, username, password
-`maven-repositories` | No | | Dictionary of dictionaries of \
- id, url, snapshots, releases
-`maven-mirrors` | No | | Dictionary of dictionaries of \
- id, url, mirror_of
-`artifact-extensions` | Yes | `["jar", "war", "ear"]` \
- | Extensions to look for in the `artifact-parent-dir` \
- for built artifacts.
-`artifact-parent-dir` | Yes | `'target'` \
- | Parent directory to look for built artifacts in \
- ending in `artifact-extensions`.
-
-Result Artifacts
-----------------
-Results artifacts output by this step.
-
-Result Artifact Key | Description
---------------------|------------
-`maven-output` | Path to Stdout and Stderr from invoking Maven.
-`packages` | An array of dictionaries with information on the built artifacts.
-
-
-## package-artifacts
-Keys in the dictionary elements in the `package-artifacts` array in the step results.
-
-| Key | Description
-|-----------------|------------
-| `path` | Absolute path to the built artifact.
+"""DEPRECATED: use ploigos_step_runner.step_implementers.package.MavenPackage instead.
+This is an alias to MavenPackage so as to keep things backwards compatible,
+but eventually should/can will be removed.
"""
-import os
-
-from ploigos_step_runner import StepResult, StepRunnerException
-from ploigos_step_runner.step_implementers.shared.maven_generic import \
- MavenGeneric
-DEFAULT_CONFIG = {
- 'maven-additional-arguments': [
- '-Dmaven.test.skip=true'
- ],
- 'artifact-extensions': ["jar", "war", "ear"],
- 'artifact-parent-dir': 'target'
-}
+from ploigos_step_runner.step_implementers.package.maven_package import MavenPackage
-REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
- 'pom-file'
-]
+class Maven(MavenPackage):
+ """DEPRECATED: use ploigos_step_runner.step_implementers.package.MavenPackage instead.
-class Maven(MavenGeneric):
- """`StepImplementer` for the `package` step using Maven.
+ This is an alias to MavenPackage so as to keep things backwards compatible,
+ but eventually should/can will be removed.
"""
def __init__( # pylint: disable=too-many-arguments
self,
@@ -92,94 +23,7 @@ def __init__( # pylint: disable=too-many-arguments
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
- environment=environment,
- maven_phases_and_goals=['package']
+ environment=environment
)
- @staticmethod
- def step_implementer_config_defaults():
- """Getter for the StepImplementer's configuration defaults.
-
- Returns
- -------
- dict
- Default values to use for step configuration values.
-
- Notes
- -----
- These are the lowest precedence configuration values.
- """
- return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
-
- @staticmethod
- def _required_config_or_result_keys():
- """Getter for step configuration or previous step result artifacts that are required before
- running this step.
-
- See Also
- --------
- _validate_required_config_or_previous_step_result_artifact_keys
-
- Returns
- -------
- array_list
- Array of configuration keys or previous step result artifacts
- that are required before running the step.
- """
- return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
-
- def _run_step(self): # pylint: disable=too-many-locals
- """Runs the step implemented by this StepImplementer.
-
- Returns
- -------
- StepResult
- Object containing the dictionary results of this step.
- """
- step_result = StepResult.from_step_implementer(self)
-
- pom_file = self.get_value('pom-file')
- artifact_extensions = self.get_value('artifact-extensions')
- artifact_parent_dir = self.get_value('artifact-parent-dir')
-
- # package the artifacts
- mvn_output_file_path = self.write_working_file('mvn_output.txt')
- try:
- # execute maven step (params come from config)
- self._run_maven_step(
- mvn_output_file_path=mvn_output_file_path
- )
-
- # find the artifacts
- packages = []
- pom_file_dir_name = os.path.dirname(os.path.abspath(pom_file))
- artifact_parent_dir_full_path = \
- os.listdir(os.path.join(
- pom_file_dir_name,
- artifact_parent_dir))
- for filename in artifact_parent_dir_full_path:
- if any(filename.endswith(ext) for ext in artifact_extensions):
- packages += [{
- 'path': os.path.join(
- pom_file_dir_name,
- artifact_parent_dir,
- filename
- )
- }]
-
- step_result.add_artifact(
- name='packages',
- value=packages
- )
- except StepRunnerException as error:
- step_result.success = False
- step_result.message = "Error running 'maven package' to package artifacts. " \
- f"More details maybe found in 'maven-output' report artifact: {error}"
- finally:
- step_result.add_artifact(
- description="Standard out and standard error from maven.",
- name='maven-output',
- value=mvn_output_file_path
- )
-
- return step_result
+ print("DEPRECATED: use ploigos_step_runner.step_implementers.package.MavenPackage instead.")
diff --git a/src/ploigos_step_runner/step_implementers/package/maven_package.py b/src/ploigos_step_runner/step_implementers/package/maven_package.py
new file mode 100644
index 00000000..d2632977
--- /dev/null
+++ b/src/ploigos_step_runner/step_implementers/package/maven_package.py
@@ -0,0 +1,185 @@
+"""`StepImplementer` for the `package` step using Maven.
+
+Notes
+-----
+
+.. Important::
+
+ If package not specified in pom will default to jar in result.
+
+Step Configuration
+------------------
+Step configuration expected as input to this step.
+Could come from:
+
+ * static configuration
+ * runtime configuration
+ * previous step results
+
+Configuration Key | Required? | Default | Description
+-----------------------------|-----------|---------|-----------
+`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
+`tls-verify` | No | `True` | Disables TLS Verification if set to False
+`maven-profiles` | No | `[]` | List of maven profiles to use.
+`maven-no-transfer-progress` | No | `True` | \
+ `True` to suppress the transfer progress of packages maven downloads.
+ `False` to have the transfer progress printed.\
+ See https://maven.apache.org/ref/current/maven-embedder/cli.html
+`maven-additional-arguments` | No | `['-Dmaven.test.skip=true']` \
+ | List of additional arguments to use. \
+ Skipping tests by default because assuming \
+ a previous step already ran them.
+`maven-servers` | No | | Dictionary of dictionaries of \
+ id, username, password
+`maven-repositories` | No | | Dictionary of dictionaries of \
+ id, url, snapshots, releases
+`maven-mirrors` | No | | Dictionary of dictionaries of \
+ id, url, mirror_of
+`artifact-extensions` | Yes | `["jar", "war", "ear"]` \
+ | Extensions to look for in the `artifact-parent-dir` \
+ for built artifacts.
+`artifact-parent-dir` | Yes | `'target'` \
+ | Parent directory to look for built artifacts in \
+ ending in `artifact-extensions`.
+
+Result Artifacts
+----------------
+Results artifacts output by this step.
+
+Result Artifact Key | Description
+--------------------|------------
+`maven-output` | Path to Stdout and Stderr from invoking Maven.
+`packages` | An array of dictionaries with information on the built artifacts.
+
+
+## package-artifacts
+Keys in the dictionary elements in the `package-artifacts` array in the step results.
+
+| Key | Description
+|-----------------|------------
+| `path` | Absolute path to the built artifact.
+
+"""
+import os
+
+from ploigos_step_runner import StepResult, StepRunnerException
+from ploigos_step_runner.step_implementers.shared.maven_generic import \
+ MavenGeneric
+
+DEFAULT_CONFIG = {
+ 'maven-additional-arguments': [
+ '-Dmaven.test.skip=true'
+ ],
+ 'artifact-extensions': ["jar", "war", "ear"],
+ 'artifact-parent-dir': 'target'
+}
+
+REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
+ 'pom-file'
+]
+
+class MavenPackage(MavenGeneric):
+ """`StepImplementer` for the `package` step using Maven.
+ """
+ def __init__( # pylint: disable=too-many-arguments
+ self,
+ workflow_result,
+ parent_work_dir_path,
+ config,
+ environment=None
+ ):
+ super().__init__(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=environment,
+ maven_phases_and_goals=['package']
+ )
+
+ @staticmethod
+ def step_implementer_config_defaults():
+ """Getter for the StepImplementer's configuration defaults.
+
+ Returns
+ -------
+ dict
+ Default values to use for step configuration values.
+
+ Notes
+ -----
+ These are the lowest precedence configuration values.
+ """
+ return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
+
+ @staticmethod
+ def _required_config_or_result_keys():
+ """Getter for step configuration or previous step result artifacts that are required before
+ running this step.
+
+ See Also
+ --------
+ _validate_required_config_or_previous_step_result_artifact_keys
+
+ Returns
+ -------
+ array_list
+ Array of configuration keys or previous step result artifacts
+ that are required before running the step.
+ """
+ return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
+
+ def _run_step(self): # pylint: disable=too-many-locals
+ """Runs the step implemented by this StepImplementer.
+
+ Returns
+ -------
+ StepResult
+ Object containing the dictionary results of this step.
+ """
+ step_result = StepResult.from_step_implementer(self)
+
+ pom_file = self.get_value('pom-file')
+ artifact_extensions = self.get_value('artifact-extensions')
+ artifact_parent_dir = self.get_value('artifact-parent-dir')
+
+ # package the artifacts
+ mvn_output_file_path = self.write_working_file('mvn_output.txt')
+ try:
+ # execute maven step (params come from config)
+ self._run_maven_step(
+ mvn_output_file_path=mvn_output_file_path
+ )
+
+ # find the artifacts
+ packages = []
+ pom_file_dir_name = os.path.dirname(os.path.abspath(pom_file))
+ artifact_parent_dir_full_path = \
+ os.listdir(os.path.join(
+ pom_file_dir_name,
+ artifact_parent_dir))
+ for filename in artifact_parent_dir_full_path:
+ if any(filename.endswith(ext) for ext in artifact_extensions):
+ packages += [{
+ 'path': os.path.join(
+ pom_file_dir_name,
+ artifact_parent_dir,
+ filename
+ )
+ }]
+
+ step_result.add_artifact(
+ name='packages',
+ value=packages
+ )
+ except StepRunnerException as error:
+ step_result.success = False
+ step_result.message = "Error running 'maven package' to package artifacts. " \
+ f"More details maybe found in 'maven-output' report artifact: {error}"
+ finally:
+ step_result.add_artifact(
+ description="Standard out and standard error from maven.",
+ name='maven-output',
+ value=mvn_output_file_path
+ )
+
+ return step_result
diff --git a/src/ploigos_step_runner/step_implementers/push_artifacts/__init__.py b/src/ploigos_step_runner/step_implementers/push_artifacts/__init__.py
index 56a7907c..c90ad607 100644
--- a/src/ploigos_step_runner/step_implementers/push_artifacts/__init__.py
+++ b/src/ploigos_step_runner/step_implementers/push_artifacts/__init__.py
@@ -1,4 +1,5 @@
"""`StepImplementers` for the `push-artifacts` step.
"""
+from ploigos_step_runner.step_implementers.push_artifacts.maven_deploy import MavenDeploy
from ploigos_step_runner.step_implementers.push_artifacts.maven import Maven
diff --git a/src/ploigos_step_runner/step_implementers/push_artifacts/maven.py b/src/ploigos_step_runner/step_implementers/push_artifacts/maven.py
index 3061f3e7..0294b4a3 100644
--- a/src/ploigos_step_runner/step_implementers/push_artifacts/maven.py
+++ b/src/ploigos_step_runner/step_implementers/push_artifacts/maven.py
@@ -1,73 +1,16 @@
-"""`StepImplementer` for the `package` step using Maven.
+"""DEPRECATED: use ploigos_step_runner.step_implementers.push_artifacts.MavenDeploy instead.
-Step Configuration
-------------------
-Step configuration expected as input to this step.
-Could come from:
-
- * static configuration
- * runtime configuration
- * previous step results
-
-Configuration Key | Required? | Default | Description
------------------------------|-----------|---------|-----------
-`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
-`tls-verify` | No | `True` | Disables TLS Verification if set to False
-`maven-profiles` | No | `[]` | List of maven profiles to use.
-`maven-no-transfer-progress` | No | `True` | \
- `True` to suppress the transfer progress of packages maven downloads.
- `False` to have the transfer progress printed.\
- See https://maven.apache.org/ref/current/maven-embedder/cli.html
-`maven-additional-arguments` | No | `['-Dmaven.test.skip=true', \
- '-Dmaven.install.skip=true']` \
- | List of additional arguments to use. \
- Skipping tests by default because assuming \
- a previous step already ran them. \
- Skipping install backs assuming this is \
- running in an ephermal environment where \
- that would be a waist of time, and also \
- that a previous step ran `package` \
- and `push-artifacts` steps.
-`maven-servers` | No | | Dictionary of dictionaries of \
- id, username, password
-`maven-repositories` | No | | Dictionary of dictionaries of \
- id, url, snapshots, releases
-`maven-mirrors` | No | | Dictionary of dictionaries of \
- id, url, mirror_of
-`version` | Yes | | version to push
-`maven-push-artifact-repo-url` | yes | | id for the maven servers and mirrors
-`maven-push-artifact-repo-id` | Yes | | url for the maven servers and mirrors
-
-Result Artifacts
-----------------
-Results artifacts output by this step.
-
-Result Artifact Key | Description
---------------------|------------
-`push-artifacts` | An array of dictionaries with information on the pushed artifacts
+This is an alias to MavenDeploy so as to keep things backwards compatible,
+but eventually should/can will be removed.
"""
-from ploigos_step_runner import StepResult, StepRunnerException
-from ploigos_step_runner.step_implementers.shared.maven_generic import \
- MavenGeneric
-from ploigos_step_runner.utils.maven import run_maven
-
-DEFAULT_CONFIG = {
- 'maven-additional-arguments': [
- '-Dmaven.install.skip=true',
- '-Dmaven.test.skip=true'
- ]
-}
+from ploigos_step_runner.step_implementers.push_artifacts.maven_deploy import MavenDeploy
-REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
- 'pom-file',
- 'maven-push-artifact-repo-url',
- 'maven-push-artifact-repo-id',
- 'version'
-]
+class Maven(MavenDeploy):
+ """DEPRECATED: use ploigos_step_runner.step_implementers.push_artifacts.MavenDeploy instead.
-class Maven(MavenGeneric):
- """`StepImplementer` for the `push-artifacts` step using Maven.
+ This is an alias to MavenDeploy so as to keep things backwards compatible,
+ but eventually should/can will be removed.
"""
def __init__( # pylint: disable=too-many-arguments
self,
@@ -80,106 +23,10 @@ def __init__( # pylint: disable=too-many-arguments
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
- environment=environment,
- maven_phases_and_goals=['deploy']
+ environment=environment
)
- @staticmethod
- def step_implementer_config_defaults():
- """Getter for the StepImplementer's configuration defaults.
-
- Returns
- -------
- dict
- Default values to use for step configuration values.
-
- Notes
- -----
- These are the lowest precedence configuration values.
- """
- return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
-
- @staticmethod
- def _required_config_or_result_keys():
- """Getter for step configuration or previous step result artifacts that are required before
- running this step.
-
- See Also
- --------
- _validate_required_config_or_previous_step_result_artifact_keys
-
- Returns
- -------
- array_list
- Array of configuration keys or previous step result artifacts
- that are required before running the step.
- """
- return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
-
- def _run_step(self): # pylint: disable=too-many-locals
- """Runs the step implemented by this StepImplementer.
-
- Returns
- -------
- StepResult
- Object containing the dictionary results of this step.
- """
- step_result = StepResult.from_step_implementer(self)
-
- # Get config items
- maven_push_artifact_repo_id = self.get_value('maven-push-artifact-repo-id')
- maven_push_artifact_repo_url = self.get_value('maven-push-artifact-repo-url')
- version = self.get_value('version')
-
- # push the artifacts
- mvn_update_version_output_file_path = self.write_working_file('mvn_versions_set_output.txt')
- mvn_push_artifacts_output_file_path = self.write_working_file('mvn_deploy_output.txt')
- try:
- # update the version before pushing
- # NOTE 1: we know this is weird. But the version in the pom isn't necessarily
- # the version that was calculated as part of the release and so we need
- # to update that before doing the maven deploy so the maven deploy will
- # use the new version.
- #
- # NOTE 2: we tried doing this in the same command as the deploy,
- # but the pom was already loaded so even though the xml was updated
- # the deploy still used the old version, hence having to run this
- # first and independently.
- print("Update maven package version")
- run_maven(
- mvn_output_file_path=mvn_update_version_output_file_path,
- settings_file=self.maven_settings_file,
- pom_file=self.get_value('pom-file'),
- phases_and_goals=['versions:set'],
- additional_arguments=[
- f'-DnewVersion={version}'
- ]
- )
-
- # execute maven step (params come from config)
- print("Push packaged maven artifacts")
- self._run_maven_step(
- mvn_output_file_path=mvn_push_artifacts_output_file_path,
- step_implementer_additional_arguments=[
- '-DaltDeploymentRepository=' \
- f'{maven_push_artifact_repo_id}::default::{maven_push_artifact_repo_url}'
- ]
- )
- except StepRunnerException as error:
- step_result.success = False
- step_result.message = "Error running 'maven deploy' to push artifacts. " \
- f"More details maybe found in 'maven-output' report artifact: {error}"
- finally:
- step_result.add_artifact(
- description="Standard out and standard error from running maven to update version.",
- name='maven-update-version-output',
- value=mvn_update_version_output_file_path
- )
- step_result.add_artifact(
- description="Standard out and standard error from running maven to " \
- "push artifacts to repository.",
- name='maven-push-artifacts-output',
- value=mvn_push_artifacts_output_file_path
- )
-
- return step_result
+ print(
+ "DEPRECATED: use ploigos_step_runner.step_implementers.push_artifacts.MavenDeploy "
+ "instead."
+ )
diff --git a/src/ploigos_step_runner/step_implementers/push_artifacts/maven_deploy.py b/src/ploigos_step_runner/step_implementers/push_artifacts/maven_deploy.py
new file mode 100644
index 00000000..bb9801f9
--- /dev/null
+++ b/src/ploigos_step_runner/step_implementers/push_artifacts/maven_deploy.py
@@ -0,0 +1,185 @@
+"""`StepImplementer` for the `package` step using Maven.
+
+Step Configuration
+------------------
+Step configuration expected as input to this step.
+Could come from:
+
+ * static configuration
+ * runtime configuration
+ * previous step results
+
+Configuration Key | Required? | Default | Description
+-----------------------------|-----------|---------|-----------
+`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
+`tls-verify` | No | `True` | Disables TLS Verification if set to False
+`maven-profiles` | No | `[]` | List of maven profiles to use.
+`maven-no-transfer-progress` | No | `True` | \
+ `True` to suppress the transfer progress of packages maven downloads.
+ `False` to have the transfer progress printed.\
+ See https://maven.apache.org/ref/current/maven-embedder/cli.html
+`maven-additional-arguments` | No | `['-Dmaven.test.skip=true', \
+ '-Dmaven.install.skip=true']` \
+ | List of additional arguments to use. \
+ Skipping tests by default because assuming \
+ a previous step already ran them. \
+ Skipping install backs assuming this is \
+ running in an ephermal environment where \
+ that would be a waist of time, and also \
+ that a previous step ran `package` \
+ and `push-artifacts` steps.
+`maven-servers` | No | | Dictionary of dictionaries of \
+ id, username, password
+`maven-repositories` | No | | Dictionary of dictionaries of \
+ id, url, snapshots, releases
+`maven-mirrors` | No | | Dictionary of dictionaries of \
+ id, url, mirror_of
+`version` | Yes | | version to push
+`maven-push-artifact-repo-url` | yes | | id for the maven servers and mirrors
+`maven-push-artifact-repo-id` | Yes | | url for the maven servers and mirrors
+
+Result Artifacts
+----------------
+Results artifacts output by this step.
+
+Result Artifact Key | Description
+--------------------|------------
+`push-artifacts` | An array of dictionaries with information on the pushed artifacts
+"""
+
+from ploigos_step_runner import StepResult, StepRunnerException
+from ploigos_step_runner.step_implementers.shared.maven_generic import \
+ MavenGeneric
+from ploigos_step_runner.utils.maven import run_maven
+
+DEFAULT_CONFIG = {
+ 'maven-additional-arguments': [
+ '-Dmaven.install.skip=true',
+ '-Dmaven.test.skip=true'
+ ]
+}
+
+REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
+ 'pom-file',
+ 'maven-push-artifact-repo-url',
+ 'maven-push-artifact-repo-id',
+ 'version'
+]
+
+class MavenDeploy(MavenGeneric):
+ """`StepImplementer` for the `push-artifacts` step using Maven.
+ """
+ def __init__( # pylint: disable=too-many-arguments
+ self,
+ workflow_result,
+ parent_work_dir_path,
+ config,
+ environment=None
+ ):
+ super().__init__(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=environment,
+ maven_phases_and_goals=['deploy']
+ )
+
+ @staticmethod
+ def step_implementer_config_defaults():
+ """Getter for the StepImplementer's configuration defaults.
+
+ Returns
+ -------
+ dict
+ Default values to use for step configuration values.
+
+ Notes
+ -----
+ These are the lowest precedence configuration values.
+ """
+ return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
+
+ @staticmethod
+ def _required_config_or_result_keys():
+ """Getter for step configuration or previous step result artifacts that are required before
+ running this step.
+
+ See Also
+ --------
+ _validate_required_config_or_previous_step_result_artifact_keys
+
+ Returns
+ -------
+ array_list
+ Array of configuration keys or previous step result artifacts
+ that are required before running the step.
+ """
+ return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
+
+ def _run_step(self): # pylint: disable=too-many-locals
+ """Runs the step implemented by this StepImplementer.
+
+ Returns
+ -------
+ StepResult
+ Object containing the dictionary results of this step.
+ """
+ step_result = StepResult.from_step_implementer(self)
+
+ # Get config items
+ maven_push_artifact_repo_id = self.get_value('maven-push-artifact-repo-id')
+ maven_push_artifact_repo_url = self.get_value('maven-push-artifact-repo-url')
+ version = self.get_value('version')
+
+ # push the artifacts
+ mvn_update_version_output_file_path = self.write_working_file('mvn_versions_set_output.txt')
+ mvn_push_artifacts_output_file_path = self.write_working_file('mvn_deploy_output.txt')
+ try:
+ # update the version before pushing
+ # NOTE 1: we know this is weird. But the version in the pom isn't necessarily
+ # the version that was calculated as part of the release and so we need
+ # to update that before doing the maven deploy so the maven deploy will
+ # use the new version.
+ #
+ # NOTE 2: we tried doing this in the same command as the deploy,
+ # but the pom was already loaded so even though the xml was updated
+ # the deploy still used the old version, hence having to run this
+ # first and independently.
+ print("Update maven package version")
+ run_maven(
+ mvn_output_file_path=mvn_update_version_output_file_path,
+ settings_file=self.maven_settings_file,
+ pom_file=self.get_value('pom-file'),
+ phases_and_goals=['versions:set'],
+ additional_arguments=[
+ f'-DnewVersion={version}'
+ ]
+ )
+
+ # execute maven step (params come from config)
+ print("Push packaged maven artifacts")
+ self._run_maven_step(
+ mvn_output_file_path=mvn_push_artifacts_output_file_path,
+ step_implementer_additional_arguments=[
+ '-DaltDeploymentRepository=' \
+ f'{maven_push_artifact_repo_id}::default::{maven_push_artifact_repo_url}'
+ ]
+ )
+ except StepRunnerException as error:
+ step_result.success = False
+ step_result.message = "Error running 'maven deploy' to push artifacts. " \
+ f"More details maybe found in 'maven-output' report artifact: {error}"
+ finally:
+ step_result.add_artifact(
+ description="Standard out and standard error from running maven to update version.",
+ name='maven-update-version-output',
+ value=mvn_update_version_output_file_path
+ )
+ step_result.add_artifact(
+ description="Standard out and standard error from running maven to " \
+ "push artifacts to repository.",
+ name='maven-push-artifacts-output',
+ value=mvn_push_artifacts_output_file_path
+ )
+
+ return step_result
diff --git a/src/ploigos_step_runner/step_implementers/uat/__init__.py b/src/ploigos_step_runner/step_implementers/uat/__init__.py
index edcefb6c..d541f3ed 100644
--- a/src/ploigos_step_runner/step_implementers/uat/__init__.py
+++ b/src/ploigos_step_runner/step_implementers/uat/__init__.py
@@ -1,4 +1,7 @@
"""`StepImplementers` for the `uat` (User Acceptance Tests) step.
"""
-from ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber import MavenSeleniumCucumber
+from ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber import \
+ MavenTestSeleniumCucumber
+from ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber import \
+ MavenSeleniumCucumber
diff --git a/src/ploigos_step_runner/step_implementers/uat/maven_selenium_cucumber.py b/src/ploigos_step_runner/step_implementers/uat/maven_selenium_cucumber.py
index 36f44272..65fb9d62 100644
--- a/src/ploigos_step_runner/step_implementers/uat/maven_selenium_cucumber.py
+++ b/src/ploigos_step_runner/step_implementers/uat/maven_selenium_cucumber.py
@@ -1,84 +1,18 @@
-"""`StepImplementer` for the `uat` step using Maven driving Selenium generating Cucumber reports.
+"""DEPRECATED: use ploigos_step_runner.step_implementers.uat.MavenTestSeleniumCucumber instead.
-Step Configuration
-------------------
-Step configuration expected as input to this step.
-Could come from:
-* static configuration
-* runtime configuration
-* previous step results
-
-Configuration Key | Required? | Default | Description
------------------------------|-----------|---------|------------
-`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
-`tls-verify` | No | `True` | Disables TLS Verification if set to False
-`maven-profiles` | No | `['integration-test']` \
- | \
- List of maven profiles to use. \
- Typically user acceptance tests are executed \
- using a specific profile using `maven test`. \
- If your user acceptance tests are run \
- differently look to use \
- `ploigos_step_runner.step_implementers.shared.MavenGeneric` \
- instead.
-`maven-no-transfer-progress` | No | `True` | \
- `True` to suppress the transfer progress of packages maven downloads.
- `False` to have the transfer progress printed.\
- See https://maven.apache.org/ref/current/maven-embedder/cli.html
-`maven-additional-arguments` | No | `[]` | List of additional arguments to use.
-`maven-servers` | No | | Dictionary of dictionaries of \
- id, username, password
-`maven-repositories` | No | | Dictionary of dictionaries of \
- id, url, snapshots, releases
-`maven-mirrors` | No | | Dictionary of dictionaries of \
- id, url, mirror_of
-`fail-on-no-tests` | Yes | `True ` | `True` to fail if there are not tests to run. \
- `False` to ignore if there are no tests to run.
-`selenium-hub-url` | Yes | | URL where the Selenium Hub is running
-`target-host-url` | Maybe | | Target host URL for UAT. \
-
\
- If not given then use first host url from \
- `deployed-host-urls`.
-`deployed-host-urls` | Maybe | | Deployed host URLs. If `target-host-url` \
- is not given then use first URL from this \
- list. If `target-host-url` is given then \
- ignore this value.
-
-Result Artifacts
-----------------
-Results artifacts output by this step.
-
-Result Artifact Key | Description
------------------------|------------
-`maven-output` | Path to Stdout and Stderr from invoking Maven.
-`surefire-reports` | Path to Surefire reports generated by Maven.
-`cucumber-report-html` | Path to Cucumber HTML report generated by Maven.
-`cucumber-report-json` | Path to Cucumber JSON report generated by Maven.
+This is an alias to MavenSeleniumCucumber so as to keep things backwards compatible,
+but eventually should/can will be removed.
"""
-import os
-
-from ploigos_step_runner import StepResult
-from ploigos_step_runner.exceptions import StepRunnerException
-from ploigos_step_runner.step_implementers.shared.maven_generic import \
- MavenGeneric
-from ploigos_step_runner.utils.xml import \
- aggregate_xml_element_attribute_values
+from ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber import \
+ MavenTestSeleniumCucumber
-DEFAULT_CONFIG = {
- 'maven-profiles': ['integration-test'],
- 'fail-on-no-tests': True
-}
-REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
- 'pom-file',
- 'fail-on-no-tests',
- 'selenium-hub-url',
-]
+class MavenSeleniumCucumber(MavenTestSeleniumCucumber):
+ """DEPRECATED: use ploigos_step_runner.step_implementers.uat.MavenTestSeleniumCucumber instead.
-class MavenSeleniumCucumber(MavenGeneric):
- """`StepImplementer` for the `uat` step using Maven driving Selenium generating
- Cucumber reports.
+ This is an alias to MavenSeleniumCucumber so as to keep things backwards compatible,
+ but eventually should/can will be removed.
"""
def __init__( # pylint: disable=too-many-arguments
self,
@@ -91,210 +25,10 @@ def __init__( # pylint: disable=too-many-arguments
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
- environment=environment,
- maven_phases_and_goals=['test']
+ environment=environment
)
- @staticmethod
- def step_implementer_config_defaults():
- """Getter for the StepImplementer's configuration defaults.
-
- Returns
- -------
- dict
- Default values to use for step configuration values.
-
- Notes
- -----
- These are the lowest precedence configuration values.
- """
- return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
-
- @staticmethod
- def _required_config_or_result_keys():
- """Getter for step configuration or previous step result artifacts that are required before
- running this step.
-
- See Also
- --------
- _validate_required_config_or_previous_step_result_artifact_keys
-
- Returns
- -------
- array_list
- Array of configuration keys or previous step result artifacts
- that are required before running the step.
- """
- return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
-
- def _validate_required_config_or_previous_step_result_artifact_keys(self):
- """Validates that the required configuration keys or previous step result artifacts
- are set and have valid values.
-
- Validates that:
- * required configuration is given
- * either target-host-url or deployed-host-urls is given
-
- Raises
- ------
- StepRunnerException
- If step configuration or previous step result artifacts have invalid required values
- """
- super()._validate_required_config_or_previous_step_result_artifact_keys()
-
- # target-host-url or deployed-host-urls must be supplied
- target_host_url = self.get_value('target-host-url')
- deployed_host_urls = self.get_value('deployed-host-urls')
- if (not target_host_url) and (not deployed_host_urls):
- raise StepRunnerException(
- "Either 'target-host-url' or 'deployed-host-urls' needs to be supplied but"
- " neither were."
- )
-
- def _run_step(self): # pylint: disable=too-many-locals,too-many-statements,too-many-branches
- """Runs the step implemented by this StepImplementer.
-
- Returns
- -------
- StepResult
- Object containing the dictionary results of this step.
- """
- step_result = StepResult.from_step_implementer(self)
-
- pom_file = self.get_value('pom-file')
- fail_on_no_tests = self.get_value('fail-on-no-tests')
- selenium_hub_url = self.get_value('selenium-hub-url')
- deployed_host_urls = self.get_value('deployed-host-urls')
- maven_profiles = self.get_value('maven-profiles')
-
- # NOTE:
- # at some point may need to do smarter logic if a deployable has more then one deployed
- # host URL to do UAT against all of them, but for now, use first one as target of UAT
- if isinstance(deployed_host_urls, list):
- target_base_url = deployed_host_urls[0]
- if len(deployed_host_urls) > 1:
- step_result.message = \
- f"Given more then one deployed host URL ({deployed_host_urls})," \
- f" targeting first one ({target_base_url}) for user acceptance test (UAT)."
- print(step_result.message)
- elif deployed_host_urls:
- target_base_url = deployed_host_urls
- else:
- target_base_url = self.get_value('target-host-url')
-
- # ensure surefire plugin enabled
- maven_surefire_plugin = self._get_effective_pom_element(
- element_path=MavenGeneric.SUREFIRE_PLUGIN_XML_ELEMENT_PATH
+ print(
+ "DEPRECATED: use ploigos_step_runner.step_implementers.uat.MavenTestSeleniumCucumber "
+ "instead."
)
- if maven_surefire_plugin is None:
- step_result.success = False
- step_result.message = 'Unit test dependency "maven-surefire-plugin" ' \
- f'missing from effective pom ({self._get_effective_pom()}).'
- return step_result
-
- # get surefire test results dir
- reports_dir = self._get_effective_pom_element(
- element_path=MavenGeneric.SUREFIRE_PLUGIN_REPORTS_DIR_XML_ELEMENT_PATH
- )
- if reports_dir is not None:
- if os.path.isabs(reports_dir.text):
- test_results_dir = reports_dir.text
- else:
- test_results_dir = os.path.join(
- os.path.dirname(os.path.abspath(pom_file)),
- reports_dir.text
- )
- else:
- test_results_dir = os.path.join(
- os.path.dirname(os.path.abspath(pom_file)),
- MavenGeneric.DEFAULT_SUREFIRE_PLUGIN_REPORTS_DIR
- )
-
- cucumber_html_report_path = os.path.join(self.work_dir_path, 'cucumber.html')
- cucumber_json_report_path = os.path.join(self.work_dir_path, 'cucumber.json')
- mvn_output_file_path = self.write_working_file('mvn_test_output.txt')
- try:
- # execute maven step (params come from config)
- self._run_maven_step(
- mvn_output_file_path=mvn_output_file_path,
- step_implementer_additional_arguments=[
- f'-Dselenium.hub.url={selenium_hub_url}',
- f'-Dtarget.base.url={target_base_url}',
- f'-Dcucumber.plugin=' \
- f'html:{cucumber_html_report_path},' \
- f'json:{cucumber_json_report_path}',
- ]
- )
-
- # if not results
- # else add evidence of results
- if not os.path.isdir(test_results_dir) or len(os.listdir(test_results_dir)) == 0:
- if fail_on_no_tests:
- step_result.message = "No user acceptance tests defined" \
- f" using maven profile ({maven_profiles})."
- step_result.success = False
- else:
- step_result.message = "No user acceptance tests defined" \
- f" using maven profile ({maven_profiles})," \
- " but 'fail-on-no-tests' is False."
- else:
- attribs = ["time", "tests", "errors", "skipped", "failures"]
- xml_element = "testsuite"
-
- report_results = aggregate_xml_element_attribute_values(
- test_results_dir,
- xml_element,
- attribs
- )
-
- not_found_attribs = []
- for attrib in attribs:
- if attrib in report_results:
- step_result.add_evidence(
- description="Surefire report value for " + attrib,
- name="uat-evidence-" + attrib,
- value=report_results[attrib]
- )
- else:
- not_found_attribs.append(attrib)
-
- if not_found_attribs:
- #NOTE: not sure if this should be a failure or just a warning...
- raise ValueError(
- "Error gathering evidence from "\
- f"surefire report, expected attribute(s) ({not_found_attribs}) "\
- f"not found in report ({test_results_dir})"
- )
-
- except StepRunnerException as error:
- step_result.success = False
- step_result.message = "Error running 'maven test' to run user acceptance tests. " \
- "More details maybe found in 'maven-output', `surefire-reports`, " \
- "`cucumber-report-html`, and `cucumber-report-json` " \
- f"report artifact: {error}"
- except ValueError as error:
- step_result.message = str(error)
- step_result.success = False
- finally:
- step_result.add_artifact(
- description="Standard out and standard error from maven.",
- name='maven-output',
- value=mvn_output_file_path
- )
- step_result.add_artifact(
- description="Surefire reports generated by maven.",
- name='surefire-reports',
- value=test_results_dir
- )
- step_result.add_artifact(
- description="Cucumber (HTML) report generated by maven.",
- name='cucumber-report-html',
- value=cucumber_html_report_path
- )
- step_result.add_artifact(
- description="Cucumber (JSON) report generated by maven.",
- name='cucumber-report-json',
- value=cucumber_json_report_path
- )
-
- return step_result
diff --git a/src/ploigos_step_runner/step_implementers/uat/maven_test_selenium_cucumber.py b/src/ploigos_step_runner/step_implementers/uat/maven_test_selenium_cucumber.py
new file mode 100644
index 00000000..693c66b0
--- /dev/null
+++ b/src/ploigos_step_runner/step_implementers/uat/maven_test_selenium_cucumber.py
@@ -0,0 +1,300 @@
+"""`StepImplementer` for the `uat` step using Maven driving Selenium generating Cucumber reports.
+
+Step Configuration
+------------------
+Step configuration expected as input to this step.
+Could come from:
+* static configuration
+* runtime configuration
+* previous step results
+
+Configuration Key | Required? | Default | Description
+-----------------------------|-----------|---------|------------
+`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
+`tls-verify` | No | `True` | Disables TLS Verification if set to False
+`maven-profiles` | No | `['integration-test']` \
+ | \
+ List of maven profiles to use. \
+ Typically user acceptance tests are executed \
+ using a specific profile using `maven test`. \
+ If your user acceptance tests are run \
+ differently look to use \
+ `ploigos_step_runner.step_implementers.shared.MavenGeneric` \
+ instead.
+`maven-no-transfer-progress` | No | `True` | \
+ `True` to suppress the transfer progress of packages maven downloads.
+ `False` to have the transfer progress printed.\
+ See https://maven.apache.org/ref/current/maven-embedder/cli.html
+`maven-additional-arguments` | No | `[]` | List of additional arguments to use.
+`maven-servers` | No | | Dictionary of dictionaries of \
+ id, username, password
+`maven-repositories` | No | | Dictionary of dictionaries of \
+ id, url, snapshots, releases
+`maven-mirrors` | No | | Dictionary of dictionaries of \
+ id, url, mirror_of
+`fail-on-no-tests` | Yes | `True ` | `True` to fail if there are not tests to run. \
+ `False` to ignore if there are no tests to run.
+`selenium-hub-url` | Yes | | URL where the Selenium Hub is running
+`target-host-url` | Maybe | | Target host URL for UAT. \
+
\
+ If not given then use first host url from \
+ `deployed-host-urls`.
+`deployed-host-urls` | Maybe | | Deployed host URLs. If `target-host-url` \
+ is not given then use first URL from this \
+ list. If `target-host-url` is given then \
+ ignore this value.
+
+Result Artifacts
+----------------
+Results artifacts output by this step.
+
+Result Artifact Key | Description
+-----------------------|------------
+`maven-output` | Path to Stdout and Stderr from invoking Maven.
+`surefire-reports` | Path to Surefire reports generated by Maven.
+`cucumber-report-html` | Path to Cucumber HTML report generated by Maven.
+`cucumber-report-json` | Path to Cucumber JSON report generated by Maven.
+"""
+
+import os
+
+from ploigos_step_runner import StepResult
+from ploigos_step_runner.exceptions import StepRunnerException
+from ploigos_step_runner.step_implementers.shared.maven_generic import \
+ MavenGeneric
+from ploigos_step_runner.utils.xml import \
+ aggregate_xml_element_attribute_values
+
+DEFAULT_CONFIG = {
+ 'maven-profiles': ['integration-test'],
+ 'fail-on-no-tests': True
+}
+
+REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
+ 'pom-file',
+ 'fail-on-no-tests',
+ 'selenium-hub-url',
+]
+
+class MavenTestSeleniumCucumber(MavenGeneric):
+ """`StepImplementer` for the `uat` step using Maven driving Selenium generating
+ Cucumber reports.
+ """
+ def __init__( # pylint: disable=too-many-arguments
+ self,
+ workflow_result,
+ parent_work_dir_path,
+ config,
+ environment=None
+ ):
+ super().__init__(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=environment,
+ maven_phases_and_goals=['test']
+ )
+
+ @staticmethod
+ def step_implementer_config_defaults():
+ """Getter for the StepImplementer's configuration defaults.
+
+ Returns
+ -------
+ dict
+ Default values to use for step configuration values.
+
+ Notes
+ -----
+ These are the lowest precedence configuration values.
+ """
+ return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
+
+ @staticmethod
+ def _required_config_or_result_keys():
+ """Getter for step configuration or previous step result artifacts that are required before
+ running this step.
+
+ See Also
+ --------
+ _validate_required_config_or_previous_step_result_artifact_keys
+
+ Returns
+ -------
+ array_list
+ Array of configuration keys or previous step result artifacts
+ that are required before running the step.
+ """
+ return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
+
+ def _validate_required_config_or_previous_step_result_artifact_keys(self):
+ """Validates that the required configuration keys or previous step result artifacts
+ are set and have valid values.
+
+ Validates that:
+ * required configuration is given
+ * either target-host-url or deployed-host-urls is given
+
+ Raises
+ ------
+ StepRunnerException
+ If step configuration or previous step result artifacts have invalid required values
+ """
+ super()._validate_required_config_or_previous_step_result_artifact_keys()
+
+ # target-host-url or deployed-host-urls must be supplied
+ target_host_url = self.get_value('target-host-url')
+ deployed_host_urls = self.get_value('deployed-host-urls')
+ if (not target_host_url) and (not deployed_host_urls):
+ raise StepRunnerException(
+ "Either 'target-host-url' or 'deployed-host-urls' needs to be supplied but"
+ " neither were."
+ )
+
+ def _run_step(self): # pylint: disable=too-many-locals,too-many-statements,too-many-branches
+ """Runs the step implemented by this StepImplementer.
+
+ Returns
+ -------
+ StepResult
+ Object containing the dictionary results of this step.
+ """
+ step_result = StepResult.from_step_implementer(self)
+
+ pom_file = self.get_value('pom-file')
+ fail_on_no_tests = self.get_value('fail-on-no-tests')
+ selenium_hub_url = self.get_value('selenium-hub-url')
+ deployed_host_urls = self.get_value('deployed-host-urls')
+ maven_profiles = self.get_value('maven-profiles')
+
+ # NOTE:
+ # at some point may need to do smarter logic if a deployable has more then one deployed
+ # host URL to do UAT against all of them, but for now, use first one as target of UAT
+ if isinstance(deployed_host_urls, list):
+ target_base_url = deployed_host_urls[0]
+ if len(deployed_host_urls) > 1:
+ step_result.message = \
+ f"Given more then one deployed host URL ({deployed_host_urls})," \
+ f" targeting first one ({target_base_url}) for user acceptance test (UAT)."
+ print(step_result.message)
+ elif deployed_host_urls:
+ target_base_url = deployed_host_urls
+ else:
+ target_base_url = self.get_value('target-host-url')
+
+ # ensure surefire plugin enabled
+ maven_surefire_plugin = self._get_effective_pom_element(
+ element_path=MavenGeneric.SUREFIRE_PLUGIN_XML_ELEMENT_PATH
+ )
+ if maven_surefire_plugin is None:
+ step_result.success = False
+ step_result.message = 'Unit test dependency "maven-surefire-plugin" ' \
+ f'missing from effective pom ({self._get_effective_pom()}).'
+ return step_result
+
+ # get surefire test results dir
+ reports_dir = self._get_effective_pom_element(
+ element_path=MavenGeneric.SUREFIRE_PLUGIN_REPORTS_DIR_XML_ELEMENT_PATH
+ )
+ if reports_dir is not None:
+ if os.path.isabs(reports_dir.text):
+ test_results_dir = reports_dir.text
+ else:
+ test_results_dir = os.path.join(
+ os.path.dirname(os.path.abspath(pom_file)),
+ reports_dir.text
+ )
+ else:
+ test_results_dir = os.path.join(
+ os.path.dirname(os.path.abspath(pom_file)),
+ MavenGeneric.DEFAULT_SUREFIRE_PLUGIN_REPORTS_DIR
+ )
+
+ cucumber_html_report_path = os.path.join(self.work_dir_path, 'cucumber.html')
+ cucumber_json_report_path = os.path.join(self.work_dir_path, 'cucumber.json')
+ mvn_output_file_path = self.write_working_file('mvn_test_output.txt')
+ try:
+ # execute maven step (params come from config)
+ self._run_maven_step(
+ mvn_output_file_path=mvn_output_file_path,
+ step_implementer_additional_arguments=[
+ f'-Dselenium.hub.url={selenium_hub_url}',
+ f'-Dtarget.base.url={target_base_url}',
+ f'-Dcucumber.plugin=' \
+ f'html:{cucumber_html_report_path},' \
+ f'json:{cucumber_json_report_path}',
+ ]
+ )
+
+ # if not results
+ # else add evidence of results
+ if not os.path.isdir(test_results_dir) or len(os.listdir(test_results_dir)) == 0:
+ if fail_on_no_tests:
+ step_result.message = "No user acceptance tests defined" \
+ f" using maven profile ({maven_profiles})."
+ step_result.success = False
+ else:
+ step_result.message = "No user acceptance tests defined" \
+ f" using maven profile ({maven_profiles})," \
+ " but 'fail-on-no-tests' is False."
+ else:
+ attribs = ["time", "tests", "errors", "skipped", "failures"]
+ xml_element = "testsuite"
+
+ report_results = aggregate_xml_element_attribute_values(
+ test_results_dir,
+ xml_element,
+ attribs
+ )
+
+ not_found_attribs = []
+ for attrib in attribs:
+ if attrib in report_results:
+ step_result.add_evidence(
+ description="Surefire report value for " + attrib,
+ name="uat-evidence-" + attrib,
+ value=report_results[attrib]
+ )
+ else:
+ not_found_attribs.append(attrib)
+
+ if not_found_attribs:
+ #NOTE: not sure if this should be a failure or just a warning...
+ raise ValueError(
+ "Error gathering evidence from "\
+ f"surefire report, expected attribute(s) ({not_found_attribs}) "\
+ f"not found in report ({test_results_dir})"
+ )
+
+ except StepRunnerException as error:
+ step_result.success = False
+ step_result.message = "Error running 'maven test' to run user acceptance tests. " \
+ "More details maybe found in 'maven-output', `surefire-reports`, " \
+ "`cucumber-report-html`, and `cucumber-report-json` " \
+ f"report artifact: {error}"
+ except ValueError as error:
+ step_result.message = str(error)
+ step_result.success = False
+ finally:
+ step_result.add_artifact(
+ description="Standard out and standard error from maven.",
+ name='maven-output',
+ value=mvn_output_file_path
+ )
+ step_result.add_artifact(
+ description="Surefire reports generated by maven.",
+ name='surefire-reports',
+ value=test_results_dir
+ )
+ step_result.add_artifact(
+ description="Cucumber (HTML) report generated by maven.",
+ name='cucumber-report-html',
+ value=cucumber_html_report_path
+ )
+ step_result.add_artifact(
+ description="Cucumber (JSON) report generated by maven.",
+ name='cucumber-report-json',
+ value=cucumber_json_report_path
+ )
+
+ return step_result
diff --git a/src/ploigos_step_runner/step_implementers/unit_test/__init__.py b/src/ploigos_step_runner/step_implementers/unit_test/__init__.py
index efd857fa..caa1d53a 100644
--- a/src/ploigos_step_runner/step_implementers/unit_test/__init__.py
+++ b/src/ploigos_step_runner/step_implementers/unit_test/__init__.py
@@ -1,3 +1,4 @@
"""`StepImplementers` for the `unit-test` step.
"""
+from ploigos_step_runner.step_implementers.unit_test.maven_test import MavenTest
from ploigos_step_runner.step_implementers.unit_test.maven import Maven
diff --git a/src/ploigos_step_runner/step_implementers/unit_test/maven.py b/src/ploigos_step_runner/step_implementers/unit_test/maven.py
index f5f5879b..b797c7b2 100644
--- a/src/ploigos_step_runner/step_implementers/unit_test/maven.py
+++ b/src/ploigos_step_runner/step_implementers/unit_test/maven.py
@@ -1,58 +1,16 @@
-"""`StepImplementer` for the `unit-test` step using Maven with Surefire plugin.
+"""DEPRECATED: use ploigos_step_runner.step_implementers.unit_test.MavenTest instead.
-Step Configuration
-------------------
-Step configuration expected as input to this step.
-Could come from:
-* static configuration
-* runtime configuration
-* previous step results
-
-Configuration Key | Required? | Default | Description
------------------------------|-----------|---------|-----------
-`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
-`tls-verify` | No | `True` | Disables TLS Verification if set to False
-`maven-profiles` | No | `[]` | List of maven profiles to use.
-`maven-no-transfer-progress` | No | `True` | \
- `True` to suppress the transfer progress of packages maven downloads.
- `False` to have the transfer progress printed.\
- See https://maven.apache.org/ref/current/maven-embedder/cli.html
-`maven-additional-arguments` | No | `[]` | List of additional arguments to use.
-`maven-servers` | No | | Dictionary of dictionaries of \
- id, username, password
-`maven-repositories` | No | | Dictionary of dictionaries of \
- id, url, snapshots, releases
-`maven-mirrors` | No | | Dictionary of dictionaries of \
- id, url, mirror_of
-`fail-on-no-tests` | Yes | `True ` | `True` to fail if there are not tests to run. \
- `False` to ignore if there are no tests to run.
-
-Result Artifacts
-----------------
-Results artifacts output by this step.
-
-Result Artifact Key | Description
---------------------|------------
-`maven-output` | Path to Stdout and Stderr from invoking Maven.
-`surefile-reports` | Path to Surefire reports generated from invoking Maven.
+This is an alias to MavenTest so as to keep things backwards compatible,
+but eventually should/can will be removed.
"""
-import os
-from ploigos_step_runner import StepResult, StepRunnerException
-from ploigos_step_runner.step_implementers.shared.maven_generic import \
- MavenGeneric
+from ploigos_step_runner.step_implementers.unit_test.maven_test import MavenTest
-DEFAULT_CONFIG = {
- 'fail-on-no-tests': True
-}
+class Maven(MavenTest):
+ """DEPRECATED: use ploigos_step_runner.step_implementers.unit_test.MavenTest instead.
-REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
- 'pom-file',
- 'fail-on-no-tests'
-]
-
-class Maven(MavenGeneric):
- """`StepImplementer` for the `unit-test` step using Maven with Surefire plugin.
+ This is an alias to MavenTest so as to keep things backwards compatible,
+ but eventually should/can will be removed.
"""
def __init__( # pylint: disable=too-many-arguments
self,
@@ -65,114 +23,7 @@ def __init__( # pylint: disable=too-many-arguments
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
- environment=environment,
- maven_phases_and_goals=['test']
+ environment=environment
)
- @staticmethod
- def step_implementer_config_defaults():
- """Getter for the StepImplementer's configuration defaults.
-
- Returns
- -------
- dict
- Default values to use for step configuration values.
-
- Notes
- -----
- These are the lowest precedence configuration values.
- """
- return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
-
- @staticmethod
- def _required_config_or_result_keys():
- """Getter for step configuration or previous step result artifacts that are required before
- running this step.
-
- See Also
- --------
- _validate_required_config_or_previous_step_result_artifact_keys
-
- Returns
- -------
- array_list
- Array of configuration keys or previous step result artifacts
- that are required before running the step.
- """
- return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
-
- def _run_step(self):
- """Runs the step implemented by this StepImplementer.
-
- Returns
- -------
- StepResult
- Object containing the dictionary results of this step.
- """
- step_result = StepResult.from_step_implementer(self)
-
- pom_file = self.get_value('pom-file')
- fail_on_no_tests = self.get_value('fail-on-no-tests')
-
- # ensure surefire plugin enabled
- # NOTE: should this really be hard requirement?
- maven_surefire_plugin = self._get_effective_pom_element(
- element_path=MavenGeneric.SUREFIRE_PLUGIN_XML_ELEMENT_PATH
- )
- if maven_surefire_plugin is None:
- step_result.success = False
- step_result.message = 'Unit test dependency "maven-surefire-plugin" ' \
- f'missing from effective pom ({self._get_effective_pom()}).'
- return step_result
-
- # get surefire test results dir
- reports_dir = self._get_effective_pom_element(
- element_path=MavenGeneric.SUREFIRE_PLUGIN_REPORTS_DIR_XML_ELEMENT_PATH
- )
- if reports_dir is not None:
- if os.path.isabs(reports_dir.text):
- test_results_dir = reports_dir.text
- else:
- test_results_dir = os.path.join(
- os.path.dirname(os.path.abspath(pom_file)),
- reports_dir.text
- )
- else:
- test_results_dir = os.path.join(
- os.path.dirname(os.path.abspath(pom_file)),
- MavenGeneric.DEFAULT_SUREFIRE_PLUGIN_REPORTS_DIR
- )
-
- # run the tests
- mvn_output_file_path = self.write_working_file('mvn_output.txt')
- try:
- # execute maven step (params come from config)
- self._run_maven_step(
- mvn_output_file_path=mvn_output_file_path
- )
-
- # check if any tests were run
- if not os.path.isdir(test_results_dir) or len(os.listdir(test_results_dir)) == 0:
- if fail_on_no_tests:
- step_result.message = 'No unit tests defined.'
- step_result.success = False
- else:
- step_result.message = "No unit tests defined, but 'fail-on-no-tests' is False."
- except StepRunnerException as error:
- step_result.success = False
- step_result.message = "Error running 'maven test' to run unit tests. " \
- "More details maybe found in 'maven-output' and `surefire-reports` " \
- f"report artifact: {error}"
- finally:
- step_result.add_artifact(
- description="Standard out and standard error from maven.",
- name='maven-output',
- value=mvn_output_file_path
- )
- step_result.add_artifact(
- description="Surefire reports generated by maven.",
- name='surefire-reports',
- value=test_results_dir
- )
-
- return step_result
+ print("DEPRECATED: use ploigos_step_runner.step_implementers.unit_test.MavenTest instead.")
diff --git a/src/ploigos_step_runner/step_implementers/unit_test/maven_test.py b/src/ploigos_step_runner/step_implementers/unit_test/maven_test.py
new file mode 100644
index 00000000..c67cd403
--- /dev/null
+++ b/src/ploigos_step_runner/step_implementers/unit_test/maven_test.py
@@ -0,0 +1,178 @@
+"""`StepImplementer` for the `unit-test` step using Maven with Surefire plugin.
+
+Step Configuration
+------------------
+Step configuration expected as input to this step.
+Could come from:
+* static configuration
+* runtime configuration
+* previous step results
+
+Configuration Key | Required? | Default | Description
+-----------------------------|-----------|---------|-----------
+`pom-file` | Yes | `'pom.xml'` | pom used when executing maven.
+`tls-verify` | No | `True` | Disables TLS Verification if set to False
+`maven-profiles` | No | `[]` | List of maven profiles to use.
+`maven-no-transfer-progress` | No | `True` | \
+ `True` to suppress the transfer progress of packages maven downloads.
+ `False` to have the transfer progress printed.\
+ See https://maven.apache.org/ref/current/maven-embedder/cli.html
+`maven-additional-arguments` | No | `[]` | List of additional arguments to use.
+`maven-servers` | No | | Dictionary of dictionaries of \
+ id, username, password
+`maven-repositories` | No | | Dictionary of dictionaries of \
+ id, url, snapshots, releases
+`maven-mirrors` | No | | Dictionary of dictionaries of \
+ id, url, mirror_of
+`fail-on-no-tests` | Yes | `True ` | `True` to fail if there are not tests to run. \
+ `False` to ignore if there are no tests to run.
+
+Result Artifacts
+----------------
+Results artifacts output by this step.
+
+Result Artifact Key | Description
+--------------------|------------
+`maven-output` | Path to Stdout and Stderr from invoking Maven.
+`surefile-reports` | Path to Surefire reports generated from invoking Maven.
+"""
+import os
+
+from ploigos_step_runner import StepResult, StepRunnerException
+from ploigos_step_runner.step_implementers.shared.maven_generic import \
+ MavenGeneric
+
+DEFAULT_CONFIG = {
+ 'fail-on-no-tests': True
+}
+
+REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS = [
+ 'pom-file',
+ 'fail-on-no-tests'
+]
+
+class MavenTest(MavenGeneric):
+ """`StepImplementer` for the `unit-test` step using Maven with Surefire plugin.
+ """
+ def __init__( # pylint: disable=too-many-arguments
+ self,
+ workflow_result,
+ parent_work_dir_path,
+ config,
+ environment=None
+ ):
+ super().__init__(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=environment,
+ maven_phases_and_goals=['test']
+ )
+
+ @staticmethod
+ def step_implementer_config_defaults():
+ """Getter for the StepImplementer's configuration defaults.
+
+ Returns
+ -------
+ dict
+ Default values to use for step configuration values.
+
+ Notes
+ -----
+ These are the lowest precedence configuration values.
+ """
+ return {**MavenGeneric.step_implementer_config_defaults(), **DEFAULT_CONFIG}
+
+ @staticmethod
+ def _required_config_or_result_keys():
+ """Getter for step configuration or previous step result artifacts that are required before
+ running this step.
+
+ See Also
+ --------
+ _validate_required_config_or_previous_step_result_artifact_keys
+
+ Returns
+ -------
+ array_list
+ Array of configuration keys or previous step result artifacts
+ that are required before running the step.
+ """
+ return REQUIRED_CONFIG_OR_PREVIOUS_STEP_RESULT_ARTIFACT_KEYS
+
+ def _run_step(self):
+ """Runs the step implemented by this StepImplementer.
+
+ Returns
+ -------
+ StepResult
+ Object containing the dictionary results of this step.
+ """
+ step_result = StepResult.from_step_implementer(self)
+
+ pom_file = self.get_value('pom-file')
+ fail_on_no_tests = self.get_value('fail-on-no-tests')
+
+ # ensure surefire plugin enabled
+ # NOTE: should this really be hard requirement?
+ maven_surefire_plugin = self._get_effective_pom_element(
+ element_path=MavenGeneric.SUREFIRE_PLUGIN_XML_ELEMENT_PATH
+ )
+ if maven_surefire_plugin is None:
+ step_result.success = False
+ step_result.message = 'Unit test dependency "maven-surefire-plugin" ' \
+ f'missing from effective pom ({self._get_effective_pom()}).'
+ return step_result
+
+ # get surefire test results dir
+ reports_dir = self._get_effective_pom_element(
+ element_path=MavenGeneric.SUREFIRE_PLUGIN_REPORTS_DIR_XML_ELEMENT_PATH
+ )
+ if reports_dir is not None:
+ if os.path.isabs(reports_dir.text):
+ test_results_dir = reports_dir.text
+ else:
+ test_results_dir = os.path.join(
+ os.path.dirname(os.path.abspath(pom_file)),
+ reports_dir.text
+ )
+ else:
+ test_results_dir = os.path.join(
+ os.path.dirname(os.path.abspath(pom_file)),
+ MavenGeneric.DEFAULT_SUREFIRE_PLUGIN_REPORTS_DIR
+ )
+
+ # run the tests
+ mvn_output_file_path = self.write_working_file('mvn_output.txt')
+ try:
+ # execute maven step (params come from config)
+ self._run_maven_step(
+ mvn_output_file_path=mvn_output_file_path
+ )
+
+ # check if any tests were run
+ if not os.path.isdir(test_results_dir) or len(os.listdir(test_results_dir)) == 0:
+ if fail_on_no_tests:
+ step_result.message = 'No unit tests defined.'
+ step_result.success = False
+ else:
+ step_result.message = "No unit tests defined, but 'fail-on-no-tests' is False."
+ except StepRunnerException as error:
+ step_result.success = False
+ step_result.message = "Error running 'maven test' to run unit tests. " \
+ "More details maybe found in 'maven-output' and `surefire-reports` " \
+ f"report artifact: {error}"
+ finally:
+ step_result.add_artifact(
+ description="Standard out and standard error from maven.",
+ name='maven-output',
+ value=mvn_output_file_path
+ )
+ step_result.add_artifact(
+ description="Surefire reports generated by maven.",
+ name='surefire-reports',
+ value=test_results_dir
+ )
+
+ return step_result
diff --git a/tests/step_implementers/package/test_maven_depricated_by_maven_package.py b/tests/step_implementers/package/test_maven_depricated_by_maven_package.py
new file mode 100644
index 00000000..a0e8e818
--- /dev/null
+++ b/tests/step_implementers/package/test_maven_depricated_by_maven_package.py
@@ -0,0 +1,28 @@
+
+from unittest.mock import patch
+
+from ploigos_step_runner import WorkflowResult
+from ploigos_step_runner.step_implementers.package import Maven
+from tests.helpers.base_step_implementer_test_case import \
+ BaseStepImplementerTestCase
+
+
+@patch("ploigos_step_runner.step_implementers.package.MavenPackage.__init__")
+class TestStepImplementerMaven_UnitTestOld___init__(BaseStepImplementerTestCase):
+ def test_defaults(self, mock_super_init):
+ workflow_result = WorkflowResult()
+ parent_work_dir_path = '/fake/path'
+ config = {}
+
+ Maven(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config
+ )
+
+ mock_super_init.assert_called_once_with(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=None
+ )
diff --git a/tests/step_implementers/package/test_maven_package.py b/tests/step_implementers/package/test_maven_package.py
index 02058a9d..8fd11ce0 100644
--- a/tests/step_implementers/package/test_maven_package.py
+++ b/tests/step_implementers/package/test_maven_package.py
@@ -3,7 +3,7 @@
from unittest.mock import patch
from ploigos_step_runner import StepResult, StepRunnerException, WorkflowResult
-from ploigos_step_runner.step_implementers.package import Maven
+from ploigos_step_runner.step_implementers.package import MavenPackage
from testfixtures import TempDirectory
from tests.helpers.base_step_implementer_test_case import \
BaseStepImplementerTestCase
@@ -16,7 +16,7 @@ def test_defaults(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenPackage(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config
@@ -35,7 +35,7 @@ def test_given_environment(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenPackage(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
@@ -55,7 +55,7 @@ class TestStepImplementerMavenPackage_step_implementer_config_defaults(
):
def test_result(self):
self.assertEqual(
- Maven.step_implementer_config_defaults(),
+ MavenPackage.step_implementer_config_defaults(),
{
'pom-file': 'pom.xml',
'tls-verify': True,
@@ -75,14 +75,14 @@ class TestStepImplementerMavenPackage__required_config_or_result_keys(
):
def test_result(self):
self.assertEqual(
- Maven._required_config_or_result_keys(),
+ MavenPackage._required_config_or_result_keys(),
[
'pom-file'
]
)
-@patch.object(Maven, '_run_maven_step')
-@patch.object(Maven, 'write_working_file', return_value='/mock/mvn_output.txt')
+@patch.object(MavenPackage, '_run_maven_step')
+@patch.object(MavenPackage, 'write_working_file', return_value='/mock/mvn_output.txt')
class TestStepImplementerMavenPackage__run_step(
BaseStepImplementerTestCase
):
@@ -93,10 +93,10 @@ def create_step_implementer(
parent_work_dir_path=''
):
return self.create_given_step_implementer(
- step_implementer=Maven,
+ step_implementer=MavenPackage,
step_config=step_config,
step_name='package',
- implementer='Maven',
+ implementer='MavenPackage',
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path
)
@@ -140,8 +140,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='package',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenPackage',
+ sub_step_implementer_name='MavenPackage'
)
expected_step_result.add_artifact(
description="Standard out and standard error from maven.",
@@ -206,8 +206,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='package',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenPackage',
+ sub_step_implementer_name='MavenPackage'
)
expected_step_result.add_artifact(
description="Standard out and standard error from maven.",
@@ -262,8 +262,8 @@ def test_fail_maven_run(
surefire_reports_dir = os.path.join(test_dir.path, 'target/surefire-reports')
expected_step_result = StepResult(
step_name='package',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenPackage',
+ sub_step_implementer_name='MavenPackage'
)
expected_step_result.success = False
expected_step_result.message = "Error running 'maven package' to package artifacts. " \
diff --git a/tests/step_implementers/push_artifacts/test_maven_push_artifacts.py b/tests/step_implementers/push_artifacts/test_maven_deploy.py
similarity index 94%
rename from tests/step_implementers/push_artifacts/test_maven_push_artifacts.py
rename to tests/step_implementers/push_artifacts/test_maven_deploy.py
index 54fe1896..4dfbf1c2 100644
--- a/tests/step_implementers/push_artifacts/test_maven_push_artifacts.py
+++ b/tests/step_implementers/push_artifacts/test_maven_deploy.py
@@ -3,7 +3,7 @@
from unittest.mock import PropertyMock, patch
from ploigos_step_runner import StepResult, WorkflowResult, StepRunnerException
-from ploigos_step_runner.step_implementers.push_artifacts import Maven
+from ploigos_step_runner.step_implementers.push_artifacts import MavenDeploy
from testfixtures import TempDirectory
from tests.helpers.base_step_implementer_test_case import \
BaseStepImplementerTestCase
@@ -16,7 +16,7 @@ def test_defaults(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenDeploy(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config
@@ -35,7 +35,7 @@ def test_given_environment(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenDeploy(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
@@ -55,7 +55,7 @@ class TestStepImplementerMavenDeploy_step_implementer_config_defaults(
):
def test_result(self):
self.assertEqual(
- Maven.step_implementer_config_defaults(),
+ MavenDeploy.step_implementer_config_defaults(),
{
'pom-file': 'pom.xml',
'tls-verify': True,
@@ -74,7 +74,7 @@ class TestStepImplementerMavenDeploy__required_config_or_result_keys(
):
def test_result(self):
self.assertEqual(
- Maven._required_config_or_result_keys(),
+ MavenDeploy._required_config_or_result_keys(),
[
'pom-file',
'maven-push-artifact-repo-url',
@@ -83,15 +83,15 @@ def test_result(self):
]
)
-@patch('ploigos_step_runner.step_implementers.push_artifacts.maven.run_maven')
-@patch.object(Maven, '_run_maven_step')
+@patch('ploigos_step_runner.step_implementers.push_artifacts.maven_deploy.run_maven')
+@patch.object(MavenDeploy, '_run_maven_step')
@patch.object(
- Maven,
+ MavenDeploy,
'write_working_file',
side_effect=['/mock/mvn_versions_set_output.txt', '/mock/mvn_deploy_output.txt']
)
@patch.object(
- Maven,
+ MavenDeploy,
'maven_settings_file',
new_callable=PropertyMock,
return_value='/fake/settings.xml'
@@ -106,10 +106,10 @@ def create_step_implementer(
parent_work_dir_path=''
):
return self.create_given_step_implementer(
- step_implementer=Maven,
+ step_implementer=MavenDeploy,
step_config=step_config,
step_name='deploy',
- implementer='Maven',
+ implementer='MavenDeploy',
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path
)
@@ -145,8 +145,8 @@ def test_success(
# create expected step result
expected_step_result = StepResult(
step_name='deploy',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenDeploy',
+ sub_step_implementer_name='MavenDeploy'
)
expected_step_result.add_artifact(
description="Standard out and standard error from running maven to update version.",
@@ -216,8 +216,8 @@ def test_fail_set_version(
# create expected step result
expected_step_result = StepResult(
step_name='deploy',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenDeploy',
+ sub_step_implementer_name='MavenDeploy'
)
expected_step_result.success = False
expected_step_result.message = "Error running 'maven deploy' to push artifacts. " \
@@ -285,8 +285,8 @@ def test_fail_mvn_depoy(
# create expected step result
expected_step_result = StepResult(
step_name='deploy',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenDeploy',
+ sub_step_implementer_name='MavenDeploy'
)
expected_step_result.success = False
expected_step_result.message = "Error running 'maven deploy' to push artifacts. " \
diff --git a/tests/step_implementers/push_artifacts/test_maven_depricated_by_maven_deploy.py b/tests/step_implementers/push_artifacts/test_maven_depricated_by_maven_deploy.py
new file mode 100644
index 00000000..34a080a4
--- /dev/null
+++ b/tests/step_implementers/push_artifacts/test_maven_depricated_by_maven_deploy.py
@@ -0,0 +1,28 @@
+
+from unittest.mock import patch
+
+from ploigos_step_runner import WorkflowResult
+from ploigos_step_runner.step_implementers.push_artifacts import Maven
+from tests.helpers.base_step_implementer_test_case import \
+ BaseStepImplementerTestCase
+
+
+@patch("ploigos_step_runner.step_implementers.push_artifacts.MavenDeploy.__init__")
+class TestStepImplementerMaven_UnitTestOld___init__(BaseStepImplementerTestCase):
+ def test_defaults(self, mock_super_init):
+ workflow_result = WorkflowResult()
+ parent_work_dir_path = '/fake/path'
+ config = {}
+
+ Maven(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config
+ )
+
+ mock_super_init.assert_called_once_with(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=None
+ )
diff --git a/tests/step_implementers/uat/test_maven_selenium_cucumber.py b/tests/step_implementers/uat/test_maven_test_selenium_cucumber.py
similarity index 93%
rename from tests/step_implementers/uat/test_maven_selenium_cucumber.py
rename to tests/step_implementers/uat/test_maven_test_selenium_cucumber.py
index 241b8c73..8441ff2a 100644
--- a/tests/step_implementers/uat/test_maven_selenium_cucumber.py
+++ b/tests/step_implementers/uat/test_maven_test_selenium_cucumber.py
@@ -4,13 +4,13 @@
from ploigos_step_runner import StepResult, StepRunnerException, WorkflowResult
from ploigos_step_runner.exceptions import StepRunnerException
-from ploigos_step_runner.step_implementers.uat import MavenSeleniumCucumber
+from ploigos_step_runner.step_implementers.uat import MavenTestSeleniumCucumber
from testfixtures import TempDirectory
from tests.helpers.base_step_implementer_test_case import \
BaseStepImplementerTestCase
-class BaseTestStepImplementerSharedMavenSeleniumCucumber(BaseStepImplementerTestCase):
+class BaseTestStepImplementerSharedMavenTestSeleniumCucumber(BaseStepImplementerTestCase):
def create_step_implementer(
self,
step_config={},
@@ -18,22 +18,22 @@ def create_step_implementer(
parent_work_dir_path=''
):
return self.create_given_step_implementer(
- step_implementer=MavenSeleniumCucumber,
+ step_implementer=MavenTestSeleniumCucumber,
step_config=step_config,
step_name='uat',
- implementer='MavenSeleniumCucumber',
+ implementer='MavenTestSeleniumCucumber',
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path
)
@patch("ploigos_step_runner.step_implementers.shared.MavenGeneric.__init__")
-class TestStepImplementerMavenTestMavenSeleniumCucumber___init__(BaseStepImplementerTestCase):
+class TestStepImplementerMavenTestMavenTestSeleniumCucumber___init__(BaseStepImplementerTestCase):
def test_defaults(self, mock_super_init):
workflow_result = WorkflowResult()
parent_work_dir_path = '/fake/path'
config = {}
- MavenSeleniumCucumber(
+ MavenTestSeleniumCucumber(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config
@@ -52,7 +52,7 @@ def test_given_environment(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- MavenSeleniumCucumber(
+ MavenTestSeleniumCucumber(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
@@ -67,12 +67,12 @@ def test_given_environment(self, mock_super_init):
maven_phases_and_goals=['test']
)
-class TestStepImplementerMavenTestMavenSeleniumCucumber_step_implementer_config_defaults(
+class TestStepImplementerMavenTestMavenTestSeleniumCucumber_step_implementer_config_defaults(
BaseStepImplementerTestCase
):
def test_result(self):
self.assertEqual(
- MavenSeleniumCucumber.step_implementer_config_defaults(),
+ MavenTestSeleniumCucumber.step_implementer_config_defaults(),
{
'pom-file': 'pom.xml',
'tls-verify': True,
@@ -84,12 +84,12 @@ def test_result(self):
}
)
-class TestStepImplementerMavenTestMavenSeleniumCucumber__required_config_or_result_keys(
+class TestStepImplementerMavenTestMavenTestSeleniumCucumber__required_config_or_result_keys(
BaseStepImplementerTestCase
):
def test_result(self):
self.assertEqual(
- MavenSeleniumCucumber._required_config_or_result_keys(),
+ MavenTestSeleniumCucumber._required_config_or_result_keys(),
[
'pom-file',
'fail-on-no-tests',
@@ -99,7 +99,7 @@ def test_result(self):
@patch("ploigos_step_runner.step_implementers.shared.MavenGeneric._validate_required_config_or_previous_step_result_artifact_keys")
class TestStepImplementerSharedMavenGeneric__validate_required_config_or_previous_step_result_artifact_keys(
- BaseTestStepImplementerSharedMavenSeleniumCucumber
+ BaseTestStepImplementerSharedMavenTestSeleniumCucumber
):
def test_valid_target_host_url(self, mock_super_validate):
with TempDirectory() as test_dir:
@@ -150,10 +150,10 @@ def test_fail_no_target_host_url_or_deployed_host_urls(self, mock_super_validate
mock_super_validate.assert_called_once_with()
-@patch.object(MavenSeleniumCucumber, '_run_maven_step')
-@patch.object(MavenSeleniumCucumber, 'write_working_file', return_value='/mock/mvn_output.txt')
+@patch.object(MavenTestSeleniumCucumber, '_run_maven_step')
+@patch.object(MavenTestSeleniumCucumber, 'write_working_file', return_value='/mock/mvn_output.txt')
@patch(
- 'ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values',
+ 'ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values',
return_value={
'time': '42',
'tests': '42',
@@ -161,14 +161,14 @@ def test_fail_no_target_host_url_or_deployed_host_urls(self, mock_super_validate
'skipped': '0',
'failures': '0'
})
-class TestStepImplementerMavenTestMavenSeleniumCucumber__run_step(
- BaseTestStepImplementerSharedMavenSeleniumCucumber
+class TestStepImplementerMavenTestMavenTestSeleniumCucumber__run_step(
+ BaseTestStepImplementerSharedMavenTestSeleniumCucumber
):
def __expected_step_result_base(self):
expected_step_result = StepResult(
step_name='uat',
- sub_step_name='MavenSeleniumCucumber',
- sub_step_implementer_name='MavenSeleniumCucumber'
+ sub_step_name='MavenTestSeleniumCucumber',
+ sub_step_implementer_name='MavenTestSeleniumCucumber'
)
return expected_step_result
@@ -258,7 +258,7 @@ def run_maven_side_effect(**kargs):
return run_maven_side_effect
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -321,7 +321,7 @@ def test_success_target_host_url_default_reports_dir(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -384,7 +384,7 @@ def test_success_single_deployed_host_url_default_reports_dir(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -451,7 +451,7 @@ def test_success_multiple_deployed_host_url_default_reports_dir(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', Mock(text='mock/fake/reports')]
)
@@ -513,7 +513,7 @@ def test_success_target_host_url_pom_specified_relative_reports_dir(
]
)
- @patch.object(MavenSeleniumCucumber, '_get_effective_pom_element')
+ @patch.object(MavenTestSeleniumCucumber, '_get_effective_pom_element')
def test_success_target_host_url_pom_specified_absolute_reports_dir(
self,
mock_effective_pom_element,
@@ -576,8 +576,8 @@ def test_success_target_host_url_pom_specified_absolute_reports_dir(
]
)
- @patch.object(MavenSeleniumCucumber, '_get_effective_pom_element', side_effect=[None, None])
- @patch.object(MavenSeleniumCucumber, '_get_effective_pom', return_value='mock-effective-pom.xml')
+ @patch.object(MavenTestSeleniumCucumber, '_get_effective_pom_element', side_effect=[None, None])
+ @patch.object(MavenTestSeleniumCucumber, '_get_effective_pom', return_value='mock-effective-pom.xml')
def test_fail_no_surefire_plugin(
self,
mock_effective_pom,
@@ -626,7 +626,7 @@ def test_fail_no_surefire_plugin(
mock_run_maven_step.assert_not_called()
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -687,7 +687,7 @@ def test_fail_no_tests(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -749,7 +749,7 @@ def test_success_but_no_tests(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -818,7 +818,7 @@ def test_could_not_find_expected_evidence(
)
@patch.object(
- MavenSeleniumCucumber,
+ MavenTestSeleniumCucumber,
'_get_effective_pom_element',
side_effect=['mock surefire element', None]
)
@@ -883,24 +883,24 @@ def test_fail_maven_error(
]
)
-# class TestStepImplementerMavenSeleniumCucumberBase(MaveStepImplementerTestCase):
+# class TestStepImplementerMavenTestSeleniumCucumberBase(MaveStepImplementerTestCase):
# def create_step_implementer(
# self,
# step_config={},
# parent_work_dir_path=''
# ):
# return self.create_given_step_implementer(
-# step_implementer=MavenSeleniumCucumber,
+# step_implementer=MavenTestSeleniumCucumber,
# step_config=step_config,
# step_name='uat',
-# implementer='MavenSeleniumCucumber',
+# implementer='MavenTestSeleniumCucumber',
# parent_work_dir_path=parent_work_dir_path
# )
-# class TestStepImplementerDeployMavenSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys(
-# TestStepImplementerMavenSeleniumCucumberBase
+# class TestStepImplementerDeployMavenTestSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys(
+# TestStepImplementerMavenTestSeleniumCucumberBase
# ):
-# def test_MavenSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_target_host_url(self):
+# def test_MavenTestSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_target_host_url(self):
# with TempDirectory() as temp_dir:
# parent_work_dir_path = os.path.join(temp_dir.path, 'working')
@@ -918,7 +918,7 @@ def test_fail_maven_error(
# step_implementer._validate_required_config_or_previous_step_result_artifact_keys()
-# def test_MavenSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_deployed_host_urls_1(self):
+# def test_MavenTestSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_deployed_host_urls_1(self):
# with TempDirectory() as temp_dir:
# parent_work_dir_path = os.path.join(temp_dir.path, 'working')
@@ -936,7 +936,7 @@ def test_fail_maven_error(
# step_implementer._validate_required_config_or_previous_step_result_artifact_keys()
-# def test_MavenSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_deployed_host_urls_2(self):
+# def test_MavenTestSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_success_deployed_host_urls_2(self):
# with TempDirectory() as temp_dir:
# parent_work_dir_path = os.path.join(temp_dir.path, 'working')
@@ -954,7 +954,7 @@ def test_fail_maven_error(
# step_implementer._validate_required_config_or_previous_step_result_artifact_keys()
-# def test_MavenSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_fail_no_target_urls(self):
+# def test_MavenTestSeleniumCucumber_validate_required_config_or_previous_step_result_artifact_keys_fail_no_target_urls(self):
# with TempDirectory() as temp_dir:
# parent_work_dir_path = os.path.join(temp_dir.path, 'working')
@@ -976,9 +976,9 @@ def test_fail_maven_error(
# ):
# step_implementer._validate_required_config_or_previous_step_result_artifact_keys()
-# class TestStepImplementerMavenSeleniumCucumber_Other(TestStepImplementerMavenSeleniumCucumberBase):
+# class TestStepImplementerMavenTestSeleniumCucumber_Other(TestStepImplementerMavenTestSeleniumCucumberBase):
# def test_step_implementer_config_defaults(self):
-# actual_defaults = MavenSeleniumCucumber.step_implementer_config_defaults()
+# actual_defaults = MavenTestSeleniumCucumber.step_implementer_config_defaults()
# expected_defaults = {
# 'fail-on-no-tests': True,
# 'pom-file': 'pom.xml',
@@ -988,7 +988,7 @@ def test_fail_maven_error(
# self.assertEqual(expected_defaults, actual_defaults)
# def test__required_config_or_result_keys(self):
-# actual_required_keys = MavenSeleniumCucumber._required_config_or_result_keys()
+# actual_required_keys = MavenTestSeleniumCucumber._required_config_or_result_keys()
# expected_required_keys = [
# 'fail-on-no-tests',
# 'pom-file',
@@ -1139,8 +1139,8 @@ def test_fail_maven_error(
# expected_step_result = StepResult(
# step_name='uat',
-# sub_step_name='MavenSeleniumCucumber',
-# sub_step_implementer_name='MavenSeleniumCucumber'
+# sub_step_name='MavenTestSeleniumCucumber',
+# sub_step_implementer_name='MavenTestSeleniumCucumber'
# )
# expected_step_result.success = expected_result_success
# expected_step_result.message = expected_result_message
@@ -1207,8 +1207,8 @@ def test_fail_maven_error(
# self.assertEqual(expected_step_result, result)
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_defaults(
@@ -1263,8 +1263,8 @@ def test_fail_maven_error(
# surefire_reports_dir=surefire_reports_dir
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_tls_verify_false(
@@ -1320,8 +1320,8 @@ def test_fail_maven_error(
# set_tls_verify_false=True
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success__deployed_host_urls_str(
@@ -1378,8 +1378,8 @@ def test_fail_maven_error(
# deployed_host_urls=deployed_host_urls
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success__deployed_host_urls_array_1(
@@ -1436,8 +1436,8 @@ def test_fail_maven_error(
# deployed_host_urls=deployed_host_urls
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success__deployed_host_urls_array_2(
@@ -1497,8 +1497,8 @@ def test_fail_maven_error(
# f" targeting first one (https://foo.ploigos.xyz) for user acceptance test (UAT)."
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_provided_profile_override(
@@ -1554,8 +1554,8 @@ def test_fail_maven_error(
# uat_maven_profile='custom-uat-profile'
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_provided_pom_file_override(
@@ -1611,8 +1611,8 @@ def test_fail_maven_error(
# pom_file_name='custom-pom.xml'
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_provided_fail_on_no_tests_false_with_tests(
@@ -1670,8 +1670,8 @@ def test_fail_maven_error(
# expected_result_success=True
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_provided_fail_on_no_tests_false_with_no_tests(
@@ -1733,8 +1733,8 @@ def test_fail_maven_error(
# " but 'fail-on-no-tests' is False."
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_fail_provided_fail_on_no_tests_true_with_no_tests(
@@ -1795,8 +1795,8 @@ def test_fail_maven_error(
# " using maven profile (integration-test)."
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_fail_no_surefire_plugin(
@@ -1859,8 +1859,8 @@ def test_fail_maven_error(
# assert_report_artifact=False
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_success_pom_specified_reports_dir(
@@ -1920,8 +1920,8 @@ def test_fail_maven_error(
# surefire_reports_dir=surefire_reports_dir
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_fail_mvn_test_failure(
@@ -1982,8 +1982,8 @@ def test_fail_maven_error(
# " report artifacts for details."
# )
-# @patch('ploigos_step_runner.step_implementers.uat.maven_selenium_cucumber.aggregate_xml_element_attribute_values')
-# @patch.object(MavenSeleniumCucumber, '_generate_maven_settings')
+# @patch('ploigos_step_runner.step_implementers.uat.maven_test_selenium_cucumber.aggregate_xml_element_attribute_values')
+# @patch.object(MavenTestSeleniumCucumber, '_generate_maven_settings')
# @patch('sh.mvn', create=True)
# @patch('ploigos_step_runner.step_implementers.shared.maven_generic.write_effective_pom')
# def test__run_step_failure_missing_evidence_attribute(
diff --git a/tests/step_implementers/uat/test_maven_test_selenium_cucumber_depricated_by_maven_test_slenium_cucumber.py b/tests/step_implementers/uat/test_maven_test_selenium_cucumber_depricated_by_maven_test_slenium_cucumber.py
new file mode 100644
index 00000000..f9c3689c
--- /dev/null
+++ b/tests/step_implementers/uat/test_maven_test_selenium_cucumber_depricated_by_maven_test_slenium_cucumber.py
@@ -0,0 +1,28 @@
+
+from unittest.mock import patch
+
+from ploigos_step_runner import WorkflowResult
+from ploigos_step_runner.step_implementers.uat import MavenSeleniumCucumber
+from tests.helpers.base_step_implementer_test_case import \
+ BaseStepImplementerTestCase
+
+
+@patch("ploigos_step_runner.step_implementers.uat.MavenTestSeleniumCucumber.__init__")
+class TestStepImplementerMaven_UnitTestOld___init__(BaseStepImplementerTestCase):
+ def test_defaults(self, mock_super_init):
+ workflow_result = WorkflowResult()
+ parent_work_dir_path = '/fake/path'
+ config = {}
+
+ MavenSeleniumCucumber(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config
+ )
+
+ mock_super_init.assert_called_once_with(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=None
+ )
diff --git a/tests/step_implementers/unit_test/test_maven_depricated_by_maven_test.py b/tests/step_implementers/unit_test/test_maven_depricated_by_maven_test.py
new file mode 100644
index 00000000..4dd7d0ae
--- /dev/null
+++ b/tests/step_implementers/unit_test/test_maven_depricated_by_maven_test.py
@@ -0,0 +1,28 @@
+
+from unittest.mock import patch
+
+from ploigos_step_runner import WorkflowResult
+from ploigos_step_runner.step_implementers.unit_test import Maven
+from tests.helpers.base_step_implementer_test_case import \
+ BaseStepImplementerTestCase
+
+
+@patch("ploigos_step_runner.step_implementers.unit_test.MavenTest.__init__")
+class TestStepImplementerMaven_UnitTestOld___init__(BaseStepImplementerTestCase):
+ def test_defaults(self, mock_super_init):
+ workflow_result = WorkflowResult()
+ parent_work_dir_path = '/fake/path'
+ config = {}
+
+ Maven(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config
+ )
+
+ mock_super_init.assert_called_once_with(
+ workflow_result=workflow_result,
+ parent_work_dir_path=parent_work_dir_path,
+ config=config,
+ environment=None
+ )
diff --git a/tests/step_implementers/unit_test/test_maven_unit_test.py b/tests/step_implementers/unit_test/test_maven_test.py
similarity index 91%
rename from tests/step_implementers/unit_test/test_maven_unit_test.py
rename to tests/step_implementers/unit_test/test_maven_test.py
index a95c1325..45d0ecd4 100644
--- a/tests/step_implementers/unit_test/test_maven_unit_test.py
+++ b/tests/step_implementers/unit_test/test_maven_test.py
@@ -3,7 +3,7 @@
from unittest.mock import Mock, patch
from ploigos_step_runner import StepResult, StepRunnerException, WorkflowResult
-from ploigos_step_runner.step_implementers.unit_test import Maven
+from ploigos_step_runner.step_implementers.unit_test import MavenTest
from testfixtures import TempDirectory
from tests.helpers.base_step_implementer_test_case import \
BaseStepImplementerTestCase
@@ -16,7 +16,7 @@ def test_defaults(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenTest(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config
@@ -35,7 +35,7 @@ def test_given_environment(self, mock_super_init):
parent_work_dir_path = '/fake/path'
config = {}
- Maven(
+ MavenTest(
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path,
config=config,
@@ -55,7 +55,7 @@ class TestStepImplementerMavenTest_step_implementer_config_defaults(
):
def test_result(self):
self.assertEqual(
- Maven.step_implementer_config_defaults(),
+ MavenTest.step_implementer_config_defaults(),
{
'pom-file': 'pom.xml',
'tls-verify': True,
@@ -71,15 +71,15 @@ class TestStepImplementerMavenTest__required_config_or_result_keys(
):
def test_result(self):
self.assertEqual(
- Maven._required_config_or_result_keys(),
+ MavenTest._required_config_or_result_keys(),
[
'pom-file',
'fail-on-no-tests'
]
)
-@patch.object(Maven, '_run_maven_step')
-@patch.object(Maven, 'write_working_file', return_value='/mock/mvn_output.txt')
+@patch.object(MavenTest, '_run_maven_step')
+@patch.object(MavenTest, 'write_working_file', return_value='/mock/mvn_output.txt')
class TestStepImplementerMavenTest__run_step(
BaseStepImplementerTestCase
):
@@ -90,15 +90,15 @@ def create_step_implementer(
parent_work_dir_path=''
):
return self.create_given_step_implementer(
- step_implementer=Maven,
+ step_implementer=MavenTest,
step_config=step_config,
step_name='unit-test',
- implementer='Maven',
+ implementer='MavenTest',
workflow_result=workflow_result,
parent_work_dir_path=parent_work_dir_path
)
- @patch.object(Maven, '_get_effective_pom_element', side_effect=['mock surefire element', None])
+ @patch.object(MavenTest, '_get_effective_pom_element', side_effect=['mock surefire element', None])
def test_success_default_reports_dir(
self,
mock_effective_pom_element,
@@ -143,8 +143,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.add_artifact(
description="Standard out and standard error from maven.",
@@ -169,7 +169,7 @@ def run_maven_side_effect(mvn_output_file_path):
)
@patch.object(
- Maven,
+ MavenTest,
'_get_effective_pom_element',
side_effect=['mock surefire element', Mock(text='mock/fake/reports')]
)
@@ -217,8 +217,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.add_artifact(
description="Standard out and standard error from maven.",
@@ -242,7 +242,7 @@ def run_maven_side_effect(mvn_output_file_path):
mvn_output_file_path='/mock/mvn_output.txt'
)
- @patch.object(Maven, '_get_effective_pom_element')
+ @patch.object(MavenTest, '_get_effective_pom_element')
def test_success_pom_specified_absolute_reports_dir(
self,
mock_effective_pom_element,
@@ -291,8 +291,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.add_artifact(
description="Standard out and standard error from maven.",
@@ -316,8 +316,8 @@ def run_maven_side_effect(mvn_output_file_path):
mvn_output_file_path='/mock/mvn_output.txt'
)
- @patch.object(Maven, '_get_effective_pom_element', side_effect=[None, None])
- @patch.object(Maven, '_get_effective_pom', return_value='mock-effective-pom.xml')
+ @patch.object(MavenTest, '_get_effective_pom_element', side_effect=[None, None])
+ @patch.object(MavenTest, '_get_effective_pom', return_value='mock-effective-pom.xml')
def test_fail_no_surefire_plugin(
self,
mock_effective_pom,
@@ -363,8 +363,8 @@ def run_maven_side_effect(mvn_output_file_path):
# create expected step result
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.success = False
expected_step_result.message = 'Unit test dependency "maven-surefire-plugin" ' \
@@ -378,7 +378,7 @@ def run_maven_side_effect(mvn_output_file_path):
mock_run_maven_step.assert_not_called()
- @patch.object(Maven, '_get_effective_pom_element', side_effect=['mock surefire element', None])
+ @patch.object(MavenTest, '_get_effective_pom_element', side_effect=['mock surefire element', None])
def test_fail_no_tests(
self,
mock_effective_pom_element,
@@ -404,8 +404,8 @@ def test_fail_no_tests(
surefire_reports_dir = os.path.join(test_dir.path, 'target/surefire-reports')
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.success = False
expected_step_result.message = 'No unit tests defined.'
@@ -431,7 +431,7 @@ def test_fail_no_tests(
mvn_output_file_path='/mock/mvn_output.txt'
)
- @patch.object(Maven, '_get_effective_pom_element', side_effect=['mock surefire element', None])
+ @patch.object(MavenTest, '_get_effective_pom_element', side_effect=['mock surefire element', None])
def test_success_but_no_tests(
self,
mock_effective_pom_element,
@@ -458,8 +458,8 @@ def test_success_but_no_tests(
surefire_reports_dir = os.path.join(test_dir.path, 'target/surefire-reports')
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.message = "No unit tests defined, but 'fail-on-no-tests' is False."
expected_step_result.add_artifact(
@@ -484,7 +484,7 @@ def test_success_but_no_tests(
mvn_output_file_path='/mock/mvn_output.txt'
)
- @patch.object(Maven, '_get_effective_pom_element', side_effect=['mock surefire element', None])
+ @patch.object(MavenTest, '_get_effective_pom_element', side_effect=['mock surefire element', None])
def test_fail_maven_run(
self,
mock_effective_pom_element,
@@ -511,8 +511,8 @@ def test_fail_maven_run(
surefire_reports_dir = os.path.join(test_dir.path, 'target/surefire-reports')
expected_step_result = StepResult(
step_name='unit-test',
- sub_step_name='Maven',
- sub_step_implementer_name='Maven'
+ sub_step_name='MavenTest',
+ sub_step_implementer_name='MavenTest'
)
expected_step_result.success = False
expected_step_result.message = "Error running 'maven test' to run unit tests. " \