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


Java SecureVault类代码示例

本文整理汇总了Java中org.wso2.carbon.secvault.SecureVault的典型用法代码示例。如果您正苦于以下问题:Java SecureVault类的具体用法?Java SecureVault怎么用?Java SecureVault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getConfigProvider

import org.wso2.carbon.secvault.SecureVault; //导入依赖的package包/类
public static ConfigProvider getConfigProvider(String file) throws ConfigurationException {
    SecureVault secureVault = mock(SecureVault.class);
    try {
        when(secureVault.resolve(anyString())).thenReturn("n3wP4s5w0r4".toCharArray());
    } catch (SecureVaultException e) {
        throw new ConfigurationException("Error resolving secure vault", e);
    }
    Path carbonHome = Paths.get("");
    carbonHome = Paths.get(carbonHome.toString(), "src", "test");
    System.setProperty("carbon.home", carbonHome.toString());
    String filePath = carbonHome.toAbsolutePath() + File.separator + "resources" + File.separator + "conf" +
            File.separator + file;
    Path configurationFilePath = Paths.get(URI.create("file:" + filePath));
    ConfigFileReader configFileReader = new YAMLBasedConfigFileReader(configurationFilePath);
    return new ConfigProviderImpl(configFileReader, secureVault);
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:17,代码来源:TestUtils.java

示例2: setup

import org.wso2.carbon.secvault.SecureVault; //导入依赖的package包/类
@BeforeTest
    public void setup() throws Exception {
        customDeployer = new CustomDeployer();
        artifactsList = new ArrayList<>();
        artifact = new Artifact(new File(getTestResourceFile(DEPLOYER_REPO).getAbsolutePath()
                + File.separator + "sample1.txt"));
        artifact.setType(new ArtifactType<>("txt"));
        artifactsList.add(artifact);
        artifact2 = new Artifact(new File(getTestResourceFile(RUNTIME_DEPLOYER_REPO).getAbsolutePath()
                                         + File.separator + "sample2.txt"));
        artifact2.setType(new ArtifactType<>("txt"));
        artifactsList.add(artifact2);

        SecureVault secureVault = EasyMock.mock(SecureVault.class);
        System.setProperty(org.wso2.carbon.utils.Constants.CARBON_HOME, getTestResourceFile("yaml")
                .getAbsolutePath());
        System.setProperty(org.wso2.carbon.utils.Constants.RUNTIME_PATH, getTestResourceFile("deployment/conf")
                .getAbsolutePath());
        ConfigProvider configProvider = ConfigProviderFactory.getConfigProvider(getResourcePath
                ("yaml", "conf", DEPLOYMENT_YAML).get(), secureVault);
        CarbonRuntime carbonRuntime = CarbonRuntimeFactory
                .createCarbonRuntime(configProvider);
        DataHolder.getInstance().setCarbonRuntime(carbonRuntime);

        DataHolder.getInstance().setConfigProvider(configProvider);

        //start a test message broker
        brokerService = new BrokerService();
        brokerService.setUseJmx(false);
        brokerService.setBrokerName("carbon");
        brokerService.setDataDirectory("target/activemq-data");
        brokerService.start();

        Topic topic = new ActiveMQTopic("topic0");
//        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://carbon?create=false");
        Connection connection = connectionFactory.createConnection();
        connection.setClientID("carbon");
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        topicSubscriber = session.createDurableSubscriber(topic, "durable");
        connection.start();

    }
 
开发者ID:wso2,项目名称:carbon-deployment,代码行数:44,代码来源:DeploymentEngineTest.java


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