示例#1
0
        public void SetUp()
        {
            diagnostics = new BottlingDiagnostics(new LoggingSession());
            _bottle     = new StubBottle("a");
            assembly    = Assembly.GetExecutingAssembly();

            theProvenance = "from here";
            diagnostics.LogAssembly(_bottle, assembly, theProvenance);
        }
示例#2
0
        public void SetUp()
        {
            diagnostics = new BottlingDiagnostics(new LoggingSession());

            loader  = new StubPackageLoader("a", "b");
            _bottle = new StubBottle("a");

            diagnostics.LogPackage(_bottle, loader);
        }
示例#3
0
        public void SetUp()
        {
            diagnostics = new BottlingDiagnostics(new LoggingSession());

            activator1 = new StubActivator();
            activator2 = new StubActivator();
            activator3 = new StubActivator();

            bootstrapper = new StubBootstrapper("Boot1", activator1, activator2, activator3);

            diagnostics.LogBootstrapperRun(bootstrapper, bootstrapper.Bootstrap(null));
        }
示例#4
0
        /// <summary>
        /// The entry method into the bottles environment
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="runActivators"></param>
        public static void LoadPackages(Action <IPackageFacility> configuration, bool runActivators = true)
        //consider renaming to InitializeEnvironment
        //have it return an environment object.
        {
            _packages.Clear();
            _remotes.Clear();

            Diagnostics = new BottlingDiagnostics(new LoggingSession());
            var record = new BottleLoadingRecord();

            Diagnostics.LogExecution(record, () => {
                var remotes = RemoteService.LoadLinkedRemotes();
                _remotes.AddRange(remotes);
                var remoteTasks = remotes.Select(x => x.Start()).ToArray();

                var facility       = new PackageFacility();
                var assemblyLoader = new AssemblyLoader(Diagnostics);
                var graph          = new PackagingRuntimeGraph(Diagnostics, assemblyLoader, _packages);

                var codeLocation = ProvenanceHelper.GetProvenanceFromStack();
                graph.InProvenance(codeLocation, g =>
                {
                    //collect user configuration
                    configuration(facility);

                    //applies collected configurations
                    facility.Configure(g);
                });


                graph.DiscoverAndLoadPackages(() =>
                {
                    //clearing assemblies why? - my guess is testing.
                    // this should only really be called once.
                    _assemblies.Clear();

                    _assemblies.AddRange(assemblyLoader.Assemblies);
                    //the above assemblies are used when we need to resolve bottle assemblies
                }, runActivators);

                Task.WaitAll(remoteTasks);
            });

            record.Finished = DateTime.Now;
        }
        public PackageDiagnosticsModel get_package_logs(PackageDiagnosticsRequestModel request)
        {
            // Might want to do some querying via json so let's flatten the logs - maybe map them?
            var logs = new List <PackageDiagnosticsLogModel>();

            // Nothing really gained here by mocking this so let's hit it directly
            PackageRegistry
            .Diagnostics
            .EachLog((target, log) => logs.Add(new PackageDiagnosticsLogModel {
                Type          = BottlingDiagnostics.GetTypeName(target),
                Description   = target.ToString(),
                Provenance    = log.Provenance,
                FullTraceText = log.FullTraceText(),
                Success       = log.Success
            }));

            return(new PackageDiagnosticsModel {
                Logs = logs
            });
        }
示例#6
0
 public void SetUp()
 {
     diagnostics = new BottlingDiagnostics(new LoggingSession());
 }