-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move BizTalkAssemblyResolver into Be.Stateless.BizTalk.Explorer
Expose BizTalkInstallation helper class Bump up BizTalk.Server.2020.* NuGets
- Loading branch information
1 parent
7f3fe78
commit 533348a
Showing
11 changed files
with
349 additions
and
22 deletions.
There are no files selected for viewing
Submodule .build
updated
5 files
+1 −1 | Directory.Build.props | |
+11 −10 | bts/deploy.ps1 | |
+9 −7 | bts/manifest-functions.ps1 | |
+11 −10 | bts/undeploy.ps1 | |
+1 −1 | pwsh/module-functions.ps1 |
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
75 changes: 75 additions & 0 deletions
75
src/Be.Stateless.BizTalk.Explorer.Tests/Management/BizTalkInstallationFixture.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,75 @@ | ||
#region Copyright & License | ||
|
||
// Copyright © 2012 - 2021 François Chabot | ||
// | ||
// 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. | ||
|
||
#endregion | ||
|
||
using System; | ||
using Be.Stateless.BizTalk.Explorer; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Be.Stateless.BizTalk.Management | ||
{ | ||
public class BizTalkInstallationFixture | ||
{ | ||
[Fact] | ||
public void DeveloperToolsPath() | ||
{ | ||
BizTalkInstallation.DeveloperToolsPath.Should().Be($@"{INSTALLATION_PATH}\Developer Tools\"); | ||
} | ||
|
||
[Fact] | ||
public void InstallationPath() | ||
{ | ||
BizTalkInstallation.InstallationPath.Should().Be($@"{INSTALLATION_PATH}\"); | ||
} | ||
|
||
[Fact] | ||
public void IsInstalled() | ||
{ | ||
BizTalkInstallation.IsInstalled.Should().BeTrue(); | ||
} | ||
|
||
[SkippableFact] | ||
public void ManagementDatabaseName() | ||
{ | ||
Skip.IfNot(BizTalkServerGroup.IsConfigured); | ||
BizTalkInstallation.ManagementDatabaseName.Should().Be("BizTalkMgmtDb"); | ||
} | ||
|
||
[SkippableFact] | ||
public void ManagementDatabaseServer() | ||
{ | ||
Skip.IfNot(BizTalkServerGroup.IsConfigured); | ||
BizTalkInstallation.ManagementDatabaseServer.Should().Be(Environment.MachineName); | ||
} | ||
|
||
[Fact] | ||
public void PipelineToolsPath() | ||
{ | ||
BizTalkInstallation.PipelineToolsPath.Should().Be($@"{INSTALLATION_PATH}\SDK\Utilities\PipelineTools\"); | ||
} | ||
|
||
[SkippableFact] | ||
public void SqlScriptsPath() | ||
{ | ||
Skip.IfNot(BizTalkServerGroup.IsConfigured); | ||
BizTalkInstallation.SqlScriptsPath.Should().Be($@"{INSTALLATION_PATH}\Schema\"); | ||
} | ||
|
||
private const string INSTALLATION_PATH = @"C:\Program Files (x86)\Microsoft BizTalk Server"; | ||
} | ||
} |
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
85 changes: 85 additions & 0 deletions
85
src/Be.Stateless.BizTalk.Explorer/Management/BizTalkInstallation.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,85 @@ | ||
#region Copyright & License | ||
|
||
// Copyright © 2012 - 2021 François Chabot | ||
// | ||
// 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. | ||
|
||
#endregion | ||
|
||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.IO; | ||
using System.Runtime.CompilerServices; | ||
using Microsoft.Win32; | ||
|
||
namespace Be.Stateless.BizTalk.Management | ||
{ | ||
public static class BizTalkInstallation | ||
{ | ||
[SuppressMessage("ReSharper", "InvertIf")] | ||
static BizTalkInstallation() | ||
{ | ||
using (var baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) | ||
using (var btsKey = baseKey.OpenSubKey(@"SOFTWARE\Microsoft\BizTalk Server\3.0")) | ||
{ | ||
if (btsKey?.GetValue("InstallPath") is string installPath) | ||
{ | ||
IsInstalled = true; | ||
_installationPath = installPath; | ||
_pipelineToolsPath = Path.Combine(installPath, @"SDK\Utilities\PipelineTools\"); | ||
using (var administrationKey = btsKey.OpenSubKey("Administration")) | ||
{ | ||
_managementDatabaseName = (string) administrationKey?.GetValue("MgmtDBName"); | ||
_managementDatabaseServer = (string) administrationKey?.GetValue("MgmtDBServer"); | ||
_sqlScriptsPath = (string) administrationKey?.GetValue("SQLScriptPath"); | ||
} | ||
// see Microsoft.BizTalk.Studio.Extensibility.ProjectSystemHelper, Microsoft.BizTalk.Studio.Extensibility, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | ||
using (var xmlToolsKey = btsKey.OpenSubKey("XML TOOLS")) | ||
{ | ||
_developerToolsPath = (string) xmlToolsKey?.GetValue("DataFilesPath"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static string DeveloperToolsPath => _developerToolsPath ?? ThrowInstallationException(); | ||
|
||
public static string InstallationPath => _installationPath ?? ThrowInstallationException(); | ||
|
||
internal static bool IsConfigured => IsInstalled && _managementDatabaseName != null && _managementDatabaseServer != null; | ||
|
||
public static bool IsInstalled { get; } | ||
|
||
public static string ManagementDatabaseName => _managementDatabaseName ?? ThrowInstallationException(); | ||
|
||
public static string ManagementDatabaseServer => _managementDatabaseServer ?? ThrowInstallationException(); | ||
|
||
public static string PipelineToolsPath => _pipelineToolsPath ?? ThrowInstallationException(); | ||
|
||
[SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "Public API.")] | ||
public static string SqlScriptsPath => _sqlScriptsPath ?? ThrowInstallationException(); | ||
|
||
private static string ThrowInstallationException([CallerMemberName] string name = null) | ||
{ | ||
if (!IsInstalled) throw new InvalidOperationException("BizTalk Server is not installed."); | ||
throw new InvalidOperationException($"BizTalk Server installation is incomplete; {name} could not be determined."); | ||
} | ||
|
||
private static readonly string _developerToolsPath; | ||
private static readonly string _installationPath; | ||
private static readonly string _managementDatabaseName; | ||
private static readonly string _managementDatabaseServer; | ||
private static readonly string _pipelineToolsPath; | ||
private static readonly string _sqlScriptsPath; | ||
} | ||
} |
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
Oops, something went wrong.