forked from Sitecore/Media-Framework-Brightcove-Edition
-
Notifications
You must be signed in to change notification settings - Fork 10
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
9962723
commit cfe73fc
Showing
1,191 changed files
with
67,725 additions
and
121,136 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{825DBC84-59CA-45CD-81C4-8F67D82EE965}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Brightcove.Core.Tests</RootNamespace> | ||
<AssemblyName>Brightcove.Core.Tests</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath> | ||
<IsCodedUITest>False</IsCodedUITest> | ||
<TestProjectType>UnitTest</TestProjectType> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="UnitTest1.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Brightcove.Core\Brightcove.Core.csproj"> | ||
<Project>{dfa739f3-5236-48db-a86c-792616d1fb2d}</Project> | ||
<Name>Brightcove.Core</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" /> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" /> | ||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" /> | ||
</Target> | ||
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" /> | ||
</Project> |
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,20 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("Brightcove.Core.Tests")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Brightcove.Core.Tests")] | ||
[assembly: AssemblyCopyright("Copyright © 2021")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("825dbc84-59ca-45cd-81c4-8f67d82ee965")] | ||
|
||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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,123 @@ | ||
using Brightcove.Core.Models; | ||
using Brightcove.Core.Services; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Brightcove.Core.Tests | ||
{ | ||
[TestClass] | ||
public class UnitTest1 | ||
{ | ||
static string accountId = "5718741447001"; | ||
static string clientId = "5e000783-0f31-43d0-873b-be08fb7234d6"; | ||
static string clientSecret = "vUhjn2o4EFw1mtOgMOoNrnIZQBAH4PXnKhKJ4niDGnypcZovFG-JcBoAtcDCjrUPvKg4MTPLYZ1X9CMglRKPZg"; | ||
|
||
[TestMethod] | ||
public void TestMethod1() | ||
{ | ||
BrightcoveAuthenticationService service = new BrightcoveAuthenticationService(clientId, clientSecret); | ||
|
||
Assert.AreEqual("", service.CreateAuthenticationHeader().Parameter); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod2() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
Assert.AreEqual(0, service.VideosCount()); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod3() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
Assert.AreEqual(0, service.GetVideos(0).Count()); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod4() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
Assert.AreEqual(0, service.GetPlayLists().Count()); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod5() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
Video video; | ||
|
||
Assert.AreEqual(true, service.TryGetVideo("aosidjfoij", out video)); | ||
Assert.AreEqual(null, video); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod6() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
Video video; | ||
|
||
service.TryGetVideo("6257819058001", out video); | ||
var ret = service.UpdateVideo(video); | ||
Assert.AreEqual(null, ret); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod7() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
PlayList video; | ||
|
||
service.TryGetPlaylist("1684261519670224819", out video); | ||
//var ret = service.UpdateVideo(video); | ||
Assert.AreEqual(null, video); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod8() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
PlayList video; | ||
|
||
service.TryGetPlaylist("1684261519670224819", out video); | ||
var ret = service.UpdatePlaylist(video); | ||
Assert.AreEqual(null, video); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod9() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
service.DeleteVideo("6215726169001"); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod10() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
service.CreatePlaylist("test123"); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod11() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
service.CreateVideo("testvideo"); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod12() | ||
{ | ||
BrightcoveService service = new BrightcoveService(accountId, clientId, clientSecret); | ||
|
||
Assert.AreEqual(null, service.IngestVideo("6279873159001", "https://ingestion-upload-production.s3.amazonaws.com/5718741447001/6279873159001/e5368f6c-cd63-4da1-b05e-c82f4f2ae7e4/6279873159001")); | ||
} | ||
} | ||
} |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net48" /> | ||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net48" /> | ||
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net48" /> | ||
</packages> |
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,81 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DFA739F3-5236-48DB-A86C-792616D1FB2D}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Brightcove.Core</RootNamespace> | ||
<AssemblyName>Brightcove.Core</AssemblyName> | ||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Exceptions\HttpStatusException.cs" /> | ||
<Compile Include="Extensions\HttpSyncExtensions.cs" /> | ||
<Compile Include="Models\AccessToken.cs" /> | ||
<Compile Include="Models\Asset.cs" /> | ||
<Compile Include="Models\AssetSource.cs" /> | ||
<Compile Include="Models\IngestJobId.cs" /> | ||
<Compile Include="Models\IngestMaster.cs" /> | ||
<Compile Include="Models\IngestTextTrack.cs" /> | ||
<Compile Include="Models\IngestVideo.cs" /> | ||
<Compile Include="Models\TemporaryIngestUrls.cs" /> | ||
<Compile Include="Models\Converters\BrightcovePlayListSearchFieldConverter.cs" /> | ||
<Compile Include="Models\Count.cs" /> | ||
<Compile Include="Models\Economics.cs" /> | ||
<Compile Include="Models\ImageAsset.cs" /> | ||
<Compile Include="Models\ImageAssets.cs" /> | ||
<Compile Include="Models\ItemState.cs" /> | ||
<Compile Include="Models\PlayList.cs" /> | ||
<Compile Include="Models\PlayListSearch.cs" /> | ||
<Compile Include="Models\TagInclusion.cs" /> | ||
<Compile Include="Models\TextTrack.cs" /> | ||
<Compile Include="Models\Video.cs" /> | ||
<Compile Include="Models\VideoLink.cs" /> | ||
<Compile Include="Models\VideoSharing.cs" /> | ||
<Compile Include="Models\VideoTextTrack.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Services\BrightcoveAuthenticationService.cs" /> | ||
<Compile Include="Services\BrightcoveService.cs" /> | ||
<Compile Include="Services\BrightcoveHttpClient.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Brightcove.Core.Extensions; | ||
|
||
namespace Brightcove.Core.Exceptions | ||
{ | ||
public class HttpStatusException : Exception | ||
{ | ||
public HttpResponseMessage Response { get; } | ||
public HttpRequestMessage Request { get; } | ||
|
||
public HttpStatusException(HttpRequestMessage request, HttpResponseMessage response) | ||
{ | ||
this.Request = request; | ||
this.Response = response; | ||
} | ||
|
||
public override string Message | ||
{ | ||
get | ||
{ | ||
string content = ""; | ||
try { content = Response?.Content?.ReadAsString(); } catch { } | ||
|
||
return $"\nCODE: {((int)Response?.StatusCode)}\nREQUEST: '{Request?.RequestUri}'\nRESPONSE: '{content}'\n"; | ||
} | ||
} | ||
} | ||
} |
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,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Brightcove.Core.Extensions | ||
{ | ||
public static class HttpSyncExtensions | ||
{ | ||
public static HttpResponseMessage Send(this HttpClient client, HttpRequestMessage request) | ||
{ | ||
var task = client.SendAsync(request); | ||
task.Wait(); | ||
return task.Result; | ||
} | ||
|
||
public static string ReadAsString(this HttpContent content) | ||
{ | ||
var task = content.ReadAsStringAsync(); | ||
task.Wait(); | ||
return task.Result; | ||
} | ||
} | ||
} |
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,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Brightcove.Core.Models | ||
{ | ||
public class AccessToken | ||
{ | ||
[JsonProperty("access_token", NullValueHandling = NullValueHandling.Ignore)] | ||
public string Token { get; set; } | ||
|
||
[JsonProperty("token_type", NullValueHandling = NullValueHandling.Ignore)] | ||
public string TokenType { get; set; } | ||
|
||
[JsonProperty("expires_in", NullValueHandling = NullValueHandling.Ignore)] | ||
public int ExpiresInSeconnds { get; set; } | ||
} | ||
} |
Oops, something went wrong.