Ejemplo n.º 1
0
    def setUp(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        config_template_path = os.path.join(
            os.getcwd(), 'layer_config_files/config_templates')

        # This is that path that will be created to hold all our dummy files
        self.testfiles_path = os.path.join(os.getcwd(),
                                           'config_tool_test_data')

        # Make dir for the test config XML files and text-replace the templates with the proper location
        make_dir_tree(os.path.join(self.testfiles_path, 'conf'))
        for file in [
                f for f in os.listdir(config_template_path)
                if os.path.isfile(os.path.join(config_template_path, f))
        ]:
            file_text_replace(
                os.path.join(config_template_path, file),
                os.path.join(self.testfiles_path, 'conf/' + file),
                '{testfile_dir}', self.testfiles_path)

        # Set the location of the archive XML config file used by all tests
        self.archive_config = os.path.join(self.testfiles_path,
                                           'conf/test_archive_config.xml')
        self.projection_config = os.path.join(self.testfiles_path,
                                              'conf/projection.xml')
        self.tilematrixset_config = os.path.join(self.testfiles_path,
                                                 'conf/tilematrixsets.xml')
Ejemplo n.º 2
0
    def setUpClass(self):
        # Get paths for test files
        test_config_path = os.path.join(os.getcwd(), 'mod_wmts_wrapper_test_data/test_wmts_err')
        base_apache_config = os.path.join(test_config_path, 'test_wmts_err_apache.conf')
        self.output_apache_config = os.path.join(apache_conf_dir, 'test_wmts_err_apache.conf')

        try:
            file_text_replace(base_apache_config, self.output_apache_config, '{testpath}', test_config_path)
        except IOError as e:
            print "Can't write file: {0}. Error: {1}".format(self.output_apache_config, e)

        restart_apache()
Ejemplo n.º 3
0
    def setUpClass(self):
        # Get paths for test files
        test_config_path = os.path.join(
            os.getcwd(), 'mod_wmts_wrapper_test_data/test_wmts_err')
        base_apache_config = os.path.join(test_config_path,
                                          'test_wmts_err_apache.conf')
        self.output_apache_config = os.path.join(apache_conf_dir,
                                                 'test_wmts_err_apache.conf')

        try:
            file_text_replace(base_apache_config, self.output_apache_config,
                              '{testpath}', test_config_path)
        except IOError as e:
            print "Can't write file: {0}. Error: {1}".format(
                self.output_apache_config, e)

        restart_apache()
Ejemplo n.º 4
0
    def setUp(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        config_template_path = os.path.join(os.getcwd(), 'layer_config_files/config_templates')

        # This is that path that will be created to hold all our dummy files
        self.testfiles_path = os.path.join(os.getcwd(), 'config_tool_test_data')

        # Make dir for the test config XML files and text-replace the templates with the proper location
        make_dir_tree(os.path.join(self.testfiles_path, 'conf'))
        for file in [f for f in os.listdir(config_template_path) if os.path.isfile(os.path.join(config_template_path, f))]:
            file_text_replace(os.path.join(config_template_path, file), os.path.join(self.testfiles_path, 'conf/' + file),
                              '{testfile_dir}', self.testfiles_path)

        # Set the location of the archive XML config file used by all tests
        self.archive_config = os.path.join(self.testfiles_path, 'conf/test_archive_config.xml')
        self.projection_config = os.path.join(self.testfiles_path, 'conf/projection.xml')
        self.tilematrixset_config = os.path.join(self.testfiles_path, 'conf/tilematrixsets.xml')
Ejemplo n.º 5
0
    def setUpClass(self):
        # Get paths for test files
        test_config_path = os.path.join(os.getcwd(),
                                        'mod_twms_test_data/test_twms_err')
        twms_configs = ('twms_cache_configs', 'twms_cache_staging',
                        'test_imagery/cache_all_twms.config')
        self.image_files_path = os.path.join(test_config_path, 'test_imagery')
        base_apache_config = os.path.join(test_config_path,
                                          'test_twms_err_apache.conf')
        self.output_apache_config = os.path.join(apache_conf_dir,
                                                 'test_twms_err_apache.conf')

        (template_dir, staging_dir, cache_config) = twms_configs
        # Make staging cache files dir
        template_path = os.path.join(test_config_path, template_dir)
        staging_path = os.path.join(test_config_path, staging_dir)
        cache_path = os.path.join(test_config_path, cache_config)
        make_dir_tree(staging_path)

        # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
        for file in [
                f for f in os.listdir(template_path)
                if os.path.isfile(os.path.join(template_path, f))
        ]:
            file_text_replace(os.path.join(template_path, file),
                              os.path.join(staging_path, file), '{cache_path}',
                              self.image_files_path)

        # Run oe_create_cache_config to make the cache config files
        cmd = 'oe_create_cache_config -cbd {0} {1}'.format(
            staging_path, cache_path)
        run_command(cmd)
        rmtree(staging_path)

        try:
            #file_text_replace(base_apache_config, self.output_apache_config, '{testpath}', test_config_path)
            file_text_replace(base_apache_config, self.output_apache_config,
                              '{cache_path}', test_config_path)
        except IOError as e:
            print "Can't write file: {0}. Error: {1}".format(
                self.output_apache_config, e)

        restart_apache()
Ejemplo n.º 6
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        oedata_path = os.path.join(os.getcwd(), 'twms_onearth_test_data')
        self.testdata_path = os.path.join(oedata_path, 'mod_twms')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging', 'test_imagery/cache_all_wmts.config')
        self.image_files_path = os.path.join(oedata_path, 'test_imagery')
        self.test_oe_config = os.path.join(oedata_path, 'oe_test.conf')
        self.test_apache_config = os.path.join(self.testdata_path, 'test_twms_err_apache.conf')
        
        template_dir, staging_dir, cache_config = wmts_configs
        # Make staging cache files dir
        template_path = os.path.join(oedata_path, template_dir)
        staging_path = os.path.join(oedata_path, staging_dir)
        cache_path = os.path.join(oedata_path, cache_config)
        make_dir_tree(staging_path)

        # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
        for file in [f for f in os.listdir(template_path) if os.path.isfile(os.path.join(template_path, f))]:
            file_text_replace(os.path.join(template_path, file), os.path.join(staging_path, file),
                              '{cache_path}', self.image_files_path)

        # Run oe_create_cache_config to make the cache config files
        cmd = 'oe_create_cache_config -cbd {0} {1}'.format(staging_path, cache_path)
        run_command(cmd)
        rmtree(staging_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(self.test_oe_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_oe_config)), '{cache_path}', oedata_path)

        # Put the correct path into the Apache config (test_twms_err_apache.conf)
        file_text_replace(self.test_apache_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_apache_config)), '{cache_path}', self.testdata_path)
        restart_apache()
Ejemplo n.º 7
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        testdata_path = os.path.join(os.getcwd(), 'mod_onearth_test_data')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging', 'test_imagery/cache_all_wmts.config')
        twms_configs = ('twms_cache_configs', 'twms_cache_staging', 'test_imagery/cache_all_twms.config')
        self.image_files_path = os.path.join(testdata_path, 'test_imagery')
        self.test_apache_config = os.path.join(testdata_path, 'oe_test.conf')
        self.mapfile = os.path.join(testdata_path, 'epsg4326.map')
        
        # create links for mapserv
        mapserver_location = '/usr/bin/mapserv'
        if not os.path.exists(testdata_path + '/wms_endpoint'):
            os.makedirs(testdata_path + '/wms_endpoint') 
        if not os.path.exists(testdata_path + '/wfs_endpoint'):
            os.makedirs(testdata_path + '/wfs_endpoint')   
        if os.path.isfile(mapserver_location):
            if os.path.islink(testdata_path + '/wms_endpoint/mapserv') == False:
                os.symlink(mapserver_location, testdata_path + '/wms_endpoint/mapserv')
            if os.path.islink(testdata_path + '/wfs_endpoint/mapserv') == False:
                os.symlink(mapserver_location, testdata_path + '/wfs_endpoint/mapserv')
        else:
            raise IOError(mapserver_location + 'does not exist')
        
        for template_dir, staging_dir, cache_config in (wmts_configs, twms_configs):
            # Make staging cache files dir
            template_path = os.path.join(testdata_path, template_dir)
            staging_path = os.path.join(testdata_path, staging_dir)
            cache_path = os.path.join(testdata_path, cache_config)
            make_dir_tree(staging_path)

            # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
            for file in [f for f in os.listdir(template_path) if os.path.isfile(os.path.join(template_path, f))]:
                file_text_replace(os.path.join(template_path, file), os.path.join(staging_path, file),
                                  '{cache_path}', self.image_files_path)

            # Run oe_create_cache_config to make the cache config files
            cmd = 'oe_create_cache_config -cbd {0} {1}'.format(staging_path, cache_path)
            run_command(cmd)
            rmtree(staging_path)

        # Put the correct path into the mapfile
        file_text_replace(self.mapfile + ".default", self.mapfile, '{cache_path}', testdata_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(self.test_apache_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_apache_config)),
                          '{cache_path}', testdata_path)
        restart_apache()
Ejemplo n.º 8
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        oedata_path = os.path.join(os.getcwd(), 'twms_onearth_test_data')
        self.testdata_path = os.path.join(oedata_path, 'mod_twms')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging',
                        'test_imagery/cache_all_wmts.config')
        self.image_files_path = os.path.join(oedata_path, 'test_imagery')
        self.test_oe_config = os.path.join(oedata_path, 'oe_test.conf')
        self.test_apache_config = os.path.join(self.testdata_path,
                                               'test_twms_err_apache.conf')

        template_dir, staging_dir, cache_config = wmts_configs
        # Make staging cache files dir
        template_path = os.path.join(oedata_path, template_dir)
        staging_path = os.path.join(oedata_path, staging_dir)
        cache_path = os.path.join(oedata_path, cache_config)
        make_dir_tree(staging_path)

        # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
        for file in [
                f for f in os.listdir(template_path)
                if os.path.isfile(os.path.join(template_path, f))
        ]:
            file_text_replace(os.path.join(template_path, file),
                              os.path.join(staging_path, file), '{cache_path}',
                              self.image_files_path)

        # Run oe_create_cache_config to make the cache config files
        cmd = 'oe_create_cache_config -cbd {0} {1}'.format(
            staging_path, cache_path)
        run_command(cmd)
        rmtree(staging_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(
            self.test_oe_config,
            os.path.join('/etc/httpd/conf.d',
                         os.path.basename(self.test_oe_config)),
            '{cache_path}', oedata_path)

        # Put the correct path into the Apache config (test_twms_err_apache.conf)
        file_text_replace(
            self.test_apache_config,
            os.path.join('/etc/httpd/conf.d',
                         os.path.basename(self.test_apache_config)),
            '{cache_path}', self.testdata_path)
        restart_apache()
Ejemplo n.º 9
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        testdata_path = os.path.join(os.getcwd(), 'mod_onearth_test_data')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging', 'test_imagery/cache_all_wmts.config')
        twms_configs = ('twms_cache_configs', 'twms_cache_staging', 'test_imagery/cache_all_twms.config')
        self.image_files_path = os.path.join(testdata_path, 'test_imagery')
        self.test_apache_config = os.path.join(testdata_path, 'oe_test.conf')
        self.mapfile = os.path.join(testdata_path, 'epsg4326.map')
        
        # create links for mapserv
        mapserver_location = '/usr/bin/mapserv'
        if not os.path.exists(testdata_path + '/wms_endpoint'):
            os.makedirs(testdata_path + '/wms_endpoint') 
        if not os.path.exists(testdata_path + '/wfs_endpoint'):
            os.makedirs(testdata_path + '/wfs_endpoint')   
        if os.path.isfile(mapserver_location):
            if os.path.islink(testdata_path + '/wms_endpoint/mapserv') == False:
                os.symlink(mapserver_location, testdata_path + '/wms_endpoint/mapserv')
            if os.path.islink(testdata_path + '/wfs_endpoint/mapserv') == False:
                os.symlink(mapserver_location, testdata_path + '/wfs_endpoint/mapserv')
        else:
            raise IOError(mapserver_location + 'does not exist')
        
        for template_dir, staging_dir, cache_config in (wmts_configs, twms_configs):
            # Make staging cache files dir
            template_path = os.path.join(testdata_path, template_dir)
            staging_path = os.path.join(testdata_path, staging_dir)
            cache_path = os.path.join(testdata_path, cache_config)
            make_dir_tree(staging_path)

            # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
            for file in [f for f in os.listdir(template_path) if os.path.isfile(os.path.join(template_path, f))]:
                file_text_replace(os.path.join(template_path, file), os.path.join(staging_path, file),
                                  '{cache_path}', self.image_files_path)

            # Run oe_create_cache_config to make the cache config files
            cmd = 'oe_create_cache_config -cbd {0} {1}'.format(staging_path, cache_path)
            run_command(cmd)
            rmtree(staging_path)

        # Put the correct path into the mapfile
        file_text_replace(self.mapfile + ".default", self.mapfile, '{cache_path}', testdata_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(self.test_apache_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_apache_config)),
                          '{cache_path}', testdata_path)
        restart_apache()
Ejemplo n.º 10
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        testdata_path = os.path.join(os.getcwd(), 'mod_onearth_test_data')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging', 'test_imagery/cache_all_wmts.config')
        twms_configs = ('twms_cache_configs', 'twms_cache_staging', 'test_imagery/cache_all_twms.config')
        self.image_files_path = os.path.join(testdata_path, 'test_imagery')
        self.test_apache_config = os.path.join(testdata_path, 'oe_test.conf')
        
        for template_dir, staging_dir, cache_config in (wmts_configs, twms_configs):
            # Make staging cache files dir
            template_path = os.path.join(testdata_path, template_dir)
            staging_path = os.path.join(testdata_path, staging_dir)
            cache_path = os.path.join(testdata_path, cache_config)
            make_dir_tree(staging_path)

            # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
            for file in [f for f in os.listdir(template_path) if os.path.isfile(os.path.join(template_path, f))]:
                file_text_replace(os.path.join(template_path, file), os.path.join(staging_path, file),
                                  '{cache_path}', self.image_files_path)

            # Run oe_create_cache_config to make the cache config files
            cmd = 'oe_create_cache_config -cbd {0} {1}'.format(staging_path, cache_path)
            run_command(cmd)
            rmtree(staging_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(self.test_apache_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_apache_config)),
                          '{cache_path}', testdata_path)
        restart_apache()

        # Set some handy constant values
        self.tile_hashes = {'210964547845bbeb357f62c214128215': '1990-01-01',
                            '403705d851af424b3bf9cafbbf869d0c': '2000-01-01',
                            '4832d6edeed31fad0bd59bbc26d92275': '2000-06-01',
                            '7ea2038a74af2988dc432a614ec94187': '2000-07-03',
                            '03b3cc7adc929dd605d617b7066b30ae': '2000-08-01',
                            '4f24774e71560e15b5ed43fcace2cb29': '2000-09-03',
                            'fd9e3aa7c12fbf823bd339b92920784e': '2000-12-01',
                            '24f90bd216f6b7ee25501155fcc8ece4': '2001-01-01',
                            '3d12e06c60b379efc41f4b8021ce1e29': '2001-05-09',
                            'e16d97b41cbb408d2a285788dfc9e3b8': '2002-01-01',
                            'b64066bafe897f0d2c0fc4a41ae7e052': '2002-12-27',
                            '21634316da8d6e0af3ee4f24643bd72c': '2002-12-01',
                            'b3639da9334ca5c13072012f9422a03c': '2003-12-01',
                            '172ba954906b3d4f5d6583b3ad88460f': '2004-12-01',
                            'f4426ab405ce748b57b34859b3811bf6': '2005-01-01',
                            '65e2446b2f779b963d0127f374a36fba': '2005-12-01',
                            'faf5788ab8e006bbcfe18be80d472840': '2006-12-01',
                            'd834056e48a95e39f55401eb61f710cd': '2007-12-01',
                            '9a3cf29a5df271c41eefc5c989fd690d': '2008-01-01',
                            'd03e3e3cdfef2b6e3d1870f26a88fe53': '2008-12-01',
                            '59692a541429c929117c854fe9e423c9': '2009-12-01',
                            '84eba8cdbb26444dbc97e119c0b76728': '2010-01-01',
                            '91206f8c5a4f6fcdcab366ea00a1f53c': '2010-01-09',
                            '9aa3115cde41a8b9c68433741d98a8b4': '2010-12-01',
                            'dae12a917a5d672c4cce4fdaf4788bf3': '2011-12-01',
                            '5346e958989b57c45919604ecf909f43': '2012-03-11',
                            '92e5d5eef4dc6866b636a49bfae3e463': '2015-01-01',
                            '5d91fa0c5273b2b58c486a15c91b2e78': '2015-01-02',
                            '81b8d855e38e6783f14899ff89a2c878': '2015-10-01',
                            '7f2992ac0986784c28d93840b1e984c4': '2016-02-29',
                            '1571c4d601dfd871e7680e279e6fd39c': '2015-01-12',
                            'b69307895d6cb654b98d247d710dd806': '2015-12-01',
                            'ba366ccd45a8f1ae0ed2b65cf67b9787': '2016-01-01',
                            '5e11f1220da2bb6f92d3e1c998f20bcf': 'black'}

        # URL that will be used to create the snap test requests
        self.snap_test_url_template = 'http://localhost/onearth/test/wmts/wmts.cgi?layer={0}&tilematrixset=EPSG4326_16km&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix=0&TileCol=0&TileRow=0&TIME={1}'
Ejemplo n.º 11
0
    def setUpClass(self):
        # Get the path of the test data -- we assume that the script is in the parent dir of the data dir
        testdata_path = os.path.join(os.getcwd(), 'mod_onearth_test_data')
        wmts_configs = ('wmts_cache_configs', 'wmts_cache_staging', 'test_imagery/cache_all_wmts.config')
        twms_configs = ('twms_cache_configs', 'twms_cache_staging', 'test_imagery/cache_all_twms.config')
        self.image_files_path = os.path.join(testdata_path, 'test_imagery')
        self.test_apache_config = os.path.join(testdata_path, 'oe_test.conf')
        
        for template_dir, staging_dir, cache_config in (wmts_configs, twms_configs):
            # Make staging cache files dir
            template_path = os.path.join(testdata_path, template_dir)
            staging_path = os.path.join(testdata_path, staging_dir)
            cache_path = os.path.join(testdata_path, cache_config)
            make_dir_tree(staging_path)

            # Copy XML/MRF files to staging cache files dir, swapping in the location of the imagery files
            for file in [f for f in os.listdir(template_path) if os.path.isfile(os.path.join(template_path, f))]:
                file_text_replace(os.path.join(template_path, file), os.path.join(staging_path, file),
                                  '{cache_path}', self.image_files_path)

            # Run oe_create_cache_config to make the cache config files
            cmd = 'oe_create_cache_config -cbd {0} {1}'.format(staging_path, cache_path)
            run_command(cmd)
            rmtree(staging_path)

        # Put the correct path into the Apache config (oe_test.conf)
        file_text_replace(self.test_apache_config, os.path.join('/etc/httpd/conf.d', os.path.basename(self.test_apache_config)),
                          '{cache_path}', testdata_path)
        restart_apache()

        # Set some handy constant values
        self.tile_hashes = {'3d5280b13cbabc41676973d26844f310': '1948-03-01',
                            '210964547845bbeb357f62c214128215': '1990-01-01',
                            '403705d851af424b3bf9cafbbf869d0c': '2000-01-01',
                            '4832d6edeed31fad0bd59bbc26d92275': '2000-06-01',
                            '7ea2038a74af2988dc432a614ec94187': '2000-07-03',
                            '03b3cc7adc929dd605d617b7066b30ae': '2000-08-01',
                            '4f24774e71560e15b5ed43fcace2cb29': '2000-09-03',
                            'fd9e3aa7c12fbf823bd339b92920784e': '2000-12-01',
                            '24f90bd216f6b7ee25501155fcc8ece4': '2001-01-01',
                            '3d12e06c60b379efc41f4b8021ce1e29': '2001-05-09',
                            'e16d97b41cbb408d2a285788dfc9e3b8': '2002-01-01',
                            'b64066bafe897f0d2c0fc4a41ae7e052': '2002-12-27',
                            '21634316da8d6e0af3ee4f24643bd72c': '2002-12-01',
                            'b3639da9334ca5c13072012f9422a03c': '2003-12-01',
                            '172ba954906b3d4f5d6583b3ad88460f': '2004-12-01',
                            'f4426ab405ce748b57b34859b3811bf6': '2005-01-01',
                            '65e2446b2f779b963d0127f374a36fba': '2005-12-01',
                            'faf5788ab8e006bbcfe18be80d472840': '2006-12-01',
                            'd834056e48a95e39f55401eb61f710cd': '2007-12-01',
                            '9a3cf29a5df271c41eefc5c989fd690d': '2008-01-01',
                            'd03e3e3cdfef2b6e3d1870f26a88fe53': '2008-12-01',
                            '59692a541429c929117c854fe9e423c9': '2009-12-01',
                            '84eba8cdbb26444dbc97e119c0b76728': '2010-01-01',
                            '91206f8c5a4f6fcdcab366ea00a1f53c': '2010-01-09',
                            '9aa3115cde41a8b9c68433741d98a8b4': '2010-12-01',
                            'dae12a917a5d672c4cce4fdaf4788bf3': '2011-12-01',
                            '5346e958989b57c45919604ecf909f43': '2012-03-11',
                            '92e5d5eef4dc6866b636a49bfae3e463': '2015-01-01',
                            '5d91fa0c5273b2b58c486a15c91b2e78': '2015-01-02',
                            '81b8d855e38e6783f14899ff89a2c878': '2015-10-01',
                            '7f2992ac0986784c28d93840b1e984c4': '2016-02-29',
                            '1571c4d601dfd871e7680e279e6fd39c': '2015-01-12',
                            'b69307895d6cb654b98d247d710dd806': '2015-12-01',
                            'ba366ccd45a8f1ae0ed2b65cf67b9787': '2016-01-01',
                            '5e11f1220da2bb6f92d3e1c998f20bcf': 'black'}

        # URL that will be used to create the snap test requests
        self.snap_test_url_template = 'http://localhost/onearth/test/wmts/wmts.cgi?layer={0}&tilematrixset=EPSG4326_16km&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix=0&TileCol=0&TileRow=0&TIME={1}'