Skip to content

Commit

Permalink
chore: Remove cloudHubAppPrefix from docs and unit tests (#84)
Browse files Browse the repository at this point in the history
* chore: Remove cloudHubAppPrefix from docs and unit tests
  • Loading branch information
talyssoncastro authored Dec 21, 2023
1 parent d4b5e86 commit cee220f
Show file tree
Hide file tree
Showing 17 changed files with 7 additions and 32 deletions.
1 change: 0 additions & 1 deletion library/examples/allOptions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ muleDeploy {
clientId 'the_client_id'
clientSecret 'the_client_secret'
}
cloudHubAppPrefix 'AVI'
// optional from here on out
appProperties([
someProp: 'someValue'
Expand Down
1 change: 0 additions & 1 deletion library/examples/minimum.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'
}
}
1 change: 0 additions & 1 deletion library/examples/muleDeploy_ch2.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'

// Cloudhub v2 specific params
applicationName '${project.name}'
Expand Down
1 change: 1 addition & 0 deletions library/examples/muleDeploy_ch2_apimanager_policies.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 1 addition & 10 deletions library/examples/muleDeploy_ch2_minimum.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion library/examples/muleDeploy_ch_all_features.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ muleDeploy {
clientId 'the_client_id'
clientSecret 'the_client_secret'
}
cloudHubAppPrefix 'AVI'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ muleDeploy {
clientId 'the_client_id'
clientSecret 'the_client_secret'
}
cloudHubAppPrefix 'AVI'
}
}
1 change: 0 additions & 1 deletion library/examples/muleDeploy_ch_only_api_retrieve.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ muleDeploy {
clientId 'the_client_id'
clientSecret 'the_client_secret'
}
cloudHubAppPrefix 'AVI'
}
}
1 change: 0 additions & 1 deletion library/examples/muleDeploy_rtf.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'

// Cloudhub v2 specific params
applicationName {
Expand Down
1 change: 0 additions & 1 deletion library/examples/multipleVersions_1_dc_project.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'
}
}
1 change: 0 additions & 1 deletion library/examples/multipleVersions_2_dc_projects.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'
}
}
1 change: 0 additions & 1 deletion library/examples/soap_endpoint.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,35 +212,34 @@ 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,
new WorkerSpecRequest('us-west-2'),
'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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
}
}

Expand Down Expand Up @@ -301,7 +299,6 @@ class CloudhubContextTest implements MavenInvoke {
clientId 'the_client_id'
clientSecret 'the_client_secret'
}
cloudHubAppPrefix 'AVI'
}
closure.delegate = context

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion maven-plugin/examples/mule4_project/muleDeploy.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ muleDeploy {
clientId params.autoDiscClientId
clientSecret params.autoDiscClientSecret
}
cloudHubAppPrefix 'AVI'
}
}

0 comments on commit cee220f

Please sign in to comment.