本文整理汇总了Java中org.oscm.string.Strings.textFileToString方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.textFileToString方法的具体用法?Java Strings.textFileToString怎么用?Java Strings.textFileToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.oscm.string.Strings
的用法示例。
在下文中一共展示了Strings.textFileToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newKeySelector_keyinfoEmpty
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void newKeySelector_keyinfoEmpty() throws Exception {
// given
String response = Strings
.textFileToString("javares/openamResponse.xml");
response = response.replaceAll(System.lineSeparator(), "").replaceAll(
"<ds:KeyInfo>.*</ds:KeyInfo>", "<ds:KeyInfo></ds:KeyInfo>");
Document document = XMLConverter.convertToDocument(response, true);
NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
"Signature");
// when
try {
factory.newKeySelector(nl.item(0));
fail();
} catch (DigitalSignatureValidationException e) {
assertTrue(e.getMessage().contains(
"Only RSA/DSA KeyValue and are X509Data supported"));
}
}
示例2: newKeySelector_keyinfoMissing
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void newKeySelector_keyinfoMissing() throws Exception {
// given
String response = Strings
.textFileToString("javares/openamResponse.xml");
response = response.replaceAll(System.lineSeparator(), "").replaceAll(
"<ds:KeyInfo>.*</ds:KeyInfo>", "");
Document document = XMLConverter.convertToDocument(response, true);
NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
"Signature");
try {
// when
factory.newKeySelector(nl.item(0));
fail();
} catch (DigitalSignatureValidationException e) {
// then
assertTrue(e.getMessage().contains(
"No KeyInfo element found in SAML assertion"));
}
}
示例3: newKeySelector_keyValue
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void newKeySelector_keyValue() throws Exception {
// given
String response = Strings
.textFileToString("javares/openamResponse.xml");
Document document = XMLConverter.convertToDocument(
replaceX509WithKeyValueData(response), true);
NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
"Signature");
// when
KeySelector keySelector = factory.newKeySelector(nl.item(0));
// then
assertTrue(keySelector instanceof KeyValueKeySelector);
}
示例4: newKeySelector_firstFound
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void newKeySelector_firstFound() throws Exception {
// given
String response = Strings
.textFileToString("javares/openamResponse.xml");
Document document = XMLConverter.convertToDocument(
addKeyValueAfterX509Data(response), true);
NodeList nl = document.getElementsByTagNameNS(XMLSignature.XMLNS,
"Signature");
// when
KeySelector keySelector = factory.newKeySelector(nl.item(0));
// then
assertTrue(keySelector instanceof X509KeySelector);
}
示例5: validateResponse_Http
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void validateResponse_Http() throws Exception {
// given
acs = new AssertionConsumerService(acsUrl, acsUrlHttps,
FILE_KEYSTORE_OPENAM, "changeit");
String response = Strings.textFileToString(FILE_OPENAM_RESPONSE);
response = response.replace("2013-05-29T10:53:36Z", (Calendar
.getInstance().get(Calendar.YEAR) + 1) + "-05-29T10:53:36Z");
response = response.replace("@RECIPIENT", acsUrl);
// when
acs.validateResponse(response, "4040406c-1530-11e0-e869-0110283f4jj6", tenantID);
// then no exception expected
}
示例6: validateResponse_Https
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test
public void validateResponse_Https() throws Exception {
// given
acs = new AssertionConsumerService(acsUrl, acsUrlHttps,
FILE_KEYSTORE_OPENAM, "changeit");
String response = Strings.textFileToString(FILE_OPENAM_RESPONSE);
response = response.replace("2013-05-29T10:53:36Z", (Calendar
.getInstance().get(Calendar.YEAR) + 1) + "-05-29T10:53:36Z");
response = response.replace("@RECIPIENT", acsUrlHttps);
// when
acs.validateResponse(response, "4040406c-1530-11e0-e869-0110283f4jj6", tenantID);
// then no exception expected
}
示例7: validateResponse_wrongRecipient
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Test(expected = AssertionValidationException.class)
public void validateResponse_wrongRecipient() throws Exception {
// given
acs = new AssertionConsumerService(acsUrl, acsUrlHttps,
FILE_KEYSTORE_OPENAM, "changeit");
String response = Strings.textFileToString(FILE_OPENAM_RESPONSE);
response = response.replace("2013-05-29T10:53:36Z", (Calendar
.getInstance().get(Calendar.YEAR) + 1) + "-05-29T10:53:36Z");
response = response.replace("@RECIPIENT", "https://something.else.de");
// when
acs.validateResponse(response, "4040406c-1530-11e0-e869-0110283f4jj6", tenantID);
// then exception
}
示例8: setup
import org.oscm.string.Strings; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
metadataLinebreaks = Strings.textFileToString(FILE_METADATA_LINEBREAKS);
encodingUtils = new RedirectEncoder();
}