本文整理匯總了Java中org.fosstrak.ale.util.SerializerUtil.serializeCCReports方法的典型用法代碼示例。如果您正苦於以下問題:Java SerializerUtil.serializeCCReports方法的具體用法?Java SerializerUtil.serializeCCReports怎麽用?Java SerializerUtil.serializeCCReports使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fosstrak.ale.util.SerializerUtil
的用法示例。
在下文中一共展示了SerializerUtil.serializeCCReports方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test_W8
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
public void test_W8() throws Exception {
//step 1
//step 2
Thread.sleep(21000);
CCSpec ccspec2 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W8_1.xml"));
CCReports ccreport2 = alecc.immediate(ccspec2);
CCReports expectedCcreports2 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W8_1.xml"));
StringWriter expectedSw2 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports2, expectedSw2);
String outExpectedString2 = expectedSw2.toString();
StringWriter sw2 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport2, sw2);
String outString2 = sw2.toString();
Assert.assertEquals(outExpectedString2.substring(outExpectedString2.indexOf("<cmdReports")), outString2.substring(outString2.indexOf("<cmdReports")));
}
示例2: test_W9
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
public void test_W9() throws Exception {
//step 1 URI1, URI3
CCSpec ccspec2 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W9_1.xml"));
alecc.define("commandcycle2", ccspec2);
CCReports ccreport2 = alecc.poll("commandcycle2");
//step 2
//step 3
CCReports expectedCcreports2 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W9_1.xml"));
StringWriter expectedSw2 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports2, expectedSw2);
String outExpectedString2 = expectedSw2.toString();
StringWriter sw2 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport2, sw2);
String outString2 = sw2.toString();
Assert.assertEquals(outExpectedString2.substring(outExpectedString2.indexOf("<cmdReports")), outString2.substring(outString2.indexOf("<cmdReports")));
//step 4 URI2, URI4
CCReports ccreport4 = alecc.poll("commandcycle2");
//step 5
//step 6
CCReports expectedCcreports4 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W9_2.xml"));
StringWriter expectedSw4 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports4, expectedSw4);
String outExpectedString4 = expectedSw4.toString();
StringWriter sw4 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport4, sw4);
String outString4 = sw4.toString();
Assert.assertEquals(outExpectedString4.substring(outExpectedString4.indexOf("<cmdReports")), outString4.substring(outString4.indexOf("<cmdReports")));
}
示例3: test_W10
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
public void test_W10() throws Exception {
//step 1
Thread.sleep(21000);
CCSpec ccspec1 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W10_1.xml"));
alecc.define("commandcycle1", ccspec1);
alecc.subscribe("commandcycle1", "http://localhost:9991");
//step 2
String[] list = alecc.getSubscribers("commandcycle1");
assertTrue(containsInStringArray(list, "http://localhost:9991"));
String ccReportsFromSocket = receiveEcreportsFromSocket(9991);
CCReports ccreports_4_expected = DeserializerUtil.deserializeCCReports(ALEConformanceTest.class.getResourceAsStream("/ccreports/CCReports_W10_1.xml"));
StringWriter expectedsw = new StringWriter();
SerializerUtil.serializeCCReports(ccreports_4_expected, expectedsw);
String outExpectedString = expectedsw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<cmdReports")), ccReportsFromSocket.substring(ccReportsFromSocket.indexOf("<cmdReports")));
//TODO: KILL operation.
//step 3
alecc.unsubscribe("commandcycle1", "http://localhost:9991");
//step 4 : Skip KILL is not implemented.
//CCSpec ccspec4 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W10_2.xml"));
//alecc.define("commandcycle4", ccspec4);
//alecc.subscribe("commandcycle4", "http://localhost:9999");
//step 5
//String[] list2 = alecc.getSubscribers("commandcycle4");
//for(String subcriber : list2) assertEquals("http://localhost:9999", subcriber);
//checking ccreprot4 is correct.
//step 6
//alecc.unsubscribe("commandcycle4", "http://localhost:9999");
}
示例4: getXml
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
/**
* This method serializes cc reports into a xml representation.
*
* @param reports the report to be serialized.
* @return xml representation of the cc reports
* @throws ImplementationException if a implementation exception occurs
*/
protected String getXml(CCReports reports) throws ImplementationException {
CharArrayWriter writer = new CharArrayWriter();
try {
SerializerUtil.serializeCCReports(reports, writer);
} catch (Exception e) {
LOG.debug("could not serialize the reports", e);
throw new ImplementationException("Unable to serialize reports.", e);
}
return writer.toString();
}
示例5: test_W4
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
public void test_W4() throws Exception {
CCSpec ccspec1 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W4_1.xml"));
alecc.define("commandcycle1", ccspec1);
Thread.sleep(21000);
// step 1
alecc.subscribe("commandcycle1", "http://localhost:9995");
// step 2
String[] subscriberNames = alecc.getSubscribers("commandcycle1");
containsInStringArray(subscriberNames, "http://localhost:9995");
String ccReportsFromSocket = receiveEcreportsFromSocket(9995);
CCReports ccreports_4_expected = DeserializerUtil.deserializeCCReports(ALEConformanceTest.class.getResourceAsStream("/ccreports/CCReports_W4_1.xml"));
StringWriter expectedsw = new StringWriter();
SerializerUtil.serializeCCReports(ccreports_4_expected, expectedsw);
String outExpectedString = expectedsw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<cmdReports")), ccReportsFromSocket.substring(ccReportsFromSocket.indexOf("<cmdReports")));
// step 3
alecc.subscribe("commandcycle1", "http://localhost:9996");
// step 4
subscriberNames = alecc.getSubscribers("commandcycle1");
assertTrue(containsInStringArray(subscriberNames, "http://localhost:9995"));
assertTrue(containsInStringArray(subscriberNames, "http://localhost:9996"));
ccReportsFromSocket = receiveEcreportsFromSocket(9996);
ccreports_4_expected = DeserializerUtil.deserializeCCReports(ALEConformanceTest.class.getResourceAsStream("/ccreports/CCReports_W4_1.xml"));
expectedsw = new StringWriter();
SerializerUtil.serializeCCReports(ccreports_4_expected, expectedsw);
outExpectedString = expectedsw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<cmdReports")), ccReportsFromSocket.substring(ccReportsFromSocket.indexOf("<cmdReports")));
// step 5
alecc.unsubscribe("commandcycle1", "http://localhost:9995");
// step 6
subscriberNames = alecc.getSubscribers("commandcycle1");
assertTrue(!containsInStringArray(subscriberNames, "http://localhost:9995"));
// step 7
alecc.unsubscribe("commandcycle1", "http://localhost:9996");
// step 8
subscriberNames = alecc.getSubscribers("commandcycle1");
assertTrue(!containsInStringArray(subscriberNames, "http://localhost:9996"));
// step 9 : repeat 1~8 with TCP Notification URI => skip
// step 10 : repeat 1~8 with File Notification URI => skip
}
示例6: test_W7
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
public void test_W7() throws Exception {
//step 1
//step 2
CCSpec ccspec2 = DeserializerUtil.deserializeCCSpec(getClass().getResourceAsStream("/ccspecs/CCSpec_W7_1.xml"));
alecc.define("commandcycle2", ccspec2);
CCReports ccreport2 = alecc.poll("commandcycle2"); //param1
CCReports expectedCcreports2 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W7_1.xml"));
StringWriter expectedSw2 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports2, expectedSw2);
String outExpectedString2 = expectedSw2.toString();
StringWriter sw2 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport2, sw2);
String outString2 = sw2.toString();
Assert.assertEquals(outExpectedString2.substring(outExpectedString2.indexOf("<cmdReports")), outString2.substring(outString2.indexOf("<cmdReports")));
//step 3
//step 4
CCReports ccreport4 = alecc.poll("commandcycle2"); //param2
CCReports expectedCcreports4 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W7_2.xml"));
StringWriter expectedSw4 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports4, expectedSw4);
String outExpectedString4 = expectedSw4.toString();
StringWriter sw4 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport4, sw4);
String outString4 = sw4.toString();
Assert.assertEquals(outExpectedString4.substring(outExpectedString4.indexOf("<cmdReports")), outString4.substring(outString4.indexOf("<cmdReports")));
//step 5
CCReports ccreport5 = alecc.poll("commandcycle2"); //param2
CCReports expectedCcreports5 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W7_3.xml"));
StringWriter expectedSw5 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports5, expectedSw5);
String outExpectedString5 = expectedSw5.toString();
StringWriter sw5 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport5, sw5);
String outString5 = sw5.toString();
Assert.assertEquals(outExpectedString5.substring(outExpectedString5.indexOf("<cmdReports")), outString5.substring(outString5.indexOf("<cmdReports")));
//step 6
//step 7
CCReports ccreport7 = alecc.poll("commandcycle2"); //param2
CCReports expectedCcreports7 = DeserializerUtil.deserializeCCReports(getClass().getResourceAsStream("/ccreports/CCReports_W7_3.xml"));
StringWriter expectedSw7 = new StringWriter();
SerializerUtil.serializeCCReports(expectedCcreports7, expectedSw7);
String outExpectedString7 = expectedSw7.toString();
StringWriter sw7 = new StringWriter();
SerializerUtil.serializeCCReports(ccreport7, sw7);
String outString7 = sw7.toString();
Assert.assertEquals(outExpectedString7.substring(outExpectedString7.indexOf("<cmdReports")), outString7.substring(outString7.indexOf("<cmdReports")));
}