public static PersistenceContext ResetDbState(this PersistenceContext context, EnvironmentEnum envoronment = EnvironmentEnum.Test) { new DbDataDeleter(context).DeleteAllData(); new DataGenerator(context, envoronment).Generate(); return context; }
public static PersistenceContext ResetDbState(this PersistenceContext context, EnvironmentEnum envoronment = EnvironmentEnum.Test) { new DbDataDeleter(context).DeleteAllData(); new DataGenerator(context, envoronment).Generate(); return(context); }
protected override void ProcessRecord() { var qb = new QuerystringBuilder(); var environments = new EnvironmentEnum[] { EnvironmentEnum.kPhysical }; qb.Add("environment", string.Join(",", environments)); var url = $"/public/protectionSources{qb.Build()}"; var results = Session.ApiClient.Get <IEnumerable <ProtectionSourceNode> >(url); results = FlattenNodes(results); List <AgentInformation> agents = new List <AgentInformation>(); foreach (var result in results) { if (result.ProtectionSource.PhysicalProtectionSource.Agents != null) { agents.AddRange(result.ProtectionSource.PhysicalProtectionSource.Agents); } } WriteObject(agents, true); }
public JsonFeatureToggler(PlatformEnum platform, EnvironmentEnum currentEnvironment, bool isTestMode, List <string> applications) : base(platform, currentEnvironment, isTestMode, applications) { _featureName = typeof(TFeature).Name; //Call this last in the constructor SetFeatureToggle(); }
public HttpResponseMessage Get(EnvironmentEnum environment, PlatformEnum platform, string application = "ALL") { log.DebugFormat("GetAllForPlatform: {0}", platform.ToString()); HttpResponseMessage response; try { var validationResult = VerifyProperties(platform, environment); if (validationResult.Errors.Count > 0) { response = Request.CreateResponse(HttpStatusCode.BadRequest, validationResult); return(response); } var features = _jsonTogglerService.GetAllFeatureTogglesForPlatformAndApplication(platform, application); var ftResults = new List <FeatureToggleResult>(); foreach (var feature in features) { var ftResult = new FeatureToggleResult(); ftResult.Name = feature.Name; ftResult.IsEnabled = feature.Platform.Has <PlatformEnum>(platform) && feature.Environment.Has <EnvironmentEnum>(environment); ftResult.FilterValues = feature.FilterValues; ftResult.CommandType = feature.CommandType.HasValue ? (int)feature.CommandType.Value : 0; ftResult.Command = feature.Command; if (feature.SubFeatureToggles != null && feature.SubFeatureToggles.Count > 0) { var subFeatures = new List <SubFeatureToggleResult>(); foreach (var subFeature in feature.SubFeatureToggles) { var subft = new SubFeatureToggleResult(); subft.Name = subFeature.Name; subft.IsEnabled = subFeature.Platform.Has <PlatformEnum>(platform) && subFeature.Environment.Has <EnvironmentEnum>(environment); subft.FilterValues = subFeature.FilterValues; subft.CommandType = subFeature.CommandType.HasValue ? (int)subFeature.CommandType.Value : 0; subft.Command = subFeature.Command; subFeatures.Add(subft); } ftResult.SubFeatures = subFeatures; } ftResults.Add(ftResult); } response = Request.CreateResponse(HttpStatusCode.OK, ftResults); } catch (Exception ex) { log.Error("Error occurred", ex); response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
/// <summary> /// Initializes a new instance of the <see cref="FamilySearchFamilyTree"/> class supporting the beta environment /// </summary> /// <param name="environment"></param> public FamilySearchFamilyTree(EnvironmentEnum environment) : this(new Uri( environment == EnvironmentEnum.Integration ? INTEGRATION_URI : environment == EnvironmentEnum.Beta ? BETA_URI : URI)) { }
/// <summary> /// Initializes a new instance of the <see cref="FamilySearchFamilyTree"/> class supporting the beta environment /// </summary> /// <param name="environment"></param> public FamilySearchFamilyTree(EnvironmentEnum environment) : this(new Uri( environment == EnvironmentEnum.Sandbox ? SANDBOX_URI : environment == EnvironmentEnum.Beta ? BETA_URI : URI)) { }
public HttpResponseMessage Get(EnvironmentEnum environment, PlatformEnum platform, string application = "ALL") { log.DebugFormat("GetAllForPlatform: {0}", platform.ToString()); HttpResponseMessage response; try { var validationResult = VerifyProperties(platform, environment); if (validationResult.Errors.Count > 0) { response = Request.CreateResponse(HttpStatusCode.BadRequest, validationResult); return(response); } var features = _jsonTogglerService.GetAllFeatureTogglesForPlatformAndApplication(platform, application); response = Request.CreateResponse(HttpStatusCode.OK, features); } catch (Exception ex) { log.Error("Error occurred", ex); response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public static bool IsPlugingFolderSame(EnvironmentEnum iSourceEnvironment, EnvironmentEnum iDestinationEnvironment) { var sourceFolderList = Directory.GetDirectories(iSourceEnvironment.GetPluginDirectory()).Enum().Select(x => x + "\\").Enum().ToList(); sourceFolderList.Remove(iSourceEnvironment.GetPluginDirectoryArchive()); var sourceFolderNameList = sourceFolderList.Select(x => x.ReplaceStart(iSourceEnvironment.GetPluginDirectory(), "", false, false)).ToList(); var destinationFolderList = Directory.GetDirectories(iDestinationEnvironment.GetPluginDirectory()).Enum().Select(x => x + "\\").Enum().ToList(); destinationFolderList.Remove(iDestinationEnvironment.GetPluginDirectoryArchive()); var destinationFolderNameList = destinationFolderList.Select(x => x.ReplaceStart(iDestinationEnvironment.GetPluginDirectory(), "", false, false)).ToList(); var comparaison = new Library.Tools.Comparator.ListComparator <string, string>(sourceFolderNameList, x => x, destinationFolderNameList, x => x); if (comparaison.RemovedList.Count != 0 || comparaison.NewList.Count != 0) { return(false); } for (int i = 0; i < sourceFolderList.Count; i++) { if (!Library.Tools.IO.MyDirectory.IsSameContentFolders(sourceFolderList[i], destinationFolderList[i])) { return(false); } } return(true); }
public static Group OpenGroup(this GroupManager iGroupManager, EnvironmentEnum iEnvironmentToOpen) { var loginTuple = iEnvironmentToOpen.GetLoginPassword(); iGroupManager.OpenGroup(iEnvironmentToOpen.GetDWConnectionString(), DriveWorksCredentials.Create(loginTuple.Item1, loginTuple.Item2)); return(iGroupManager.Group); }
public IJsonTogglerSection GetJsonSettings(EnvironmentEnum env, PlatformEnum platform, string applications = "All") { _config.Setup(c => c.Environment).Returns(env); _config.Setup(c => c.Platform).Returns(platform); _config.Setup(c => c.Applications).Returns(applications); return(_config.Object); }
public SubFeatureToggle(PlatformEnum platform, EnvironmentEnum currentEnvironment, bool isTestMode, List <string> applications) { _applications = applications; _currentEnvironment = currentEnvironment; _currentPlatform = platform; _isTestMode = isTestMode; _togglerHelper = new JsonTogglerHelper(); }
public List <ProjectDetails> OrderProjetByChildSpec(EnvironmentEnum iSourceEnvironment, List <ProjectDetails> iOriginalProjectDetailsList) { var result = new List <ProjectDetails>(); //var host = new EngineHost(HostEnvironment.CreateDefaultEnvironment(false)); //var sourceGroupManager = host.CreateGroupManager(); //var sourceGroup = sourceGroupManager.OpenGroup(iSourceEnvironment); ////Réagencement des projets par les enfants d'abord //var sourceProjectManager = host.CreateProjectManager(); //var noOrderProjetChildSpecList = new List<KeyValuePair<ProjectDetails, List<ChildSpecificationList>>>(); //foreach (var projectItem in iOriginalProjectDetailsList.Enum()) //{ // sourceProjectManager.OpenProject(sourceGroup, projectItem); // noOrderProjetChildSpecList.Add(new KeyValuePair<ProjectDetails, List<ChildSpecificationList>>(projectItem, DriveWorks.Helper.Manager.ControlVersionManager.GetProjectChildSpecificationListLists(sourceProjectManager.Project))); // sourceProjectManager.CloseProject(false); //} //var previousProjetChildSpecListCount = 0; //var orderProject = new List<ProjectDetails>(); //while (iOriginalProjectDetailsList.Count != orderProject.Count) //{ // foreach (var projectItem in iOriginalProjectDetailsList.Enum()) // { // //Si pas encore présent dans la liste // if (!noOrderProjetChildSpecList.Any(x => x.Key.Id == projectItem.Id)) // { // var pairProject = noOrderProjetChildSpecList.Single(x => x.Key.Id == projectItem.Id); // //Bouclage sur toutes les child // foreach (var childListItem in pairProject.Value.Enum()) // { // //Bouclage sur les projets de la child // foreach (var projectChildItem in childListItem.SelectedItem.ItemValues) // { // var test = "ergerlfk"; // } // } // } // } ////Vérification qu'il y a bien une progression pour éviter boucle infinit si référence circulaire //if (previousProjetChildSpecListCount == projetChildSpecList.Count) // throw new Exception("Impossible de ranger les projets dans l'ordre des childspec, il y a surment une référence circulaire avec les childspec"); //previousProjetChildSpecListCount = projetChildSpecList.Count; //} return(result); }
public static string GetSQLExtendConnectionString(this EnvironmentEnum iValue) { Type type = iValue.GetType(); FieldInfo fieldInfo = type.GetField(iValue.ToString()); SQLExtendConnectionStringAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(SQLExtendConnectionStringAttribute), false) as SQLExtendConnectionStringAttribute[]; SQLExtendConnectionStringAttribute value = (SQLExtendConnectionStringAttribute)attrs.FirstOrDefault(); return(value != null ? value.SQLExtendConnectionString : null); }
public static string GetProjectDirectoryArchive(this EnvironmentEnum iValue) { Type type = iValue.GetType(); FieldInfo fieldInfo = type.GetField(iValue.ToString()); ProjectDirectoryArchiveAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(ProjectDirectoryArchiveAttribute), false) as ProjectDirectoryArchiveAttribute[]; ProjectDirectoryArchiveAttribute value = (ProjectDirectoryArchiveAttribute)attrs.FirstOrDefault(); return(value != null ? value.ProjectDirectoryArchive : null); }
public static string GetDevelopperTeam(this EnvironmentEnum iValue) { Type type = iValue.GetType(); FieldInfo fieldInfo = type.GetField(iValue.ToString()); DevelopperTeamAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(DevelopperTeamAttribute), false) as DevelopperTeamAttribute[]; DevelopperTeamAttribute value = (DevelopperTeamAttribute)attrs.FirstOrDefault(); return(value != null ? value.DevelopperTeam : null); }
public static string GetSpecificationPrefix(this EnvironmentEnum iValue) { Type type = iValue.GetType(); FieldInfo fieldInfo = type.GetField(iValue.ToString()); SpecificationPrefixAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(SpecificationPrefixAttribute), false) as SpecificationPrefixAttribute[]; SpecificationPrefixAttribute value = (SpecificationPrefixAttribute)attrs.FirstOrDefault(); return(value != null ? value.SpecificationPrefix : null); }
public static Tuple <string, string> GetLoginPassword(this EnvironmentEnum iValue) { Type type = iValue.GetType(); FieldInfo fieldInfo = type.GetField(iValue.ToString()); LoginPasswordAttribute[] attrs = fieldInfo.GetCustomAttributes(typeof(LoginPasswordAttribute), false) as LoginPasswordAttribute[]; LoginPasswordAttribute value = (LoginPasswordAttribute)attrs.FirstOrDefault(); return(value != null ? new Tuple <string, string>(value.Login, value.Password) : null); }
public void GetService(Request MyRequest) { _Environment = MyRequest._EnvironmentSelected; if (_Environment == EnvironmentEnum.Production) { _EndPointAddress = "https://wsvc.cdiscount.com/MarketplaceAPIService.svc"; _MarketplaceAPIService = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, _EndPointAddress); _MarketplaceAPIService.Endpoint.EndpointBehaviors.Add(_RequestInterceptor); var b = _MarketplaceAPIService.Endpoint.Binding as System.ServiceModel.BasicHttpBinding; b.SendTimeout = TimeSpan.FromMinutes(10); b.ReceiveTimeout = TimeSpan.FromMinutes(10); b.OpenTimeout = TimeSpan.FromMinutes(10); b.CloseTimeout = TimeSpan.FromMinutes(10); } else { if (_Environment == EnvironmentEnum.Recette) { _EndPointAddress = "https://wsvc.recette-cdiscount.com/MarketplaceAPIService.svc"; } else if (_Environment == EnvironmentEnum.Preproduction) { _EndPointAddress = "http://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc"; } _MarketplaceAPIService = new MarketplaceAPIServiceClient(MarketplaceAPIServiceClient.EndpointConfiguration.BasicHttpBinding_IMarketplaceAPIService, _EndPointAddress); var b = _MarketplaceAPIService.Endpoint.Binding as System.ServiceModel.BasicHttpBinding; b.SendTimeout = TimeSpan.FromMinutes(10); b.ReceiveTimeout = TimeSpan.FromMinutes(10); b.OpenTimeout = TimeSpan.FromMinutes(10); b.CloseTimeout = TimeSpan.FromMinutes(10); string proxyUrl = Environment.GetEnvironmentVariable("QUOTAGUARDSTATIC_URL"); System.Uri proxyUri = new System.Uri(proxyUrl); string cleanProxyURL = proxyUri.Scheme + "://" + proxyUri.Host + ":" + proxyUri.Port; string user = proxyUri.UserInfo.Split(':')[0]; string password = proxyUri.UserInfo.Split(':')[1]; WebProxy myProxy = new WebProxy(); Uri newUri = new Uri(cleanProxyURL); myProxy.Credentials = new NetworkCredential(user, password); myProxy.Address = newUri; /* b.ProxyAddress =newUri; * WebRequest.DefaultWebProxy = myProxy; * b.Security.Mode = BasicHttpSecurityMode.Transport; * b.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; // !!! * b.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; // !!! * b.UseDefaultWebProxy = true; */ _MarketplaceAPIService.Endpoint.EndpointBehaviors.Add(_RequestInterceptor); } }
public EnvironmentObject createEnvironmentObject(RegionEnum _RegionEnum, EnvironmentEnum objectType) { EnvironmentObject environmentObject = new EnvironmentObject(); environmentObject.Body.MainBody.StandartTextureShift = new Microsoft.Xna.Framework.Vector2(0, 0); environmentObject.EnvironmentEnum = objectType; switch(objectType) { case EnvironmentEnum.Tree_Normal_1: { environmentObject.Body.MainBody.TexturePath = "Region/" + _RegionEnum.ToString() + "/Block/Environment/Tree/Tree1"; environmentObject.Size = new Microsoft.Xna.Framework.Vector3(64, 64, 0); environmentObject.Body.setSize(new Microsoft.Xna.Framework.Vector3(64, 64, 0)); environmentObject.CollisionBounds.Add(new Rectangle(22, 45, 12, 2)); break; } case EnvironmentEnum.Flower_1: { environmentObject.Body.MainBody.TexturePath = "Region/" + _RegionEnum.ToString() + "/Block/Environment/Flower/Flower1"; environmentObject.Size = new Microsoft.Xna.Framework.Vector3(32, 32, 0); environmentObject.Body.MainBody.StandartTextureShift = new Microsoft.Xna.Framework.Vector2(Utility.Random.GenerateGoodRandomNumber(0, 9) * 32, 0); break; } case EnvironmentEnum.Plant: { break; } case EnvironmentEnum.Tree_Brown: { break; } case EnvironmentEnum.Tree_Grey: { break; } case EnvironmentEnum.Chest: { environmentObject.Body.MainBody.TexturePath = "Region/" + _RegionEnum.ToString() + "/Block/Environment/Chest/Chest"; environmentObject.Size = new Microsoft.Xna.Framework.Vector3(32, 48, 0); environmentObject.Body.MainBody.StandartTextureShift = new Microsoft.Xna.Framework.Vector2(1*32, 0); environmentObject.Interactions.Add(new GameLibrary.Model.Object.Interaction.Interactions.ChestInteraction(environmentObject)); break; } case EnvironmentEnum.FarmHouse1: { environmentObject.Body.MainBody.TexturePath = "Region/" + _RegionEnum.ToString() + "/Block/Environment/Farm/FarmHouse1"; environmentObject.Size = new Microsoft.Xna.Framework.Vector3(370, 355, 0); break; } } return environmentObject; }
public static void AddData(this IServiceCollection services, EnvironmentEnum environment) { AWSConfigsDynamoDB.Context.TableNamePrefix = $"{environment}-"; services.AddHttpClient <IPostcodeService, PostcodeIOHttpClient>(); services.AddAWSService <IAmazonDynamoDB>(); services.AddTransient <IDynamoDBContext, DynamoDBContext>(); services.AddSingleton <IFarmRepository, FarmDynamoDbRepository>(); services.AddSingleton <IGeohashService, GeohashService>(); }
static HostEnvironment() { var name = ConfigurationManager.AppSettings["ASPNET_ENVIRONMENT"]; var enumValue = NameToEnum(name); if (enumValue.HasValue) { environment = enumValue.Value; } EnvironmentName = environment.ToString(); }
public void Migrations_Should_Work_Both_Ways(EnvironmentEnum environment) { var migrator = new DbMigrator(new MigrationConfiguration()); migrator.Update(); new PersistenceContext().ResetDbState(environment); // back to 0 migrator.Update("0"); // up to current migrator.Update(); }
private void MenuItem_OnChecked(object sender, RoutedEventArgs e) { if (_currentEnvironmentMenuItem != null) { _currentEnvironmentMenuItem.IsChecked = false; } _currentEnvironmentMenuItem = (MenuItem)e.Source; EnvironmentEnum temp; Enum.TryParse(_currentEnvironmentMenuItem.Header.ToString(), out temp); GlobalCurrentEnvironmentEnum = temp; }
public override IEnumerable<User> GetGeneratedData(EnvironmentEnum environment) { if (environment == EnvironmentEnum.Dev || environment == EnvironmentEnum.Test) { return Enumerable.Range(1, environment == EnvironmentEnum.Dev ? 100 : 10).Select(i => new User { UserName = "******" + i, Email = "email@email" + i, HashedPassword = new HashProvider().GetPasswordHash("password" + i), Active = i%2 == 0 }); } return null; }
// Lambda / Test constructor public LambdaFunctionBase(RegionEndpoint regionEndpoint, EnvironmentEnum environment) { RegionEndpoint = regionEndpoint; Environment = environment; var services = new ServiceCollection(); ConfigureServicesInternal(services); ServiceProvider = services.BuildServiceProvider(); Logger = ServiceProvider.GetRequiredService <ILogger <LambdaFunctionBase> >(); Logger.LogInformation("BuildServiceProvider completed"); }
public Settings(EnvironmentEnum environment) { Environment = environment; if (Environment == EnvironmentEnum.Local) { RebuildDatabase = true; ConnectionString = @"Data Source=(localdb)\mssqllocaldb;Initial Catalog=ScoreCard;User id=launchpad;Password=mcquack123!;"; } else if (Environment == EnvironmentEnum.Production) { RebuildDatabase = false; var secretContainer = new SecretContainer("scoreCard_db"); var connectionStringCredentials = $"User Id={secretContainer.UserName};Password={ secretContainer.Password};"; ConnectionString = @"Data Source=SQL6003.site4now.net;Initial Catalog=DB_A2AF2E_scorecard;" + connectionStringCredentials; } }
public ContextBase() { switch (ConfigurationHelper <string> .GetValue("Environment").ToLower()) { case "windows": _environment = EnvironmentEnum.Windows; break; case "web": _environment = EnvironmentEnum.Web; break; default: throw new NotImplementedException("Environment not recognized or not implemented !!!"); } }
void Start() { if (!Application.isEditor) { this.Environment = EnvironmentEnum.STAGING; } if (this.Environment == EnvironmentEnum.LOCAL) { this.baseURL = "http://localhost:3000/api/"; } if (this.Environment == EnvironmentEnum.STAGING) { this.baseURL = "https://amulet-api.herokuapp.com/api/"; } }
/// <summary> /// Get's all Feature Toggles from the JSON files that exist for the provided environment. /// </summary> /// <param name="environment">EnvironmentEnum e.g. Local, Dev, QAS, Stage, Prod</param> /// <returns>A collection of FeatureToggles for the environment.</returns> public List <FeatureToggle> GetAllFeatureTogglesForEnvironment(EnvironmentEnum environment) { var jsonFiles = GetJsonFiles(); var result = new List <FeatureToggle>(); foreach (var jsonFile in jsonFiles) { var featureToggle = GetFeatureToggleFromJson(jsonFile); if (environment.Has <EnvironmentEnum>(featureToggle.Environment) || featureToggle.SubFeatureToggles.Where(w => environment.Has <EnvironmentEnum>(w.Environment) == true).Count() > 0) { result.Add(featureToggle); } } return(result); }
public string GetConnectionStringByEnvironment(string key) { var env = ConfigurationManager.AppSettings["Environment"].ToString(); EnvironmentEnum myEnvironment = (EnvironmentEnum)Enum.Parse(typeof(EnvironmentEnum), env, true); switch (myEnvironment) { case EnvironmentEnum.Local: break; case EnvironmentEnum.Development: key = $"{key}Dev"; break; case EnvironmentEnum.Production: key = $"{key}Prod"; break; } return(ConfigurationManager.ConnectionStrings[key].ConnectionString); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Particle = binaryReader.ReadTagReference(); this.Location = binaryReader.ReadLongBlockIndex1(); this.CoordinateSystem = ((CoordinateSystemEnum)(binaryReader.ReadInt16())); this.Environment = ((EnvironmentEnum)(binaryReader.ReadInt16())); this.Disposition = ((DispositionEnum)(binaryReader.ReadInt16())); this.CameraMode = ((CameraModeEnum)(binaryReader.ReadInt16())); this.SortBias = binaryReader.ReadInt16(); this.ParticleSystemDefinitionNewFlags = ((Flags)(binaryReader.ReadInt16())); this.LODInDistance = binaryReader.ReadSingle(); this.LODFeatherInDelta = binaryReader.ReadSingle(); this.fieldskip = binaryReader.ReadBytes(4); this.LODOutDistance = binaryReader.ReadSingle(); this.LODFeatherOutDelta = binaryReader.ReadSingle(); this.fieldskip0 = binaryReader.ReadBytes(4); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(184)); return(pointerQueue); }
public DataGenerator(DbContext context, EnvironmentEnum environment) : base(context, environment) { }
public void ShowEnvironment(EnvironmentEnum env) { // destroy existing if (environment != null) { Destroy(environment); environment = null; } switch (env) { default: case EnvironmentEnum.kNone: break; case EnvironmentEnum.kMountains: environment = Instantiate(mountainPrefab, Vector3.zero, Quaternion.identity) as GameObject; break; case EnvironmentEnum.kForest: environment = Instantiate(forestPrefab, Vector3.zero, Quaternion.identity) as GameObject; break; } }