Ejemplo n.º 1
0
    def test_create_single_detailed_forest(self):
        """
        Test the following scenario:

        The database is given a forest object.  It should create a forest with
        the given name.  That forest should match the features of the datailed
        forest.

        """

        conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password))

        hosts = Host.list_hosts(conn)
        db = Database("detailed-forest-create-test-db", hosts[0].host_name())

        forest = Forest("detailed-forest-create-forest1", host=hosts[0].host_name(),
                        large_data_directory=ds.large_data_directory)

        db.set_forests([forest])

        db.create(conn)

        forest = Forest.lookup("detailed-forest-create-forest1", conn)

        try:
            self.assertEqual("detailed-forest-create-forest1", forest.name())
            self.assertEqual(ds.large_data_directory, forest.large_data_directory())
        finally:
            db.remove(conn)
    def test_create_single_detailed_forest(self):
        """
        Test the following scenario:

        The database is given a forest object.  It should create a forest with
        the given name.  That forest should match the features of the datailed
        forest.

        """

        conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password))

        hosts = Host.list(conn)
        db = Database("detailed-forest-create-test-db", hosts[0])

        forest = Forest("detailed-forest-create-forest1", host=hosts[0])
        forest.set_large_data_directory(ds.large_data_directory)

        db.set_forest_names([forest.forest_name()])

        db.create(conn)

        forest = Forest.lookup(conn, "detailed-forest-create-forest1")

        try:
            self.assertEqual("detailed-forest-create-forest1",
                             forest.forest_name())
            #this isn't in the properties...oddly.
            #self.assertEqual(ds.large_data_directory, forest.large_data_directory())
        finally:
            db.delete(connection=conn)
    def test_create_single_detailed_forest(self):
        """
        Test the following scenario:

        The database is given a forest object.  It should create a forest with
        the given name.  That forest should match the features of the datailed
        forest.

        """

        hosts = Host.list(self.connection)
        db = Database("detailed-forest-create-test-db", hosts[0])

        forest = Forest("detailed-forest-create-forest1", host=hosts[0])
        forest.set_large_data_directory("")

        db.set_forest_names([forest.forest_name()])

        db.create(self.connection)

        forest = Forest.lookup(self.connection,
                               "detailed-forest-create-forest1")

        try:
            assert "detailed-forest-create-forest1" == forest.forest_name()
            #this isn't in the properties...oddly.
            #self.assertEqual(ds.large_data_directory, forest.large_data_directory())
        finally:
            db.delete(connection=self.connection)
Ejemplo n.º 4
0
    def test_create_forest(self):
        conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password))

        host = Host.list_hosts(conn)[0]

        forest = Forest("test-forest-simple-create", host=host.host_name(),
                        large_data_directory=ds.large_data_directory,
                        fast_data_directory=ds.fast_data_directory, )
        forest.create(conn)

        forest = Forest.lookup("test-forest-simple-create", conn)

        try:
            self.assertIsNotNone(forest)
            self.assertEqual("test-forest-simple-create", forest.name())
            self.assertEqual(host.host_name(), forest.host())
            self.assertEqual(ds.large_data_directory, forest.large_data_directory())
            self.assertEqual(ds.fast_data_directory, forest.fast_data_directory())
        finally:
            forest.remove(conn)
Ejemplo n.º 5
0
    def test_create_single_detailed_forest(self):
        """
        Test the following scenario:

        The database is given a forest object.  It should create a forest with
        the given name.  That forest should match the features of the datailed
        forest.

        """

        hosts = Host.list(self.connection)
        db = Database("detailed-forest-create-test-db", hosts[0])

        forest = Forest("detailed-forest-create-forest1", host=hosts[0])
        forest.set_large_data_directory("")

        db.set_forest_names([forest.forest_name()])

        db.create(self.connection)

        forest = Forest.lookup(self.connection, "detailed-forest-create-forest1")

        try:
            assert "detailed-forest-create-forest1" == forest.forest_name()
            # this isn't in the properties...oddly.
            # self.assertEqual(ds.large_data_directory, forest.large_data_directory())
        finally:
            db.delete(connection=self.connection)
Ejemplo n.º 6
0
    def test_create_forest(self):
        conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password))

        host = Host.list(conn)[0]

        forest = Forest("test-forest-simple-create", host=host)

        forest.set_large_data_directory(ds.large_data_directory)
        forest.set_fast_data_directory(ds.fast_data_directory)

        forest.create(conn)

        forest = Forest.lookup(conn, "test-forest-simple-create")

        try:
            self.assertIsNotNone(forest)
            self.assertEqual("test-forest-simple-create", forest.forest_name())
            self.assertEqual(host, forest.host())
            self.assertEqual(ds.large_data_directory, forest.large_data_directory())
            self.assertEqual(ds.fast_data_directory, forest.fast_data_directory())
        finally:
            forest.delete(connection=conn)
Ejemplo n.º 7
0
    def test_getters_and_setters(self):
        forest = Forest("Foo", host="bar")
        forest.set_data_directory(ds.data_directory)
        forest.set_large_data_directory(ds.large_data_directory)
        forest.set_fast_data_directory(ds.fast_data_directory)

        self.assertEqual(forest.forest_name(), "Foo")

        forest.set_availability("offline")
        self.assertEqual("offline", forest.availability())

        with self.assertRaises(ValidationError):
            forest.set_availability("foo")

        self.assertEqual("bar", forest.host())

        self.assertEqual(ds.data_directory, forest.data_directory())

        self.assertEqual(ds.fast_data_directory, forest.fast_data_directory())

        self.assertEqual(ds.large_data_directory, forest.large_data_directory())
Ejemplo n.º 8
0
    def test_create_forest(self):
        conn = Connection(tc.hostname, HTTPDigestAuth(tc.admin, tc.password))

        host = Host.list(conn)[0]

        forest = Forest(
            "test-forest-simple-create",
            host=host,
            large_data_directory=ds.large_data_directory,
            fast_data_directory=ds.fast_data_directory,
        )
        forest.create(conn)

        forest = Forest.lookup(conn, "test-forest-simple-create")

        try:
            self.assertIsNotNone(forest)
            self.assertEqual("test-forest-simple-create", forest.forest_name())
            self.assertEqual(host.host_name(), forest.host())
            self.assertEqual(ds.large_data_directory,
                             forest.large_data_directory())
            self.assertEqual(ds.fast_data_directory,
                             forest.fast_data_directory())
        finally:
            forest.remove(conn)
Ejemplo n.º 9
0
    def test_getters_and_setters(self):
        forest = Forest("Foo",
                        host="bar",
                        data_directory=ds.data_directory,
                        large_data_directory=ds.large_data_directory,
                        fast_data_directory=ds.fast_data_directory)

        self.assertEqual(forest.forest_name(), "Foo")

        forest.set_availability("offline")
        self.assertEqual("offline", forest.availability())

        with self.assertRaises(ValidationError):
            forest.set_availability("foo")

        self.assertEqual("bar", forest.host())

        self.assertEqual(ds.data_directory, forest.data_directory())

        forest.set_database("foo")
        self.assertEqual("foo", forest.database())

        self.assertEqual(ds.fast_data_directory, forest.fast_data_directory())

        self.assertEqual(ds.large_data_directory,
                         forest.large_data_directory())
Ejemplo n.º 10
0
    def test_create_forest(self):
        host = Host.list(self.connection)[0]

        forest = Forest("test-forest-simple-create", host=host)

        forest.set_large_data_directory("")
        forest.set_fast_data_directory("")

        forest.create(self.connection)

        forest = Forest.lookup(self.connection, "test-forest-simple-create")

        try:
            assert forest is not None
            assert "test-forest-simple-create" == forest.forest_name()
            assert host == forest.host()
            assert "" == forest.large_data_directory()
            assert "" == forest.fast_data_directory()
        finally:
            forest.delete(connection=self.connection)
Ejemplo n.º 11
0
    def test_getters_and_setters(self):
        forest = Forest("Foo", host="bar")
        forest.set_data_directory("")
        forest.set_large_data_directory("")
        forest.set_fast_data_directory("")

        assert "Foo" == forest.forest_name()

        forest.set_availability("offline")
        assert "offline" == forest.availability()

        try:
            forest.set_availability("foo")
            assert False
        except ValidationError:
            assert True

        assert "bar" == forest.host()

        assert "" == forest.data_directory()

        assert "" == forest.fast_data_directory()

        assert "" == forest.large_data_directory()