/** Constructor for JUnit Testing purposes only. Do not use it normally. */
  GroovyDataProvider(URL configURL) {
    configObject = doBootstrap();

    // parse the configuration file once
    ConfigObject highPriorityCO = cs.parse(configURL);
    configObject = mergeConfigObjects(configObject, highPriorityCO);
  }
  public BaseSettingsApi(
      BuildSettings settings, GrailsBuildEventListener buildEventListener, boolean interactive) {
    buildSettings = settings;
    buildProps = buildSettings.getConfig().toProperties();
    grailsHome = buildSettings.getGrailsHome();

    metadataFile = new File(buildSettings.getBaseDir(), "application.properties");

    metadata = metadataFile.exists() ? Metadata.getInstance(metadataFile) : Metadata.getCurrent();

    metadataFile = metadata.getMetadataFile();
    enableProfile = Boolean.valueOf(getPropertyValue("grails.script.profile", false).toString());
    pluginsHome = buildSettings.getProjectPluginsDir().getPath();
    pluginSettings = GrailsPluginUtils.getPluginBuildSettings(settings);
    grailsAppName = metadata.getApplicationName();
    isInteractive = interactive;

    // If no app name property (upgraded/new/edited project) default to basedir.
    if (grailsAppName == null) {
      grailsAppName = buildSettings.getBaseDir().getName();
    }

    if (grailsAppName.indexOf('/') > -1) {
      appClassName =
          grailsAppName.substring(grailsAppName.lastIndexOf('/'), grailsAppName.length());
    } else {
      appClassName = GrailsNameUtils.getClassNameRepresentation(grailsAppName);
    }
    configSlurper = buildSettings.createConfigSlurper();
    configSlurper.setEnvironment(buildSettings.getGrailsEnv());
    this.buildEventListener = buildEventListener;
  }
 /** load the bootstrap configuration */
 private ConfigObject doBootstrap() {
   URL url = getClass().getClassLoader().getResource(BOOTSTRAP_FILE_NAME);
   String msg =
       String.format(
           "Missing bootstrap file: %s. (Hint: copy "
               + "framework/test-contract/src/bootstrap.groovy to folder framework/test-contract/build)",
           BOOTSTRAP_FILE_NAME);
   Assert.assertNotNull(msg, url);
   return cs.parse(url);
 }