8000 feat: Add ODP GraphQL Manager and Tests by mikechu-optimizely · Pull Request #310 · optimizely/csharp-sdk · GitHub
[go: up one dir, main page]

Skip to content

feat: Add ODP GraphQL Manager and Tests #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f7e0138
Initial GraphQLManager tests
mikechu-optimizely Aug 3, 2022
4536719
Correct GraphQLManagerTest.cs
mikechu-optimizely Aug 3, 2022
f2b4e79
Add GraphQL manager and supporting entities
mikechu-optimizely Aug 3, 2022
1e579ee
Fully cover json response
mikechu-optimizely Aug 3, 2022
d2df4a0
Adding GQLManager interface for testing
mikechu-optimizely Aug 3, 2022
368817f
Tests for common scenarios Swift ref
mikechu-optimizely Aug 3, 2022
728e1a8
Fix compiler error
mikechu-optimizely Aug 3, 2022
5e08827
Refactors
mikechu-optimizely Aug 3, 2022
5909f8e
WIP Handle versions of .NET
mikechu-optimizely Aug 3, 2022
7d35390
Merge branch 'master' into mike/ats-graphql
mikechu-optimizely Aug 4, 2022
5664b75
WebRequest and HttpClient ODP clients
mikechu-optimizely Aug 4, 2022
0e96ee1
Only support NET Standard; Inject & unit test
mikechu-optimizely Aug 4, 2022
3b267f3
Filled unit tests
mikechu-optimizely Aug 4, 2022
ed3f049
Copyright notices and ending line
mikechu-optimizely Aug 4, 2022
06a61a5
Corrections and simplifications
mikechu-optimizely Aug 5, 2022
705ce61
Corrections logged messages & supporting tests
mikechu-optimizely Aug 8, 2022
9a7ef8f
Remove excess validations
mikechu-optimizely Aug 8, 2022
dd91fce
Add unexpected node; Fix test
mikechu-optimizely Aug 8, 2022
< 8000 a href="/optimizely/csharp-sdk/pull/310/commits/96b84fa741a6f28e1edef75542db359720762ac1" class="select-menu-item " role="menuitem" data-commit="96b84fa741a6f28e1edef75542db359720762ac1" data-parent-commit="dd91fce4c7360daf75f3c9df614ad9d69e6c312b">
96b84fa
Update OptimizelySDK.Tests/OdpTests/GraphQLManagerTest.cs
mikechu-optimizely Aug 8, 2022
0f444df
Update OptimizelySDK/Odp/Client/OdpClient.cs
mikechu-optimizely Aug 8, 2022
8c74e43
Update OptimizelySDK/Odp/Client/OdpClient.cs
mikechu-optimizely Aug 8, 2022
6866c82
Enhanced error handling and matching tests
mikechu-optimizely Aug 8, 2022
2b2b65d
Add end of file lines
mikechu-optimizely Aug 8, 2022
cd4e8f1
Add class internal documentation
mikechu-optimizely Aug 16, 2022
d58e683
Add line at EOF
mikechu-optimizely Aug 16, 2022
0ef9849
Merge branch 'master' into mike/ats-graphql
mikechu-optimizely Aug 17, 2022
85b9fd3
Refactoring GraphQLManager
mikechu-optimizely Aug 18, 2022
f87d7f7
Refactor OdpClient
mikechu-optimizely Aug 18, 2022
c443b52
WIP Code review edits
mikechu-optimizely Aug 22, 2022
f57b438
Update doc
mikechu-optimizely Aug 22, 2022
98ad25d
QuerySegmentsParameters Builder
mikechu-optimizely Aug 23, 2022
2d76e3b
Documentation
mikechu-optimizely Aug 23, 2022
20016f9
Document constructors
mikechu-optimizely Aug 23, 2022
76e3e9e
Code review changes
mikechu-optimizely Aug 23, 2022
f5fc257
Adjust sync-to-async call methodology
mikechu-optimizely Aug 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Copyright notices and ending line
  • Loading branch information
mikechu-optimizely committed Aug 4, 2022
commit ed3f049ee9567b40fd9111874cab20bae0217cc7
21 changes: 18 additions & 3 deletions OptimizelySDK.Tests/OdpTests/GraphQLManagerTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
using Moq;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using Moq;
using Moq.Protected;
using NUnit.Framework;
using OptimizelySDK.AudienceConditions;
Expand All @@ -9,7 +25,6 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -294,4 +309,4 @@ private HttpClient GetHttpClientThatReturnsStatus(HttpStatusCode statusCode)
return new HttpClient(mockedHandler.Object);
}
}
}
}
19 changes: 17 additions & 2 deletions OptimizelySDK/Odp/Client/IOdpClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
using OptimizelySDK.Logger;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using OptimizelySDK.Odp.Entity;

namespace OptimizelySDK.Odp.Client
Expand All @@ -7,4 +22,4 @@ public interface IOdpClient
{
string QuerySegments(QuerySegmentsParameters parameters);
}
}
}
20 changes: 18 additions & 2 deletions OptimizelySDK/Odp/Client/OdpClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
using OptimizelySDK.Logger;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using OptimizelySDK.Logger;
using OptimizelySDK.Odp.Entity;
using System;
using System.Net.Http;
Expand Down Expand Up @@ -54,4 +70,4 @@ QuerySegmentsParameters parameters
return request;
}
}
}
}
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Audience.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Audience
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Customer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Customer
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Data.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Data
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Edge.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Edge
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Error.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Error
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Extension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Extension
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Location.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Location
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Node.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Node
{
Expand Down
19 changes: 17 additions & 2 deletions OptimizelySDK/Odp/Entity/QuerySegmentsParameters.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
using Newtonsoft.Json;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using Newtonsoft.Json;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace OptimizelySDK.Odp.Entity
{
Expand Down
18 changes: 17 additions & 1 deletion OptimizelySDK/Odp/Entity/Response.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
namespace OptimizelySDK.Odp.Entity
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace OptimizelySDK.Odp.Entity
{
public class Response
{
Expand Down
20 changes: 18 additions & 2 deletions OptimizelySDK/Odp/GraphQLManager.cs
1CF5
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
using Newtonsoft.Json;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using Newtonsoft.Json;
using OptimizelySDK.AudienceConditions;
using OptimizelySDK.Logger;
using OptimizelySDK.Odp.Client;
Expand Down Expand Up @@ -80,4 +96,4 @@ public Response ParseSegmentsResponseJson(string jsonResponse)
return JsonConvert.DeserializeObject<Response>(json);
}
}
}
}
19 changes: 17 additions & 2 deletions OptimizelySDK/Odp/IGraphQLManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
using OptimizelySDK.Odp.Entity;
using System.Collections.Generic;
/*
* Copyright 2022 Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using OptimizelySDK.Odp.Entity;

namespace OptimizelySDK.Odp
{
Expand Down
0