本文整理匯總了Java中org.fosstrak.ale.util.SerializerUtil.serializeLRSpec方法的典型用法代碼示例。如果您正苦於以下問題:Java SerializerUtil.serializeLRSpec方法的具體用法?Java SerializerUtil.serializeLRSpec怎麽用?Java SerializerUtil.serializeLRSpec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.fosstrak.ale.util.SerializerUtil
的用法示例。
在下文中一共展示了SerializerUtil.serializeLRSpec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: decodeResult
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Override
protected void decodeResult(StringBuffer sb, Object result) {
if (result instanceof ArrayOfString) {
ArrayOfString resultStringArray = (ArrayOfString)result;
if (resultStringArray.getString().size() == 0) {
sb.append(m_guiText.getString("EmptyArray"));
} else {
for (String s : resultStringArray.getString()) {
sb.append(s);
sb.append("\n");
}
}
} else if (result instanceof LRSpec) {
CharArrayWriter writer = new CharArrayWriter();
try {
SerializerUtil.serializeLRSpec((LRSpec)result, writer);
} catch (Exception e) {
FosstrakAleClient.instance().showExceptionDialog(m_guiText.getString("SerializationExceptionMessage"));
}
sb.append(writer.toString());
}
}
示例2: testSerializeLRSpec
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void testSerializeLRSpec() throws Exception {
LRSpec lrSpec = createDummyLRSpec();
CharArrayWriter writer = new CharArrayWriter();
SerializerUtil.serializeLRSpec(lrSpec, writer);
String str = writer.toString();
LRSpec lrSpec2 = DeserializerUtil.deserializeLRSpec(new ByteArrayInputStream(str.getBytes()));
ensureSame(lrSpec, lrSpec2);
}
示例3: test_L3
import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void test_L3() throws Exception {
// step 1
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_1_Composite.xml"));
alelr.define("L1", lrspec);
// step 2
List<String> readerNames = alelr.getLogicalReaderNames();
assertTrue(readerNames.contains("L1"));
// step 3
List<String> lrNames = new ArrayList<String>();
lrNames.add("limg00n_emulator");
alelr.addReaders("L1", lrNames);
// step 4
LRSpec spec = alelr.getLRSpec("L1");
//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
StringWriter sw = new StringWriter();
SerializerUtil.serializeLRSpec(spec, sw);
String outString = sw.toString();
LRSpec expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_4_Expected.xml"));
StringWriter expectedSw = new StringWriter();
SerializerUtil.serializeLRSpec(expected, expectedSw);
String outExpectedString = expectedSw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
// step 5
alelr.removeReaders("L1", lrNames);
spec = alelr.getLRSpec("L1");
//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
sw = new StringWriter();
SerializerUtil.serializeLRSpec(spec, sw);
outString = sw.toString();
expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_5_Expected.xml"));
expectedSw = new StringWriter();
SerializerUtil.serializeLRSpec(expected, expectedSw);
outExpectedString = expectedSw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
// step 6
alelr.setReaders("L1", lrNames);
// step 7
spec = alelr.getLRSpec("L1");
//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
sw = new StringWriter();
SerializerUtil.serializeLRSpec(spec, sw);
outString = sw.toString();
expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_7_Expected.xml"));
expectedSw = new StringWriter();
SerializerUtil.serializeLRSpec(expected, expectedSw);
outExpectedString = expectedSw.toString();
Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
// step 8
alelr.undefine("L1");
assertTrue(!alelr.getLogicalReaderNames().contains("L1"));
}