Exemplo n.º 1
0
 def setUp(self):
     self.file1 = 'lstest1.csv'
     self.file2 = 'lstest2.csv'
     self.dir1 = 'lstest1'
     self.dir2 = 'lstest2'
     self.file3 = self.dir1 + '/' + self.file1
     self.testdata = testdata
     fh = open(self.file1, 'w')
     fh.write(testdata)
     fh.close()
     # Delete input file1 if it exists already
     if storeClient.ls(TEST_TOKEN, self.file1, 'csv') != '':
         storeClient.rm(TEST_TOKEN, self.file1)
     # Delete input file2 if it exists already
     if storeClient.ls(TEST_TOKEN, self.file2, 'csv') != '':
         storeClient.rm(TEST_TOKEN, self.file2)
     # Create dir1 if it does NOT exist already
     if storeClient.ls(TEST_TOKEN, self.dir1, 'csv') == '':
         storeClient.mkdir(TEST_TOKEN, self.dir1)
     # Delete dir2 if it exists already
     if storeClient.ls(TEST_TOKEN, self.dir2, 'csv') != '':
         storeClient.rmdir(TEST_TOKEN, self.dir2)
     # Put local file to VOSpace
     storeClient.put(TEST_TOKEN, self.file1, self.file1)
     # Put local file to VOSpace directory
     storeClient.put(TEST_TOKEN, self.file1, self.file3)
     # Delete temporary local test file
     os.remove(self.file1)
Exemplo n.º 2
0
 def test_list(self):
     # Make sure that file1 exists in VOSpace
     self.assertEqual(storeClient.ls(TEST_TOKEN,self.file1,'csv'),self.file1)
     # Make sure that file2 does NOT exist in VOSpace
     self.assertEqual(storeClient.ls(TEST_TOKEN,self.file2,'csv'),'')
     # Make sure that dir1 exists in VOSpace
     self.assertEqual(storeClient.ls(TEST_TOKEN,self.dir1,'csv'),self.dir1)
     # Make sure that dir2 does NOT exist in VOSpace
     self.assertEqual(storeClient.ls(TEST_TOKEN,self.dir2,'csv'),'')
Exemplo n.º 3
0
def vo_list(*args):
    if DRY_RUN:
        return

    for uri in args:
        print("LIST [%s]" % uri)
        print("\t" + "\n\t".join(sc.ls(uri, format="long").splitlines()))
Exemplo n.º 4
0
 def tearDown(self):
     # Delete file1 if it exists
     if storeClient.ls(TEST_TOKEN, self.file1, 'csv') != '':
         storeClient.rm(TEST_TOKEN, self.file1)
     # Delete file2 if it exists
     if storeClient.ls(TEST_TOKEN, self.file2, 'csv') != '':
         storeClient.rm(TEST_TOKEN, self.file2)
     # Delete file2 if it exists
     if storeClient.ls(TEST_TOKEN, self.file3, 'csv') != '':
         storeClient.rm(TEST_TOKEN, self.file3)
     # Delete dir1 if it exists
     if storeClient.ls(TEST_TOKEN, self.dir1, 'csv') != '':
         storeClient.rmdir(TEST_TOKEN, self.dir1)
     # Delete dir2 if it exists
     if storeClient.ls(TEST_TOKEN, self.dir2, 'csv') != '':
         storeClient.rmdir(TEST_TOKEN, self.dir2)
Exemplo n.º 5
0
# creating the directories we are going to work on
print("-> START: Create working containers")
tpartial0 = time.time()
vo_mkdir(seed_node, "%s/Z/" % seed_node, "%s/Z/Y" % seed_node,
         "%s/Z/W" % seed_node, "%s/R" % seed_node)
tpartial = time.time()
print("---> END: Make directories [%s]/Z/[Y,W] [%s]/R in [%.2f]s" %
      (seed_node, seed_node, tpartial - tpartial0))

# List archive container/directory
if LIST_ARCH_CONTAINER or LIST_LARGE_ARCH_CONTAINER:
    print("-> START: List archive container [%s]" % arch_container[0])
    tpartial0 = time.time()
    #vo_list(arch_container[0])
    #print("\t" + "\n\t".join(sc.ls(uri, format="long").splitlines()))
    arch_dir_list = sc.ls(arch_container[0], format="long").splitlines()
    # choose one file from the list to test link
    arch_file_link_to_list = arch_dir_list[10]
    tpartial = time.time()
    arch_dir_list_size = len(arch_dir_list)
    if arch_dir_list_size == arch_container[1]:
        print("OK LIST [%s] with [%d] files" % arch_container)
    else:
        print("FAIL LIST [%s], number of files don't match" %
              arch_container[0])
    print("---> END: List dirs [%s] n [%.2f]s" %
          (arch_container[0], tpartial - tpartial0))

# COPY a directory we know we have data on, internally, within the VOSpace
if COPY_DIR_FROM_ARCHIVE:
    container_to_copy_from = arch_container[0]
Exemplo n.º 6
0
 def run(self):
     token = getUserToken(self)
     return storeClient.ls(token,
                           name=self.name.value,
                           format=self.format.value)