Пример #1
0
        public void UpdateProcessOfferings()
        {
            WpsProvider provider = CreateProvider("test-wps-1-sync", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false);

            provider.AddTag("mytag1");
            List <WpsProcessOffering> services = provider.GetWpsProcessOfferingsFromRemote();

            Assert.AreEqual(1, services.Count());
            var service = services[0];

            foreach (var s in services)
            {
                s.Store();
            }
            Assert.True(!string.IsNullOrEmpty(service.Tags) && service.Tags.Contains("mytag1"));
            provider.AddTag("mytag2");//mytag2 is added only for new services
            provider.UpdateProcessOfferings();
            Assert.True(!string.IsNullOrEmpty(service.Tags) && service.Tags.Contains("mytag1") && !service.Tags.Contains("mytag2"));
            service.Delete();
            provider.UpdateProcessOfferings();
            EntityList <WpsProcessOffering> dbProcesses = provider.GetWpsProcessOfferings(false);

            Assert.AreEqual(1, dbProcesses.Count());
            service = dbProcesses.Items.First();
            Assert.True(!string.IsNullOrEmpty(service.Tags) && service.Tags.Contains("mytag1") && service.Tags.Contains("mytag2"));
            provider.Delete();
        }
Пример #2
0
        public void CreateWpsServiceFromRemote()
        {
            WpsProvider provider = CreateProvider("test-wps-1-remote", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false);
            List <WpsProcessOffering> services = provider.GetWpsProcessOfferingsFromRemote();

            Assert.AreEqual(1, services.Count());
            provider.Delete();
        }
Пример #3
0
        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();
        }
Пример #4
0
        public void CreateWpsServiceFromRemoteWithTags()
        {
            WpsProvider provider = CreateProvider("test-wps-1-tag", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false);

            provider.AddTag("mytag");
            List <WpsProcessOffering> services = provider.GetWpsProcessOfferingsFromRemote();

            Assert.AreEqual(1, services.Count());
            Assert.True(!string.IsNullOrEmpty(services[0].Tags) && services[0].Tags.Contains("mytag"));
            provider.Delete();
        }
Пример #5
0
        public void CreateWpsServiceFromRemoteWithDomain()
        {
            Domain domainpub = new Domain(context);

            domainpub.Identifier = "domainPublic";
            domainpub.Kind       = DomainKind.Public;
            domainpub.Store();

            WpsProvider provider = CreateProvider("test-wps-1-domain", "test provider 1", "http://dem.terradue.int:8080/wps/WebProcessingService", false);

            provider.Domain = domainpub;
            List <WpsProcessOffering> services = provider.GetWpsProcessOfferingsFromRemote();

            Assert.AreEqual(1, services.Count());
            Assert.True(services[0].DomainId == domainpub.Id);
            provider.Delete();
        }
Пример #6
0
        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();
        }
Пример #7
0
        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();
        }
Пример #8
0
        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();
        }