Skip to content

Commit 90487c8

Browse files
committed
feat(Discovery v2): Add support for Discovery V2
1 parent 244e035 commit 90487c8

File tree

5 files changed

+114
-3
lines changed

5 files changed

+114
-3
lines changed

IBM.Watson.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.Watson.VisualRecognitio
129129
EndProject
130130
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.Watson.VisualRecognition.v4.Examples", "examples\IBM.Watson.VisualRecognition.v4.Examples\IBM.Watson.VisualRecognition.v4.Examples.csproj", "{EAB0C966-76C7-4457-AAC4-383A298A5EAB}"
131131
EndProject
132+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DiscoveryV2", "DiscoveryV2", "{9A62662C-AB8A-4683-B251-B9B8B95B5F49}"
133+
EndProject
134+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.Watson.Discovery.v2", "src\IBM.Watson.Discovery.v2\IBM.Watson.Discovery.v2.csproj", "{BA689C8D-4763-4569-88BC-5D4BE3EB3021}"
135+
EndProject
136+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IBM.Watson.Discovery.v2.IntegrationTests", "test\Discovery.v2.IntegrationTests\IBM.Watson.Discovery.v2.IntegrationTests.csproj", "{3D256EE8-CEB5-4871-983B-A8240571347E}"
137+
EndProject
132138
Global
133139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
134140
Debug|Any CPU = Debug|Any CPU
@@ -331,6 +337,14 @@ Global
331337
{EAB0C966-76C7-4457-AAC4-383A298A5EAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
332338
{EAB0C966-76C7-4457-AAC4-383A298A5EAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
333339
{EAB0C966-76C7-4457-AAC4-383A298A5EAB}.Release|Any CPU.Build.0 = Release|Any CPU
340+
{BA689C8D-4763-4569-88BC-5D4BE3EB3021}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
341+
{BA689C8D-4763-4569-88BC-5D4BE3EB3021}.Debug|Any CPU.Build.0 = Debug|Any CPU
342+
{BA689C8D-4763-4569-88BC-5D4BE3EB3021}.Release|Any CPU.ActiveCfg = Release|Any CPU
343+
{BA689C8D-4763-4569-88BC-5D4BE3EB3021}.Release|Any CPU.Build.0 = Release|Any CPU
344+
{3D256EE8-CEB5-4871-983B-A8240571347E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
345+
{3D256EE8-CEB5-4871-983B-A8240571347E}.Debug|Any CPU.Build.0 = Debug|Any CPU
346+
{3D256EE8-CEB5-4871-983B-A8240571347E}.Release|Any CPU.ActiveCfg = Release|Any CPU
347+
{3D256EE8-CEB5-4871-983B-A8240571347E}.Release|Any CPU.Build.0 = Release|Any CPU
334348
EndGlobalSection
335349
GlobalSection(SolutionProperties) = preSolution
336350
HideSolutionNode = FALSE
@@ -384,6 +398,8 @@ Global
384398
{86FC135E-3D1E-40FE-9BE6-1B0A72ACDC20} = {69DE0999-CABC-4108-9B49-2B902D9A318E}
385399
{AF2B1FCA-118D-4ABA-B7B0-EFB6BBC7164F} = {69DE0999-CABC-4108-9B49-2B902D9A318E}
386400
{EAB0C966-76C7-4457-AAC4-383A298A5EAB} = {69DE0999-CABC-4108-9B49-2B902D9A318E}
401+
{BA689C8D-4763-4569-88BC-5D4BE3EB3021} = {9A62662C-AB8A-4683-B251-B9B8B95B5F49}
402+
{3D256EE8-CEB5-4871-983B-A8240571347E} = {9A62662C-AB8A-4683-B251-B9B8B95B5F49}
387403
EndGlobalSection
388404
GlobalSection(ExtensibilityGlobals) = postSolution
389405
SolutionGuid = {B9D9D17B-1C17-402F-B701-DC671528690A}

test/Discovery.v1.IntegrationTests/DiscoveryCpdIntegrationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
namespace IBM.Watson.Discovery.v1.IntegrationTests
2222
{
23-
[TestClass]
23+
//[TestClass] // CPD only
2424
public class DiscoveryCpdIntegrationTests
2525
{
2626
private DiscoveryService service;
@@ -48,7 +48,7 @@ public void Setup()
4848
collectionId = listCollectionsResult.Result.Collections[0].CollectionId;
4949
}
5050

51-
//[TestMethod] // CPD only
51+
[TestMethod]
5252
public void TestAutocompletion()
5353
{
5454
var autoCompletionResult = service.GetAutocompletion(environmentId: environmentId, collectionId: collectionId, prefix: "ho");
@@ -58,7 +58,7 @@ public void TestAutocompletion()
5858
Assert.IsNotNull(autoCompletionResult.Result._Completions[0]);
5959
}
6060

61-
//[TestMethod] // CPD only
61+
[TestMethod]
6262
public void TestSpellingSuggestions()
6363
{
6464
var queryResult = service.Query(environmentId: environmentId, collectionId: collectionId, naturalLanguageQuery: "cluod", spellingSuggestions: true);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright 2019 IBM Corp. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
using Microsoft.VisualStudio.TestTools.UnitTesting;
19+
20+
namespace IBM.Watson.Discovery.v2.IntegrationTests
21+
{
22+
[TestClass]
23+
public class DiscoveryIntegrationTests
24+
{
25+
private DiscoveryService service;
26+
private string versionDate = "2019-11-20";
27+
28+
[TestInitialize]
29+
public void Setup()
30+
{
31+
service = new DiscoveryService(versionDate);
32+
}
33+
}
34+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<VersionPrefix>4.0.0</VersionPrefix>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
<AssemblyName>IBM.Watson.Discovery.v2.IntegrationTests</AssemblyName>
7+
<PackageId>IBM.Watson.Discovery.v2.IntegrationTests</PackageId>
8+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
9+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
10+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
11+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
12+
<Version>4.0.0</Version>
13+
</PropertyGroup>
14+
15+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
16+
<DebugType>full</DebugType>
17+
<DebugSymbols>true</DebugSymbols>
18+
</PropertyGroup>
19+
20+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
21+
<DebugType>full</DebugType>
22+
<DebugSymbols>true</DebugSymbols>
23+
</PropertyGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
27+
<PackageReference Include="MSTest.TestAdapter" Version="1.1.8-rc" />
28+
<PackageReference Include="MSTest.TestFramework" Version="1.0.8-rc" />
29+
<PackageReference Include="NSubstitute" Version="4.2.1" />
30+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
31+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="1.0.2" />
32+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
33+
<PackageReference Include="OpenCover" Version="4.7.922" />
34+
<PackageReference Include="coveralls.net" Version="0.7.0" />
35+
<PackageReference Include="ReportGenerator" Version="4.1.5" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<ProjectReference Include="..\..\src\IBM.Watson.Discovery.v2\IBM.Watson.Discovery.v2.csproj" />
40+
</ItemGroup>
41+
42+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyConfiguration("")]
9+
[assembly: AssemblyCompany("")]
10+
[assembly: AssemblyProduct("IBM.Watson.Discovery.v1.IntegrationTests")]
11+
[assembly: AssemblyTrademark("")]
12+
13+
// Setting ComVisible to false makes the types in this assembly not visible
14+
// to COM components. If you need to access a type in this assembly from
15+
// COM, set the ComVisible attribute to true on that type.
16+
[assembly: ComVisible(false)]
17+
18+
// The following GUID is for the ID of the typelib if this project is exposed to COM
19+
[assembly: Guid("0248ba8f-0351-4f9c-acb3-7d9fe42a4cb1")]

0 commit comments

Comments
 (0)