public void CanBeUsedWithTheUsingCSharpIdiomToAttemptOnAnISync() { // no expectations mocks.ReplayAll(); MySemaphore sync = new MySemaphore(1); using (new SyncHolder(sync, 100)) { Assert.AreEqual(0, sync.Permits); } Assert.AreEqual(1, sync.Permits); sync = new MySemaphore(0); try { using (new SyncHolder(sync, 100)) { Assert.IsTrue(false, "wrongly entered sync block"); } } catch (TimeoutException) { Assert.AreEqual(0, sync.Permits); } }
public bool TryToCauseAnError (ISync sync, long msecs) { new Thread(new ThreadStart(Go)).Start(); bool got = sync.Attempt(msecs); _resetEvent.Set(); return got; }
public void SetUp () { nReconfigured = 0; appName = Guid.NewGuid().ToString(); application = new Application(appName); Directory.CreateDirectory(application.FullPath); manager = new ApplicationWatcherManager(application, 10); manager.Reconfigured += new EventHandler(manager_Reconfigured); reconfigured = new Semaphore(0); }
public void SetUp () { _path = Path.GetFullPath(Guid.NewGuid().ToString()); Directory.CreateDirectory(_path); monitor = new FileSystemMonitor(_path); monitor.Start(); tester = new FileSystemMonitorTester(_path); sync = new Semaphore(0); msecs = 1000; aFile = "foo.txt"; }
public void AddSync(ISync Sync) { if (_syncs.ContainsKey(Sync.Name)) { throw new Exception("Sync Name already exists in the SyncManager."); } else { lock(_locker) { _syncs.Add(Sync.Name, Sync); } } }
static NamesValuesPair DumpSyncTrait(ISync sync) { var type = sync.GetType(); TypeInfo typeInfo; lock (typeInfoCache) typeInfo = typeInfoCache[type]; var values = new object[typeInfo.Names.Length]; var index = 0; foreach (var func in typeInfo.SerializableCopyOfMemberFunctions) values[index++] = func(sync); return Pair.New(typeInfo.Names, values); }
/// <summary> /// Creates a new <see cref="SyncHolder"/> trying to <see cref="ISync.Acquire"/> the given /// <see cref="ISync"/> /// </summary> /// <param name="sync">the <see cref="ISync"/> to be held</param> public SyncHolder (ISync sync) { Init (sync); }
public void SetUp() { mocks = new MockRepository(); sync = (ISync)mocks.CreateMock(typeof(ISync)); }
public Worker(ISync startPermit, ISync workedSync) { this.startPermit = startPermit; this.workedSync = workedSync; }
public EstoqueService(IRepository <Estoque> repEstoque, ISync sync) { _repEstoque = repEstoque; _sync = sync; }
public MyService (ISync sync1, ISync sync2) { this._sync1 = sync1; this._sync2 = sync2; }
protected void InitHandler (ISync sync) { location = new FileSystemDeployLocation (dispatcher, deployPath); handler = NewHandler (sync); }
public void SetUp () { MockApplication.ResetCount(); started = new Latch(); new Thread(new ThreadStart(Go)).Start(); started.Acquire(); boxTester = new MyListBoxTester("applicationList", form); appStatus = new LabelTester("applicationStatus", form); serviceStatus = new LabelTester("serviceStatus", form); }
internal static int Hash(ISync sync) { return(GetHashFunction(sync)(sync)); }
internal static Func <object, int> GetHashFunction(ISync sync) { return(HashFunctions[sync.GetType()]); }
public Processor(ISync iface) { iface_ = iface; processMap_["InvokeExternalService"] = InvokeExternalService_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["lookupByPhoneNumber"] = lookupByPhoneNumber_Process; processMap_["lookupNearby"] = lookupNearby_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["OnEvent"] = OnEvent_Process; processMap_["OnFrameEnd"] = OnFrameEnd_Process; }
public static void MarkAsSynced(SqlBase origin, ISync ISync) => MarkAsSynced(origin, ISync.Guid);
/// <summary> /// initializes and acquire access to the <see cref="ISync"/> /// </summary> /// <param name="sync"></param> private void Init (ISync sync) { this._sync = sync; _sync.Acquire(); }
public Processor(ISync iface) { iface_ = iface; processMap_["SayHello"] = SayHello_Process; }
public OldDataDirStream(FqStreamID FQSID, StreamFactory.StreamOp Op, CallerInfo Ci, ISync sync) : base(FQSID, Op, Ci, sync) { if (!typeof(IValue).IsAssignableFrom(typeof(ValType))) { throw new InvalidDataException("ValType must implement IValue"); } }
public ExceptionDispatcher (ISync started, ISync canContinue) { this.started = started; this.canContinue = canContinue; }
public Processor(ISync iface) : base(iface) { iface_ = iface; processMap_["GetGraspPoses"] = GetGraspPoses_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["ValidateSDK"] = ValidateSDK_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["Subscribe"] = Subscribe_Process; }
public StoppingHelper (ServiceSupport serviceSupport, ISync stopping, ISync stopped) { this.stopping = stopping; this.stopped = stopped; this.serviceSupport = serviceSupport; }
public Helper(ISync sync, Latch latch) { Init(latch, sync, null); }
public Processor(ISync iface) { iface_ = iface; processMap_["GetSomeWork"] = GetSomeWork_Process; processMap_["MealPrepared"] = MealPrepared_Process; }
public Helper(Latch latch, ISync sync, IObjectPool objectPool) { Init(latch, sync, objectPool); }
public Processor(ISync iface) { iface_ = iface; processMap_["getVersion"] = getVersion_Process; processMap_["getTime"] = getTime_Process; }
public void Init(Latch latch, ISync sync, IObjectPool objectPool) { this.sync = sync; this.latch = latch; this.objectPool = objectPool; }
public SyncedDeployer(ISync sync) { this.sync = sync; }
public Processor(ISync iface) { iface_ = iface; processMap_["Invoke"] = Invoke_Process; }
/// <summary> /// Creates a new <see cref="SyncHolder"/> trying to <see cref="ISync.Attempt"/> the given /// <see cref="ISync"/> /// </summary> /// <param name="sync">the <see cref="ISync"/> to be held</param> /// <param name="msecs">millisecond to try to acquire the lock</param> public SyncHolder (ISync sync, long msecs) { Init(new TimeoutSync(sync, msecs)); }
public Processor(ISync iface) { iface_ = iface; processMap_["secondtestString"] = secondtestString_Process; }
public void SetUp () { mocks = new MockRepository(); sync = mocks.StrictMock<ISync>(); }
public SyncHash(ISync trait, int hash) { Trait = trait; Hash = hash; }
public void SetUp() { mocks = new MockRepository(); sync = (ISync) mocks.CreateMock(typeof(ISync)); }
public Processor(ISync iface) { iface_ = iface; processMap_["Add"] = Add_Process; }
public void SetUp () { base.SetUp_(); factoryMock = new DynamicMock(typeof(IApplicationWatcherFactory)); watcherMock = new DynamicMock(typeof(IApplicationWatcher)); factory = (IApplicationWatcherFactory) factoryMock.Object; watcher = (IApplicationWatcher) watcherMock.Object; deployEventDispatched = false; forwardDispatcherSync = new Latch(); }
public Processor(ISync iface) { iface_ = iface; processMap_["GetPlayingUserInfo"] = GetPlayingUserInfo_Process; }
protected void InitHandlerAndStartLocation (ISync sync) { GC.SuppressFinalize (location); InitHandler (sync); location.StartWatching (); }
public SyncHash(ISync trait) { Trait = trait; hashFunction = Sync.GetHashFunction(trait); }
protected TestingHandler NewHandler (ISync sync) { try { log.Debug("disconnecting testing handler"); location.DeployEvent -= new DeployEventHandler (dontUseHandler.Handle); } catch {} dontUseHandler = new TestingHandler (sync); log.Debug("connecting testing handler"); location.DeployEvent += new DeployEventHandler (dontUseHandler.Handle); return dontUseHandler; }
private void LoadPropiedades() { syncLogRepository = new SyncLogRepository(); _SistemaRepository = new SistemaRepository(); _RegistroRepository = new RegistroRepository(); _ServerLastDataRepository = new ServerLastDataRepository(); _UploadLogRepository = new UploadLogRepository(); _EvidenceSyncRepository = new EvidenceSyncRepository(); _SyncRepository = new SyncRepository(); _CondProRepository = new CondProRepository(); _DependenciaRepository = new DependenciaRepository(); _EstPuntoMedRepository = new EstPuntoMedRepository(); _EstructuraRepository = new EstructuraRepository(); _EstructuraDependenciaRepository = new EstructuraDependenciaRepository(); _PuntoMedicionRepository = new PuntoMedicionRepository(); _TipoPuntoMedicionRepository = new TipoPuntoMedicionRepository(); _UnidadMedidaRepository = new UnidadMedidaRepository(); //_ConsideracionRepository = new ConsideracionRepository(); //_AccionProtocoloRepository = new AccionProtocoloRepository(); _CnfSettingRepository = new CnfSettingRepository(); routeService = ConfigurationManager.AppSettings["RutaServicioSubida"].ToString(); routeDownload = ConfigurationManager.AppSettings["RutaServicioDescarga"].ToString(); basicAuthUser = ConfigurationManager.AppSettings["basicAuthUser"].ToString(); basicAuthPass = ConfigurationManager.AppSettings["basicAuthPass"].ToString(); contador = int.Parse(ConfigurationManager.AppSettings["ContSettings"].ToString()); TopLog = int.Parse(ConfigurationManager.AppSettings["TopLog"].ToString()); }
public InterruptAgainStrategy(ISync stop, ISync go) { this.stopSync = stop; this.goSync = go; }
public Job(int size, int creationTime, int clientSize, ISync start, int executionTime, int repeat) { this.poolSize = size; this.creationTime = creationTime; this.clientSize = clientSize; this.run = start; this.executionTime = executionTime; this.repeat = repeat; }
public void SetUp () { sync1 = new Semaphore(0); sync2 = new Semaphore(0); serviceable = new MyService(sync1, sync2); serviceSupport = new ServiceSupport(serviceable); }
public BlockWhileStartingExecutor (ISync starting, ISync started) { this.starting = starting; this.started = started; }
public Processor(ISync iface) { iface_ = iface; processMap_["Search"] = Search_Process; }
public Client(int id, ISync run, SimplePool pool, int repeat) { this.run = run; this.pool = pool; this.id = id; lock (this.GetType()) { created++; //Console.Out.WriteLine("#{0} created (created/run: {1}/{2})...", id, created, nRun); } this.repeat = repeat; }
public Processor(ISync iface) { iface_ = iface; processMap_["notify"] = notify_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["SendMessageFromPlatform"] = SendMessageFromPlatform_Process; }
public Processor(ISync iface) { iface_ = iface; processMap_["GetAllBanji"] = GetAllBanji_Process; }
public Queuer (IObjectPool pool, IRunnable runnable) { this.pool = pool; this.runnable = runnable; this.sync = new Latch(); }
public Processor(ISync iface) { iface_ = iface; processMap_["TakeScreenShot"] = TakeScreenShot_Process; }