Пример #1
0
        public static void InitWorkspace(List <string> typeDirectories, string workspaceDirectory, string cacheDirectory)
        {
            if (typeDirectories == null)
            {
                throw new ArgumentNullException("typeDirectories");
            }
            if (typeDirectories.Count == 0)
            {
                throw new ArgumentException("List of type directories cannot be empty", "typeDirectories");
            }
            if (cacheDirectory == null)
            {
                throw new ArgumentNullException("cacheDirectory");
            }
            if (cacheDirectory.Length == 0)
            {
                throw new ArgumentException("m_workspace cache directory must be a valid directory", "cacheDirectory");
            }

            if (s_workspaceInstance != null)
            {
                s_workspaceInstance.Dispose();
            }

            StreamManager manager = StreamManager.CreateNewManager();

            s_workspaceInstance = InitWorkspaceInternal(typeDirectories, workspaceDirectory, cacheDirectory, manager);
        }
Пример #2
0
        internal TraceLabTestApplication(TestContext context, bool loadComponents)
        {
            Context = context;
            NLog.LogManager.Configuration = new NLog.Config.LoggingConfiguration();
            DecisionsToClear = new List <string>();

            //string inputDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            //inputDir = System.IO.Path.Combine(inputDir, "..", "..", "..", "..", "Data", "GenericTestData");

            string testClass = context.FullyQualifiedTestClassName;
            int    index     = context.FullyQualifiedTestClassName.LastIndexOf('.');

            if (index != -1)
            {
                testClass = testClass.Substring(index + 1);
            }

            string outputDir = context.TestDeploymentDir;//Path.Combine(context.TestDeploymentDir, testClass, context.TestName);

            Directory.CreateDirectory(outputDir);

            DeployedDirectory = outputDir;
            BaseTestDirectory = DeployedDirectory;

            var types = System.IO.Path.Combine(BaseTestDirectory, "Types");

            System.IO.Directory.CreateDirectory(types);
            List <string> typesDir = new List <string>();

            typesDir.Add(types);

            string workspaceDirectory = System.IO.Path.Combine(BaseTestDirectory, "workspace");
            string cacheDirectory     = System.IO.Path.Combine(BaseTestDirectory, "cache");

            CacheDirectory = cacheDirectory;

            PackageManager = new Core.PackageSystem.PackageManager();

            Settings          = TraceLab.Core.Settings.Settings.GetSettings();
            StreamManager     = StreamManager.CreateNewManager();
            WorkspaceInstance = (Workspace)typeof(WorkspaceManager).GetMethod("InitWorkspaceInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { typesDir, workspaceDirectory, cacheDirectory, StreamManager });
            Components        = (ComponentsLibrary)typeof(ComponentsLibrary).GetMethod("InitInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { Settings.ComponentPaths });;

            //set the components directories
            string path = System.IO.Path.Combine(BaseTestDirectory, "TestComponents");

            Directory.CreateDirectory(path);
            Settings.ComponentPaths.Add(new Core.Settings.SettingsPath(true, path));

            TraceLab.Core.Decisions.DecisionCompilationRunner.DecisionDirectoryPath = path;
            Components.DataRoot = BaseTestDirectory;

            if (loadComponents)
            {
                path = Path.GetDirectoryName(OutputAssembly);
                Directory.CreateDirectory(path);
                Settings.ComponentPaths.Add(new Core.Settings.SettingsPath(true, path));
                LoadComponents();
            }
        }
Пример #3
0
        public static CachingSerializer Create(
            string path_s,
            string cachePath_s1,
            Type[] supportedTypes_types
            )
        {
            CachingSerializer cachingSerializer = new CachingSerializer
                                                      (StreamManager.CreateNewManager(), path_s, cachePath_s1, supportedTypes_types);

            return(cachingSerializer);

            // TODO: Edit factory method of CachingSerializer
            // This method should be able to configure the object in all possible ways.
            // Add as many parameters as needed,
            // and assign their values to each field by using the API.
        }
Пример #4
0
 public static object Create()
 {
     return(StreamManager.CreateNewManager());
 }