Skip to content

Commit

Permalink
Fixing NPE #6281 (#6626)
Browse files Browse the repository at this point in the history
* Fixing NPE #6281
  • Loading branch information
mbhaskar authored and kushagraThapar committed Dec 4, 2019
1 parent 280d8ca commit d58cc35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public Mono<CosmosStoredProcedureResponse> execute(Object[] procedureParams, Cos
return cosmosContainer.getDatabase()
.getDocClientWrapper()
.executeStoredProcedure(getLink(), options.toRequestOptions(), procedureParams)
.map(response -> new CosmosStoredProcedureResponse(response, cosmosContainer))
.map(response -> new CosmosStoredProcedureResponse(response, cosmosContainer, this.id))
.single();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ public class CosmosStoredProcedureResponse extends CosmosResponse<CosmosStoredPr
}
}

CosmosStoredProcedureResponse(StoredProcedureResponse response, CosmosContainer cosmosContainer) {
CosmosStoredProcedureResponse(StoredProcedureResponse response, CosmosContainer cosmosContainer,
String storedProcedureId) {
super(response);
this.storedProcedureResponse = response;
this.storedProcedure = new CosmosStoredProcedure(storedProcedureId, cosmosContainer);
}

/**
Expand All @@ -34,7 +36,7 @@ public CosmosStoredProcedureProperties properties() {

/**
* Gets the stored procedure object
* @return the stored procedure object or null
* @return the stored procedure object or null in case of delete request
*/
public CosmosStoredProcedure storedProcedure() {
return this.storedProcedure;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.azure.data.cosmos.CosmosStoredProcedureRequestOptions;
import com.azure.data.cosmos.FeedOptions;
import com.azure.data.cosmos.FeedResponse;
import com.azure.data.cosmos.PartitionKey;
import com.azure.data.cosmos.SqlQuerySpec;
import com.azure.data.cosmos.internal.HttpConstants;
import com.azure.data.cosmos.rx.TestSuiteBase;
Expand Down Expand Up @@ -148,8 +149,6 @@ public void deleteStoredProcedure() throws Exception {

}

// TODO: Fix underlying async execute response issue before enabling this test
/*
@Test(groups = {"simple"}, timeOut = TIMEOUT)
public void executeStoredProcedure() throws Exception {
CosmosStoredProcedureProperties sproc = new CosmosStoredProcedureProperties()
Expand All @@ -159,11 +158,11 @@ public void executeStoredProcedure() throws Exception {
CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(sproc);
CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions();
options.partitionKey(PartitionKey.None);
container.getScripts()
.getStoredProcedure(sproc.id())
.execute(null, options);
CosmosSyncStoredProcedureResponse executeResponse = container.getScripts()
.getStoredProcedure(sproc.id())
.execute(null, options);
assertThat(executeResponse.activityId()).isNotEmpty();
}
*/

@Test(groups = {"simple"}, timeOut = TIMEOUT)
private void readAllSprocs() throws Exception {
Expand Down

0 comments on commit d58cc35

Please sign in to comment.