当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationProperties.forceReload方法代码示例

本文整理汇总了Java中org.apache.atlas.ApplicationProperties.forceReload方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationProperties.forceReload方法的具体用法?Java ApplicationProperties.forceReload怎么用?Java ApplicationProperties.forceReload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.atlas.ApplicationProperties的用法示例。


在下文中一共展示了ApplicationProperties.forceReload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeConfiguration

import org.apache.atlas.ApplicationProperties; //导入方法依赖的package包/类
public static String writeConfiguration(final PropertiesConfiguration configuration) throws Exception {
    String confLocation = System.getProperty("atlas.conf");
    URL url;
    if (confLocation == null) {
        url = BaseSecurityTest.class.getResource("/" + ApplicationProperties.APPLICATION_PROPERTIES);
    } else {
        url = new File(confLocation, ApplicationProperties.APPLICATION_PROPERTIES).toURI().toURL();
    }
    PropertiesConfiguration configuredProperties = new PropertiesConfiguration();
    configuredProperties.load(url);

    configuredProperties.copy(configuration);

    String persistDir = TestUtils.getTempDirectory();
    configuredProperties.setProperty("atlas.authentication.method.file", "true");
    configuredProperties.setProperty("atlas.authentication.method.file.filename", persistDir
            + "/users-credentials");
    configuredProperties.setProperty("atlas.auth.policy.file",persistDir
            + "/policy-store.txt" );
    TestUtils.writeConfiguration(configuredProperties, persistDir + File.separator +
            ApplicationProperties.APPLICATION_PROPERTIES);
    setupUserCredential(persistDir);
    setUpPolicyStore(persistDir);
    ApplicationProperties.forceReload();
    return persistDir;
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:27,代码来源:BaseSecurityTest.java

示例2: testNoConfiguredCredentialProvider

import org.apache.atlas.ApplicationProperties; //导入方法依赖的package包/类
@Test
public void testNoConfiguredCredentialProvider() throws Exception {
    String originalConf = null;
    try {
        originalConf = System.getProperty("atlas.conf");
        System.clearProperty("atlas.conf");
        ApplicationProperties.forceReload();
        secureEmbeddedServer = new SecureEmbeddedServer(securePort, TestUtils.getWarPath());
        secureEmbeddedServer.server.start();

        Assert.fail("Should have thrown an exception");
    } catch (IOException e) {
        Assert.assertEquals(e.getMessage(),
                "No credential provider path configured for storage of certificate store passwords");
    } finally {
        if (secureEmbeddedServer != null) {
            secureEmbeddedServer.server.stop();
        }

        if (originalConf == null) {
            System.clearProperty("atlas.conf");
        } else {
            System.setProperty("atlas.conf", originalConf);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:27,代码来源:SecureEmbeddedServerTestBase.java

示例3: testServerConfiguredUsingCredentialProvider

import org.apache.atlas.ApplicationProperties; //导入方法依赖的package包/类
@Test
public void testServerConfiguredUsingCredentialProvider() throws Exception {
    // setup the configuration
    final PropertiesConfiguration configuration = new PropertiesConfiguration();
    configuration.setProperty(CERT_STORES_CREDENTIAL_PROVIDER_PATH, providerUrl);
    configuration.setProperty("atlas.services.enabled", false);
    configuration.setProperty("atlas.notification.embedded", "false");
    // setup the credential provider
    setupCredentials();

    String persistDir = BaseSecurityTest.writeConfiguration(configuration);
    String originalConf = System.getProperty("atlas.conf");
    System.setProperty("atlas.conf", persistDir);

    ApplicationProperties.forceReload();
    SecureEmbeddedServer secureEmbeddedServer = null;
    try {
        secureEmbeddedServer = new SecureEmbeddedServer(21443, TestUtils.getWarPath()) {
            @Override
            protected PropertiesConfiguration getConfiguration() {
                return configuration;
            }

            @Override
            protected WebAppContext getWebAppContext(String path) {
                WebAppContext application = new WebAppContext(path, "/");
                application.setDescriptor(
                        System.getProperty("projectBaseDir") + "/webapp/src/test/webapp/WEB-INF/web.xml");
                application.setClassLoader(Thread.currentThread().getContextClassLoader());
                return application;
            }

        };
        secureEmbeddedServer.server.start();

        URL url = new URL("https://localhost:21443/api/atlas/admin/status");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        connection.connect();

        // test to see whether server is up and root page can be served
        Assert.assertEquals(connection.getResponseCode(), 200);
    } catch(Throwable e) {
        Assert.fail("War deploy failed", e);
    } finally {
        secureEmbeddedServer.server.stop();

        if (originalConf == null) {
            System.clearProperty("atlas.conf");
        } else {
            System.setProperty("atlas.conf", originalConf);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-atlas,代码行数:55,代码来源:SecureEmbeddedServerTest.java


注:本文中的org.apache.atlas.ApplicationProperties.forceReload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。