db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r405889 - /db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java
Date Fri, 12 May 2006 21:40:38 GMT
Author: tomdz
Date: Fri May 12 14:40:37 2006
New Revision: 405889

URL: http://svn.apache.org/viewcvs?rev=405889&view=rev
Log:
Simplified the test case

Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java?rev=405889&r1=405888&r2=405889&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/SqlBuilderTest.java Fri May 12 14:40:37
2006
@@ -1,7 +1,7 @@
 package org.apache.ddlutils;
 
 /*
- * Copyright 1999-2006 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.ddlutils.Platform;
 import org.apache.ddlutils.model.Database;
+import org.apache.ddlutils.model.Table;
 import org.apache.ddlutils.platform.SqlBuilder;
 import org.apache.ddlutils.platform.TestPlatform;
 
@@ -32,63 +32,33 @@
  */
 public class SqlBuilderTest extends TestBase
 {
-    /** The tested model. */
-    private static final String TEST_MODEL =
-        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
-        "<database name='ddlutils'>\n"+
-        "  <table name='TestTable'>\n"+
-        "    <column name='id' autoIncrement='true' type='INTEGER' primaryKey='true'/>\n"+
-        "    <column name='name' type='VARCHAR' size='15'/>\n"+
-        "  </table>\n"+
-        "</database>";
-
     /**
-     * {@inheritDoc}
-     */
-    public void setUp()
-    {
-    }
-
-    /**
-     * Test the updateSql method.
+     * Tests the {@link SqlBuilder#getUpdateSql(Table, Map, boolean)} method.
      */
     public void testUpdateSql()
     {
+        final String modelXml =
+            "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+            "<database name='ddlutils'>\n"+
+            "  <table name='TestTable'>\n"+
+            "    <column name='id' autoIncrement='true' type='INTEGER' primaryKey='true'/>\n"+
+            "    <column name='name' type='VARCHAR' size='15'/>\n"+
+            "  </table>\n"+
+            "</database>";
+
         TestPlatform platform   = new TestPlatform();
         SqlBuilder   sqlBuilder = platform.getSqlBuilder();
-        Database     database   = parseDatabaseFromString(TEST_MODEL);
+        Database     database   = parseDatabaseFromString(modelXml);
         Map          map        = new HashMap();
 
         map.put("name", "ddlutils");
         map.put("id", new Integer(0));
 
+        platform.setDelimitedIdentifierModeOn(true);
+        
         String sql = sqlBuilder.getUpdateSql(database.getTable(0), map, false);
 
         assertEquals("UPDATE \"TestTable\" SET \"name\" = 'ddlutils' WHERE \"id\" = '0'",
                      sql);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected String getDatabaseName()
-    {
-        return null;
-    }
-
-    /**
-     * The tested builder.
-     */
-    public class SqlBuilderImpl extends SqlBuilder
-    {
-        /**
-         * Creates a new instance.
-         * 
-         * @param platform The plaftform this builder belongs to
-         */
-        public SqlBuilderImpl(Platform platform)
-        {
-            super(platform);
-        }
     }
 }



Mime
View raw message