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


Java Strings.textFileToString方法代码示例

本文整理汇总了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"));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:KeySelectorFactoryTest.java

示例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"));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:22,代码来源:KeySelectorFactoryTest.java

示例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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:KeySelectorFactoryTest.java

示例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);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:17,代码来源:KeySelectorFactoryTest.java

示例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
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:AssertionConsumerServiceTest.java

示例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
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:AssertionConsumerServiceTest.java

示例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
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:AssertionConsumerServiceTest.java

示例8: setup

import org.oscm.string.Strings; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
    metadataLinebreaks = Strings.textFileToString(FILE_METADATA_LINEBREAKS);
    encodingUtils = new RedirectEncoder();
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:6,代码来源:RedirectEncoderTest.java


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