Пример #1
0
        public void ValidateGeneratedDownloadDirectory()
        {
            VersionDescriptor versionDescriptor = new VersionDescriptor {
                Major = "ccl08b", Minor = "1", Comment = "bla"
            };

            string downloadUri = versionDescriptor.ResourceDirectory;

            Assert.That(downloadUri, Is.EqualTo("ccl08b_1"));
        }
Пример #2
0
        private async Task CreateOrUpdateNapackAsync(string packageName, NapackLocalDescriptor napackDescriptor, UserSecret userSecret, NapackServerClient client)
        {
            string rootDirectory = Path.GetFullPath(Path.GetDirectoryName(this.PackageFile));
            Dictionary <string, NapackFile> files = UploadOperation.ParseNapackFiles(rootDirectory, rootDirectory);

            files.Remove(Path.GetFileName(this.PackageFile));

            bool packageExists = await client.ContainsNapack(packageName).ConfigureAwait(false);

            if (!packageExists)
            {
                await this.CreateNapackPackageAsync(packageName, napackDescriptor, files, userSecret, client).ConfigureAwait(false);
            }
            else
            {
                // This is a new version creation operation.
                VersionDescriptor version = await client.UpdatePackageAsync(packageName, this.CreateNapackVersion(napackDescriptor, files), userSecret).ConfigureAwait(false);

                NapackClient.Log($"Updated the {packageName} package to version {version.Major}.{version.Minor}.{version.Patch}");
            }
        }
Пример #3
0
        public override string Serialize()
        {
            StemStr str = null;

            if (_ReuseQueue.Count > 0)
            {
                lock (_ReuseQueue)
                    if (_ReuseQueue.Count > 0)
                    {
                        str = _ReuseQueue.Dequeue();
                    }
            }

            if (str == null)
            {
                str = new StemStr("", 10000);
            }

            try
            {
                str.Reset("<InstructionSet xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>");

                str.Append(VersionDescriptor.Serialize());
                str.Append("\r\n   <ID>" + ID.ToString() + "</ID>");
                str.Append("\r\n   <BranchIP>" + System.Security.SecurityElement.Escape(BranchIP) + "</BranchIP>");
                str.Append("\r\n   <Assigned>" + XmlConvert.ToString(Assigned, XmlDateTimeSerializationMode.Utc) + "</Assigned>");
                str.Append("\r\n   <Received>" + XmlConvert.ToString(Received, XmlDateTimeSerializationMode.Utc) + "</Received>");
                str.Append("\r\n   <Started>" + XmlConvert.ToString(Started, XmlDateTimeSerializationMode.Utc) + "</Started>");
                str.Append("\r\n   <Completed>" + XmlConvert.ToString(Completed, XmlDateTimeSerializationMode.Utc) + "</Completed>");
                str.Append("\r\n   <DeploymentControllerID>" + DeploymentControllerID + "</DeploymentControllerID>");
                str.Append("\r\n   <DeploymentManagerIP>" + DeploymentManagerIP + "</DeploymentManagerIP>");
                str.Append("\r\n   <DeploymentController>" + DeploymentController + "</DeploymentController>");
                str.Append("\r\n   <InstructionSetTemplate>" + System.Security.SecurityElement.Escape(InstructionSetTemplate) + "</InstructionSetTemplate>");
                str.Append("\r\n   <InitiationSource>" + System.Security.SecurityElement.Escape(InitiationSource) + "</InitiationSource>");
                str.Append("\r\n   <ProcessName>" + System.Security.SecurityElement.Escape(ProcessName) + "</ProcessName>");
                str.Append("\r\n   <ContinuousExecution>" + XmlConvert.ToString(ContinuousExecution) + "</ContinuousExecution>");
                str.Append("\r\n   <ContinuousExecutionInterval>" + XmlConvert.ToString(ContinuousExecutionInterval) + "</ContinuousExecutionInterval>");
                str.Append("\r\n   <ExecuteStaticInSandboxes>" + XmlConvert.ToString(ExecuteStaticInSandboxes) + "</ExecuteStaticInSandboxes>");
                str.Append("\r\n   <CachePostMortem>" + XmlConvert.ToString(CachePostMortem) + "</CachePostMortem>");
                str.Append("\r\n   <DeploymentManagerRelease>" + System.Security.SecurityElement.Escape(DeploymentManagerRelease) + "</DeploymentManagerRelease>");

                if (PostMortemMetaData != null && PostMortemMetaData.Count > 0)
                {
                    XDocument d = XDocument.Load(new System.Xml.XmlTextReader(new System.IO.StringReader(STEM.Sys.Serializable.Serialize(PostMortemMetaData))));
                    d.Root.Name = "PostMortemMetaData";
                    str.Append("\r\n   " + d.ToString());
                }
                else
                {
                    str.Append("\r\n   <PostMortemMetaData />");
                }

                str.Append("\r\n   <InstructionsXml>" + SerializationSourceInstructionDocument + "</InstructionsXml>");

                str.Append("\r\n</InstructionSet>");

                return(str.ToString());
            }
            finally
            {
                if (_ReuseQueue.Count < 1000)
                {
                    lock (_ReuseQueue)
                        _ReuseQueue.Enqueue(str);
                }
            }
        }