diff --git a/pom.xml b/pom.xml index 40c2f5e146..ce3503ae50 100644 --- a/pom.xml +++ b/pom.xml @@ -433,12 +433,16 @@ com.hp.sv SVConfigurator - 4.10.1.48219 + 4.20.0.49723 commons-io commons-io + + commons-codec + commons-codec + diff --git a/src/main/java/com/hpe/application/automation/tools/model/SvExportModel.java b/src/main/java/com/hpe/application/automation/tools/model/SvExportModel.java index 722eab26f3..223a6bdc6c 100644 --- a/src/main/java/com/hpe/application/automation/tools/model/SvExportModel.java +++ b/src/main/java/com/hpe/application/automation/tools/model/SvExportModel.java @@ -41,14 +41,16 @@ public class SvExportModel extends AbstractSvRunModel { private final String targetDirectory; private final boolean cleanTargetDirectory; private final boolean switchToStandByFirst; + private final boolean archive; @DataBoundConstructor public SvExportModel(String serverName, boolean force, String targetDirectory, boolean cleanTargetDirectory, - SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst) { + SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst, boolean archive) { super(serverName, force, serviceSelection); this.targetDirectory = StringUtils.trim(targetDirectory); this.cleanTargetDirectory = cleanTargetDirectory; this.switchToStandByFirst = switchToStandByFirst; + this.archive = archive; } public String getTargetDirectory() { @@ -62,4 +64,8 @@ public boolean isCleanTargetDirectory() { public boolean isSwitchToStandByFirst() { return switchToStandByFirst; } + + public boolean isArchive() { + return archive; + } } \ No newline at end of file diff --git a/src/main/java/com/hpe/application/automation/tools/pipelineSteps/SvExportStep.java b/src/main/java/com/hpe/application/automation/tools/pipelineSteps/SvExportStep.java index b39b6e3f95..a995ef077c 100644 --- a/src/main/java/com/hpe/application/automation/tools/pipelineSteps/SvExportStep.java +++ b/src/main/java/com/hpe/application/automation/tools/pipelineSteps/SvExportStep.java @@ -46,15 +46,17 @@ public class SvExportStep extends AbstractSvStep { private final boolean cleanTargetDirectory; private final SvServiceSelectionModel serviceSelection; private final boolean switchToStandByFirst; + private final boolean archive; @DataBoundConstructor public SvExportStep(String serverName, boolean force, String targetDirectory, boolean cleanTargetDirectory, - SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst) { + SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst, boolean archive) { super(serverName, force); this.targetDirectory = targetDirectory; this.cleanTargetDirectory = cleanTargetDirectory; this.serviceSelection = serviceSelection; this.switchToStandByFirst = switchToStandByFirst; + this.archive = archive; } public String getTargetDirectory() { @@ -73,9 +75,13 @@ public boolean isSwitchToStandByFirst() { return switchToStandByFirst; } + public boolean isArchive() { + return archive; + } + @Override protected SimpleBuildStep getBuilder() { - return new SvExportBuilder(serverName, force, targetDirectory, cleanTargetDirectory, serviceSelection, switchToStandByFirst); + return new SvExportBuilder(serverName, force, targetDirectory, cleanTargetDirectory, serviceSelection, switchToStandByFirst, archive); } @Extension diff --git a/src/main/java/com/hpe/application/automation/tools/run/SvDeployBuilder.java b/src/main/java/com/hpe/application/automation/tools/run/SvDeployBuilder.java index cbfca527a2..10c8a6291f 100644 --- a/src/main/java/com/hpe/application/automation/tools/run/SvDeployBuilder.java +++ b/src/main/java/com/hpe/application/automation/tools/run/SvDeployBuilder.java @@ -91,7 +91,7 @@ private Iterable getServiceList(IProject project) { } private void deployServiceFromProject(IProject project, PrintStream logger) throws Exception { - IDeployProcessor processor = new DeployProcessor(null, new ServiceAmendingServiceImpl()); + IDeployProcessor processor = new DeployProcessor(null); ICommandExecutor commandExecutor = createCommandExecutor(); for (IService service : getServiceList(project)) { diff --git a/src/main/java/com/hpe/application/automation/tools/run/SvExportBuilder.java b/src/main/java/com/hpe/application/automation/tools/run/SvExportBuilder.java index 01df4de106..0de78cb63b 100644 --- a/src/main/java/com/hpe/application/automation/tools/run/SvExportBuilder.java +++ b/src/main/java/com/hpe/application/automation/tools/run/SvExportBuilder.java @@ -39,6 +39,8 @@ import java.io.IOException; import java.io.PrintStream; +import com.hp.sv.jsvconfigurator.build.ProjectBuilder; +import com.hp.sv.jsvconfigurator.core.IProject; import com.hpe.application.automation.tools.model.SvExportModel; import com.hpe.application.automation.tools.model.SvServiceSelectionModel; import com.hp.sv.jsvconfigurator.core.IService; @@ -71,8 +73,8 @@ public class SvExportBuilder extends AbstractSvRunBuilder { @DataBoundConstructor public SvExportBuilder(String serverName, boolean force, String targetDirectory, boolean cleanTargetDirectory, - SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst) { - super(new SvExportModel(serverName, force, targetDirectory, cleanTargetDirectory, serviceSelection, switchToStandByFirst)); + SvServiceSelectionModel serviceSelection, boolean switchToStandByFirst, boolean archive) { + super(new SvExportModel(serverName, force, targetDirectory, cleanTargetDirectory, serviceSelection, switchToStandByFirst, archive)); } @Override @@ -95,6 +97,7 @@ protected void performImpl(@Nonnull Run run, @Nonnull FilePath workspace, IChmodeProcessor chmodeProcessor = new ChmodeProcessor(null); ICommandExecutor exec = createCommandExecutor(); + IProject project = null; verifyNotNull(model.getTargetDirectory(), "Target directory must be set"); @@ -104,6 +107,10 @@ protected void performImpl(@Nonnull Run run, @Nonnull FilePath workspace, cleanTargetDirectory(logger, targetDirectory); } + if (model.getServiceSelection().getSelectionType().equals(SvServiceSelectionModel.SelectionType.PROJECT)) { + project = new ProjectBuilder().buildProject(new File(model.getServiceSelection().getProjectPath()), model.getServiceSelection().getProjectPassword()); + } + for (ServiceInfo serviceInfo : getServiceList(false, logger, workspace)) { if (model.isSwitchToStandByFirst()) { switchToStandBy(serviceInfo, chmodeProcessor, exec, logger); @@ -111,7 +118,12 @@ protected void performImpl(@Nonnull Run run, @Nonnull FilePath workspace, logger.printf(" Exporting service '%s' [%s] to %s %n", serviceInfo.getName(), serviceInfo.getId(), targetDirectory); verifyNotLearningBeforeExport(logger, exec, serviceInfo); - exportProcessor.process(exec, targetDirectory, serviceInfo.getId(), false); + if (!model.getServiceSelection().getSelectionType().equals(SvServiceSelectionModel.SelectionType.PROJECT)) { + exportProcessor.process(exec, targetDirectory, serviceInfo.getId(), project, false, model.isArchive()); + } + } + if (model.getServiceSelection().getSelectionType().equals(SvServiceSelectionModel.SelectionType.PROJECT)) { + exportProcessor.process(exec, targetDirectory, null, project, false, model.isArchive()); } } @@ -142,9 +154,13 @@ private void cleanTargetDirectory(PrintStream logger, String targetDirectory) th File target = new File(targetDirectory); if (target.exists()) { File[] subfolders = target.listFiles((FilenameFilter) DirectoryFileFilter.INSTANCE); - if (subfolders.length > 0) { + File[] files = target.listFiles((FilenameFilter) new SuffixFileFilter(".vproja")); + if (subfolders.length > 0 || files.length > 0) { logger.println(" Cleaning target directory..."); } + for(File file : files) { + FileUtils.forceDelete(file); + } for (File subfolder : subfolders) { if (subfolder.listFiles((FilenameFilter) new SuffixFileFilter(".vproj")).length > 0) { logger.println(" Deleting subfolder of target directory: " + subfolder.getAbsolutePath()); diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvChangeModeBuilder/config.properties b/src/main/resources/com/hpe/application/automation/tools/run/SvChangeModeBuilder/config.properties index 7f22c96417..32f3b79c6a 100644 --- a/src/main/resources/com/hpe/application/automation/tools/run/SvChangeModeBuilder/config.properties +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvChangeModeBuilder/config.properties @@ -1,6 +1,6 @@ # -# © Copyright 2013 EntIT Software LLC -# Certain versions of software and/or documents (“Material”) accessible here may contain branding from +# ? Copyright 2013 EntIT Software LLC +# Certain versions of software and/or documents (“Material?) accessible here may contain branding from # Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, # the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP # and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE @@ -32,4 +32,4 @@ # # suppress inspection "UnusedProperty" -NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file +NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvDeployBuilder/config.properties b/src/main/resources/com/hpe/application/automation/tools/run/SvDeployBuilder/config.properties index 7f22c96417..32f3b79c6a 100644 --- a/src/main/resources/com/hpe/application/automation/tools/run/SvDeployBuilder/config.properties +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvDeployBuilder/config.properties @@ -1,6 +1,6 @@ # -# © Copyright 2013 EntIT Software LLC -# Certain versions of software and/or documents (“Material”) accessible here may contain branding from +# ? Copyright 2013 EntIT Software LLC +# Certain versions of software and/or documents (“Material?) accessible here may contain branding from # Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, # the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP # and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE @@ -32,4 +32,4 @@ # # suppress inspection "UnusedProperty" -NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file +NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.jelly b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.jelly index ffca04f9a4..e4ca1b915d 100644 --- a/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.jelly +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.jelly @@ -68,4 +68,8 @@ + + + + diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.properties b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.properties index 7f22c96417..32f3b79c6a 100644 --- a/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.properties +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/config.properties @@ -1,6 +1,6 @@ # -# © Copyright 2013 EntIT Software LLC -# Certain versions of software and/or documents (“Material”) accessible here may contain branding from +# ? Copyright 2013 EntIT Software LLC +# Certain versions of software and/or documents (“Material?) accessible here may contain branding from # Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, # the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP # and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE @@ -32,4 +32,4 @@ # # suppress inspection "UnusedProperty" -NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file +NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/help-archive.html b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/help-archive.html new file mode 100644 index 0000000000..536fe1c866 --- /dev/null +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvExportBuilder/help-archive.html @@ -0,0 +1,36 @@ + + +
+ If set, Export service(s) as project archive(s) (.vproja). +
diff --git a/src/main/resources/com/hpe/application/automation/tools/run/SvUndeployBuilder/config.properties b/src/main/resources/com/hpe/application/automation/tools/run/SvUndeployBuilder/config.properties index 7f22c96417..32f3b79c6a 100644 --- a/src/main/resources/com/hpe/application/automation/tools/run/SvUndeployBuilder/config.properties +++ b/src/main/resources/com/hpe/application/automation/tools/run/SvUndeployBuilder/config.properties @@ -1,6 +1,6 @@ # -# © Copyright 2013 EntIT Software LLC -# Certain versions of software and/or documents (“Material”) accessible here may contain branding from +# ? Copyright 2013 EntIT Software LLC +# Certain versions of software and/or documents (“Material?) accessible here may contain branding from # Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, # the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP # and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE @@ -32,4 +32,4 @@ # # suppress inspection "UnusedProperty" -NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file +NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto Manage Jenkins->Configure System->Service Virtualization->Add SV server \ No newline at end of file