예제 #1
0
        internal void Initialize(ImageflowMiddlewareOptions middlewareOptions)
        {
            options = middlewareOptions;
            mgr.MonitorLicenses(this);
            mgr.MonitorHeartbeat(this);

            // Ensure our cache is appropriately invalidated
            cachedResult = null;
            mgr.AddLicenseChangeHandler(this, (me, manager) => me.cachedResult = null);

            // And repopulated, so that errors show up.
            if (Result == null)
            {
                throw new ApplicationException("Failed to populate license result");
            }
        }
예제 #2
0
        public MockConfig(LicenseManagerSingleton mgr, ILicenseClock clock, string[] codes, IEnumerable <KeyValuePair <string, string> > domainMappings)
        {
            this.codes = codes;
            this.mgr   = mgr;
            Clock      = clock ?? Clock;

            mgr.MonitorLicenses(this);
            mgr.MonitorHeartbeat(this);

            // Ensure our cache is appropriately invalidated
            cache = null;
            mgr.AddLicenseChangeHandler(this, (me, manager) => me.cache = null);

            // And repopulated, so that errors show up.
            if (Result == null)
            {
                throw new ApplicationException("Failed to populate license result");
            }
            this.domainMappings = domainMappings;
        }