banzai-inc / fixtures-component

Development fixtures component for the reloadable pattern
Eclipse Public License 1.0
6 stars 1 forks source link

integrating into `duct-framework`'s new edn-based system configuration #3

Closed dadair-ca closed 8 years ago

dadair-ca commented 8 years ago

Hello!

I'm trying to integrate fixtures-component into duct's new edn-based system configuration map.

Here's a snippet of the map:

{:components
 {:db ...
  ...
  :fixtures fixtures.component/fixtures}
 :dependencies
 {...
  :fixtures [:db]}
 :config
 {...
  :fixtures
  {:adapter fixtures.adapters.jdbc/jdbc-adapter
   :data [[:accounts [...]]]}
...

However, I keep getting ArityException Wrong number of args (0) passed to: Symbol clojure.lang.AFn.throwArity (AFn.java:429) in the REPL when I try to start the system. The stacktrace points to:

                  AFn.java:  429  clojure.lang.AFn/throwArity
                  AFn.java:   28  clojure.lang.AFn/invoke
                  core.clj:    8  fixtures.core/start <--------------
                  core.clj:    4  fixtures.core/start
             component.clj:   10  fixtures.component.Fixtures/start
                  core.clj:   40  suspendable.core/resume-system-component
                  core.clj:   36  suspendable.core/resume-system-component

which is:

(ns fixtures.core
  (:require [fixtures.protocols :refer [load! unload!]]))

(defn start
  "Starts a component"
  [db data {:keys [adapter setup]}]
  (if adapter
    (load! (adapter) db data) <-------------------
    (setup db)))

(defn stop
...)

Because of the error message, I'm assuming that it is a problem with the (adapter) call.

I've tried manually (require ..) fixtures.component, and fixtures.adapters.jdbc in the namespace that then goes on to load the configuration map, in case those were not being found and causing some errors, but that hasn't helped the situation.

Do you have any experience using fixtures-component in the new edn-based duct template? Or do you have any idea what I may be doing wrong here?

Thanks for your help!

dadair-ca commented 8 years ago

It appears that duct doesn't (require ..) vars in the :config part of the system map. I don't think therefore fixtures-component can be directly incorporated, and maybe an adapter component (in the software design sense) may be necessary.

dadair-ca commented 8 years ago

I had to circumvent the issue by using the bindings capabilities of duct's load-system. Since this isn't a fixtures-component issue, I'll close this.