-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22968fe
commit 13dfd50
Showing
55 changed files
with
4,350 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,3 @@ provided by the bot. You will only need to do this once across all repos using o | |
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [[email protected]](mailto:[email protected]) with any additional questions or comments. | ||
|
||
# Releasing | ||
To publish Nuget packages, you must create a release using the GitHub release feature. The release should be | ||
tagged with a version like `1.0.0-master-{yyyymmdd}-{daily iteration}`. For example if you wanted to create a release | ||
on March 4, 2020 the version would be `1.0.0-master-20200304-1`. If you wanted to create a second release on that | ||
date, the version would be `1.0.0-master-20200304-2`. | ||
|
||
Publishing a release will envoke the [.NET Core Build & Publish workflow](.github/workflows/dotnetbuildpublish.yml) | ||
and publish the Nugets with the version specified to the GitHub package repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# Third party notices | ||
|
||
Do Not Translate or Localize | ||
|
||
This file is based on or incorporates material from the projects listed below (Third Party IP). The original copyright notice and the license under which Microsoft received such Third Party IP, are set forth below. Such licenses and notices are provided for informational purposes only. Microsoft licenses the Third Party IP to you under the licensing terms for the Microsoft product. Microsoft reserves all other rights not expressly granted under this agreement, whether by implication, estoppel or otherwise. | ||
|
||
## Ensure.That 8.1.2 | ||
* Component Source: https://github.com/danielwertheim/Ensure.That/ | ||
* Component Copyright and License: | ||
> The MIT License (MIT) | ||
> | ||
> Copyright (c) 2015 Daniel Wertheim | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in all | ||
> copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
> SOFTWARE. | ||
## Newtonsoft.Json.Schema 3.0.11 | ||
* Component Source: https://github.com/JamesNK/Newtonsoft.Json.Schema/ | ||
* Component Copyright and License: | ||
> Json.NET Schema | ||
> | ||
> Copyright (c) 2014 Newtonsoft | ||
> | ||
> This program is free software: you can redistribute it and/or modify it | ||
> under the terms of the GNU Affero General Public License as published by the | ||
> Free Software Foundation, either version 3 of the License, see | ||
> http://www.gnu.org/licenses/agpl-3.0.html. | ||
> | ||
> This program is distributed in the hope that it will be useful, but WITHOUT | ||
> ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
> FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. | ||
> | ||
> | ||
> Commercial License | ||
> | ||
> In addition to this license, Json.NET Schema is offered under a commercial license. | ||
## NSubstitute 4.2.1 | ||
* Component Source: https://github.com/nsubstitute/ | ||
* Component Copyright and License: | ||
> Copyright (c) 2009 Anthony Egerton ([email protected]) and David Tchepak ([email protected]) | ||
> All rights reserved. | ||
> | ||
> Redistribution and use in source and binary forms, with or without modification, | ||
> are permitted provided that the following conditions are met: | ||
> | ||
> * Redistributions of source code must retain the above copyright notice, | ||
> this list of conditions and the following disclaimer. | ||
> * Redistributions in binary form must reproduce the above copyright notice, | ||
> this list of conditions and the following disclaimer in the documentation | ||
> and/or other materials provided with the distribution. | ||
> * Neither the names of the copyright holders nor the names of | ||
> contributors may be used to endorse or promote products derived from this | ||
> software without specific prior written permission. | ||
> | ||
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
> ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
> FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
> | ||
> [ http://www.opensource.org/licenses/bsd-license.php ]> | ||
## StyleCop.Analyzers 1.1.118 | ||
* Component Source: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/ | ||
* Component Copyright and License: | ||
>Copyright (c) Tunnel Vision Laboratories, LLC. All rights reserved. | ||
> | ||
>Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
>these files except in compliance with the License. You may obtain a copy of the | ||
>License at | ||
> | ||
>http://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. | ||
> | ||
>--- | ||
> | ||
>This project uses other open source projects, which are used under the terms | ||
>of the following license(s). | ||
> | ||
>.NET Compiler Platform ("Roslyn") | ||
> | ||
> Copyright Microsoft. | ||
> | ||
> Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
> these files except in compliance with the License. You may obtain a copy of the | ||
> License at | ||
> | ||
> http://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. | ||
> | ||
>Code Cracker | ||
> | ||
> Copyright 2014 Giovanni Bassi and Elemar Jr. | ||
> | ||
> Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
> these files except in compliance with the License. You may obtain a copy of the | ||
> License at | ||
> | ||
> http://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. | ||
> | ||
>LightJson | ||
> | ||
> Copyright (c) 2017 Marcos López C. | ||
> | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
> THE SOFTWARE. | ||
## XUnit 2.4.1 | ||
* Component Source: https://github.com/xunit/xunit | ||
* Component Copyright and License: | ||
> Copyright (c) .NET Foundation and Contributors | ||
> All Rights Reserved | ||
> | ||
> 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 | ||
> | ||
> http://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. |
15 changes: 15 additions & 0 deletions
15
src/Microsoft.Health.Abstractions/Exceptions/ServiceUnavailableException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
namespace Microsoft.Health.Abstractions.Exceptions | ||
{ | ||
public class ServiceUnavailableException : MicrosoftHealthException | ||
{ | ||
public ServiceUnavailableException() | ||
: base(Resources.ServiceUnavailable) | ||
{ | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/Microsoft.Health.SqlServer.Api.UnitTests/Controllers/SchemaControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. | ||
// ------------------------------------------------------------------------------------------------- | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Routing; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Microsoft.Health.SqlServer.Api.Controllers; | ||
using Microsoft.Health.SqlServer.Features.Schema; | ||
using Newtonsoft.Json.Linq; | ||
using NSubstitute; | ||
using Xunit; | ||
|
||
namespace Microsoft.Health.SqlServer.Api.UnitTests.Controllers | ||
{ | ||
public class SchemaControllerTests | ||
{ | ||
private readonly SchemaController _schemaController; | ||
private readonly SchemaInformation _schemaInformation; | ||
|
||
public SchemaControllerTests() | ||
{ | ||
_schemaInformation = new SchemaInformation((int)TestSchemaVersion.Version1, (int)TestSchemaVersion.Version3); | ||
|
||
var urlHelperFactory = Substitute.For<IUrlHelperFactory>(); | ||
var urlHelper = Substitute.For<IUrlHelper>(); | ||
urlHelper.RouteUrl(Arg.Any<UrlRouteContext>()).Returns("https://localhost/script"); | ||
urlHelperFactory.GetUrlHelper(Arg.Any<ActionContext>()).Returns(urlHelper); | ||
|
||
var scriptProvider = Substitute.For<IScriptProvider>(); | ||
|
||
_schemaController = new SchemaController(_schemaInformation, scriptProvider, urlHelperFactory, NullLogger<SchemaController>.Instance); | ||
} | ||
|
||
[Fact] | ||
public void GivenAScriptRequest_WhenSchemaIdFound_ThenReturnScriptSuccess() | ||
{ | ||
ActionResult result = _schemaController.SqlScript(1); | ||
string script = result.ToString(); | ||
Assert.NotNull(script); | ||
} | ||
|
||
[Fact] | ||
public void GivenAnAvailableVersionsRequest_WhenCurrentVersionIsNull_ThenAllVersionsReturned() | ||
{ | ||
ActionResult result = _schemaController.AvailableVersions(); | ||
|
||
var jsonResult = result as JsonResult; | ||
Assert.NotNull(jsonResult); | ||
|
||
var jArrayResult = JArray.FromObject(jsonResult.Value); | ||
Assert.Equal(Enum.GetNames(typeof(TestSchemaVersion)).Length, jArrayResult.Count); | ||
|
||
JToken firstResult = jArrayResult.First; | ||
Assert.Equal(1, firstResult["id"]); | ||
Assert.Equal("https://localhost/script", firstResult["script"]); | ||
} | ||
|
||
[Fact] | ||
public void GivenAnAvailableVersionsRequest_WhenCurrentVersionNotNull_ThenCorrectVersionsReturned() | ||
{ | ||
_schemaInformation.Current = (int)TestSchemaVersion.Version2; | ||
ActionResult result = _schemaController.AvailableVersions(); | ||
|
||
var jsonResult = result as JsonResult; | ||
Assert.NotNull(jsonResult); | ||
|
||
var jArrayResult = JArray.FromObject(jsonResult.Value); | ||
Assert.Equal(Enum.GetNames(typeof(TestSchemaVersion)).Length - 1, jArrayResult.Count); | ||
|
||
JToken firstResult = jArrayResult.First; | ||
Assert.Equal(2, firstResult["id"]); | ||
Assert.Equal("https://localhost/script", firstResult["script"]); | ||
} | ||
|
||
[Fact] | ||
public void GivenACurrentVersionRequest_WhenNotImplemented_ThenNotImplementedShouldBeThrown() | ||
{ | ||
Assert.Throws<NotImplementedException>(() => _schemaController.CurrentVersion()); | ||
} | ||
|
||
[Fact] | ||
public void GivenACompatibilityRequest_WhenNotImplemented_ThenNotImplementedShouldBeThrown() | ||
{ | ||
Assert.Throws<NotImplementedException>(() => _schemaController.Compatibility()); | ||
} | ||
} | ||
} |
Oops, something went wrong.