Example usage for org.apache.shiro.io ResourceUtils CLASSPATH_PREFIX

List of usage examples for org.apache.shiro.io ResourceUtils CLASSPATH_PREFIX

Introduction

In this page you can find the example usage for org.apache.shiro.io ResourceUtils CLASSPATH_PREFIX.

Prototype

String CLASSPATH_PREFIX

To view the source code for org.apache.shiro.io ResourceUtils CLASSPATH_PREFIX.

Click Source Link

Document

Resource path prefix that specifies to load from a classpath location, value is classpath:

Usage

From source file:org.apache.aurora.scheduler.app.local.LocalSchedulerMain.java

License:Apache License

public static void main(String[] args) {
    File backupDir = Files.createTempDir();
    backupDir.deleteOnExit();/*w  w  w.j  av  a2 s . co  m*/
    List<String> arguments = ImmutableList.<String>builder().add(args).add("-cluster_name=local")
            .add("-serverset_path=/aurora/local/scheduler").add("-zk_endpoints=localhost:2181")
            .add("-zk_in_proc=true").add("-backup_dir=" + backupDir.getAbsolutePath())
            .add("-mesos_master_address=fake").add("-thermos_executor_path=fake").add("-http_port=8081")
            .add("-http_authentication_mechanism=BASIC")
            .add("-shiro_ini_path=" + ResourceUtils.CLASSPATH_PREFIX
                    + "org/apache/aurora/scheduler/http/api/security/shiro-example.ini")
            .add("-enable_h2_console=true").build();
    SchedulerMain.applyStaticArgumentValues(arguments.toArray(new String[] {}));

    Module persistentStorage = new AbstractModule() {
        @Override
        protected void configure() {
            bind(new TypeLiteral<Boolean>() {
            }).annotatedWith(SnapshotStoreImpl.ExperimentalTaskStore.class).toInstance(false);
            bind(Storage.class).to(Key.get(Storage.class, Storage.Volatile.class));
            bind(NonVolatileStorage.class).to(FakeNonVolatileStorage.class);
            bind(DistributedSnapshotStore.class).toInstance(snapshot -> {
            });
        }
    };

    Module fakeMesos = new AbstractModule() {
        @Override
        protected void configure() {
            bind(DriverSettings.class).toInstance(DRIVER_SETTINGS);
            bind(SchedulerDriver.class).to(FakeMaster.class);
            bind(DriverFactory.class).to(FakeMaster.class);
            bind(FakeMaster.class).in(Singleton.class);
            install(new ClusterSimulatorModule());
        }
    };

    SchedulerMain.flagConfiguredMain(Modules.combine(fakeMesos, persistentStorage, new TierModule()));
}

From source file:org.apache.aurora.scheduler.http.api.security.ShiroIniConverterTest.java

License:Apache License

@Test(expected = ParameterException.class)
public void testDoParseNonexistent() {
    parser.convert(ResourceUtils.CLASSPATH_PREFIX + NONEXISTENT_RESOURCE);
}

From source file:org.apache.aurora.scheduler.http.api.security.ShiroIniParserTest.java

License:Apache License

@Test(expected = ShiroConfigurationException.class)
public void testDoParseNonexistent() {
    parser.doParse(ResourceUtils.CLASSPATH_PREFIX + NONEXISTENT_RESOURCE);
}

From source file:org.ehcache.integrations.shiro.EhcacheShiroManager.java

License:Apache License

private URL getResource() throws MalformedURLException {
    String cacheManagerConfigFile = getCacheManagerConfigFile();
    String configFileWithoutPrefix = stripPrefix(cacheManagerConfigFile);
    if (cacheManagerConfigFile.startsWith(ResourceUtils.CLASSPATH_PREFIX)) {
        return ClassUtils.getResource(configFileWithoutPrefix);
    }/*from   www .  j a va 2 s.c o  m*/

    String url = ResourceUtils.hasResourcePrefix(cacheManagerConfigFile) ? configFileWithoutPrefix
            : cacheManagerConfigFile;

    return new URL(url);
}

From source file:uk.co.q3c.v7.base.config.ConfigUtilTest.java

License:Apache License

@Test
public void shiroFilePathWithExpandedVariable_notFileContext() {

    // given/*from   ww  w. j a v a  2  s  .  c o  m*/
    resourcePath = ResourceUtils.CLASSPATH_PREFIX + "$user.home/directory/filename.txt";
    // when
    String result = ConfigUtil.shiroFilePathWithExpandedVariable(resourcePath);
    // then
    assertThat(result).isEqualTo(resourcePath);
}