/** For testing with JUnit: java org.xmlBlaster.test.cluster.NodeParserTest */
public static void main(String[] args)
{
ServerScope glob = new ServerScope(args);
glob.setUseCluster(true);
ClusterManager m = new ClusterManager(glob, null);
try {
m.init(glob, null);
String xml =
"<clusternode id='heron.mycomp.com'>" +
" <master type='DomainToMaster' version='0.9'>\n" +
" <key queryType='DOMAIN' domain='RUGBY'/>\n" +
" <key queryType='XPATH'>//STOCK</key>\n" +
" <filter type='ContentLength'>\n" +
" 8000\n" +
" </filter>\n" +
" <filter type='ContainsChecker' version='7.1' xy='true'>\n" +
" bug\n" +
" </filter>\n" +
" <someOtherPluginfilter>\n" +
" <![CDATA[\n" +
" ]]>\n" +
" </someOtherPluginfilter>\n" +
" </master>\n" +
"</clusternode>\n";
{
System.out.println("\nmaster message from client ...");
NodeParser nodeParser = new NodeParser(glob, new ClusterNode(glob, new NodeId("heron.mycomp.com"), null), xml);
System.out.println(nodeParser.getClusterNode().toXml());
}
xml =
"<clusternode id='heron.mycomp.com'>\n" +
" <master stratum='1' refid='frodo' type='DomainPlugin' version='2.0' acceptDefault='false' acceptOtherDefault='true'>\n" +
" My own rule\n" +
" </master>\n" +
" <state>\n" +
" <cpu id='0' idle='60'/>\n" +
" <cpu id='1' idle='58'/>\n" +
" <ram free='10657'/>\n" +
" </state>\n" +
"</clusternode>\n";
{
System.out.println("\nFull Message from client ...");
NodeParser nodeParser = new NodeParser(glob, glob.getClusterManager(), xml, null);
System.out.println(nodeParser.getClusterNode().toXml());
}
}
catch(Throwable e) {
e.printStackTrace();