Ejemplo n.º 1
0
 private void AddRow(IReferences source)
 {
     var newRow = LiterarySources.NewRow();
     newRow[0] = source.GetType();
     newRow[1] = source.GetDescription();
     LiterarySources.Rows.Add(newRow);
 }
Ejemplo n.º 2
0
        public IReferences GetLiterarySource()
        {
            if (DissertationRadioButton.Checked)
            {
                LiterarySource = _dissertationControl.GetDissertation();
            }
            if (MultiRadioButton.Checked)
            {
                LiterarySource = _multiControl.GetMultiEdition();
            }
            if (NormRadioButton.Checked)
            {
                LiterarySource = _normControl.GetNormDocument();
            }

            return LiterarySource;
        }
Ejemplo n.º 3
0
        public LimitsHttpServiceV1Test()
        {
            _persistence = new LimitsMemoryPersistence();
            _controller  = new LimitsController();
            _service     = new LimitsHttpServiceV1();

            IReferences references = References.FromTuples(
                new Descriptor("pip-services-limits-dotnet", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("pip-services-limits-dotnet", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("pip-services-limits-dotnet", "service", "http", "default", "1.0"), _service
                );

            _controller.SetReferences(references);

            _persistence.OpenAsync(null).Wait();

            _service.Configure(HttpConfig);
            _service.SetReferences(references);
            _service.OpenAsync(null).Wait();
        }
        public CompaniesHttpServiceV1Test()
        {
            _persistence = new CompaniesMemoryPersistence();
            _controller  = new CompaniesController();
            _service     = new CompaniesHttpServiceV1();

            IReferences references = References.FromTuples(
                new Descriptor("CompaniesService", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("CompaniesService", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("CompaniesService", "service", "http", "default", "1.0"), _service
                );

            _controller.SetReferences(references);

            _service.Configure(HttpConfig);
            _service.SetReferences(references);

            Task.Run(() => _service.OpenAsync(null));
            Thread.Sleep(5000);
        }
        public CustomersDirectClientV1Test()
        {
            _persistence = new CustomersMemoryPersistence();
            _controller  = new CustomersController();
            _client      = new CustomersDirectClientV1();

            IReferences references = References.FromTuples(
                new Descriptor("eic-customers", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("eic-customers", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("eic-customers", "client", "direct", "default", "1.0"), _client
                );

            _controller.SetReferences(references);

            _client.SetReferences(references);

            _fixture = new CustomersClientV1Fixture(_client);

            _client.OpenAsync(null).Wait();
        }
Ejemplo n.º 6
0
        public GuidesDirectClientV1Test()
        {
            var persistence = new GuidesMemoryPersistence();
            var controller  = new GuidesController();
            var client      = new GuidesDirectClientV1();

            IReferences references = References.FromTuples(
                new Descriptor("wexxle-guides", "persistence", "memory", "default", "1.0"), persistence,
                new Descriptor("wexxle-guides", "controller", "default", "default", "1.0"), controller,
                new Descriptor("wexxle-guides", "client", "direct", "default", "1.0"), client,
                new Descriptor("wexxle-attachments", "client", "null", "default", "1.0"), new AttachmentsNullClientV1()
                );

            controller.SetReferences(references);

            client.SetReferences(references);

            _fixture = new GuidesClientV1Fixture(client);

            client.OpenAsync(null).Wait();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets references to dependent components.
        /// </summary>
        /// <param name="references">references to locate the component dependencies.</param>
        public virtual void SetReferences(IReferences references)
        {
            _references = references;

            _logger.SetReferences(references);
            _counters.SetReferences(references);
            _dependencyResolver.SetReferences(references);

            // Get endpoint
            _endpoint      = _dependencyResolver.GetOneOptional("endpoint") as HttpEndpoint;
            _localEndpoint = _endpoint == null;

            // Or create a local one
            if (_endpoint == null)
            {
                _endpoint = CreateLocalEndpoint();
            }

            // Add registration callback to the endpoint
            _endpoint.Register(this);
        }
        /// <summary>
        /// SetReferences are sets references to dependent components.
        /// </summary>
        /// <param name="references">References to be set</param>
        public override void SetReferences(IReferences references)
        {
            base.SetReferences(references);

            _references = references;

            _dependencyResolver.SetReferences(references);
            // Get connection
            _connection = _dependencyResolver.GetOneOptional <NatsConnection>("connection");

            // Or create a local one
            if (_connection == null)
            {
                _connection      = CreateConnection();
                _localConnection = true;
            }
            else
            {
                _localConnection = false;
            }
        }
Ejemplo n.º 9
0
        public Snippets(
            ICompilerService compiler,
            IWorkspace workspace,
            IReferences references,
            ILogger <Snippets> logger,
            IEventService eventService)
        {
            Compiler         = compiler;
            Workspace        = workspace;
            GlobalReferences = references;
            Logger           = logger;
            AssemblyInfo     = new AssemblyInfo(null);
            Items            = new Snippet[0];

            _metadata                       = new Lazy <CompilerMetadata>(LoadCompilerMetadata);
            Workspace.Reloaded             += OnWorkspaceReloaded;
            GlobalReferences.PackageLoaded += OnGlobalReferencesPackageLoaded;;

            AssemblyLoadContext.Default.Resolving += Resolve;

            eventService?.TriggerServiceInitialized <ISnippets>(this);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets references to dependent components.
        /// </summary>
        /// <param name="references">references to locate the component dependencies.</param>
        public override void SetReferences(IReferences references)
        {
            base.SetReferences(references);

            _cachedCounters = _dependencyResolver.GetOneOptional <PrometheusCounters>("prometheus-counters");
            var contextInfo = references.GetOneOptional <ContextInfo>(
                new Descriptor("pip-services3", "context-info", "default", "*", "1.0"));

            if (contextInfo != null && string.IsNullOrEmpty(_source))
            {
                _source = contextInfo.Name;
            }
            if (contextInfo != null && string.IsNullOrEmpty(_instance))
            {
                _instance = contextInfo.ContextId;
            }

            if (_cachedCounters == null)
            {
                _cachedCounters = _dependencyResolver.GetOneOptional <CachedCounters>("cached-counters");
            }
        }
        public CustomersHttpServiceV1Test()
        {
            _persistence = new CustomersMemoryPersistence();
            _controller  = new CustomersController();
            _service     = new CustomersHttpServiceV1();

            IReferences references = References.FromTuples(
                new Descriptor("eic-customers", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("eic-customers", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("eic-customers", "service", "http", "default", "1.0"), _service
                );

            _controller.SetReferences(references);

            _service.Configure(HttpConfig);
            _service.SetReferences(references);

            //_service.OpenAsync(null).Wait();
            // Todo: This is defect! Open shall not block the tread
            Task.Run(() => _service.OpenAsync(null));
            Thread.Sleep(5000); // Just let service a sec to be initialized
        }
        public virtual void SetReferences(IReferences references)
        {
            try
            {
                _logger.SetReferences(references);

                var mongoDbConnectionUrl = new MongoUrlBuilder(ConnectionUri);
                AccountName  = mongoDbConnectionUrl.Username;
                AccessKey    = mongoDbConnectionUrl.Password;
                DatabaseName = mongoDbConnectionUrl.DatabaseName;

                _metricsService = references.GetOneRequired <ICosmosDbMetricsService>(new Descriptor("pip-services", "metrics-service", "*", "*", "*"));
                _lock           = references.GetOneRequired <ILock>(new Descriptor("pip-services", "lock", "*", "*", "*"));

                _timer = new FixedRateTimer(PerformMonitorAsync, TimerInterval, DelayInterval);
            }
            catch (Exception exception)
            {
                _logger.Error("AbstractCosmosDbPersistenceThroughputMonitor", exception,
                              $"Failed to configure the CosmosDb persistence throughput monitor with parameters '{_configParams}'.");
            }
        }
Ejemplo n.º 13
0
        public AccountHttpClientV1Test()
        {
            try
            {
                _client = new AccountsHttpClientV1();

                IReferences references = References.FromTuples(
                    new Descriptor("SHL-Account", "client", "http", "default", "1.0"), _client
                    );

                _client.Configure(HttpConfig);
                _client.SetReferences(references);

                _fixture = new AccountClientV1Fixture(_client);

                _client.OpenAsync(null).Wait();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 14
0
        public LimitsHttpClientV1Test()
        {
            _persistence = new LimitsMemoryPersistence();
            _persistence.Configure(new ConfigParams());

            _controller = new LimitsController();
            _controller.Configure(new ConfigParams());

            _client  = new LimitsHttpClientV1();
            _service = new LimitsHttpServiceV1();


            ConfigParams HttpConfig = ConfigParams.FromTuples(
                "connection.protocol", "http",
                "connection.host", "localhost",
                "connection.port", 3000
                );

            _service.Configure(HttpConfig);
            _client.Configure(HttpConfig);

            _fixture = new LimitsClientV1Fixture(_client);

            IReferences references = References.FromTuples(
                new Descriptor("pip-services-limits-dotnet", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("pip-services-limits-dotnet", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("pip-services-limits-dotnet", "client", "http", "default", "1.0"), _client,
                new Descriptor("pip-services-limits-dotnet", "service", "http", "default", "1.0"), _service
                );

            _controller.SetReferences(references);
            _client.SetReferences(references);
            _service.SetReferences(references);

            _persistence.OpenAsync(null).Wait();
            _service.OpenAsync(null).Wait();
            _client.OpenAsync(null).Wait();
        }
Ejemplo n.º 15
0
        public GuidesHttpServiceV1BeforeAll()
        {
            Persistence = new GuidesMemoryPersistence();
            Controller  = new GuidesController();
            Service     = new GuidesHttpServiceV1();
            _cache      = new NullCache();

            References = PipServices3.Commons.Refer.References.FromTuples(
                new Descriptor("wexxle-guides", "persistence", "memory", "default", "1.0"), Persistence,
                new Descriptor("pip-services3", "cache", "null", "default", "1.0"), _cache,
                new Descriptor("wexxle-guides", "controller", "default", "default", "1.0"), Controller,
                new Descriptor("wexxle-guides", "service", "http", "default", "1.0"), Service,
                new Descriptor("wexxle-attachments", "client", "null", "default", "1.0"), new AttachmentsNullClientV1()
                );

            Controller.SetReferences(References);

            Service.Configure(HttpConfig);
            Service.SetReferences(References);

            Task.Run(() => Service.OpenAsync(null));
            Thread.Sleep(1000);
        }
Ejemplo n.º 16
0
        public LimitsDirectClientV1Test()
        {
            _persistence = new LimitsMemoryPersistence();
            _persistence.Configure(new ConfigParams());

            _controller = new LimitsController();
            _controller.Configure(new ConfigParams());

            _client = new LimitsDirectClientV1();

            IReferences references = References.FromTuples(
                new Descriptor("pip-services-limits-dotnet", "persistence", "memory", "default", "1.0"), _persistence,
                new Descriptor("pip-services-limits-dotnet", "controller", "default", "default", "1.0"), _controller,
                new Descriptor("pip-services-limits-dotnet", "client", "direct", "default", "1.0"), _client
                );

            _controller.SetReferences(references);

            _client.SetReferences(references);

            _fixture = new LimitsClientV1Fixture(_client);

            _persistence.OpenAsync(null).Wait();
        }
Ejemplo n.º 17
0
 /// <summary>
 ///     Constructs a new resolver that looks for symbols in a given
 ///     collection of snippets.
 /// </summary>
 /// <param name="snippets">
 ///     The collection of snippets to be used when resolving symbols.
 /// </param>
 public OperationResolver(ISnippets snippets, IWorkspace workspace, IReferences references)
 {
     this.snippets   = snippets;
     this.workspace  = workspace;
     this.references = references;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Creates a SymbolResolver from a Snippets implementation. Only used for testing.
 /// </summary>
 internal OperationResolver(Snippets snippets)
 {
     this.snippets   = snippets;
     this.workspace  = snippets.Workspace;
     this.references = snippets.GlobalReferences;
 }
Ejemplo n.º 19
0
 public virtual void SetReferences(IReferences references)
 {
     _logger.SetReferences(references);
 }
Ejemplo n.º 20
0
        /// <summary>
        ///     Registers an event handler that searches newly loaded packages
        ///     for extensions to this engine (in particular, for result encoders).
        /// </summary>
        private void RegisterPackageLoadedEvent(IServiceProvider services, ILogger logger, IReferences references)
        {
            var knownAssemblies = references
                                  .Assemblies
                                  .Select(asm => asm.Assembly.GetName())
                                  .ToImmutableHashSet()
                                  // Except assemblies known at compile-time as well.
                                  .Add(typeof(StateVectorToHtmlResultEncoder).Assembly.GetName())
                                  .Add(typeof(AzureClientErrorToHtmlEncoder).Assembly.GetName());

            foreach (var knownAssembly in knownAssemblies)
            {
                System.Console.WriteLine($"{knownAssembly.FullName}");
            }

            // Register new display encoders when packages load.
            references.PackageLoaded += (sender, args) =>
            {
                logger.LogDebug("Scanning for display encoders after loading {Package}.", args.PackageId);
                foreach (var assembly in references.Assemblies
                         .Select(asm => asm.Assembly)
                         .Where(asm => !knownAssemblies.Contains(asm.GetName()))
                         )
                {
                    // Look for display encoders in the new assembly.
                    logger.LogDebug("Found new assembly {Name}, looking for display encoders.", assembly.FullName);
                    var relevantTypes = assembly
                                        .GetTypes()
                                        .Where(type =>
                                               !type.IsAbstract &&
                                               !type.IsInterface &&
                                               typeof(IResultEncoder).IsAssignableFrom(type)
                                               );

                    foreach (var type in relevantTypes)
                    {
                        logger.LogDebug(
                            "Found display encoder {TypeName} in {AssemblyName}; registering.",
                            type.FullName,
                            assembly.FullName
                            );

                        // Try and instantiate the new result encoder, but if it fails, that is likely
                        // a non-critical failure that should result in a warning.
                        try
                        {
                            RegisterDisplayEncoder(ActivatorUtilities.CreateInstance(services, type) as IResultEncoder);
                        }
                        catch (Exception ex)
                        {
                            logger.LogWarning(
                                ex,
                                "Encountered exception loading result encoder {TypeName} from {AssemblyName}.",
                                type.FullName, assembly.FullName
                                );
                        }
                    }
                    knownAssemblies = knownAssemblies.Add(assembly.GetName());
                }
            };
        }
Ejemplo n.º 21
0
        public override void SetReferences(IReferences references)
        {
            _dependencyResolver.SetReferences(references);

            _Persistence = _dependencyResolver.GetOneRequired <IBeaconsPersistence>("persistence");
        }
 /// <summary>
 /// Creates a new instance of the decorator.
 /// </summary>
 /// <param name="baseReferences">the next references or decorator in the chain.</param>
 /// <param name="parentReferences">the decorator at the top of the chain.</param>
 public LinkReferencesDecorator(IReferences baseReferences = null, IReferences parentReferences = null)
     : base(baseReferences, parentReferences)
 {
 }
 public override void SetReferences(IReferences references)
 {
     base.SetReferences(references);
     this._logger   = new CompositeLogger();
     this._counters = new CompositeCounters();
 }
 public void SetReferences(IReferences references)
 {
     _persistence = references.GetOneRequired <IBeaconsPersistence>(
         new Descriptor("beacons", "persistence", "*", "*", "1.0")
         );
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Sets the component references
 /// </summary>
 /// <param name="references">references to set.</param>
 public void SetReferences(IReferences references)
 {
     _references = references;
 }
Ejemplo n.º 26
0
 public LinkReferencesDecorator(IReferences baseReferences = null, IReferences parentReferences = null)
     : base(baseReferences, parentReferences)
 {
     LinkEnabled = true;
 }
Ejemplo n.º 27
0
 public PackagesController(IReferences references)
 {
     this.References = references;
 }
 /// <summary>
 /// Creates a new instance of the decorator.
 /// </summary>
 /// <param name="baseReferences">the next references or decorator in the chain.</param>
 /// <param name="parentReferences">the decorator at the top of the chain.</param>
 public ReferencesDecorator(IReferences baseReferences = null, IReferences parentReferences = null)
 {
     BaseReferences   = baseReferences ?? parentReferences;
     ParentReferences = parentReferences ?? baseReferences;
 }
 /// <summary>
 /// Sets references to dependent components.
 /// </summary>
 /// <param name="references">references to locate the component dependencies.</param>
 public void SetReferences(IReferences references)
 {
     _connectionResolver.SetReferences(references);
     _credentialResolver.SetReferences(references);
 }
        public void SetReferences(IReferences references)
        {
            _logger.SetReferences(references);

            InitializeConnection();
        }
Ejemplo n.º 31
0
 public bool Equals(IReferences other)
 {
     return(Equals(other as SafeComWrapper <VB.References>));
 }
Ejemplo n.º 32
0
        public override void SetReferences(IReferences references)
        {
            base.SetReferences(references);

            _controller = references.GetOneRequired <IDummyController>(new Descriptor("pip-services3-dummies", "controller", "default", "*", "1.0"));
        }