Esempio n. 1
0
        public void TestConexionCreateRepositoryConfig()
        {
            try
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.Development.json");

                IConfiguration Configuration = builder.Build();

                ConfigUrlService configUrl   = new ConfigUrlService(Configuration);
                CallApiService   callService = new CallApiService();
                CallRepositoryConfigApiService callRepository = new CallRepositoryConfigApiService(callService, null, configUrl);
                RepositoryConfigViewModel      item           = new RepositoryConfigViewModel()
                {
                    Name       = "Prueba",
                    OauthToken = "qyueu11",
                    Url        = "url/prueba"
                };
                var resultado = callRepository.CreateRepositoryConfigView(item);
                Assert.True(true);
            }
            catch (Exception)
            {
                Assert.True(false);
            }
        }
Esempio n. 2
0
 public void TestConexionListadoShapeConfig()
 {
     try
     {
         ConfigUrlService          configUrl      = new ConfigUrlService();
         CallApiService            callService    = new CallApiService();
         CallShapeConfigApiService callRepository = new CallShapeConfigApiService(callService, null, configUrl);
         var resultado = callRepository.GetShapeConfigs();
         Assert.True(true);
     }
     catch (Exception)
     {
         Assert.True(false);
     }
 }
Esempio n. 3
0
 public void TestConexionDeleteShapeConfig()
 {
     try
     {
         ConfigUrlService          configUrl      = new ConfigUrlService();
         CallApiService            callService    = new CallApiService();
         CallShapeConfigApiService callRepository = new CallShapeConfigApiService(callService, null, configUrl);
         Guid id        = Guid.NewGuid();
         var  resultado = callRepository.DeleteShapeConfig(id);
         Assert.True(true);
     }
     catch (Exception)
     {
         Assert.True(false);
     }
 }
 public void TestConexionCreateRepositoryConfig()
 {
     try
     {
         ConfigUrlService configUrl   = new ConfigUrlService();
         CallApiService   callService = new CallApiService(configUrl);
         CallRepositoryConfigApiService callRepository = new CallRepositoryConfigApiService(callService);
         RepositoryConfigViewModel      item           = new RepositoryConfigViewModel()
         {
             Name       = "Prueba",
             OauthToken = "qyueu11",
             Url        = "url/prueba"
         };
         var resultado = callRepository.CreateRepositoryConfigView(item);
         Assert.True(true);
     }
     catch (Exception)
     {
         Assert.True(false);
     }
 }
Esempio n. 5
0
        public void TestConexionListadoRepositoryConfig()
        {
            try
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.Development.json");

                IConfiguration Configuration = builder.Build();

                ConfigUrlService configUrl   = new ConfigUrlService(Configuration);
                CallApiService   callService = new CallApiService();
                CallRepositoryConfigApiService callRepository = new CallRepositoryConfigApiService(callService, null, configUrl);
                var resultado = callRepository.GetRepositoryConfigs();
                Assert.True(true);
            }
            catch (Exception)
            {
                Assert.True(false);
            }
        }
 public FavoriteExamService(CallApiService apiService)
 {
     _apiService = apiService;
 }
 public WeatherForecastController(CallApiService callApiService, ILogger <WeatherForecastController> logger)
 {
     _callApiService = callApiService;
     _logger         = logger;
 }
Esempio n. 8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();
            string      casBaseUrl           = "";

            if (environmentVariables.Contains("CasBaseUrl"))
            {
                casBaseUrl = environmentVariables["CasBaseUrl"] as string;
            }
            else
            {
                casBaseUrl = Configuration["CasBaseUrl"];
            }

            string serviceHost = "";

            if (environmentVariables.Contains("ServiceHost"))
            {
                serviceHost = environmentVariables["ServiceHost"] as string;
            }
            else
            {
                serviceHost = Configuration["ServiceHost"];
            }
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>
            {
                options.LoginPath        = new PathString("/login");
                options.AccessDeniedPath = new PathString("/access-denied");
            })
            .AddCAS(options =>
            {
                options.CasServerUrlBase = casBaseUrl;      // Set in `appsettings.json` file.
                options.SignInScheme     = CookieAuthenticationDefaults.AuthenticationScheme;
                options.ServiceHost      = serviceHost;
            });
            bool cargado = false;

            while (!cargado)
            {
                // services.AddMvcRazorRuntimeCompilation();
                try
                {
                    services.AddRazorPages().AddRazorRuntimeCompilation();
                    services.AddControllersWithViews().AddRazorRuntimeCompilation();
                    services.Configure <MvcRazorRuntimeCompilationOptions>(opts =>
                    {
                        CallApiService serviceApi         = new CallApiService();
                        CallTokenService tokenService     = new CallTokenService(new ConfigTokenService());
                        ConfigUrlService serviceUrl       = new ConfigUrlService();
                        CallApiVirtualPath apiVirtualPath = new CallApiVirtualPath(tokenService, serviceUrl, serviceApi);
                        opts.FileProviders.Add(
                            new ApiFileProvider(apiVirtualPath));
                    });
                    cargado = true;
                } catch (Exception ex)
                {
                    cargado = false;
                }
            }
            services.AddEntityFrameworkNpgsql().AddDbContext <EntityContext>(opt =>
            {
                var builder = new NpgsqlDbContextOptionsBuilder(opt);
                builder.SetPostgresVersion(new Version(9, 6));
                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                if (environmentVariables.Contains("PostgreConnectionmigration"))
                {
                    opt.UseNpgsql(environmentVariables["PostgreConnectionmigration"] as string);
                }
                else
                {
                    opt.UseNpgsql(Configuration.GetConnectionString("PostgreConnectionmigration"));
                }
            });

            services.AddScoped <DiscoverItemBDService, DiscoverItemBDService>();
            services.AddScoped <ProcessDiscoverStateJobBDService, ProcessDiscoverStateJobBDService>();


            services.AddControllersWithViews();
            services.AddSingleton(typeof(ConfigPathLog));
            services.AddSingleton(typeof(ConfigUrlService));
            services.AddSingleton(typeof(ConfigUrlCronService));
            services.AddSingleton(typeof(ConfigUnidataPrefix));
            services.AddScoped <ICallRepositoryConfigService, CallRepositoryConfigApiService>();
            services.AddScoped <ICallUrisFactoryApiService, CallUrisFactoryApiService>();
            services.AddScoped <ICallService, CallApiService>();
            services.AddScoped <ICallEtlService, CallEtlService>();
            services.AddScoped <ICallShapeConfigService, CallShapeConfigApiService>();
            services.AddScoped(typeof(CallCronApiService));
            services.AddScoped(typeof(CheckSystemService));
            services.AddScoped(typeof(CallCronService));
            services.AddScoped(typeof(ConfigTokenService));
            services.AddScoped(typeof(CallTokenService));
            services.AddScoped(typeof(CallApiVirtualPath));
            services.AddScoped(typeof(CallRepositoryJobService));
            services.AddScoped(typeof(ReplaceUsesService));
        }