Themes may be edited freely. They contain static images, CSS,
and layouts for Vaadin applications.
----------------------------
-Building Custom Widget Sets
----------------------------
-The 'widgetsets' directory is generated automatically, so we suggest that you
-do not edit it. You can rebuild the widgetsets directory by running the
-command below in the top project directory:
-
- ant -f build-widgetsets.xml
-
-See build-widgetsets.xml and the Reference Manual for more information
-regarding widget sets.
-
----------------------------
-Vaadin Development
----------------------------
-When developing the Vaadin Library itself, change to "build" directory and
-run "ant widgetsets" to compile all widgetsets or "ant widgetset-default",
-or "ant widgetset-colorpicker" etc. to compile individual widgetsets. You
-must have GWT installed under build/gwt.
-
See http://dev.vaadin.com/wiki/DevDocs/StartingDevelopment for instructions for
installing GWT and compiling widgetsets for Vaadin development.
================================= -->
<!--<target name="all" description="Compiles all parts of the project" depends="buildhelpers,theme-compiler,shared,server,client">-->
<target name="all" description="Compiles all parts of the project" depends="buildorder">
-
<subant buildpathref="build-path">
</subant>
</target>
</target>
+ <target name="tests" depends="buildorder">
+ <subant buildpathref="build-path" target="tests">
+ </subant>
+ </target>
+
</project>
</description>
<include file="../build.xml" as="vaadin" />
<include file="../common.xml" as="common" />
-
+
<property name="module.name" value="vaadin-buildhelpers" />
<property name="result.dir" location="result" />
<path id="classpath.compile.custom" />
<target name="clean">
<antcall target="common.clean" />
</target>
+
+ <target name="tests">
+ <!--<antcall target="common.tests.run" />-->
+ <echo>WHAT? No JUnit tests for ${module.name}!</echo>
+ </target>
</project>
\ No newline at end of file
<conf name="build" />
<conf name="build-provided" />
<conf name="ide" />
+ <conf name="tests" />
</configurations>
<publications>
<artifact type="jar" />
<target name="clean">
<antcall target="common.clean" />
</target>
+
+ <target name="tests">
+ <!--<antcall target="common.tests.run" />-->
+ <echo>WHAT? No tests for ${module.name}!</echo>
+ </target>
+
</project>
\ No newline at end of file
-->
<fileset file="${gwt.user.jar}" />
</path>
+ <path id="classpath.tests.custom" />
<target name="jar">
<antcall target="common.jar">
<target name="clean">
<antcall target="common.clean" />
</target>
+
+ <target name="tests">
+ <antcall target="common.tests.run" />
+ </target>
+
</project>
\ No newline at end of file
<conf name="build" />
<conf name="build-provided" />
<conf name="ide" />
+ <conf name="tests" />
</configurations>
<publications>
<artifact></artifact>
</publications>
- <dependencies defaultconf="build" defaultconfmapping="build,ide->master">
+ <dependencies defaultconf="build" defaultconfmapping="build,ide->default">
<!-- API DEPENDENCIES -->
<!-- LIBRARY DEPENDENCIES (compile time) -->
<!-- Project modules -->
<dependency org="com.vaadin" name="vaadin-shared"
- rev="${vaadin.version}" conf="build->build"></dependency>
+ rev="${vaadin.version}" conf="build,tests->build"></dependency>
<dependency org="com.vaadin" name="vaadin-server"
rev="${vaadin.version}" conf="build->build"></dependency>
<!-- gwt-user dependencies -->
<dependency org="org.w3c.css" name="sac" rev="1.3" />
+ <dependency org="junit" name="junit" rev="4.5"
+ conf="tests->default" />
</dependencies>
</ivy-module>
<property name="src" location="{$result.dir}/../src" />
<union id="jar.files">
- <fileset dir="${tests.classes}" excludes="${tests.classes.exclude}" />
+ <fileset dir="${classes}" excludes="${classes.exclude}" />
<fileset dir="${src}" excludes="${jar.exclude}" />
<fileset refid="common.files.for.all.jars" />
<fileset file="${pom.xml}" />
<property name="result.dir" location="result" />
<property name="classes" location="${result.dir}/classes" />
+ <property name="tests.src" location="${result.dir}/../tests/src" />
<property name="tests.classes" location="${result.dir}/tests/classes" />
+
<junit printsummary="withOutAndErr">
<formatter usefile="false" type="plain" />
<classpath refid="classpath.tests.dependencies" />
<batchtest fork="yes">
- <fileset dir="${tests.classes}">
+ <fileset dir="${tests.src}">
+ <exclude name="**/Abstract*" />
+ <exclude name="com/vaadin/tests/data/bean/*" />
+ <exclude name="com/vaadin/tests/util/*" />
+ <exclude name="**/VaadinClasses.java" />
</fileset>
</batchtest>
</junit>
<classpath location="${classes}" />
<classpath refid="classpath.tests.custom" />
</javac>
- <copy todir="${tests.classes}">
+
+ <!-- Copy resources -->
+ <copy todir="${tests.classes}" failonerror="false">
<fileset dir="${tests.resources}" />
</copy>
</target>
<property name="module.name" value="vaadin-server" />
<property name="result.dir" value="result" />
<path id="classpath.compile.custom" />
+ <path id="classpath.tests.custom" />
+
+ <union id="jar.includes">
+ <union refid="server.gwt.includes" />
+ <fileset dir="${vaadin.basedir}">
+ <include name="WebContent/VAADIN/vaadinBootstrap.js" />
+ </fileset>
+ </union>
<target name="jar">
<antcall target="common.jar">
- <reference torefid="extra.jar.includes" refid="server.gwt.includes" />
+ <reference torefid="extra.jar.includes" refid="jar.includes" />
</antcall>
</target>
<target name="clean">
<antcall target="common.clean" />
</target>
+
+ <target name="tests">
+ <antcall target="common.tests.run"/>
+ </target>
+
+
</project>
\ No newline at end of file
<!-- Liferay Portal Service -->
<dependency org="com.liferay.portal" name="portal-service"
- rev="6.0.2" conf="build-provided,ide -> master" />
+ rev="6.0.2" conf="build-provided,ide -> default" />
<!--Servlet API version 2.5 -->
<dependency org="javax.servlet" name="servlet-api"
- rev="2.5" conf="build-provided,ide -> master" />
+ rev="2.5" conf="build-provided,ide,tests -> default" />
<!--Portlet API version 2.0 (JSR-286) -->
<dependency org="javax.portlet" name="portlet-api"
- rev="2.0" conf="build-provided,ide -> master" />
+ rev="2.0" conf="build-provided,ide,tests -> default" />
<!-- Google App Engine -->
<dependency org="com.google.appengine" name="appengine-api-1.0-sdk"
- rev="1.2.1" conf="build-provided,ide -> master" />
+ rev="1.2.1" conf="build-provided,ide,tests -> default" />
<dependency org="javax.validation" name="validation-api"
- rev="1.0.0.GA" conf="build-provided,ide -> master" />
+ rev="1.0.0.GA" conf="build-provided,ide,tests -> default" />
<!-- LIBRARY DEPENDENCIES (compile time) -->
<!-- Project modules -->
<dependency org="com.vaadin" name="vaadin-shared"
- rev="${vaadin.version}" conf="build"></dependency>
+ rev="${vaadin.version}" conf="build,tests" />
<dependency org="com.vaadin" name="vaadin-buildhelpers"
- rev="${vaadin.version}" conf="build"></dependency>
+ rev="${vaadin.version}" conf="build,tests" />
<!-- Jsoup for BootstrapHandler -->
<dependency org="org.jsoup" name="jsoup" rev="1.6.3"
- conf="build,ide -> master" />
+ conf="build,ide -> default" />
<!-- TESTING DEPENDENCIES -->
- <!-- TestBench tests -->
- <dependency org="commons-codec" name="commons-codec"
- rev="1.5" conf="tests,ide->master" />
- <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11"
- conf="tests,ide->master" />
- <dependency org="org.mortbay.jetty" name="jetty-util"
- rev="6.1.11" conf="tests,ide->master" />
-
<!-- Test frameworks & related -->
<dependency org="junit" name="junit" rev="4.5"
- conf="tests,ide -> master" />
+ conf="tests,ide -> default" />
<dependency org="org.easymock" name="easymock" rev="3.0"
- conf="tests,ide-> master" />
+ conf="tests,ide-> default" transitive="true" />
<dependency org="org.hsqldb" name="hsqldb" rev="2.2.6"
- conf="tests,ide -> master" />
+ conf="tests,ide -> default" />
+ <dependency org="commons-io" name="commons-io" rev="1.4"
+ conf="tests->default" />
+ <dependency org="commons-lang" name="commons-lang"
+ rev="2.3" conf="tests->default" />
</dependencies>
* @return True if additions are allowed.
*/
public boolean isNewItemsAllowed() {
-
return allowNewOptions;
}
import com.vaadin.data.util.sqlcontainer.query.FreeformQueryTest;
import com.vaadin.data.util.sqlcontainer.query.QueryBuilderTest;
import com.vaadin.data.util.sqlcontainer.query.TableQueryTest;
-import com.vaadin.data.util.sqlcontainer.query.generator.DefaultSQLGenerator;
-import com.vaadin.data.util.sqlcontainer.query.generator.MSSQLGenerator;
-import com.vaadin.data.util.sqlcontainer.query.generator.OracleGenerator;
-import com.vaadin.data.util.sqlcontainer.query.generator.SQLGenerator;
@RunWith(Suite.class)
@SuiteClasses({ SimpleJDBCConnectionPoolTest.class,
TableQueryTest.class, SQLGeneratorsTest.class, UtilTest.class,
TicketTests.class, BetweenTest.class, ReadOnlyRowIdTest.class })
public class AllTests {
- /* Set the DB used for testing here! */
- public enum DB {
- HSQLDB, MYSQL, POSTGRESQL, MSSQL, ORACLE;
- }
-
- /* 0 = HSQLDB, 1 = MYSQL, 2 = POSTGRESQL, 3 = MSSQL, 4 = ORACLE */
- public static final DB db = DB.HSQLDB;
-
- /* Auto-increment column offset (HSQLDB = 0, MYSQL = 1, POSTGRES = 1) */
- public static int offset;
- /* Garbage table creation query (=three queries for oracle) */
- public static String createGarbage;
- public static String createGarbageSecond;
- public static String createGarbageThird;
- /* DB Drivers, urls, usernames and passwords */
- public static String dbDriver;
- public static String dbURL;
- public static String dbUser;
- public static String dbPwd;
- /* People -test table creation statement(s) */
- public static String peopleFirst;
- public static String peopleSecond;
- public static String peopleThird;
- /* Versioned -test table createion statement(s) */
- public static String[] versionStatements;
- /* SQL Generator used during the testing */
- public static SQLGenerator sqlGen;
-
- /* Set DB-specific settings based on selected DB */
- static {
- sqlGen = new DefaultSQLGenerator();
- switch (db) {
- case HSQLDB:
- offset = 0;
- createGarbage = "create table garbage (id integer generated always as identity, type varchar(32), PRIMARY KEY(id))";
- dbDriver = "org.hsqldb.jdbc.JDBCDriver";
- dbURL = "jdbc:hsqldb:mem:sqlcontainer";
- dbUser = "SA";
- dbPwd = "";
- peopleFirst = "create table people (id integer generated always as identity, name varchar(32), AGE INTEGER)";
- peopleSecond = "alter table people add primary key (id)";
- versionStatements = new String[] {
- "create table versioned (id integer generated always as identity, text varchar(255), version tinyint default 0)",
- "alter table versioned add primary key (id)" };
- break;
- case MYSQL:
- offset = 1;
- createGarbage = "create table GARBAGE (ID integer auto_increment, type varchar(32), PRIMARY KEY(ID))";
- dbDriver = "com.mysql.jdbc.Driver";
- dbURL = "jdbc:mysql:///sqlcontainer";
- dbUser = "sqlcontainer";
- dbPwd = "sqlcontainer";
- peopleFirst = "create table PEOPLE (ID integer auto_increment not null, NAME varchar(32), AGE INTEGER, primary key(ID))";
- peopleSecond = null;
- versionStatements = new String[] {
- "create table VERSIONED (ID integer auto_increment not null, TEXT varchar(255), VERSION tinyint default 0, primary key(ID))",
- "CREATE TRIGGER upd_version BEFORE UPDATE ON VERSIONED"
- + " FOR EACH ROW SET NEW.VERSION = OLD.VERSION+1" };
- break;
- case POSTGRESQL:
- offset = 1;
- createGarbage = "create table GARBAGE (\"ID\" serial PRIMARY KEY, \"TYPE\" varchar(32))";
- dbDriver = "org.postgresql.Driver";
- dbURL = "jdbc:postgresql://localhost:5432/test";
- dbUser = "postgres";
- dbPwd = "postgres";
- peopleFirst = "create table PEOPLE (\"ID\" serial primary key, \"NAME\" VARCHAR(32), \"AGE\" INTEGER)";
- peopleSecond = null;
- versionStatements = new String[] {
- "create table VERSIONED (\"ID\" serial primary key, \"TEXT\" VARCHAR(255), \"VERSION\" INTEGER DEFAULT 0)",
- "CREATE OR REPLACE FUNCTION zz_row_version() RETURNS TRIGGER AS $$"
- + "BEGIN"
- + " IF TG_OP = 'UPDATE'"
- + " AND NEW.\"VERSION\" = old.\"VERSION\""
- + " AND ROW(NEW.*) IS DISTINCT FROM ROW (old.*)"
- + " THEN"
- + " NEW.\"VERSION\" := NEW.\"VERSION\" + 1;"
- + " END IF;" + " RETURN NEW;" + "END;"
- + "$$ LANGUAGE plpgsql;",
- "CREATE TRIGGER \"mytable_modify_dt_tr\" BEFORE UPDATE"
- + " ON VERSIONED FOR EACH ROW"
- + " EXECUTE PROCEDURE \"public\".\"zz_row_version\"();" };
- break;
- case MSSQL:
- offset = 1;
- createGarbage = "create table GARBAGE (\"ID\" int identity(1,1) primary key, \"TYPE\" varchar(32))";
- dbDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
- dbURL = "jdbc:sqlserver://localhost:1433;databaseName=tempdb;";
- dbUser = "sa";
- dbPwd = "sa";
- peopleFirst = "create table PEOPLE (\"ID\" int identity(1,1) primary key, \"NAME\" VARCHAR(32), \"AGE\" INTEGER)";
- peopleSecond = null;
- versionStatements = new String[] { "create table VERSIONED (\"ID\" int identity(1,1) primary key, \"TEXT\" VARCHAR(255), \"VERSION\" rowversion not null)" };
- sqlGen = new MSSQLGenerator();
- break;
- case ORACLE:
- offset = 1;
- createGarbage = "create table GARBAGE (\"ID\" integer primary key, \"TYPE\" varchar2(32))";
- createGarbageSecond = "create sequence garbage_seq start with 1 increment by 1 nomaxvalue";
- createGarbageThird = "create trigger garbage_trigger before insert on GARBAGE for each row begin select garbage_seq.nextval into :new.ID from dual; end;";
- dbDriver = "oracle.jdbc.OracleDriver";
- dbURL = "jdbc:oracle:thin:test/test@localhost:1521:XE";
- dbUser = "test";
- dbPwd = "test";
- peopleFirst = "create table PEOPLE (\"ID\" integer primary key, \"NAME\" VARCHAR2(32), \"AGE\" INTEGER)";
- peopleSecond = "create sequence people_seq start with 1 increment by 1 nomaxvalue";
- peopleThird = "create trigger people_trigger before insert on PEOPLE for each row begin select people_seq.nextval into :new.ID from dual; end;";
- versionStatements = new String[] {
- "create table VERSIONED (\"ID\" integer primary key, \"TEXT\" VARCHAR(255), \"VERSION\" INTEGER DEFAULT 0)",
- "create sequence versioned_seq start with 1 increment by 1 nomaxvalue",
- "create trigger versioned_trigger before insert on VERSIONED for each row begin select versioned_seq.nextval into :new.ID from dual; end;",
- "create sequence versioned_version start with 1 increment by 1 nomaxvalue",
- "create trigger versioned_version_trigger before insert or update on VERSIONED for each row begin select versioned_version.nextval into :new.VERSION from dual; end;" };
- sqlGen = new OracleGenerator();
- break;
- }
- }
}
import org.junit.Assert;
import org.junit.Test;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
public class DataGenerator {
Statement statement = conn.createStatement();
try {
statement.execute("drop table PEOPLE");
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
statement.execute("drop sequence people_seq");
}
} catch (SQLException e) {
// Will fail if table doesn't exist, which is OK.
conn.rollback();
}
- statement.execute(AllTests.peopleFirst);
- if (AllTests.peopleSecond != null) {
- statement.execute(AllTests.peopleSecond);
+ statement.execute(SQLTestsConstants.peopleFirst);
+ if (SQLTestsConstants.peopleSecond != null) {
+ statement.execute(SQLTestsConstants.peopleSecond);
}
- if (AllTests.db == DB.ORACLE) {
- statement.execute(AllTests.peopleThird);
+ if (SQLTestsConstants.db == DB.ORACLE) {
+ statement.execute(SQLTestsConstants.peopleThird);
}
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Ville', '23')");
statement.executeUpdate("insert into people values('Kalle', '7')");
statement.executeUpdate("insert into people values('Pelle', '18')");
Connection conn = connectionPool.reserveConnection();
Statement statement = conn.createStatement();
for (int i = 4; i < 5000; i++) {
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Person "
+ i + "', '" + i % 99 + "')");
} else {
Statement statement = conn.createStatement();
try {
statement.execute("DROP TABLE VERSIONED");
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
statement.execute("drop sequence versioned_seq");
statement.execute("drop sequence versioned_version");
}
// Will fail if table doesn't exist, which is OK.
conn.rollback();
}
- for (String stmtString : AllTests.versionStatements) {
+ for (String stmtString : SQLTestsConstants.versionStatements) {
statement.execute(stmtString);
}
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement
.executeUpdate("insert into VERSIONED values('Junk', default)");
} else {
Statement statement = conn.createStatement();
try {
statement.execute("drop table GARBAGE");
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
statement.execute("drop sequence garbage_seq");
}
} catch (SQLException e) {
// Will fail if table doesn't exist, which is OK.
conn.rollback();
}
- statement.execute(AllTests.createGarbage);
- if (AllTests.db == DB.ORACLE) {
- statement.execute(AllTests.createGarbageSecond);
- statement.execute(AllTests.createGarbageThird);
+ statement.execute(SQLTestsConstants.createGarbage);
+ if (SQLTestsConstants.db == DB.ORACLE) {
+ statement.execute(SQLTestsConstants.createGarbageSecond);
+ statement.execute(SQLTestsConstants.createGarbageThird);
}
conn.commit();
connectionPool.releaseConnection(conn);
import org.junit.Test;
import com.vaadin.data.Container.Filter;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper;
import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder;
public static StatementHelper getQueryWithFilters(List<Filter> filters,
int offset, int limit) {
StatementHelper sh = new StatementHelper();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
if (limit > 1) {
offset++;
limit--;
.append(" AND ").append(Integer.toString(offset + limit));
sh.setQueryString(query.toString());
return sh;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
if (limit > 1) {
offset++;
limit--;
import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Item;
import com.vaadin.data.util.filter.Like;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.query.OrderBy;
public class SQLContainerTableQueryTest {
- private static final int offset = AllTests.offset;
- private static final String createGarbage = AllTests.createGarbage;
+ private static final int offset = SQLTestsConstants.offset;
+ private static final String createGarbage = SQLTestsConstants.createGarbage;
private JDBCConnectionPool connectionPool;
@Before
public void setUp() throws SQLException {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
} catch (SQLException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
@Test
public void constructor_withTableQuery_shouldSucceed() throws SQLException {
new SQLContainer(new TableQuery("people", connectionPool,
- AllTests.sqlGen));
+ SQLTestsConstants.sqlGen));
}
@Test
public void containsId_withTableQueryAndExistingId_returnsTrue()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertTrue(container.containsId(new RowId(
new Object[] { 1 + offset })));
}
public void containsId_withTableQueryAndNonexistingId_returnsFalse()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertFalse(container.containsId(new RowId(
new Object[] { 1337 + offset })));
}
@Test
public void getContainerProperty_tableExistingItemIdAndPropertyId_returnsProperty()
throws SQLException {
- TableQuery t = new TableQuery("people", connectionPool, AllTests.sqlGen);
+ TableQuery t = new TableQuery("people", connectionPool,
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(t);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
"Ville",
container
public void getContainerProperty_tableExistingItemIdAndNonexistingPropertyId_returnsNull()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertNull(container.getContainerProperty(new RowId(
new Object[] { 1 + offset }), "asdf"));
}
public void getContainerProperty_tableNonexistingItemId_returnsNull()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertNull(container.getContainerProperty(new RowId(
new Object[] { 1337 + offset }), "NAME"));
}
public void getContainerPropertyIds_table_returnsIDAndNAME()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Collection<?> propertyIds = container.getContainerPropertyIds();
Assert.assertEquals(3, propertyIds.size());
Assert.assertArrayEquals(new String[] { "ID", "NAME", "AGE" },
@Test
public void getItem_tableExistingItemId_returnsItem() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Item item;
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
item = container.getItem(new RowId(new Object[] { new BigDecimal(
0 + offset) }));
} else {
String NEW_VALUE = "OtherValue"; //$NON-NLS-1$
SQLContainer container = new SQLContainer(new TableQuery("people", //$NON-NLS-1$
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object itemID = container.addItem();
Item item = container.getItem(itemID);
item.getItemProperty("NAME").setValue(OLD_VALUE); //$NON-NLS-1$
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Item item;
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
item = container.getItem(new RowId(new Object[] { new BigDecimal(
1337 + offset) }));
Assert.assertNotNull(item);
public void getItemIds_table_returnsItemIdsWithKeys0through3()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Collection<?> itemIds = container.getItemIds();
Assert.assertEquals(4, itemIds.size());
RowId zero = new RowId(new Object[] { 0 + offset });
RowId one = new RowId(new Object[] { 1 + offset });
RowId two = new RowId(new Object[] { 2 + offset });
RowId three = new RowId(new Object[] { 3 + offset });
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
String[] correct = new String[] { "1", "2", "3", "4" };
List<String> oracle = new ArrayList<String>();
for (Object o : itemIds) {
@Test
public void getType_tableNAMEPropertyId_returnsString() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(String.class, container.getType("NAME"));
}
@Test
public void getType_tableIDPropertyId_returnsInteger() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(BigDecimal.class, container.getType("ID"));
} else {
Assert.assertEquals(Integer.class, container.getType("ID"));
public void getType_tableNonexistingPropertyId_returnsNull()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertNull(container.getType("asdf"));
}
@Test
public void size_table_returnsFour() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(4, container.size());
}
public void size_tableOneAddedItem_returnsFive() throws SQLException {
Connection conn = connectionPool.reserveConnection();
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Bengt', 30)");
} else {
statement
connectionPool.releaseConnection(conn);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(5, container.size());
}
public void indexOfId_tableWithParameterThree_returnsThree()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(3, container.indexOfId(new RowId(
new Object[] { new BigDecimal(3 + offset) })));
} else {
public void indexOfId_table5000RowsWithParameter1337_returns1337()
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
- TableQuery q = new TableQuery("people", connectionPool, AllTests.sqlGen);
+ TableQuery q = new TableQuery("people", connectionPool,
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(q);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
container.getItem(new RowId(new Object[] { new BigDecimal(
1337 + offset) }));
Assert.assertEquals(1337, container.indexOfId(new RowId(
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1337 + offset }).toString(),
itemId.toString());
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1337 + offset }).toString(),
itemId.toString());
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1338 + offset }).toString(),
container.nextItemId(itemId).toString());
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1336 + offset }).toString(),
container.prevItemId(itemId).toString());
@Test
public void firstItemId_table_returnsItemId0() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 0 + offset }).toString(),
container.firstItemId().toString());
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 4999 + offset }).toString(),
container.lastItemId().toString());
@Test
public void isFirstId_tableActualFirstId_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isFirstId(new RowId(
new Object[] { new BigDecimal(0 + offset) })));
} else {
@Test
public void isFirstId_tableSecondId_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertFalse(container.isFirstId(new RowId(
new Object[] { new BigDecimal(1 + offset) })));
} else {
@Test
public void isLastId_tableSecondId_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertFalse(container.isLastId(new RowId(
new Object[] { new BigDecimal(1 + offset) })));
} else {
@Test
public void isLastId_tableLastId_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isLastId(new RowId(
new Object[] { new BigDecimal(3 + offset) })));
} else {
public void isLastId_table5000RowsLastId_returnsTrue() throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
- if (AllTests.db == DB.ORACLE) {
+ connectionPool, SQLTestsConstants.sqlGen));
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isLastId(new RowId(
new Object[] { new BigDecimal(4999 + offset) })));
} else {
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
for (int i = 0; i < 5000; i++) {
Assert.assertTrue(container.containsId(container.getIdByIndex(i)));
}
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.setAutoCommit(true);
for (int i = 0; i < 5000; i++) {
Assert.assertTrue(container.containsId(container.getIdByIndex(i)));
@Test
public void refresh_table_sizeShouldUpdate() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(4, container.size());
DataGenerator.addFiveThousandPeople(connectionPool);
container.refresh();
// make sure that the refresh method actually refreshes stuff and isn't
// a NOP.
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(4, container.size());
DataGenerator.addFiveThousandPeople(connectionPool);
Assert.assertEquals(4, container.size());
@Test
public void setAutoCommit_table_shouldSucceed() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.setAutoCommit(true);
Assert.assertTrue(container.isAutoCommit());
container.setAutoCommit(false);
@Test
public void getPageLength_table_returnsDefault100() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertEquals(100, container.getPageLength());
}
@Test
public void setPageLength_table_shouldSucceed() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.setPageLength(20);
Assert.assertEquals(20, container.getPageLength());
container.setPageLength(200);
@Test(expected = UnsupportedOperationException.class)
public void addContainerProperty_normal_isUnsupported() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addContainerProperty("asdf", String.class, "");
}
public void removeContainerProperty_normal_isUnsupported()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.removeContainerProperty("asdf");
}
@Test(expected = UnsupportedOperationException.class)
public void addItemObject_normal_isUnsupported() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItem("asdf");
}
public void addItemAfterObjectObject_normal_isUnsupported()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItemAfter("asdf", "foo");
}
@Test(expected = UnsupportedOperationException.class)
public void addItemAtIntObject_normal_isUnsupported() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItemAt(2, "asdf");
}
@Test(expected = UnsupportedOperationException.class)
public void addItemAtInt_normal_isUnsupported() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItemAt(2);
}
@Test(expected = UnsupportedOperationException.class)
public void addItemAfterObject_normal_isUnsupported() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItemAfter("asdf");
}
@Test
public void addItem_tableAddOneNewItem_returnsItemId() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object itemId = container.addItem();
Assert.assertNotNull(itemId);
}
public void addItem_tableAddOneNewItem_autoCommit_returnsFinalItemId()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
container.setAutoCommit(true);
Object itemId = container.addItem();
public void addItem_tableAddOneNewItem_autoCommit_sizeIsIncreased()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
container.setAutoCommit(true);
int originalSize = container.size();
public void addItem_tableAddOneNewItem_shouldChangeSize()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
int size = container.size();
container.addItem();
Assert.assertEquals(size + 1, container.size());
public void addItem_tableAddTwoNewItems_shouldChangeSize()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
int size = container.size();
Object id1 = container.addItem();
Object id2 = container.addItem();
public void nextItemId_tableNewlyAddedItem_returnsNewlyAdded()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object lastId = container.lastItemId();
Object id = container.addItem();
Assert.assertEquals(id, container.nextItemId(lastId));
public void lastItemId_tableNewlyAddedItem_returnsNewlyAdded()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object lastId = container.lastItemId();
Object id = container.addItem();
Assert.assertEquals(id, container.lastItemId());
@Test
public void indexOfId_tableNewlyAddedItem_returnsFour() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertEquals(4, container.indexOfId(id));
}
public void getItem_tableNewlyAddedItem_returnsNewlyAdded()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertNotNull(container.getItem(id));
}
public void getItemIds_tableNewlyAddedItem_containsNewlyAdded()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.getItemIds().contains(id));
}
public void getContainerProperty_tableNewlyAddedItem_returnsPropertyOfNewlyAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Item item = container.getItem(id);
item.getItemProperty("NAME").setValue("asdf");
public void containsId_tableNewlyAddedItem_returnsTrue()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.containsId(id));
}
public void prevItemId_tableTwoNewlyAddedItems_returnsFirstAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id1 = container.addItem();
Object id2 = container.addItem();
Assert.assertEquals(id1, container.prevItemId(id2));
throws SQLException {
DataGenerator.createGarbage(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("garbage",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertSame(id, container.firstItemId());
}
throws SQLException {
DataGenerator.createGarbage(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("garbage",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.isFirstId(id));
}
public void isLastId_tableOneItemAdded_returnsTrueForAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.isLastId(id));
}
public void isLastId_tableTwoItemsAdded_returnsTrueForLastAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItem();
Object id2 = container.addItem();
Assert.assertTrue(container.isLastId(id2));
public void getIdByIndex_tableOneItemAddedLastIndexInContainer_returnsAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertEquals(id, container.getIdByIndex(container.size() - 1));
}
public void removeItem_tableNoAddedItems_removesItemFromContainer()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
int size = container.size();
Object id = container.firstItemId();
Assert.assertTrue(container.removeItem(id));
@Test
public void containsId_tableRemovedItem_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.firstItemId();
Assert.assertTrue(container.removeItem(id));
Assert.assertFalse(container.containsId(id));
public void removeItem_tableOneAddedItem_removesTheAddedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
int size = container.size();
Assert.assertTrue(container.removeItem(id));
@Test
public void getItem_tableItemRemoved_returnsNull() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.firstItemId();
Assert.assertTrue(container.removeItem(id));
Assert.assertNull(container.getItem(id));
@Test
public void getItem_tableAddedItemRemoved_returnsNull() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertNotNull(container.getItem(id));
Assert.assertTrue(container.removeItem(id));
public void getItemIds_tableItemRemoved_shouldNotContainRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.firstItemId();
Assert.assertTrue(container.getItemIds().contains(id));
Assert.assertTrue(container.removeItem(id));
public void getItemIds_tableAddedItemRemoved_shouldNotContainRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.getItemIds().contains(id));
Assert.assertTrue(container.removeItem(id));
@Test
public void containsId_tableItemRemoved_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.firstItemId();
Assert.assertTrue(container.containsId(id));
Assert.assertTrue(container.removeItem(id));
public void containsId_tableAddedItemRemoved_returnsFalse()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object id = container.addItem();
Assert.assertTrue(container.containsId(id));
public void nextItemId_tableItemRemoved_skipsRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.getIdByIndex(0);
Object second = container.getIdByIndex(1);
Object third = container.getIdByIndex(2);
public void nextItemId_tableAddedItemRemoved_skipsRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.lastItemId();
Object second = container.addItem();
Object third = container.addItem();
public void prevItemId_tableItemRemoved_skipsRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.getIdByIndex(0);
Object second = container.getIdByIndex(1);
Object third = container.getIdByIndex(2);
public void prevItemId_tableAddedItemRemoved_skipsRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.lastItemId();
Object second = container.addItem();
Object third = container.addItem();
public void firstItemId_tableFirstItemRemoved_resultChanges()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.firstItemId();
Assert.assertTrue(container.removeItem(first));
Assert.assertNotSame(first, container.firstItemId());
throws SQLException {
DataGenerator.createGarbage(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("garbage",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.addItem();
Object second = container.addItem();
Assert.assertSame(first, container.firstItemId());
public void lastItemId_tableLastItemRemoved_resultChanges()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object last = container.lastItemId();
Assert.assertTrue(container.removeItem(last));
Assert.assertNotSame(last, container.lastItemId());
public void lastItemId_tableAddedLastItemRemoved_resultChanges()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object last = container.addItem();
Assert.assertSame(last, container.lastItemId());
Assert.assertTrue(container.removeItem(last));
public void isFirstId_tableFirstItemRemoved_returnsFalse()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.firstItemId();
Assert.assertTrue(container.removeItem(first));
Assert.assertFalse(container.isFirstId(first));
throws SQLException {
DataGenerator.createGarbage(connectionPool);
SQLContainer container = new SQLContainer(new TableQuery("garbage",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object first = container.addItem();
container.addItem();
Assert.assertSame(first, container.firstItemId());
public void isLastId_tableLastItemRemoved_returnsFalse()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object last = container.lastItemId();
Assert.assertTrue(container.removeItem(last));
Assert.assertFalse(container.isLastId(last));
public void isLastId_tableAddedLastItemRemoved_returnsFalse()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object last = container.addItem();
Assert.assertSame(last, container.lastItemId());
Assert.assertTrue(container.removeItem(last));
@Test
public void indexOfId_tableItemRemoved_returnsNegOne() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.getIdByIndex(2);
Assert.assertTrue(container.removeItem(id));
Assert.assertEquals(-1, container.indexOfId(id));
public void indexOfId_tableAddedItemRemoved_returnsNegOne()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
Assert.assertTrue(container.indexOfId(id) != -1);
Assert.assertTrue(container.removeItem(id));
public void getIdByIndex_tableItemRemoved_resultChanges()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.getIdByIndex(2);
Assert.assertTrue(container.removeItem(id));
Assert.assertNotSame(id, container.getIdByIndex(2));
public void getIdByIndex_tableAddedItemRemoved_resultChanges()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.addItem();
container.addItem();
int index = container.indexOfId(id);
@Test
public void removeAllItems_table_shouldSucceed() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertTrue(container.removeAllItems());
Assert.assertEquals(0, container.size());
}
public void removeAllItems_tableAddedItems_shouldSucceed()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addItem();
container.addItem();
Assert.assertTrue(container.removeAllItems());
@Test
public void commit_tableAddedItem_shouldBeWrittenToDB() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object id = container.addItem();
container.getContainerProperty(id, "NAME").setValue("New Name");
public void commit_tableTwoAddedItems_shouldBeWrittenToDB()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object id = container.addItem();
Object id2 = container.addItem();
public void commit_tableRemovedItem_shouldBeRemovedFromDB()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object last = container.lastItemId();
container.removeItem(last);
public void commit_tableLastItemUpdated_shouldUpdateRowInDB()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
Object last = container.lastItemId();
container.getContainerProperty(last, "NAME").setValue("Donald");
@Test
public void rollback_tableItemAdded_discardsAddedItem() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
int size = container.size();
Object id = container.addItem();
container.getContainerProperty(id, "NAME").setValue("foo");
public void rollback_tableItemRemoved_restoresRemovedItem()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
int size = container.size();
Object last = container.lastItemId();
container.removeItem(last);
@Test
public void rollback_tableItemChanged_discardsChanges() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object last = container.lastItemId();
container.getContainerProperty(last, "NAME").setValue("foo");
container.rollback();
public void itemChangeNotification_table_isModifiedReturnsTrue()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertFalse(container.isModified());
RowItem last = (RowItem) container.getItem(container.lastItemId());
container.itemChangeNotification(last);
@Test
public void itemSetChangeListeners_table_shouldFire() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
ItemSetChangeListener listener = EasyMock
.createMock(ItemSetChangeListener.class);
listener.containerItemSetChange(EasyMock.isA(ItemSetChangeEvent.class));
public void itemSetChangeListeners_tableItemRemoved_shouldFire()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
ItemSetChangeListener listener = EasyMock
.createMock(ItemSetChangeListener.class);
listener.containerItemSetChange(EasyMock.isA(ItemSetChangeEvent.class));
@Test
public void removeListener_table_shouldNotFire() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
ItemSetChangeListener listener = EasyMock
.createMock(ItemSetChangeListener.class);
EasyMock.replay(listener);
@Test
public void isModified_tableRemovedItem_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertFalse(container.isModified());
container.removeItem(container.lastItemId());
Assert.assertTrue(container.isModified());
@Test
public void isModified_tableAddedItem_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertFalse(container.isModified());
container.addItem();
Assert.assertTrue(container.isModified());
@Test
public void isModified_tableChangedItem_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Assert.assertFalse(container.isModified());
container.getContainerProperty(container.lastItemId(), "NAME")
.setValue("foo");
public void getSortableContainerPropertyIds_table_returnsAllPropertyIds()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Collection<?> sortableIds = container.getSortableContainerPropertyIds();
Assert.assertTrue(sortableIds.contains("ID"));
Assert.assertTrue(sortableIds.contains("NAME"));
Assert.assertTrue(sortableIds.contains("AGE"));
Assert.assertEquals(3, sortableIds.size());
- if (AllTests.db == DB.MSSQL || AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.MSSQL
+ || SQLTestsConstants.db == DB.ORACLE) {
Assert.assertFalse(sortableIds.contains("rownum"));
}
}
@Test
public void addOrderBy_table_shouldReorderResults() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals("Ville",
@Test(expected = IllegalArgumentException.class)
public void addOrderBy_tableIllegalColumn_shouldFail() throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
container.addOrderBy(new OrderBy("asdf", true));
}
@Test
public void sort_table_sortsByName() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals("Ville",
@Test
public void addFilter_table_filtersResults() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
@Test
public void addContainerFilter_filtersResults() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
public void addContainerFilter_ignoreCase_filtersResults()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
public void removeAllContainerFilters_table_noFiltering()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
@Test
public void removeContainerFilters_table_noFiltering() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
public void addFilter_tableBufferedItems_alsoFiltersBufferedItems()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
public void sort_tableBufferedItems_sortsBufferedItemsLastInOrderAdded()
throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals("Ville",
import com.vaadin.data.Item;
import com.vaadin.data.util.filter.Compare.Equal;
import com.vaadin.data.util.filter.Like;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.query.FreeformQuery;
import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder;
public class SQLContainerTest {
- private static final int offset = AllTests.offset;
+ private static final int offset = SQLTestsConstants.offset;
private JDBCConnectionPool connectionPool;
@Before
public void setUp() throws SQLException {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
} catch (SQLException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
"Ville",
container
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
Item item;
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
item = container.getItem(new RowId(new Object[] { new BigDecimal(
0 + offset) }));
} else {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
Item item;
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
item = container.getItem(new RowId(new Object[] { new BigDecimal(
1337 + offset) }));
Assert.assertNotNull(item);
RowId one = new RowId(new Object[] { 1 + offset });
RowId two = new RowId(new Object[] { 2 + offset });
RowId three = new RowId(new Object[] { 3 + offset });
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
String[] correct = new String[] { "1", "2", "3", "4" };
List<String> oracle = new ArrayList<String>();
for (Object o : itemIds) {
throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(BigDecimal.class, container.getType("ID"));
} else {
Assert.assertEquals(Integer.class, container.getType("ID"));
public void size_freeformOneAddedItem_returnsFive() throws SQLException {
Connection conn = connectionPool.reserveConnection();
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Bengt', '42')");
} else {
statement
throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(3, container.indexOfId(new RowId(
new Object[] { new BigDecimal(3 + offset) })));
} else {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
container.getItem(new RowId(new Object[] { new BigDecimal(
1337 + offset) }));
Assert.assertEquals(1337, container.indexOfId(new RowId(
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(new RowId(new Object[] { new BigDecimal(
1337 + offset) }), itemId);
} else {
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT row_number() OVER"
+ start
+ " AND " + end;
return q;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
query.setDelegate(delegate);
SQLContainer container = new SQLContainer(query);
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1337 + offset }).toString(),
itemId.toString());
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1338 + offset }).toString(),
container.nextItemId(itemId).toString());
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
Object itemId = container.getIdByIndex(1337);
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 1336 + offset }).toString(),
container.prevItemId(itemId).toString());
public void firstItemId_freeform_returnsItemId0() throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 0 + offset }).toString(),
container.firstItemId().toString());
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(
new RowId(new Object[] { 4999 + offset }).toString(),
container.lastItemId().toString());
throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isFirstId(new RowId(
new Object[] { new BigDecimal(0 + offset) })));
} else {
public void isFirstId_freeformSecondId_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertFalse(container.isFirstId(new RowId(
new Object[] { new BigDecimal(1 + offset) })));
} else {
public void isLastId_freeformSecondId_returnsFalse() throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertFalse(container.isLastId(new RowId(
new Object[] { new BigDecimal(1 + offset) })));
} else {
public void isLastId_freeformLastId_returnsTrue() throws SQLException {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people", connectionPool, "ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isLastId(new RowId(
new Object[] { new BigDecimal(3 + offset) })));
} else {
SQLContainer container = new SQLContainer(new FreeformQuery(
"SELECT * FROM people ORDER BY \"ID\" ASC", connectionPool,
"ID"));
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertTrue(container.isLastId(new RowId(
new Object[] { new BigDecimal(4999 + offset) })));
} else {
.getCurrentArguments()[0];
RowItem item = (RowItem) EasyMock.getCurrentArguments()[1];
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement
.executeUpdate("insert into people values('"
+ item.getItemProperty("NAME")
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT row_number() OVER"
+ start
+ " AND " + end;
return q;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
.getCurrentArguments()[0];
RowItem item = (RowItem) EasyMock.getCurrentArguments()[1];
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement
.executeUpdate("insert into people values('"
+ item.getItemProperty("NAME")
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT row_number() OVER"
+ start
+ " AND " + end;
return q;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT row_number() OVER"
+ start
+ " AND " + end;
return q;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT row_number() OVER"
+ start
+ " AND " + end;
return q;
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
int start = offset + 1;
int end = offset + limit + 1;
String q = "SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
SQLGenerator gen = new MSSQLGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
orderBys, offset, limit, null)
.getQueryString();
}
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
SQLGenerator gen = new OracleGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
SQLGenerator gen = new MSSQLGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
orderBys, offset, limit, null)
.getQueryString();
}
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
SQLGenerator gen = new OracleGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
Object[] args = EasyMock.getCurrentArguments();
int offset = (Integer) (args[0]);
int limit = (Integer) (args[1]);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
SQLGenerator gen = new MSSQLGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
orderBys, offset, limit, null)
.getQueryString();
}
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
SQLGenerator gen = new OracleGenerator();
if (orderBys == null || orderBys.isEmpty()) {
List<OrderBy> ob = new ArrayList<OrderBy>();
--- /dev/null
+/*
+ * Copyright 2011 Vaadin Ltd.
+ *
+ * Licensed 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 com.vaadin.data.util.sqlcontainer;
+
+import com.vaadin.data.util.sqlcontainer.query.generator.DefaultSQLGenerator;
+import com.vaadin.data.util.sqlcontainer.query.generator.MSSQLGenerator;
+import com.vaadin.data.util.sqlcontainer.query.generator.OracleGenerator;
+import com.vaadin.data.util.sqlcontainer.query.generator.SQLGenerator;
+
+public class SQLTestsConstants {
+
+ /* Set the DB used for testing here! */
+ public enum DB {
+ HSQLDB, MYSQL, POSTGRESQL, MSSQL, ORACLE;
+ }
+
+ /* 0 = HSQLDB, 1 = MYSQL, 2 = POSTGRESQL, 3 = MSSQL, 4 = ORACLE */
+ public static final DB db = DB.HSQLDB;
+
+ /* Auto-increment column offset (HSQLDB = 0, MYSQL = 1, POSTGRES = 1) */
+ public static int offset;
+ /* Garbage table creation query (=three queries for oracle) */
+ public static String createGarbage;
+ public static String createGarbageSecond;
+ public static String createGarbageThird;
+ /* DB Drivers, urls, usernames and passwords */
+ public static String dbDriver;
+ public static String dbURL;
+ public static String dbUser;
+ public static String dbPwd;
+ /* People -test table creation statement(s) */
+ public static String peopleFirst;
+ public static String peopleSecond;
+ public static String peopleThird;
+ /* Versioned -test table createion statement(s) */
+ public static String[] versionStatements;
+ /* SQL Generator used during the testing */
+ public static SQLGenerator sqlGen;
+
+ /* Set DB-specific settings based on selected DB */
+ static {
+ sqlGen = new DefaultSQLGenerator();
+ switch (db) {
+ case HSQLDB:
+ offset = 0;
+ createGarbage = "create table garbage (id integer generated always as identity, type varchar(32), PRIMARY KEY(id))";
+ dbDriver = "org.hsqldb.jdbc.JDBCDriver";
+ dbURL = "jdbc:hsqldb:mem:sqlcontainer";
+ dbUser = "SA";
+ dbPwd = "";
+ peopleFirst = "create table people (id integer generated always as identity, name varchar(32), AGE INTEGER)";
+ peopleSecond = "alter table people add primary key (id)";
+ versionStatements = new String[] {
+ "create table versioned (id integer generated always as identity, text varchar(255), version tinyint default 0)",
+ "alter table versioned add primary key (id)" };
+ break;
+ case MYSQL:
+ offset = 1;
+ createGarbage = "create table GARBAGE (ID integer auto_increment, type varchar(32), PRIMARY KEY(ID))";
+ dbDriver = "com.mysql.jdbc.Driver";
+ dbURL = "jdbc:mysql:///sqlcontainer";
+ dbUser = "sqlcontainer";
+ dbPwd = "sqlcontainer";
+ peopleFirst = "create table PEOPLE (ID integer auto_increment not null, NAME varchar(32), AGE INTEGER, primary key(ID))";
+ peopleSecond = null;
+ versionStatements = new String[] {
+ "create table VERSIONED (ID integer auto_increment not null, TEXT varchar(255), VERSION tinyint default 0, primary key(ID))",
+ "CREATE TRIGGER upd_version BEFORE UPDATE ON VERSIONED"
+ + " FOR EACH ROW SET NEW.VERSION = OLD.VERSION+1" };
+ break;
+ case POSTGRESQL:
+ offset = 1;
+ createGarbage = "create table GARBAGE (\"ID\" serial PRIMARY KEY, \"TYPE\" varchar(32))";
+ dbDriver = "org.postgresql.Driver";
+ dbURL = "jdbc:postgresql://localhost:5432/test";
+ dbUser = "postgres";
+ dbPwd = "postgres";
+ peopleFirst = "create table PEOPLE (\"ID\" serial primary key, \"NAME\" VARCHAR(32), \"AGE\" INTEGER)";
+ peopleSecond = null;
+ versionStatements = new String[] {
+ "create table VERSIONED (\"ID\" serial primary key, \"TEXT\" VARCHAR(255), \"VERSION\" INTEGER DEFAULT 0)",
+ "CREATE OR REPLACE FUNCTION zz_row_version() RETURNS TRIGGER AS $$"
+ + "BEGIN"
+ + " IF TG_OP = 'UPDATE'"
+ + " AND NEW.\"VERSION\" = old.\"VERSION\""
+ + " AND ROW(NEW.*) IS DISTINCT FROM ROW (old.*)"
+ + " THEN"
+ + " NEW.\"VERSION\" := NEW.\"VERSION\" + 1;"
+ + " END IF;" + " RETURN NEW;" + "END;"
+ + "$$ LANGUAGE plpgsql;",
+ "CREATE TRIGGER \"mytable_modify_dt_tr\" BEFORE UPDATE"
+ + " ON VERSIONED FOR EACH ROW"
+ + " EXECUTE PROCEDURE \"public\".\"zz_row_version\"();" };
+ break;
+ case MSSQL:
+ offset = 1;
+ createGarbage = "create table GARBAGE (\"ID\" int identity(1,1) primary key, \"TYPE\" varchar(32))";
+ dbDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
+ dbURL = "jdbc:sqlserver://localhost:1433;databaseName=tempdb;";
+ dbUser = "sa";
+ dbPwd = "sa";
+ peopleFirst = "create table PEOPLE (\"ID\" int identity(1,1) primary key, \"NAME\" VARCHAR(32), \"AGE\" INTEGER)";
+ peopleSecond = null;
+ versionStatements = new String[] { "create table VERSIONED (\"ID\" int identity(1,1) primary key, \"TEXT\" VARCHAR(255), \"VERSION\" rowversion not null)" };
+ sqlGen = new MSSQLGenerator();
+ break;
+ case ORACLE:
+ offset = 1;
+ createGarbage = "create table GARBAGE (\"ID\" integer primary key, \"TYPE\" varchar2(32))";
+ createGarbageSecond = "create sequence garbage_seq start with 1 increment by 1 nomaxvalue";
+ createGarbageThird = "create trigger garbage_trigger before insert on GARBAGE for each row begin select garbage_seq.nextval into :new.ID from dual; end;";
+ dbDriver = "oracle.jdbc.OracleDriver";
+ dbURL = "jdbc:oracle:thin:test/test@localhost:1521:XE";
+ dbUser = "test";
+ dbPwd = "test";
+ peopleFirst = "create table PEOPLE (\"ID\" integer primary key, \"NAME\" VARCHAR2(32), \"AGE\" INTEGER)";
+ peopleSecond = "create sequence people_seq start with 1 increment by 1 nomaxvalue";
+ peopleThird = "create trigger people_trigger before insert on PEOPLE for each row begin select people_seq.nextval into :new.ID from dual; end;";
+ versionStatements = new String[] {
+ "create table VERSIONED (\"ID\" integer primary key, \"TEXT\" VARCHAR(255), \"VERSION\" INTEGER DEFAULT 0)",
+ "create sequence versioned_seq start with 1 increment by 1 nomaxvalue",
+ "create trigger versioned_trigger before insert on VERSIONED for each row begin select versioned_seq.nextval into :new.ID from dual; end;",
+ "create sequence versioned_version start with 1 increment by 1 nomaxvalue",
+ "create trigger versioned_version_trigger before insert or update on VERSIONED for each row begin select versioned_version.nextval into :new.VERSION from dual; end;" };
+ sqlGen = new OracleGenerator();
+ break;
+ }
+ }
+
+}
\ No newline at end of file
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.filter.Compare.Equal;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.query.FreeformQuery;
import com.vaadin.data.util.sqlcontainer.query.FreeformStatementDelegate;
@Before
public void setUp() throws SQLException {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
DataGenerator.addPeopleToDatabase(connectionPool);
}
Assert.assertEquals("Pelle",
container.getContainerProperty(container.firstItemId(), "NAME")
.getValue());
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(new BigDecimal(18), container
.getContainerProperty(container.firstItemId(), "AGE")
.getValue());
@Test
public void ticket6136_table_ageIs18() throws SQLException {
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
// Ville, Kalle, Pelle, Börje
Assert.assertEquals(4, container.size());
Assert.assertEquals("Pelle",
container.getContainerProperty(container.firstItemId(), "NAME")
.getValue());
- if (AllTests.db == DB.ORACLE) {
+ if (SQLTestsConstants.db == DB.ORACLE) {
Assert.assertEquals(new BigDecimal(18), container
.getContainerProperty(container.firstItemId(), "AGE")
.getValue());
public void ticket7434_getItem_Modified_Changed_Unchanged()
throws SQLException {
SQLContainer container = new SQLContainer(new TableQuery("people",
- connectionPool, AllTests.sqlGen));
+ connectionPool, SQLTestsConstants.sqlGen));
Object id = container.firstItemId();
Item item = container.getItem(id);
import org.junit.Before;
import org.junit.Test;
-import com.vaadin.data.util.sqlcontainer.AllTests;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants;
public class SimpleJDBCConnectionPoolTest {
private JDBCConnectionPool connectionPool;
@Before
public void setUp() throws SQLException {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
}
@Test
@Test(expected = IllegalArgumentException.class)
public void construct_onlyDriverNameGiven_shouldFail() throws SQLException {
SimpleJDBCConnectionPool cp = new SimpleJDBCConnectionPool(
- AllTests.dbDriver, null, null, null);
+ SQLTestsConstants.dbDriver, null, null, null);
}
@Test(expected = IllegalArgumentException.class)
public void construct_onlyDriverNameAndUrlGiven_shouldFail()
throws SQLException {
SimpleJDBCConnectionPool cp = new SimpleJDBCConnectionPool(
- AllTests.dbDriver, AllTests.dbURL, null, null);
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL, null, null);
}
@Test(expected = IllegalArgumentException.class)
public void construct_onlyDriverNameAndUrlAndUserGiven_shouldFail()
throws SQLException {
SimpleJDBCConnectionPool cp = new SimpleJDBCConnectionPool(
- AllTests.dbDriver, AllTests.dbURL, AllTests.dbUser, null);
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, null);
}
@Test(expected = RuntimeException.class)
public void construct_nonExistingDriver_shouldFail() throws SQLException {
SimpleJDBCConnectionPool cp = new SimpleJDBCConnectionPool("foo",
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd);
+ SQLTestsConstants.dbURL, SQLTestsConstants.dbUser,
+ SQLTestsConstants.dbPwd);
}
@Test
public void reserveConnection_newConnectionOpened_shouldSucceed()
throws SQLException {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 0, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 0, 2);
Connection c = connectionPool.reserveConnection();
Assert.assertNotNull(c);
}
import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Like;
import com.vaadin.data.util.filter.Or;
-import com.vaadin.data.util.sqlcontainer.AllTests;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants;
import com.vaadin.data.util.sqlcontainer.DataGenerator;
import com.vaadin.data.util.sqlcontainer.RowItem;
import com.vaadin.data.util.sqlcontainer.SQLContainer;
public void setUp() throws SQLException {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
} catch (SQLException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
* No need to run this for Oracle/MSSQL generators since the
* DefaultSQLGenerator method would be called anyway.
*/
- if (AllTests.sqlGen instanceof MSSQLGenerator
- || AllTests.sqlGen instanceof OracleGenerator) {
+ if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
+ || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
return;
}
- SQLGenerator sg = AllTests.sqlGen;
+ SQLGenerator sg = SQLTestsConstants.sqlGen;
TableQuery query = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(query);
StatementHelper sh = sg.generateDeleteQuery(
* No need to run this for Oracle/MSSQL generators since the
* DefaultSQLGenerator method would be called anyway.
*/
- if (AllTests.sqlGen instanceof MSSQLGenerator
- || AllTests.sqlGen instanceof OracleGenerator) {
+ if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
+ || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
return;
}
SQLGenerator sg = new DefaultSQLGenerator();
* No need to run this for Oracle/MSSQL generators since the
* DefaultSQLGenerator method would be called anyway.
*/
- if (AllTests.sqlGen instanceof MSSQLGenerator
- || AllTests.sqlGen instanceof OracleGenerator) {
+ if (SQLTestsConstants.sqlGen instanceof MSSQLGenerator
+ || SQLTestsConstants.sqlGen instanceof OracleGenerator) {
return;
}
SQLGenerator sg = new DefaultSQLGenerator();
import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Like;
-import com.vaadin.data.util.sqlcontainer.AllTests;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.DataGenerator;
import com.vaadin.data.util.sqlcontainer.RowId;
import com.vaadin.data.util.sqlcontainer.RowItem;
public class FreeformQueryTest {
- private static final int offset = AllTests.offset;
+ private static final int offset = SQLTestsConstants.offset;
private JDBCConnectionPool connectionPool;
@Before
public void setUp() throws SQLException {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
} catch (SQLException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
// Add some people
Connection conn = connectionPool.reserveConnection();
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Bengt', 30)");
statement.executeUpdate("insert into people values('Ingvar', 50)");
} else {
Arrays.asList("ID"), connectionPool);
FreeformQueryDelegate delegate = EasyMock
.createMock(FreeformQueryDelegate.class);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
EasyMock.expect(delegate.getQueryString(0, 2))
.andReturn(
"SELECT * FROM (SELECT row_number()"
+ "OVER (ORDER BY id ASC) AS rownum, * FROM people)"
+ " AS a WHERE a.rownum BETWEEN 0 AND 2");
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
EasyMock.expect(delegate.getQueryString(0, 2))
.andReturn(
"SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
Arrays.asList("ID"), connectionPool);
FreeformQueryDelegate delegate = EasyMock
.createMock(FreeformQueryDelegate.class);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
EasyMock.expect(delegate.getQueryString(0, 2))
.andReturn(
"SELECT * FROM (SELECT row_number()"
+ "OVER (ORDER BY id ASC) AS rownum, * FROM people)"
+ " AS a WHERE a.rownum BETWEEN 0 AND 2");
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
EasyMock.expect(delegate.getQueryString(0, 2))
.andReturn(
"SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
query.beginTransaction();
ResultSet rs = query.getResults(0, 2);
int rsoffset = 0;
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
rsoffset++;
}
Assert.assertTrue(rs.next());
Arrays.asList("ID"), connectionPool);
FreeformQueryDelegate delegate = EasyMock
.createMock(FreeformQueryDelegate.class);
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
EasyMock.expect(delegate.getQueryString(200, 100))
.andReturn(
"SELECT * FROM (SELECT row_number()"
+ "OVER (ORDER BY id ASC) AS rownum, * FROM people)"
+ " AS a WHERE a.rownum BETWEEN 201 AND 300");
- } else if (AllTests.db == DB.ORACLE) {
+ } else if (SQLTestsConstants.db == DB.ORACLE) {
EasyMock.expect(delegate.getQueryString(200, 100))
.andReturn(
"SELECT * FROM (SELECT x.*, ROWNUM AS r FROM"
import com.vaadin.data.Container.Filter;
import com.vaadin.data.util.filter.Compare.Equal;
import com.vaadin.data.util.filter.Like;
-import com.vaadin.data.util.sqlcontainer.AllTests;
-import com.vaadin.data.util.sqlcontainer.AllTests.DB;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants.DB;
import com.vaadin.data.util.sqlcontainer.DataGenerator;
import com.vaadin.data.util.sqlcontainer.OptimisticLockException;
import com.vaadin.data.util.sqlcontainer.RowItem;
import com.vaadin.data.util.sqlcontainer.query.generator.DefaultSQLGenerator;
public class TableQueryTest {
- private static final int offset = AllTests.offset;
+ private static final int offset = SQLTestsConstants.offset;
private JDBCConnectionPool connectionPool;
@Before
public void setUp() throws SQLException {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 2);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 2);
} catch (SQLException e) {
e.printStackTrace();
Assert.fail(e.getMessage());
@Test
public void construction_legalParameters_defaultGenerator_shouldSucceed() {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
Assert.assertArrayEquals(new Object[] { "ID" }, tQuery
.getPrimaryKeyColumns().toArray());
boolean correctTableName = "people".equalsIgnoreCase(tQuery
@Test
public void getCount_simpleQuery_returnsFour() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
Assert.assertEquals(4, tQuery.getCount());
}
// Add some people
Connection conn = connectionPool.reserveConnection();
Statement statement = conn.createStatement();
- if (AllTests.db == DB.MSSQL) {
+ if (SQLTestsConstants.db == DB.MSSQL) {
statement.executeUpdate("insert into people values('Bengt', 30)");
statement.executeUpdate("insert into people values('Ingvar', 50)");
} else {
connectionPool.releaseConnection(conn);
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
Assert.assertEquals(6, tQuery.getCount());
}
@Test
public void getCount_normalState_releasesConnection() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.getCount();
tQuery.getCount();
Assert.assertNotNull(connectionPool.reserveConnection());
@Test
public void getResults_simpleQuery_returnsFourRecords() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
ResultSet rs = tQuery.getResults(0, 0);
DataGenerator.addFiveThousandPeople(connectionPool);
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
ResultSet rs = tQuery.getResults(0, 0);
@Test
public void beginTransaction_readOnly_shouldSucceed() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
}
public void beginTransaction_transactionAlreadyActive_shouldFail()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
tQuery.beginTransaction();
@Test
public void commit_readOnly_shouldSucceed() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
tQuery.commit();
}
@Test
public void rollback_readOnly_shouldSucceed() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.beginTransaction();
tQuery.rollback();
}
@Test(expected = SQLException.class)
public void commit_noActiveTransaction_shouldFail() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.commit();
}
@Test(expected = SQLException.class)
public void rollback_noActiveTransaction_shouldFail() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.rollback();
}
public void containsRowWithKeys_existingKeys_returnsTrue()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
Assert.assertTrue(tQuery.containsRowWithKey(1));
}
public void containsRowWithKeys_nonexistingKeys_returnsTrue()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
Assert.assertFalse(tQuery.containsRowWithKey(1337));
}
public void containsRowWithKeys_invalidKeys_shouldFail()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
boolean b = true;
try {
b = tQuery.containsRowWithKey("foo");
public void containsRowWithKeys_nullKeys_shouldFailAndReleaseConnections()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
try {
tQuery.containsRowWithKey(new Object[] { null });
org.junit.Assert
@Test
public void setFilters_shouldReturnCorrectCount() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
List<Filter> filters = new ArrayList<Filter>();
filters.add(new Like("NAME", "%lle"));
tQuery.setFilters(filters);
public void setOrderByNameAscending_shouldReturnCorrectOrder()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
List<OrderBy> orderBys = Arrays.asList(new OrderBy("NAME", true));
tQuery.setOrderBy(orderBys);
public void setOrderByNameDescending_shouldReturnCorrectOrder()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
List<OrderBy> orderBys = Arrays.asList(new OrderBy("NAME", false));
tQuery.setOrderBy(orderBys);
@Test
public void setFilters_nullParameter_shouldSucceed() {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setFilters(null);
}
@Test
public void setOrderBy_nullParameter_shouldSucceed() {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setOrderBy(null);
}
public void removeRowThroughContainer_legalRowItem_shouldSucceed()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(tQuery);
container.setAutoCommit(false);
Assert.assertTrue(container.removeItem(container.getItemIds()
public void removeRowThroughContainer_nonexistingRowId_shouldFail()
throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(tQuery);
container.setAutoCommit(true);
@Test
public void insertRowThroughContainer_shouldSucceed() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("ID");
SQLContainer container = new SQLContainer(tQuery);
@Test
public void modifyRowThroughContainer_shouldSucceed() throws SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
// In this test the primary key is used as a version column
tQuery.setVersionColumn("ID");
public void storeRow_noVersionColumn_shouldSucceed()
throws UnsupportedOperationException, SQLException {
TableQuery tQuery = new TableQuery("people", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
SQLContainer container = new SQLContainer(tQuery);
Object id = container.addItem();
RowItem row = (RowItem) container.getItem(id);
DataGenerator.addVersionedData(connectionPool);
TableQuery tQuery = new TableQuery("versioned", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("VERSION");
SQLContainer container = new SQLContainer(tQuery);
RowItem row = (RowItem) container.getItem(container.firstItemId());
@Test(expected = OptimisticLockException.class)
public void storeRow_versionSetAndLessThanDBValue_shouldThrowException()
throws SQLException {
- if (AllTests.db == DB.HSQLDB) {
+ if (SQLTestsConstants.db == DB.HSQLDB) {
throw new OptimisticLockException(
"HSQLDB doesn't support row versioning for optimistic locking - don't run this test.",
null);
DataGenerator.addVersionedData(connectionPool);
TableQuery tQuery = new TableQuery("versioned", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("VERSION");
SQLContainer container = new SQLContainer(tQuery);
RowItem row = (RowItem) container.getItem(container.firstItemId());
DataGenerator.addVersionedData(connectionPool);
TableQuery tQuery = new TableQuery("versioned", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("VERSION");
SQLContainer container = new SQLContainer(tQuery);
RowItem row = (RowItem) container.getItem(container.firstItemId());
@Test(expected = OptimisticLockException.class)
public void removeRow_versionSetAndLessThanDBValue_shouldThrowException()
throws SQLException {
- if (AllTests.db == AllTests.DB.HSQLDB) {
+ if (SQLTestsConstants.db == SQLTestsConstants.DB.HSQLDB) {
// HSQLDB doesn't support versioning, so this is to make the test
// green.
throw new OptimisticLockException(null);
DataGenerator.addVersionedData(connectionPool);
TableQuery tQuery = new TableQuery("versioned", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("VERSION");
SQLContainer container = new SQLContainer(tQuery);
RowItem row = (RowItem) container.getItem(container.firstItemId());
@Test
public void removeRow_throwsOptimisticLockException_shouldStillWork()
throws SQLException {
- if (AllTests.db == AllTests.DB.HSQLDB) {
+ if (SQLTestsConstants.db == SQLTestsConstants.DB.HSQLDB) {
// HSQLDB doesn't support versioning, so this is to make the test
// green.
return;
DataGenerator.addVersionedData(connectionPool);
TableQuery tQuery = new TableQuery("versioned", connectionPool,
- AllTests.sqlGen);
+ SQLTestsConstants.sqlGen);
tQuery.setVersionColumn("VERSION");
SQLContainer container = new SQLContainer(tQuery);
RowItem row = (RowItem) container.getItem(container.firstItemId());
<target name="publish-local" depends="jar">
<antcall target="common.publish-local" />
</target>
+
<target name="clean">
- <antcall target="common.clean">
- </antcall>
+ <antcall target="common.clean"/>
+ </target>
+
+ <target name="tests">
+ <!--<antcall target="common.tests.run" />-->
+ <echo>WHAT? No tests for ${module.name}!</echo>
</target>
+
</project>
\ No newline at end of file
<conf name="build" />
<conf name="build-provided" />
<conf name="ide" />
+ <conf name="tests" />
</configurations>
<publications>
<artifact></artifact>
<dependency org="com.vaadin" name="vaadin-buildhelpers"
rev="${vaadin.version}" conf="build"></dependency>
<dependency org="junit" name="junit" rev="4.5"
- conf="tests -> master" />
+ conf="tests -> default" />
<dependency org="net.sourceforge.cssparser" name="cssparser"
- rev="0.9.5" conf="tests,ide->master" />
+ rev="0.9.5" conf="tests,ide->default" />
</dependencies>
</ivy-module>
--- /dev/null
+<?xml version="1.0"?>
+
+<project name="vaadin-uitest" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+ <description>
+ Provides a uitest WAR containing Vaadin UI tests
+ </description>
+ <include file="../common.xml" as="common" />
+ <include file="../build.xml" as="vaadin" />
+
+ <!-- global properties -->
+ <property name="module.name" value="vaadin-uitest" />
+ <property name="result.dir" value="result" />
+
+ <path id="classpath.compile.custom">
+ </path>
+
+ <target name="dependencies">
+ <!-- This is copied from common.xml to be able to add server.tests.source to the source path -->
+
+ <ivy:resolve resolveid="common" conf="build, build-provided" />
+ <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
+ </target>
+
+ <target name="compile" description="Compiles the module" depends="dependencies">
+
+ <fail unless="module.name" message="No module name given" />
+ <property name="result.dir" location="result" />
+ <property name="src" location="${result.dir}/../src" />
+ <property name="classes" location="${result.dir}/classes" />
+ <property name="server.tests.sources" location="${result.dir}/../../server/tests/src" />
+ <mkdir dir="${classes}" />
+
+ <!-- TODO: Get rid of this -->
+ <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
+ <src path="${server.tests.sources}" />
+ <include name="com/vaadin/tests/data/bean/**" />
+ <include name="com/vaadin/tests/VaadinClasses.java" />
+ <include name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" />
+ <classpath refid="classpath.compile.dependencies" />
+ <classpath refid="classpath.compile.custom" />
+ </javac>
+
+ <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
+ <src path="${src}" />
+ <classpath location="${classes}" />
+ <classpath refid="classpath.compile.dependencies" />
+ <classpath refid="classpath.compile.custom" />
+ </javac>
+ </target>
+
+ <target name="war" depends="compile, dependencies">
+ <property name="result.dir" location="result" />
+ <property name="classes" location="${result.dir}/classes" />
+ <property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
+ <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
+ <property name="deps.dir" location="${result.dir}/deps" />
+
+
+ <mkdir dir="${deps.dir}" />
+ <copy todir="${deps.dir}" flatten="true">
+ <path refid="classpath.compile.dependencies" />
+ </copy>
+
+ <war destfile="${result.war}" duplicate="fail" index="true">
+ <fileset refid="common.files.for.all.jars" />
+ <fileset dir="${WebContent.dir}">
+ <include name="statictestfiles/**" />
+ <include name="WEB-INF/*.xml" />
+ </fileset>
+ <classes dir="${classes}" />
+ <lib dir="${deps.dir}" />
+ </war>
+
+ </target>
+
+ <target name="publish-local" depends="war">
+ <antcall target="common.publish-local" />
+ </target>
+
+ <target name="clean">
+ <antcall target="common.clean" />
+ </target>
+ <target name="tests">
+ <!--<antcall target="common.tests.run" />-->
+ <echo>WHAT? No JUnit tests for ${module.name}!</echo>
+ </target>
+</project>
\ No newline at end of file
-<ivy-module version="2.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation= "http://ant.apache.org/ivy/schemas/ivy.xsd">
-
- <info organisation="com.vaadin" module="vaadin-uitests"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+ <info organisation="com.vaadin" module="vaadin-uitest"
+ revision="${vaadin.version}" />
+
<configurations>
- <conf name="jetty" visibility="private" />
- <conf name="emma" visibility="private" />
- <conf name="server" visibility="private" />
- </configurations>
- <publications />
- <dependencies>
- <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.7" conf="server,jetty->default(*)" />
- <dependency org="emma" name="emma" rev="2.0.5312-patched" conf="server,emma -> default(*)"/>
- </dependencies>
-</ivy-module>
\ No newline at end of file
+ <conf name="build" />
+ <conf name="build-provided" />
+ <conf name="ide" />
+ </configurations>
+ <publications>
+ <artifact type="war" />
+ </publications>
+ <dependencies defaultconf="build" defaultconfmapping="build,ide->default">
+ <!-- API DEPENDENCIES -->
+ <dependency org="javax.portlet" name="portlet-api"
+ rev="2.0" conf="build-provided,ide -> default" />
+
+ <dependency org="javax.validation" name="validation-api"
+ rev="1.0.0.GA" conf="build-provided,ide -> default" />
+ <!--Servlet API version 2.5 -->
+ <dependency org="javax.servlet" name="servlet-api"
+ rev="2.5" conf="build-provided,ide -> default" />
+ <!-- Google App Engine -->
+ <dependency org="com.google.appengine" name="appengine-api-1.0-sdk"
+ rev="1.2.1" conf="build-provided,ide -> default" />
+
+ <!-- LIBRARY DEPENDENCIES (compile time) -->
+ <!-- Project modules -->
+ <dependency org="com.vaadin" name="vaadin-server"
+ rev="${vaadin.version}" conf="build->build"></dependency>
+ <dependency org="com.vaadin" name="vaadin-client"
+ rev="${vaadin.version}" conf="build->build"></dependency>
+<!-- <dependency org="com.vaadin" name="vaadin-client-compiled"
+ rev="${vaadin.version}" conf="build->build"></dependency>
+ <dependency org="com.vaadin" name="vaadin-theme-compiled"
+ rev="${vaadin.version}" conf="build->build"></dependency>
+-->
+ <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11"
+ conf="build,ide->default" />
+ <dependency org="org.mortbay.jetty" name="jetty-util"
+ rev="6.1.11" conf="build,ide->default" />
+ <dependency org="junit" name="junit" rev="4.5"
+ conf="build,ide -> default" />
+
+ <dependency org="commons-codec" name="commons-codec"
+ rev="1.5" conf="build,ide->default" />
+ <dependency org="commons-io" name="commons-io" rev="1.4"
+ conf="build,ide->default" />
+
+ </dependencies>
+
+</ivy-module>
import java.sql.SQLException;
import java.sql.Statement;
-import com.vaadin.data.util.sqlcontainer.AllTests;
+import com.vaadin.data.util.sqlcontainer.SQLTestsConstants;
import com.vaadin.data.util.sqlcontainer.SQLContainer;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
// Will fail if table doesn't exist, which is OK.
conn.rollback();
}
- switch (AllTests.db) {
+ switch (SQLTestsConstants.db) {
case HSQLDB:
statement
.execute("create table "
private void initConnectionPool() {
try {
- connectionPool = new SimpleJDBCConnectionPool(AllTests.dbDriver,
- AllTests.dbURL, AllTests.dbUser, AllTests.dbPwd, 2, 5);
+ connectionPool = new SimpleJDBCConnectionPool(
+ SQLTestsConstants.dbDriver, SQLTestsConstants.dbURL,
+ SQLTestsConstants.dbUser, SQLTestsConstants.dbPwd, 2, 5);
} catch (SQLException e) {
e.printStackTrace();
}
<property name="webroot" value="${testing.testarea}/${package.name}/WebContent"></property>
<ivy:resolve file="ivy.xml"/>
- <ivy:cachepath pathid="server" conf="server" />
+ <ivy:cachepath pathid="server" conf="build" />
<java classname="com.vaadin.launcher.DemoLauncher" fork="yes" dir="${testing.testarea}/${package.name}" resultproperty="server.start.result">
<arg value="--nogui=1" />
<classpath>