internal TeamCityExtension(string flowId)
        {
            this.flowId = flowId ?? Hash64.CreateUniqueHash().ToString();

            currentStepStack = new Stack <string>();
            continuationMap  = new MultiMap <string, Continuation>();
        }
            public TestIsolationServer GetTestIsolationServer(DebuggerSetup debuggerSetup)
            {
                if (server != null)
                {
                    return(server);
                }

                try
                {
                    statusReporter("Attaching to AutoCAD.");

                    string ipcPortName = "AcadTestIsolationContext." + Hash64.CreateUniqueHash();
                    Guid   uniqueId    = Guid.NewGuid();
                    server = new TestIsolationServer(ipcPortName, uniqueId);
                    process.Start(ipcPortName, uniqueId, debuggerSetup);
                    return(server);
                }
                catch
                {
                    if (process != null)
                    {
                        process.Dispose();
                    }
                    if (server != null)
                    {
                        server.Dispose();
                    }
                    throw;
                }
            }
 public ReportFilePool(IDiskCacheGroup cacheGroup, int numberOfFiles)
 {
     for (var i = 0; i < numberOfFiles; i++)
     {
         var uniqueFilename = string.Format("{0}.{1}.html", ReportName, Hash64.CreateUniqueHash());
         files.Add(cacheGroup.GetFileInfo(uniqueFilename));
     }
 }
        /// <summary>
        /// Creates an uninitialized host.
        /// </summary>
        /// <param name="hostSetup">The host setup.</param>
        /// <param name="logger">The logger for host message output.</param>
        /// <param name="runtimePath">The runtime path where the hosting executable will be found.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="hostSetup"/>
        /// <paramref name="logger"/>, or <paramref name="runtimePath"/> is null.</exception>
        public IsolatedProcessHost(HostSetup hostSetup, ILogger logger, string runtimePath)
            : base(hostSetup, logger, PingInterval)
        {
            if (runtimePath == null)
            {
                throw new ArgumentNullException("runtimePath");
            }

            this.runtimePath = runtimePath;
            uniqueId         = Hash64.CreateUniqueHash().ToString();

            logConsoleOutputBufferTimer = new Timer(LogConsoleOutputBufferTimeoutExpired);
        }
Exemple #5
0
        /// <summary>
        /// Creates an attachment.
        /// </summary>
        /// <param name="name">The name of attachment, or null to automatically assign one.  The attachment
        /// name must be unique within the scope of the currently executing test step.</param>
        /// <param name="contentType">The content type, not null.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="contentType"/> is null.</exception>
        internal /*to prevent subclassing outside of the framework*/ Attachment(string name, string contentType)
        {
            if (name != null && name.Length > 100)
            {
                throw new ArgumentException("name must be 100 chars or less", "name");
            }

            if (contentType == null)
            {
                throw new ArgumentNullException("contentType");
            }

            this.name        = name ?? Hash64.CreateUniqueHash().ToString();
            this.contentType = contentType;
        }
            public void VisitEmbedTag(EmbedTag tag)
            {
                AttachmentData attachment = testStepRun.TestLog.GetAttachment(tag.AttachmentName);

                if (attachment == null)
                {
                    return;
                }

                string src = formatter.GetAttachmentFileInfo(testStepRun.Step.Id, attachment).FullName;

                writer.Write("<div class=\"logStreamEmbed\">");
                if (attachment.ContentType.StartsWith("image/"))
                {
                    writer.Write("<a href=\"");
                    writer.Write(src);
                    writer.Write("\" class=\"attachmentLink\">");
                    writer.Write("<img class=\"embeddedImage\" src=\"");
                    WriteHtmlEncoded(writer, src);
                    writer.Write("\" alt=\"Attachment: ");
                    WriteHtmlEncoded(writer, attachment.Name);
                    writer.Write("\" /></a>");
                }
                else if ((attachment.ContentType.StartsWith("text/html") || attachment.ContentType.StartsWith("text/xhtml")) &&
                         attachment.IsText)
                {
                    writer.Write(attachment.GetText());
                }
                else if (attachment.ContentType.StartsWith("text/") &&
                         attachment.IsText)
                {
                    writer.Write("<pre>");
                    WriteHtmlEncodedWithBreaks(writer, attachment.GetText());
                    writer.Write("</pre>");
                }
                else if (flashEnabled && attachment.ContentType.StartsWith(MimeTypes.FlashVideo))
                {
                    string placeholderId = "video-" + Hash64.CreateUniqueHash();
                    writer.Write("<div id=\"");
                    writer.Write(placeholderId);
                    writer.Write("\">");

                    writer.Write("<script type=\"text/javascript\">");
                    writer.Write("swfobject.embedSWF('");
                    WriteHtmlEncoded(writer, new Uri(Path.Combine(formatter.jsDir, "player.swf")).ToString());
                    writer.Write("', '");
                    writer.Write(placeholderId);
                    writer.Write("', '400', '300', '9.0.98', '");
                    WriteHtmlEncoded(writer, new Uri(Path.Combine(formatter.jsDir, "expressInstall.swf")).ToString());
                    writer.Write("', {file: '");
                    WriteHtmlEncoded(writer, new Uri(src).ToString());
                    writer.Write("'}, {allowfullscreen: 'true', allowscriptaccess: 'always'}, {id: '");
                    writer.Write(placeholderId);
                    writer.Write("'})");
                    writer.Write("</script>");

                    writer.Write("</div>");
                }
                else
                {
                    writer.Write("Attachment: <a href=\"");
                    WriteHtmlEncoded(writer, src);
                    writer.Write("\" class=\"attachmentLink\">");
                    WriteHtmlEncoded(writer, attachment.Name);
                    writer.Write("</a>");
                }
                writer.Write("</div>");
            }
Exemple #7
0
        private string GetTemporaryConfigurationFilePath()
        {
            switch (ConfigurationFileLocation)
            {
            case ConfigurationFileLocation.None:
                return(null);

            case ConfigurationFileLocation.Temp:
                return(SpecialPathPolicy.For("Hosting").CreateTempFileWithUniqueName().FullName);

            case ConfigurationFileLocation.AppBase:
                if (applicationBaseDirectory == null)
                {
                    throw new InvalidOperationException("The configuration file was to be written to the application base directory but none was specified in the host setup.");
                }

                for (; ;)
                {
                    string path = Path.Combine(GetCanonicalApplicationBaseDirectory(null), Hash64.CreateUniqueHash() + ".tmp.config");
                    if (!File.Exists(path))
                    {
                        return(path);
                    }
                }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }