Commit 3312da4e authored by Felix Seibert's avatar Felix Seibert
Browse files

changed module and file names such that there are matching.

parent eddef532
......@@ -3,7 +3,7 @@ import unittest
import os
import shutil
import xOSDManager
import OSDManager
import div_util
import verify
import dir_status_page_parser
......@@ -66,7 +66,7 @@ class TestDataDistribution(unittest.TestCase):
class TestDirStatusPageParser(unittest.TestCase):
def test_feed(self):
parser = dir_status_page_parser.DIRStatusPageParser()
parser = dir_status_page_parser.dir_status_page_parser()
html_data = open('../test_data/dir_status_page.html', 'r').read()
......@@ -142,21 +142,21 @@ class TestXOSDManager(unittest.TestCase):
def test_init_no_xtreemfs_volume(self):
dummy_path = '/'
with self.assertRaises(xOSDManager.NotAXtreemFSVolume):
xOSDManager.OSDManager(dummy_path)
with self.assertRaises(OSDManager.NotAXtreemFSVolume):
OSDManager.OSDManager(dummy_path)
def test_path_on_volume(self):
osd_man = xOSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
osd_man = OSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
self.assertEqual(os.path.join(self.volume_name, self.path_on_volume, self.some_folder),
osd_man.path_on_volume(
os.path.join(self.path_to_mount, self.path_on_volume, self.some_folder)))
with self.assertRaises(xOSDManager.PathNotManagedException):
with self.assertRaises(OSDManager.PathNotManagedException):
osd_man.path_on_volume(self.absolute_path_random)
def test_get_target_dir(self):
osd_man = xOSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
osd_man = OSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
folder_id = os.path.join(self.volume_name, self.path_on_volume, self.some_folder, self.some_sub_folder)
target_dir = osd_man.get_target_dir(folder_id)
......@@ -226,7 +226,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder)
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.copy_folders(self.depth_2_dirs)
self.assertTrue(verify.verify_gms_folder(managed_folder))
......@@ -247,7 +247,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
new_dirs.append(new_dir)
copy_tuples.append((depth_2_dir, new_dir))
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.create_empty_folders(new_dirs)
# now copy files manually and check whether the data layout is good
......@@ -274,7 +274,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
new_dirs.append(new_dir)
copy_tuples.append((depth_2_dir, new_dir))
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.create_empty_folders(new_dirs)
for src, dst in copy_tuples:
......@@ -308,7 +308,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder_1 = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder_1)
x_man_1 = xOSDManager.OSDManager(managed_folder_1)
x_man_1 = OSDManager.OSDManager(managed_folder_1)
x_man_1.copy_folders(self.depth_2_dirs)
total_size_in_distribution_1 = 0
......@@ -316,7 +316,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
total_size_in_distribution_1 += osd.totalFolderSize
managed_folder_2 = os.path.join(self.mount_point_2, self.path_on_mount_point)
x_man_2 = xOSDManager.OSDManager(managed_folder_2)
x_man_2 = OSDManager.OSDManager(managed_folder_2)
total_size_in_distribution_2 = 0
for osd in x_man_2.dataDistribution.OSDs.values():
......@@ -328,7 +328,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder_1 = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder_1)
x_man_1 = xOSDManager.OSDManager(managed_folder_1)
x_man_1 = OSDManager.OSDManager(managed_folder_1)
x_man_1.copy_folders(self.depth_2_dirs)
removed_folder_id = 'xfs_volume/x/y/folder/dir_0/FOLDER_1'
......@@ -349,7 +349,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder_1 = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder_1)
x_man_1 = xOSDManager.OSDManager(managed_folder_1)
x_man_1 = OSDManager.OSDManager(managed_folder_1)
x_man_1.copy_folders(self.depth_2_dirs)
moved_folder_id = 'xfs_volume/x/y/folder/dir_0/FOLDER_1'
......
......@@ -3,7 +3,7 @@ import unittest
import os
import shutil
import xOSDManager
import OSDManager
import div_util
import verify
......@@ -36,21 +36,21 @@ class TestXOSDManager(unittest.TestCase):
def test_init_no_xtreemfs_volume(self):
dummy_path = '/'
with self.assertRaises(xOSDManager.NotAXtreemFSVolume):
xOSDManager.OSDManager(dummy_path)
with self.assertRaises(OSDManager.NotAXtreemFSVolume):
OSDManager.OSDManager(dummy_path)
def test_path_on_volume(self):
osd_man = xOSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
osd_man = OSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
self.assertEqual(os.path.join(self.volume_name, self.path_on_volume, self.some_folder),
osd_man.path_on_volume(
os.path.join(self.path_to_mount, self.path_on_volume, self.some_folder)))
with self.assertRaises(xOSDManager.PathNotManagedException):
with self.assertRaises(OSDManager.PathNotManagedException):
osd_man.path_on_volume(self.absolute_path_random)
def test_get_target_dir(self):
osd_man = xOSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
osd_man = OSDManager.OSDManager(self.absolute_path_to_managed_folder, value_map=self.value_map)
folder_id = os.path.join(self.volume_name, self.path_on_volume, self.some_folder, self.some_sub_folder)
target_dir = osd_man.get_target_dir(folder_id)
......@@ -120,7 +120,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder)
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.copy_folders(self.depth_2_dirs)
self.assertTrue(verify.verifyGMSFolder(managed_folder))
......@@ -141,7 +141,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
new_dirs.append(new_dir)
copy_tuples.append((depth_2_dir, new_dir))
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.create_empty_folders(new_dirs)
# now copy files manually and check whether the data layout is good
......@@ -168,7 +168,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
new_dirs.append(new_dir)
copy_tuples.append((depth_2_dir, new_dir))
x_man = xOSDManager.OSDManager(managed_folder)
x_man = OSDManager.OSDManager(managed_folder)
x_man.create_empty_folders(new_dirs)
for src, dst in copy_tuples:
......@@ -202,7 +202,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
managed_folder_1 = os.path.join(self.mount_point_1, self.path_on_mount_point)
os.makedirs(managed_folder_1)
x_man_1 = xOSDManager.OSDManager(managed_folder_1)
x_man_1 = OSDManager.OSDManager(managed_folder_1)
x_man_1.copy_folders(self.depth_2_dirs)
total_size_in_distribution_1 = 0
......@@ -210,7 +210,7 @@ class TestXOSDManagerWithXtreemFS(unittest.TestCase):
total_size_in_distribution_1 += osd.totalFolderSize
managed_folder_2 = os.path.join(self.mount_point_2, self.path_on_mount_point)
x_man_2 = xOSDManager.OSDManager(managed_folder_2)
x_man_2 = OSDManager.OSDManager(managed_folder_2)
total_size_in_distribution_2 = 0
for osd in x_man_2.dataDistribution.osds.values():
......
......@@ -8,7 +8,7 @@ import shutil
import dataDistribution
import div_util
import folder
import dir_status_page_parser
import xtreemfs_client.dir_status_page_parser as dir_status_page_parser
'''
xOSDManager - a python module to manage OSD selection in XtreemFS
......@@ -66,7 +66,7 @@ class OSDManager(object):
answer = request.urlopen(div_util.get_http_address(self.volumeAddress))
html_data = answer.read().decode('UTF-8')
parser = dir_status_page_parser.DIRStatusPageParser()
parser = dir_status_page_parser.dir_status_page_parser()
parser.feed(html_data)
# filter out data sets without last update time or wrong service type
......
......@@ -2,7 +2,7 @@ import argparse
import sys
import xOSDManager
import OSDManager
import verify
"""
......@@ -57,7 +57,7 @@ if args.verify:
verify.print_tree(vars(args)['target-folder'][0])
sys.exit(0)
x_man = xOSDManager.OSDManager(vars(args)['target-folder'][0], debug=args.debug)
x_man = OSDManager.OSDManager(vars(args)['target-folder'][0], debug=args.debug)
if args.print:
print(x_man)
......
from html.parser import HTMLParser
from urllib import request
class DIRStatusPageParser(HTMLParser):
class dir_status_page_parser(HTMLParser):
def __init__(self):
super().__init__()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment