Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            server = new Bizarrefish.WebLib.HTTPServer<VisorSessionData>(8080,"../../WebStatic");

            ajaxHandler = new AjaxHandler<VisorSessionData>(server);

            tvs = new TestVisorService(Directory.GetCurrentDirectory());

            Streams<VisorSessionData> streams = new Streams<VisorSessionData>(server, tvs);

            Results.tvs = tvs;
            Results.streams = streams;
            Plans.tvs = tvs;
            Machines.tvs = tvs;
            Status.tvs = tvs;
            Tests.tvs = tvs;
            Tests.streams = streams;

            ajaxHandler.AddClass<Results>();
            ajaxHandler.AddClass<Plans>();
            ajaxHandler.AddClass<Machines>();
            ajaxHandler.AddClass<Status>();
            ajaxHandler.AddClass<Tests>();

            File.Delete("../../ajax.js");
            File.WriteAllText("../../WebStatic/ajax.js", ajaxHandler.GetJavascript());

            server.Start();
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            server = new Bizarrefish.WebLib.HTTPServer <VisorSessionData>(8080, "../../WebStatic");

            ajaxHandler = new AjaxHandler <VisorSessionData>(server);

            tvs = new TestVisorService(Directory.GetCurrentDirectory());

            Streams <VisorSessionData> streams = new Streams <VisorSessionData>(server, tvs);


            Results.tvs     = tvs;
            Results.streams = streams;
            Plans.tvs       = tvs;
            Machines.tvs    = tvs;
            Status.tvs      = tvs;
            Tests.tvs       = tvs;
            Tests.streams   = streams;

            ajaxHandler.AddClass <Results>();
            ajaxHandler.AddClass <Plans>();
            ajaxHandler.AddClass <Machines>();
            ajaxHandler.AddClass <Status>();
            ajaxHandler.AddClass <Tests>();

            File.Delete("../../ajax.js");
            File.WriteAllText("../../WebStatic/ajax.js", ajaxHandler.GetJavascript());

            server.Start();
        }
Exemplo n.º 3
0
        public Streams(Bizarrefish.WebLib.HTTPServer <TSession> server, ITestVisorService tvs)
        {
            this.tvs    = tvs;
            this.server = server;

            // Artifacts
            server.AddStreamReadFunc(ARTIFACT_KEY, key => {
                string runId, testKey;
                int index;
                SplitArtifactKey(key, out runId, out testKey, out index);
                return(tvs.ReadArtifact(runId, testKey, index));
            });

            // Tests
            server.AddStreamWriteFunc(TESTS_KEY, (key, stream) => {
                string testTypeId, testName;
                SplitTestUploadKey(key, out testTypeId, out testName);

                string tempFile = Path.GetTempFileName();
                try
                {
                    using (var fileStream = File.Open(tempFile, FileMode.OpenOrCreate))
                    {
                        WebUtils.ExtractMultipartFileData(TEST_FILE_FIELD_NAME, stream, fileStream);

                        fileStream.Seek(0, SeekOrigin.Begin);

                        tvs.CreateTest(fileStream, testName, testTypeId);
                    }
                }
                finally
                {
                    File.Delete(tempFile);
                }
            });
        }