Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void subCallShouldReturnLocalRouters()
        public virtual void SubCallShouldReturnLocalRouters()
        {
            string dbName = GetFirstDbName(_dbNames);
            Stream <CoreGraphDatabase> members = _dbNames.Select(n => _cluster.getMemberWithAnyRole(n, Role.FOLLOWER, Role.LEADER).database());

            IDictionary <string, object> @params = new Dictionary <string, object>();

            @params[DATABASE.parameterName()] = dbName;
            Stream <Optional <MultiClusterRoutingResult> > optResults = members.map(db => CallProcedure(db, GET_ROUTERS_FOR_DATABASE, @params));
            IList <MultiClusterRoutingResult> results = optResults.filter(Optional.isPresent).map(Optional.get).collect(Collectors.toList());

            bool consistentResults = results.Distinct().Count() == 1;

            assertThat("The results should be the same, regardless of which database the procedure is executed against.", consistentResults);

            Optional <MultiClusterRoutingResult> firstResult = results.First();

            int numRouterSets = firstResult.map(r => r.routers().size()).orElse(0);

            assertEquals("There should only be routers returned for a single database.", 1, numRouterSets);

            bool correctResultDbName = firstResult.map(r => r.routers().containsKey(dbName)).orElse(false);

            assertThat("The results should contain routers for the database passed to the procedure.", correctResultDbName);
        }
Esempio n. 2
0
        /// <summary>
        /// Instantiate with either the development or production DB
        /// </summary>
        /// <param name="db">E_Database</param>
        public DbAccess(DATABASE db)
        {
            _theDb = db;
            switch (_theDb)
            {
            case DATABASE.Production:
                _datasource = DsProduction;
                break;

            case DATABASE.Test:
                _datasource = DsBeta;
                break;

            case DATABASE.Development:
                _datasource = DsDevelopment;
                break;

            case DATABASE.HPPK:
                _datasource = DsHPPK;
                break;

            case DATABASE.HPPK_Pankyo:
                _datasource = DsHPPKPankyo;
                break;
            }
        }
Esempio n. 3
0
        public void Load(List <string> LSProducts, TimeFrame TFrame)
        {
            string sTFrame = ABBREVIATIONS.ToString(TFrame);

            Thread Thrd = new Thread(delegate()
            {
                Record DATA = new Record(DTStart, TFrame);
                foreach (string product in LSProducts)
                {
                    DateTime DTNow     = DateTime.Now.AddMonths(1);
                    DateTime DTCurrent = DTStart;

                    do
                    {
                        List <ChartPoint> LCPoints = DATABASE.Load_ChartPoints(product, DTCurrent, sTFrame);
                        DATA.Set(product, LCPoints);

                        DTCurrent = DTCurrent.AddMonths(1);
                    } while (DTNow.Year >= DTCurrent.Year || DTNow.Month >= DTCurrent.Month);
                }
                this.Set(TFrame, DATA);
            });

            Thrd.Priority = ThreadPriority.Highest;
            Thrd.Start();
            LThreadLoad.Add(Thrd);
        }
Esempio n. 4
0
        public void Save(string product, DateTime DTime, TimeFrame TFrame)
        {
            string            sTFrame  = ABBREVIATIONS.ToString(TFrame);
            Record            DATA     = this.Get(TFrame);
            List <ChartPoint> LCPoints = DATA.GetMonth(product, DTime);

            DATABASE.Save_ChartPoints(LCPoints, product, DTime, sTFrame);
        }
Esempio n. 5
0
        private static void Initialize()
        {
            var types = typeof(DynamicallyAccessibleEnumAttribute).GetTypesWithThisAttribute();

            foreach (var type in types)
            {
                var identifier = type.GetCustomAttribute <DynamicallyAccessibleEnumAttribute>().Identifier;
                if (!DATABASE.ContainsKey(identifier))
                {
                    DATABASE.Add(identifier, type);
                }
            }
        }
 public DatabaseElement(XmlNode databaseNode, SqlEntityData defaults) : base(databaseNode, defaults)
 {
     if (databaseNode != null && DATABASE.Equals(databaseNode.Name))
     {
         foreach (XmlNode node in GetChildNodes(databaseNode, SQLENTITIES, SqlEntityElement.SQLENTITY))
         {
             sqlentities.Add(new SqlEntityElement(node, this));
         }
     }
     else
     {
         throw new ArgumentException("The XmlNode argument is not a database node.");
     }
 }
Esempio n. 7
0
        public void csvSaveTeamParser(string csv, char separator = ',')
        {
            List <String> lines = new List <String>();
            List <Team>   teams = DATABASE.Teams();

            foreach (Team team in teams)
            {
                string abrv  = team.Abrv;
                int    games = team.Wins + team.Loses;
                string data2 = String.Join(",", team.WinPctHistoryData.Select(x => x.ToString()).ToArray());
                string data  = abrv + "," + games + "," + data2;
                lines.Add(data);
            }
            File.WriteAllLines(csv, lines);
        }
Esempio n. 8
0
        public void collectData(string line)
        {
            String headerRegEx = header_contains_League ? REGEX_HEADER : REGEX_HEADER_NO_LEAGUE;
            Regex  regex       = new Regex(headerRegEx);
            Match  headerMatch = regex.Match(line);

            if (headerMatch.Success && isThisADivisionName(line))
            {
                m_CurrentDivision = headerMatch.Groups[1].Value.Trim();
            }
            else
            {
                regex = new Regex(REGEX_TEAM_RECORD);
                Match teamMatch = regex.Match(line);
                if (teamMatch.Success)
                {
                    String name = teamMatch.Groups[1].Value.Trim();
                    name = name.Substring(0, name.Length - 1).Trim();
                    if (name.Length > 7)
                    {
                        String abv = name.Substring(name.Length - 3).Trim();
                        if (abv.Length == 3)
                        {
                            name = name.Substring(0, name.Length - 3);

                            Team team = new Team(RecordIndex.getNextId(RecordIndex.INDEX.TeamId), m_CurrentDivision, Program.LEAGUES[0].Length);
                            team.Name  = name.Trim();
                            team.Abrv  = abv;
                            team.Wins  = Convert.ToInt32(teamMatch.Groups[2].Value.Trim());
                            team.Loses = Convert.ToInt32(teamMatch.Groups[3].Value.Trim());
                            //        team.Wpct = Convert.ToDouble(teamMatch.Groups[4].Value.Trim());
                            String gamesBehind = teamMatch.Groups[5].Value.Trim();
                            if (gamesBehind.StartsWith("-"))
                            {
                                team.Gb = 0;
                            }
                            else
                            {
                                team.Gb = Convert.ToDouble(gamesBehind);
                            }
                            DATABASE.addTeam(team);
                        }
                    }
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Constructor: initializes the database source to a development system
        /// </summary>
        public DbAccess(string database)
        {
            _datasource = DsDevelopment;

            switch (database)
            {
            case DevelopmentName:
                _datasource = DsDevelopment;
                _theDb      = DATABASE.Development;
                break;

            case ProductionName:
                _datasource = DsProduction;
                _theDb      = DATABASE.Production;
                break;

            case BetaName:
                _datasource = DsBeta;
                _theDb      = DATABASE.Test;
                break;

            case ServerName:
                _datasource = DsHPPK;
                _theDb      = DATABASE.HPPK;
                break;

            case BangaloreACT:
                _datasource = DsBangalore;
                _theDb      = DATABASE.Bangalore_ACT;
                break;

            case ServerNamePankyo:
                _datasource = DsHPPKPankyo;
                _theDb      = DATABASE.HPPK_Pankyo;
                break;

            default:
                _datasource = database;
                _theDb      = DATABASE.Other;
                break;
            }
        }
Esempio n. 10
0
        public bool Load(string product, TimeFrame TFrame, int deep, int ahead, int count)
        {
            if (DLSCPoints.ContainsKey(product)) //if up to date, refresh data base and return
            {
                DLSCPoints[product] = ARCHIVE.GetDATA(TFrame, product);
                return(false);
            }
            else
            {
                DLSCPoints.Add(product, ARCHIVE.GetDATA(TFrame, product));
            }


            List <ChartPointsPredition> LDCPsPoints = DATABASE.Load_ChartPointsPrediction(product, ABBREVIATIONS.ToString(TFrame), deep, ahead);


            int iPosition = DLSCPoints[product].Count - count;

            if (LDCPsPoints == null || LDCPsPoints.Count == 0)
            {
                DATA.Add(product, new List <ChartPointsPredition>());
            }
            else
            {
                if (LDCPsPoints.Count > count)
                {
                    LDCPsPoints.RemoveRange(0, LDCPsPoints.Count - count);
                }

                for (int i = 0; i < LDCPsPoints.Count; i++)
                {
                    LDCPsPoints[i].Prognosis(0);
                }

                DATA.Add(product, LDCPsPoints);
            }

            return(true);
        }
Esempio n. 11
0
        private List <Team> getTeamsByScope(ReportScope scope)
        {
            List <Team> matches = new List <Team>();

            foreach (Team team in DATABASE.Teams())
            {
                if (scope.AllTeams)
                {
                    matches.Add(team);
                }
                if (scope.Division.Length > 0 &&
                    (Program.LEAGUES[0].Length > 0 && scope.League.Length > 0))

                {
                    if (team.Division.Equals(scope.Division) &&
                        team.League.Equals(scope.League))
                    {
                        matches.Add(team);
                    }
                }
                else if (scope.Division.Length > 0 &&
                         team.Division.Equals(scope.Division))
                {
                    matches.Add(team);
                }
                else if (scope.League.Length > 0 &&
                         team.League.Equals(scope.League))
                {
                    matches.Add(team);
                }
                else if (scope.League.Equals("X") &&
                         scope.Division.Length == 0 &&
                         Program.LEAGUES[0].Length == 0)
                {
                    matches.Add(team);
                }
            }
            return(matches);
        }
Esempio n. 12
0
 private void InitializeInstanceFields()
 {
     _procedureSignature = _procedureSignature(GET_ROUTERS_FOR_DATABASE.fullyQualifiedProcedureName()).@in(DATABASE.parameterName(), Neo4jTypes.NTString).@out(TTL.parameterName(), Neo4jTypes.NTInteger).@out(ROUTERS.parameterName(), Neo4jTypes.NTList(Neo4jTypes.NTMap)).description(DESCRIPTION).build();
 }
Esempio n. 13
0
 public Config()
 {
     this.LoadConfig();
     this._db = new DATABASE(this.config);
 }
Esempio n. 14
0
 public Config()
 {
     this.LoadConfig();
     this._db = new DATABASE(this.config);
 }
Esempio n. 15
0
 public void Save(List <ChartPointsPredition> LCPsPredictions)
 {
     DATABASE.Save_ChartPointsPrediction(LCPsPredictions);
 }