[xgws-dev] CVS Update: codes/xsul/java/tests/xsul/lead

Aleksander Andrzej Slominski xgws-dev_at_extreme.indiana.edu
Wed May 31 18:14:01 2006


aslom       06/05/31 18:12:56

  Added:       xsul/java/tests/xsul/lead TestXmlNameValueList.java
  Log:
  test xml-name-value-list
  
  Revision  Changes    Path
  1.1                  codes/xsul/java/tests/xsul/lead/TestXmlNameValueList.java
  
  Index: TestXmlNameValueList.java
  ===================================================================
  /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*-  //------100-columns-wide------>|*/
  /*
   * Copyright (c) 2006 Extreme! Lab, Indiana University. All rights reserved.
   *
   * This software is open source. See the bottom of this file for the licence.
   *
   * $Id: TestXmlNameValueList.java,v 1.1 2006/05/31 22:12:56 aslom Exp $
   */
  
  package xsul.lead;
  
  import java.io.ByteArrayInputStream;
  import java.util.Properties;
  import javax.xml.namespace.QName;
  import junit.framework.TestSuite;
  import org.xmlpull.v1.builder.XmlInfosetBuilder;
  import xsul.XmlConstants;
  import xsul.XsulTestCase;
  import xsul.XsulVersion;
  
  /**
   * Tests for converting between different versions of WS-Addressing (mostly to and from WSA 1.0)
   *
   * @version $Revision: 1.1 $
   * @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
   */
  public class TestXmlNameValueList extends XsulTestCase {
      private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
      
      public static void main (String[] args) {
          junit.textui.TestRunner.run (new TestSuite(TestXmlNameValueList.class));
      }
      
      public TestXmlNameValueList(String name) {
          super(name);
      }
      
      
      public void testPropertiesCoversion() throws Exception
      {
          XsulVersion.requireVersion("2.6.1");
          Properties props = new Properties();
          //  properties.load(new FileInputStream("filename.properties"));
          props.load(new ByteArrayInputStream(PROPS.getBytes("UTF8")));
          System.err.println("props="+props);
          XmlNameValueList xmlProps = new XmlNameValueList(new QName("NameListPropertis"), props);
          System.err.println("xmlProps="+builder.serializeToString(xmlProps));
          Properties props2 = xmlProps.toProperties();
          System.err.println("props2="+props);
      }
      
      final private static String PROPS =
          "#Model Domain Configuration parameters\n"+
          "#Wed May 31 11:22:58 EDT 2006\n"+
          "nx=64\n"+
          "ctrlat=39.686\n"+
          "dy=5\n"+
          "ctrlon=-85.941\n"+
          "dx=5\n"+
          "ny=64 \n"+
          "";
      
  }