public void GetSaoWithSingletonModeAndAop() { IApplicationContext ctx = new XmlApplicationContext("assembly://Spring.Services.Tests/Spring.Data.Spring.Remoting/saoSingleton-aop.xml"); ContextRegistry.RegisterContext(ctx); //object saoFactory = ctx.GetObject("&remoteCounter"); //Assert.IsNotNull(saoFactory); object obj = ctx.GetObject("remoteCounter"); Assert.IsNotNull(obj, "Object is null even though a object has been exported."); Assert.IsTrue(AopUtils.IsAopProxy(obj)); Assert.IsTrue((obj is ISimpleCounter), "Object should implement 'ISimpleCounter' interface."); MethodCounter aopCounter = ctx.GetObject("countingBeforeAdvice") as MethodCounter; Assert.IsNotNull(aopCounter); int aopCount = aopCounter.GetCalls("Count"); Assert.AreEqual(0, aopCount); ISimpleCounter sc = (ISimpleCounter)obj; Assert.AreEqual(1, sc.Counter, "Remote object hasn't been activated by the server."); sc.Count(); Assert.AreEqual(2, sc.Counter, "Remote object doesn't work in a 'Singleton' mode."); Assert.AreEqual(1, aopCounter.GetCalls("Count")); }
private void AssertExportedService(string serviceName, int expectedCount) { ISimpleCounter client = (ISimpleCounter)Activator.GetObject(typeof(ISimpleCounter), "tcp://localhost:8005/" + serviceName); client.Count(); client.Count(); Assert.AreEqual(expectedCount, client.Counter); }
public void GetSimpleObject() { IApplicationContext ctx = new XmlApplicationContext("assembly://Spring.Services.Tests/Spring.Data.Spring.Remoting/cao.xml"); ContextRegistry.RegisterContext(ctx); object obj = ctx.GetObject("remoteCaoCounter1"); Assert.IsNotNull(obj, "Object is null even though a object has been registered."); Assert.IsTrue((obj is ISimpleCounter), "Object should implement 'ISimpleCounter' interface."); ISimpleCounter sc = (ISimpleCounter)obj; Assert.AreEqual(7, sc.Counter, "Remote object hasn't been activated by the client."); sc.Count(); Assert.AreEqual(8, sc.Counter); }
public void GetSaoWithSingletonMode() { IApplicationContext ctx = new XmlApplicationContext("assembly://Spring.Services.Tests/Spring.Data.Spring.Remoting/saoSingleton.xml"); ContextRegistry.RegisterContext(ctx); object obj = ctx.GetObject("remoteSaoSingletonCounter"); Assert.IsNotNull(obj, "Object is null even though a object has been exported."); Assert.IsTrue((obj is ISimpleCounter), "Object should implement 'ISimpleCounter' interface."); ISimpleCounter sc = (ISimpleCounter)obj; Assert.AreEqual(1, sc.Counter, "Remote object hasn't been activated by the server."); sc.Count(); Assert.AreEqual(2, sc.Counter, "Remote object doesn't work in a 'Singleton' mode."); }
public SPRNET967_SimpleCounterClient(ISimpleCounter service) { this.service = service; }
public SPRNET967_SimpleCounterWrapper(ISimpleCounter service) { this.service = service; }
public void Setup() { Subject = new SimpleCounter <object>(); }