public void TestGetComponentSettings()
        {
            service.WithHeader("X-Watson-Test", "1");
            var getComponentSettingsResult = service.GetComponentSettings(
                projectId: projectId
                );

            Assert.IsNotNull(getComponentSettingsResult.Result);
            Assert.IsNotNull(getComponentSettingsResult.Result.ResultsPerPage);
            Assert.IsNotNull(getComponentSettingsResult.Result.FieldsShown);
            Assert.IsNotNull(getComponentSettingsResult.Result.Aggregations);
            Assert.IsNotNull(getComponentSettingsResult.Result.Autocomplete);
        }
예제 #2
0
        public void GetComponentSettings()
        {
            CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
                url: "https://{cpd_cluster_host}{:port}",
                username: "******",
                password: "******"
                );

            DiscoveryService service = new DiscoveryService("2019-11-22", authenticator);

            service.SetServiceUrl("{https://{cpd_cluster_host}{:port}/discovery/{release}/instances/{instance_id}/api}");

            var result = service.GetComponentSettings(
                projectId: "{project_id}"
                );

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

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

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

            service.VersionDate = versionDate;

            var projectId = "projectId";

            var result = service.GetComponentSettings(projectId: projectId);

            request.Received().WithArgument("version", versionDate);
            client.Received().GetAsync($"{service.ServiceUrl}/v2/projects/{projectId}/component_settings");
        }
예제 #4
0
        public IEnumerator TestGetComponentSettings()
        {
            Log.Debug("DiscoveryServiceV2IntegrationTests", "Attempting to GetComponentSettings...");
            ComponentSettingsResponse componentSettingsResponse = null;

            service.GetComponentSettings(
                callback: (DetailedResponse <ComponentSettingsResponse> response, IBMError error) =>
            {
                Log.Debug("DiscoveryServiceV2IntegrationTests", "GetComponentSettings result: {0}", response.Response);
                componentSettingsResponse = response.Result;
                Assert.IsNotNull(componentSettingsResponse);
                Assert.IsNotNull(componentSettingsResponse.Aggregations);
                Assert.IsTrue(componentSettingsResponse.Aggregations.Count > 0);
                Assert.IsNull(error);
            },
                projectId: projectId
                );

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