Re: svn commit: r747308 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Tue Feb 24 2009 - 03:42:21 EST

  • Next message: Robert Zeigler: "Re: svn commit: r747308 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java"

    Please notice this one, as I am facing this for the second time. "\n" seems
    not to work properly on Windows when comparing to "encodeAsXML()" result.
    Correct expression is System.getProperty("line.separator")

    2009/2/24 <andre..pache.org>

    > Author: andrey
    > Date: Tue Feb 24 08:38:41 2009
    > New Revision: 747308
    >
    > URL: http://svn.apache.org/viewvc?rev=747308&view=rev
    > Log:
    > fixing test, which fails on windows
    >
    > Modified:
    >
    > cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java
    >
    > Modified:
    > cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java
    > URL:
    > http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java?rev=747308&r1=747307&r2=747308&view=diff
    >
    > ==============================================================================
    > ---
    > cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java
    > (original)
    > +++
    > cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/DataMapTest.java
    > Tue Feb 24 08:38:41 2009
    >.. -402,33 +402,35 @@
    > assertEquals(expectedNames[i], proc.getName());
    > }
    > }
    > -
    > +
    >
    > public void testQuoteSqlIdentifiersEcodeAsXML(){
    > DataMap map = new DataMap("aaa");
    > - map.setQuotingSQLIdentifiers(true);
    > + map.setQuotingSQLIdentifiers(true);
    > StringWriter w = new StringWriter();
    > XMLEncoder e = new XMLEncoder(new PrintWriter(w));
    > -
    > +
    > + String separator = System.getProperty("line.separator");
    > +
    > StringBuffer s = new StringBuffer("<data-map project-version=\"");
    > - s.append(String.valueOf(Project.CURRENT_PROJECT_VERSION));
    > - s.append("\">\n");
    > - s.append("<property name=\"quoteSqlIdentifiers\"
    > value=\"true\"/>\n");
    > - s.append("</data-map>\n");
    > -
    > + s.append(String.valueOf(Project.CURRENT_PROJECT_VERSION));
    > + s.append("\">").append(separator);
    > + s.append("<property name=\"quoteSqlIdentifiers\"
    > value=\"true\"/>").append(separator);
    > + s.append("</data-map>").append(separator);
    > +
    > map.encodeAsXML(e);
    > - assertEquals(w.getBuffer().toString(), s.toString());
    > -
    > - map.setQuotingSQLIdentifiers(false);
    > + assertEquals(w.getBuffer().toString(), s.toString());
    > +
    > + map.setQuotingSQLIdentifiers(false);
    > StringWriter w2 = new StringWriter();
    > XMLEncoder e2 = new XMLEncoder(new PrintWriter(w2));
    > -
    > +
    > StringBuffer s2 = new StringBuffer("<data-map project-version=\"");
    > - s2.append(String.valueOf(Project.CURRENT_PROJECT_VERSION));
    > - s2.append("\">\n");
    > - s2.append("</data-map>\n");
    > + s2.append(String.valueOf(Project.CURRENT_PROJECT_VERSION));
    > + s2.append("\">").append(separator);
    > + s2.append("</data-map>").append(separator);
    > map.encodeAsXML(e2);
    > - assertEquals(w2.getBuffer().toString(), s2.toString());
    > -
    > + assertEquals(w2.getBuffer().toString(), s2.toString());
    > +
    > }
    > }
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Feb 24 2009 - 03:44:49 EST