def setUp(self): self.__bookId = 5 self.__title = "Fratii Karamazov" self.__author = "Dostoievski" self.__description = "pam pam" self.__clientId = 7 self.__name = "Ion Iliescu" self.__rentalId = 16 self.__rentedDate = 20 self.__dueDate = 13 self.__returnedDate = 30 self.__book = Book(self.__bookId, self.__title, self.__description, self.__author) self.__client = Client(self.__clientId, self.__name) self.__rental = Rental(self.__rentalId, self.__bookId, self.__clientId, self.__rentedDate, self.__dueDate, self.__returnedDate) self.__repoBook = RepoBook() self.__repoClient = RepoClient() self.__undoList = UndoRedo() self.__repoRental = RepoRental(self.__repoBook, self.__repoClient) self.__validBook = BookValidator() self.__validClient = ClientValidator() self.__validRental = RepoValidator(self.__repoBook, self.__repoClient) self.__bookService = ServiceBook(self.__repoBook, self.__validBook, self.__undoList) self.__clientService = ServiceClient(self.__repoClient, self.__validClient, self.__undoList) self.__rentalService = ServiceRental(self.__repoBook, self.__repoClient, self.__validRental, self.__repoRental, self.__undoList)
from repo.RepositoryPickleFiles import RepoBookBinaryFiles from repo.RepositoryClientsFiles import RepoClientTextFiles from repo.RepositoryClientsPickleFiles import RepoClientBinaryFiles from repo.RepositoryChooser import ChooseRepo from valid.Validation import BookValidator, ClientValidator, RepoValidator from business.Service import ServiceBook, ServiceClient, ServiceRental from tests.Tests import Tests from undo.UndoRedo import UndoOperation, UndoRedo repo = ChooseRepo("settings.properties") repoChoose = repo.ChooseRepoType() repoFiles = repo.fileNames() if repoChoose == "memory": bookRepo = RepoBook() clientRepo = RepoClient() rentalRepo = RepoRental(bookRepo, clientRepo) elif repoChoose == "textfiles": bookRepo = RepoBookTextFiles(repoFiles[0]) clientRepo = RepoClientTextFiles(repoFiles[1]) rentalRepo = RepoRentalTextFiles(bookRepo, clientRepo, repoFiles[2]) else: bookRepo = RepoBookBinaryFiles(repoFiles[0]) clientRepo = RepoClientBinaryFiles(repoFiles[1]) rentalRepo = RepoRentalPickleFiles(bookRepo, clientRepo, repoFiles[2]) #bookRepo = RepoBookBinaryFiles() #clientRepo = RepoClientBinaryFiles() #bookRepo = RepoBookTextFiles() #bookRepo = RepoBook() #clientRepo = RepoClient() #clientRepo = RepoClientTextFiles() #rentalRepo = RepoRental(bookRepo, clientRepo)