Esempio n. 1
0
 def create(self):
     if self.obj_attr_is_set('id'):
         raise exception.ObjectActionError(action='create',
                                           reason=_('already created'))
     updates = self.karbor_obj_get_changes()
     db_service = db.service_create(self._context, updates)
     self._from_db_object(self._context, self, db_service)
Esempio n. 2
0
 def test_services_create(self):
     service_ref = db.service_create(self.ctxt,
                                     {'host': 'hosttest',
                                      'binary': 'binarytest',
                                      'topic': 'topictest',
                                      'report_count': 0})
     self.assertEqual(service_ref['host'], 'hosttest')
Esempio n. 3
0
 def create(self):
     if self.obj_attr_is_set('id'):
         raise exception.ObjectActionError(action='create',
                                           reason=_('already created'))
     updates = self.karbor_obj_get_changes()
     db_service = db.service_create(self._context, updates)
     self._from_db_object(self._context, self, db_service)
Esempio n. 4
0
 def _create_service_ref(self, context):
     service_ref = db.service_create(context,
                                     {'host': self.host,
                                      'binary': self.binary,
                                      'topic': self.topic,
                                      'report_count': 0})
     self.service_id = service_ref['id']
Esempio n. 5
0
 def _create_service_ref(self, context):
     service_ref = db.service_create(context,
                                     {'host': self.host,
                                      'binary': self.binary,
                                      'topic': self.topic,
                                      'report_count': 0})
     self.service_id = service_ref['id']
Esempio n. 6
0
 def test_services_create(self):
     service_ref = db.service_create(
         self.ctxt, {
             'host': 'hosttest',
             'binary': 'binarytest',
             'topic': 'topictest',
             'report_count': 0
         })
     self.assertEqual('hosttest', service_ref['host'])
Esempio n. 7
0
 def test_service_destroy(self):
     service_ref = db.service_create(self.ctxt,
                                     {'host': 'hosttest2',
                                      'binary': 'binarytest2',
                                      'topic': 'topictest2',
                                      'report_count': 0})
     service_id = service_ref['id']
     db.service_destroy(self.ctxt, service_id)
     self.assertRaises(exception.ServiceNotFound, db.service_get,
                       self.ctxt, service_id)
Esempio n. 8
0
 def test_service_destroy(self):
     service_ref = db.service_create(
         self.ctxt, {
             'host': 'hosttest2',
             'binary': 'binarytest2',
             'topic': 'topictest2',
             'report_count': 0
         })
     service_id = service_ref['id']
     db.service_destroy(self.ctxt, service_id)
     self.assertRaises(exception.ServiceNotFound, db.service_get, self.ctxt,
                       service_id)
Esempio n. 9
0
    def test_service_get_by_host_and_topic(self):
        service_ref = db.service_create(self.ctxt,
                                        {'host': 'hosttest5',
                                         'binary': 'binarytest5',
                                         'topic': 'topictest5',
                                         'report_count': 0})

        service_get_ref = db.service_get_by_host_and_topic(self.ctxt,
                                                           'hosttest5',
                                                           'topictest5')
        self.assertEqual(service_ref['host'], 'hosttest5')
        self.assertEqual(service_get_ref['host'], 'hosttest5')
Esempio n. 10
0
    def test_service_get_by_host_and_topic(self):
        service_ref = db.service_create(
            self.ctxt, {
                'host': 'hosttest5',
                'binary': 'binarytest5',
                'topic': 'topictest5',
                'report_count': 0
            })

        service_get_ref = db.service_get_by_host_and_topic(
            self.ctxt, 'hosttest5', 'topictest5')
        self.assertEqual('hosttest5', service_ref['host'])
        self.assertEqual('hosttest5', service_get_ref['host'])
Esempio n. 11
0
 def test_service_update(self):
     service_ref = db.service_create(self.ctxt,
                                     {'host': 'hosttest3',
                                      'binary': 'binarytest3',
                                      'topic': 'topictest3',
                                      'report_count': 0})
     service_id = service_ref['id']
     service_update_ref = db.service_update(self.ctxt, service_id,
                                            {'host': 'hosttest4',
                                             'binary': 'binarytest4',
                                             'topic': 'topictest4',
                                             'report_count': 0})
     self.assertEqual(service_ref['host'], 'hosttest3')
     self.assertEqual(service_update_ref['host'], 'hosttest4')
Esempio n. 12
0
 def test_service_update(self):
     service_ref = db.service_create(
         self.ctxt, {
             'host': 'hosttest3',
             'binary': 'binarytest3',
             'topic': 'topictest3',
             'report_count': 0
         })
     service_id = service_ref['id']
     service_update_ref = db.service_update(
         self.ctxt, service_id, {
             'host': 'hosttest4',
             'binary': 'binarytest4',
             'topic': 'topictest4',
             'report_count': 0
         })
     self.assertEqual('hosttest3', service_ref['host'])
     self.assertEqual('hosttest4', service_update_ref['host'])