Ejemplo n.º 1
0
        /// <summary>
        /// Callback function called when the publisher update is triggered
        /// </summary>
        public void OnSubscriberUpdate(object SourceOfEvent, FakeTicker fakeTickerArg)
        {
            bool           bFound = false;
            SubscriberData temp;

            for (int i = 0; i < DataList.Count; i++)
            {
                temp = ( SubscriberData )DataList[i];

                if (temp.Name == fakeTickerArg.Name)
                {
                    temp.Value = fakeTickerArg.Value;
                    bFound     = true;
                }
            }

            if (bFound == false)
            {
                SubscriberData data = new SubscriberData();
                data.Name  = fakeTickerArg.Name;
                data.Value = fakeTickerArg.Value;

                DataList.Add(data);
            }

            IsUpdated = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Register a ticker with the Publish class
        /// </summary>
        /// <param name="ticker">The FakeTicker to be registered</param>
        public void RegisterFakeTicker(string strName, int nValue)
        {
            /// create a new faketicker
            FakeTicker Fake = new FakeTicker(strName, nValue);

            /// store it in the update list
            FakeTickerList.Add(Fake);

            nNumSubscriptions++;
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            SecurityLog           securityLog           = mock(typeof(SecurityLog));
            InternalFlatFileRealm internalFlatFileRealm = new InternalFlatFileRealm(new InMemoryUserRepository(), new InMemoryRoleRepository(), new BasicPasswordPolicy(), new RateLimitedAuthenticationStrategy(Clock.systemUTC(), Config.defaults()), mock(typeof(JobScheduler)), new InMemoryUserRepository(), new InMemoryUserRepository()
                                                                                    );

            _testRealm = new TestRealm(this, LdapConfig, securityLog, new SecureHasher());

            IList <Realm> realms = listOf(internalFlatFileRealm, _testRealm);

            _fakeTicker  = new FakeTicker();
            _authManager = new MultiRealmAuthManager(internalFlatFileRealm, realms, new ShiroCaffeineCache.Manager(_fakeTicker.read, 100, 10, true), securityLog, false, false, Collections.emptyMap());
            _authManager.init();
            _authManager.start();

            _authManager.UserManager.newUser("mike", password("123"), false);
            _authManager.UserManager.newUser("mats", password("456"), false);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _fakeTicker = new FakeTicker();
            _cache      = new ShiroCaffeineCache <int, string>(_fakeTicker.read, ThreadStart.run, _ttl, 5, true);
        }
Ejemplo n.º 5
0
 public StopwatchTests()
 {
     ticker    = new FakeTicker();
     stopwatch = Stopwatches.Create(ticker);
 }