當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。