Esempio n. 1
0
    def setUp(self):
        yield super(iSchedulePOST, self).setUp()

        serversDB = ServersDB()
        a_server = Server("A", "http://localhost:8008", thisServer=True)
        serversDB.addServer(a_server)
        b_server = Server("B", "http://localhost:8108", thisServer=False)
        serversDB.addServer(b_server)
        yield self.buildStoreAndDirectory(serversDB=serversDB)

        self.site.resource.putChild(
            "ischedule",
            IScheduleInboxResource(self.site.resource, self.storeUnderTest()))
        self.site.resource.putChild(
            "podding",
            IScheduleInboxResource(self.site.resource,
                                   self.storeUnderTest(),
                                   podding=True))

        yield self.populate()

        # iSchedule server
        IScheduleServers()
        server = IScheduleServerRecord("http://127.0.0.1")
        server.allow_from = True
        IScheduleServers._domainMap["example.org"] = server
        self.addCleanup(lambda: IScheduleServers._domainMap.pop("example.org")
                        )  #@UndefinedVariable
Esempio n. 2
0
    def setUp(self):
        yield super(MultiStoreConduitTest, self).setUp()

        # Stores
        for i in range(self.numberOfStores):
            serversDB = ServersDB()
            for j in range(self.numberOfStores):
                letter = chr(ord("A") + j)
                port = 8008 + 100 * j
                server = Server(letter, "http://127.0.0.1:{}".format(port),
                                letter, j == i)
                serversDB.addServer(server)

            if i == 0:
                yield self.buildStoreAndDirectory(
                    serversDB=serversDB, storeBuilder=self.theStoreBuilders[i])
                self.theStores[i] = self.store
            else:
                self.theStores[i] = yield self.buildStore(
                    self.theStoreBuilders[i])
                directory = buildTestDirectory(self.theStores[i],
                                               self.mktemp(),
                                               serversDB=serversDB)
                self.theStores[i].setDirectoryService(directory)

            self.theStores[i].queryCacher = None  # Cannot use query caching
            self.theStores[i].conduit = self.makeConduit(self.theStores[i])

            FakeConduitRequest.addServerStore(
                serversDB.getServerById(chr(ord("A") + i)), self.theStores[i])
Esempio n. 3
0
    def setUp(self):
        yield super(ExternalHome, self).setUp()

        serversDB = ServersDB()
        serversDB.addServer(Server("A", "http://127.0.0.1", "A", True))
        serversDB.addServer(Server("B", "http://127.0.0.2", "B", False))

        yield self.buildStoreAndDirectory(serversDB=serversDB)

        self.site.resource.putChild("conduit", ConduitResource(self.site.resource, self.storeUnderTest()))
Esempio n. 4
0
    def setUp(self):
        yield super(ConduitPOST, self).setUp()

        serversDB = ServersDB()
        self.thisServer = Server("A", "http://127.0.0.1", "A", True)
        serversDB.addServer(self.thisServer)
        yield self.buildStoreAndDirectory(serversDB=serversDB)

        self.site.resource.putChild("conduit", ConduitResource(self.site.resource, self.storeUnderTest()))

        yield self.populate()
Esempio n. 5
0
    def setUp(self):
        yield super(ConduitPOST, self).setUp()

        serversDB = ServersDB()
        self.thisServer = Server("A", "http://127.0.0.1", "A", True)
        serversDB.addServer(self.thisServer)
        yield self.buildStoreAndDirectory(serversDB=serversDB)

        self.site.resource.putChild("conduit", ConduitResource(self.site.resource, self.storeUnderTest()))

        yield self.populate()
Esempio n. 6
0
    def setUp(self):
        yield super(MultiStoreConduitTest, self).setUp()

        # Store 1
        serversDB1 = ServersDB()
        server1a = Server("A", "http://127.0.0.1:8008", "A", True)
        serversDB1.addServer(server1a)
        server1b = Server("B", "http://127.0.0.1:8108", "B", False)
        serversDB1.addServer(server1b)
        yield self.buildStoreAndDirectory(serversDB=serversDB1)
        self.store.queryCacher = None     # Cannot use query caching
        self.store.conduit = self.makeConduit(self.store)

        # Store 2
        serversDB2 = ServersDB()
        server2a = Server("A", "http://127.0.0.1:8008", "A", False)
        serversDB2.addServer(server2a)
        server2b = Server("B", "http://127.0.0.1:8108", "B", True)
        serversDB2.addServer(server2b)

        self.store2 = yield self.buildStore(self.theStoreBuilder2)
        directory2 = buildTestDirectory(
            self.store2, self.mktemp(), serversDB=serversDB2
        )

        self.store2.setDirectoryService(directory2)
        self.store2.queryCacher = None     # Cannot use query caching
        self.store2.conduit = self.makeConduit(self.store2)

        FakeConduitRequest.addServerStore(server1a, self.store)
        FakeConduitRequest.addServerStore(server2b, self.store2)
Esempio n. 7
0
    def setUp(self):
        yield super(MultiStoreConduitTest, self).setUp()

        # Store 1
        serversDB1 = ServersDB()
        server1a = Server("A", "http://127.0.0.1:8008", "A", True)
        serversDB1.addServer(server1a)
        server1b = Server("B", "http://127.0.0.1:8108", "B", False)
        serversDB1.addServer(server1b)
        yield self.buildStoreAndDirectory(serversDB=serversDB1)
        self.store.queryCacher = None  # Cannot use query caching
        self.store.conduit = self.makeConduit(self.store)

        # Store 2
        serversDB2 = ServersDB()
        server2a = Server("A", "http://127.0.0.1:8008", "A", False)
        serversDB2.addServer(server2a)
        server2b = Server("B", "http://127.0.0.1:8108", "B", True)
        serversDB2.addServer(server2b)

        self.store2 = yield self.buildStore(self.theStoreBuilder2)
        directory2 = buildTestDirectory(self.store2,
                                        self.mktemp(),
                                        serversDB=serversDB2)

        self.store2.setDirectoryService(directory2)
        self.store2.queryCacher = None  # Cannot use query caching
        self.store2.conduit = self.makeConduit(self.store2)

        FakeConduitRequest.addServerStore(server1a, self.store)
        FakeConduitRequest.addServerStore(server2b, self.store2)
Esempio n. 8
0
    def setUp(self):
        yield super(MultiStoreConduitTest, self).setUp()

        # Stores
        for i in range(self.numberOfStores):
            serversDB = ServersDB()
            for j in range(self.numberOfStores):
                letter = chr(ord("A") + j)
                port = 8008 + 100 * j
                server = Server(
                    letter, "http://127.0.0.1:{}".format(port), letter, j == i
                )
                serversDB.addServer(server)

            if i == 0:
                yield self.buildStoreAndDirectory(
                    serversDB=serversDB,
                    storeBuilder=self.theStoreBuilders[i],
                    accounts=self.accounts,
                    augments=self.augments,
                )
                self.theStores[i] = self.store
            else:
                self.theStores[i] = yield self.buildStore(
                    self.theStoreBuilders[i]
                )
                directory = buildTestDirectory(
                    self.theStores[i],
                    self.mktemp(),
                    serversDB=serversDB,
                    accounts=self.accounts,
                    augments=self.augments,
                )
                self.theStores[i].setDirectoryService(directory)

            self.theStores[i].queryCacher = None     # Cannot use query caching
            self.theStores[i].conduit = self.makeConduit(self.theStores[i])

            FakeConduitRequest.addServerStore(
                serversDB.getServerById(chr(ord("A") + i)), self.theStores[i]
            )
Esempio n. 9
0
    def setUp(self):
        yield super(iSchedulePOST, self).setUp()

        serversDB = ServersDB()
        a_server = Server("A", "http://localhost:8008", thisServer=True)
        serversDB.addServer(a_server)
        b_server = Server("B", "http://localhost:8108", thisServer=False)
        serversDB.addServer(b_server)
        yield self.buildStoreAndDirectory(serversDB=serversDB)

        self.site.resource.putChild("ischedule", IScheduleInboxResource(self.site.resource, self.storeUnderTest()))
        self.site.resource.putChild("podding", IScheduleInboxResource(self.site.resource, self.storeUnderTest(), podding=True))

        yield self.populate()

        # iSchedule server
        IScheduleServers()
        server = IScheduleServerRecord("http://127.0.0.1")
        server.allow_from = True
        IScheduleServers._domainMap["example.org"] = server
        self.addCleanup(lambda : IScheduleServers._domainMap.pop("example.org")) #@UndefinedVariable