View Javadoc
1   /*
2    * Copyright 2002-2016 the original author or authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.github.springtestdbunit.annotation;
18  
19  /**
20   * Database test operations that can be performed to configure database tables.
21   *
22   * @see DatabaseSetup
23   * @see DatabaseTearDown
24   *
25   * @author Phillip Webb
26   */
27  public enum DatabaseOperation {
28  
29  	/**
30  	 * Updates the contents of existing database tables from the dataset.
31  	 */
32  	UPDATE,
33  
34  	/**
35  	 * Inserts new database tables and contents from the dataset.
36  	 */
37  	INSERT,
38  
39  	/**
40  	 * Refresh the contents of existing database tables. Rows from the dataset will insert or replace existing data. Any
41  	 * database rows that are not in the dataset remain unaffected.
42  	 */
43  	REFRESH,
44  
45  	/**
46  	 * Deletes database table rows that matches rows from the dataset.
47  	 */
48  	DELETE,
49  
50  	/**
51  	 * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
52  	 * in the dataset remain unaffected.
53  	 * @see #TRUNCATE_TABLE
54  	 */
55  	DELETE_ALL,
56  
57  	/**
58  	 * Deletes all rows from a database table when the table is specified in the dataset. Tables in the database but not
59  	 * in the dataset are unaffected. Identical to {@link #DELETE_ALL} expect this operation cannot be rolled back and
60  	 * is supported by less database vendors.
61  	 * @see #DELETE_ALL
62  	 */
63  	TRUNCATE_TABLE,
64  
65  	/**
66  	 * Deletes all rows from a database table when the tables is specified in the dataset and subsequently insert new
67  	 * contents. Equivalent to calling {@link #DELETE_ALL} followed by {@link #INSERT}.
68  	 */
69  	CLEAN_INSERT;
70  
71  }