Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing NPE #6281 #6626

Merged
merged 2 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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