protected static async Task TearDownAsync(params PackageInfo[] packages) { try { var builder = new ServiceFabricClientBuilder(); builder.UseEndpoints(new Uri(TestInfo.Connection)); var fabricClient = await builder.BuildAsync(); foreach (var package in packages) { await DeleteExistingApplicationAsync(fabricClient, package.AppId); await RemoveApplicationTypeAsync(fabricClient, package.AppTypeName); } } catch (Exception) { // Ignore } finally { foreach (var package in packages) { Directory.Delete(package.TempDir, true); } } }
public static Task <IServiceFabricClient> ConnectAsync(this ServiceFabricClientBuilder serviceFabricClientBuilder, string ClusterEndPoint, string ThumbPrint, StoreLocation storeLocation = StoreLocation.CurrentUser) { var builder = serviceFabricClientBuilder.UseEndpoints(new Uri(ClusterEndPoint)); if (!string.IsNullOrWhiteSpace(ThumbPrint)) { Func <CancellationToken, Task <SecuritySettings> > GetSecurityCredentials = (ct) => { var store = new X509Store(StoreName.My, storeLocation); store.Open(OpenFlags.ReadOnly); var clientCert = store.Certificates.Find(X509FindType.FindByThumbprint, ThumbPrint, false)[0]; var remoteSecuritySettings = new RemoteX509SecuritySettings(new List <string> { ThumbPrint }); return(Task.FromResult <SecuritySettings>(new X509SecuritySettings(clientCert, remoteSecuritySettings))); }; builder = builder.UseX509Security(GetSecurityCredentials); } builder.ClientSettings.ClientTimeout = TimeSpan.FromMinutes(15); return(builder.BuildAsyncDirect()); }
private static void AppendClusterEndpoint(ServiceFabricClientBuilder builder, Manifest manifest) { builder.UseEndpoints(new Uri(manifest.ClusterDetails.Connection)); }