//[TestMethod]
        public void Batches_Success()
        {
            var    getBatchesResult = service.ListBatches();
            string batchId          = "";

            using (FileStream fsInput = File.OpenRead(objectStorageCredentialsInputFilepath))
            {
                using (FileStream fsOutput = File.OpenRead(objectStorageCredentialsOutputFilepath))
                {
                    var createBatchResult = service.CreateBatch(
                        "html_conversion",
                        fsInput,
                        "us-south",
                        "compare-comply-integration-test-bucket-input",
                        fsOutput,
                        "us-south",
                        "compare-comply-integration-test-bucket-output"
                        );
                    batchId = createBatchResult.BatchId;
                    Assert.IsNotNull(createBatchResult);
                    Assert.IsTrue(!string.IsNullOrEmpty(createBatchResult.BatchId));
                }
            }

            var getBatchResult    = service.GetBatch(batchId);
            var updateBatchResult = service.UpdateBatch(batchId, "rescan");

            Assert.IsNotNull(updateBatchResult);
            Assert.IsNotNull(getBatchResult);
            Assert.IsTrue(getBatchResult.BatchId == batchId);
            Assert.IsTrue(getBatchesResult._Batches != null);
            Assert.IsNotNull(getBatchesResult);
        }
Exemple #2
0
        public void Batches_Success()
        {
            service.WithHeader("X-Watson-Test", "1");
            var    getBatchesResult = service.ListBatches();
            string batchId          = "";

            using (FileStream fsInput = File.OpenRead(objectStorageCredentialsInputFilepath))
            {
                using (FileStream fsOutput = File.OpenRead(objectStorageCredentialsOutputFilepath))
                {
                    using (MemoryStream msInput = new MemoryStream())
                    {
                        using (MemoryStream msOutput = new MemoryStream())
                        {
                            fsInput.CopyTo(msInput);
                            fsOutput.CopyTo(msOutput);
                            service.WithHeader("X-Watson-Test", "1");
                            var createBatchResult = service.CreateBatch(
                                function: "html_conversion",
                                inputCredentialsFile: msInput,
                                inputBucketLocation: "us-south",
                                inputBucketName: "compare-comply-integration-test-bucket-input",
                                outputCredentialsFile: msOutput,
                                outputBucketLocation: "us-south",
                                outputBucketName: "compare-comply-integration-test-bucket-output"
                                );

                            batchId = createBatchResult.Result.BatchId;
                            Assert.IsNotNull(createBatchResult.Result);
                            Assert.IsTrue(!string.IsNullOrEmpty(createBatchResult.Result.BatchId));
                        }
                    }
                }
            }

            service.WithHeader("X-Watson-Test", "1");
            var getBatchResult = service.GetBatch(
                batchId: batchId
                );

            service.WithHeader("X-Watson-Test", "1");
            var updateBatchResult = service.UpdateBatch(
                batchId: batchId,
                action: "rescan",
                model: compareComplyModel
                );

            Assert.IsNotNull(updateBatchResult);
            Assert.IsNotNull(getBatchResult);
            Assert.IsTrue(getBatchResult.Result.BatchId == batchId);
            Assert.IsTrue(getBatchesResult.Result._Batches != null);
            Assert.IsNotNull(getBatchesResult);
        }
Exemple #3
0
        public void GetBatch()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            CompareComplyService service = new CompareComplyService("2018-10-15", authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var result = service.GetBatch(
                batchId: "{batch-id}"
                );

            Console.WriteLine(result.Response);
        }
Exemple #4
0
        public void GetBatch()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            var result = service.GetBatch(
                batchId: batchId
                );

            Console.WriteLine(result.Response);
        }
Exemple #5
0
        public void GetBatch()
        {
            TokenOptions tokenOptions = new TokenOptions()
            {
                IamApiKey  = apikey,
                ServiceUrl = url
            };

            CompareComplyService service = new CompareComplyService(tokenOptions, versionDate);

            var result = service.GetBatch(
                batchId: batchId
                );

            Console.WriteLine(result.Response);
        }
        public void GetBatch_Success()
        {
            IClient  client  = Substitute.For <IClient>();
            IRequest request = Substitute.For <IRequest>();

            client.GetAsync(Arg.Any <string>())
            .Returns(request);

            CompareComplyService service = new CompareComplyService(client);
            var versionDate = "versionDate";

            service.VersionDate = versionDate;

            var batchId = "batchId";

            var result = service.GetBatch(batchId: batchId);

            request.Received().WithArgument("version", versionDate);
            client.Received().GetAsync($"{service.ServiceUrl}/v1/batches/{batchId}");
        }
Exemple #7
0
        public IEnumerator TestGetBatch()
        {
            Log.Debug("CompareComplyServiceV1IntegrationTests", "Attempting to GetBatch...");
            BatchStatus getBatchResponse = null;

            service.GetBatch(
                callback: (DetailedResponse <BatchStatus> response, IBMError error) =>
            {
                Log.Debug("CompareComplyServiceV1IntegrationTests", "GetBatch result: {0}", response.Response);
                getBatchResponse = response.Result;
                Assert.IsNotNull(getBatchResponse);
                Assert.IsTrue(getBatchResponse.BatchId == createdBatchId);
                Assert.IsNull(error);
            },
                batchId: createdBatchId
                );

            while (getBatchResponse == null)
            {
                yield return(null);
            }
        }