cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [39/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 2a99064
Date Tue, 09 Apr 2013 13:21:16 GMT
Factories for DiskOffering, ServiceOffering

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/be71fae9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/be71fae9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/be71fae9

Branch: refs/heads/marvin_refactor
Commit: be71fae9b4854a2b83064be0f12fc359612f7d1a
Parents: ed291ee
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sat Mar 30 22:16:39 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun Mar 31 22:19:28 2013 +0530

----------------------------------------------------------------------
 .../marvin/marvin/integration/lib/base/Account.py  |    2 +-
 .../integration/lib/factory/AccountFactory.py      |    2 +-
 .../integration/lib/factory/DiskOfferingFactory.py |   21 ++++++++-
 .../integration/lib/factory/DomainFactory.py       |    3 +-
 .../lib/factory/NetworkOfferingFactory.py          |   13 +++--
 .../lib/factory/ServiceOfferingFactory.py          |   25 ++++++++---
 .../integration/lib/factory/test/testFactories.py  |   34 +++++++++++---
 7 files changed, 75 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/base/Account.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/Account.py b/tools/marvin/marvin/integration/lib/base/Account.py
index b5ad12a..c9698eb 100644
--- a/tools/marvin/marvin/integration/lib/base/Account.py
+++ b/tools/marvin/marvin/integration/lib/base/Account.py
@@ -23,7 +23,7 @@ from marvin.cloudstackAPI import updateAccount
 from marvin.cloudstackAPI import disableAccount
 from marvin.cloudstackAPI import deleteAccount
 
-class Account(CloudStackEntity):
+class Account(CloudStackEntity.CloudStackEntity):
 
 
     def __init__(self, items):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
index ebff3fe..7306073 100644
--- a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
@@ -15,9 +15,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
-from marvin.integration.lib.base import Account
 import hashlib
 from marvin.integration.lib.factory.CloudStackBaseFactory import *
+from marvin.integration.lib.base import Account
 from marvin.integration.lib.utils import random_gen
 
 class AccountFactory(CloudStackBaseFactory):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
index df3ef3e..11c4df8 100644
--- a/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
@@ -16,9 +16,26 @@
 # under the License.
 import factory
 from marvin.integration.lib.base import DiskOffering
+from marvin.integration.lib.utils import random_gen
+
 class DiskOfferingFactory(factory.Factory):
 
     FACTORY_FOR = DiskOffering
 
-    displaytext = None
-    name = None
+    displaytext = factory.Sequence(lambda n : "DiskOffering" + random_gen())
+    name = factory.Sequence(lambda n : "DiskOffering" + random_gen())
+
+
+class SharedDiskOfferingFactory(DiskOfferingFactory):
+
+    displaytext = "SharedDiskOffering"
+    name = factory.Sequence(lambda n : "SharedDiskOffering" + random_gen())
+    storagetype = "shared"
+    disksize = 10 #MB
+
+class LocalDiskOfferingFactory(DiskOfferingFactory):
+
+    displaytext = "LocalDiskOffering"
+    name = factory.Sequence(lambda n : "LocalDiskOffering" + random_gen())
+    storagetype = "local"
+    disksize = 10 #MB

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/DomainFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/DomainFactory.py b/tools/marvin/marvin/integration/lib/factory/DomainFactory.py
index 9f5158e..1c51170 100644
--- a/tools/marvin/marvin/integration/lib/factory/DomainFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/DomainFactory.py
@@ -16,8 +16,9 @@
 # under the License.
 import factory
 from marvin.integration.lib.base import Domain
+from marvin.integration.lib.utils import random_gen
 class DomainFactory(factory.Factory):
 
     FACTORY_FOR = Domain
 
-    name = None
+    name = "Domain" + factory.Sequence(lambda n : random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
index 7736281..5f876c8 100644
--- a/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
@@ -20,8 +20,11 @@ class NetworkOfferingFactory(factory.Factory):
 
     FACTORY_FOR = NetworkOffering
 
-    displaytext = None
-    guestiptype = None
-    name = None
-    supportedservices = None
-    traffictype = None
+    displaytext = "Network Offering"
+    guestiptype = "Isolated"
+    name = "Network Offering"
+    supportedservices = "Dhcp,Dns,SourceNat,PortForwarding"
+    traffictype = "Guest"
+
+
+class DefaultIsolatedNetworkOffering

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/ServiceOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/ServiceOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/ServiceOfferingFactory.py
index fb85187..a0b4295 100644
--- a/tools/marvin/marvin/integration/lib/factory/ServiceOfferingFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/ServiceOfferingFactory.py
@@ -15,13 +15,24 @@
 # specific language governing permissions and limitations
 # under the License.
 import factory
+from marvin.integration.lib.factory.CloudStackBaseFactory import *
 from marvin.integration.lib.base import ServiceOffering
-class ServiceOfferingFactory(factory.Factory):
+from marvin.integration.lib.utils import random_gen
 
-    FACTORY_FOR = ServiceOffering
+class ServiceOfferingFactory(CloudStackBaseFactory):
 
-    cpunumber = None
-    cpuspeed = None
-    displaytext = None
-    memory = None
-    name = None
+    FACTORY_FOR = ServiceOffering.ServiceOffering
+
+    cpunumber = 1
+    cpuspeed = 1000 #Mhz
+    displaytext = "Service Offering"
+    memory = 512 #MB
+    name =  factory.Sequence(lambda n: "ServiceOffering" + random_gen())
+
+
+class SmallServiceOfferingFactory(ServiceOfferingFactory):
+    cpunumber = 1
+    cpuspeed = 100 #Mhz
+    memory = 100 #MB
+    displaytext = "Small Service Offering"
+    name = factory.Sequence(lambda n: "SmallServiceOffering" + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be71fae9/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
index 551d7f6..d8afb03 100644
--- a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
+++ b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
@@ -16,8 +16,11 @@
 # under the License.
 
 import unittest
-from marvin.integration.lib.factory import AccountFactory
-from marvin.integration.lib.base import Account
+from marvin.integration.lib.factory.AccountFactory import *
+from marvin.integration.lib.base.Account import *
+
+from marvin.integration.lib.factory.ServiceOfferingFactory import *
+from marvin.integration.lib.base.ServiceOffering import *
 from marvin.cloudstackTestClient import cloudstackTestClient
 
 class AccountFactoryTest(unittest.TestCase):
@@ -25,22 +28,37 @@ class AccountFactoryTest(unittest.TestCase):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost').getApiClient()
 
     def test_userAccountFactory(self):
-        af = AccountFactory.AccountFactory()
-        accnt = Account.Account.create(apiclient=self.apiClient, AccountFactory=af)
+        af = AccountFactory()
+        accnt = Account.create(apiclient=self.apiClient, AccountFactory=af)
         self.assertTrue(accnt is not None, msg="no account created by factory")
         self.assertEqual(accnt.name, af.username, msg="account names are not same")
 
     def test_adminAccountFactory(self):
-        af = AccountFactory.AccountFactory()
-        accnt = Account.Account.create(apiclient=self.apiClient, AccountFactory=af)
+        af = AdminAccountFactory()
+        accnt = Account.create(apiclient=self.apiClient, AccountFactory=af)
         self.assertTrue(accnt is not None, msg="no account created by factory")
         self.assertEqual(accnt.name, af.username, msg="account names are not same")
 
     def test_userAccountFactoryCustomArgs(self):
-        af = AccountFactory.AccountFactory(firstname='test', lastname='test')
-        accnt = Account.Account.create(apiclient=self.apiClient, AccountFactory=af)
+        af = AccountFactory(firstname='test', lastname='test')
+        accnt = Account.create(apiclient=self.apiClient, AccountFactory=af)
         self.assertTrue(accnt is not None, msg="no account created by factory")
         self.assertEqual(accnt.name, af.username, msg="account names are not same")
 
     def tearDown(self):
         pass
+
+
+class ServiceOfferingFactoryTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost').getApiClient()
+
+    def test_serviceOfferingFactory(self):
+        sf = ServiceOfferingFactory()
+        soffering = ServiceOffering.create(apiclient=self.apiClient, ServiceOfferingFactory=sf)
+        self.assertTrue(soffering is not None, msg="no service offering was created")
+        self.assertEqual(soffering.name, sf.name, msg="error in service offering factory
creation")
+
+
+    def tearDown(self):
+        pass
\ No newline at end of file


Mime
View raw message