From a37a4e330b7dfd28ea96cb29d69e9e0b6151ff6f Mon Sep 17 00:00:00 2001 From: Peter Shin Date: Tue, 9 Apr 2024 10:28:43 -0500 Subject: [PATCH] LPD-22405 Source formatting --- .../testNoClassification.gradle | 6 +++--- .../testOverrideLCPJsonFile.gradle | 10 +++++----- .../testFileExistsClientExtensionConfig.gradle | 2 +- .../testFileExistsSiteInitializerJson.gradle | 12 ++++++------ ...ientExtensionBuildFileContentsTestCase.gradle | 16 ++++++++++++++-- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testNoClassification.gradle b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testNoClassification.gradle index 5a15cd88e1f97b..2b1df81e473980 100644 --- a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testNoClassification.gradle +++ b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testNoClassification.gradle @@ -1,11 +1,11 @@ ext.expectedFilePath = "LCP.json" ext.expectedContentStrings = [ - '"foo" : "bar"', - '"kind" : "Deployment"', + '"foo": "bar"', + '"kind": "Deployment"', ] ext.taskPath = ":client-extension-no-classification:createClientExtensionConfig" ext.unexpectedContentStrings = [ - '"kind" : "Job"', + '"kind": "Job"', ] apply from: project.property("commonScript.testClientExtensionBuildFileContentsTestCase.gradle") \ No newline at end of file diff --git a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testOverrideLCPJsonFile.gradle b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testOverrideLCPJsonFile.gradle index 307698911ca0ca..4428b1dfa83f24 100644 --- a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testOverrideLCPJsonFile.gradle +++ b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionLCPJsonOverride/testOverrideLCPJsonFile.gradle @@ -1,13 +1,13 @@ ext.expectedFilePath = "LCP.json" ext.expectedContentStrings = [ - '"foo" : "bar"', - '"dependencies" : [ "foo", "bar" ]', - '"memory" : 500', - '"LIFERAY_ROUTES_DXP" : "/etc/liferay/lxc/dxp-metadata"' + '"foo": "bar"', + '"dependencies": [ "foo", "bar" ]', + '"memory": 500', + '"LIFERAY_ROUTES_DXP": "/etc/liferay/lxc/dxp-metadata"' ] ext.taskPath = ":client-extension-override-lcp-json:createClientExtensionConfig" ext.unexpectedContentStrings = [ - '"memory" : 300', + '"memory": 300', ] apply from: project.property("commonScript.testClientExtensionBuildFileContentsTestCase.gradle") \ No newline at end of file diff --git a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsClientExtensionConfig.gradle b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsClientExtensionConfig.gradle index ae20abbb85ade0..4ebd45c09cc15a 100644 --- a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsClientExtensionConfig.gradle +++ b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsClientExtensionConfig.gradle @@ -1,4 +1,4 @@ -ext.expectedContentStrings = [' ":configurator:policy" : "force"', ' "buildTimestamp" : '] +ext.expectedContentStrings = [' ":configurator:policy": "force"', ' "buildTimestamp": '] ext.expectedFilePath = "site-initializer.client-extension-config.json" ext.taskPath = ":site-initializer:createClientExtensionConfig" diff --git a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsSiteInitializerJson.gradle b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsSiteInitializerJson.gradle index f714ab4e2e46c5..900b4cad63d788 100644 --- a/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsSiteInitializerJson.gradle +++ b/modules/sdk/gradle-plugins-workspace/src/gradleTest/clientExtensionTypeSiteInitializer/testFileExistsSiteInitializerJson.gradle @@ -1,10 +1,10 @@ ext.expectedContentStrings = [ - '"externalReferenceCode" : "External Reference Code"', - '"membershipType" : "open"', - '"name" : "Site Name"', - '"parentSiteKey" : "Parent Site Name"', - '"templateKey" : "Sample Template Key"', - '"templateType" : "site-initializer"', + '"externalReferenceCode": "External Reference Code"', + '"membershipType": "open"', + '"name": "Site Name"', + '"parentSiteKey": "Parent Site Name"', + '"templateKey": "Sample Template Key"', + '"templateType": "site-initializer"', ] ext.expectedFilePath = "site-initializer/site-initializer.json" ext.taskPath = ":site-initializer:createClientExtensionConfig" diff --git a/modules/sdk/gradle-plugins-workspace/src/gradleTest/testClientExtensionBuildFileContentsTestCase.gradle b/modules/sdk/gradle-plugins-workspace/src/gradleTest/testClientExtensionBuildFileContentsTestCase.gradle index 1a8157b397e522..932892b6baa5a0 100644 --- a/modules/sdk/gradle-plugins-workspace/src/gradleTest/testClientExtensionBuildFileContentsTestCase.gradle +++ b/modules/sdk/gradle-plugins-workspace/src/gradleTest/testClientExtensionBuildFileContentsTestCase.gradle @@ -24,11 +24,23 @@ runGradleTest { assert file.exists() expectedContentStrings.each { - assert file.text.contains(it) + assert _contains(file, it) } unexpectedContentStrings.each { - assert !file.text.contains(it) + assert !_contains(file, it) } } +} + +private boolean _contains(File file, String s) { + if (file.text.contains(s)) { + return true + } + + if (file.text.contains(s.replaceAll('"(\\S+)": ', '"\$1" : '))) { + return true + } + + return false } \ No newline at end of file