Revision: 3306
Author: [email protected]
Date: Wed Feb 17 15:16:16 2010
Log: Corrected the annotations on the ColumnValueCount class for
persistence and added tests for persisting the column value.
http://code.google.com/p/power-architect/source/detail?r=3306
Added:
/trunk/regress/ca/sqlpower/architect/profile/ColumnValueCountTest.java
Modified:
/trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java
=======================================
--- /dev/null
+++ /trunk/regress/ca/sqlpower/architect/profile/ColumnValueCountTest.java
Wed Feb 17 15:16:16 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.profile;
+
+import ca.sqlpower.architect.util.ArchitectNewValueMaker;
+import ca.sqlpower.object.PersistedSPObjectTest;
+import ca.sqlpower.object.SPObject;
+import ca.sqlpower.sql.DataSourceCollection;
+import ca.sqlpower.sql.SPDataSource;
+import ca.sqlpower.testutil.NewValueMaker;
+
+public class ColumnValueCountTest extends PersistedSPObjectTest {
+
+ private ColumnValueCount cvc;
+
+ public ColumnValueCountTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ cvc = (ColumnValueCount) new ArchitectNewValueMaker(
+ getRootObject(),
getPLIni()).makeNewValue(ColumnValueCount.class, null, "");
+ }
+
+ @Override
+ protected Class<? extends SPObject> getChildClassType() {
+ return null;
+ }
+
+ @Override
+ public SPObject getSPObjectUnderTest() {
+ return cvc;
+ }
+
+ @Override
+ public NewValueMaker createNewValueMaker(SPObject root,
DataSourceCollection<SPDataSource> dsCollection) {
+ return new ArchitectNewValueMaker(root, dsCollection);
+ }
+
+}
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java Thu Feb
11 11:47:13 2010
+++ /trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java Wed Feb
17 15:16:16 2010
@@ -23,6 +23,7 @@
import ca.sqlpower.object.AbstractSPObject;
import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
import ca.sqlpower.object.annotation.Constructor;
import ca.sqlpower.object.annotation.ConstructorParameter;
@@ -34,6 +35,12 @@
*/
public class ColumnValueCount extends AbstractSPObject {
+ /**
+ * Defines an absolute ordering of the child types of this class.
+ */
+ @SuppressWarnings("unchecked")
+ public static List<Class<? extends SPObject>> allowedChildTypes =
Collections.emptyList();
+
private Object value;
private int count;
private double percent;
@@ -57,14 +64,17 @@
this.percent = percent;
}
+ @Accessor
public int getCount() {
return count;
}
+ @Accessor
public Object getValue() {
return value;
}
+ @Accessor
public double getPercent() {
return percent;
}