Skip to content

Commit

Permalink
Merge 175a392 into 39b0160
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhpe committed Apr 9, 2018
2 parents 39b0160 + 175a392 commit 7fa9825
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 21 deletions.
6 changes: 5 additions & 1 deletion pom.xml
Expand Up @@ -433,12 +433,16 @@
<dependency>
<groupId>com.hp.sv</groupId>
<artifactId>SVConfigurator</artifactId>
<version>4.10.1.48219</version>
<version>4.20.0.49723</version>
<exclusions>
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Expand Up @@ -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() {
Expand All @@ -62,4 +64,8 @@ public boolean isCleanTargetDirectory() {
public boolean isSwitchToStandByFirst() {
return switchToStandByFirst;
}

public boolean isArchive() {
return archive;
}
}
Expand Up @@ -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() {
Expand All @@ -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
Expand Down
Expand Up @@ -91,7 +91,7 @@ private Iterable<IService> 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)) {
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -71,8 +73,8 @@ public class SvExportBuilder extends AbstractSvRunBuilder<SvExportModel> {

@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
Expand All @@ -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");

Expand All @@ -104,14 +107,23 @@ 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);
}

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());
}
}

Expand Down Expand Up @@ -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());
Expand Down
@@ -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
Expand Down Expand Up @@ -32,4 +32,4 @@
#

# suppress inspection "UnusedProperty"
NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
@@ -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
Expand Down Expand Up @@ -32,4 +32,4 @@
#

# suppress inspection "UnusedProperty"
NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
Expand Up @@ -68,4 +68,8 @@
<f:entry title="Force" field="force">
<f:checkbox checked="${instance.model.force}"/>
</f:entry>

<f:entry title="Archive" field="archive">
<f:checkbox checked="${instance.model.archive}"/>
</f:entry>
</j:jelly>
@@ -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
Expand Down Expand Up @@ -32,4 +32,4 @@
#

# suppress inspection "UnusedProperty"
NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
@@ -0,0 +1,36 @@
<!--
~ © 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
~ marks are the property of their respective owners.
~ __________________________________________________________________
~ MIT License
~
~ Copyright (c) 2018 Micro Focus Company, L.P.
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
~ ___________________________________________________________________
~
-->

<div>
If set, Export service(s) as project archive(s) (.vproja).
</div>
@@ -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
Expand Down Expand Up @@ -32,4 +32,4 @@
#

# suppress inspection "UnusedProperty"
NoSvServerDefined=No HPE Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>
NoSvServerDefined=No Service Virtualization server is defined. To use this build step, goto <b>Manage Jenkins->Configure System->Service Virtualization->Add SV server</b>

0 comments on commit 7fa9825

Please sign in to comment.