Revision: 3235
Author: [email protected]
Date: Tue Jan 19 13:07:30 2010
Log: Fix to failing tests in Architect. Two recent changes to the library
made several tests in Architect fail.
When the setters for different populate flags was added to the SQLTable
they were not added to the ignore list for the Architect tests. These are
being ignored because setting the table to not populated in the test will
try to populate the test and cause exceptions as the data source is a stub.
The SQLIndex.Column had the value for setAscendingOrDescending tightened to
the Enum AscendDescend instead of being Object. This required a new
converter for the enum for loading the project. There may be a way to make
a generic Enum converter for this.
http://code.google.com/p/power-architect/source/detail?r=3235
Added:
/trunk/src/ca/sqlpower/architect/AscendDescendConverter.java
Modified:
/trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
/trunk/src/ca/sqlpower/architect/ProjectLoader.java
=======================================
--- /dev/null
+++ /trunk/src/ca/sqlpower/architect/AscendDescendConverter.java Tue Jan 19
13:07:30 2010
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect;
+
+import org.apache.commons.beanutils.Converter;
+
+import ca.sqlpower.sqlobject.SQLIndex.AscendDescend;
+
+
+public class AscendDescendConverter implements Converter {
+
+ @SuppressWarnings("unchecked")
+ public Object convert(Class targetType, Object value) {
+ if (value == null) {
+ return null;
+ }
+
+ if (targetType == AscendDescend.class) {
+ return AscendDescend.valueOf((String) value);
+ } else {
+ throw new IllegalArgumentException("Cannot perform conversion
to target type " + targetType);
+ }
+ }
+
+}
=======================================
--- /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Fri Jan 15 15:02:04 2010
+++ /trunk/regress/ca/sqlpower/architect/swingui/TestSwingUIProject.java
Tue Jan 19 13:07:30 2010
@@ -225,6 +225,10 @@
propertiesToIgnore.add("class");
propertiesToIgnore.add("childCount");
propertiesToIgnore.add("populated");
+ propertiesToIgnore.add("columnsPopulated");
+ propertiesToIgnore.add("exportedKeysPopulated");
+ propertiesToIgnore.add("importedKeysPopulated");
+ propertiesToIgnore.add("indicesPopulated");
propertiesToIgnore.add("magicEnabled");
propertiesToIgnore.add("childrenInaccessibleReason");
propertiesToIgnore.add("session");
=======================================
--- /trunk/src/ca/sqlpower/architect/ProjectLoader.java Fri Jan 15 15:02:04
2010
+++ /trunk/src/ca/sqlpower/architect/ProjectLoader.java Tue Jan 19 13:07:30
2010
@@ -60,6 +60,7 @@
import ca.sqlpower.sqlobject.SQLRelationship;
import ca.sqlpower.sqlobject.SQLSchema;
import ca.sqlpower.sqlobject.SQLTable;
+import ca.sqlpower.sqlobject.SQLIndex.AscendDescend;
import ca.sqlpower.sqlobject.SQLIndex.Column;
import ca.sqlpower.sqlobject.SQLRelationship.Deferrability;
import ca.sqlpower.sqlobject.SQLRelationship.UpdateDeleteRule;
@@ -75,6 +76,7 @@
static {
ConvertUtils.register(new DeferrabilityConverter(),
Deferrability.class);
ConvertUtils.register(new UpdateDeleteRuleConverter(),
UpdateDeleteRule.class);
+ ConvertUtils.register(new AscendDescendConverter(),
AscendDescend.class);
}
/**