void ExpĆ²rt() { log = new StringBuilder(); foreach (Fwk.Bases.ServiceConfiguration s in _Services) { try { Fwk.Bases.ServiceConfiguration sclon = s.Clone(); sclon.ApplicationId = txtAppId.Text; ServiceMetadata.AddServiceConfiguration(_SelectedProvider.Name, sclon); log.AppendLine(string.Concat(s.Name, " OK")); } catch (Fwk.Exceptions.TechnicalException te) { if (te.ErrorId.Equals("7002")) { log.AppendLine(string.Concat(s.Name, " already exist")); } else { log.AppendLine(string.Concat(s.Name, Fwk.Exceptions.ExceptionHelper.GetAllMessageException(te))); } _HasErrors = true; } } textBox1.Text = log.ToString(); }
public void ImportToDB() { String strErrorResut = String.Empty; try { ServiceConfigurationCollection services = ServiceMetadata.GetAllServices("XML_test"); if (ServiceMetadata.GetAllServices("Sql_test").Count == 0) { foreach (ServiceConfiguration s in services) { ServiceMetadata.AddServiceConfiguration("Sql_test", s); } } } catch (Exception e) { strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e); } Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut); }
public void ServiceMetadata_Test(string providerName) { String strErrorResut = String.Empty; ServiceConfiguration wServiceConfigurationOriginal; ServiceConfiguration wServiceConfiguration; try { ServiceConfigurationCollection services = ServiceMetadata.GetAllServices(providerName); if (services.Count == 0) { Assert.Inconclusive("No existen servicios para realizar pruevas "); } #region update wServiceConfigurationOriginal = ServiceMetadata.GetServiceConfiguration(providerName, services[0].Name); wServiceConfiguration = wServiceConfigurationOriginal.Clone(); wServiceConfiguration.Audit = true; wServiceConfiguration.Name = wServiceConfigurationOriginal.Name + "_test"; wServiceConfiguration.Description = wServiceConfigurationOriginal.Description + "_test"; wServiceConfiguration.Request = wServiceConfigurationOriginal.Request + "_test"; wServiceConfiguration.Response = wServiceConfigurationOriginal.Response + "_test"; ServiceMetadata.SetServiceConfiguration(providerName, wServiceConfigurationOriginal.Name, wServiceConfiguration); #endregion #region CHEK update wServiceConfiguration = null; wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, wServiceConfigurationOriginal.Name + "_test"); if (!wServiceConfiguration.Name.Equals(string.Concat(wServiceConfigurationOriginal.Name, "_test")) || !wServiceConfiguration.Response.Equals(string.Concat(wServiceConfigurationOriginal.Response, "_test")) || !wServiceConfiguration.Request.Equals(string.Concat(wServiceConfigurationOriginal.Request, "_test")) || !wServiceConfiguration.Description.Equals(string.Concat(wServiceConfigurationOriginal.Description, "_test"))) { Assert.Fail("La actualizacion en el metodo SetServiceConfiguration no se realizo con exito.-"); } #endregion #region Add new service wServiceConfiguration = new ServiceConfiguration(); wServiceConfiguration.Audit = true; wServiceConfiguration.Description = "desc_test"; wServiceConfiguration.Name = "Name_test"; wServiceConfiguration.Handler = "Handler_test"; wServiceConfiguration.Request = "Request_test"; wServiceConfiguration.Response = "Response_test"; ServiceMetadata.AddServiceConfiguration(providerName, wServiceConfiguration); #endregion #region CHEK Add new service wServiceConfiguration = null; wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, "Name_test"); if (wServiceConfiguration == null) { Assert.Fail("La creacion del servicio por medio del metodo AddServiceConfiguration no se realizo con exito.-"); } #endregion ServiceMetadata.DeleteServiceConfiguration(providerName, "Name_test"); try { wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, "Name_test"); } catch (Exceptions.TechnicalException te) { if (te.ErrorId.Equals("7002")) { } } } catch (Exception e) { strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e); } Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut); }
/// <summary> /// Almacena la configuraciĆ³n de un nuevo servicio de negocio. /// </summary> /// <param name="providerName">Nombre del proveedor de la metadata de servicio</param> /// <param name="serviceConfiguration"></param> public static void AddServiceConfiguration(string providerName, ServiceConfiguration serviceConfiguration) { ServiceMetadata.AddServiceConfiguration(providerName, serviceConfiguration); }