public void SearchWpsServicesByQ() { var uid = Guid.NewGuid().ToString(); WpsProvider provider = CreateProvider(uid, "test provider", "http://gpod.eo.esa.int/wps?service=WPS&version=1.0.0&request=GetCapabilities", true); provider.UpdateProcessOfferings(true); EntityList <WpsProcessOffering> wpsProcessList = new EntityList <WpsProcessOffering>(context); wpsProcessList.Template.Provider = provider; wpsProcessList.Load(); var nbprocesses = wpsProcessList.Items.Count(); WpsProcessOffering service1 = wpsProcessList.Items.First(); service1.Identifier = "searchbyQidentifier"; service1.Name = "searchbyQname"; service1.Description = "searchbyQdescription"; service1.Store(); EntityList <WpsProcessOffering> services = new EntityList <WpsProcessOffering>(context); var parameters = new NameValueCollection(); parameters.Set("count", (nbprocesses + 1) + ""); IOpenSearchResultCollection osr = ose.Query(services, parameters); parameters.Set("q", "searchbyNoQidentifier"); osr = ose.Query(services, parameters); Assert.AreEqual(0, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("q", "searchbyQ"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("q", "searchbyQidentifier"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("q", "searchbyQname"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("q", "searchbyQdescription"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); provider.Delete(); }
public void GetProcessOfferingEntityList() { WpsProvider provider = CreateProvider("test-wps-1", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false); WpsProcessOffering process = CreateProcess(provider, "com.test.provider.1", "test provider 1", false); process.Store(); Assert.IsFalse(process.Available); WpsProvider provider2 = CreateProvider("test-wps-2", "test provider 2", "http://dem.terradue.int:8080/wps/WebProcessingService", false); WpsProcessOffering process2 = CreateProcess(provider2, "com.test.provider.2", "test provider 2", false); process2.Store(); Assert.IsFalse(process2.Available); EntityList <WpsProcessOffering> processes = provider.GetWpsProcessOfferings(false); Assert.That(processes.Count == 1); provider.Delete(); provider2.Delete(); }
private WpsProcessOffering CreateProcess(WpsProvider provider, string identifier, string name) { WpsProcessOffering process = new WpsProcessOffering(context); process.Name = name; process.Description = name; process.RemoteIdentifier = identifier; process.Identifier = Guid.NewGuid().ToString(); process.Url = provider.BaseUrl; process.Version = "1.0.0"; process.Provider = provider; try { process.Store(); } catch (Exception e) { throw e; } return(process); }
public void SearchWpsServicesByTags() { WpsProvider provider = CreateProvider("test-wps-search-1", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false); WpsProcessOffering process = CreateProcess(provider, "com.test.provider.1", "test provider 1", true); process.AddTag("mytag"); process.AddTag("mytag1"); process.AddTag("mytag2"); process.Store(); EntityList <WpsProcessOffering> services = new EntityList <WpsProcessOffering>(context); var parameters = new NameValueCollection(); parameters.Set("tag", "mytag"); IOpenSearchResultCollection osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("tag", "tag"); osr = ose.Query(services, parameters); Assert.AreEqual(0, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("tag", "tag,mytag"); osr = ose.Query(services, parameters); Assert.AreEqual(0, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("tag", "mytag,mytag1"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); provider.Delete(); }
public void LoadWpsJobStatus() { WpsProvider provider = CreateProvider("planetek", "planetek", "http://urban-tep.planetek.it/wps/WebProcessingService", true); provider.Store(); WpsProcessOffering process = CreateProcess(provider, "it.planetek.wps.extension.Processor", "Title of the processor"); process.Store(); WpsJob job = new WpsJob(context); job.WpsId = process.Identifier; job.StatusLocation = "http://urban-tep.planetek.it/wps/RetrieveResultServlet?id=72ed982a-8522-4c02-bb71-77f4c22a7808"; var jobresponse = job.GetStatusLocationContent(); var execResponse = jobresponse as ExecuteResponse; job.UpdateStatusFromExecuteResponse(execResponse); //get job recast response execResponse = ProductionResultHelper.GetWpsjobRecastResponse(context, job, execResponse); Assert.True(true); }
public void SearchWpsServicesByAvailability() { var uid = Guid.NewGuid().ToString(); WpsProvider provider = CreateProvider(uid, "test provider", "http://gpod.eo.esa.int/wps?service=WPS&version=1.0.0&request=GetCapabilities", false); provider.UpdateProcessOfferings(); EntityList <WpsProcessOffering> wpsProcessList = new EntityList <WpsProcessOffering>(context); wpsProcessList.Template.Provider = provider; wpsProcessList.Load(); var nbprocesses = wpsProcessList.Items.Count(); EntityList <WpsProcessOffering> services = new EntityList <WpsProcessOffering>(context); var parameters = new NameValueCollection(); parameters.Set("count", (nbprocesses + 1) + ""); IOpenSearchResultCollection osr = ose.Query(services, parameters); Assert.AreEqual(nbprocesses, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "all"); osr = ose.Query(services, parameters); Assert.AreEqual(nbprocesses, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "false"); osr = ose.Query(services, parameters); Assert.AreEqual(nbprocesses, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "true"); osr = ose.Query(services, parameters); Assert.AreEqual(0, osr.Items.Count()); WpsProcessOffering service1 = wpsProcessList.Items.First(); service1.Available = true; service1.Store(); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "all"); osr = ose.Query(services, parameters); Assert.AreEqual(nbprocesses, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "false"); osr = ose.Query(services, parameters); Assert.AreEqual(nbprocesses - 1, osr.Items.Count()); services = new EntityList <WpsProcessOffering>(context); parameters.Set("available", "true"); osr = ose.Query(services, parameters); Assert.AreEqual(1, osr.Items.Count()); provider.Delete(); }
public object Put(BulkSwitchServiceRequestTep request) { var context = TepWebContext.GetWebContext(PagePrivileges.AdminOnly); try { context.Open(); context.LogInfo(this, string.Format("/service/wps/bulk/replace PUT identifiers='{0}' newIdentifier='{1}'", string.Join(",", request.Identifiers), request.Service != null ? request.Service.Identifier : null)); if (request.Identifiers == null || request.Identifiers.Count == 0) { return(new HttpResult("No services specified", HttpStatusCode.BadRequest)); } if (request.Service == null) { return(new HttpResult("No service specified", HttpStatusCode.BadRequest)); } foreach (var identifier in request.Identifiers) { try { WpsProcessOfferingTep wpsOld = WpsProcessOfferingTep.FromIdentifier(context, identifier); WpsProcessOffering wpsNew = (WpsProcessOffering)request.Service.ToEntity(context, new WpsProcessOffering(context)); wpsNew.Identifier = Guid.NewGuid().ToString(); if (!string.IsNullOrEmpty(request.WpsIdentifier)) { var provider = (WpsProvider)ComputingResource.FromIdentifier(context, request.WpsIdentifier); wpsNew.Provider = provider; } else { wpsNew.Provider = wpsOld.Provider; } wpsNew.DomainId = wpsOld.DomainId; wpsNew.Tags = wpsOld.Tags; wpsNew.IconUrl = wpsOld.IconUrl; wpsNew.Available = true; wpsNew.Commercial = wpsOld.Commercial; wpsNew.Geometry = wpsOld.Geometry; wpsNew.ValidationUrl = wpsOld.ValidationUrl; wpsNew.TermsConditionsUrl = wpsOld.TermsConditionsUrl; wpsNew.TermsConditionsText = wpsOld.TermsConditionsText; wpsNew.Store(); if (request.DeleteOld) { wpsOld.Delete(); } else { wpsOld.Available = false; wpsOld.Store(); } } catch (Exception e) { context.LogError(this, "Error while loading service " + identifier, e); } } context.Close(); } catch (Exception e) { context.LogError(this, e.Message, e); context.Close(); throw e; } return(new HttpResult("", HttpStatusCode.OK)); }