" <clientProperty name='StringKey' type='String' encoding='" + Constants.ENCODING_BASE64 + "'>QmxhQmxhQmxh</clientProperty>\n" +
" <persistent>true</persistent>\n" +
"</qos>\n";
I_ConnectQosFactory factory = this.glob.getConnectQosFactory();
ConnectQosData qos = factory.readObject(xml); // parse
assertEquals("", true, qos.getPersistentProp().getValue());
String newXml = qos.toXml(); // dump
qos = factory.readObject(newXml); // parse again
if (log.isLoggable(Level.FINE)) log.fine("ORIG=\n" + xml + "\n NEW=\n" + newXml);
SessionQos sessionQos = qos.getSessionQos();
assertEquals("sessionTimeout failed", sessionTimeout, sessionQos.getSessionTimeout());
if (SessionName.useSessionMarker())
assertEquals("", "/node/avalon/client/joe/session/2", sessionQos.getSessionName().getAbsoluteName());
else
assertEquals("", "/node/avalon/client/joe/2", sessionQos.getSessionName().getAbsoluteName());
assertEquals("", true, sessionQos.hasPublicSessionId());
assertEquals("", 2L, sessionQos.getPublicSessionId());
assertEquals("", sessionTimeout, sessionQos.getSessionTimeout());
assertEquals("", 27, sessionQos.getMaxSessions());
assertEquals("", true, sessionQos.clearSessions());
assertEquals("", "xyz", sessionQos.getSecretSessionId());
assertEquals("", false, qos.isPtpAllowed());
assertEquals("", true, qos.isClusterNode());
assertEquals("", true, qos.isReconnected());
assertEquals("", "/node/heron/instanceId/123445", qos.getInstanceId());
assertEquals("", false, qos.duplicateUpdates());
assertEquals("", true, qos.getPersistentProp().getValue());
{
ClientQueueProperty prop = qos.getClientQueueProperty();
assertEquals("", 22L, prop.getMaxEntries());
assertEquals("", "RAM", prop.getType());
assertEquals("", "4.0", prop.getVersion());
assertEquals("", 44L, prop.getMaxBytes());
AddressBase[] addrArr = prop.getAddresses();
assertEquals("Address array", 1, addrArr.length);
AddressBase addr = addrArr[0];
assertEquals("", "34", addr.getEnv("intKey2", "").getValue());
}
{
CbQueueProperty prop = qos.getSubjectQueueProperty();
assertEquals("", 1009L, prop.getMaxEntries());
assertEquals("", "XY", prop.getType());
assertEquals("", "7.0", prop.getVersion());
assertEquals("", 4009L, prop.getMaxBytes());
assertEquals("", 509L, prop.getMaxEntriesCache());
assertEquals("", 777L, prop.getMaxBytesCache());
/* Currently deactivated in code
assertEquals("", 20009L, prop.getStoreSwapLevel());
assertEquals("", 10000L, prop.getStoreSwapBytes());
assertEquals("", 20000L, prop.getReloadSwapLevel());
assertEquals("", 30000L, prop.getReloadSwapBytes());
*/
assertEquals("", "deadMessage", prop.getOnOverflow());
assertEquals("", true, qos.hasSubjectQueueProperty());
}
{
CbQueueProperty prop = qos.getSessionCbQueueProperty();
assertEquals("", 1600L, prop.getMaxEntries());
AddressBase[] addrArr = prop.getAddresses();
assertEquals("Address array", 1, addrArr.length);
AddressBase addr = addrArr[0];
assertEquals("", 400, addr.getCollectTime());
assertEquals("", 12, addr.getBurstModeMaxEntries());
assertEquals("", 24, addr.getBurstModeMaxBytes());
assertEquals("", "1234", addr.getEnv("intKey1", "").getValue());
System.out.println("GOT: "+addr.getRawAddress());
assertEquals("", "http:/www.mars.universe:8080/RPC2", addr.getRawAddress());
}
assertEquals("Wrong number of clientProperties", 2, qos.getClientProperties().size());
{
String prop = qos.getClientProperty("StringKey", (String)null);
assertTrue("Missing client property", prop != null);
assertEquals("Wrong base64 decoding", "BlaBlaBla", prop); // Base64: QmxhQmxhQmxh -> BlaBlaBla
}
{
int prop = qos.getClientProperty("intKey", -1);
assertEquals("Wrong value", 123, prop);
}
//System.out.println(qos.toXml());
// TODO: check all methods !!!
/*
protected I_ClientPlugin getPlugin(String mechanism, String version) throws XmlBlasterException
public String getSecurityData() {
*/
ServerRef[] refArr = qos.getServerRefs();
assertEquals("", 3, refArr.length);
ServerRef ref = qos.getServerRef();
assertTrue("", ref != null);
/*
public ClientQueueProperty getClientQueueProperty() {
public final I_SecurityQos getSecurityQos() throws XmlBlasterException
public final String getSecurityPluginType() throws XmlBlasterException
public final String getSecurityPluginVersion() throws XmlBlasterException
*/
AddressBase[] addrArr = qos.getAddresses(true);
assertEquals("Address array", 1, addrArr.length);
//Address addr = qos.getAddress();
//assertEquals("", "http:...", addr.getAddress().trim()); // from client queue property
assertEquals("", false, qos.isPtpAllowed());
assertEquals("", "joe", qos.getUserId());
}
catch (XmlBlasterException e) {
fail("testParse failed: " + e.toString());
}