Modified: db/torque/torque4/trunk/torque-test/src/main/schema/qualified-table-name-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/qualified-table-name-schema.xml?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/qualified-table-name-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/qualified-table-name-schema.xml Tue Jul 14 12:46:20 2020
@@ -23,8 +23,8 @@
defaultIdMethod="@DATABASE_ID_METHOD@"
xmlns="http://db.apache.org/torque/4.0/templates/database"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://db.apache.org/torque/4.1/templates/database
- http://db.apache.org/torque/torque-4.1/documentation/orm-reference/database-4-1.xsd">
+ xsi:schemaLocation="http://db.apache.org/torque/5.0/templates/database
+ http://db.apache.org/torque/torque-5.0/documentation/orm-reference/database-5-0.xsd">
<table name="@[email protected]_name" >
<column name="id" type="INTEGER" primaryKey="true"/>
Modified: db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml (original)
+++ db/torque/torque4/trunk/torque-test/src/main/schema/test-schema.xml Tue Jul 14 12:46:20 2020
@@ -22,7 +22,7 @@
<database name="@DATABASE_DEFAULT@"
defaultIdMethod="@DATABASE_ID_METHOD@"
- xmlns="http://db.apache.org/torque/4.1/templates/database">
+ xmlns="http://db.apache.org/torque/5.0/templates/database">
<include-schema filename="included-schema.xml" />
<external-schema filename="ext-schema.xml" />
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoInsertTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoInsertTest.java?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoInsertTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/DoInsertTest.java Tue Jul 14 12:46:20 2020
@@ -43,6 +43,7 @@ import org.apache.torque.test.peer.Integ
import org.apache.torque.util.ColumnValues;
import org.apache.torque.util.JdbcTypedValue;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.ArgumentsSource;
import static org.junit.Assert.assertEquals;
@@ -75,6 +76,7 @@ public class DoInsertTest extends BaseDa
*
* @throws Exception if a database error occurs.
*/
+ @Test
public void testDoInsert() throws Exception
{
Author author = new Author();
@@ -96,6 +98,7 @@ public class DoInsertTest extends BaseDa
*
* @throws Exception if a database error occurs.
*/
+ @Test
public void testDoInsertWithColumnValues() throws Exception
{
ColumnValues columnValues = new ColumnValues();
@@ -121,6 +124,7 @@ public class DoInsertTest extends BaseDa
*
* @throws Exception if a database error occurs.
*/
+ @Test
public void testDoInsertWithColumnValuesAndVerbatimSqlValue()
throws Exception
{
@@ -158,6 +162,7 @@ public class DoInsertTest extends BaseDa
* @throws Exception if a database error occurs.
*/
@ArgumentsSource(AdapterProvider.class)
+ @Test
public void testDoInsertWithSelectSingleRecordIdSet(Adapter adapter)
throws Exception
{
@@ -196,6 +201,7 @@ public class DoInsertTest extends BaseDa
*
* @throws Exception if a database error occurs.
*/
+ @Test
public void testDoInsertWithSelectSingleRecord()
throws Exception
{
@@ -229,6 +235,7 @@ public class DoInsertTest extends BaseDa
*
* @throws Exception if a database error occurs.
*/
+ @Test
public void testDoInsertWithSelectMultipleRecords()
throws Exception
{
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/map/DatabaseMapTest.java Tue Jul 14 12:46:20 2020
@@ -19,18 +19,21 @@ package org.apache.torque.map;
* under the License.
*/
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.util.List;
import org.apache.torque.BaseDatabaseTestCase;
import org.apache.torque.Torque;
import org.apache.torque.TorqueException;
+import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
+import org.junit.jupiter.api.TestMethodOrder;
/**
* Test code for Database Map functions
@@ -38,6 +41,7 @@ import static org.junit.Assert.assertNot
* @author <a href="mailto:[email protected]">Greg Monroe</a>
* @version $Id
*/
+@TestMethodOrder(OrderAnnotation.class)
public class DatabaseMapTest extends BaseDatabaseTestCase
{
@@ -59,41 +63,34 @@ public class DatabaseMapTest extends Bas
// Hack to store exception thrown by test in static initializer
private static Throwable testDatabaseMapInitializeResult = null;
- static
- {
- // make sure this is the first test running,
- // as it will fail if another test method runs before
- try
- {
- doTestDatabaseMapInitialize();
- }
- catch (Throwable t)
- {
- testDatabaseMapInitializeResult = t;
- }
- }
-
/**
* Test initializing the default database. <p> Assumptions: <ul> A table
* called NotUsedBeforeMapInit table exists in the default schema
* (bookstore)<br> This table has not been used by any other test prior to
* this test.<br> </ul>
*/
- private static void doTestDatabaseMapInitialize() throws Exception
+ @Order(1)
+ @Test
+ public void doTestDatabaseMapInitialize() throws Exception
{
- // Get default schema DB
- DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
- TableMap tMap = map.getTable(TABLE_NAME1);
- assertTrue(
- "Did not expect to find NotUsedBeforeMapInit table before " +
- "initialize!",
- tMap == null);
- map.initialize();
- tMap = map.getTable(TABLE_NAME1);
- assertTrue(
- "Did not find table named NotUsedBeforeMapInit after " +
- "initialization!",
- tMap != null);
+ try {
+ // Get default schema DB
+ DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
+ TableMap tMap = map.getTable(TABLE_NAME1);
+ assertTrue( tMap == null,
+ "Did not expect to find NotUsedBeforeMapInit table before " +
+ "initialize!"
+ );
+ map.initialize();
+ tMap = map.getTable(TABLE_NAME1);
+ assertTrue( tMap == null,
+ "Did not find table named NotUsedBeforeMapInit after " +
+ "initialization!"
+ );
+ } catch (Throwable t)
+ {
+ testDatabaseMapInitializeResult = t;
+ }
}
/**
@@ -102,6 +99,7 @@ public class DatabaseMapTest extends Bas
* @throws Throwable if the test has failed.
*/
@Test
+ @Order(2)
public void testDatabaseMapInitialize() throws Throwable
{
if (testDatabaseMapInitializeResult != null)
@@ -122,25 +120,27 @@ public class DatabaseMapTest extends Bas
* @throws TorqueException
*/
@Test
+ @Order(3)
public void testColumnOrder() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
map.initialize();
TableMap tMap = map.getTable(TABLE_NAME1);
ColumnMap[] columns = tMap.getColumns();
- assertTrue("TestColumnOrder: Did not get enough columns from table!",
- columns.length >= COLUMN_NAMES.length);
+ assertTrue(columns.length >= COLUMN_NAMES.length,
+ "TestColumnOrder: Did not get enough columns from table!");
for (int i = 0; i < COLUMN_NAMES.length; i++)
{
String cName = columns[i].getColumnName();
String expected = COLUMN_NAMES[i];
// Handle torque.deprecated.uppercasePeer=true problems
String upperCaseExpected = expected.toUpperCase();
- assertTrue("TableMap for " + TABLE_NAME1
+ assertTrue(cName.equals(expected) ||
+ cName.equals(upperCaseExpected),
+ "TableMap for " + TABLE_NAME1
+ " did not preserve XML column order! Expected "
+ expected + " but found " +
- cName, cName.equals(expected) ||
- cName.equals(upperCaseExpected));
+ cName);
}
}
@@ -156,6 +156,7 @@ public class DatabaseMapTest extends Bas
* @throws TorqueException
*/
@Test
+ @Order(4)
public void testTableOrder() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
@@ -178,24 +179,25 @@ public class DatabaseMapTest extends Bas
* @throws TorqueException
*/
@Test
+ @Order(5)
public void testExternalSchemaTables() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap();
map.initialize();
TableMap table = map.getTable("ext");
- assertTrue("Did not find external schema table, 'ext'!",
- table != null);
+ assertTrue( table != null,"Did not find external schema table, 'ext'!"
+ );
table = map.getTable("extext");
- assertTrue("Did not find external schema table, 'extext'!",
- table != null);
+ assertTrue( table != null,"Did not find external schema table, 'extext'!");
}
/**
* Test that various table properties get set correctly from the XML
*/
@Test
+ @Order(6)
public void testTableAttributes() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
@@ -208,9 +210,8 @@ public class DatabaseMapTest extends Bas
"TableMap description",
"Table used for database map initialisation checks",
table.getDescription());
- assertTrue("TableMap OM Class was null!", table.getOMClass() != null);
- assertTrue("TableMap Peer Class was null!",
- table.getPeerClass() != null);
+ assertTrue( table.getOMClass() != null, "TableMap OM Class was null!");
+ assertTrue( table.getPeerClass() != null, "TableMap Peer Class was null!");
table = map.getTable(TABLE_NAME2);
validateAttribute(
@@ -223,6 +224,7 @@ public class DatabaseMapTest extends Bas
* Test that various column properties get set correctly from the XML
*/
@Test
+ @Order(7)
public void testColumnAttributes() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
@@ -239,30 +241,19 @@ public class DatabaseMapTest extends Bas
validateAttribute("Column description", "id column", column
.getDescription());
- assertTrue(
- "Column isPrimaryKey attribute returned false instead of true!",
- column.isPrimaryKey());
- assertTrue(
- "Column isAutoIncrement attribute returned false instead of true!",
- column.isAutoIncrement());
- assertTrue(
- "Column isNotNull attribute returned false instead of true!",
- column.isNotNull());
- assertTrue(
- "Column isUsePrimitive attribute returned false instead of true!",
- column.isUsePrimitive());
- assertTrue("Column type attribute was not Integer!",
- column.getType() instanceof Integer);
+ assertTrue( column.isPrimaryKey(), "Column isPrimaryKey attribute returned false instead of true!");
+ assertTrue( column.isAutoIncrement(), "Column isAutoIncrement attribute returned false instead of true!");
+ assertTrue( column.isNotNull(), "Column isNotNull attribute returned false instead of true!");
+ assertTrue( column.isUsePrimitive(), "Column isUsePrimitive attribute returned false instead of true!");
+ assertTrue( column.getType() instanceof Integer, "Column type attribute was not Integer!");
column = table.getColumn("one");
// Handle torque.deprecated.uppercasePeer=true problems
if ( column == null ) {
column = table.getColumn("ONE");
}
- assertFalse(
- "Column isProtected attribute returned true instead of false!",
- column.isProtected());
- assertTrue("Column size != 50", column.getSize() == 50);
+ assertFalse(column.isProtected(), "Column isProtected attribute returned true instead of false!");
+ assertTrue(column.getSize() == 50, "Column size != 50");
validateAttribute("Column default", "unknown", column
.getDefault());
@@ -271,24 +262,20 @@ public class DatabaseMapTest extends Bas
if ( column == null ) {
column = table.getColumn("THREE");
}
- assertTrue("Column position attribute != 4",
- column.getPosition() == 4);
+ assertTrue( column.getPosition() == 4, "Column position attribute != 4");
TableMap tableWithProtectedColumn = map.getTable(PROTECTED_TABLE);
column = tableWithProtectedColumn.getColumn("id");
- assertTrue(
- "Column isProtected attribute returned false instead of true!",
- column.isProtected());
+ assertTrue(column.isProtected(), "Column isProtected attribute returned false instead of true!");
column = tableWithProtectedColumn.getColumn("name");
- assertTrue(
- "Column isProtected attribute returned false instead of true!",
- column.isProtected());
+ assertTrue( column.isProtected(), "Column isProtected attribute returned false instead of true!");
}
/**
* Test that the foreign key properties get set correctly from the XML
*/
@Test
+ @Order(8)
public void testForeignKeyAttributes() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
@@ -312,25 +299,29 @@ public class DatabaseMapTest extends Bas
* Test that Inheritance info is stored correctly
*/
@Test
+ @Order(9)
public void testInheritanceMapping() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(DATABASE_NAME);
map.initialize();
TableMap table = map.getTable(TABLE_NAME1);
- assertTrue("Table isUseInheritance returned false!", table
- .isUseInheritance());
+ assertTrue(table
+ .isUseInheritance(),
+ "Table isUseInheritance returned false!");
ColumnMap column = table.getColumn("CLASS_NAME");
- assertTrue("Column isUseInheritance returned false!", column
- .isUseInheritance());
+ assertTrue(column
+ .isUseInheritance(),
+ "Column isUseInheritance returned false!");
InheritanceMap[] inhArray = column.getInheritanceMaps();
- assertEquals("Did not get 3 mappings back!", 3, inhArray.length);
+ assertEquals(3, inhArray.length, "Did not get 3 mappings back!");
InheritanceMap inh = column.getInheritanceMap("C");
- assertTrue("Inheritance map did not preserve XML order!", inh.getKey()
- .equals(inhArray[1].getKey()));
+ assertTrue(inh.getKey()
+ .equals(inhArray[1].getKey()),
+ "Inheritance map did not preserve XML order!");
validateAttribute("Inheritance key", "C", inh.getKey());
validateAttribute("Inheritance className", "MapInheritanceChildC", inh
.getClassName());
@@ -343,6 +334,7 @@ public class DatabaseMapTest extends Bas
* Test for controlled error on getting invalid database
*/
@Test
+ @Order(10)
public void testInvalidDatabaseName() throws TorqueException
{
DatabaseMap map = Torque.getDatabaseMap(INVALID_DATABASE_NAME);
@@ -361,6 +353,7 @@ public class DatabaseMapTest extends Bas
* Tests whether all options are present
*/
@Test
+ @Order(11)
public void testOptions() throws TorqueException
{
DatabaseMap databaseMap = Torque.getDatabaseMap(DATABASE_NAME);
@@ -400,8 +393,9 @@ public class DatabaseMapTest extends Bas
final String expected,
final String result)
{
- assertTrue(name + " attribute not set correctly!\n Expected '"
- + expected + "' and got '" + result + "'", expected
- .equals(result));
+ assertTrue(expected
+ .equals(result),
+ name + " attribute not set correctly!\n Expected '"
+ + expected + "' and got '" + result + "'");
}
}
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerMySQLCallback.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerMySQLCallback.java?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerMySQLCallback.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/junit5/extension/DockerMySQLCallback.java Tue Jul 14 12:46:20 2020
@@ -29,7 +29,6 @@ import java.lang.annotation.Target;
import org.apache.torque.junit5.extension.AdapterParameterResolver;
import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.testcontainers.junit.jupiter.Testcontainers;
Added: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/mysql/DoInsertContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/mysql/DoInsertContainerTest.java?rev=1879858&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/mysql/DoInsertContainerTest.java (added)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/mysql/DoInsertContainerTest.java Tue Jul 14 12:46:20 2020
@@ -0,0 +1,28 @@
+package org.apache.torque.testcontainer.mysql;
+
+/*
+ * 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.
+ */
+
+import org.apache.torque.generated.peer.DoInsertTest;
+import org.apache.torque.testcontainer.junit5.extension.DockerMySQLCallback;
+
+@DockerMySQLCallback
+public class DoInsertContainerTest extends DoInsertTest {
+
+}
Added: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/DoInsertContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/DoInsertContainerTest.java?rev=1879858&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/DoInsertContainerTest.java (added)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/DoInsertContainerTest.java Tue Jul 14 12:46:20 2020
@@ -0,0 +1,28 @@
+package org.apache.torque.testcontainer.postgresql;
+
+/*
+ * 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.
+ */
+
+import org.apache.torque.generated.peer.DoInsertTest;
+import org.apache.torque.testcontainer.junit5.extension.DockerPostGresCallback;
+
+@DockerPostGresCallback
+public class DoInsertContainerTest extends DoInsertTest {
+
+}
Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/ManagerConditionalContainerTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/ManagerConditionalContainerTest.java?rev=1879858&r1=1879857&r2=1879858&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/ManagerConditionalContainerTest.java (original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/testcontainer/postgresql/ManagerConditionalContainerTest.java Tue Jul 14 12:46:20 2020
@@ -20,9 +20,7 @@ package org.apache.torque.testcontainer.
*/
import org.apache.torque.ManagerTestConditional;
-import org.apache.torque.testcontainer.junit5.extension.DockerCallbackExtension;
import org.apache.torque.testcontainer.junit5.extension.DockerPostGresCallback;
-import org.junit.jupiter.api.extension.RegisterExtension;
@DockerPostGresCallback
public class ManagerConditionalContainerTest extends ManagerTestConditional {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.