01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: TestCreateSequenceDaffodil.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.database.queries;
09:
10: import com.uwyn.rife.database.exceptions.SequenceNameRequiredException;
11:
12: public class TestCreateSequenceDaffodil extends TestCreateSequence {
13: public TestCreateSequenceDaffodil(String name) {
14: super (name);
15: }
16:
17: public void testInstantiationDaffodil() {
18: CreateSequence query = new CreateSequence(mDaffodil);
19: assertNotNull(query);
20: try {
21: query.getSql();
22: fail();
23: } catch (SequenceNameRequiredException e) {
24: assertEquals(e.getQueryName(), "CreateSequence");
25: }
26: }
27:
28: public void testClearDaffodil() {
29: CreateSequence query = new CreateSequence(mDaffodil);
30: query.name("sequencename");
31: assertNotNull(query.getSql());
32: query.clear();
33: try {
34: query.getSql();
35: fail();
36: } catch (SequenceNameRequiredException e) {
37: assertEquals(e.getQueryName(), "CreateSequence");
38: }
39: }
40:
41: public void testCreateDaffodil() {
42: CreateSequence query = new CreateSequence(mDaffodil);
43: query.name("sequencename");
44: assertEquals(query.getSql(), "CREATE SEQUENCE sequencename");
45: execute(mDaffodil, query);
46: }
47:
48: public void testCloneDaffodil() {
49: CreateSequence query = new CreateSequence(mDaffodil);
50: query.name("sequencename");
51: CreateSequence query_clone = query.clone();
52: assertEquals(query.getSql(), query_clone.getSql());
53: assertTrue(query != query_clone);
54: execute(mDaffodil, query_clone);
55: }
56: }
|