Ejemplo n.º 1
0
    def testFilters(self):
        from application.Parcel import Manager as ParcelManager
        manager = \
                ParcelManager.get(self.view, \
                                  path=[os.path.join(self.repoDir, 'parcels')])
        manager.loadParcels(['parcel:osaf.pim'])

        k = KindCollection(view=self.view)
        kind = self.view.findPath('//parcels/osaf/pim/ContentItem')
        print kind
Ejemplo n.º 2
0
    def _reopenRepository(self):
        self.rep.commit()

        if self.ramdb:
            self.rep.closeView()
            self.rep.openView()
        else:
            self.rep.close()
            self.rep = DBRepository(os.path.join(self.testdir,
                                                 '__repository__'))
            self.rep.open()

        self.manager = \
         ParcelManager.get(self.rep.view, \
         path=[os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 3
0
    def _reopenRepository(self):
        self.rep.commit()

        if self.ramdb:
            self.rep.closeView()
            self.rep.openView()
        else:
            self.rep.close()
            self.rep = DBRepository(
                os.path.join(self.testdir, '__repository__'))
            self.rep.open()

        self.manager = \
         ParcelManager.get(self.rep.view, \
         path=[os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 4
0
    def _openRepository(self, ramdb=True):
        preloadedRepositoryPath = os.path.join(self.testdir, '__preloaded_repository__')
        self.rep = DBRepository(os.path.join(self.testdir, '__repository__'))

        if os.path.exists(preloadedRepositoryPath):
            self.ramdb = False
            self.rep.open(ramdb=False,
                          restore=preloadedRepositoryPath,
                          refcounted=True)
            self.rep.logger.setLevel(self.logLevel)
            self.rep.logger.info('Using preloaded repository')
        else:
            self.rep.create(ramdb=self.ramdb,
                            refcounted=True)
            self.rep.logger.setLevel(self.logLevel)
            self.rep.loadPack(self.chandlerPack)
            self.rep.commit()

        self.manager = \
         ParcelManager.get(self.rep.view, \
         path=[os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 5
0
    def _openRepository(self, ramdb=True):
        preloadedRepositoryPath = os.path.join(self.testdir,
                                               '__preloaded_repository__')
        self.rep = DBRepository(os.path.join(self.testdir, '__repository__'))

        if os.path.exists(preloadedRepositoryPath):
            self.ramdb = False
            self.rep.open(ramdb=False,
                          restore=preloadedRepositoryPath,
                          refcounted=True)
            self.rep.logger.setLevel(self.logLevel)
            self.rep.logger.info('Using preloaded repository')
        else:
            self.rep.create(ramdb=self.ramdb, refcounted=True)
            self.rep.logger.setLevel(self.logLevel)
            self.rep.loadPack(self.chandlerPack)
            self.rep.commit()

        self.manager = \
         ParcelManager.get(self.rep.view, \
         path=[os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 6
0
    def _reopenRepository(self):

        super(RepositoryTestCase, self)._reopenRepository()
        self.manager = ParcelManager.get(
            self.view, [os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 7
0
    def _openRepository(self, ramdb=True):

        super(RepositoryTestCase, self)._openRepository(ramdb)
        self.manager = ParcelManager.get(
            self.view, [os.path.join(self.rootdir, 'parcels')])
Ejemplo n.º 8
0
# pre-import any command line arguments so errors can be reported sooner
report_on = [(arg, schema.importString(arg))for arg in sys.argv[1:]]
  
for chatty in 'Parcel', 'Inbound':
    # Silence talkative loggers
    logger = logging.getLogger(chatty)
    logger.setLevel(logging.WARNING)

logging.getLogger().addHandler(logging.StreamHandler())

rep = NullRepositoryView()
schema.initRepository(rep)

manager = ParcelManager.get(
    rep, path=[os.path.join(os.path.dirname(__file__),'parcels')]
)

manager.loadParcels() #['http://osafoundation.org/parcels/osaf/contentmodel'])

classKinds = {}
allKinds = set()

def scan_parcel(item):
    for child in item.iterChildren():
        if isinstance(child,Parcel):
            scan_parcel(child)
        elif isinstance(child,Kind):
            classKinds.setdefault(child.getItemClass(),[]).append(child)
            allKinds.add(child)
Ejemplo n.º 9
0
    def _reopenRepository(self):

        super(RepositoryTestCase, self)._reopenRepository()
        self.manager = ParcelManager.get(self.view, [os.path.join(self.rootdir,
                                                                  'parcels')])
Ejemplo n.º 10
0
    def _openRepository(self, ramdb=True):

        super(RepositoryTestCase, self)._openRepository(ramdb)
        self.manager = ParcelManager.get(self.view, [os.path.join(self.rootdir,
                                                                  'parcels')])