use of com.azure.cosmos.models.CosmosStoredProcedureResponse in project DataSpaceConnector by eclipse-dataspaceconnector.
the class CosmosTransferProcessStoreIntegrationTest method uploadStoredProcedure.
private static void uploadStoredProcedure(CosmosContainer container, String name) {
var is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name + ".js");
if (is == null) {
throw new AssertionError("The input stream referring to the " + name + " file cannot be null!");
}
Scanner s = new Scanner(is).useDelimiter("\\A");
String body = s.hasNext() ? s.next() : "";
CosmosStoredProcedureProperties props = new CosmosStoredProcedureProperties(name, body);
CosmosScripts scripts = container.getScripts();
if (scripts.readAllStoredProcedures().stream().noneMatch(sp -> sp.getId().equals(name))) {
CosmosStoredProcedureResponse storedProcedure = scripts.createStoredProcedure(props);
}
}
Aggregations