예제 #1
0
 public void Can_throw_in_Start_with_exception_translators_in_place()
 {
     try {
         _serviceInfo = DreamTestHelper.CreateService(_hostInfo, typeof(TestExceptionalService), "throwsonstart", new XDoc("config").Elem("throw-on-start", true));
         Assert.Fail("didn't throw on start");
     } catch(Exception e) {
         Assert.IsTrue(e.Message.EndsWith("BadRequest: throwing in service start"),e.Message);
     }
 }
 public void Can_throw_in_Start_with_exception_translators_in_place()
 {
     try {
         _serviceInfo = DreamTestHelper.CreateService(_hostInfo, typeof(TestExceptionalService), "throwsonstart", new XDoc("config").Elem("throw-on-start", true));
         Assert.Fail("didn't throw on start");
     } catch (Exception e) {
         Assert.IsTrue(e.Message.EndsWith("BadRequest: throwing in service start"), e.Message);
     }
 }
 public void FixtureSetup() {
     var builder = new ContainerBuilder();
     builder.Register(c => _searchBLFactory()).As<ISearchBL>().RequestScoped();
     _hostInfo = DreamTestHelper.CreateRandomPortHost(new XDoc("config").Elem("apikey", Utils.Settings.ApiKey), builder.Build());
     _hostInfo.Host.Self.At("load").With("name", "mindtouch.deki").Post(DreamMessage.Ok());
     _hostInfo.Host.Self.At("load").With("name", "mindtouch.deki.services").Post(DreamMessage.Ok());
     _hostInfo.Host.Self.At("load").With("name", "mindtouch.indexservice").Post(DreamMessage.Ok());
     _deki = DreamTestHelper.CreateService(_hostInfo, Utils.Settings.DekiConfig);
     _search = _deki.AtLocalHost.At("site", "query");
 }
예제 #4
0
        public void ServiceTest()
        {
            string sid      = "http://services.mindtouch.com/dream/test/2007/03/sample";
            string sidInner = "http://services.mindtouch.com/dream/test/2007/03/sample-inner";

            _host.At("blueprints").Post(new XDoc("blueprint").Elem("assembly", "test.mindtouch.dream").Elem("class", "MindTouch.Dream.Test.SampleService"));
            _host.At("blueprints").Post(new XDoc("blueprint").Elem("assembly", "test.mindtouch.dream").Elem("class", "MindTouch.Dream.Test.SampleInnerService"));
            DreamServiceInfo info = DreamTestHelper.CreateService(_hostinfo,
                                                                  new XDoc("config")
                                                                  .Elem("path", "sample")
                                                                  .Elem("sid", sid)
                                                                  .Start("prologue")
                                                                  .Attr("name", "dummy")
                                                                  .Value("p0")
                                                                  .End()
                                                                  .Start("epilogue")
                                                                  .Attr("name", "dummy")
                                                                  .Value("e0")
                                                                  .End()
                                                                  .Elem("apikey", "xyz"));
            Plug service = info.AtLocalHost.With("apikey", "xyz");

            // TODO (steveb):
            //  1) check that http://localhost:8081/host/services contains the newly started service
            //  2) check that http://localhost:8081/host/services contains the inner service of the newly started service
            //  3) check that http://localhost:8081/host/sample has the expected prologues/epilogues
            //  4) check that http://localhost:8081/host/sample/inner has the 'sample' as owner
            //  5) check that http://localhost:8081/host/sample/inner has the expected prologues/epilogues

            service.Delete();

            //  6) check that http://localhost:8081/host/services does not contain the started service
            //  7) check that http://localhost:8081/host/services does not contain the inner service

            _host.At("blueprints", XUri.DoubleEncodeSegment(sid)).Delete();
            _host.At("blueprints", XUri.DoubleEncodeSegment(sidInner)).Delete();
        }
예제 #5
0
 public void GlobalSetup()
 {
     var config = new XDoc("config");
     var builder = new ContainerBuilder();
     _smtpClientFactory = new SmtpClientFactoryMock();
     builder.Register(c => _smtpClientFactory).As<ISmtpClientFactory>().ServiceScoped();
     _hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build(ContainerBuildOptions.Default));
     _emailService = DreamTestHelper.CreateService(
         _hostInfo,
         "sid://mindtouch.com/2009/01/dream/email",
         "email",
         new XDoc("config")
             .Elem("apikey", "servicekey")
             .Elem("smtp-host", DEFAULT_HOST)
     );
     _plug = _emailService.WithInternalKey().AtLocalHost;
 }
예제 #6
0
 private void CreateStorageService()
 {
     var config = new XDoc("config")
         .Elem("folder", "test")
         .Elem("bucket", "test-bucket")
         .Elem("privatekey", "test-private")
         .Elem("publickey", "test-public");
     _storage = DreamTestHelper.CreateService(_hostInfo, "sid://mindtouch.com/2010/10/dream/s3.storage", "store", config);
 }
예제 #7
0
 public void Init()
 {
     _hostInfo = DreamTestHelper.CreateRandomPortHost();
     _parent = DreamTestHelper.CreateService(_hostInfo, typeof(InheritanceParent), "parent");
     _child = DreamTestHelper.CreateService(_hostInfo, typeof(InheritanceChild), "child");
 }
예제 #8
0
 public void Init()
 {
     _hostInfo = DreamTestHelper.CreateRandomPortHost();
     _parent   = DreamTestHelper.CreateService(_hostInfo, typeof(InheritanceParent), "parent");
     _child    = DreamTestHelper.CreateService(_hostInfo, typeof(InheritanceChild), "child");
 }
예제 #9
0
 private DreamServiceInfo(DreamServiceInfo info, DreamCookieJar cookies)
 {
     _internalSetCookie = info._internalSetCookie;
     _privateSetCookie = info._privateSetCookie;
     AtLocalHost = info.AtLocalHost.WithCookieJar(cookies);
 }
예제 #10
0
 public void GlobalSetup()
 {
     _hostInfo = DreamTestHelper.CreateRandomPortHost();
     _queueService = DreamTestHelper.CreateService(_hostInfo, "sid://mindtouch.com/2009/12/dream/queue", "queue", new XDoc("config").Elem("folder", Path.GetTempPath()));
     _plug = _queueService.WithInternalKey().AtLocalHost;
 }
예제 #11
0
 private DreamServiceInfo(DreamServiceInfo info, DreamCookieJar cookies)
 {
     _internalSetCookie = info._internalSetCookie;
     _privateSetCookie  = info._privateSetCookie;
     AtLocalHost        = info.AtLocalHost.WithCookieJar(cookies);
 }
예제 #12
0
 public void FixtureSetup()
 {
     _hostInfo = DreamTestHelper.CreateRandomPortHost();
     _serviceInfo = DreamTestHelper.CreateService(_hostInfo, typeof(TestExceptionalService), "test");
 }
예제 #13
0
 private void CreateStorageService()
 {
     var config = new XDoc("config")
             .Elem("endpoint", _config.Endpoint.Name)
             .Elem("folder", _config.RootPath)
             .Elem("bucket", _config.Bucket)
             .Elem("privatekey", _config.PrivateKey)
             .Elem("publickey", _config.PublicKey);
     _storage = DreamTestHelper.CreateService(_hostInfo, "sid://mindtouch.com/2010/10/dream/s3.storage", "store", config);
 }
예제 #14
0
		public static void GlobalSetup(TestContext testContext)
		{
			var config = new XDoc("config");

            var instances = new XDoc("instances")
                .Start("instance").Attr("webhost", "test.foiremuses.org").Attr("databaseName", "foiremusesxml")
                .Start("components")
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IScoreDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatScoreDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "ScoreDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IPlayDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatPlayDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "PlayDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.ISourceDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatSourceDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "SourceDataMapper").End()
                .Start("component").Attr("type", "FoireMuses.Core.Interfaces.IUserDataMapper, FoireMuses.Core")
                .Attr("implementation", "FoireMuses.Core.Loveseat.LoveseatUserDataMapper, FoireMuses.Core.Loveseat")
                .Attr("name", "UserDataMapper").End()
                .End().End();

			var builder = new ContainerBuilder();
			mscore = new MockScoreController();
            msource = new MockSourceController();
            mplay = new MockPlayController();
            muser = new MockUserController();
			builder.Register(c => mscore).As<IScoreController>().ServiceScoped();
            builder.Register(c => mplay).As<IPlayController>().ServiceScoped();
            builder.Register(c => msource).As<ISourceController>().ServiceScoped();
            builder.Register(c => muser).As<IUserController>().ServiceScoped();
			_hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build());
			_hostInfo.Host.Self.At("load").With("name", "foiremuses.webservice").Post(DreamMessage.Ok());
			_service = DreamTestHelper.CreateService(
				_hostInfo,
				"http://foiremuses.org/service",
				"foiremuses",
				instances
			);
			_plug = _service.WithInternalKey().AtLocalHost;
		}
예제 #15
0
 public void FixtureSetup()
 {
     _hostInfo    = DreamTestHelper.CreateRandomPortHost();
     _serviceInfo = DreamTestHelper.CreateService(_hostInfo, typeof(TestExceptionalService), "test");
 }
예제 #16
0
        public static void GlobalSetup(TestContext testContext)
        {
            var config = new XDoc("config");

        	var instances = new XDoc("instances")
        		.Start("instance").Attr("webhost", "test.foiremuses.org").Attr("databaseName", "foiremusesxml").End();

            var builder = new ContainerBuilder();
            theMockUserController = new MockUserController();
            builder.Register(c => theMockUserController).As<IUserController>().ServiceScoped();
            _hostInfo = DreamTestHelper.CreateRandomPortHost(config, builder.Build());
            _hostInfo.Host.Self.At("load").With("name", "foiremuses.webservice").Post(DreamMessage.Ok());
            _service = DreamTestHelper.CreateService(
                _hostInfo,
                "http://foiremuses.org/service",
                "foiremuses",
                instances
            );
            _plug = _service.WithInternalKey().AtLocalHost;
        }