本文整理匯總了Java中org.fosstrak.ale.util.SerializerUtil.serializeECReports方法的典型用法代碼示例。如果您正苦於以下問題:Java SerializerUtil.serializeECReports方法的具體用法?Java SerializerUtil.serializeECReports怎麽用?Java SerializerUtil.serializeECReports使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fosstrak.ale.util.SerializerUtil
的用法示例。
在下文中一共展示了SerializerUtil.serializeECReports方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getXml
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
/**
* This method serializes ec reports into a xml representation.
*
* @param reports the report to be serialized.
* @return xml representation of the ec reports
* @throws ImplementationException if a implementation exception occurs
*/
protected String getXml(ECReports reports) throws ImplementationException {
CharArrayWriter writer = new CharArrayWriter();
try {
SerializerUtil.serializeECReports(reports, writer);
} catch (Exception e) {
LOG.debug("could not serialize the reports", e);
throw new ImplementationException("Unable to serialize reports.", e);
}
return writer.toString();
}
示例2: getPrettyXml
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
/**
* This method serializes ec reports into a well formed xml representation.
*
* @param reports to serialize
* @return well formed xml representation of the ec reports
* @throws ImplementationException if a implementation exception occurs
*/
protected String getPrettyXml(ECReports reports) throws ImplementationException {
CharArrayWriter writer = new CharArrayWriter();
try {
SerializerUtil.serializeECReports(reports, writer);
} catch (Exception e) {
throw new ImplementationException("Unable to serialize reports", e);
}
return writer.toString();
}
示例3: testSerializeECReports
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void testSerializeECReports() throws Exception {
ECReports ecReports = createDummyECReports();
CharArrayWriter writer = new CharArrayWriter();
SerializerUtil.serializeECReports(ecReports, writer);
String str = writer.toString();
ECReports ecReports2 = DeserializerUtil.deserializeECReports(new ByteArrayInputStream(str.getBytes()));
ensureSame(ecReports, ecReports2);
}
示例4: compareEquals
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
private boolean compareEquals(ECReports ecreport5, ECReports expectedEcreports5)
throws Exception {
StringWriter expectedSw5 = new StringWriter();
SerializerUtil.serializeECReports(expectedEcreports5, expectedSw5);
String outExpectedString5 = expectedSw5.toString();
StringWriter sw5 = new StringWriter();
SerializerUtil.serializeECReports(ecreport5, sw5);
String outString5 = sw5.toString();
return outExpectedString5.substring(outExpectedString5.indexOf("<reports")).equals(outString5.substring(outString5.indexOf("<reports")));
}
示例5: convertToString
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
private String convertToString(ECReports reports) throws Exception {
// convert expected report to string
StringWriter expectedsw = new StringWriter();
SerializerUtil.serializeECReports(reports, expectedsw);
String outExpectedString = expectedsw.toString();
return outExpectedString;
}
示例6: convertToComparableString
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
private String convertToComparableString(ECReports reports) throws Exception {
// convert expected report to string
StringWriter expectedsw = new StringWriter();
SerializerUtil.serializeECReports(reports, expectedsw);
String outExpectedString = expectedsw.toString();
return outExpectedString.substring(outExpectedString.indexOf("<reports>"));
}
示例7: test_R4
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void test_R4() throws Exception {
// precondition : a valid ECSpec has been defined
ECSpec ecspec1 = DeserializerUtil.deserializeECSpec(ALEConformanceTest.class.getResourceAsStream("/ecspecs/ECSpec_R4_1.xml"));
ale.define("ECSpec_R4_1", ecspec1);
// step 1
ale.subscribe("ECSpec_R4_1", "http://localhost:9999");
// step 2
String[] subscriberNames = ale.getSubscribers("ECSpec_R4_1");
containsInStringArray(subscriberNames, "http://localhost:9999");
String ecReportsFromSocket = receiveEcreportsFromSocket(9999);
ECReports ecreports_4_expected = DeserializerUtil.deserializeECReports(ALEConformanceTest.class.getResourceAsStream("/ecreports/ECReports_R4_1_expected.xml"));
StringWriter expectedsw = new StringWriter();
SerializerUtil.serializeECReports(ecreports_4_expected, expectedsw);
String outExpectedString = expectedsw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<reports>")), ecReportsFromSocket.substring(ecReportsFromSocket.indexOf("<reports>")));
// step 3
ale.subscribe("ECSpec_R4_1", "http://localhost:10000");
// step 4
subscriberNames = ale.getSubscribers("ECSpec_R4_1");
assertTrue(containsInStringArray(subscriberNames, "http://localhost:9999"));
assertTrue(containsInStringArray(subscriberNames, "http://localhost:10000"));
// step 5
ale.unsubscribe("ECSpec_R4_1", "http://localhost:9999");
// step 6
subscriberNames = ale.getSubscribers("ECSpec_R4_1");
assertTrue(!containsInStringArray(subscriberNames, "http://localhost:9999"));
// step 7
ale.unsubscribe("ECSpec_R4_1", "http://localhost:10000");
// step 8
subscriberNames = ale.getSubscribers("ECSpec_R4_1");
assertTrue(!containsInStringArray(subscriberNames, "http://localhost:10000"));
// step 9 : repeat 1~8 with TCP Notification URI => skip
// step 10 : repeat 1~8 with File Notification URI => skip
// step 11 : repeat 1~8 with HTTPS Notification URI => skip
// test ended : undefine pre-condition
ale.undefine("ECSpec_R4_1");
}
示例8: printECReports
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
private void printECReports(ECReports ecreports) throws Exception {
SerializerUtil.serializeECReports(ecreports, new OutputStreamWriter(System.out));
System.out.println();
}