syslog_ng: Rearrange methods between syslog-ng state and execution module.

It also adds the missing unit tests.