protected Properties getWebworkProperties() {
   final Properties properties = new Properties();
   InputStream in = null;
   try {
     in = ClassLoaderUtils.getResourceAsStream(DEFAULT_WEBWORK_PROPERTIES, getClass());
     properties.load(in);
   } catch (final Exception e) {
     log.error(
         "Could not load webwork properties from '"
             + DEFAULT_WEBWORK_PROPERTIES
             + "'.  Using default value for '"
             + APKeys.JIRA_ATTACHMENT_SIZE
             + "' as '"
             + getDefaultValue()
             + "'",
         e);
     return null;
   } finally {
     try {
       if (in != null) {
         in.close();
       }
     } catch (final IOException e) {
       log.error("Could not close '" + DEFAULT_WEBWORK_PROPERTIES + "' inputStream", e);
     }
   }
   return properties;
 }
    private void initialise(final VelocityEngine velocityEngine) {
      try {
        final Properties velocityPropertiesFile = new Properties();

        try {
          velocityPropertiesFile.load(
              ClassLoaderUtils.getResourceAsStream("velocity.properties", getClass()));
        } catch (final Exception e) {
          log.warn(
              "Could not configure the Velocity Engine from the velocity.properties, manually configuring.");
          velocityPropertiesFile.put("resource.loader", "class");
          velocityPropertiesFile.put(
              "class.resource.loader.description", "Velocity Classpath Resource Loader");
          velocityPropertiesFile.put(
              "class.resource.loader.class",
              "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        }

        // override caching options if were in dev mode
        if (JiraSystemProperties.isDevMode()) {
          // Turn off velocity caching
          velocityPropertiesFile.put("class.resource.loader.cache", "false");
          velocityPropertiesFile.put("velocimacro.library.autoreload", "true");
          velocityPropertiesFile.put("plugin.resource.loader.cache", "false");
        }

        velocityEngine.init(velocityPropertiesFile);
      } catch (final Exception e) {
        log.error("Exception initialising Velocity: " + e, e);
      }
    }
 private String getDataFilePath(String dataFileName) {
   // let's do some funky URL stuff to find the real path of this file
   final URL url =
       ClassLoaderUtils.getResource(
           JiraTestUtil.TESTS_BASE + "/action/admin/" + dataFileName,
           TestDefaultDataImportService.class);
   final File f = new File(url.getPath());
   expect(mockJiraHome.getImportDirectory()).andReturn(new File(f.getParent())).anyTimes();
   return f.getAbsolutePath();
 }