本文整理汇总了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);
}
示例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();
}