001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: TestSequenceValueMysql.java 3634 2007-01-08 21:42:24Z gbevin $
007: */
008: package com.uwyn.rife.database.queries;
009:
010: import com.uwyn.rife.database.exceptions.SequenceNameRequiredException;
011: import com.uwyn.rife.database.exceptions.SequenceOperationRequiredException;
012: import com.uwyn.rife.database.exceptions.UnsupportedSqlFeatureException;
013:
014: public class TestSequenceValueMysql extends TestSequenceValue {
015: public TestSequenceValueMysql(String name) {
016: super (name);
017: }
018:
019: public void testInstantiationMysql() {
020: SequenceValue query = new SequenceValue(mMysql);
021: assertNotNull(query);
022: try {
023: query.getSql();
024: fail();
025: } catch (SequenceNameRequiredException e) {
026: assertEquals(e.getQueryName(), "SequenceValue");
027: }
028: }
029:
030: public void testInvalidMysql() {
031: SequenceValue query = new SequenceValue(mMysql);
032: try {
033: query.getSql();
034: fail();
035: } catch (SequenceNameRequiredException e) {
036: assertEquals(e.getQueryName(), "SequenceValue");
037: }
038: query.name("sequencename");
039: try {
040: query.getSql();
041: fail();
042: } catch (SequenceOperationRequiredException e) {
043: assertEquals(e.getQueryName(), "SequenceValue");
044: }
045: query.clear();
046: query.next();
047: try {
048: query.getSql();
049: fail();
050: } catch (SequenceNameRequiredException e) {
051: assertEquals(e.getQueryName(), "SequenceValue");
052: }
053: query.clear();
054: }
055:
056: public void testClearMysql() {
057: SequenceValue query = new SequenceValue(mMysql);
058: query.name("sequencename").next();
059: try {
060: query.getSql();
061: fail();
062: } catch (UnsupportedSqlFeatureException e) {
063: assertTrue(true);
064: }
065: query.clear();
066: try {
067: query.getSql();
068: fail();
069: } catch (SequenceNameRequiredException e) {
070: assertEquals(e.getQueryName(), "SequenceValue");
071: }
072: }
073:
074: public void testNextMysql() {
075: SequenceValue query = new SequenceValue(mMysql);
076: query.name("sequencename").next();
077: try {
078: query.getSql();
079: fail();
080: } catch (UnsupportedSqlFeatureException e) {
081: assertTrue(true);
082: }
083: }
084:
085: public void testCurrentMysql() {
086: SequenceValue query = new SequenceValue(mMysql);
087: query.name("sequencename").current();
088: try {
089: query.getSql();
090: fail();
091: } catch (UnsupportedSqlFeatureException e) {
092: assertTrue(true);
093: }
094: }
095:
096: public void testCloneMysql() {
097: SequenceValue query = new SequenceValue(mMysql);
098: query.name("sequencename").next();
099: SequenceValue query_clone = query.clone();
100: try {
101: query_clone.getSql();
102: fail();
103: } catch (UnsupportedSqlFeatureException e) {
104: assertTrue(true);
105: }
106: }
107: }
|