Java 类org.springframework.core.io.FileSystemResourceLoader 实例源码

项目:FinanceAnalytics    文件:AbstractWebSecurityResourceTestCase.java   
@BeforeMethod(groups = TestGroup.UNIT)
public void setUp() throws Exception {
  _uriInfo = new MockUriInfo(true);
  _secMaster = new InMemorySecurityMaster();
  _secLoader = new AbstractSecurityLoader() {
    @Override
    protected SecurityLoaderResult doBulkLoad(SecurityLoaderRequest request) {
      throw new UnsupportedOperationException("load security not supported");
    }
  };
  _orgMaster = new InMemoryLegalEntityMaster();

  HistoricalTimeSeriesMaster htsMaster = new InMemoryHistoricalTimeSeriesMaster();
  addSecurity(WebResourceTestUtils.getEquitySecurity());
  addSecurity(WebResourceTestUtils.getBondFutureSecurity());

  _webSecuritiesResource = new WebSecuritiesResource(_secMaster, _secLoader, htsMaster, _orgMaster);
  MockServletContext sc = new MockServletContext("/web-engine", new FileSystemResourceLoader());
  Configuration cfg = FreemarkerOutputter.createConfiguration();
  cfg.setServletContextForTemplateLoading(sc, "WEB-INF/pages");
  FreemarkerOutputter.init(sc, cfg);
  _webSecuritiesResource.setServletContext(sc);
  _webSecuritiesResource.setUriInfo(_uriInfo);

}
项目:kc-rice    文件:RiceTestCase.java   
/**
    * configures logging using custom properties file if specified, or the default one.
    * Log4j also uses any file called log4.properties in the classpath
    *
    * <p>To configure a custom logging file, set a JVM system property on using -D. For example
    * -Dalt.log4j.config.location=file:/home/me/kuali/test/dev/log4j.properties
    * </p>
    *
    * <p>The above option can also be set in the run configuration for the unit test in the IDE.
    * To avoid log4j using files called log4j.properties that are defined in the classpath, add the following system property:
    * -Dlog4j.defaultInitOverride=true
    * </p>
    * @throws IOException
    */
protected void configureLogging() throws IOException {
       ResourceLoader resourceLoader = new FileSystemResourceLoader();
       String altLog4jConfigLocation = System.getProperty(ALT_LOG4J_CONFIG_LOCATION_PROP);
       Resource log4jConfigResource = null;
       if (!StringUtils.isEmpty(altLog4jConfigLocation)) { 
           log4jConfigResource = resourceLoader.getResource(altLog4jConfigLocation);
       }
       if (log4jConfigResource == null || !log4jConfigResource.exists()) {
           System.out.println("Alternate Log4j config resource does not exist! " + altLog4jConfigLocation);
           System.out.println("Using default log4j configuration: " + DEFAULT_LOG4J_CONFIG);
           log4jConfigResource = resourceLoader.getResource(DEFAULT_LOG4J_CONFIG);
       } else {
           System.out.println("Using alternate log4j configuration at: " + altLog4jConfigLocation);
       }
       Properties p = new Properties();
       p.load(log4jConfigResource.getInputStream());
       PropertyConfigurator.configure(p);
   }
项目:gwt-sl    文件:HandlerTest.java   
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    ServletContext servletContext = new MockServletContext(
            new FileSystemResourceLoader());
    requestService = new MockHttpServletRequest("PUT", "/service");
    applicationContext = new XmlWebApplicationContext();
    applicationContext.setServletContext(servletContext);
    applicationContext.setConfigLocations(new String[] {
            "src/main/webapp/WEB-INF/handler-servlet.xml",
            "src/main/webapp/WEB-INF/applicationContext.xml" });
    try{
    applicationContext.refresh();
    }
    catch (Throwable e){
        e.printStackTrace();
    }
    handler = (GWTHandler) applicationContext.getBean("urlMapping", GWTHandler.class);
}
项目:class-guard    文件:QuartzSupportTests.java   
@Test
public void testSchedulerWithSpringBeanJobFactoryAndJobSchedulingData() throws Exception {
    Assume.group(TestGroup.PERFORMANCE);
    DummyJob.param = 0;
    DummyJob.count = 0;

    SchedulerFactoryBean bean = new SchedulerFactoryBean();
    bean.setJobFactory(new SpringBeanJobFactory());
    bean.setJobSchedulingDataLocation("org/springframework/scheduling/quartz/job-scheduling-data.xml");
    bean.setResourceLoader(new FileSystemResourceLoader());
    bean.afterPropertiesSet();
    bean.start();

    Thread.sleep(500);
    assertEquals(10, DummyJob.param);
    assertTrue(DummyJob.count > 0);

    bean.destroy();
}
项目:sharding    文件:ResourceLoader.java   
public static Resource getResource(String sourcePath) {
    String pathToUse = StringUtils.cleanPath(sourcePath);
    if (pathToUse == null) {
        return null;
    }
    Resource resource = null;
    try {
        if (pathToUse.startsWith(org.springframework.core.io.ResourceLoader.CLASSPATH_URL_PREFIX)) {
            resource = new ClassRelativeResourceLoader(ResourceLoader.class).getResource(pathToUse);
        }
        if (resource == null) {
            resource = new FileSystemResourceLoader().getResource(pathToUse);
        }
    } catch (Exception e) {
        log.error("getResource error.", e);
    }
    return resource;
}
项目:rice    文件:RiceTestCase.java   
/**
    * configures logging using custom properties file if specified, or the default one.
    * Log4j also uses any file called log4.properties in the classpath
    *
    * <p>To configure a custom logging file, set a JVM system property on using -D. For example
    * -Dalt.log4j.config.location=file:/home/me/kuali/test/dev/log4j.properties
    * </p>
    *
    * <p>The above option can also be set in the run configuration for the unit test in the IDE.
    * To avoid log4j using files called log4j.properties that are defined in the classpath, add the following system property:
    * -Dlog4j.defaultInitOverride=true
    * </p>
    * @throws IOException
    */
protected void configureLogging() throws IOException {
       ResourceLoader resourceLoader = new FileSystemResourceLoader();
       String altLog4jConfigLocation = System.getProperty(ALT_LOG4J_CONFIG_LOCATION_PROP);
       Resource log4jConfigResource = null;
       if (!StringUtils.isEmpty(altLog4jConfigLocation)) { 
           log4jConfigResource = resourceLoader.getResource(altLog4jConfigLocation);
       }
       if (log4jConfigResource == null || !log4jConfigResource.exists()) {
           System.out.println("Alternate Log4j config resource does not exist! " + altLog4jConfigLocation);
           System.out.println("Using default log4j configuration: " + DEFAULT_LOG4J_CONFIG);
           log4jConfigResource = resourceLoader.getResource(DEFAULT_LOG4J_CONFIG);
       } else {
           System.out.println("Using alternate log4j configuration at: " + altLog4jConfigLocation);
       }
       Properties p = new Properties();
       p.load(log4jConfigResource.getInputStream());
       PropertyConfigurator.configure(p);
   }
项目:kuali_rice    文件:RiceTestCase.java   
/**
    * configures logging using custom properties file if specified, or the default one.
    * Log4j also uses any file called log4.properties in the classpath
    *
    * <p>To configure a custom logging file, set a JVM system property on using -D. For example
    * -Dalt.log4j.config.location=file:/home/me/kuali/test/dev/log4j.properties
    * </p>
    *
    * <p>The above option can also be set in the run configuration for the unit test in the IDE.
    * To avoid log4j using files called log4j.properties that are defined in the classpath, add the following system property:
    * -Dlog4j.defaultInitOverride=true
    * </p>
    * @throws IOException
    */
protected void configureLogging() throws IOException {
       ResourceLoader resourceLoader = new FileSystemResourceLoader();
       String altLog4jConfigLocation = System.getProperty(ALT_LOG4J_CONFIG_LOCATION_PROP);
       Resource log4jConfigResource = null;
       if (!StringUtils.isEmpty(altLog4jConfigLocation)) { 
           log4jConfigResource = resourceLoader.getResource(altLog4jConfigLocation);
       }
       if (log4jConfigResource == null || !log4jConfigResource.exists()) {
           System.out.println("Alternate Log4j config resource does not exist! " + altLog4jConfigLocation);
           System.out.println("Using default log4j configuration: " + DEFAULT_LOG4J_CONFIG);
           log4jConfigResource = resourceLoader.getResource(DEFAULT_LOG4J_CONFIG);
       } else {
           System.out.println("Using alternate log4j configuration at: " + altLog4jConfigLocation);
       }
       Properties p = new Properties();
       p.load(log4jConfigResource.getInputStream());
       PropertyConfigurator.configure(p);
   }
项目:xm-commons    文件:LepSpringConfiguration.java   
@Bean
protected RouterResourceLoader routerResourceLoader() {
    Map<String, ResourceLoader> routerMap = new HashMap<>(RESOURCE_LOADERS_CAPACITY);
    routerMap.put(CLASSPATH_URL_PREFIX, resourceLoader);
    routerMap.put(XM_MS_CONFIG_URL_PREFIX, cfgResourceLoader());
    routerMap.put(FILE_URL_PREFIX, new FileSystemResourceLoader());
    return new RouterResourceLoader(routerMap);
}
项目:xm-commons    文件:XmLepResourceServiceFileUnitTest.java   
@Before
public void before() throws IOException {
    oldUserHome = System.getProperty(USER_HOME);

    // init temp folder
    testScriptDir = folder.newFolder("home", "xm-online", "config", "tenants",
                                     TENANT_KEY_VALUE.toUpperCase(), APP_NAME,
                                     "lep", "resource", "service");


    // init system property
    File userHomeDir = Paths.get(folder.getRoot().toPath().toString(), "home").toFile();
    System.setProperty(USER_HOME, userHomeDir.getAbsolutePath());

    // copy script from classpath to file system tmp folder
    File scriptFile = Paths.get(testScriptDir.getAbsolutePath(), "Script$$before.groovy").toFile();
    if (!scriptFile.createNewFile()) {
        throw new IllegalStateException("Can't create file: " + scriptFile.getAbsolutePath());
    }
    InputStream scriptIn = resourceLoader.getResource(SCRIPT_CLASSPATH_URL).getInputStream();
    Files.copy(scriptIn, scriptFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
    scriptIn.close();

    // init resource service
    Map<String, ResourceLoader> urlPrefixToResourceLoader = new HashMap<>();
    urlPrefixToResourceLoader.put("file:", new FileSystemResourceLoader());
    RouterResourceLoader routerResourceLoader = new RouterResourceLoader(urlPrefixToResourceLoader);
    resourceService = new XmLepResourceService(APP_NAME, FILE, routerResourceLoader);
}
项目:gemini.blueprint    文件:OsgiBundleResourceTest.java   
public void testFileWithSpecialCharsInTheNameBeingResolved() throws Exception {
       String name = Thread.currentThread().getContextClassLoader().getResource( "test-file" ).toString();
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);
    resource = new OsgiBundleResource(bundle, name);

    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:gemini.blueprint    文件:OsgiBundleResourceTest.java   
public void testFileWithEmptyCharsInTheNameBeingResolved() throws Exception {
    String name = Thread.currentThread().getContextClassLoader().getResource( "test file" ).toString();
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);
    resource = new OsgiBundleResource(bundle, name);

    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:gemini.blueprint    文件:OsgiBundleResourceTest.java   
public void testFileWithNormalCharsInTheNameBeingResolved() throws Exception {
    String name = Thread.currentThread().getContextClassLoader().getResource( "normal" ).toString();
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);

    resource = new OsgiBundleResource(bundle, name);
    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:spring-cloud-dashboard    文件:TestDependencies.java   
@Bean
public ResourceLoader resourceLoader() {
    MavenProperties mavenProperties = new MavenProperties();
    mavenProperties.setRemoteRepositories(new HashMap<>(Collections.singletonMap("springRepo",
            new MavenProperties.RemoteRepository("https://repo.spring.io/libs-snapshot"))));

    Map<String, ResourceLoader> resourceLoaders = new HashMap<>();
    resourceLoaders.put("maven", new MavenResourceLoader(mavenProperties));
    resourceLoaders.put("file", new FileSystemResourceLoader());

    DelegatingResourceLoader delegatingResourceLoader = new DelegatingResourceLoader(resourceLoaders);
    return delegatingResourceLoader;
}
项目:spring4-understanding    文件:WebMvcConfigurationSupportExtensionTests.java   
@Before
public void setUp() {
    this.context = new StaticWebApplicationContext();
    this.context.setServletContext(new MockServletContext(new FileSystemResourceLoader()));
    this.context.registerSingleton("controller", TestController.class);

    this.config = new TestWebMvcConfigurationSupport();
    this.config.setApplicationContext(this.context);
    this.config.setServletContext(this.context.getServletContext());
}
项目:spring4-understanding    文件:Log4jWebConfigurerTests.java   
private void initLogging(String location, boolean refreshInterval) {
    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
    if (refreshInterval) {
        sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
    }
    Log4jWebConfigurer.initLogging(sc);

    try {
        assertLogOutput();
    } finally {
        Log4jWebConfigurer.shutdownLogging(sc);
    }
    assertTrue(MockLog4jAppender.closeCalled);
}
项目:spring4-understanding    文件:Log4jWebConfigurerTests.java   
@Test
public void testLog4jConfigListener() {
    Log4jConfigListener listener = new Log4jConfigListener();

    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
    listener.contextInitialized(new ServletContextEvent(sc));

    try {
        assertLogOutput();
    } finally {
        listener.contextDestroyed(new ServletContextEvent(sc));
    }
    assertTrue(MockLog4jAppender.closeCalled);
}
项目:move2alf    文件:RootMap.java   
private ServletContext createServletContext () throws Exception {
    // Establish the servlet context and config
      final MockServletContext servletContext = new MockServletContext(WEB_APP_PATH, new FileSystemResourceLoader());
      final MockServletConfig servletConfig = new MockServletConfig(servletContext);

      // Create a WebApplicationContext and initialize it with the xml and servlet configuration.
      final XmlWebApplicationContext webApplicationContext = new XmlWebApplicationContext();
      servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, webApplicationContext);
      webApplicationContext.setServletConfig(servletConfig);

      // Create a DispatcherServlet that uses the previously established WebApplicationContext.
      @SuppressWarnings("serial")
final DispatcherServlet dispatcherServlet = new DispatcherServlet() {
              @Override
              protected WebApplicationContext createWebApplicationContext(ApplicationContext parent) {
                      return webApplicationContext;
              }
      };

      // Prepare the context.
      webApplicationContext.refresh();
      webApplicationContext.registerShutdownHook();

      // Initialize the servlet.
      dispatcherServlet.setContextConfigLocation("");
      dispatcherServlet.init(servletConfig);

      return dispatcherServlet.getServletContext();
  }
项目:spring-cloud-dataflow    文件:BootVersionsCompletionProviderTests.java   
@Bean
public AppRegistry appRegistry() {
    final ResourceLoader resourceLoader = new FileSystemResourceLoader();
    return new AppRegistry(new InMemoryUriRegistry(), resourceLoader) {

        /*
         * Pretend there is a boot13 and boot14 source.
         */
        @Override
        public AppRegistration find(String name, ApplicationType type) {
            String filename = name + "-1.0.0.BUILD-SNAPSHOT.jar";
            File file = new File(ROOT, filename);
            if (file.exists()) {
                return new AppRegistration(name, type, file.toURI(), file.toURI());
            }
            else {
                return null;
            }
        }

        @Override
        public List<AppRegistration> findAll() {
            List<AppRegistration> result = new ArrayList<>();
            result.add(find("boot13", ApplicationType.source));
            result.add(find("boot14", ApplicationType.source));
            return result;
        }
    };
}
项目:spring-cloud-dataflow    文件:TestDependencies.java   
@Bean
public DelegatingResourceLoader resourceLoader(MavenProperties mavenProperties) {
    Map<String, ResourceLoader> resourceLoaders = new HashMap<>();
    resourceLoaders.put("maven", new MavenResourceLoader(mavenProperties));
    resourceLoaders.put("file", new FileSystemResourceLoader());

    DelegatingResourceLoader delegatingResourceLoader = new DelegatingResourceLoader(resourceLoaders);
    return delegatingResourceLoader;
}
项目:FinanceAnalytics    文件:AbstractWebPositionResourceTestCase.java   
@BeforeMethod(groups = TestGroup.UNIT)
public void setUp() throws Exception {
  _uriInfo = new MockUriInfo(true);
  _trades = getTrades();
  _secMaster = new InMemorySecurityMaster(new ObjectIdSupplier("Mock"));
  _positionMaster = new InMemoryPositionMaster();
  final MasterConfigSource configSource = new MasterConfigSource(new InMemoryConfigMaster());
  final InMemoryHistoricalTimeSeriesMaster htsMaster = new InMemoryHistoricalTimeSeriesMaster();
  final HistoricalTimeSeriesResolver htsResolver = new DefaultHistoricalTimeSeriesResolver(new DefaultHistoricalTimeSeriesSelector(configSource), htsMaster);
  _htsSource = new MasterHistoricalTimeSeriesSource(htsMaster, htsResolver);
  _securitySource = new InMemorySecuritySource();
  _secLoader = new AbstractSecurityLoader() {
    @Override
    protected SecurityLoaderResult doBulkLoad(SecurityLoaderRequest request) {
      throw new UnsupportedOperationException("load security not supported");
    }
  };
  populateSecMaster();
  _externalSchemes = new HashMap<>();
  _externalSchemes.put(ExternalSchemes.OG_SYNTHETIC_TICKER, ExternalSchemes.OG_SYNTHETIC_TICKER.getName());
  _webPositionsResource = new WebPositionsResource(_positionMaster, _secLoader, _securitySource, _htsSource, _externalSchemes);
  final MockServletContext sc = new MockServletContext("/web-engine", new FileSystemResourceLoader());
  final Configuration cfg = FreemarkerOutputter.createConfiguration();
  cfg.setServletContextForTemplateLoading(sc, "WEB-INF/pages");
  FreemarkerOutputter.init(sc, cfg);
  _webPositionsResource.setServletContext(sc);
  _webPositionsResource.setUriInfo(_uriInfo);
}
项目:kc-rice    文件:NotificationPropertyPlaceholderConfigurer.java   
/**
 * This method consolidates config properties.
 * @param properties
 * @return Properties
 * @throws IOException
 */
protected Properties transformProperties(Properties properties) throws IOException {
    String cfgLocation = System.getProperty(CFG_LOCATION_PROPERTY);

    if (cfgLocation != null) {
        Resource resource = new FileSystemResourceLoader().getResource(cfgLocation);
        if (resource != null && resource.exists()) {
            new DefaultPropertiesPersister().load(properties, resource.getInputStream());
        }
    }

    return properties;
}
项目:TableAliasV60    文件:DataLoaderTest.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {

    String[] contexts = new String[] {
            "classpath:/META-INF/spring/applicationContext.xml",
            "file:src/main/webapp/WEB-INF/spring/web-context.xml" };
    context = new XmlWebApplicationContext();
    context.setConfigLocations(contexts);
    context.setServletContext(new MockServletContext("/webapp",
            new FileSystemResourceLoader()));
    context.refresh();

}
项目:kansalaisaloite    文件:WebSecurityConfig.java   
@Bean
public KeyManager keyManager() {

    if (!Strings.isNullOrEmpty(environment.getProperty("keystore.location"))) {
        try {
            Resource storeFile = new FileSystemResourceLoader().getResource(environment.getProperty("keystore.location"));

            String keystoreKey = environment.getProperty("keystore.key");
            String storePass = environment.getProperty("keystore.password");

            Map<String, String> passwords = new HashMap<>();

            passwords.put(keystoreKey, environment.getProperty("keystore.key.password"));

            KeyStore jceks = KeyStore.getInstance("JCEKS");

            jceks.load(storeFile.getInputStream(), storePass.toCharArray());
            return new JKSKeyManager(storeFile, storePass, passwords, keystoreKey);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } else {
        return new EmptyKeyManager();
    }

}
项目:class-guard    文件:WebMvcConfigurationSupportExtensionTests.java   
@Before
public void setUp() {
    this.webAppContext = new StaticWebApplicationContext();
    this.webAppContext.setServletContext(new MockServletContext(new FileSystemResourceLoader()));
    this.webAppContext.registerSingleton("controller", TestController.class);

    this.webConfig = new TestWebMvcConfigurationSupport();
    this.webConfig.setApplicationContext(this.webAppContext);
    this.webConfig.setServletContext(this.webAppContext.getServletContext());
}
项目:class-guard    文件:Log4jWebConfigurerTests.java   
private void initLogging(String location, boolean refreshInterval) {
    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
    if (refreshInterval) {
        sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
    }
    Log4jWebConfigurer.initLogging(sc);

    try {
        assertLogOutput();
    } finally {
        Log4jWebConfigurer.shutdownLogging(sc);
    }
    assertTrue(MockLog4jAppender.closeCalled);
}
项目:class-guard    文件:Log4jWebConfigurerTests.java   
@Test
public void testLog4jConfigListener() {
    Log4jConfigListener listener = new Log4jConfigListener();

    MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
    sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
    listener.contextInitialized(new ServletContextEvent(sc));

    try {
        assertLogOutput();
    } finally {
        listener.contextDestroyed(new ServletContextEvent(sc));
    }
    assertTrue(MockLog4jAppender.closeCalled);
}
项目:MLDS    文件:AngularTranslateServiceSetup.java   
public void setup() {
    if (AngularTranslateService.getInstance() == null) {
        angularTranslateService = new AngularTranslateService();
    } else {
        angularTranslateService = AngularTranslateService.getInstance();
    }

    mockServletContext = new MockServletContext("src/main/webapp", new FileSystemResourceLoader());
    angularTranslateService.setServletContext(mockServletContext);
}
项目:rice    文件:NotificationPropertyPlaceholderConfigurer.java   
/**
 * This method consolidates config properties.
 * @param properties
 * @return Properties
 * @throws IOException
 */
protected Properties transformProperties(Properties properties) throws IOException {
    String cfgLocation = System.getProperty(CFG_LOCATION_PROPERTY);

    if (cfgLocation != null) {
        Resource resource = new FileSystemResourceLoader().getResource(cfgLocation);
        if (resource != null && resource.exists()) {
            new DefaultPropertiesPersister().load(properties, resource.getInputStream());
        }
    }

    return properties;
}
项目:spring-osgi    文件:OsgiBundleResourceTest.java   
public void testFileWithSpecialCharsInTheNameBeingResolved() throws Exception {
    String name = "file:./target/test-classes/test-file";
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);
    resource = new OsgiBundleResource(bundle, name);

    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:spring-osgi    文件:OsgiBundleResourceTest.java   
public void testFileWithEmptyCharsInTheNameBeingResolved() throws Exception {
    String name = "file:./target/test-classes/test file";
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);
    resource = new OsgiBundleResource(bundle, name);

    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:spring-osgi    文件:OsgiBundleResourceTest.java   
public void testFileWithNormalCharsInTheNameBeingResolved() throws Exception {
    String name = "file:pom.xml";
    FileSystemResourceLoader fileLoader = new FileSystemResourceLoader();
    fileLoader.setClassLoader(getClass().getClassLoader());

    Resource fileRes = fileLoader.getResource(name);

    resource = new OsgiBundleResource(bundle, name);
    testFileVsOsgiFileResolution(fileRes, resource);
}
项目:pagerDutySynchronizer    文件:PagerDutyBridgeService.java   
PagerDutyBridgeService(String statuspageComponentIds, IncidentTypeMarshaller marshallingService, String configFile) {
   statusPageIOComponentIds = Sets.newHashSet();
   for (String componentId : Splitter.on(",").split(statuspageComponentIds)) {
      if (StatusPageIOComponentId.isValid(componentId)) {
         statusPageIOComponentIds.add(StatusPageIOComponentId.valueOf(componentId));
      }
   }

   // load config for incidentTypes and unmarshall them as incidenTypes
   Resource resource = new FileSystemResourceLoader().getResource(configFile);
   incidentTypes = marshallingService.loadIncidentTypes(resource);
}
项目:kuali_rice    文件:NotificationPropertyPlaceholderConfigurer.java   
/**
 * This method consolidates config properties.
 * @param properties
 * @return Properties
 * @throws IOException
 */
protected Properties transformProperties(Properties properties) throws IOException {
    String cfgLocation = System.getProperty(CFG_LOCATION_PROPERTY);

    if (cfgLocation != null) {
        Resource resource = new FileSystemResourceLoader().getResource(cfgLocation);
        if (resource != null && resource.exists()) {
            new DefaultPropertiesPersister().load(properties, resource.getInputStream());
        }
    }

    return properties;
}
项目:spring-spreadsheet    文件:CSVHandlerMethodReturnValueHandlerTest.java   
private static ServletContext servletContext() {
    return new MockServletContext("/", new FileSystemResourceLoader());
}
项目:spring-spreadsheet    文件:ExcelHandlerMethodReturnValueHandlerTest.java   
private static ServletContext servletContext() {
    return new MockServletContext("/", new FileSystemResourceLoader());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ResourceUtils.java   
FileSearchResourceLoader(ClassLoader classLoader) {
    super(classLoader);
    this.files = new FileSystemResourceLoader();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringBootMockServletContext.java   
public SpringBootMockServletContext(String resourceBasePath) {
    this(resourceBasePath, new FileSystemResourceLoader());
}
项目:spring-boot-concourse    文件:ResourceUtils.java   
FileSearchResourceLoader(ClassLoader classLoader) {
    super(classLoader);
    this.files = new FileSystemResourceLoader();
}
项目:spring-boot-concourse    文件:SpringBootMockServletContext.java   
public SpringBootMockServletContext(String resourceBasePath) {
    this(resourceBasePath, new FileSystemResourceLoader());
}
项目:bonita-ui-designer    文件:WorkspaceInitializerTest.java   
@Before
public void initializeWorkspaceInitializer() {
    workspaceInitializer.setServletContext(new MockServletContext(WAR_BASE_PATH, new FileSystemResourceLoader()));
    workspaceInitializer.setMigrations(Arrays.<LiveMigration>asList(pageLiveMigration, widgetLiveMigration));
}