#2888: Initialise ConfigSchema's and fix type names.
This commit is contained in:
@@ -31,7 +31,7 @@ class ExtendedApplication(Application, identifier="ExtendedApplication"):
|
||||
The application requests and loads web pages using its domain name and requesting IP addresses using DNS.
|
||||
"""
|
||||
|
||||
config: "ExtendedApplication.ConfigSchema"
|
||||
config: "ExtendedApplication.ConfigSchema" = None
|
||||
|
||||
target_url: Optional[str] = None
|
||||
|
||||
@@ -47,7 +47,7 @@ class ExtendedApplication(Application, identifier="ExtendedApplication"):
|
||||
class ConfigSchema(Application.ConfigSchema):
|
||||
"""ConfigSchema for ExtendedApplication."""
|
||||
|
||||
type: str = "EXTENDEDAPPLICATION"
|
||||
type: str = "EXTENDED_APPLICATION"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
kwargs["name"] = "ExtendedApplication"
|
||||
|
||||
@@ -17,12 +17,12 @@ from primaite.utils.validation.port import PORT_LOOKUP
|
||||
class BroadcastTestService(Service, identifier="BroadcastTestService"):
|
||||
"""A service for sending broadcast and unicast messages over a network."""
|
||||
|
||||
config: "BroadcastTestService.ConfigSchema"
|
||||
config: "BroadcastTestService.ConfigSchema" = None
|
||||
|
||||
class ConfigSchema(Service.ConfigSchema):
|
||||
"""ConfigSchema for BroadcastTestService."""
|
||||
|
||||
type: str = "BROADCASTTESTSERVICE"
|
||||
type: str = "BROADCAST_TEST_SERVICE"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
# Set default service properties for broadcasting
|
||||
|
||||
@@ -14,13 +14,19 @@ from primaite.utils.validation.port import PORT_LOOKUP
|
||||
from tests import TEST_ASSETS_ROOT
|
||||
|
||||
|
||||
class _DatabaseListener(Service):
|
||||
class _DatabaseListener(Service, identifier="_DatabaseListener"):
|
||||
config: "_DatabaseListener.ConfigSchema" = None
|
||||
name: str = "DatabaseListener"
|
||||
protocol: str = PROTOCOL_LOOKUP["TCP"]
|
||||
port: int = PORT_LOOKUP["NONE"]
|
||||
listen_on_ports: Set[int] = {PORT_LOOKUP["POSTGRES_SERVER"]}
|
||||
payloads_received: List[Any] = Field(default_factory=list)
|
||||
|
||||
class ConfigSchema(Service.ConfigSchema):
|
||||
"""ConfigSchema for _DatabaseListener."""
|
||||
|
||||
type: str = "_DATABASE_LISTENER"
|
||||
|
||||
def receive(self, payload: Any, session_id: str, **kwargs) -> bool:
|
||||
self.payloads_received.append(payload)
|
||||
self.sys_log.info(f"{self.name}: received payload {payload}")
|
||||
|
||||
Reference in New Issue
Block a user