diff --git a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestjobmanagementserver.py b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestjobmanagementserver.py index dd6e551164cfbb0c4563ddfea3b117b4103e8236..f095fd39b5fa0836eb791cf60d17bf3c173229d2 100755 --- a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestjobmanagementserver.py +++ b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestjobmanagementserver.py @@ -15,19 +15,17 @@ from lofar.messaging.messages import CommandMessage, EventMessage testname = 't_ingestjobmanagementserver_%s' % uuid.uuid1() -with TemporaryQueue(testname+"_ingest_notification_bus") as tmp_queue1, \ - TemporaryQueue(testname+"_ingest_bus") as tmp_queue2, \ - TemporaryQueue(testname + "_jobman_notification_bus") as tmp_queue3, \ +with TemporaryQueue(testname+"_bus") as tmp_bus, \ TemporaryQueue(testname + "_jobs_queue") as tmp_queue4, \ TemporaryQueue(testname + "_jobs_for_transfer_queue") as tmp_queue5: #overwrite some defaults in the config to run this as an isolated test import lofar.lta.ingest.common.config as cconfig - cconfig.DEFAULT_INGEST_NOTIFICATION_BUSNAME = tmp_queue1.address + cconfig.DEFAULT_INGEST_NOTIFICATION_BUSNAME = tmp_bus.address import lofar.lta.ingest.server.config as config - config.DEFAULT_INGEST_BUSNAME = tmp_queue2.address - config.DEFAULT_JOBMANAGER_NOTIFICATION_QUEUENAME = tmp_queue3.address + config.DEFAULT_INGEST_BUSNAME = tmp_bus.address + config.DEFAULT_JOBMANAGER_NOTIFICATION_QUEUENAME = tmp_bus.address config.DEFAULT_INGEST_JOBS_QUEUENAME = tmp_queue4.address config.DEFAULT_INGEST_JOBS_FOR_TRANSER_QUEUENAME = tmp_queue5.address diff --git a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestmomadapter.py b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestmomadapter.py index d33ce2d5c442edf4380336032ba3d288e74b401e..8896d970cdef6507f27fd244f35e6372c6597e63 100755 --- a/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestmomadapter.py +++ b/LTA/LTAIngest/LTAIngestServer/LTAIngestAdminServer/test/t_ingestmomadapter.py @@ -20,21 +20,16 @@ class TestIngestMoMAdapter(unittest.TestCase): self.tmp_queue1.open() self.addCleanup(self.tmp_queue1.close) - self.tmp_queue2 = TemporaryQueue("t_ingestmomadapter_lofar.lta.ingest.notification") - self.tmp_queue2.open() - self.addCleanup(self.tmp_queue2.close) - - self.tmp_queue3 = TemporaryQueue("t_ingestmomadapter_lofar.lta.ingest.notification.momingestadapter") - self.tmp_queue3.open() - self.addCleanup(self.tmp_queue3.close) + self.tmp_bus = TemporaryQueue("t_ingestmomadapter_lofar") + self.tmp_bus.open() + self.addCleanup(self.tmp_bus.close) momclient_patcher = mock.patch('lofar.lta.ingest.server.momclient.MoMClient') self.addCleanup(momclient_patcher.stop) self.momclient_mock = momclient_patcher.start() self.adapter = IngestMomAdapter(job_queue_name=self.tmp_queue1.address, - notification_publish_busname=self.tmp_queue2.address, - notification_queue_name=self.tmp_queue3.address, + busname=self.tmp_bus.address, mom_xmlrpc_host='localhost', mom_xmlrpc_port=randint(2345, 4567), # pick random port to reduce chance of clashes momClient = self.momclient_mock) diff --git a/SAS/MoM/MoMQueryService/test/t_momqueryservice.py b/SAS/MoM/MoMQueryService/test/t_momqueryservice.py index 76fde85d6ea986c4fdfed3d4bf3f0525361450b4..2b360816811b11ea5acf25e502e07abd425f1d8c 100755 --- a/SAS/MoM/MoMQueryService/test/t_momqueryservice.py +++ b/SAS/MoM/MoMQueryService/test/t_momqueryservice.py @@ -41,7 +41,6 @@ except ImportError as e: from lofar.common.dbcredentials import Credentials from lofar.mom.momqueryservice.momqueryrpc import MoMQueryRPC -from lofar.mom.momqueryservice.config import DEFAULT_MOMQUERY_SERVICENAME from lofar.mom.momqueryservice.momqueryservice import MoMDatabaseWrapper, ProjectDetailsQueryHandler from proton import Message @@ -864,7 +863,7 @@ class TestMomQueryRPC(unittest.TestCase): # the mock library had difficulty to mock ToBus and FromBus probably to some weir naming issue. # so mocking is done on QPID messaging level. - self.momrpc = MoMQueryRPC('busname', DEFAULT_MOMQUERY_SERVICENAME) + self.momrpc = MoMQueryRPC('busname') self.sender_mock = mock.MagicMock() self.receiver_mock = mock.MagicMock() diff --git a/SAS/OTDB_Services/TreeService.py b/SAS/OTDB_Services/TreeService.py index 9d31b1dcf66a8fc12c88a4bbc4ef8d09d7c6a877..64b0d5a59e3a6e3c4584259545bc7330e861b03d 100755 --- a/SAS/OTDB_Services/TreeService.py +++ b/SAS/OTDB_Services/TreeService.py @@ -657,8 +657,8 @@ class PostgressMessageHandler(MessageHandlerInterface): logger.info("_SetProject({0})".format(kwargs)) return SetProject(kwargs, self.connection) -def create_service(service_name, busname, dbcreds, broker=None): - return Service(service_name, +def create_service(busname, dbcreds, broker=None): + return Service(DEFAULT_OTDB_SERVICENAME, PostgressMessageHandler, busname=busname, use_service_methods=True, @@ -692,8 +692,7 @@ def main(): dbcreds = dbcredentials.parse_options(options) print("###dbcreds:", dbcreds) - with create_service(service_name=DEFAULT_OTDB_SERVICENAME, - busname=options.busname, + with create_service(busname=options.busname, dbcreds=dbcreds, broker=options.broker): waitForInterrupt() diff --git a/SAS/OTDB_Services/test/t_TreeService.py b/SAS/OTDB_Services/test/t_TreeService.py index 6080285faf5a8eccaf5714ce9054c17d3573ce1d..b5a1800f317892d3c42523f2e394fac955f0950f 100644 --- a/SAS/OTDB_Services/test/t_TreeService.py +++ b/SAS/OTDB_Services/test/t_TreeService.py @@ -34,7 +34,6 @@ import psycopg2 import subprocess from lofar.messaging.messagebus import * from lofar.messaging.RPC import * -from lofar.sas.otdb.config import DEFAULT_OTDB_SERVICENAME from lofar.sas.otdb.TreeService import create_service from lofar.common.dbcredentials import Credentials @@ -98,7 +97,7 @@ try: with TemporaryQueue(__name__) as tmp_queue: busname = tmp_queue.address - with create_service(DEFAULT_OTDB_SERVICENAME, busname, database_credentials): + with create_service(busname, database_credentials): with RPC("OTDBService.TaskGetIDs", ForwardExceptions=True, busname=busname, timeout=10) as otdbRPC: # Existing: otdb_id:1099268, mom_id:353713 do_rpc (otdbRPC, {'OtdbID': 1099268, 'MomID': 353713 }) diff --git a/SAS/OTDB_Services/test/t_TreeStatusEvents.py b/SAS/OTDB_Services/test/t_TreeStatusEvents.py index 01e98d9fc8f7016b755fb1f58811d7af6533166f..bfe9a61ed303487c444fd2d3f53473282169d9ba 100644 --- a/SAS/OTDB_Services/test/t_TreeStatusEvents.py +++ b/SAS/OTDB_Services/test/t_TreeStatusEvents.py @@ -34,7 +34,6 @@ import testing.postgresql import psycopg2 import subprocess from lofar.messaging.messagebus import * -from lofar.sas.otdb.config import DEFAULT_OTDB_SERVICENAME from lofar.sas.otdb.TreeStatusEvents import create_service from lofar.common.dbcredentials import Credentials import threading