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: TestCreateSequenceH2.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 TestCreateSequenceH2 extends TestCreateSequence {
13: public TestCreateSequenceH2(String name) {
14: super (name);
15: }
16:
17: public void testInstantiationH2() {
18: CreateSequence query = new CreateSequence(mH2);
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 testClearH2() {
29: CreateSequence query = new CreateSequence(mH2);
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 testCreateH2() {
42: CreateSequence query = new CreateSequence(mH2);
43: query.name("sequencename");
44: assertEquals(query.getSql(), "CREATE SEQUENCE sequencename");
45: execute(mH2, query);
46: }
47:
48: public void testCloneH2() {
49: CreateSequence query = new CreateSequence(mH2);
50: query.name("sequencename");
51: CreateSequence query_clone = query.clone();
52: assertEquals(query.getSql(), query_clone.getSql());
53: assertTrue(query != query_clone);
54: execute(mH2, query_clone);
55: }
56: }
|