示例#1
0
        public AstoriaServiceHost(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
            : base(workspace, webDataServicePrefixName, machineName, database)
        {

            if (AstoriaTestProperties.Host == Host.IDSH || AstoriaTestProperties.Host == Host.IDSH2)
            {
                if (AstoriaTestProperties.HostAuthenicationMethod != "None")
                    AstoriaTestLog.FailAndThrow("Test implementations of IDSH do not support authentication");
            }

            waitHandleName = waitHandlePrefix + identifier;
            serviceInstanceName = this.WebDataServicePrefixName + "_" + identifier;
            exeName = serviceName + this.WebDataServicePrefixName;

            if (ProcessHelper.IsLocalMachine(this.MachineName))
            {
                DestinationFolder = Path.Combine(serviceHostFolder, serviceInstanceName);
                DestinationFolder_Local = DestinationFolder;
                ExecutablePath = Path.Combine(DestinationFolder, exeName + ".exe");
                localExecutablePath = ExecutablePath;
            }
            else
            {
                string remoteMachineLocalPath = IISHelper.GetLocalMachineWWWRootSharePath(this.MachineName);
                DestinationFolder_Local = Path.Combine(IISHelper.GetLocalMachineWWWRootSharePath(this.MachineName), serviceInstanceName);
                DestinationFolder = Path.Combine(IISHelper.GetWWWRootSharePath(this.MachineName), serviceInstanceName);
                ExecutablePath = Path.Combine(DestinationFolder, exeName + ".exe");
                localExecutablePath = Path.Combine(DestinationFolder_Local, exeName + ".exe");
            }

            rootUri = Uri.UriSchemeHttp + "://" + this.MachineName + ":7777";

        }
示例#2
0
        public AstoriaWebDataService(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
        {
            Workspace = workspace;
            if (String.IsNullOrEmpty(webDataServicePrefixName))
            {
                throw new ArgumentException("String.IsNullOrEmpty(WebDataServicePrefixName)", webDataServicePrefixName);
            }

            WebDataServicePrefixName = webDataServicePrefixName;
            WebDataServiceName       = String.Format("{0}_{1}_{2}", WebDataServicePrefixName, System.Net.Dns.GetHostName(), Guid.NewGuid().ToString("N"));
            MachineName = machineName;
            Database    = database;
        }
示例#3
0
 /// <summary>Initializes a new <see cref="AstoriaWebDataService"/> instance.</summary>
 /// <param name="WebDataServicePrefixName"></param>
 /// <param name="Database"></param>
 public IISWebDataService(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
     : base(workspace, webDataServicePrefixName, machineName, database)
 {
 }
示例#4
0
        public static AstoriaWebDataService CreateAstoriaDataWebService(Workspace workspace, string webDataServicePrefixName, AstoriaDatabase database, bool skipDataServiceVerify)
        {
            AstoriaWebDataService service = null;

            //Base the creation on the AstoriaTestProperties
            switch (AstoriaTestProperties.Host)
            {
            case Host.WebServiceHost:
            case Host.IDSH:
            case Host.IDSH2:
                service = new AstoriaServiceHost(workspace, webDataServicePrefixName, Environment.MachineName, database);
                break;

            case Host.WebServiceHostRemote:
                service = new AstoriaServiceHost(workspace, webDataServicePrefixName, GetMachineName(), database);
                break;

            default:
                service = new IISWebDataService(workspace, webDataServicePrefixName, GetMachineName(), database);
                break;
            }

            // write out helpful debugging URIs
            if (AstoriaTestProperties.Client == ClientEnum.SILVERLIGHT)
            {
                WriteUriToList(service.ServiceRootUri + "Monitor.aspx");
                WriteUriToList(service.ServiceRootUri + "SilverlightAstoriaTestPage.html");
                WriteUriToList(service.ServiceUri);
            }

            // if running locally in partial trust, ensure that the trusted methods are available
            if (AstoriaTestProperties.IsLocalHost &&
                AstoriaTestProperties.ServiceTrustLevel != TrustLevel.Full &&
                AstoriaTestProperties.RuntimeEnvironment == TestRuntimeEnvironment.Lab)
            {
                Assembly trustedAssembly = typeof(FullTrust.TrustedMethods).Assembly;
                //if (!trustedAssembly.GlobalAssemblyCache)
                //{
                //    AstoriaTestLog.FailAndThrow("Assembly containing fully trusted components must be in the GAC. " +
                //        "Run 'gacutil -if <dll>' on AstoriaTestFramework.FullTrust from a visual studio command prompt");
                //}

                if (!trustedAssembly.IsFullyTrusted)
                {
                    AstoriaTestLog.FailAndThrow("Assembly containing components requiring full trust is not trusted");
                }
            }

            try
            {
                // push the verification step down to the derived classes so that a failure there can be handled accordingly
                //
                service.CreateWebService(!skipDataServiceVerify);
            }
            catch (Exception e)
            {
                // we need to make sure that we don't 'leak' services that fail to start, as it can mean a process is left running that will
                // cause subsequent ArtClean's to fail. This has caused build failures at least once.
                //
                if (AstoriaTestProperties.IsLabRun || AstoriaTestProperties.RuntimeEnvironment == TestRuntimeEnvironment.CheckinSuites)
                {
                    service.Dispose();
                }
                throw new TestFailedException("Failed to create web service", null, null, e);
            }

            if (skipDataServiceVerify)
            {
                // for call logging, we need the directory to exist, and the service doesn't necessarily have permission to create it
                // TODO: find some better, common place to put this for IIS, WebServiceHost, etc. Right now this is the best spot
#if !ClientSKUFramework
                IOUtil.EnsureEmptyDirectoryExists(Path.Combine(service.DestinationFolder, CallOrder.APICallLog.DirectoryName));
#endif

                Thread.Sleep(5000);     //To allow time for the service to start running before requests get made
            }

            return(service);
        }
示例#5
0
 public AstoriaWebDataService(Workspace workspace, string webDataServicePrefixName, AstoriaDatabase database)
     : this(workspace, webDataServicePrefixName, "localhost", database)
 {
 }
        private AstoriaCustomServiceHost(Workspace workspace, string webDataServicePrefixName, AstoriaDatabase database)
            : base(workspace, webDataServicePrefixName, database)
        {

        }
        /// <summary>Initializes a new <see cref="AstoriaWebDataService"/> instance.</summary>
        /// <param name="WebDataServicePrefixName"></param>
        /// <param name="Database"></param>
        public IISWebDataService(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
            : base(workspace, webDataServicePrefixName, machineName, database)
        {

        }
        public static AstoriaWebDataService CreateAstoriaDataWebService(Workspace workspace, string webDataServicePrefixName, AstoriaDatabase database, bool skipDataServiceVerify)
        {
            AstoriaWebDataService service = null;
            //Base the creation on the AstoriaTestProperties
            switch (AstoriaTestProperties.Host)
            {
                case Host.WebServiceHost:
                case Host.IDSH:
                case Host.IDSH2:
                    service = new AstoriaServiceHost(workspace, webDataServicePrefixName, Environment.MachineName, database);
                    break;

                case Host.WebServiceHostRemote:
                    service = new AstoriaServiceHost(workspace, webDataServicePrefixName, GetMachineName(), database);
                    break;

                default:
                    service = new IISWebDataService(workspace, webDataServicePrefixName, GetMachineName(), database);
                    break;
            }

            // write out helpful debugging URIs
            if (AstoriaTestProperties.Client == ClientEnum.SILVERLIGHT)
            {
                WriteUriToList(service.ServiceRootUri + "Monitor.aspx");
                WriteUriToList(service.ServiceRootUri + "SilverlightAstoriaTestPage.html");
                WriteUriToList(service.ServiceUri);
            }

            // if running locally in partial trust, ensure that the trusted methods are available
            if (AstoriaTestProperties.IsLocalHost
                && AstoriaTestProperties.ServiceTrustLevel != TrustLevel.Full
                && AstoriaTestProperties.RuntimeEnvironment == TestRuntimeEnvironment.Lab)
            {
                Assembly trustedAssembly = typeof(FullTrust.TrustedMethods).Assembly;
                //if (!trustedAssembly.GlobalAssemblyCache)
                //{
                //    AstoriaTestLog.FailAndThrow("Assembly containing fully trusted components must be in the GAC. " + 
                //        "Run 'gacutil -if <dll>' on AstoriaTestFramework.FullTrust from a visual studio command prompt");
                //}

                if (!trustedAssembly.IsFullyTrusted)
                {
                    AstoriaTestLog.FailAndThrow("Assembly containing components requiring full trust is not trusted");
                }
            }

            try
            {
                // push the verification step down to the derived classes so that a failure there can be handled accordingly
                //
                service.CreateWebService(!skipDataServiceVerify);
            }
            catch (Exception e)
            {
                // we need to make sure that we don't 'leak' services that fail to start, as it can mean a process is left running that will
                // cause subsequent ArtClean's to fail. This has caused build failures at least once.
                //
                if (AstoriaTestProperties.IsLabRun || AstoriaTestProperties.RuntimeEnvironment == TestRuntimeEnvironment.CheckinSuites)
                {
                    service.Dispose();
                }
                throw new TestFailedException("Failed to create web service", null, null, e);
            }

            if (skipDataServiceVerify)
            {
                // for call logging, we need the directory to exist, and the service doesn't necessarily have permission to create it
                // TODO: find some better, common place to put this for IIS, WebServiceHost, etc. Right now this is the best spot
#if !ClientSKUFramework
                IOUtil.EnsureEmptyDirectoryExists(Path.Combine(service.DestinationFolder, CallOrder.APICallLog.DirectoryName));
#endif

                Thread.Sleep(5000);     //To allow time for the service to start running before requests get made
            }

            return service;
        }
 public AstoriaWebDataService(Workspace workspace, string webDataServicePrefixName, AstoriaDatabase database)
     : this(workspace, webDataServicePrefixName, "localhost", database)
 {
 }
        public AstoriaWebDataService(Workspace workspace, string webDataServicePrefixName, string machineName, AstoriaDatabase database)
        {
            Workspace = workspace;
            if (String.IsNullOrEmpty(webDataServicePrefixName))
                throw new ArgumentException("String.IsNullOrEmpty(WebDataServicePrefixName)", webDataServicePrefixName);

            WebDataServicePrefixName = webDataServicePrefixName;
            WebDataServiceName = String.Format("{0}_{1}_{2}", WebDataServicePrefixName, System.Net.Dns.GetHostName(), Guid.NewGuid().ToString("N"));
            MachineName = machineName;
            Database = database;
        }