/// <summary>
        /// Loads the decision module based on the decision metadata
        /// </summary>
        /// <param name="decisionMetadata">The decision metadata.</param>
        /// <param name="workspaceWrapper">The workspace wrapper.</param>
        /// <param name="componentsAppDomain">The components app domain is the app domain which decision assembly is going to be loaded into.</param>
        /// <returns>Loaded decision</returns>
        internal static IDecisionModule LoadDecisionModule(DecisionMetadata decisionMetadata, IWorkspaceInternal workspaceWrapper,
                                                                                AppDomain componentsAppDomain)
        {
            DecisionLoader loader = ConstructDecisionModuleInComponentsAppDomain(decisionMetadata, workspaceWrapper, componentsAppDomain);

            return (IDecisionModule)loader.LoadedDecisionModule;
        }
Beispiel #2
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns></returns>
        public override Metadata Clone()
        {
            var clone = new DecisionMetadata();

            clone.CopyFrom(this);
            return(clone);
        }
Beispiel #3
0
        /// <summary>
        /// Performs a deep copy of the data in this object to another instance of the Metadata.
        /// </summary>
        /// <param name="other">The other.</param>
        protected override void CopyFrom(Metadata other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            base.CopyFrom(other);

            DecisionMetadata metadata = (DecisionMetadata)other;

            UniqueDecisionID  = metadata.UniqueDecisionID;
            CompilationStatus = metadata.CompilationStatus;
            IsCodeDirty       = metadata.IsCodeDirty;
            DecisionCode      = metadata.DecisionCode;
        }
        private void CompileDecision(string code)
        {
            DecisionMetadata decisionMetadata = new DecisionMetadata("Decision");
        
            Dictionary<string, string> mockSuccessorNodeLabelIdLookup = new Dictionary<string,string>();
            mockSuccessorNodeLabelIdLookup.Add("node 1 label", "Fake node 1 id");
            mockSuccessorNodeLabelIdLookup.Add("node 2 label", "Fake node 2 id");

            Dictionary<string, string> mockPredeccessorsOutputsNameTypeLookup = new Dictionary<string, string>();
            mockPredeccessorsOutputsNameTypeLookup.Add("test", "int");
            mockPredeccessorsOutputsNameTypeLookup.Add("targetArtifacts", "TraceLabSDK.Types.TLArtifactsCollection");
            mockPredeccessorsOutputsNameTypeLookup.Add("sourceArtifacts", "TraceLabSDK.Types.TLArtifactsCollection");

            decisionMetadata.DecisionCode = code;

            DecisionCompilationRunner_Accessor.BuildSourceAndCompileDecisionModule(decisionMetadata, mockSuccessorNodeLabelIdLookup, mockPredeccessorsOutputsNameTypeLookup, 
                                               AppContext.WorkspaceInstance.TypeDirectories, new LoggerNameRoot("Mock"));
        }
        private DecisionMetadata CompileMockDecision(string decisionCode)
        {
            DecisionMetadata decisionMetadata = new DecisionMetadata("Decision");
            decisionMetadata.DecisionCode = decisionCode;

            DecisionCompilationRunner_Accessor.BuildSourceAndCompileDecisionModule(decisionMetadata, null, null,
                 AppContext.WorkspaceInstance.TypeDirectories, new LoggerNameRoot("Mock"));

            AppContext.DecisionsToClear.Add(decisionMetadata.UniqueDecisionID);

            return decisionMetadata;
        }
 /// <summary>
 /// Clones this instance.
 /// </summary>
 /// <returns></returns>
 public override Metadata Clone()
 {
     var clone = new DecisionMetadata();
     clone.CopyFrom(this);
     return clone;
 }