/// <summary> /// Initializes a new instance of the <see cref="AuthenticationAndUploadViewModel<T>"/> class. /// THe authentication view model is used for the AuthenticationAndUpload Form. /// </summary> /// <param name="webService">The webservice accessor object that is used to access the webservice</param> /// <param name="uploadHandler">The upload handler, the method to be executed when authentication is completed</param> /// <param name="uploadingMessage">The uploading message - the info message that is shown during the uploading process</param> /// <param name="uploadCompletedMessage">The upload completed message - the info message that is shown when upload is completed successfully</param> public AuthenticationAndUploadViewModel(WebserviceAccessor webService, UploadHandler <T> uploadHandler, string uploadingMessage, string uploadCompletedMessage) { if (uploadHandler == null) { throw new ArgumentNullException("uploadHandler"); } m_currentState = AuthenticationState.Authentication; Authenticate = new DelegateCommand(ExecuteAuthenticate, CanExecuteAuthenticate); m_webService = webService; if (m_webService != null) { //extract joomla root address from webserviceAddress, assuming it is TraceLab jooomla component if (m_webService.WebserviceUrl.AbsoluteUri.Contains("administrator")) { /// Gets the webservice joomla base address. Needed for hyperlinks to create user accounts, forgot password, and username string webserviceJoomlaBaseAddress = m_webService.WebserviceUrl.AbsoluteUri.Substring(0, m_webService.WebserviceUrl.AbsoluteUri.IndexOf("administrator")); CreateAccountUrl = new Uri(webserviceJoomlaBaseAddress + JoomlaLinks.CreateAccountUrl); RemindUserUrl = new Uri(webserviceJoomlaBaseAddress + JoomlaLinks.RemindUserUrl); ResetPasswordUrl = new Uri(webserviceJoomlaBaseAddress + JoomlaLinks.ResetPasswordUrl); } else { NLog.LogManager.GetCurrentClassLogger().Warn("The webaddress is not a standard joomla com_jtracelab webservice address, thus the links to website for creating account, retrieving password won't work."); } } m_uploadHandler = uploadHandler; m_uploadingMessage = uploadingMessage; m_uploadCompletedMessage = uploadCompletedMessage; }
public void StartWizard(Experiment experimentToBeBenchmarked) { if (experimentToBeBenchmarked == null) { throw new InvalidOperationException("Benchmark cannot be run with null experiment."); } //if webservice is set access webservice, and load benchmarks from there... on OnRetrieveListOfBenchmarksCallCompleted will load load also local benchmarks //and discover those that are online contests if (m_settings.WebserviceAddress != null) { m_webService = new WebserviceAccessor(m_settings.WebserviceAddress, true); if (m_webService != null) { var listOfContestsCallback = new Callback <ListOfContestsResponse>(); listOfContestsCallback.CallCompleted += OnRetrieveListOfBenchmarksCallCompleted; m_webService.RetrieveListOfContests(listOfContestsCallback); } else { //load only local benchmarks Benchmarks = BenchmarkLoader.LoadBenchmarksInfo(BenchmarksDirectory); } } else { //load only local benchmarks Benchmarks = BenchmarkLoader.LoadBenchmarksInfo(BenchmarksDirectory); } ExperimentToBeBenchmarked = experimentToBeBenchmarked; }
public void StartWizard(Experiment experimentToBeBenchmarked) { if (experimentToBeBenchmarked == null) throw new InvalidOperationException("Benchmark cannot be run with null experiment."); //if webservice is set access webservice, and load benchmarks from there... on OnRetrieveListOfBenchmarksCallCompleted will load load also local benchmarks //and discover those that are online contests if (m_settings.WebserviceAddress != null) { m_webService = new WebserviceAccessor(m_settings.WebserviceAddress, true); if (m_webService != null) { var listOfContestsCallback = new Callback<ListOfContestsResponse>(); listOfContestsCallback.CallCompleted += OnRetrieveListOfBenchmarksCallCompleted; m_webService.RetrieveListOfContests(listOfContestsCallback); } else { //load only local benchmarks Benchmarks = BenchmarkLoader.LoadBenchmarksInfo(BenchmarksDirectory); } } else { //load only local benchmarks Benchmarks = BenchmarkLoader.LoadBenchmarksInfo(BenchmarksDirectory); } ExperimentToBeBenchmarked = experimentToBeBenchmarked; }
public void TestSetup() { WebService = new WebserviceAccessor("test://webservice.php", true); ValidCredentials = new Credentials() { Username = "******", Password = "******" }; }
public void AddressNotFoundTest() { WebService = new WebserviceAccessor("https://localhost/notexisitingfakeadress", true); AuthenticationResponse authenticationResponse = AuthenticateSync(ValidCredentials); Assert.AreEqual(ResponseStatus.STATUS_FAILURE, authenticationResponse.Status); Assert.IsNull(authenticationResponse.Ticket); Assert.IsNotNull(authenticationResponse.ErrorMessage); System.Diagnostics.Debug.WriteLine(authenticationResponse.ErrorMessage); //404 error }
public void TestSetup() { //WebService = new WebserviceAccessor("https://localhost/administrator/components/com_jtracelab/webservice/webservice.php", true); //WebService = new WebserviceAccessor("http://coest.org/testcontests/administrator/components/com_jtracelab/webservice/webservice.php", true); WebService = new WebserviceAccessor("http://coest.org/testjoomla/administrator/components/com_jtracelab/webservice/WebService.php", true); ValidCredentials = new Credentials() { Username = "******", Password = "******" }; }
/// <summary> /// Initializes a new instance of the <see cref="DefiningBenchmark"/> class. /// </summary> /// <param name="baseExperiment">The base experiment represents experiment based on which the benchmark is being defined.</param> public DefiningBenchmark(Experiment baseExperiment, ComponentsLibrary library, Workspace workspace, PackageSystem.PackageManager manager, IEnumerable <string> workspaceTypeDirectories, string webserviceAddress) { if (baseExperiment == null) { throw new ArgumentNullException("baseExperiment"); } if (library == null) { throw new ArgumentNullException("library"); } if (workspace == null) { throw new ArgumentNullException("workspace"); } if (workspaceTypeDirectories == null) { throw new ArgumentNullException("workspaceTypeDirectories"); } // these are needed to create experiment serializing in Define method m_packageManager = manager; m_library = library; WebserviceAddress = webserviceAddress; if (webserviceAddress != null) { m_webService = new WebserviceAccessor(webserviceAddress, true); } m_baseExperiment = baseExperiment; m_workspace = workspace; //wrap the workspace into experiment workspace wrapper, so that we can load units only from experiment namespace m_experimentWorkspaceWrapper = new ExperimentWorkspaceWrapper(workspace, m_baseExperiment.ExperimentInfo.Id); //prefil benchmark info PrefillBenchmarkInfo(); //get nodes that can be selected as template GetTemplatizableComponents(); //get the ExperimentResults variables that can be selected as publishable results //from the ExperimentResults all metric names, their descriptions and dataset names are going to be extracted //when contest is going to be published GetPublishableExperimentResults(); }
/// <summary> /// Initializes a new instance of the <see cref="DefiningBenchmark"/> class. /// </summary> /// <param name="baseExperiment">The base experiment represents experiment based on which the benchmark is being defined.</param> public DefiningBenchmark(Experiment baseExperiment, ComponentsLibrary library, Workspace workspace, PackageSystem.PackageManager manager, IEnumerable<string> workspaceTypeDirectories, string webserviceAddress) { if (baseExperiment == null) throw new ArgumentNullException("baseExperiment"); if (library == null) throw new ArgumentNullException("library"); if (workspace == null) throw new ArgumentNullException("workspace"); if (workspaceTypeDirectories == null) throw new ArgumentNullException("workspaceTypeDirectories"); // these are needed to create experiment serializing in Define method m_packageManager = manager; m_library = library; WebserviceAddress = webserviceAddress; if (webserviceAddress != null) { m_webService = new WebserviceAccessor(webserviceAddress, true); } m_baseExperiment = baseExperiment; m_workspace = workspace; //wrap the workspace into experiment workspace wrapper, so that we can load units only from experiment namespace m_experimentWorkspaceWrapper = new ExperimentWorkspaceWrapper(workspace, m_baseExperiment.ExperimentInfo.Id); //prefil benchmark info PrefillBenchmarkInfo(); //get nodes that can be selected as template GetTemplatizableComponents(); //get the ExperimentResults variables that can be selected as publishable results //from the ExperimentResults all metric names, their descriptions and dataset names are going to be extracted //when contest is going to be published GetPublishableExperimentResults(); }
public void NullWebserviceAddressTest2() { WebService = new WebserviceAccessor(null, true); }
public void InvalidAddressTest2() { WebService = new WebserviceAccessor("invalid url address", true); }