From cee220fa145606f8a6cac7a6354cd3070891013e Mon Sep 17 00:00:00 2001 From: Talysson de Castro Date: Thu, 21 Dec 2023 17:08:36 -0300 Subject: [PATCH] chore: Remove cloudHubAppPrefix from docs and unit tests (#84) * chore: Remove cloudHubAppPrefix from docs and unit tests --- library/examples/allOptions.groovy | 1 - library/examples/minimum.groovy | 1 - library/examples/muleDeploy_ch2.groovy | 1 - .../muleDeploy_ch2_apimanager_policies.groovy | 1 + library/examples/muleDeploy_ch2_minimum.groovy | 11 +---------- library/examples/muleDeploy_ch_all_features.groovy | 1 - .../muleDeploy_ch_api_retrieve_and_policy_sync.groovy | 1 - .../examples/muleDeploy_ch_only_api_retrieve.groovy | 1 - library/examples/muleDeploy_rtf.groovy | 1 - library/examples/multipleVersions_1_dc_project.groovy | 1 - .../examples/multipleVersions_2_dc_projects.groovy | 1 - library/examples/soap_endpoint.groovy | 1 - .../api/models/CloudhubV2DeploymentRequestTest.groovy | 11 +++++------ .../mule/deployment/dsl/CloudhubContextTest.groovy | 3 --- .../mule/deployment/dsl/CloudhubV2ContextTest.groovy | 1 - .../deployment/dsl/RuntimeFabricContextTest.groovy | 1 - maven-plugin/examples/mule4_project/muleDeploy.groovy | 1 - 17 files changed, 7 insertions(+), 32 deletions(-) diff --git a/library/examples/allOptions.groovy b/library/examples/allOptions.groovy index 018aa3d8..68c99228 100644 --- a/library/examples/allOptions.groovy +++ b/library/examples/allOptions.groovy @@ -121,7 +121,6 @@ muleDeploy { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' // optional from here on out appProperties([ someProp: 'someValue' diff --git a/library/examples/minimum.groovy b/library/examples/minimum.groovy index e6477cdb..7e7c10bc 100644 --- a/library/examples/minimum.groovy +++ b/library/examples/minimum.groovy @@ -33,6 +33,5 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' } } diff --git a/library/examples/muleDeploy_ch2.groovy b/library/examples/muleDeploy_ch2.groovy index 466bb3cd..9c547c03 100644 --- a/library/examples/muleDeploy_ch2.groovy +++ b/library/examples/muleDeploy_ch2.groovy @@ -25,7 +25,6 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' // Cloudhub v2 specific params applicationName '${project.name}' diff --git a/library/examples/muleDeploy_ch2_apimanager_policies.groovy b/library/examples/muleDeploy_ch2_apimanager_policies.groovy index 8a5d5102..89364ef8 100644 --- a/library/examples/muleDeploy_ch2_apimanager_policies.groovy +++ b/library/examples/muleDeploy_ch2_apimanager_policies.groovy @@ -25,6 +25,7 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } + businessGroupId 'the-group-id' workerSpecs { target 'Cloudhub-US-West-2' muleVersion '4.4.0' diff --git a/library/examples/muleDeploy_ch2_minimum.groovy b/library/examples/muleDeploy_ch2_minimum.groovy index d0ca8559..29286066 100644 --- a/library/examples/muleDeploy_ch2_minimum.groovy +++ b/library/examples/muleDeploy_ch2_minimum.groovy @@ -2,19 +2,10 @@ muleDeploy { // version of the tool version '1.0' - policies { - clientEnforcementPolicyBasic { - // version is optional (will use version in this library by default) - version '1.2.1' - // can supply paths just like above if necessary - } - } - cloudHubV2Application { environment params.env - applicationName 'hello-world-test' applicationName { - baseAppName 'the-app' + baseAppName 'hello-world-test' } appVersion '1.0.0-SNAPSHOT' cryptoKey params.cryptoKey diff --git a/library/examples/muleDeploy_ch_all_features.groovy b/library/examples/muleDeploy_ch_all_features.groovy index f9c7d19e..7a991160 100644 --- a/library/examples/muleDeploy_ch_all_features.groovy +++ b/library/examples/muleDeploy_ch_all_features.groovy @@ -45,6 +45,5 @@ muleDeploy { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' } } \ No newline at end of file diff --git a/library/examples/muleDeploy_ch_api_retrieve_and_policy_sync.groovy b/library/examples/muleDeploy_ch_api_retrieve_and_policy_sync.groovy index 86e35041..5bef2dbc 100644 --- a/library/examples/muleDeploy_ch_api_retrieve_and_policy_sync.groovy +++ b/library/examples/muleDeploy_ch_api_retrieve_and_policy_sync.groovy @@ -50,6 +50,5 @@ muleDeploy { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' } } \ No newline at end of file diff --git a/library/examples/muleDeploy_ch_only_api_retrieve.groovy b/library/examples/muleDeploy_ch_only_api_retrieve.groovy index fb8b686b..e7ec13b7 100644 --- a/library/examples/muleDeploy_ch_only_api_retrieve.groovy +++ b/library/examples/muleDeploy_ch_only_api_retrieve.groovy @@ -37,6 +37,5 @@ muleDeploy { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' } } \ No newline at end of file diff --git a/library/examples/muleDeploy_rtf.groovy b/library/examples/muleDeploy_rtf.groovy index 1554aa66..ee675d73 100644 --- a/library/examples/muleDeploy_rtf.groovy +++ b/library/examples/muleDeploy_rtf.groovy @@ -25,7 +25,6 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' // Cloudhub v2 specific params applicationName { diff --git a/library/examples/multipleVersions_1_dc_project.groovy b/library/examples/multipleVersions_1_dc_project.groovy index 305e3de8..1aa8eaf7 100644 --- a/library/examples/multipleVersions_1_dc_project.groovy +++ b/library/examples/multipleVersions_1_dc_project.groovy @@ -56,6 +56,5 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' } } diff --git a/library/examples/multipleVersions_2_dc_projects.groovy b/library/examples/multipleVersions_2_dc_projects.groovy index c82bd874..ea05bf98 100644 --- a/library/examples/multipleVersions_2_dc_projects.groovy +++ b/library/examples/multipleVersions_2_dc_projects.groovy @@ -59,6 +59,5 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' } } diff --git a/library/examples/soap_endpoint.groovy b/library/examples/soap_endpoint.groovy index a78704f8..137da68c 100644 --- a/library/examples/soap_endpoint.groovy +++ b/library/examples/soap_endpoint.groovy @@ -37,6 +37,5 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' } } diff --git a/library/src/test/java/com/avioconsulting/mule/deployment/api/models/CloudhubV2DeploymentRequestTest.groovy b/library/src/test/java/com/avioconsulting/mule/deployment/api/models/CloudhubV2DeploymentRequestTest.groovy index b1270ab7..10c8d1ff 100644 --- a/library/src/test/java/com/avioconsulting/mule/deployment/api/models/CloudhubV2DeploymentRequestTest.groovy +++ b/library/src/test/java/com/avioconsulting/mule/deployment/api/models/CloudhubV2DeploymentRequestTest.groovy @@ -212,14 +212,14 @@ class CloudhubV2DeploymentRequestTest implements MavenInvoke { /** * This case validates that the name of application to deploy is not larger that the maximum required of 42 characters. * however, this validation happens after build the final appName (normalizedAppName) like this: ${cloudhubAppprefix}-${appName}-${env} length should not larger than 42 characters. - * example: cloudhubPrefix=someprefix , appName=myVeryVeryVeryLargeApplicationName, env=prod -> someprefix-myVeryVeryLargeApplicationName-prod is larger than 42 characters, it's not a valid name - * ${cloudhubAppprefix} could be null so: myVeryVeryVeryLargeApplicationName-prod is a valid name + * example: ApplicationName{ baseName=myVeryVeryVeryLargeApplicationName, usePrefix=true, useSuffix=true, prefix=someprefix, suffix=prod -> someprefix-myVeryVeryLargeApplicationName-prod is larger than 42 characters, it's not a valid name + * ${usePrefix} could be false so: myVeryVeryVeryLargeApplicationName-prod is a valid name */ @Test void test_deploymentRequest_appName_should_not_larger_than_required() { def appName = 'app-myVeryVeryVeryLargeApplicationName' - def cloudHubPrefix = 'client' + def prefix = 'client' def environment = 'DEV' def exception = shouldFail { new CloudhubV2DeploymentRequest(environment, @@ -227,20 +227,19 @@ class CloudhubV2DeploymentRequestTest implements MavenInvoke { 'theKey', 'theClientId', 'theSecret', - new ApplicationName(appName,true,false,'cloudHubPrefix',null), + new ApplicationName(appName,true,true, prefix, environment), '4.2.2', 'f2ea2cb4-c600-4bb5-88e8-e952ff5591ee') } MatcherAssert.assertThat exception.message, - is(equalTo("Maximum size of application name is 42 and the provided name has 53 characters")) + is(equalTo("Maximum size of application name is 42 and the provided name has 49 characters")) } @Test void test_deploymentRequest_appName_empty() { def appName = null - def cloudHubPrefix = 'client' def environment = 'DEV' def exception = shouldFail { new CloudhubV2DeploymentRequest(environment, diff --git a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubContextTest.groovy b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubContextTest.groovy index 17d4f28a..bc6aa0dd 100644 --- a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubContextTest.groovy +++ b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubContextTest.groovy @@ -70,8 +70,6 @@ class CloudhubContextTest implements MavenInvoke { is(equalTo('the_client_id')) assertThat anypointClientSecret, is(equalTo('the_client_secret')) -// assertThat cloudHubAppPrefix, -// is(equalTo('AVI')) } } @@ -301,7 +299,6 @@ class CloudhubContextTest implements MavenInvoke { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' } closure.delegate = context diff --git a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubV2ContextTest.groovy b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubV2ContextTest.groovy index 97acbd61..16795e48 100644 --- a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubV2ContextTest.groovy +++ b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/CloudhubV2ContextTest.groovy @@ -206,7 +206,6 @@ class CloudhubV2ContextTest implements MavenInvoke { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' workerSpecs { target 'target_name'} } closure.delegate = context diff --git a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/RuntimeFabricContextTest.groovy b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/RuntimeFabricContextTest.groovy index b10cba71..48cbf4fe 100644 --- a/library/src/test/java/com/avioconsulting/mule/deployment/dsl/RuntimeFabricContextTest.groovy +++ b/library/src/test/java/com/avioconsulting/mule/deployment/dsl/RuntimeFabricContextTest.groovy @@ -213,7 +213,6 @@ class RuntimeFabricContextTest implements MavenInvoke { clientId 'the_client_id' clientSecret 'the_client_secret' } - cloudHubAppPrefix 'AVI' workerSpecs { target 'target_name'} } closure.delegate = context diff --git a/maven-plugin/examples/mule4_project/muleDeploy.groovy b/maven-plugin/examples/mule4_project/muleDeploy.groovy index 04d772d3..d4eae983 100644 --- a/maven-plugin/examples/mule4_project/muleDeploy.groovy +++ b/maven-plugin/examples/mule4_project/muleDeploy.groovy @@ -24,6 +24,5 @@ muleDeploy { clientId params.autoDiscClientId clientSecret params.autoDiscClientSecret } - cloudHubAppPrefix 'AVI' } }