cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [14/48] Installing Maven Failsafe Plugin
Date Sun, 02 Nov 2014 07:10:02 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
deleted file mode 100644
index 11af3b8..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.access.jdbc;
-
-import java.sql.Connection;
-import java.sql.Date;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cayenne.DataRow;
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.access.DataNode;
-import org.apache.cayenne.access.MockOperationObserver;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.query.Query;
-import org.apache.cayenne.query.SQLAction;
-import org.apache.cayenne.query.SQLTemplate;
-import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.query.SortOrder;
-import org.apache.cayenne.test.jdbc.DBHelper;
-import org.apache.cayenne.test.jdbc.TableHelper;
-import org.apache.cayenne.testdo.testmap.Artist;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.ServerCaseDataSourceFactory;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-import org.apache.cayenne.unit.util.SQLTemplateCustomizer;
-
-@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
-public class SQLTemplateActionTest extends ServerCase {
-
-    @Inject
-    protected ServerCaseDataSourceFactory dataSourceFactory;
-
-    @Inject
-    protected DataNode node;
-
-    @Inject
-    protected JdbcAdapter adapter;
-
-    @Inject
-    protected ObjectContext objectContext;
-
-    @Inject
-    protected DBHelper dbHelper;
-
-    @Inject
-    protected SQLTemplateCustomizer sqlTemplateCustomizer;
-
-    protected TableHelper tArtist;
-
-    @Override
-    protected void setUpAfterInjection() throws Exception {
-        dbHelper.deleteAll("PAINTING_INFO");
-        dbHelper.deleteAll("PAINTING");
-        dbHelper.deleteAll("ARTIST_EXHIBIT");
-        dbHelper.deleteAll("ARTIST_GROUP");
-        dbHelper.deleteAll("ARTIST");
-
-        tArtist = new TableHelper(dbHelper, "ARTIST");
-        tArtist.setColumns("ARTIST_ID", "ARTIST_NAME", "DATE_OF_BIRTH");
-    }
-
-    protected void createFourArtists() throws Exception {
-
-        Date date = new Date(System.currentTimeMillis());
-
-        tArtist.insert(11, "artist2", date);
-        tArtist.insert(101, "artist3", date);
-        tArtist.insert(201, "artist4", date);
-        tArtist.insert(3001, "artist5", date);
-    }
-
-    public void testProperties() throws Exception {
-        SQLTemplate template = new SQLTemplate(Object.class, "AAAAA");      
-  
-        SQLTemplateAction action = new SQLTemplateAction(template, node);
-        assertSame(template, action.getQuery());
-        assertSame(node, action.dataNode);
-    }
-
-    public void testExecuteSelect() throws Exception {
-        createFourArtists();
-
-        String templateString = "SELECT * FROM ARTIST WHERE ARTIST_ID = #bind($id)";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-        sqlTemplateCustomizer.updateSQLTemplate(template);
-
-        Map<String, Object> bindings = new HashMap<String, Object>();
-        bindings.put("id", 201l);
-        template.setParameters(bindings);
-
-        // must ensure the right SQLTemplateAction is created
-
-        SQLAction plan = adapter.getAction(template, node);
-        assertTrue(plan instanceof SQLTemplateAction);
-
-        MockOperationObserver observer = new MockOperationObserver();
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-
-        try {
-            plan.performAction(c, observer);
-        }
-        finally {
-            c.close();
-        }
-
-        List<DataRow> rows = observer.rowsForQuery(template);
-        assertNotNull(rows);
-        assertEquals(1, rows.size());
-        DataRow row = rows.get(0);
-
-        // In the absence of ObjEntity most DB's return a Long here, except for Oracle
-        // that has no BIGINT type and
-        // returns BigDecimal, so do a Number comparison
-        Number id = (Number) row.get("ARTIST_ID");
-        assertNotNull(id);
-        assertEquals(((Number) bindings.get("id")).longValue(), id.longValue());
-        assertEquals("artist4", row.get("ARTIST_NAME"));
-        assertTrue(row.containsKey("DATE_OF_BIRTH"));
-    }
-
-    public void testSelectUtilDate() throws Exception {
-        createFourArtists();
-
-        String templateString = "SELECT #result('DATE_OF_BIRTH' 'java.util.Date' 'DOB') "
-                + "FROM ARTIST WHERE ARTIST_ID = #bind($id)";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-        sqlTemplateCustomizer.updateSQLTemplate(template);
-
-        Map<String, Object> bindings = new HashMap<String, Object>();
-        bindings.put("id", 101);
-        template.setParameters(bindings);
-
-        SQLAction plan = adapter.getAction(template, node);
-
-        MockOperationObserver observer = new MockOperationObserver();
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-
-        try {
-            plan.performAction(c, observer);
-        }
-        finally {
-            c.close();
-        }
-
-        List<DataRow> rows = observer.rowsForQuery(template);
-        assertNotNull(rows);
-        assertEquals(1, rows.size());
-        DataRow row = rows.get(0);
-
-        assertNotNull(row.get("DOB"));
-        assertEquals(java.util.Date.class, row.get("DOB").getClass());
-    }
-
-    public void testSelectSQLDate() throws Exception {
-        createFourArtists();
-
-        String templateString = "SELECT #result('DATE_OF_BIRTH' 'java.sql.Date' 'DOB') "
-                + "FROM ARTIST WHERE ARTIST_ID = #bind($id)";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-        sqlTemplateCustomizer.updateSQLTemplate(template);
-
-        Map<String, Object> bindings = new HashMap<String, Object>();
-        bindings.put("id", 101);
-        template.setParameters(bindings);
-
-        SQLAction plan = adapter.getAction(template, node);
-
-        MockOperationObserver observer = new MockOperationObserver();
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-
-        try {
-            plan.performAction(c, observer);
-        }
-        finally {
-            c.close();
-        }
-
-        List<DataRow> rows = observer.rowsForQuery(template);
-        assertNotNull(rows);
-        assertEquals(1, rows.size());
-        DataRow row = rows.get(0);
-
-        assertNotNull(row.get("DOB"));
-        assertEquals(java.sql.Date.class, row.get("DOB").getClass());
-    }
-
-    public void testSelectSQLTimestamp() throws Exception {
-        createFourArtists();
-
-        String templateString = "SELECT #result('DATE_OF_BIRTH' 'java.sql.Timestamp' 'DOB') "
-                + "FROM ARTIST WHERE ARTIST_ID = #bind($id)";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-        sqlTemplateCustomizer.updateSQLTemplate(template);
-
-        Map<String, Object> bindings = new HashMap<String, Object>();
-        bindings.put("id", 201);
-        template.setParameters(bindings);
-
-        SQLAction plan = adapter.getAction(template, node);
-
-        MockOperationObserver observer = new MockOperationObserver();
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-
-        try {
-            plan.performAction(c, observer);
-        }
-        finally {
-            c.close();
-        }
-
-        List<DataRow> rows = observer.rowsForQuery(template);
-        assertNotNull(rows);
-        assertEquals(1, rows.size());
-        DataRow row = rows.get(0);
-
-        assertNotNull(row.get("DOB"));
-        // Sybase returns a Timestamp subclass... so can't test equality
-        assertTrue(java.sql.Timestamp.class.isAssignableFrom(row.get("DOB").getClass()));
-    }
-
-    public void testExecuteUpdate() throws Exception {
-        String templateString = "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME, DATE_OF_BIRTH) "
-                + "VALUES (#bind($id), #bind($name), #bind($dob 'DATE'))";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-
-        Map<String, Object> bindings = new HashMap<String, Object>();
-        bindings.put("id", new Long(1));
-        bindings.put("name", "a1");
-        bindings.put("dob", new Date(System.currentTimeMillis()));
-        template.setParameters(bindings);
-
-        SQLAction action = adapter.getAction(template, node);
-
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-        try {
-            MockOperationObserver observer = new MockOperationObserver();
-            action.performAction(c, observer);
-
-            int[] batches = observer.countsForQuery(template);
-            assertNotNull(batches);
-            assertEquals(1, batches.length);
-            assertEquals(1, batches[0]);
-        }
-        finally {
-            c.close();
-        }
-
-        assertEquals(1, tArtist.getRowCount());
-        assertEquals(1l, tArtist.getLong("ARTIST_ID"));
-        assertEquals("a1", tArtist.getString("ARTIST_NAME").trim());
-    }
-
-    public void testExecuteUpdateNoParameters() throws Exception {
-        createFourArtists();
-
-        SQLTemplate template = new SQLTemplate(
-                Object.class,
-                "delete from ARTIST where ARTIST_NAME like 'a%'");
-
-        SQLAction action = adapter.getAction(template, node);
-
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-        try {
-            MockOperationObserver observer = new MockOperationObserver();
-            action.performAction(c, observer);
-
-            int[] batches = observer.countsForQuery(template);
-            assertNotNull(batches);
-            assertEquals(1, batches.length);
-            assertEquals(4, batches[0]);
-        }
-        finally {
-            c.close();
-        }
-    }
-
-    public void testExecuteUpdateBatch() throws Exception {
-        String templateString = "INSERT INTO ARTIST (ARTIST_ID, ARTIST_NAME, DATE_OF_BIRTH) "
-                + "VALUES (#bind($id), #bind($name), #bind($dob 'DATE'))";
-        SQLTemplate template = new SQLTemplate(Object.class, templateString);
-
-        Map<String, Object> bindings1 = new HashMap<String, Object>();
-        bindings1.put("id", new Long(1));
-        bindings1.put("name", "a1");
-        bindings1.put("dob", new Date(System.currentTimeMillis()));
-
-        Map<String, Object> bindings2 = new HashMap<String, Object>();
-        bindings2.put("id", new Long(33));
-        bindings2.put("name", "a$$$$$");
-        bindings2.put("dob", new Date(System.currentTimeMillis()));
-        template.setParameters(new Map[] {
-                bindings1, bindings2
-        });
-
-        SQLAction genericAction = adapter.getAction(template, node);
-        assertTrue(genericAction instanceof SQLTemplateAction);
-        SQLTemplateAction action = (SQLTemplateAction) genericAction;
-
-        assertSame(node, action.dataNode);
-        assertSame(template, action.getQuery());
-
-        Connection c = dataSourceFactory.getSharedDataSource().getConnection();
-        try {
-            MockOperationObserver observer = new MockOperationObserver();
-            action.performAction(c, observer);
-
-            int[] batches = observer.countsForQuery(template);
-            assertNotNull(batches);
-            assertEquals(2, batches.length);
-            assertEquals(1, batches[0]);
-            assertEquals(1, batches[1]);
-        }
-        finally {
-            c.close();
-        }
-
-        MockOperationObserver observer = new MockOperationObserver();
-        SelectQuery query = new SelectQuery(Artist.class);
-        query.addOrdering("db:ARTIST_ID", SortOrder.ASCENDING);
-        node.performQueries(Collections.singletonList((Query) query), observer);
-
-        List<DataRow> data = observer.rowsForQuery(query);
-        assertEquals(2, data.size());
-        DataRow row1 = data.get(0);
-        assertEquals(bindings1.get("id"), row1.get("ARTIST_ID"));
-        assertEquals(bindings1.get("name"), row1.get("ARTIST_NAME"));
-        // to compare dates we need to create the binding correctly
-        // assertEquals(bindings1.get("dob"), row.get("DATE_OF_BIRTH"));
-
-        DataRow row2 = data.get(1);
-        assertEquals(bindings2.get("id"), row2.get("ARTIST_ID"));
-        assertEquals(bindings2.get("name"), row2.get("ARTIST_NAME"));
-        // to compare dates we need to create the binding correctly
-        // assertEquals(bindings2.get("dob"), row2.get("DATE_OF_BIRTH"));
-    }
-
-    public void testExtractTemplateString() throws Exception {
-        SQLTemplate template = new SQLTemplate(Artist.class, "A\nBC");
-        SQLTemplateAction action = new SQLTemplateAction(template, node);
-
-        assertEquals("A BC", action.extractTemplateString());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
new file mode 100644
index 0000000..40849fd
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
@@ -0,0 +1,98 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.access.jdbc;
+
+import org.apache.cayenne.DataRow;
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.jdbc.DBHelper;
+import org.apache.cayenne.testdo.testmap.ClobTestEntity;
+import org.apache.cayenne.testdo.testmap.ClobTestRelation;
+import org.apache.cayenne.unit.UnitDbAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import java.util.List;
+
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class SelectActionIT extends ServerCase {
+
+    @Inject
+    private DataContext context;
+
+    @Inject
+    private UnitDbAdapter accessStackAdapter;
+
+    @Inject
+    private DBHelper dbHelper;
+
+    @Override
+    protected void setUpAfterInjection() throws Exception {
+        dbHelper.deleteAll("CLOB_TEST_RELATION");
+        
+        if (accessStackAdapter.supportsLobs()) {
+            dbHelper.deleteAll("CLOB_TEST");
+        }
+    }
+
+    public void testFetchLimit_DistinctResultIterator() throws Exception {
+        if (accessStackAdapter.supportsLobs()) {
+
+            insertClobDb();
+
+            Expression qual = Expression.fromString("clobValue.value = 100");
+            SelectQuery select = new SelectQuery(ClobTestEntity.class, qual);
+            select.setFetchLimit(25);
+            List<DataRow> resultRows = context.performQuery(select);
+
+            assertNotNull(resultRows);
+            assertEquals(25, resultRows.size());
+        }
+    }
+
+    protected void insertClobDb() {
+        ClobTestEntity obj;
+        for (int i = 0; i < 80; i++) {
+            if (i < 20) {
+                obj = (ClobTestEntity) context.newObject("ClobTestEntity");
+                obj.setClobCol("a1" + i);
+                insetrClobRel(obj);
+            }
+            else {
+                obj = (ClobTestEntity) context.newObject("ClobTestEntity");
+                obj.setClobCol("a2");
+                insetrClobRel(obj);
+            }
+        }
+
+        context.commitChanges();
+    }
+
+    protected void insetrClobRel(ClobTestEntity clobId) {
+        ClobTestRelation obj;
+
+        for (int i = 0; i < 20; i++) {
+            obj = (ClobTestRelation) context.newObject("ClobTestRelation");
+            obj.setValue(100);
+            obj.setClobId(clobId);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
deleted file mode 100644
index 2e94cbb..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.access.jdbc;
-
-import java.util.List;
-
-import org.apache.cayenne.DataRow;
-import org.apache.cayenne.access.DataContext;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.exp.Expression;
-import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.test.jdbc.DBHelper;
-import org.apache.cayenne.testdo.testmap.ClobTestEntity;
-import org.apache.cayenne.testdo.testmap.ClobTestRelation;
-import org.apache.cayenne.unit.UnitDbAdapter;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-
-@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
-public class SelectActionTest extends ServerCase {
-
-    @Inject
-    private DataContext context;
-
-    @Inject
-    private UnitDbAdapter accessStackAdapter;
-
-    @Inject
-    private DBHelper dbHelper;
-
-    @Override
-    protected void setUpAfterInjection() throws Exception {
-        dbHelper.deleteAll("CLOB_TEST_RELATION");
-        
-        if (accessStackAdapter.supportsLobs()) {
-            dbHelper.deleteAll("CLOB_TEST");
-        }
-    }
-
-    public void testFetchLimit_DistinctResultIterator() throws Exception {
-        if (accessStackAdapter.supportsLobs()) {
-
-            insertClobDb();
-
-            Expression qual = Expression.fromString("clobValue.value = 100");
-            SelectQuery select = new SelectQuery(ClobTestEntity.class, qual);
-            select.setFetchLimit(25);
-            List<DataRow> resultRows = context.performQuery(select);
-
-            assertNotNull(resultRows);
-            assertEquals(25, resultRows.size());
-        }
-    }
-
-    protected void insertClobDb() {
-        ClobTestEntity obj;
-        for (int i = 0; i < 80; i++) {
-            if (i < 20) {
-                obj = (ClobTestEntity) context.newObject("ClobTestEntity");
-                obj.setClobCol("a1" + i);
-                insetrClobRel(obj);
-            }
-            else {
-                obj = (ClobTestEntity) context.newObject("ClobTestEntity");
-                obj.setClobCol("a2");
-                insetrClobRel(obj);
-            }
-        }
-
-        context.commitChanges();
-    }
-
-    protected void insetrClobRel(ClobTestEntity clobId) {
-        ClobTestRelation obj;
-
-        for (int i = 0; i < 20; i++) {
-            obj = (ClobTestRelation) context.newObject("ClobTestRelation");
-            obj.setValue(100);
-            obj.setClobId(clobId);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorIT.java
new file mode 100644
index 0000000..542f7cd
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorIT.java
@@ -0,0 +1,136 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.translator.batch;
+
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.query.BatchQuery;
+import org.apache.cayenne.query.BatchQueryRow;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import java.sql.Types;
+
+import static org.mockito.Mockito.mock;
+
+@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
+public class DefaultBatchTranslatorIT extends ServerCase {
+
+    @Inject
+    private AdhocObjectFactory objectFactory;
+
+    public void testConstructor() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, null) {
+            @Override
+            protected String createSql() {
+                return null;
+            }
+
+            @Override
+            protected BatchParameterBinding[] createBindings() {
+                return new BatchParameterBinding[0];
+            }
+
+            @Override
+            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
+                return new BatchParameterBinding[0];
+            }
+        };
+
+        assertSame(adapter, builder.adapter);
+    }
+
+    public void testAppendDbAttribute1() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        String trimFunction = "testTrim";
+
+        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, trimFunction) {
+
+            @Override
+            protected String createSql() {
+                return null;
+            }
+
+            @Override
+            protected BatchParameterBinding[] createBindings() {
+                return new BatchParameterBinding[0];
+            }
+
+            @Override
+            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
+                return new BatchParameterBinding[0];
+            }
+        };
+
+        StringBuilder buf = new StringBuilder();
+        DbEntity entity = new DbEntity("Test");
+        DbAttribute attr = new DbAttribute("testAttr", Types.CHAR, null);
+        attr.setEntity(entity);
+        builder.appendDbAttribute(buf, attr);
+        assertEquals("testTrim(testAttr)", buf.toString());
+
+        buf = new StringBuilder();
+        attr = new DbAttribute("testAttr", Types.VARCHAR, null);
+        attr.setEntity(entity);
+        builder.appendDbAttribute(buf, attr);
+        assertEquals("testAttr", buf.toString());
+    }
+
+    public void testAppendDbAttribute2() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+
+        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, null) {
+            @Override
+            protected String createSql() {
+                return null;
+            }
+
+            @Override
+            protected BatchParameterBinding[] createBindings() {
+                return new BatchParameterBinding[0];
+            }
+
+            @Override
+            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
+                return new BatchParameterBinding[0];
+            }
+        };
+
+        StringBuilder buf = new StringBuilder();
+        DbEntity entity = new DbEntity("Test");
+
+        DbAttribute attr = new DbAttribute("testAttr", Types.CHAR, null);
+        attr.setEntity(entity);
+        builder.appendDbAttribute(buf, attr);
+        assertEquals("testAttr", buf.toString());
+
+        buf = new StringBuilder();
+        attr = new DbAttribute("testAttr", Types.VARCHAR, null);
+        attr.setEntity(entity);
+
+        builder.appendDbAttribute(buf, attr);
+        assertEquals("testAttr", buf.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorTest.java
deleted file mode 100644
index 53af3b7..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DefaultBatchTranslatorTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.access.translator.batch;
-
-import static org.mockito.Mockito.mock;
-
-import java.sql.Types;
-
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.query.BatchQuery;
-import org.apache.cayenne.query.BatchQueryRow;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-
-@UseServerRuntime(ServerCase.TESTMAP_PROJECT)
-public class DefaultBatchTranslatorTest extends ServerCase {
-
-    @Inject
-    private AdhocObjectFactory objectFactory;
-
-    public void testConstructor() throws Exception {
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, null) {
-            @Override
-            protected String createSql() {
-                return null;
-            }
-
-            @Override
-            protected BatchParameterBinding[] createBindings() {
-                return new BatchParameterBinding[0];
-            }
-
-            @Override
-            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
-                return new BatchParameterBinding[0];
-            }
-        };
-
-        assertSame(adapter, builder.adapter);
-    }
-
-    public void testAppendDbAttribute1() throws Exception {
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-        String trimFunction = "testTrim";
-
-        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, trimFunction) {
-
-            @Override
-            protected String createSql() {
-                return null;
-            }
-
-            @Override
-            protected BatchParameterBinding[] createBindings() {
-                return new BatchParameterBinding[0];
-            }
-
-            @Override
-            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
-                return new BatchParameterBinding[0];
-            }
-        };
-
-        StringBuilder buf = new StringBuilder();
-        DbEntity entity = new DbEntity("Test");
-        DbAttribute attr = new DbAttribute("testAttr", Types.CHAR, null);
-        attr.setEntity(entity);
-        builder.appendDbAttribute(buf, attr);
-        assertEquals("testTrim(testAttr)", buf.toString());
-
-        buf = new StringBuilder();
-        attr = new DbAttribute("testAttr", Types.VARCHAR, null);
-        attr.setEntity(entity);
-        builder.appendDbAttribute(buf, attr);
-        assertEquals("testAttr", buf.toString());
-    }
-
-    public void testAppendDbAttribute2() throws Exception {
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-
-        DefaultBatchTranslator builder = new DefaultBatchTranslator(mock(BatchQuery.class), adapter, null) {
-            @Override
-            protected String createSql() {
-                return null;
-            }
-
-            @Override
-            protected BatchParameterBinding[] createBindings() {
-                return new BatchParameterBinding[0];
-            }
-
-            @Override
-            protected BatchParameterBinding[] doUpdateBindings(BatchQueryRow row) {
-                return new BatchParameterBinding[0];
-            }
-        };
-
-        StringBuilder buf = new StringBuilder();
-        DbEntity entity = new DbEntity("Test");
-
-        DbAttribute attr = new DbAttribute("testAttr", Types.CHAR, null);
-        attr.setEntity(entity);
-        builder.appendDbAttribute(buf, attr);
-        assertEquals("testAttr", buf.toString());
-
-        buf = new StringBuilder();
-        attr = new DbAttribute("testAttr", Types.VARCHAR, null);
-        attr.setEntity(entity);
-
-        builder.appendDbAttribute(buf, attr);
-        assertEquals("testAttr", buf.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorIT.java
new file mode 100644
index 0000000..e43e8bd
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorIT.java
@@ -0,0 +1,153 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.translator.batch;
+
+import org.apache.cayenne.configuration.server.ServerRuntime;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.query.DeleteBatchQuery;
+import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
+import org.apache.cayenne.unit.UnitDbAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.mockito.Mockito.mock;
+
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class DeleteBatchTranslatorIT extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private DbAdapter adapter;
+
+    @Inject
+    private UnitDbAdapter unitAdapter;
+
+    @Inject
+    private AdhocObjectFactory objectFactory;
+
+    public void testConstructor() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+
+        DeleteBatchTranslator builder = new DeleteBatchTranslator(mock(DeleteBatchQuery.class), adapter, null);
+
+        assertSame(adapter, builder.adapter);
+    }
+
+    public void testCreateSqlString() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+
+        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
+
+        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
+
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("DELETE FROM " + entity.getName() + " WHERE LOCKING_TEST_ID = ?", generatedSql);
+    }
+
+    public void testCreateSqlStringWithNulls() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+
+        List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
+                entity.getAttribute("NAME"));
+
+        Collection<String> nullAttributes = Collections.singleton("NAME");
+
+        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
+
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("DELETE FROM " + entity.getName() + " WHERE LOCKING_TEST_ID = ? AND NAME IS NULL", generatedSql);
+    }
+
+    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
+
+            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+            DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
+            String generatedSql = builder.getSql();
+
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+
+            assertNotNull(generatedSql);
+            assertEquals("DELETE FROM " + charStart + entity.getName() + charEnd + " WHERE " + charStart
+                    + "LOCKING_TEST_ID" + charEnd + " = ?", generatedSql);
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+
+    }
+
+    public void testCreateSqlStringWithNullsWithIdentifiersQuote() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+
+            List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
+                    entity.getAttribute("NAME"));
+
+            Collection<String> nullAttributes = Collections.singleton("NAME");
+
+            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
+
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
+            DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
+            String generatedSql = builder.getSql();
+
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+            assertNotNull(generatedSql);
+
+            assertEquals("DELETE FROM " + charStart + entity.getName() + charEnd + " WHERE " + charStart
+                    + "LOCKING_TEST_ID" + charEnd + " = ? AND " + charStart + "NAME" + charEnd + " IS NULL",
+                    generatedSql);
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorTest.java
deleted file mode 100644
index b91b882..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/DeleteBatchTranslatorTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.access.translator.batch;
-
-import static org.mockito.Mockito.mock;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.cayenne.access.translator.batch.DeleteBatchTranslator;
-import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.query.DeleteBatchQuery;
-import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
-import org.apache.cayenne.unit.UnitDbAdapter;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-
-@UseServerRuntime(ServerCase.LOCKING_PROJECT)
-public class DeleteBatchTranslatorTest extends ServerCase {
-
-    @Inject
-    private ServerRuntime runtime;
-
-    @Inject
-    private DbAdapter adapter;
-
-    @Inject
-    private UnitDbAdapter unitAdapter;
-
-    @Inject
-    private AdhocObjectFactory objectFactory;
-
-    public void testConstructor() throws Exception {
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-
-        DeleteBatchTranslator builder = new DeleteBatchTranslator(mock(DeleteBatchQuery.class), adapter, null);
-
-        assertSame(adapter, builder.adapter);
-    }
-
-    public void testCreateSqlString() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-
-        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
-
-        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
-
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-        DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
-        String generatedSql = builder.getSql();
-        assertNotNull(generatedSql);
-        assertEquals("DELETE FROM " + entity.getName() + " WHERE LOCKING_TEST_ID = ?", generatedSql);
-    }
-
-    public void testCreateSqlStringWithNulls() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-
-        List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
-                entity.getAttribute("NAME"));
-
-        Collection<String> nullAttributes = Collections.singleton("NAME");
-
-        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
-
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-        DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
-        String generatedSql = builder.getSql();
-        assertNotNull(generatedSql);
-        assertEquals("DELETE FROM " + entity.getName() + " WHERE LOCKING_TEST_ID = ? AND NAME IS NULL", generatedSql);
-    }
-
-    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-        try {
-
-            entity.getDataMap().setQuotingSQLIdentifiers(true);
-            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
-
-            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
-            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
-            DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
-            String generatedSql = builder.getSql();
-
-            String charStart = unitAdapter.getIdentifiersStartQuote();
-            String charEnd = unitAdapter.getIdentifiersEndQuote();
-
-            assertNotNull(generatedSql);
-            assertEquals("DELETE FROM " + charStart + entity.getName() + charEnd + " WHERE " + charStart
-                    + "LOCKING_TEST_ID" + charEnd + " = ?", generatedSql);
-        } finally {
-            entity.getDataMap().setQuotingSQLIdentifiers(false);
-        }
-
-    }
-
-    public void testCreateSqlStringWithNullsWithIdentifiersQuote() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-        try {
-
-            entity.getDataMap().setQuotingSQLIdentifiers(true);
-
-            List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"),
-                    entity.getAttribute("NAME"));
-
-            Collection<String> nullAttributes = Collections.singleton("NAME");
-
-            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
-
-            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
-
-            DeleteBatchTranslator builder = new DeleteBatchTranslator(deleteQuery, adapter, null);
-            String generatedSql = builder.getSql();
-
-            String charStart = unitAdapter.getIdentifiersStartQuote();
-            String charEnd = unitAdapter.getIdentifiersEndQuote();
-            assertNotNull(generatedSql);
-
-            assertEquals("DELETE FROM " + charStart + entity.getName() + charEnd + " WHERE " + charStart
-                    + "LOCKING_TEST_ID" + charEnd + " = ? AND " + charStart + "NAME" + charEnd + " IS NULL",
-                    generatedSql);
-        } finally {
-            entity.getDataMap().setQuotingSQLIdentifiers(false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorIT.java
new file mode 100644
index 0000000..1a631db
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorIT.java
@@ -0,0 +1,93 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.access.translator.batch;
+
+import org.apache.cayenne.configuration.server.ServerRuntime;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.query.InsertBatchQuery;
+import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
+import org.apache.cayenne.unit.UnitDbAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import static org.mockito.Mockito.mock;
+
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class InsertBatchTranslatorIT extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private DbAdapter adapter;
+
+    @Inject
+    private UnitDbAdapter unitAdapter;
+
+    @Inject
+    private AdhocObjectFactory objectFactory;
+
+    public void testConstructor() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+
+        InsertBatchTranslator builder = new InsertBatchTranslator(mock(InsertBatchQuery.class), adapter);
+
+        assertSame(adapter, builder.adapter);
+    }
+
+    public void testCreateSqlString() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        InsertBatchQuery insertQuery = new InsertBatchQuery(entity, 1);
+        InsertBatchTranslator builder = new InsertBatchTranslator(insertQuery, adapter);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("INSERT INTO " + entity.getName() + " (DESCRIPTION, LOCKING_TEST_ID, NAME) VALUES (?, ?, ?)",
+                generatedSql);
+    }
+
+    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
+            InsertBatchQuery insertQuery = new InsertBatchQuery(entity, 1);
+            InsertBatchTranslator builder = new InsertBatchTranslator(insertQuery, adapter);
+            String generatedSql = builder.getSql();
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+            assertNotNull(generatedSql);
+            assertEquals("INSERT INTO " + charStart + entity.getName() + charEnd + " (" + charStart + "DESCRIPTION"
+                    + charEnd + ", " + charStart + "LOCKING_TEST_ID" + charEnd + ", " + charStart + "NAME" + charEnd
+                    + ") VALUES (?, ?, ?)", generatedSql);
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorTest.java
deleted file mode 100644
index 3d1e5de..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/InsertBatchTranslatorTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.access.translator.batch;
-
-import static org.mockito.Mockito.mock;
-
-import org.apache.cayenne.access.translator.batch.InsertBatchTranslator;
-import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.query.InsertBatchQuery;
-import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
-import org.apache.cayenne.unit.UnitDbAdapter;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-
-@UseServerRuntime(ServerCase.LOCKING_PROJECT)
-public class InsertBatchTranslatorTest extends ServerCase {
-
-    @Inject
-    private ServerRuntime runtime;
-
-    @Inject
-    private DbAdapter adapter;
-
-    @Inject
-    private UnitDbAdapter unitAdapter;
-
-    @Inject
-    private AdhocObjectFactory objectFactory;
-
-    public void testConstructor() throws Exception {
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-
-        InsertBatchTranslator builder = new InsertBatchTranslator(mock(InsertBatchQuery.class), adapter);
-
-        assertSame(adapter, builder.adapter);
-    }
-
-    public void testCreateSqlString() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-
-        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
-        InsertBatchQuery insertQuery = new InsertBatchQuery(entity, 1);
-        InsertBatchTranslator builder = new InsertBatchTranslator(insertQuery, adapter);
-        String generatedSql = builder.getSql();
-        assertNotNull(generatedSql);
-        assertEquals("INSERT INTO " + entity.getName() + " (DESCRIPTION, LOCKING_TEST_ID, NAME) VALUES (?, ?, ?)",
-                generatedSql);
-    }
-
-    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
-        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
-                .getDbEntity();
-        try {
-
-            entity.getDataMap().setQuotingSQLIdentifiers(true);
-
-            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
-
-            InsertBatchQuery insertQuery = new InsertBatchQuery(entity, 1);
-            InsertBatchTranslator builder = new InsertBatchTranslator(insertQuery, adapter);
-            String generatedSql = builder.getSql();
-            String charStart = unitAdapter.getIdentifiersStartQuote();
-            String charEnd = unitAdapter.getIdentifiersEndQuote();
-            assertNotNull(generatedSql);
-            assertEquals("INSERT INTO " + charStart + entity.getName() + charEnd + " (" + charStart + "DESCRIPTION"
-                    + charEnd + ", " + charStart + "LOCKING_TEST_ID" + charEnd + ", " + charStart + "NAME" + charEnd
-                    + ") VALUES (?, ?, ?)", generatedSql);
-        } finally {
-            entity.getDataMap().setQuotingSQLIdentifiers(false);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorIT.java
new file mode 100644
index 0000000..1309e7c
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorIT.java
@@ -0,0 +1,173 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.access.translator.batch;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.access.DataNode;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.exp.ExpressionFactory;
+import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.query.DeleteBatchQuery;
+import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.test.parallel.ParallelTestContainer;
+import org.apache.cayenne.testdo.locking.SoftDelete;
+import org.apache.cayenne.unit.UnitDbAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class SoftDeleteBatchTranslatorIT extends ServerCase {
+
+    @Inject
+    private ObjectContext context;
+
+    @Inject
+    protected DbAdapter adapter;
+
+    @Inject
+    private DataNode dataNode;
+
+    @Inject
+    private UnitDbAdapter unitAdapter;
+
+    @Inject
+    private AdhocObjectFactory objectFactory;
+
+    private DeleteBatchTranslator createTranslator(DeleteBatchQuery query) {
+        JdbcAdapter adapter = objectFactory.newInstance(JdbcAdapter.class, JdbcAdapter.class.getName());
+        return createTranslator(query, adapter);
+    }
+
+    private DeleteBatchTranslator createTranslator(DeleteBatchQuery query, JdbcAdapter adapter) {
+        return (DeleteBatchTranslator) new SoftDeleteTranslatorFactory().translator(query, adapter, null);
+    }
+
+    public void testCreateSqlString() throws Exception {
+        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
+
+        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("ID"));
+
+        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
+        DeleteBatchTranslator builder = createTranslator(deleteQuery);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("UPDATE " + entity.getName() + " SET DELETED = ? WHERE ID = ?", generatedSql);
+    }
+
+    public void testCreateSqlStringWithNulls() throws Exception {
+        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
+
+        List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("ID"), entity.getAttribute("NAME"));
+
+        Collection<String> nullAttributes = Collections.singleton("NAME");
+
+        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
+        DeleteBatchTranslator builder = createTranslator(deleteQuery);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("UPDATE " + entity.getName() + " SET DELETED = ? WHERE ID = ? AND NAME IS NULL", generatedSql);
+    }
+
+    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
+        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+
+            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("ID"));
+
+            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(),
+                    1);
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+            DeleteBatchTranslator builder = createTranslator(deleteQuery, adapter);
+            String generatedSql = builder.getSql();
+
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+
+            assertNotNull(generatedSql);
+            assertEquals("UPDATE " + charStart + entity.getName() + charEnd + " SET " + charStart + "DELETED" + charEnd
+                    + " = ? WHERE " + charStart + "ID" + charEnd + " = ?", generatedSql);
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+
+    }
+
+    public void testUpdate() throws Exception {
+
+        final DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
+
+        JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+        BatchTranslatorFactory oldFactory = dataNode.getBatchTranslatorFactory();
+        try {
+            dataNode.setBatchTranslatorFactory(new SoftDeleteTranslatorFactory());
+
+            final SoftDelete test = context.newObject(SoftDelete.class);
+            test.setName("SoftDeleteBatchQueryBuilderTest");
+            context.commitChanges();
+
+            final SelectQuery query = new SelectQuery(SoftDelete.class);
+
+            new ParallelTestContainer() {
+
+                @Override
+                protected void assertResult() throws Exception {
+                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
+                    assertEquals(1, context.performQuery(query).size());
+
+                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
+                    assertEquals(0, context.performQuery(query).size());
+                }
+            }.runTest(200);
+
+            context.deleteObjects(test);
+            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
+            context.commitChanges();
+
+            new ParallelTestContainer() {
+
+                @Override
+                protected void assertResult() throws Exception {
+                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
+                    assertEquals(0, context.performQuery(query).size());
+
+                    SQLTemplate template = new SQLTemplate(entity, "SELECT * FROM SOFT_DELETE");
+                    template.setFetchingDataRows(true);
+                    assertEquals(1, context.performQuery(template).size());
+                }
+            }.runTest(200);
+        } finally {
+            context.performQuery(new SQLTemplate(entity, "DELETE FROM SOFT_DELETE"));
+            dataNode.setBatchTranslatorFactory(oldFactory);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorTest.java
deleted file mode 100644
index 942ae13..0000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/SoftDeleteBatchTranslatorTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.access.translator.batch;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.PersistenceState;
-import org.apache.cayenne.access.DataNode;
-import org.apache.cayenne.access.translator.batch.BatchTranslatorFactory;
-import org.apache.cayenne.access.translator.batch.DeleteBatchTranslator;
-import org.apache.cayenne.access.translator.batch.SoftDeleteTranslatorFactory;
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.dba.JdbcAdapter;
-import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.exp.ExpressionFactory;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.query.DeleteBatchQuery;
-import org.apache.cayenne.query.SQLTemplate;
-import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.test.parallel.ParallelTestContainer;
-import org.apache.cayenne.testdo.locking.SoftDelete;
-import org.apache.cayenne.unit.UnitDbAdapter;
-import org.apache.cayenne.unit.di.server.ServerCase;
-import org.apache.cayenne.unit.di.server.UseServerRuntime;
-
-@UseServerRuntime(ServerCase.LOCKING_PROJECT)
-public class SoftDeleteBatchTranslatorTest extends ServerCase {
-
-    @Inject
-    private ObjectContext context;
-
-    @Inject
-    protected DbAdapter adapter;
-
-    @Inject
-    private DataNode dataNode;
-
-    @Inject
-    private UnitDbAdapter unitAdapter;
-
-    @Inject
-    private AdhocObjectFactory objectFactory;
-
-    private DeleteBatchTranslator createTranslator(DeleteBatchQuery query) {
-        JdbcAdapter adapter = objectFactory.newInstance(JdbcAdapter.class, JdbcAdapter.class.getName());
-        return createTranslator(query, adapter);
-    }
-
-    private DeleteBatchTranslator createTranslator(DeleteBatchQuery query, JdbcAdapter adapter) {
-        return (DeleteBatchTranslator) new SoftDeleteTranslatorFactory().translator(query, adapter, null);
-    }
-
-    public void testCreateSqlString() throws Exception {
-        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
-
-        List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("ID"));
-
-        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(), 1);
-        DeleteBatchTranslator builder = createTranslator(deleteQuery);
-        String generatedSql = builder.getSql();
-        assertNotNull(generatedSql);
-        assertEquals("UPDATE " + entity.getName() + " SET DELETED = ? WHERE ID = ?", generatedSql);
-    }
-
-    public void testCreateSqlStringWithNulls() throws Exception {
-        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
-
-        List<DbAttribute> idAttributes = Arrays.asList(entity.getAttribute("ID"), entity.getAttribute("NAME"));
-
-        Collection<String> nullAttributes = Collections.singleton("NAME");
-
-        DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, nullAttributes, 1);
-        DeleteBatchTranslator builder = createTranslator(deleteQuery);
-        String generatedSql = builder.getSql();
-        assertNotNull(generatedSql);
-        assertEquals("UPDATE " + entity.getName() + " SET DELETED = ? WHERE ID = ? AND NAME IS NULL", generatedSql);
-    }
-
-    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
-        DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
-        try {
-
-            entity.getDataMap().setQuotingSQLIdentifiers(true);
-
-            List<DbAttribute> idAttributes = Collections.singletonList(entity.getAttribute("ID"));
-
-            DeleteBatchQuery deleteQuery = new DeleteBatchQuery(entity, idAttributes, Collections.<String> emptySet(),
-                    1);
-            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
-            DeleteBatchTranslator builder = createTranslator(deleteQuery, adapter);
-            String generatedSql = builder.getSql();
-
-            String charStart = unitAdapter.getIdentifiersStartQuote();
-            String charEnd = unitAdapter.getIdentifiersEndQuote();
-
-            assertNotNull(generatedSql);
-            assertEquals("UPDATE " + charStart + entity.getName() + charEnd + " SET " + charStart + "DELETED" + charEnd
-                    + " = ? WHERE " + charStart + "ID" + charEnd + " = ?", generatedSql);
-        } finally {
-            entity.getDataMap().setQuotingSQLIdentifiers(false);
-        }
-
-    }
-
-    public void testUpdate() throws Exception {
-
-        final DbEntity entity = context.getEntityResolver().getObjEntity(SoftDelete.class).getDbEntity();
-
-        JdbcAdapter adapter = (JdbcAdapter) this.adapter;
-        BatchTranslatorFactory oldFactory = dataNode.getBatchTranslatorFactory();
-        try {
-            dataNode.setBatchTranslatorFactory(new SoftDeleteTranslatorFactory());
-
-            final SoftDelete test = context.newObject(SoftDelete.class);
-            test.setName("SoftDeleteBatchQueryBuilderTest");
-            context.commitChanges();
-
-            final SelectQuery query = new SelectQuery(SoftDelete.class);
-
-            new ParallelTestContainer() {
-
-                @Override
-                protected void assertResult() throws Exception {
-                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
-                    assertEquals(1, context.performQuery(query).size());
-
-                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
-                    assertEquals(0, context.performQuery(query).size());
-                }
-            }.runTest(200);
-
-            context.deleteObjects(test);
-            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
-            context.commitChanges();
-
-            new ParallelTestContainer() {
-
-                @Override
-                protected void assertResult() throws Exception {
-                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
-                    assertEquals(0, context.performQuery(query).size());
-
-                    SQLTemplate template = new SQLTemplate(entity, "SELECT * FROM SOFT_DELETE");
-                    template.setFetchingDataRows(true);
-                    assertEquals(1, context.performQuery(template).size());
-                }
-            }.runTest(200);
-        } finally {
-            context.performQuery(new SQLTemplate(entity, "DELETE FROM SOFT_DELETE"));
-            dataNode.setBatchTranslatorFactory(oldFactory);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/e42c376c/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/UpdateBatchTranslatorIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/UpdateBatchTranslatorIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/UpdateBatchTranslatorIT.java
new file mode 100644
index 0000000..4b77c84
--- /dev/null
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/batch/UpdateBatchTranslatorIT.java
@@ -0,0 +1,159 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.access.translator.batch;
+
+import org.apache.cayenne.configuration.server.ServerRuntime;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
+import org.apache.cayenne.di.AdhocObjectFactory;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DbEntity;
+import org.apache.cayenne.query.UpdateBatchQuery;
+import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
+import org.apache.cayenne.unit.UnitDbAdapter;
+import org.apache.cayenne.unit.di.server.ServerCase;
+import org.apache.cayenne.unit.di.server.UseServerRuntime;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static org.mockito.Mockito.mock;
+
+@UseServerRuntime(ServerCase.LOCKING_PROJECT)
+public class UpdateBatchTranslatorIT extends ServerCase {
+
+    @Inject
+    private ServerRuntime runtime;
+
+    @Inject
+    private DbAdapter adapter;
+
+    @Inject
+    private UnitDbAdapter unitAdapter;
+
+    @Inject
+    private AdhocObjectFactory objectFactory;
+
+    public void testConstructor() throws Exception {
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        UpdateBatchTranslator builder = new UpdateBatchTranslator(mock(UpdateBatchQuery.class), adapter, null);
+        assertSame(adapter, builder.adapter);
+    }
+
+    public void testCreateSqlString() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+
+        List idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
+        List updatedAttributes = Collections.singletonList(entity.getAttribute("DESCRIPTION"));
+
+        UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes,
+                Collections.<String> emptySet(), 1);
+
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        UpdateBatchTranslator builder = new UpdateBatchTranslator(updateQuery, adapter, null);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+        assertEquals("UPDATE " + entity.getName() + " SET DESCRIPTION = ? WHERE LOCKING_TEST_ID = ?", generatedSql);
+    }
+
+    public void testCreateSqlStringWithNulls() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+
+        List idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"), entity.getAttribute("NAME"));
+
+        List updatedAttributes = Collections.singletonList(entity.getAttribute("DESCRIPTION"));
+
+        Collection nullAttributes = Collections.singleton("NAME");
+
+        UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes, nullAttributes, 1);
+
+        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
+        UpdateBatchTranslator builder = new UpdateBatchTranslator(updateQuery, adapter, null);
+        String generatedSql = builder.getSql();
+        assertNotNull(generatedSql);
+
+        assertEquals("UPDATE " + entity.getName() + " SET DESCRIPTION = ? WHERE LOCKING_TEST_ID = ? AND NAME IS NULL",
+                generatedSql);
+    }
+
+    public void testCreateSqlStringWithIdentifiersQuote() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+            List idAttributes = Collections.singletonList(entity.getAttribute("LOCKING_TEST_ID"));
+            List updatedAttributes = Collections.singletonList(entity.getAttribute("DESCRIPTION"));
+
+            UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes,
+                    Collections.<String> emptySet(), 1);
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
+            UpdateBatchTranslator builder = new UpdateBatchTranslator(updateQuery, adapter, null);
+            String generatedSql = builder.getSql();
+
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+
+            assertNotNull(generatedSql);
+            assertEquals("UPDATE " + charStart + entity.getName() + charEnd + " SET " + charStart + "DESCRIPTION"
+                    + charEnd + " = ? WHERE " + charStart + "LOCKING_TEST_ID" + charEnd + " = ?", generatedSql);
+
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+    }
+
+    public void testCreateSqlStringWithNullsWithIdentifiersQuote() throws Exception {
+        DbEntity entity = runtime.getDataDomain().getEntityResolver().getObjEntity(SimpleLockingTestEntity.class)
+                .getDbEntity();
+        try {
+
+            entity.getDataMap().setQuotingSQLIdentifiers(true);
+            List idAttributes = Arrays.asList(entity.getAttribute("LOCKING_TEST_ID"), entity.getAttribute("NAME"));
+
+            List updatedAttributes = Collections.singletonList(entity.getAttribute("DESCRIPTION"));
+
+            Collection nullAttributes = Collections.singleton("NAME");
+
+            UpdateBatchQuery updateQuery = new UpdateBatchQuery(entity, idAttributes, updatedAttributes,
+                    nullAttributes, 1);
+            JdbcAdapter adapter = (JdbcAdapter) this.adapter;
+
+            UpdateBatchTranslator builder = new UpdateBatchTranslator(updateQuery, adapter, null);
+            String generatedSql = builder.getSql();
+            assertNotNull(generatedSql);
+
+            String charStart = unitAdapter.getIdentifiersStartQuote();
+            String charEnd = unitAdapter.getIdentifiersEndQuote();
+            assertEquals("UPDATE " + charStart + entity.getName() + charEnd + " SET " + charStart + "DESCRIPTION"
+                    + charEnd + " = ? WHERE " + charStart + "LOCKING_TEST_ID" + charEnd + " = ? AND " + charStart
+                    + "NAME" + charEnd + " IS NULL", generatedSql);
+
+        } finally {
+            entity.getDataMap().setQuotingSQLIdentifiers(false);
+        }
+    }
+
+}


Mime
View raw message