From b9c9171b3a4a00e1aca6ea296e9f874bdecc87f6 Mon Sep 17 00:00:00 2001 From: Marcelo Oporto Fernandez Date: Wed, 2 Sep 2015 10:30:02 -0400 Subject: [PATCH 1/4] Fixed bug --- .../org/BasicOrgComponentsValidator.groovy | 20 ++++++++----- .../org/BasicOrgSubcomponentsValidator.groovy | 29 ++++++++++++------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy index 4f9b02b..f4a93bc 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy @@ -57,17 +57,21 @@ public class BasicOrgComponentsValidator implements OrgInterfaceValidator{ QueryBuilder queryBuilder = new QueryBuilder() JsonSlurper jsonSlurper = new JsonSlurper() + def component = MetadataComponents.getComponent(folderComponent) ArrayList orgFiles = [] - def typeComponent = MetadataComponents.getComponent(folderComponent).getTypeName() - def extensionComponent = MetadataComponents.getComponent(folderComponent).getExtension() - def sqlString = queryBuilder.createQueryFromBasicComponent(typeComponent) - def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) - def jsonResulSet = jsonSlurper.parseText(resultSet as String) + if(component != null) { + def typeComponent = component.getTypeName() + def extensionComponent = component.getExtension() + def sqlString = queryBuilder.createQueryFromBasicComponent(typeComponent) + def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) + def jsonResulSet = jsonSlurper.parseText(resultSet as String) - for(def i = 0; i < jsonResulSet.records.size(); i++) { - def nameFile = "${jsonResulSet.records[i]['Name']}.${extensionComponent}" - orgFiles.add(new File(Paths.get(projectPath,folderComponent, nameFile ).toString())) + for(def i = 0; i < jsonResulSet.records.size(); i++) { + def nameFile = "${jsonResulSet.records[i]['Name']}.${extensionComponent}" + orgFiles.add(new File(Paths.get(projectPath,folderComponent, nameFile ).toString())) + } } + return orgFiles } } diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy index 35462cc..ebc804c 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy @@ -73,18 +73,27 @@ public class BasicOrgSubcomponentsValidator implements OrgInterfaceValidator{ */ public boolean existFileInOrg(Credential credential, File filesToValidate, String typeSubcomponent) { ToolingAPI toolingAPI = new ToolingAPI(credential) - def typeComponent = MetadataComponents.getComponent(typeSubcomponent).getTypeName() - def extensionComponent = MetadataComponents.getComponent(typeSubcomponent).getExtension() + def existSubcomponent = false + def component = MetadataComponents.getComponent(typeSubcomponent) - def sqlString = queryBuilder.createQueryGetSubomponent(typeComponent, filesToValidate) - def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) - def jsonResulSet = jsonSlurper.parseText(resultSet as String) - for(def i = 0; i < jsonResulSet.records.size(); i++) { - String fullName = "${jsonResulSet.records[i]['FullName']}.${extensionComponent}" - if(fullName.equals(filesToValidate.getName())) { - return true + if(component != null) { + def typeComponent = component.getTypeName() + def extensionComponent = component.getExtension() + + def sqlString = queryBuilder.createQueryGetSubomponent(typeComponent, filesToValidate) + def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) + def jsonResulSet = jsonSlurper.parseText(resultSet as String) + for(def i = 0; i < jsonResulSet.records.size(); i++) { + String fullName = "${jsonResulSet.records[i]['FullName']}.${extensionComponent}" + if(fullName.equals(filesToValidate.getName())) { + existSubcomponent = true + } } } - return false + else { + existSubcomponent = true + } + + return existSubcomponent } } From f1a5f3724bb6bc2f91b3b26bb34fd236204f2f26 Mon Sep 17 00:00:00 2001 From: Marcelo Oporto Fernandez Date: Wed, 2 Sep 2015 16:16:27 -0400 Subject: [PATCH 2/4] Add new tests --- .../utils/salesforce/OrgValidatorTest.groovy | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy index 4429853..b0be314 100644 --- a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy +++ b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy @@ -26,6 +26,9 @@ class OrgValidatorTest extends Specification { ArrayList validTriggerFiles ArrayList invalidTriggerFiles ArrayList unvalidatedDocumentFiles + ArrayList invalidNonexistentFiles + ArrayList validPagesFiles + ArrayList invalidPagesFiles @Shared Map> mapExpected @@ -46,7 +49,10 @@ class OrgValidatorTest extends Specification { invalidClassFiles = [] validTriggerFiles = [] invalidTriggerFiles = [] + validPagesFiles = [] + invalidPagesFiles = [] unvalidatedDocumentFiles = [] + invalidNonexistentFiles = [] mapExpected = [:] @@ -72,9 +78,21 @@ class OrgValidatorTest extends Specification { invalidTriggerFiles.add(new File(Paths.get(SRC_PATH,'triggers','triggerFall2.trigger').toString())) invalidTriggerFiles.add(new File(Paths.get(SRC_PATH,'triggers','triggerFall3.trigger').toString())) + validPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','Page1.page').toString())) + validPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','Page2.page').toString())) + validPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','Page3.page').toString())) + + invalidPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','PageFall1.page').toString())) + invalidPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','PageFall2.page').toString())) + invalidPagesFiles.add(new File(Paths.get(SRC_PATH,'pages','PageFall3.page').toString())) + unvalidatedDocumentFiles.add(new File(Paths.get(SRC_PATH,'documents','myDocuments','doc.txt').toString())) unvalidatedDocumentFiles.add(new File(Paths.get(SRC_PATH,'documents','myDocuments','doc2.txt').toString())) + invalidNonexistentFiles.add(new File(Paths.get(SRC_PATH,'othercomponent','doc1.txt').toString())) + invalidNonexistentFiles.add(new File(Paths.get(SRC_PATH,'othercomponent','doc2.txt').toString())) + invalidNonexistentFiles.add(new File(Paths.get(SRC_PATH,'othercomponent','doc3.txt').toString())) + mapExpected.put(Constants.VALID_FILE, new ArrayList()) mapExpected.put(Constants.DOES_NOT_EXIST_FILES, new ArrayList()) mapExpected.put(Constants.FILE_WITHOUT_VALIDATOR, new ArrayList()) @@ -166,4 +184,51 @@ class OrgValidatorTest extends Specification { mapResponse[Constants.DOES_NOT_EXIST_FILES].sort() == mapExpected[Constants.DOES_NOT_EXIST_FILES].sort() mapResponse[Constants.FILE_WITHOUT_VALIDATOR].sort() == mapExpected[Constants.FILE_WITHOUT_VALIDATOR].sort() } + + def "Test should returns a map that contains all valid, invalid and noneexistent files" () { + given: + mapExpected[Constants.VALID_FILE].addAll(validClassFiles) + mapExpected[Constants.VALID_FILE].addAll(validTriggerFiles) + mapExpected[Constants.FILE_WITHOUT_VALIDATOR].addAll(invalidNonexistentFiles) + + + allFiles.addAll(validClassFiles) + allFiles.addAll(validTriggerFiles) + allFiles.addAll(invalidNonexistentFiles) + + when: + Map> mapResponse = OrgValidator.validateFiles(credential, allFiles, SRC_PATH) + showMaps(true,mapExpected,mapResponse) + + then: + mapResponse[Constants.VALID_FILE].sort() == mapExpected[Constants.VALID_FILE].sort() + mapResponse[Constants.DOES_NOT_EXIST_FILES].sort() == mapExpected[Constants.DOES_NOT_EXIST_FILES].sort() + mapResponse[Constants.FILE_WITHOUT_VALIDATOR].sort() == mapExpected[Constants.FILE_WITHOUT_VALIDATOR].sort() + } + + def "Test should returns a map that contains all valid xistent files" () { + given: + mapExpected[Constants.VALID_FILE].addAll(validClassFiles) + mapExpected[Constants.VALID_FILE].addAll(validTriggerFiles) + mapExpected[Constants.VALID_FILE].addAll(validPagesFiles) + mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidClassFiles) + mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidTriggerFiles) + mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidPagesFiles) + + allFiles.addAll(validClassFiles) + allFiles.addAll(validTriggerFiles) + allFiles.addAll(validPagesFiles) + allFiles.addAll(invalidClassFiles) + allFiles.addAll(invalidTriggerFiles) + allFiles.addAll(invalidPagesFiles) + + when: + Map> mapResponse = OrgValidator.validateFiles(credential, allFiles, SRC_PATH) + showMaps(true,mapExpected,mapResponse) + + then: + mapResponse[Constants.VALID_FILE].sort() == mapExpected[Constants.VALID_FILE].sort() + mapResponse[Constants.DOES_NOT_EXIST_FILES].sort() == mapExpected[Constants.DOES_NOT_EXIST_FILES].sort() + mapResponse[Constants.FILE_WITHOUT_VALIDATOR].sort() == mapExpected[Constants.FILE_WITHOUT_VALIDATOR].sort() + } } \ No newline at end of file From 76f6ce3b9ae2b5eaf6d5b61c46c9867fe5b4bf38 Mon Sep 17 00:00:00 2001 From: marco_cadima Date: Fri, 9 Oct 2015 11:00:12 -0400 Subject: [PATCH 3/4] Org validator was updated --- .../enforce/utils/salesforce/OrgValidator.groovy | 6 +++--- .../org/BasicOrgComponentsValidator.groovy | 15 ++++++--------- .../org/BasicOrgSubcomponentsValidator.groovy | 16 ++++++---------- .../org/DefaultOrgComponentsValidator.groovy | 9 ++++----- .../utils/salesforce/OrgValidatorTest.groovy | 10 +++++----- 5 files changed, 24 insertions(+), 32 deletions(-) diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidator.groovy index 9d9e50a..88836a8 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidator.groovy @@ -2,8 +2,8 @@ package org.fundacionjala.gradle.plugins.enforce.utils.salesforce import org.fundacionjala.gradle.plugins.enforce.utils.Constants import org.fundacionjala.gradle.plugins.enforce.utils.Util -import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.files.BasicOrgComponentsValidator -import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.files.DefaultOrgComponentsValidator +import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org.BasicOrgComponentsValidator +import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org.DefaultOrgComponentsValidator import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.files.SalesforceValidator import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org.BasicOrgSubcomponentsValidator import org.fundacionjala.gradle.plugins.enforce.wsc.Credential @@ -38,7 +38,7 @@ class OrgValidator { * @param filesToValidate ia a list of files that need to validate * @param projectPath our repository */ - public static Map> validateFiles(Credential credential,ArrayList filesToValidate, String projectPath) { + public static Map> validateFiles(Credential credential, ArrayList filesToValidate, String projectPath) { Map> mapFiles = filesToValidate.groupBy { Util.getFirstPath(Util.getRelativePath(it,projectPath)) } diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy index 6400a63..d871add 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgComponentsValidator.groovy @@ -1,4 +1,4 @@ -package org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.files +package org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org import groovy.json.JsonSlurper import org.fundacionjala.gradle.plugins.enforce.utils.Constants @@ -24,12 +24,10 @@ public class BasicOrgComponentsValidator implements OrgInterfaceValidator{ */ @Override public Map> validateFiles(Credential credential, ArrayList filesToVerify, String folderComponent, String projectPath) { - Map> mapFiles = [:] mapFiles.put(Constants.VALID_FILE, new ArrayList()) mapFiles.put(Constants.FILES_NOT_FOUND, new ArrayList()) mapFiles.put(Constants.FILE_WITHOUT_VALIDATOR, new ArrayList()) - ArrayList orgFiles = getFilesIntoOrg(credential, folderComponent, projectPath) filesToVerify.findAll{ File file -> @@ -52,18 +50,17 @@ public class BasicOrgComponentsValidator implements OrgInterfaceValidator{ * @param path orn repository */ public ArrayList getFilesIntoOrg(Credential credential, String folderComponent, String projectPath) { - ToolingAPI toolingAPI = new ToolingAPI(credential) QueryBuilder queryBuilder = new QueryBuilder() JsonSlurper jsonSlurper = new JsonSlurper() - def component = MetadataComponents.getComponent(folderComponent) + MetadataComponents component = MetadataComponents.getComponent(folderComponent) ArrayList orgFiles = [] if(component != null) { - def typeComponent = component.getTypeName() - def extensionComponent = component.getExtension() - def sqlString = queryBuilder.createQueryFromBasicComponent(typeComponent) - def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) + String typeComponent = component.getTypeName() + String extensionComponent = component.getExtension() + String sqlString = queryBuilder.createQueryFromBasicComponent(typeComponent) + String resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) def jsonResulSet = jsonSlurper.parseText(resultSet as String) for(def i = 0; i < jsonResulSet.records.size(); i++) { diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy index 68a3a86..53c835b 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/BasicOrgSubcomponentsValidator.groovy @@ -67,33 +67,29 @@ public class BasicOrgSubcomponentsValidator implements OrgInterfaceValidator{ /** * Validates the subcomponents defined in Salesforce organization * @param credential contains the data needed to connect with the API sales force - * @param filesToValidate is a list of files that need to validate - * @param typeSubcomponent is a subcomponent type that we need validate + * @param fileToValidate is a list of files that need to validate + * @param subcomponentType is a subcomponent type that we need validate * @return a boolean value that indicate if a subComponent exist in Salesforce organization */ - public boolean existFileInOrg(Credential credential, File filesToValidate, String typeSubcomponent) { + public boolean existFileInOrg(Credential credential, File fileToValidate, String subcomponentType) { ToolingAPI toolingAPI = new ToolingAPI(credential) def existSubcomponent = false - def component = MetadataComponents.getComponent(typeSubcomponent) + def component = MetadataComponents.getComponent(subcomponentType) if(component != null) { def typeComponent = component.getTypeName() def extensionComponent = component.getExtension() - def sqlString = queryBuilder.createQueryGetSubomponent(typeComponent, filesToValidate) + def sqlString = queryBuilder.createQueryGetSubomponent(typeComponent, fileToValidate) def resultSet = toolingAPI.httpAPIClient.executeQuery(sqlString) def jsonResulSet = jsonSlurper.parseText(resultSet as String) for(def i = 0; i < jsonResulSet.records.size(); i++) { String fullName = "${jsonResulSet.records[i]['FullName']}.${extensionComponent}" - if(fullName.equals(filesToValidate.getName())) { + if(fullName.equals(fileToValidate.getName())) { existSubcomponent = true } } } - else { - existSubcomponent = true - } - return existSubcomponent } } diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/DefaultOrgComponentsValidator.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/DefaultOrgComponentsValidator.groovy index 5f14651..1cebfd0 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/DefaultOrgComponentsValidator.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/component/validators/org/DefaultOrgComponentsValidator.groovy @@ -1,18 +1,17 @@ -package org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.files +package org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org import org.fundacionjala.gradle.plugins.enforce.utils.Constants -import org.fundacionjala.gradle.plugins.enforce.utils.salesforce.component.validators.org.OrgInterfaceValidator import org.fundacionjala.gradle.plugins.enforce.wsc.Credential /** * This class defines a default validate for some salesforce component */ -public class DefaultOrgComponentsValidator implements OrgInterfaceValidator{ +public class DefaultOrgComponentsValidator implements OrgInterfaceValidator { @Override - public Map> validateFiles(Credential credential, ArrayList filesToVerify, String folderComponent, String projectPath) { + public Map> validateFiles(Credential credential, ArrayList filesToVerify, String folderComponent, String projectPath) { - Map> mapFiles = [:] + Map> mapFiles = [:] mapFiles.put(Constants.VALID_FILE, new ArrayList()) mapFiles.put(Constants.FILES_NOT_FOUND, new ArrayList()) mapFiles.put(Constants.FILE_WITHOUT_VALIDATOR, new ArrayList()) diff --git a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy index c0d36b3..8df3c12 100644 --- a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy +++ b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/utils/salesforce/OrgValidatorTest.groovy @@ -202,7 +202,7 @@ class OrgValidatorTest extends Specification { then: mapResponse[Constants.VALID_FILE].sort() == mapExpected[Constants.VALID_FILE].sort() - mapResponse[Constants.DOES_NOT_EXIST_FILES].sort() == mapExpected[Constants.DOES_NOT_EXIST_FILES].sort() + mapResponse[Constants.FILES_NOT_FOUND].sort() == mapExpected[Constants.FILES_NOT_FOUND].sort() mapResponse[Constants.FILE_WITHOUT_VALIDATOR].sort() == mapExpected[Constants.FILE_WITHOUT_VALIDATOR].sort() } @@ -211,9 +211,9 @@ class OrgValidatorTest extends Specification { mapExpected[Constants.VALID_FILE].addAll(validClassFiles) mapExpected[Constants.VALID_FILE].addAll(validTriggerFiles) mapExpected[Constants.VALID_FILE].addAll(validPagesFiles) - mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidClassFiles) - mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidTriggerFiles) - mapExpected[Constants.DOES_NOT_EXIST_FILES].addAll(invalidPagesFiles) + mapExpected[Constants.FILES_NOT_FOUND].addAll(invalidClassFiles) + mapExpected[Constants.FILES_NOT_FOUND].addAll(invalidTriggerFiles) + mapExpected[Constants.FILES_NOT_FOUND].addAll(invalidPagesFiles) allFiles.addAll(validClassFiles) allFiles.addAll(validTriggerFiles) @@ -228,7 +228,7 @@ class OrgValidatorTest extends Specification { then: mapResponse[Constants.VALID_FILE].sort() == mapExpected[Constants.VALID_FILE].sort() - mapResponse[Constants.DOES_NOT_EXIST_FILES].sort() == mapExpected[Constants.DOES_NOT_EXIST_FILES].sort() + mapResponse[Constants.FILES_NOT_FOUND].sort() == mapExpected[Constants.FILES_NOT_FOUND].sort() mapResponse[Constants.FILE_WITHOUT_VALIDATOR].sort() == mapExpected[Constants.FILE_WITHOUT_VALIDATOR].sort() } } \ No newline at end of file From 2a12cdbdef60b0daaf39fc737a6ce7bbce00dec9 Mon Sep 17 00:00:00 2001 From: marco_cadima Date: Fri, 9 Oct 2015 16:14:35 -0400 Subject: [PATCH 4/4] bug: "Undeploy task isn't excluding files" was fixed. --- .../plugins/enforce/EnforcePluginExtension.groovy | 2 +- .../tasks/salesforce/deployment/Deployment.groovy | 11 ----------- .../tasks/salesforce/deployment/Undeploy.groovy | 12 ++++++------ .../tasks/salesforce/deployment/UndeployTest.groovy | 8 ++++---- .../tasks/salesforce/unittest/RunTestTaskTest.groovy | 8 ++++---- 5 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/EnforcePluginExtension.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/EnforcePluginExtension.groovy index a817cce..effaa8d 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/EnforcePluginExtension.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/EnforcePluginExtension.groovy @@ -35,7 +35,7 @@ class EnforcePluginExtension { */ ArrayList deleteSubComponents = ['*'] - ArrayList standardObjects = [] + ArrayList standardComponents = [] String tool = "" diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Deployment.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Deployment.groovy index eeb9039..ac1536b 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Deployment.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Deployment.groovy @@ -111,17 +111,6 @@ abstract class Deployment extends SalesforceTask { fileManager.createNewDirectory(pathDirectory) } - /** - * Combines package that was updated from build folder and package from source directory - * @param buildPackagePath is path of package that is into build directory - */ - public void combinePackage(String buildPackagePath) { - PackageCombiner.packageCombine(projectPackagePath, buildPackagePath) - if (excludes) { - removeFilesExcluded(buildPackagePath) - } - } - /** * Combines package from build folder and package from source directory * @param buildPackagePath is path of package that is into build directory diff --git a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Undeploy.groovy b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Undeploy.groovy index bfd732b..ab73aab 100644 --- a/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Undeploy.groovy +++ b/src/main/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/Undeploy.groovy @@ -53,7 +53,7 @@ class Undeploy extends Deployment { @Override void runTask() { truncate() - addNewStandardObjects() + addNewStandardComponents() unDeploy() } @@ -67,7 +67,7 @@ class Undeploy extends Deployment { copyFilesToTaskDirectory(filesToTruncate) addInterceptor() writePackage(taskPackagePath, filesToTruncate) - combinePackage(taskPackagePath) + combinePackageToUpdate(taskPackagePath) executeDeploy(taskFolderPath, START_MESSAGE_TRUNCATE, SUCCESS_MESSAGE_TRUNCATE) } @@ -93,7 +93,7 @@ class Undeploy extends Deployment { public void unDeploy() { createDeploymentDirectory(taskFolderPath) deployToDeleteComponents() - combinePackage(taskDestructivePath) + combinePackageToUpdate(taskDestructivePath) executeDeploy(taskFolderPath, START_MESSAGE_UNDEPLOY, SUCCESS_MESSAGE_DELETE) } @@ -159,10 +159,10 @@ class Undeploy extends Deployment { /** * Adds new standard objects from user property */ - public void addNewStandardObjects() { + public void addNewStandardComponents() { if (Util.isValidProperty(project, Constants.FORCE_EXTENSION) && - project[Constants.FORCE_EXTENSION].standardObjects) { - standardComponents += project[Constants.FORCE_EXTENSION].standardObjects + project[Constants.FORCE_EXTENSION].standardComponents) { + standardComponents += project[Constants.FORCE_EXTENSION].standardComponents } } diff --git a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/UndeployTest.groovy b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/UndeployTest.groovy index 90bc8b2..3496f65 100644 --- a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/UndeployTest.groovy +++ b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/deployment/UndeployTest.groovy @@ -54,7 +54,7 @@ class UndeployTest extends Specification { project.apply(plugin: EnforcePlugin) project.enforce { srcPath = "${File.separator}home${File.separator}user${File.separator}project${File.separator}one" - standardObjects = ["Q2w_Test__c.object"] + standardComponents = ["Q2w_Test__c.object"] tool = "metadata" poll = 200 waitTime = 10 @@ -113,7 +113,7 @@ class UndeployTest extends Specification { def "Test should get the standard objects assigned"() { expect: - project.extensions.findByName('enforce').standardObjects == ["Q2w_Test__c.object"] + project.extensions.findByName('enforce').standardComponents == ["Q2w_Test__c.object"] } def "Test should get the tool assigned"() { @@ -160,8 +160,8 @@ class UndeployTest extends Specification { undeployInstance.copyFilesToTaskDirectory(undeployInstance.filesToTruncate) undeployInstance.addInterceptor() undeployInstance.writePackage(undeployInstance.taskPackagePath, undeployInstance.filesToTruncate) - undeployInstance.combinePackage(undeployInstance.taskPackagePath) - undeployInstance.addNewStandardObjects() + undeployInstance.combinePackageToUpdate(undeployInstance.taskPackagePath) + undeployInstance.addNewStandardComponents() undeployInstance.createDeploymentDirectory(undeployInstance.taskFolderPath) undeployInstance.deployToDeleteComponents() def destructiveXmlContent = new File(Paths.get(SRC_PATH, 'build', 'undeploy', 'destructiveChanges.xml').toString()).text diff --git a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/unittest/RunTestTaskTest.groovy b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/unittest/RunTestTaskTest.groovy index 499c3ef..478441c 100644 --- a/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/unittest/RunTestTaskTest.groovy +++ b/src/test/groovy/org/fundacionjala/gradle/plugins/enforce/tasks/salesforce/unittest/RunTestTaskTest.groovy @@ -26,7 +26,7 @@ class RunTestTaskTest extends Specification { project.apply(plugin: EnforcePlugin) project.enforce { srcPath = "${File.separator}home${File.separator}user${File.separator}project${File.separator}one" - standardObjects = ["Q2w_Test__c.object"] + standardComponents = ["Q2w_Test__c.object"] tool = "metadata" poll = 200 waitTime = 10 @@ -50,7 +50,7 @@ class RunTestTaskTest extends Specification { def "Should get the standard objects assigned"() { expect: - project.extensions.findByName('enforce').standardObjects == ["Q2w_Test__c.object"] + project.extensions.findByName('enforce').standardComponents == ["Q2w_Test__c.object"] } def "Should get the tool assigned"() { @@ -62,7 +62,7 @@ class RunTestTaskTest extends Specification { given: project.enforce { srcPath = SRC_PATH - standardObjects = ["Q2w_Test__c.object"] + standardComponents = ["Q2w_Test__c.object"] tool = "metadata" poll = 200 waitTime = 10 @@ -82,7 +82,7 @@ class RunTestTaskTest extends Specification { given: project.enforce { srcPath = SRC_PATH - standardObjects = ["Q2w_Test__c.object"] + standardComponents = ["Q2w_Test__c.object"] tool = "metadata" poll = 200 waitTime = 10