cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [46/50] [abbrv] git commit: updated refs/heads/marvin_refactor to 2a99064
Date Tue, 09 Apr 2013 13:21:23 GMT
working virtulmachine test

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/c7c15cfa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c7c15cfa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c7c15cfa

Branch: refs/heads/marvin_refactor
Commit: c7c15cfad1ea25325540b9274925e02710efeca6
Parents: fed5840
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sun Mar 31 21:55:23 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun Mar 31 22:19:29 2013 +0530

----------------------------------------------------------------------
 .../integration/lib/factory/TemplateFactory.py     |   11 +++++-
 .../marvin/integration/lib/factory/UserFactory.py  |    1 +
 .../lib/factory/VirtualMachineFactory.py           |    7 +++-
 .../integration/lib/factory/test/testFactories.py  |   26 ++++++++++++++-
 .../marvin/marvin/integration/lib/generateBase.py  |    3 +-
 5 files changed, 42 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7c15cfa/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py b/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py
index 175a6e9..e2bb023 100644
--- a/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/TemplateFactory.py
@@ -16,10 +16,17 @@
 # under the License.
 import factory
 from marvin.integration.lib.base import Template
-class TemplateFactory(factory.Factory):
+from marvin.integration.lib.factory.CloudStackBaseFactory import CloudStackBaseFactory
 
-    FACTORY_FOR = Template
+class TemplateFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = Template.Template
 
     displaytext = None
     name = None
     ostypeid = None
+
+class DefaultBuiltInTemplateFactory(TemplateFactory):
+    ostype = 'CentOS 5.3 (64-bit)'
+    displaytext = 'CentOS 5.3 (64-bit)'
+    name = 'CentOS 5.3 (64-bit)'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7c15cfa/tools/marvin/marvin/integration/lib/factory/UserFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/UserFactory.py b/tools/marvin/marvin/integration/lib/factory/UserFactory.py
index a249478..eb2cafb 100644
--- a/tools/marvin/marvin/integration/lib/factory/UserFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/UserFactory.py
@@ -16,6 +16,7 @@
 # under the License.
 import factory
 from marvin.integration.lib.base import User
+
 class UserFactory(factory.Factory):
 
     FACTORY_FOR = User

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7c15cfa/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py b/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
index a9dc6c0..260a0ed 100644
--- a/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
@@ -14,11 +14,14 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+
 import factory
 from marvin.integration.lib.base import VirtualMachine
-class VirtualMachineFactory(factory.Factory):
+from marvin.integration.lib.factory.CloudStackBaseFactory import CloudStackBaseFactory
+
+class VirtualMachineFactory(CloudStackBaseFactory):
 
-    FACTORY_FOR = VirtualMachine
+    FACTORY_FOR = VirtualMachine.VirtualMachine
 
     serviceofferingid = None
     templateid = None

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7c15cfa/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 1637020..7e682c2 100644
--- a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
+++ b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
@@ -17,6 +17,7 @@
 
 import unittest
 from marvin.cloudstackTestClient import cloudstackTestClient
+from marvin.integration.lib.common import get_template
 
 from marvin.integration.lib.factory.AccountFactory import *
 from marvin.integration.lib.base.Account import Account
@@ -27,6 +28,13 @@ from marvin.integration.lib.base.ServiceOffering import ServiceOffering
 from marvin.integration.lib.factory.NetworkOfferingFactory import *
 from marvin.integration.lib.base.NetworkOffering import NetworkOffering
 
+from marvin.integration.lib.base.Zone import Zone
+
+from marvin.integration.lib.factory.TemplateFactory import *
+
+from marvin.integration.lib.factory.VirtualMachineFactory import *
+from marvin.integration.lib.base.VirtualMachine import VirtualMachine
+
 class AccountFactoryTest(unittest.TestCase):
     def setUp(self):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost').getApiClient()
@@ -92,4 +100,20 @@ class NetworkOfferingFactoryTest(unittest.TestCase):
         sgOffering.update(self.apiClient, state='Enabled')
 
     def tearDown(self):
-        pass
\ No newline at end of file
+        pass
+
+class VirtualMachineFactoryTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost').getApiClient()
+
+    def tearDown(self):
+        pass
+
+    def test_virtualMachineDeploy(self):
+        sf = ServiceOfferingFactory()
+        tf = DefaultBuiltInTemplateFactory()
+        zones = Zone.list(apiclient=self.apiClient)
+        template = get_template(apiclient=self.apiClient, zoneid = zones[0].id, ostype=tf.ostype)
+        vmf = VirtualMachineFactory(serviceofferingid = sf.id, templateid = template.id,
zoneid = zones[0].id)
+
+        vm = VirtualMachine.create(apiclient=self.apiClient, VirtualMachineFactory=vmf)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7c15cfa/tools/marvin/marvin/integration/lib/generateBase.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/generateBase.py b/tools/marvin/marvin/integration/lib/generateBase.py
index 2b213ff..f6d94c0 100644
--- a/tools/marvin/marvin/integration/lib/generateBase.py
+++ b/tools/marvin/marvin/integration/lib/generateBase.py
@@ -137,7 +137,8 @@ def write_entity_classes(entities):
                 else:
                     body.append(tabspace + 'def %s(self, apiclient, **kwargs):'%(action))
                 body.append(tabspace*2 + 'cmd = %(module)s.%(command)s()'%{"module": details["apimodule"],
"command": details["apicmd"]})
-                body.append(tabspace*2 + 'cmd.id = self.id')
+                if action not in ['create', 'list', 'deploy']:
+                    body.append(tabspace*2 + 'cmd.id = self.id')
                 for arg in details['args']:
                     body.append(tabspace*2 + 'cmd.%s = %s'%(arg, arg))
                 body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.iteritems()]')


Mime
View raw message