//[TestMethod] public void TestCreateCollection() { service.WithHeader("X-Watson-Test", "1"); var createCollectionResult = service.CreateCollection( projectId: projectId, name: "name test", description: "description test", language: "en" ); Assert.IsNotNull(createCollectionResult.Response); Assert.IsNotNull(createCollectionResult.Result.CollectionId); Assert.IsTrue(createCollectionResult.Result.Name == "name test"); Assert.IsTrue(createCollectionResult.Result.Description == "description test"); Assert.IsTrue(createCollectionResult.Result.Language == "en"); // Delete collection service.WithHeader("X-Watson-Test", "1"); var deleteCollectionResult = service.DeleteCollection( projectId: projectId, collectionId: createCollectionResult.Result.CollectionId ); Assert.IsNotNull(deleteCollectionResult.Response); Assert.IsTrue(deleteCollectionResult.StatusCode == 204); }
private void DeleteCollection() { Console.WriteLine(string.Format("\nCalling DeleteCollection()...")); if (string.IsNullOrEmpty(_createdEnvironmentId)) { throw new ArgumentNullException("_createdEnvironmentId is null"); } if (string.IsNullOrEmpty(_createdCollectionId)) { throw new ArgumentNullException("_createdCollectionId is null"); } var result = _discovery.DeleteCollection(_createdEnvironmentId, _createdCollectionId); if (result != null) { Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); _createdCollectionId = null; } else { Console.WriteLine("result is null."); } }
public void DeleteCollection() { Console.WriteLine(string.Format("\nCalling DeleteCollection()...")); if (string.IsNullOrEmpty(_createdEnvironmentId)) { Assert.Fail("_createdEnvironmentId is null"); } if (string.IsNullOrEmpty(_createdCollectionId)) { Assert.Fail("_createdCollectionId is null"); } var result = _discovery.DeleteCollection(_createdEnvironmentId, _createdCollectionId); if (result != null) { Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); _createdCollectionId = null; } else { Console.WriteLine("result is null."); } Assert.IsNotNull(result); Assert.IsTrue(result.Status == DeleteCollectionResponse.StatusEnum.DELETED); }
public void DeleteCollection() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); DiscoveryService service = new DiscoveryService("2019-04-30", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.DeleteCollection( environmentId: "{environmentId}", collectionId: "{collectionId}" ); Console.WriteLine(result.Response); }
public void DeleteCollection() { IamConfig config = new IamConfig( apikey: apikey ); DiscoveryService service = new DiscoveryService(versionDate, config); service.SetEndpoint(url); var result = service.DeleteCollection( environmentId: environmentId, collectionId: collectionId ); Console.WriteLine(result.Response); }
public void DeleteCollection() { TokenOptions tokenOptions = new TokenOptions() { IamApiKey = apikey, ServiceUrl = url }; DiscoveryService service = new DiscoveryService(tokenOptions, versionDate); var result = service.DeleteCollection( environmentId: environmentId, collectionId: collectionId ); Console.WriteLine(result.Response); }
public IEnumerator TestDeleteCollection() { Log.Debug("DiscoveryServiceV2IntegrationTests", "Attempting to DeleteCollection..."); bool deleteCollectionResponse = false; service.DeleteCollection( callback: (DetailedResponse <object> response, IBMError error) => { Log.Debug("DiscoveryServiceV2IntegrationTests", "DeleteCollection result: {0}", response.Response); deleteCollectionResponse = true; Assert.IsNull(error); }, projectId: projectId, collectionId: collectionId ); while (!deleteCollectionResponse) { yield return(null); } }
public static void TearDown() { var environmentVariable = Environment.GetEnvironmentVariable("VCAP_SERVICES"); var fileContent = File.ReadAllText(environmentVariable); var vcapServices = JObject.Parse(fileContent); string _endpoint = vcapServices["discovery"][0]["credentials"]["url"].Value <string>(); string _username = vcapServices["discovery"][0]["credentials"]["username"].Value <string>(); string _password = vcapServices["discovery"][0]["credentials"]["password"].Value <string>(); DiscoveryService _discovery = new DiscoveryService(_username, _password, DiscoveryService.DISCOVERY_VERSION_DATE_2016_12_01); if (!string.IsNullOrEmpty(_createdEnvironmentId) && !string.IsNullOrEmpty(_createdCollectionId) && !string.IsNullOrEmpty(_createdDocumentId)) { _discovery.DeleteDocument(_createdEnvironmentId, _createdCollectionId, _createdDocumentId); } if (!string.IsNullOrEmpty(_createdEnvironmentId) && !string.IsNullOrEmpty(_createdCollectionId)) { _discovery.DeleteCollection(_createdEnvironmentId, _createdCollectionId); } if (!string.IsNullOrEmpty(_createdEnvironmentId) && !string.IsNullOrEmpty(_createdConfigurationId)) { _discovery.DeleteConfiguration(_createdEnvironmentId, _createdConfigurationId); } if (!string.IsNullOrEmpty(_createdEnvironmentId)) { _discovery.DeleteEnvironment(_createdEnvironmentId); } }