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