public async Task GremlinGraphCreateUpdateTests() { IList <IncludedPath> includedPath = new List <IncludedPath> { new IncludedPath { Path = "/*" } }; IList <ExcludedPath> excludedPaths = new List <ExcludedPath> { new ExcludedPath { Path = "/pathToNotIndex/*" } }; IList <IList <CompositePath> > compositeIndexes = new List <IList <CompositePath> > { new List <CompositePath> { new CompositePath { Path = "/orderByPath1", Order = CompositePathSortOrder.Ascending }, new CompositePath { Path = "/orderByPath2", Order = CompositePathSortOrder.Descending } }, new List <CompositePath> { new CompositePath { Path = "/orderByPath3", Order = CompositePathSortOrder.Ascending }, new CompositePath { Path = "/orderByPath4", Order = CompositePathSortOrder.Descending } } }; IList <SpatialSpec> spatialIndexes = new List <SpatialSpec> { new SpatialSpec("/*", new List <SpatialType> { new SpatialType("Point") }) }; IndexingPolicy indexingPolicy = new IndexingPolicy(true, IndexingMode.Consistent, includedPath, excludedPaths, compositeIndexes, spatialIndexes); ContainerPartitionKey containerPartitionKey = new ContainerPartitionKey(new List <string> { "/address" }, "Hash", null); IList <string> paths = new List <string>() { "/testpath" }; UniqueKey uk = new UniqueKey(paths); IList <UniqueKey> uniqueKeys = new List <UniqueKey>(); uniqueKeys.Add(uk); UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(uniqueKeys); ConflictResolutionPolicy conflictResolutionPolicy = new ConflictResolutionPolicy(new ConflictResolutionMode("LastWriterWins"), "/path", ""); CreateUpdateOptions createUpdateOptions = new CreateUpdateOptions(sampleThroughput, new AutoscaleSettings()); GremlinGraphCreateUpdateParameters gremlinGraphCreateUpdateParameters = new GremlinGraphCreateUpdateParameters(new GremlinGraphResource(gremlinGraphName, indexingPolicy, containerPartitionKey, -1, uniqueKeyPolicy, conflictResolutionPolicy), createUpdateOptions); Response <GremlinGraphGetResults> gremlinResponse = await WaitForCompletionAsync(await CosmosDBManagementClient.GremlinResources.StartCreateUpdateGremlinGraphAsync(resourceGroupName, databaseAccountName, databaseName, gremlinGraphName, gremlinGraphCreateUpdateParameters)); Assert.NotNull(gremlinResponse); GremlinGraphGetResults gremlinGraphGetResults = gremlinResponse.Value; Assert.NotNull(gremlinGraphGetResults); VerifyGremlinGraphCreation(gremlinGraphGetResults, gremlinGraphCreateUpdateParameters); var throughputResponse = CosmosDBManagementClient.GremlinResources.GetGremlinGraphThroughputAsync(resourceGroupName, databaseAccountName, databaseName, gremlinGraphName); ThroughputSettingsGetResults throughputSettingsGetResults = throughputResponse.ConfigureAwait(false).GetAwaiter().GetResult(); Assert.NotNull(throughputSettingsGetResults); Assert.NotNull(throughputSettingsGetResults.Name); Assert.AreEqual(throughputSettingsGetResults.Resource.Throughput, sampleThroughput); Assert.AreEqual(gremlinGraphsThroughputType, throughputSettingsGetResults.Type); }
public GremlinGraphImpl WithPartitionKey(ContainerPartitionKey containerPartitionKey) { this.createUpdateParameters.Resource.PartitionKey = containerPartitionKey; return(this); }