|
2 | 2 |
|
3 | 3 | import java.io.File; |
4 | 4 | import java.io.IOException; |
5 | | -import java.util.HashMap; |
6 | 5 | import java.util.Map; |
7 | 6 |
|
8 | | -import com.axway.maven.apigw.utils.*; |
9 | 7 | import org.apache.commons.io.FileUtils; |
10 | 8 | import org.apache.maven.plugin.MojoExecutionException; |
11 | 9 | import org.apache.maven.plugin.MojoFailureException; |
|
14 | 12 | import org.apache.maven.plugins.annotations.Mojo; |
15 | 13 | import org.apache.maven.plugins.annotations.Parameter; |
16 | 14 |
|
| 15 | +import com.axway.maven.apigw.utils.FedBuilder; |
| 16 | +import com.axway.maven.apigw.utils.ProjectDeploy; |
| 17 | +import com.axway.maven.apigw.utils.ProjectPack; |
| 18 | +import com.axway.maven.apigw.utils.Source; |
| 19 | +import com.axway.maven.apigw.utils.Target; |
17 | 20 | import com.fasterxml.jackson.databind.ObjectMapper; |
18 | 21 | import com.fasterxml.jackson.databind.node.ObjectNode; |
19 | 22 |
|
@@ -77,7 +80,7 @@ private void deployPolicyProject() throws MojoExecutionException { |
77 | 80 | // pack test server project |
78 | 81 | ProjectPack packer = new ProjectPack(this.homeAxwayGW, getLog()); |
79 | 82 | packer.setPassphrasePol(this.passphrasePol); |
80 | | - int exitCode = packer.execute(getTempDir(), PROJECT_NAME, this.testServerDirectory, null); |
| 83 | + int exitCode = packer.execute(getTempDir(), PROJECT_NAME, this.testServerDirectory, buildPolicyProperties()); |
81 | 84 | if (exitCode != 0) { |
82 | 85 | throw new MojoExecutionException("failed to build packed project"); |
83 | 86 | } |
@@ -154,19 +157,14 @@ private File configFed(File pol, File env, File info) throws MojoExecutionExcept |
154 | 157 |
|
155 | 158 | private void deployFed(File fed) throws MojoExecutionException { |
156 | 159 | try { |
157 | | - Map<String, String> polProps = new HashMap<>(); |
158 | | - polProps.put("Name", this.project.getGroupId() + ":" + this.project.getArtifactId()); |
159 | | - polProps.put("Version", this.project.getVersion()); |
160 | | - polProps.put("Type", "Test Deployment"); |
| 160 | + Map<String, String> polProps = buildPolicyProperties(); |
161 | 161 |
|
162 | 162 | Source source = new Source(fed, this.passphraseFed); |
163 | 163 | Target target = new Target(this.deployGroup, this.passphraseDeploy); |
164 | 164 |
|
165 | | - AbstractCommandExecutor deploy; |
166 | | - |
167 | 165 | // Deploying to a Classic Gateway, ok to use projdeploy |
168 | 166 | this.getLog().info("Using projdeploy to deploy the fed file"); |
169 | | - deploy = new ProjectDeploy(this.homeAxwayGW, getDomain(), getLog()); |
| 167 | + ProjectDeploy deploy = new ProjectDeploy(this.homeAxwayGW, getDomain(), getLog()); |
170 | 168 | int exitCode = deploy.execute(source, target, polProps, null); |
171 | 169 | if (exitCode != 0) { |
172 | 170 | throw new MojoExecutionException("Failed to deploy project: exitCode=" + exitCode); |
|
0 commit comments