Esempio n. 1
0
        public void BuildAppProject(ReformApp reformApp, QihooAppStoreCompleteApp appItem)
        {
            var appProject = AppStoreUIService.GetAppProjectByPKGName(appItem.PackageName);

            if (appProject == null)
            {
                LogHelper.WriteInfo(string.Format("Has new app, name {0}, downloading...", appItem.Name), ConsoleColor.Yellow);
                reformApp.NewAppCount++;

                var appfileName = string.Empty;
                DownloadResources(appItem, out appfileName);

                appProject = AddNewApp(appItem, appProject, appfileName);
            }
            else
            {
                try
                {
                    var appitems = AppStoreUIService.GetAppsFromAppList <AppProject>(appProject.Id);
                    if (appitems == null)
                    {
                        AppProjectDelete(appProject.Id);
                    }
                    else
                    {
                        AddNewVersionApp(reformApp, appItem, appProject);
                    }
                }
                catch (Exception)
                {
                    AppProjectDelete(appProject.Id);
                }
            }
        }
Esempio n. 2
0
        public void AddNewVersionApp(ReformApp reformApp, QihooAppStoreCompleteApp appItem, AppProject appProject)
        {
            try
            {
                var appitems = AppStoreUIService.GetAppsFromAppList <AppProject>(appProject.Id);
                foreach (var a in appitems)
                {
                    var versions = RedisService.GetAllSubModelIdsByType <App, AppVersion>(a.Id).ToIdsWithNoPrefix <AppVersion>();

                    if (!versions.Contains(appItem.VersionCode))
                    {
                        reformApp.NewVersionCount = AddNewVersionForApp(reformApp.NewVersionCount, appItem, a);
                    }
                    else
                    {
                        reformApp.DupVersionCount++;
                        LogHelper.WriteInfo(string.Format("Already has version {1} for app name {0}", appItem.Name, appItem.VersionCode), ConsoleColor.DarkYellow);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message + ex.StackTrace);
            }
        }
Esempio n. 3
0
        public void DeleteUnValidApkInfo()
        {
            List <KeyValuePair <string, string> > delAppVerInfos = new List <KeyValuePair <string, string> >();

            delAppVerInfos.Add(new KeyValuePair <string, string>(59025.ToString(), 8.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(59167.ToString(), 62.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(60785.ToString(), 560.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(59229.ToString(), 8.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(59231.ToString(), 1.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(61504.ToString(), 4.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(61538.ToString(), 1.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(61624.ToString(), 8.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(60923.ToString(), 19.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(60931.ToString(), 11.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(58779.ToString(), 12.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(59683.ToString(), 41.ToString()));
            delAppVerInfos.Add(new KeyValuePair <string, string>(60041.ToString(), 21.ToString()));

            RedisService      redis             = new RedisService();
            AppStoreUIService AppStoreUIService = new AppStoreUIService(FileService, redis);

            foreach (var del in delAppVerInfos)
            {
                redis.DeleteSubModel <App, AndroidPackageView>(del.Key, del.Value);
                redis.DeleteSubModel <App, AppVersion>(del.Key, del.Value);
                LogHelper.WriteInfo(string.Format("Remove App {0} with Version code {1}", del.Key, del.Value));
            }
        }
        public AppStoresWapUIServiceTest()
        {
            _redisServiceMock = new Mock<IRedisService>();
            redisService = _redisServiceMock.Object;

            _redisServiceMock2 = new Mock<IRedisService2>();
            redisService2 = _redisServiceMock2.Object;

            _redisClientMock = new Mock<IRedisClient>();
            redisClient = _redisClientMock.Object;

            _appStoreUIServiceMock = new Mock<IAppStoreUIService>();
            appStoreUIService = _appStoreUIServiceMock.Object;

            _logServiceMock = new Mock<ILogger>();
            logService = _logServiceMock.Object;

            _fileServiceMock = new Mock<IFileService>();
            fileService = _fileServiceMock.Object;

            _fullTextSearchServiceMock = new Mock<IFullTextSearchService>();
            fullTextSearchService = _fullTextSearchServiceMock.Object;

            _requestRepoMock = new Mock<IRequestRepository>();
            requestRepo = _requestRepoMock.Object;

            appStoreUIRealService = new AppStoreUIService(fs, redisReal);

            sesionRepository = new Mock<ISessionRepository>();
            sesionRepositoryReal = new SessionRepository();

            cookieServiceReal =new CookieService();
            cookieService = new Mock<ICookieService>();

            appStoreServiceReal = new AppStoreService(fs, redisReal, appStoreUIRealService, new FullTextSearchService(redisReal),new IMEICacheService(redisReal));
            appStoreServiceReal.RedisService2 = new RedisService2();
            appStoreService = new AppStoreService(fs, redisService, appStoreUIRealService, new FullTextSearchService(redisService), new IMEICacheService(redisReal));
            appStoreService.RedisService2 = redisService2;

            appStoresWapUIServiceReal = new AppStoresWapUISerivces(appStoreUIRealService, redisReal, appStoreServiceReal, sesionRepositoryReal, cookieServiceReal, new FullTextSearchService(redisReal));
            appStoresWapUIServiceReal.RedisService2 = new RedisService2();
            appStoresWapUIService = new AppStoresWapUISerivces(appStoreUIService, redisService, appStoreService, sesionRepository.Object, cookieService.Object, fullTextSearchService);

            appStoresWapUIService.RedisService2 = redisService2;
            Bootstrapper.Start();
            redisReal.FlushAll();
        }
        public DeviceModel GetMatchedDeviceModel(string valuePattern, string actualValue)
        {
            List<string> allDeviceModelIds = new List<string>() { "1" };
            _redisServiceMock.Setup<List<string>>(m => m.GetAllActiveModelIds<DeviceModel>()).Returns(allDeviceModelIds);

            Dictionary<string, object> customProperties = new Dictionary<string, object>();
            customProperties["7"] = valuePattern;

            var deviceModel = new DeviceModel()
            {
                ModelName = "MTK_6252",
                CustomProperties = customProperties
            };
            _redisServiceMock.Setup<DeviceModel>(m => m.GetModelWithCustomProperties<DeviceModel, CustomProperty>("1")).Returns(deviceModel);

            Element lcdAttr = new Element();
            lcdAttr.Id = "7";
            lcdAttr.Name = "lcd";
            _redisServiceMock.Setup<Element>(m => m.Get<Element>("7")).Returns(lcdAttr);

            AppStoreUIService appStoreService = new AppStoreUIService(fileService, redisService);

            var namevalues = new NameValueCollection();
            namevalues[MobileParam.Key_Resolution] = actualValue;
            _requestRepoMock.Setup<NameValueCollection>(m => m.Header).Returns(namevalues);
            MobileParam mobileParam = new MobileParam(requestRepo);

            return appStoreService.GetDeviceModelByRequest(mobileParam);
        }
        public void GetDeviceModelByRequest_not_matched_by_string_value()
        {
            List<string> allDeviceModelIds = new List<string>() { "1" };
            _redisServiceMock.Setup<List<string>>(m => m.GetAllActiveModelIds<DeviceModel>()).Returns(allDeviceModelIds);

            Dictionary<string, object> customProperties = new Dictionary<string, object>();
            customProperties["7"] = "240x321";

            var deviceModel = new DeviceModel()
            {
                ModelName = "MTK_6252",
                CustomProperties = customProperties
            };
            _redisServiceMock.Setup<DeviceModel>(m => m.GetModelWithCustomProperties<DeviceModel, CustomProperty>("1")).Returns(deviceModel);

            Element lcdAttr = new Element();
            lcdAttr.Id = "7";
            lcdAttr.Name = "lcd";
            _redisServiceMock.Setup<Element>(m => m.Get<Element>("7")).Returns(lcdAttr);

            AppStoreUIService appStoreService = new AppStoreUIService(fileService, redisService);

            var namevalues = new NameValueCollection();
            namevalues[MobileParam.Key_Resolution] = "240x320";
            _requestRepoMock.Setup<NameValueCollection>(m => m.Header).Returns(namevalues);
            MobileParam mobileParam = new MobileParam(requestRepo);

            var result = appStoreService.GetDeviceModelByRequest(mobileParam);

            Assert.Null(result);
        }
        public AppStoresServiceTest()
        {
            _redisServiceMock = new Mock<IRedisService>();
            redisService = _redisServiceMock.Object;

            _redisServiceMock2 = new Mock<IRedisService2>();
            redisService2 = _redisServiceMock2.Object;

            _redisClientMock = new Mock<IRedisClient>();
            redisClient = _redisClientMock.Object;

            _appStoreUIServiceMock = new Mock<IAppStoreUIService>();
            appStoreUIService = _appStoreUIServiceMock.Object;

            _fileServiceMock = new Mock<IFileService>();
            fileService = _fileServiceMock.Object;

            _logServiceMock = new Mock<ILogger>();
            logService = _logServiceMock.Object;

            _requestRepoMock = new Mock<IRequestRepository>();
            requestRepo = _requestRepoMock.Object;

            _fullTextSearchServiceMock = new Mock<IFullTextSearchService>();
            fullTextSearchService = _fullTextSearchServiceMock.Object;
            _imeiCacheServiceMock = new Mock<IIMEICacheService>();
            imeiCacheService = _imeiCacheServiceMock.Object;

            appStoreUIRealService = new AppStoreUIService(fs, redis);
            appStoreUIRealService.RedisService2 = redis2;
            appStoreRealService = new AppStoreService(fs, redis, appStoreUIRealService, fullTextSearchService, imeiCacheService);
            appStoreRealService.RedisService2 = redis2;

            appStoreMockService = new AppStoreService(_fileServiceMock.Object, _redisServiceMock.Object,
                _appStoreUIServiceMock.Object, _fullTextSearchServiceMock.Object,_imeiCacheServiceMock.Object);
            appStoreMockService.RedisService2 = redisService2;
            redis.FlushAll();

            EntityMapping.Config();
        }
        public void Add_new_keyword_return_saved_keyword_model_Id_successfully()
        {
            var searchCriteria = new Dictionary<string, string>();
            searchCriteria["Name"] = "key11";
            _redisServiceMock.Setup(m => m.FindIdsByConditions<Keyword>(It.IsAny<Dictionary<string, string>>())).Returns(new List<string>());

            _redisServiceMock.Setup(m => m.Add<Keyword>(It.IsAny<Keyword>())).Returns("11");

            AppStoreUIService appStoreService = new AppStoreUIService(fileService, redisService);
            var result = appStoreService.AddKeyword("key11",1);
            Assert.Equal("11", result);
        }
Esempio n. 9
0
        public ActionResult CheckDupFile()
        {
            var redis = new RedisService();
            var appStore = new AppStoreUIService(new FileService(), redis);
            var appIds = redis.GetAllActiveModelIds<App>().ToIdsWithNoPrefix<App>();
            List<App> apps = new List<App>();
            Dictionary<string, List<string>> batchCategory = new Dictionary<string, List<string>>();

            foreach (var id in appIds)
            {
                if (redis.IsExist("App:" + id))
                {
                    var app = redis.GetModelWithCustomProperties<App, CustomProperty>(id);

                    //if (app.CustomProperties.ContainsKey("1"))
                    //{
                    //    if (batchCategory.ContainsKey(app.CustomProperties["1"].ToString()))
                    //    {
                    //        batchCategory[app.CustomProperties["1"].ToString()].Add(id);
                    //    }
                    //    else
                    //    {
                    //        batchCategory[app.CustomProperties["1"].ToString()] = new List<string> { id };
                    //    }

                    //}
                    // if (app.CustomProperties.ContainsValue("MTK_6255*"))
                    //{
                    apps.Add(app);
                    //}
                }
            }
            Dictionary<string, List<string>> dups = new Dictionary<string, List<string>>();

            foreach (var app in apps)
            {
                string flag6255 = string.Empty;
                if (app.CustomProperties != null && app.CustomProperties.ContainsKey("1") && app.CustomProperties["1"].ToString().Equals("MTK_6255*")
                    && app.CustomProperties.ContainsKey("2") && app.CustomProperties["2"].ToString().Equals("480x800"))
                {
                    flag6255 = "<lable style=\"color:red\"> <<<<<<<<<<<<  MTK_6255* & 480x800</label>";
                }

                if (!string.IsNullOrEmpty(app.CurrentTestVersion))
                {
                    var ver = appStore.GetCurrentTestVersionForApp(app.Id);
                    if (ver != null)
                    {
                        if (dups.ContainsKey(ver.FileUrl))
                        {
                            dups[ver.FileUrl].Add(string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Internal Test publish App {2} </a> {3}", app.AppProjectId, app.Id, app.Name, flag6255));
                        }
                        else
                        {
                            dups[ver.FileUrl] = new List<string> { string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Internal Test publish App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255) };
                        }
                    }
                }

                if (!string.IsNullOrEmpty(app.CurrentVer))
                {
                    var ver = appStore.GetCurrentVersionForApp(app.Id);
                    if (ver != null)
                    {
                        if (dups.ContainsKey(ver.FileUrl))
                        {
                            dups[ver.FileUrl].Add(string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Published App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255));
                        }
                        else
                        {
                            dups[ver.FileUrl] = new List<string> { string.Format("<a href=\"http://inet.kk570.com/AppStoresUI/AppDetails?appProjectId={0}&appId={1}\"> click here to fix Published App {2} </a>{3}", app.AppProjectId, app.Id, app.Name, flag6255) };
                        }
                    }
                }
            }

            StringBuilder sb = new StringBuilder();
            foreach (var kv in dups)
            {
                if (kv.Value.Count > 1)
                {
                    sb.Append(string.Format("<lable style=\"color:gray\">File {0} duplicate in:</label> <br/>", kv.Key));
                    foreach (var v in kv.Value)
                    {
                        sb.Append(v + "<br/>");
                    }

                    sb.Append("<br/>");
                }
            }

            return Content(sb.ToString(), "text/html");
        }