 
              env-1-mod-dir (fs/file env-1-dir "modules")
              env-1-mod-1-dir-and-manifests [(fs/file env-1-mod-dir
-                                                     "envmod1")
-                                            ["envmod1baz" "envmod1bim"]]
-             _ (gen-classes env-1-mod-1-dir-and-manifests)
-             env-1-mod-2-dir (fs/file env-1-mod-dir "envmod2")
+                                                     "mod1env1")
+                                            ["baz" "bim"]]
+             _ (gen-module-classes env-1-mod-1-dir-and-manifests)
+             env-1-mod-2-dir (fs/file env-1-mod-dir "mod2env1")
              env-1-mod-2-dir-and-manifests [env-1-mod-2-dir
-                                            ["envmod2baz" "envmod2bim"]]
-             _ (gen-classes env-1-mod-2-dir-and-manifests)
+                                            ["baz" "bim"]]
+             _ (gen-module-classes env-1-mod-2-dir-and-manifests)
 
              env-3-dir-and-manifests [(env-dir "env3") ["dip" "dap" "dup"]]
 
              base-mod-dir (fs/file code-dir "modules")
-             base-mod-1-and-manifests [(fs/file base-mod-dir "basemod1")
-                                       ["basemod1bap"]]
-             _ (gen-classes base-mod-1-and-manifests)
+             base-mod-1-and-manifests [(fs/file base-mod-dir "mod1envbase")
+                                       ["bap"]]
+             _ (gen-module-classes base-mod-1-and-manifests)
 
              bogus-env-dir (env-dir "bogus-env")
              _ (create-env [bogus-env-dir []])
              _ (gen-classes [bogus-env-dir ["envbogus"]])
-             _ (gen-classes [(fs/file base-mod-dir "base-bogus") ["base-bogus1"]])
+             _ (gen-module-classes [(fs/file base-mod-dir "base-bogus") ["base-bogus1"]])
 
              get-class-info-for-env (fn [env]
                                       (-> (.getClassInfoForEnvironment jruby-puppet

(ns puppetlabs.services.jruby.class-info-test
  (:require [clojure.test :refer :all]
            [puppetlabs.kitchensink.core :as ks]
            [puppetlabs.services.jruby.jruby-puppet-testutils :as jruby-testutils]
            [puppetlabs.services.jruby.puppet-environments :as puppet-env]

            [puppetlabs.trapperkeeper.app :as tk-app]
            [puppetlabs.trapperkeeper.testutils.bootstrap :as tk-bootstrap]))

(defn gen-module-classes
  [[mod-dir manifests]]
  (let [manifest-dir (fs/file mod-dir "manifests")
        mod-name (fs/base-name mod-dir)]
    (ks/mkdirs! manifest-dir)
    (doseq [manifest manifests]
      (spit (fs/file manifest-dir (str manifest ".pp"))
            (str
              "class " mod-name "::" manifest "($" manifest "_a, Integer $"
              manifest "_b, String $" manifest
              "_c = 'c default value') { }\n"
              "class " mod-name "::" manifest "2($" manifest "2_a, Integer $"
              manifest "2_b, String $" manifest
              "2_c = 'c default value') { }\n")))))

(defn gen-classes
  [[env-dir manifests]]
  (let [manifest-dir (fs/file env-dir "manifests")]
    (ks/mkdirs! manifest-dir)
    (doseq [manifest manifests]
      (spit (fs/file manifest-dir (str manifest ".pp"))
