Beispiel #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);
            }
        }
Beispiel #2
0
        public IActionResult Index()
        {
            ConfigUrlService urlService = new ConfigUrlService();
            string           routeProxy = $"{urlService.GetProxy()}/public/gnossdeustobackend/home";

            return(Redirect(routeProxy));
        }
Beispiel #3
0
        public void TestGetRecord()
        {
            ConfigUrlService urlService = new ConfigUrlService();

            urlService.Url = "http://herc-as-front-desa.atica.um.es/carga/";
            CallApiNeedInfoPublisData api        = new CallApiNeedInfoPublisData(urlService);
            OaiPublishRDFService      oaiPublish = new OaiPublishRDFService(null, api);
            string rdf = oaiPublish.CallGetRecord(new Guid("5efac0ad-ec4e-467d-bbf5-ce3f64edb46a"), "1");

            Assert.True(!string.IsNullOrEmpty(rdf));
        }
Beispiel #4
0
        public void TestListIdentifier()
        {
            ConfigUrlService urlService = new ConfigUrlService();

            urlService.Url = "http://herc-as-front-desa.atica.um.es/carga/";
            CallApiNeedInfoPublisData api        = new CallApiNeedInfoPublisData(urlService);
            OaiPublishRDFService      oaiPublish = new OaiPublishRDFService(null, api);
            var lista = oaiPublish.CallListIdentifier(new Guid("5efac0ad-ec4e-467d-bbf5-ce3f64edb46a"));

            Assert.True(lista.Count > 0);
        }
Beispiel #5
0
 public etlController(IDiscoverItemService iDiscoverItemService, IRepositoriesConfigService iRepositoriesConfigService, IShapesConfigService iShapeConfigService, ConfigSparql configSparql, CallOAIPMH callOAIPMH, CallConversor callConversor, ConfigUrlService configUrlService, IRabbitMQService amqpService)
 {
     _discoverItemService       = iDiscoverItemService;
     _repositoriesConfigService = iRepositoriesConfigService;
     _shapeConfigService        = iShapeConfigService;
     _configSparql     = configSparql;
     _callOAIPMH       = callOAIPMH;
     _callConversor    = callConversor;
     _configUrlService = configUrlService;
     _amqpService      = amqpService;
 }
Beispiel #6
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);
     }
 }
        /// <summary>
        /// Obtiene los datos de una página
        /// </summary>
        /// <param name="route">Ruta de la página</param>
        /// <returns></returns>
        public IActionResult Details(string route)
        {
            var page = _documentationApi.GetPage(route);
            ConfigUrlService urlService    = new ConfigUrlService();
            string           routeProxy    = $"{urlService.GetProxy()}{page.Route}";
            PageViewModel    pageViewModel = new PageViewModel()
            {
                Route          = routeProxy,
                RouteProxyLess = page.Route,
                LastModified   = page.LastModified,
                PageId         = page.PageId
            };

            return(View(pageViewModel));
        }
Beispiel #8
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);
     }
 }
Beispiel #10
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 CallApiVirtualPath(CallTokenService tokenService, ConfigUrlService serviceUrl, ICallService serviceApi)
 {
     _serviceUrl = serviceUrl;
     _serviceApi = serviceApi;
     if (tokenService != null)
     {
         bool tokenCargado = false;
         while (!tokenCargado)
         {
             try
             {
                 _token       = tokenService.CallTokenApiDocumentacion();
                 tokenCargado = true;
             }
             catch (Exception ex)
             {
                 tokenCargado = false;
             }
         }
     }
 }
        public IActionResult Index()
        {
            var page = _documentationApi.GetPage(RUTA_MENU);

            if (page != null)
            {
                ConfigUrlService configUrlService = new ConfigUrlService();
                string           routeProxy       = $"{configUrlService.GetProxy()}{page.Route}";
                PageViewModel    pageViewModel    = new PageViewModel()
                {
                    RouteProxyLess = page.Route,
                    Route          = routeProxy,
                    LastModified   = page.LastModified,
                    PageId         = page.PageId
                };
                return(View(pageViewModel));
            }
            else
            {
                return(View(null));
            }
        }
 public HomeController(ILogger <HomeController> logger, ConfigUrlService configUrlService)
 {
     _logger           = logger;
     _configUrlService = configUrlService;
 }
Beispiel #14
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));
        }
Beispiel #15
0
 public CallApiVirtualPath(CallTokenService tokenService, ConfigUrlService serviceUrl, ICallService serviceApi)
 {
     _serviceUrl   = serviceUrl;
     _serviceApi   = serviceApi;
     _tokenService = tokenService;
 }
Beispiel #16
0
 public CMSController(CallApiVirtualPath documentationApi, ReplaceUsesService replaceUsesService, ConfigUrlService configUrlService)
 {
     _documentationApi   = documentationApi;
     _replaceUsesService = replaceUsesService;
     _configUrlService   = configUrlService;
 }