Skip to content

Commit f4d18ec

Browse files
Merge pull request #138 from apigee/Issue137
Fix for #137
2 parents f5db7ce + 18d3b23 commit f4d18ec

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

samples/mockapi-recommended/src/gateway/shared-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<plugin>
7474
<groupId>io.apigee.build-tools.enterprise4g</groupId>
7575
<artifactId>apigee-edge-maven-plugin</artifactId>
76-
<version>1.2.1</version>
76+
<version>1.2.2</version>
7777
<executions>
7878
<execution>
7979
<id>configure-bundle</id>

samples/security-sharedflow/src/sharedflows/parent-sharedflow-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<plugin>
7474
<groupId>io.apigee.build-tools.enterprise4g</groupId>
7575
<artifactId>apigee-edge-maven-plugin</artifactId>
76-
<version>1.2.1</version>
76+
<version>1.2.2</version>
7777
<executions>
7878
<execution>
7979
<id>configure-bundle</id>

src/main/java/io/apigee/buildTools/enterprise4g/rest/RestClient.java

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,16 @@
2020

2121
import java.io.File;
2222
import java.io.IOException;
23-
import java.util.*;
24-
25-
import com.google.api.client.http.javanet.NetHttpTransport;
26-
import org.slf4j.Logger;
27-
import org.slf4j.LoggerFactory;
23+
import java.util.ArrayList;
24+
import java.util.Collections;
25+
import java.util.Iterator;
26+
import java.util.List;
2827

2928
import javax.net.ssl.HttpsURLConnection;
3029

31-
import com.google.api.client.http.apache.ApacheHttpTransport;
32-
import com.google.api.client.json.gson.GsonFactory;
3330
import org.apache.maven.plugin.MojoExecutionException;
31+
import org.slf4j.Logger;
32+
import org.slf4j.LoggerFactory;
3433

3534
import com.apigee.mgmtapi.sdk.client.MgmtAPIClient;
3635
import com.apigee.mgmtapi.sdk.model.AccessToken;
@@ -46,11 +45,15 @@
4645
import com.google.api.client.http.HttpResponseException;
4746
import com.google.api.client.http.HttpTransport;
4847
import com.google.api.client.http.UrlEncodedContent;
48+
import com.google.api.client.http.apache.ApacheHttpTransport;
49+
import com.google.api.client.http.javanet.NetHttpTransport;
4950
import com.google.api.client.json.JsonFactory;
51+
import com.google.api.client.json.gson.GsonFactory;
5052
import com.google.api.client.util.GenericData;
5153
import com.google.api.client.util.Key;
5254
import com.google.gson.Gson;
5355
import com.google.gson.GsonBuilder;
56+
import com.google.gson.JsonSyntaxException;
5457

5558
import io.apigee.buildTools.enterprise4g.utils.PrintUtil;
5659
import io.apigee.buildTools.enterprise4g.utils.ServerProfile;
@@ -638,9 +641,26 @@ public String activateBundleRevision(Bundle bundle) throws IOException {
638641

639642
HttpResponse response = null;
640643
response = executeAPI(profile, deployRestRequest);
644+
String responseString = response.parseAsString();
645+
SeamLessDeploymentStatus deployment3 = null;
646+
try{
647+
deployment3 = new Gson().fromJson(responseString, SeamLessDeploymentStatus.class);
648+
}catch (JsonSyntaxException e){
649+
// https://github.com/apigee/apigee-deploy-maven-plugin/issues/92
650+
// https://github.com/apigee/apigee-deploy-maven-plugin/issues/137
651+
// Whenever an existing API is deployed with option as override and in the new revision, the proxy basepath is changed,
652+
// the Mgmt API response is different. It does not return the usual response if the proxy has no changes to the basepath
653+
deployment2 = new Gson().fromJson(responseString, BundleActivationConfig.class);
654+
if (log.isInfoEnabled()) {
655+
log.info(PrintUtil.formatResponse(response, gson.toJson(deployment2)));
656+
log.info("Deployed revision is:{}", deployment2.revision);
657+
}
658+
applyDelay();
659+
return deployment2.state;
660+
}
641661

642662
if (getProfile().isOverride()) {
643-
SeamLessDeploymentStatus deployment3 = response.parseAs(SeamLessDeploymentStatus.class);
663+
//deployment3 = response.parseAs(SeamLessDeploymentStatus.class);
644664
Iterator<BundleActivationConfig> iter = deployment3.environment.iterator();
645665
while (iter.hasNext()) {
646666
BundleActivationConfig config = iter.next();
@@ -663,7 +683,7 @@ public String activateBundleRevision(Bundle bundle) throws IOException {
663683

664684
}
665685

666-
deployment2 = response.parseAs(BundleActivationConfig.class);
686+
deployment2 = new Gson().fromJson(responseString, BundleActivationConfig.class);
667687
if (log.isInfoEnabled()) {
668688
log.info(PrintUtil.formatResponse(response, gson.toJson(deployment2)));
669689
log.info("Deployed revision is:{}", deployment2.revision);

0 commit comments

Comments
 (0)